diff --git a/dom/base/nsGlobalWindow.cpp b/dom/base/nsGlobalWindow.cpp index 88b91a031279..2d900ab8d5f1 100644 --- a/dom/base/nsGlobalWindow.cpp +++ b/dom/base/nsGlobalWindow.cpp @@ -11896,7 +11896,7 @@ nsGlobalWindow::OpenInternal(const nsAString& aUrl, const nsAString& aName, rv = pwwatch->OpenWindow2(AsOuter(), url.get(), name_ptr, options_ptr, /* aCalledFromScript = */ true, aDialog, aNavigate, argv, - 1.0f, 0, getter_AddRefs(domReturn)); + getter_AddRefs(domReturn)); } else { // Force a system caller here so that the window watcher won't screw us // up. We do NOT want this case looking at the JS context on the stack @@ -11916,7 +11916,7 @@ nsGlobalWindow::OpenInternal(const nsAString& aUrl, const nsAString& aName, rv = pwwatch->OpenWindow2(AsOuter(), url.get(), name_ptr, options_ptr, /* aCalledFromScript = */ false, aDialog, aNavigate, aExtraArgument, - 1.0f, 0, getter_AddRefs(domReturn)); + getter_AddRefs(domReturn)); } } diff --git a/dom/workers/ServiceWorkerClients.cpp b/dom/workers/ServiceWorkerClients.cpp index ba8aca79a6d5..565287943bf5 100644 --- a/dom/workers/ServiceWorkerClients.cpp +++ b/dom/workers/ServiceWorkerClients.cpp @@ -606,7 +606,7 @@ private: spec.get(), nullptr, nullptr, - false, false, true, nullptr, 1.0f, 0, + false, false, true, nullptr, getter_AddRefs(newWindow)); nsCOMPtr pwindow = nsPIDOMWindowOuter::From(newWindow); pwindow.forget(aWindow); diff --git a/embedding/components/windowwatcher/nsPIWindowWatcher.idl b/embedding/components/windowwatcher/nsPIWindowWatcher.idl index 2c8be6044afd..825c80428f6a 100644 --- a/embedding/components/windowwatcher/nsPIWindowWatcher.idl +++ b/embedding/components/windowwatcher/nsPIWindowWatcher.idl @@ -55,9 +55,6 @@ interface nsPIWindowWatcher : nsISupports @param aNavigate true if we should navigate the new window to the specified URL. @param aArgs Window argument - @param aOpenerFullZoom the full zoom multiplier for the opener window. - this can be null in the single process case where - the opener full zoom is obtained from aParent. @return the new window @note This method may examine the JS context stack for purposes of @@ -68,14 +65,12 @@ interface nsPIWindowWatcher : nsISupports (which is determined based on the JS stack and the value of aParent). This is not guaranteed, however. */ - [optional_argc] mozIDOMWindowProxy openWindow2(in mozIDOMWindowProxy aParent, in string aUrl, in string aName, in string aFeatures, in boolean aCalledFromScript, in boolean aDialog, in boolean aNavigate, - in nsISupports aArgs, - [optional] in float aOpenerFullZoom); + in nsISupports aArgs); /** * Opens a new window using the most recent non-private browser diff --git a/embedding/components/windowwatcher/nsWindowWatcher.cpp b/embedding/components/windowwatcher/nsWindowWatcher.cpp index 82b50d054bc2..09bce49823be 100644 --- a/embedding/components/windowwatcher/nsWindowWatcher.cpp +++ b/embedding/components/windowwatcher/nsWindowWatcher.cpp @@ -371,8 +371,7 @@ nsWindowWatcher::OpenWindow(mozIDOMWindowProxy* aParent, return OpenWindowInternal(aParent, aUrl, aName, aFeatures, /* calledFromJS = */ false, dialog, - /* navigate = */ true, argv, - /* openerFullZoom = */ nullptr, aResult); + /* navigate = */ true, argv, aResult); } struct SizeSpec @@ -435,8 +434,6 @@ nsWindowWatcher::OpenWindow2(mozIDOMWindowProxy* aParent, bool aDialog, bool aNavigate, nsISupports* aArguments, - float aOpenerFullZoom, - uint8_t aOptionalArgc, mozIDOMWindowProxy** aResult) { nsCOMPtr argv = ConvertArgsToArray(aArguments); @@ -457,7 +454,6 @@ nsWindowWatcher::OpenWindow2(mozIDOMWindowProxy* aParent, return OpenWindowInternal(aParent, aUrl, aName, aFeatures, aCalledFromScript, dialog, aNavigate, argv, - aOptionalArgc >= 1 ? &aOpenerFullZoom : nullptr, aResult); } @@ -673,7 +669,7 @@ nsWindowWatcher::OpenWindowWithTabParent(nsITabParent* aOpeningTabParent, SizeSpec sizeSpec; CalcSizeSpec(aFeatures, sizeSpec); SizeOpenedWindow(chromeTreeOwner, parentWindowOuter, false, sizeSpec, - &aOpenerFullZoom); + Some(aOpenerFullZoom)); nsCOMPtr newTabParent; chromeTreeOwner->GetPrimaryTabParent(getter_AddRefs(newTabParent)); @@ -694,7 +690,6 @@ nsWindowWatcher::OpenWindowInternal(mozIDOMWindowProxy* aParent, bool aDialog, bool aNavigate, nsIArray* aArgv, - float* aOpenerFullZoom, mozIDOMWindowProxy** aResult) { nsresult rv = NS_OK; @@ -1254,8 +1249,7 @@ nsWindowWatcher::OpenWindowInternal(mozIDOMWindowProxy* aParent, if (isNewToplevelWindow) { nsCOMPtr newTreeOwner; newDocShellItem->GetTreeOwner(getter_AddRefs(newTreeOwner)); - SizeOpenedWindow(newTreeOwner, aParent, isCallerChrome, sizeSpec, - aOpenerFullZoom); + SizeOpenedWindow(newTreeOwner, aParent, isCallerChrome, sizeSpec); } // XXXbz isn't windowIsModal always true when windowIsModalContentDialog? @@ -2273,21 +2267,20 @@ nsWindowWatcher::CalcSizeSpec(const nsACString& aFeatures, SizeSpec& aResult) The top-level nsIDocShellTreeOwner of the newly opened window. @param aParent (optional) The parent window from which to inherit zoom factors from if - aOpenerFullZoom isn't passed. + aOpenerFullZoom is none. @param aIsCallerChrome True if the code requesting the new window is privileged. @param aSizeSpec The size that the new window should be. @param aOpenerFullZoom - An optional pointer to a zoom factor to scale the content - to. + If not nothing, a zoom factor to scale the content to. */ void nsWindowWatcher::SizeOpenedWindow(nsIDocShellTreeOwner* aTreeOwner, mozIDOMWindowProxy* aParent, bool aIsCallerChrome, const SizeSpec& aSizeSpec, - float* aOpenerFullZoom) + Maybe aOpenerFullZoom) { // We should only be sizing top-level windows if we're in the parent // process. @@ -2306,8 +2299,8 @@ nsWindowWatcher::SizeOpenedWindow(nsIDocShellTreeOwner* aTreeOwner, return; } - double openerZoom = aOpenerFullZoom ? *aOpenerFullZoom : 1.0; - if (aParent && !aOpenerFullZoom) { + double openerZoom = aOpenerFullZoom.valueOr(1.0); + if (aParent && aOpenerFullZoom.isNothing()) { nsCOMPtr piWindow = nsPIDOMWindowOuter::From(aParent); if (nsIDocument* doc = piWindow->GetDoc()) { if (nsIPresShell* shell = doc->GetShell()) { diff --git a/embedding/components/windowwatcher/nsWindowWatcher.h b/embedding/components/windowwatcher/nsWindowWatcher.h index ba402e75044d..d5947b79d588 100644 --- a/embedding/components/windowwatcher/nsWindowWatcher.h +++ b/embedding/components/windowwatcher/nsWindowWatcher.h @@ -13,6 +13,7 @@ #include "nsCOMPtr.h" #include "mozilla/Mutex.h" +#include "mozilla/Maybe.h" #include "nsIWindowCreator.h" // for stupid compilers #include "nsIWindowWatcher.h" #include "nsIPromptFactory.h" @@ -83,7 +84,6 @@ protected: bool aDialog, bool aNavigate, nsIArray* aArgv, - float* aOpenerFullZoom, mozIDOMWindowProxy** aResult); static nsresult URIfromURL(const char* aURL, @@ -111,7 +111,8 @@ protected: mozIDOMWindowProxy* aParent, bool aIsCallerChrome, const SizeSpec& aSizeSpec, - float* aOpenerFullZoom); + mozilla::Maybe aOpenerFullZoom = + mozilla::Nothing()); static void GetWindowTreeItem(mozIDOMWindowProxy* aWindow, nsIDocShellTreeItem** aResult); static void GetWindowTreeOwner(nsPIDOMWindowOuter* aWindow,