diff --git a/atom/browser/api/atom_api_web_contents.cc b/atom/browser/api/atom_api_web_contents.cc index 0fab6128332c..94e03b19b968 100644 --- a/atom/browser/api/atom_api_web_contents.cc +++ b/atom/browser/api/atom_api_web_contents.cc @@ -1854,7 +1854,7 @@ void WebContents::SetZoomLevel(double level) { zoom_controller_->SetZoomLevel(level); } -double WebContents::GetZoomLevel() { +double WebContents::GetZoomLevel() const { return zoom_controller_->GetZoomLevel(); } @@ -1863,7 +1863,7 @@ void WebContents::SetZoomFactor(double factor) { SetZoomLevel(level); } -double WebContents::GetZoomFactor() { +double WebContents::GetZoomFactor() const { auto level = GetZoomLevel(); return content::ZoomLevelToZoomFactor(level); } @@ -1884,22 +1884,23 @@ void WebContents::OnGetZoomLevel(content::RenderFrameHost* rfh, rfh->Send(reply_msg); } -v8::Local WebContents::GetWebPreferences(v8::Isolate* isolate) { +v8::Local WebContents::GetWebPreferences( + v8::Isolate* isolate) const { auto* web_preferences = WebContentsPreferences::From(web_contents()); if (!web_preferences) return v8::Null(isolate); return mate::ConvertToV8(isolate, *web_preferences->preference()); } -v8::Local WebContents::GetLastWebPreferences(v8::Isolate* isolate) { - WebContentsPreferences* web_preferences = - WebContentsPreferences::FromWebContents(web_contents()); +v8::Local WebContents::GetLastWebPreferences( + v8::Isolate* isolate) const { + auto* web_preferences = WebContentsPreferences::From(web_contents()); if (!web_preferences) return v8::Null(isolate); return mate::ConvertToV8(isolate, *web_preferences->last_preference()); } -v8::Local WebContents::GetOwnerBrowserWindow() { +v8::Local WebContents::GetOwnerBrowserWindow() const { if (owner_window()) return BrowserWindow::From(isolate(), owner_window()); else diff --git a/atom/browser/api/atom_api_web_contents.h b/atom/browser/api/atom_api_web_contents.h index b6d939307ea3..bb90a9ee498c 100644 --- a/atom/browser/api/atom_api_web_contents.h +++ b/atom/browser/api/atom_api_web_contents.h @@ -213,9 +213,9 @@ class WebContents : public mate::TrackableObject, // Methods for zoom handling. void SetZoomLevel(double level); - double GetZoomLevel(); + double GetZoomLevel() const; void SetZoomFactor(double factor); - double GetZoomFactor(); + double GetZoomFactor() const; // Callback triggered on permission response. void OnEnterFullscreenModeForTab(content::WebContents* source, @@ -231,11 +231,11 @@ class WebContents : public mate::TrackableObject, const scoped_refptr& body); // Returns the web preferences of current WebContents. - v8::Local GetWebPreferences(v8::Isolate* isolate); - v8::Local GetLastWebPreferences(v8::Isolate* isolate); + v8::Local GetWebPreferences(v8::Isolate* isolate) const; + v8::Local GetLastWebPreferences(v8::Isolate* isolate) const; // Returns the owner window. - v8::Local GetOwnerBrowserWindow(); + v8::Local GetOwnerBrowserWindow() const; // Grants the child process the capability to access URLs with the origin of // the specified URL. diff --git a/atom/common/options_switches.cc b/atom/common/options_switches.cc index fd5ae7c83d6e..17a8800d24f5 100644 --- a/atom/common/options_switches.cc +++ b/atom/common/options_switches.cc @@ -191,7 +191,6 @@ const char kAppPath[] = "app-path"; // The command line switch versions of the options. const char kBackgroundColor[] = "background-color"; const char kPreloadScript[] = "preload"; -const char kPreloadURL[] = "preload-url"; const char kPreloadScripts[] = "preload-scripts"; const char kNodeIntegration[] = "node-integration"; const char kContextIsolation[] = "context-isolation"; diff --git a/atom/common/options_switches.h b/atom/common/options_switches.h index 988defce9f5a..387b11d8d657 100644 --- a/atom/common/options_switches.h +++ b/atom/common/options_switches.h @@ -95,7 +95,6 @@ extern const char kAppPath[]; extern const char kBackgroundColor[]; extern const char kPreloadScript[]; -extern const char kPreloadURL[]; extern const char kPreloadScripts[]; extern const char kNodeIntegration[]; extern const char kContextIsolation[]; diff --git a/lib/browser/guest-window-manager.js b/lib/browser/guest-window-manager.js index 8e2aa3bb9882..a6effeea8877 100644 --- a/lib/browser/guest-window-manager.js +++ b/lib/browser/guest-window-manager.js @@ -63,8 +63,9 @@ const mergeBrowserWindowOptions = function (embedder, options) { } // Inherit certain option values from parent window + const webPreferences = embedder.getLastWebPreferences() for (const [name, value] of inheritedWebPreferences) { - if (embedder.getLastWebPreferences()[name] === value) { + if (webPreferences[name] === value) { options.webPreferences[name] = value } }