forked from mirrors/gecko-dev
Bug 1701001 - Part 1: Standardize the condition for opening popup from window.open. r=smaug
Removed "width" feature from the popup condition, and removed related parameters (aWidthSpecified, and aSizeSpec) from functions. Also added "popup" feature that explicitly specify whether to request popup or not. This is only for content context, and it behaves differently than existing "popup" feature for chrome context that makes the window no-style. Differential Revision: https://phabricator.services.mozilla.com/D129410
This commit is contained in:
parent
1569812676
commit
f11f62dcaf
11 changed files with 72 additions and 94 deletions
|
|
@ -816,9 +816,9 @@ BrowserChild::GetInterface(const nsIID& aIID, void** aSink) {
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
BrowserChild::ProvideWindow(nsIOpenWindowInfo* aOpenWindowInfo,
|
BrowserChild::ProvideWindow(nsIOpenWindowInfo* aOpenWindowInfo,
|
||||||
uint32_t aChromeFlags, bool aCalledFromJS,
|
uint32_t aChromeFlags, bool aCalledFromJS,
|
||||||
bool aWidthSpecified, nsIURI* aURI,
|
nsIURI* aURI, const nsAString& aName,
|
||||||
const nsAString& aName, const nsACString& aFeatures,
|
const nsACString& aFeatures, bool aForceNoOpener,
|
||||||
bool aForceNoOpener, bool aForceNoReferrer,
|
bool aForceNoReferrer,
|
||||||
nsDocShellLoadState* aLoadState, bool* aWindowIsNew,
|
nsDocShellLoadState* aLoadState, bool* aWindowIsNew,
|
||||||
BrowsingContext** aReturn) {
|
BrowsingContext** aReturn) {
|
||||||
*aReturn = nullptr;
|
*aReturn = nullptr;
|
||||||
|
|
@ -826,7 +826,7 @@ BrowserChild::ProvideWindow(nsIOpenWindowInfo* aOpenWindowInfo,
|
||||||
RefPtr<BrowsingContext> parent = aOpenWindowInfo->GetParent();
|
RefPtr<BrowsingContext> parent = aOpenWindowInfo->GetParent();
|
||||||
|
|
||||||
int32_t openLocation = nsWindowWatcher::GetWindowOpenLocation(
|
int32_t openLocation = nsWindowWatcher::GetWindowOpenLocation(
|
||||||
parent->GetDOMWindow(), aChromeFlags, aCalledFromJS, aWidthSpecified,
|
parent->GetDOMWindow(), aChromeFlags, aCalledFromJS,
|
||||||
aOpenWindowInfo->GetIsForPrinting());
|
aOpenWindowInfo->GetIsForPrinting());
|
||||||
|
|
||||||
// If it turns out we're opening in the current browser, just hand over the
|
// If it turns out we're opening in the current browser, just hand over the
|
||||||
|
|
@ -849,9 +849,9 @@ BrowserChild::ProvideWindow(nsIOpenWindowInfo* aOpenWindowInfo,
|
||||||
// code back to our caller.
|
// code back to our caller.
|
||||||
ContentChild* cc = ContentChild::GetSingleton();
|
ContentChild* cc = ContentChild::GetSingleton();
|
||||||
return cc->ProvideWindowCommon(this, aOpenWindowInfo, aChromeFlags,
|
return cc->ProvideWindowCommon(this, aOpenWindowInfo, aChromeFlags,
|
||||||
aCalledFromJS, aWidthSpecified, aURI, aName,
|
aCalledFromJS, aURI, aName, aFeatures,
|
||||||
aFeatures, aForceNoOpener, aForceNoReferrer,
|
aForceNoOpener, aForceNoReferrer, aLoadState,
|
||||||
aLoadState, aWindowIsNew, aReturn);
|
aWindowIsNew, aReturn);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BrowserChild::DestroyWindow() {
|
void BrowserChild::DestroyWindow() {
|
||||||
|
|
|
||||||
|
|
@ -966,10 +966,10 @@ static nsresult GetCreateWindowParams(nsIOpenWindowInfo* aOpenWindowInfo,
|
||||||
|
|
||||||
nsresult ContentChild::ProvideWindowCommon(
|
nsresult ContentChild::ProvideWindowCommon(
|
||||||
BrowserChild* aTabOpener, nsIOpenWindowInfo* aOpenWindowInfo,
|
BrowserChild* aTabOpener, nsIOpenWindowInfo* aOpenWindowInfo,
|
||||||
uint32_t aChromeFlags, bool aCalledFromJS, bool aWidthSpecified,
|
uint32_t aChromeFlags, bool aCalledFromJS, nsIURI* aURI,
|
||||||
nsIURI* aURI, const nsAString& aName, const nsACString& aFeatures,
|
const nsAString& aName, const nsACString& aFeatures, bool aForceNoOpener,
|
||||||
bool aForceNoOpener, bool aForceNoReferrer, nsDocShellLoadState* aLoadState,
|
bool aForceNoReferrer, nsDocShellLoadState* aLoadState, bool* aWindowIsNew,
|
||||||
bool* aWindowIsNew, BrowsingContext** aReturn) {
|
BrowsingContext** aReturn) {
|
||||||
MOZ_DIAGNOSTIC_ASSERT(aTabOpener, "We must have a tab opener");
|
MOZ_DIAGNOSTIC_ASSERT(aTabOpener, "We must have a tab opener");
|
||||||
|
|
||||||
*aReturn = nullptr;
|
*aReturn = nullptr;
|
||||||
|
|
@ -1037,9 +1037,9 @@ nsresult ContentChild::ProvideWindowCommon(
|
||||||
MOZ_DIAGNOSTIC_ASSERT(!nsContentUtils::IsSpecialName(name));
|
MOZ_DIAGNOSTIC_ASSERT(!nsContentUtils::IsSpecialName(name));
|
||||||
|
|
||||||
Unused << SendCreateWindowInDifferentProcess(
|
Unused << SendCreateWindowInDifferentProcess(
|
||||||
aTabOpener, parent, aChromeFlags, aCalledFromJS, aWidthSpecified,
|
aTabOpener, parent, aChromeFlags, aCalledFromJS, aURI, features,
|
||||||
aURI, features, fullZoom, name, triggeringPrincipal, csp,
|
fullZoom, name, triggeringPrincipal, csp, referrerInfo,
|
||||||
referrerInfo, aOpenWindowInfo->GetOriginAttributes());
|
aOpenWindowInfo->GetOriginAttributes());
|
||||||
|
|
||||||
// We return NS_ERROR_ABORT, so that the caller knows that we've abandoned
|
// We return NS_ERROR_ABORT, so that the caller knows that we've abandoned
|
||||||
// the window open as far as it is concerned.
|
// the window open as far as it is concerned.
|
||||||
|
|
@ -1239,7 +1239,7 @@ nsresult ContentChild::ProvideWindowCommon(
|
||||||
}
|
}
|
||||||
|
|
||||||
SendCreateWindow(aTabOpener, parent, newChild, aChromeFlags, aCalledFromJS,
|
SendCreateWindow(aTabOpener, parent, newChild, aChromeFlags, aCalledFromJS,
|
||||||
aWidthSpecified, aOpenWindowInfo->GetIsForPrinting(),
|
aOpenWindowInfo->GetIsForPrinting(),
|
||||||
aOpenWindowInfo->GetIsForWindowDotPrint(), aURI, features,
|
aOpenWindowInfo->GetIsForWindowDotPrint(), aURI, features,
|
||||||
fullZoom, Principal(triggeringPrincipal), csp, referrerInfo,
|
fullZoom, Principal(triggeringPrincipal), csp, referrerInfo,
|
||||||
aOpenWindowInfo->GetOriginAttributes(), std::move(resolve),
|
aOpenWindowInfo->GetOriginAttributes(), std::move(resolve),
|
||||||
|
|
|
||||||
|
|
@ -113,11 +113,10 @@ class ContentChild final : public PContentChild,
|
||||||
|
|
||||||
MOZ_CAN_RUN_SCRIPT_BOUNDARY nsresult ProvideWindowCommon(
|
MOZ_CAN_RUN_SCRIPT_BOUNDARY nsresult ProvideWindowCommon(
|
||||||
BrowserChild* aTabOpener, nsIOpenWindowInfo* aOpenWindowInfo,
|
BrowserChild* aTabOpener, nsIOpenWindowInfo* aOpenWindowInfo,
|
||||||
uint32_t aChromeFlags, bool aCalledFromJS, bool aWidthSpecified,
|
uint32_t aChromeFlags, bool aCalledFromJS, nsIURI* aURI,
|
||||||
nsIURI* aURI, const nsAString& aName, const nsACString& aFeatures,
|
const nsAString& aName, const nsACString& aFeatures, bool aForceNoOpener,
|
||||||
bool aForceNoOpener, bool aForceNoReferrer,
|
bool aForceNoReferrer, nsDocShellLoadState* aLoadState,
|
||||||
nsDocShellLoadState* aLoadState, bool* aWindowIsNew,
|
bool* aWindowIsNew, BrowsingContext** aReturn);
|
||||||
BrowsingContext** aReturn);
|
|
||||||
|
|
||||||
void Init(base::ProcessId aParentPid, const char* aParentBuildID,
|
void Init(base::ProcessId aParentPid, const char* aParentBuildID,
|
||||||
mozilla::ipc::ScopedPort aPort, uint64_t aChildID,
|
mozilla::ipc::ScopedPort aPort, uint64_t aChildID,
|
||||||
|
|
|
||||||
|
|
@ -5129,9 +5129,8 @@ bool ContentParent::DeallocPWebBrowserPersistDocumentParent(
|
||||||
mozilla::ipc::IPCResult ContentParent::CommonCreateWindow(
|
mozilla::ipc::IPCResult ContentParent::CommonCreateWindow(
|
||||||
PBrowserParent* aThisTab, BrowsingContext* aParent, bool aSetOpener,
|
PBrowserParent* aThisTab, BrowsingContext* aParent, bool aSetOpener,
|
||||||
const uint32_t& aChromeFlags, const bool& aCalledFromJS,
|
const uint32_t& aChromeFlags, const bool& aCalledFromJS,
|
||||||
const bool& aWidthSpecified, const bool& aForPrinting,
|
const bool& aForPrinting, const bool& aForWindowDotPrint,
|
||||||
const bool& aForWindowDotPrint, nsIURI* aURIToLoad,
|
nsIURI* aURIToLoad, const nsCString& aFeatures, const float& aFullZoom,
|
||||||
const nsCString& aFeatures, const float& aFullZoom,
|
|
||||||
BrowserParent* aNextRemoteBrowser, const nsString& aName, nsresult& aResult,
|
BrowserParent* aNextRemoteBrowser, const nsString& aName, nsresult& aResult,
|
||||||
nsCOMPtr<nsIRemoteTab>& aNewRemoteTab, bool* aWindowIsNew,
|
nsCOMPtr<nsIRemoteTab>& aNewRemoteTab, bool* aWindowIsNew,
|
||||||
int32_t& aOpenLocation, nsIPrincipal* aTriggeringPrincipal,
|
int32_t& aOpenLocation, nsIPrincipal* aTriggeringPrincipal,
|
||||||
|
|
@ -5219,7 +5218,7 @@ mozilla::ipc::IPCResult ContentParent::CommonCreateWindow(
|
||||||
}
|
}
|
||||||
|
|
||||||
aOpenLocation = nsWindowWatcher::GetWindowOpenLocation(
|
aOpenLocation = nsWindowWatcher::GetWindowOpenLocation(
|
||||||
outerWin, aChromeFlags, aCalledFromJS, aWidthSpecified, aForPrinting);
|
outerWin, aChromeFlags, aCalledFromJS, aForPrinting);
|
||||||
|
|
||||||
MOZ_ASSERT(aOpenLocation == nsIBrowserDOMWindow::OPEN_NEWTAB ||
|
MOZ_ASSERT(aOpenLocation == nsIBrowserDOMWindow::OPEN_NEWTAB ||
|
||||||
aOpenLocation == nsIBrowserDOMWindow::OPEN_NEWWINDOW ||
|
aOpenLocation == nsIBrowserDOMWindow::OPEN_NEWWINDOW ||
|
||||||
|
|
@ -5347,8 +5346,8 @@ mozilla::ipc::IPCResult ContentParent::CommonCreateWindow(
|
||||||
mozilla::ipc::IPCResult ContentParent::RecvCreateWindow(
|
mozilla::ipc::IPCResult ContentParent::RecvCreateWindow(
|
||||||
PBrowserParent* aThisTab, const MaybeDiscarded<BrowsingContext>& aParent,
|
PBrowserParent* aThisTab, const MaybeDiscarded<BrowsingContext>& aParent,
|
||||||
PBrowserParent* aNewTab, const uint32_t& aChromeFlags,
|
PBrowserParent* aNewTab, const uint32_t& aChromeFlags,
|
||||||
const bool& aCalledFromJS, const bool& aWidthSpecified,
|
const bool& aCalledFromJS, const bool& aForPrinting,
|
||||||
const bool& aForPrinting, const bool& aForPrintPreview, nsIURI* aURIToLoad,
|
const bool& aForPrintPreview, nsIURI* aURIToLoad,
|
||||||
const nsCString& aFeatures, const float& aFullZoom,
|
const nsCString& aFeatures, const float& aFullZoom,
|
||||||
const IPC::Principal& aTriggeringPrincipal, nsIContentSecurityPolicy* aCsp,
|
const IPC::Principal& aTriggeringPrincipal, nsIContentSecurityPolicy* aCsp,
|
||||||
nsIReferrerInfo* aReferrerInfo, const OriginAttributes& aOriginAttributes,
|
nsIReferrerInfo* aReferrerInfo, const OriginAttributes& aOriginAttributes,
|
||||||
|
|
@ -5432,10 +5431,10 @@ mozilla::ipc::IPCResult ContentParent::RecvCreateWindow(
|
||||||
int32_t openLocation = nsIBrowserDOMWindow::OPEN_NEWWINDOW;
|
int32_t openLocation = nsIBrowserDOMWindow::OPEN_NEWWINDOW;
|
||||||
mozilla::ipc::IPCResult ipcResult = CommonCreateWindow(
|
mozilla::ipc::IPCResult ipcResult = CommonCreateWindow(
|
||||||
aThisTab, parent, newBCOpenerId != 0, aChromeFlags, aCalledFromJS,
|
aThisTab, parent, newBCOpenerId != 0, aChromeFlags, aCalledFromJS,
|
||||||
aWidthSpecified, aForPrinting, aForPrintPreview, aURIToLoad, aFeatures,
|
aForPrinting, aForPrintPreview, aURIToLoad, aFeatures, aFullZoom, newTab,
|
||||||
aFullZoom, newTab, VoidString(), rv, newRemoteTab, &cwi.windowOpened(),
|
VoidString(), rv, newRemoteTab, &cwi.windowOpened(), openLocation,
|
||||||
openLocation, aTriggeringPrincipal, aReferrerInfo, /* aLoadUri = */ false,
|
aTriggeringPrincipal, aReferrerInfo, /* aLoadUri = */ false, aCsp,
|
||||||
aCsp, aOriginAttributes);
|
aOriginAttributes);
|
||||||
if (!ipcResult) {
|
if (!ipcResult) {
|
||||||
return ipcResult;
|
return ipcResult;
|
||||||
}
|
}
|
||||||
|
|
@ -5463,9 +5462,8 @@ mozilla::ipc::IPCResult ContentParent::RecvCreateWindow(
|
||||||
|
|
||||||
mozilla::ipc::IPCResult ContentParent::RecvCreateWindowInDifferentProcess(
|
mozilla::ipc::IPCResult ContentParent::RecvCreateWindowInDifferentProcess(
|
||||||
PBrowserParent* aThisTab, const MaybeDiscarded<BrowsingContext>& aParent,
|
PBrowserParent* aThisTab, const MaybeDiscarded<BrowsingContext>& aParent,
|
||||||
const uint32_t& aChromeFlags, const bool& aCalledFromJS,
|
const uint32_t& aChromeFlags, const bool& aCalledFromJS, nsIURI* aURIToLoad,
|
||||||
const bool& aWidthSpecified, nsIURI* aURIToLoad, const nsCString& aFeatures,
|
const nsCString& aFeatures, const float& aFullZoom, const nsString& aName,
|
||||||
const float& aFullZoom, const nsString& aName,
|
|
||||||
nsIPrincipal* aTriggeringPrincipal, nsIContentSecurityPolicy* aCsp,
|
nsIPrincipal* aTriggeringPrincipal, nsIContentSecurityPolicy* aCsp,
|
||||||
nsIReferrerInfo* aReferrerInfo, const OriginAttributes& aOriginAttributes) {
|
nsIReferrerInfo* aReferrerInfo, const OriginAttributes& aOriginAttributes) {
|
||||||
MOZ_DIAGNOSTIC_ASSERT(!nsContentUtils::IsSpecialName(aName));
|
MOZ_DIAGNOSTIC_ASSERT(!nsContentUtils::IsSpecialName(aName));
|
||||||
|
|
@ -5508,7 +5506,7 @@ mozilla::ipc::IPCResult ContentParent::RecvCreateWindowInDifferentProcess(
|
||||||
nsresult rv;
|
nsresult rv;
|
||||||
mozilla::ipc::IPCResult ipcResult = CommonCreateWindow(
|
mozilla::ipc::IPCResult ipcResult = CommonCreateWindow(
|
||||||
aThisTab, parent, /* aSetOpener = */ false, aChromeFlags, aCalledFromJS,
|
aThisTab, parent, /* aSetOpener = */ false, aChromeFlags, aCalledFromJS,
|
||||||
aWidthSpecified, /* aForPrinting = */ false,
|
/* aForPrinting = */ false,
|
||||||
/* aForPrintPreview = */ false, aURIToLoad, aFeatures, aFullZoom,
|
/* aForPrintPreview = */ false, aURIToLoad, aFeatures, aFullZoom,
|
||||||
/* aNextRemoteBrowser = */ nullptr, aName, rv, newRemoteTab, &windowIsNew,
|
/* aNextRemoteBrowser = */ nullptr, aName, rv, newRemoteTab, &windowIsNew,
|
||||||
openLocation, aTriggeringPrincipal, aReferrerInfo,
|
openLocation, aTriggeringPrincipal, aReferrerInfo,
|
||||||
|
|
|
||||||
|
|
@ -518,9 +518,8 @@ class ContentParent final
|
||||||
PBrowserParent* aThisBrowserParent,
|
PBrowserParent* aThisBrowserParent,
|
||||||
const MaybeDiscarded<BrowsingContext>& aParent, PBrowserParent* aNewTab,
|
const MaybeDiscarded<BrowsingContext>& aParent, PBrowserParent* aNewTab,
|
||||||
const uint32_t& aChromeFlags, const bool& aCalledFromJS,
|
const uint32_t& aChromeFlags, const bool& aCalledFromJS,
|
||||||
const bool& aWidthSpecified, const bool& aForPrinting,
|
const bool& aForPrinting, const bool& aForWindowDotPrint,
|
||||||
const bool& aForWindowDotPrint, nsIURI* aURIToLoad,
|
nsIURI* aURIToLoad, const nsCString& aFeatures, const float& aFullZoom,
|
||||||
const nsCString& aFeatures, const float& aFullZoom,
|
|
||||||
const IPC::Principal& aTriggeringPrincipal,
|
const IPC::Principal& aTriggeringPrincipal,
|
||||||
nsIContentSecurityPolicy* aCsp, nsIReferrerInfo* aReferrerInfo,
|
nsIContentSecurityPolicy* aCsp, nsIReferrerInfo* aReferrerInfo,
|
||||||
const OriginAttributes& aOriginAttributes,
|
const OriginAttributes& aOriginAttributes,
|
||||||
|
|
@ -529,10 +528,9 @@ class ContentParent final
|
||||||
mozilla::ipc::IPCResult RecvCreateWindowInDifferentProcess(
|
mozilla::ipc::IPCResult RecvCreateWindowInDifferentProcess(
|
||||||
PBrowserParent* aThisTab, const MaybeDiscarded<BrowsingContext>& aParent,
|
PBrowserParent* aThisTab, const MaybeDiscarded<BrowsingContext>& aParent,
|
||||||
const uint32_t& aChromeFlags, const bool& aCalledFromJS,
|
const uint32_t& aChromeFlags, const bool& aCalledFromJS,
|
||||||
const bool& aWidthSpecified, nsIURI* aURIToLoad,
|
nsIURI* aURIToLoad, const nsCString& aFeatures, const float& aFullZoom,
|
||||||
const nsCString& aFeatures, const float& aFullZoom, const nsString& aName,
|
const nsString& aName, nsIPrincipal* aTriggeringPrincipal,
|
||||||
nsIPrincipal* aTriggeringPrincipal, nsIContentSecurityPolicy* aCsp,
|
nsIContentSecurityPolicy* aCsp, nsIReferrerInfo* aReferrerInfo,
|
||||||
nsIReferrerInfo* aReferrerInfo,
|
|
||||||
const OriginAttributes& aOriginAttributes);
|
const OriginAttributes& aOriginAttributes);
|
||||||
|
|
||||||
static void BroadcastBlobURLRegistration(
|
static void BroadcastBlobURLRegistration(
|
||||||
|
|
@ -764,9 +762,8 @@ class ContentParent final
|
||||||
mozilla::ipc::IPCResult CommonCreateWindow(
|
mozilla::ipc::IPCResult CommonCreateWindow(
|
||||||
PBrowserParent* aThisTab, BrowsingContext* aParent, bool aSetOpener,
|
PBrowserParent* aThisTab, BrowsingContext* aParent, bool aSetOpener,
|
||||||
const uint32_t& aChromeFlags, const bool& aCalledFromJS,
|
const uint32_t& aChromeFlags, const bool& aCalledFromJS,
|
||||||
const bool& aWidthSpecified, const bool& aForPrinting,
|
const bool& aForPrinting, const bool& aForWindowDotPrint,
|
||||||
const bool& aForWindowDotPrint, nsIURI* aURIToLoad,
|
nsIURI* aURIToLoad, const nsCString& aFeatures, const float& aFullZoom,
|
||||||
const nsCString& aFeatures, const float& aFullZoom,
|
|
||||||
BrowserParent* aNextRemoteBrowser, const nsString& aName,
|
BrowserParent* aNextRemoteBrowser, const nsString& aName,
|
||||||
nsresult& aResult, nsCOMPtr<nsIRemoteTab>& aNewRemoteTab,
|
nsresult& aResult, nsCOMPtr<nsIRemoteTab>& aNewRemoteTab,
|
||||||
bool* aWindowIsNew, int32_t& aOpenLocation,
|
bool* aWindowIsNew, int32_t& aOpenLocation,
|
||||||
|
|
|
||||||
|
|
@ -1476,7 +1476,6 @@ parent:
|
||||||
PBrowser aNewTab,
|
PBrowser aNewTab,
|
||||||
uint32_t aChromeFlags,
|
uint32_t aChromeFlags,
|
||||||
bool aCalledFromJS,
|
bool aCalledFromJS,
|
||||||
bool aWidthSpecified,
|
|
||||||
bool aForPrinting,
|
bool aForPrinting,
|
||||||
bool aForWindowDotPrint,
|
bool aForWindowDotPrint,
|
||||||
nsIURI aURIToLoad,
|
nsIURI aURIToLoad,
|
||||||
|
|
@ -1493,7 +1492,6 @@ parent:
|
||||||
MaybeDiscardedBrowsingContext aParent,
|
MaybeDiscardedBrowsingContext aParent,
|
||||||
uint32_t aChromeFlags,
|
uint32_t aChromeFlags,
|
||||||
bool aCalledFromJS,
|
bool aCalledFromJS,
|
||||||
bool aWidthSpecified,
|
|
||||||
nsIURI aURIToLoad,
|
nsIURI aURIToLoad,
|
||||||
nsCString aFeatures,
|
nsCString aFeatures,
|
||||||
float aFullZoom,
|
float aFullZoom,
|
||||||
|
|
|
||||||
|
|
@ -47,9 +47,6 @@ interface nsIWindowProvider : nsISupports
|
||||||
* window if this provider returns null. See nsIWebBrowserChrome for
|
* window if this provider returns null. See nsIWebBrowserChrome for
|
||||||
* the possible values of this field.
|
* the possible values of this field.
|
||||||
*
|
*
|
||||||
* @param aWidthSpecified Whether the attempt to create a window is trying
|
|
||||||
* to specify the width for the new window.
|
|
||||||
*
|
|
||||||
* @param aURI The URI to be loaded in the new window (may be NULL). The
|
* @param aURI The URI to be loaded in the new window (may be NULL). The
|
||||||
* nsIWindowProvider implementation must not load this URI into the
|
* nsIWindowProvider implementation must not load this URI into the
|
||||||
* window it returns. This URI is provided solely to help the
|
* window it returns. This URI is provided solely to help the
|
||||||
|
|
@ -97,7 +94,6 @@ interface nsIWindowProvider : nsISupports
|
||||||
BrowsingContext provideWindow(in nsIOpenWindowInfo aOpenWindowInfo,
|
BrowsingContext provideWindow(in nsIOpenWindowInfo aOpenWindowInfo,
|
||||||
in unsigned long aChromeFlags,
|
in unsigned long aChromeFlags,
|
||||||
in boolean aCalledFromJS,
|
in boolean aCalledFromJS,
|
||||||
in boolean aWidthSpecified,
|
|
||||||
in nsIURI aURI,
|
in nsIURI aURI,
|
||||||
in AString aName,
|
in AString aName,
|
||||||
in AUTF8String aFeatures,
|
in AUTF8String aFeatures,
|
||||||
|
|
|
||||||
|
|
@ -520,7 +520,7 @@ nsWindowWatcher::OpenWindowWithRemoteTab(nsIRemoteTab* aRemoteTab,
|
||||||
SizeSpec sizeSpec;
|
SizeSpec sizeSpec;
|
||||||
CalcSizeSpec(features, false, sizeSpec);
|
CalcSizeSpec(features, false, sizeSpec);
|
||||||
|
|
||||||
uint32_t chromeFlags = CalculateChromeFlagsForContent(features, sizeSpec);
|
uint32_t chromeFlags = CalculateChromeFlagsForContent(features);
|
||||||
|
|
||||||
if (isPrivateBrowsingWindow) {
|
if (isPrivateBrowsingWindow) {
|
||||||
chromeFlags |= nsIWebBrowserChrome::CHROME_PRIVATE_WINDOW;
|
chromeFlags |= nsIWebBrowserChrome::CHROME_PRIVATE_WINDOW;
|
||||||
|
|
@ -707,7 +707,7 @@ nsresult nsWindowWatcher::OpenWindowInternal(
|
||||||
} else {
|
} else {
|
||||||
MOZ_DIAGNOSTIC_ASSERT(parentBC && parentBC->IsContent(),
|
MOZ_DIAGNOSTIC_ASSERT(parentBC && parentBC->IsContent(),
|
||||||
"content caller must provide content parent");
|
"content caller must provide content parent");
|
||||||
chromeFlags = CalculateChromeFlagsForContent(features, sizeSpec);
|
chromeFlags = CalculateChromeFlagsForContent(features);
|
||||||
|
|
||||||
if (aDialog) {
|
if (aDialog) {
|
||||||
MOZ_ASSERT(XRE_IsParentProcess());
|
MOZ_ASSERT(XRE_IsParentProcess());
|
||||||
|
|
@ -839,11 +839,10 @@ nsresult nsWindowWatcher::OpenWindowInternal(
|
||||||
|
|
||||||
nsCOMPtr<nsIWindowProvider> provider = do_GetInterface(parentTreeOwner);
|
nsCOMPtr<nsIWindowProvider> provider = do_GetInterface(parentTreeOwner);
|
||||||
if (provider) {
|
if (provider) {
|
||||||
rv = provider->ProvideWindow(openWindowInfo, chromeFlags, aCalledFromJS,
|
rv = provider->ProvideWindow(
|
||||||
sizeSpec.WidthSpecified(), uriToLoad, name,
|
openWindowInfo, chromeFlags, aCalledFromJS, uriToLoad, name,
|
||||||
featuresStr, aForceNoOpener,
|
featuresStr, aForceNoOpener, aForceNoReferrer, aLoadState,
|
||||||
aForceNoReferrer, aLoadState, &windowIsNew,
|
&windowIsNew, getter_AddRefs(newBC));
|
||||||
getter_AddRefs(newBC));
|
|
||||||
|
|
||||||
if (NS_SUCCEEDED(rv) && newBC) {
|
if (NS_SUCCEEDED(rv) && newBC) {
|
||||||
nsCOMPtr<nsIDocShell> newDocShell = newBC->GetDocShell();
|
nsCOMPtr<nsIDocShell> newDocShell = newBC->GetDocShell();
|
||||||
|
|
@ -1723,14 +1722,17 @@ uint32_t nsWindowWatcher::CalculateChromeFlagsHelper(
|
||||||
}
|
}
|
||||||
|
|
||||||
// static
|
// static
|
||||||
bool nsWindowWatcher::ShouldOpenPopup(const WindowFeatures& aFeatures,
|
bool nsWindowWatcher::ShouldOpenPopup(const WindowFeatures& aFeatures) {
|
||||||
const SizeSpec& aSizeSpec) {
|
|
||||||
if (aFeatures.IsEmpty()) {
|
if (aFeatures.IsEmpty()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Follow Google Chrome's behavior that opens a popup depending on
|
// NOTE: This is different than chrome-only "popup" feature that is handled
|
||||||
// the following features.
|
// in nsWindowWatcher::CalculateChromeFlagsForSystem.
|
||||||
|
if (aFeatures.Exists("popup")) {
|
||||||
|
return aFeatures.GetBool("popup");
|
||||||
|
}
|
||||||
|
|
||||||
if (!aFeatures.GetBoolWithDefault("location", false) &&
|
if (!aFeatures.GetBoolWithDefault("location", false) &&
|
||||||
!aFeatures.GetBoolWithDefault("toolbar", false)) {
|
!aFeatures.GetBoolWithDefault("toolbar", false)) {
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -1752,11 +1754,6 @@ bool nsWindowWatcher::ShouldOpenPopup(const WindowFeatures& aFeatures,
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Follow Safari's behavior that opens a popup when width is specified.
|
|
||||||
if (aSizeSpec.WidthSpecified()) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1765,13 +1762,12 @@ bool nsWindowWatcher::ShouldOpenPopup(const WindowFeatures& aFeatures,
|
||||||
* from a child process. The feature string can only control whether to open a
|
* from a child process. The feature string can only control whether to open a
|
||||||
* new tab or a new popup.
|
* new tab or a new popup.
|
||||||
* @param aFeatures a string containing a list of named features
|
* @param aFeatures a string containing a list of named features
|
||||||
* @param aSizeSpec the result of CalcSizeSpec
|
|
||||||
* @return the chrome bitmask
|
* @return the chrome bitmask
|
||||||
*/
|
*/
|
||||||
// static
|
// static
|
||||||
uint32_t nsWindowWatcher::CalculateChromeFlagsForContent(
|
uint32_t nsWindowWatcher::CalculateChromeFlagsForContent(
|
||||||
const WindowFeatures& aFeatures, const SizeSpec& aSizeSpec) {
|
const WindowFeatures& aFeatures) {
|
||||||
if (aFeatures.IsEmpty() || !ShouldOpenPopup(aFeatures, aSizeSpec)) {
|
if (aFeatures.IsEmpty() || !ShouldOpenPopup(aFeatures)) {
|
||||||
// Open the current/new tab in the current/new window
|
// Open the current/new tab in the current/new window
|
||||||
// (depends on browser.link.open_newwindow).
|
// (depends on browser.link.open_newwindow).
|
||||||
return nsIWebBrowserChrome::CHROME_ALL;
|
return nsIWebBrowserChrome::CHROME_ALL;
|
||||||
|
|
@ -2404,7 +2400,6 @@ void nsWindowWatcher::SizeOpenedWindow(nsIDocShellTreeOwner* aTreeOwner,
|
||||||
int32_t nsWindowWatcher::GetWindowOpenLocation(nsPIDOMWindowOuter* aParent,
|
int32_t nsWindowWatcher::GetWindowOpenLocation(nsPIDOMWindowOuter* aParent,
|
||||||
uint32_t aChromeFlags,
|
uint32_t aChromeFlags,
|
||||||
bool aCalledFromJS,
|
bool aCalledFromJS,
|
||||||
bool aWidthSpecified,
|
|
||||||
bool aIsForPrinting) {
|
bool aIsForPrinting) {
|
||||||
// These windows are not actually visible to the user, so we return the thing
|
// These windows are not actually visible to the user, so we return the thing
|
||||||
// that we can always handle.
|
// that we can always handle.
|
||||||
|
|
@ -2460,16 +2455,16 @@ int32_t nsWindowWatcher::GetWindowOpenLocation(nsPIDOMWindowOuter* aParent,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (restrictionPref == 2) {
|
if (restrictionPref == 2) {
|
||||||
// Only continue if there are no width feature and no special
|
// Only continue if there is no special chrome flags - with the exception
|
||||||
// chrome flags - with the exception of the remoteness and private flags,
|
// of the remoteness and private flags, which might have been
|
||||||
// which might have been automatically flipped by Gecko.
|
// automatically flipped by Gecko.
|
||||||
int32_t uiChromeFlags = aChromeFlags;
|
int32_t uiChromeFlags = aChromeFlags;
|
||||||
uiChromeFlags &= ~(nsIWebBrowserChrome::CHROME_REMOTE_WINDOW |
|
uiChromeFlags &= ~(nsIWebBrowserChrome::CHROME_REMOTE_WINDOW |
|
||||||
nsIWebBrowserChrome::CHROME_FISSION_WINDOW |
|
nsIWebBrowserChrome::CHROME_FISSION_WINDOW |
|
||||||
nsIWebBrowserChrome::CHROME_PRIVATE_WINDOW |
|
nsIWebBrowserChrome::CHROME_PRIVATE_WINDOW |
|
||||||
nsIWebBrowserChrome::CHROME_NON_PRIVATE_WINDOW |
|
nsIWebBrowserChrome::CHROME_NON_PRIVATE_WINDOW |
|
||||||
nsIWebBrowserChrome::CHROME_PRIVATE_LIFETIME);
|
nsIWebBrowserChrome::CHROME_PRIVATE_LIFETIME);
|
||||||
if (uiChromeFlags != nsIWebBrowserChrome::CHROME_ALL || aWidthSpecified) {
|
if (uiChromeFlags != nsIWebBrowserChrome::CHROME_ALL) {
|
||||||
return nsIBrowserDOMWindow::OPEN_NEWWINDOW;
|
return nsIBrowserDOMWindow::OPEN_NEWWINDOW;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -54,8 +54,7 @@ class nsWindowWatcher : public nsIWindowWatcher,
|
||||||
|
|
||||||
static int32_t GetWindowOpenLocation(nsPIDOMWindowOuter* aParent,
|
static int32_t GetWindowOpenLocation(nsPIDOMWindowOuter* aParent,
|
||||||
uint32_t aChromeFlags,
|
uint32_t aChromeFlags,
|
||||||
bool aCalledFromJS, bool aWidthSpecified,
|
bool aCalledFromJS, bool aIsForPrinting);
|
||||||
bool aIsForPrinting);
|
|
||||||
|
|
||||||
// Will first look for a caller on the JS stack, and then fall back on
|
// Will first look for a caller on the JS stack, and then fall back on
|
||||||
// aCurrentContext if it can't find one.
|
// aCurrentContext if it can't find one.
|
||||||
|
|
@ -88,11 +87,10 @@ class nsWindowWatcher : public nsIWindowWatcher,
|
||||||
static nsresult URIfromURL(const nsACString& aURL,
|
static nsresult URIfromURL(const nsACString& aURL,
|
||||||
mozIDOMWindowProxy* aParent, nsIURI** aURI);
|
mozIDOMWindowProxy* aParent, nsIURI** aURI);
|
||||||
|
|
||||||
static bool ShouldOpenPopup(const mozilla::dom::WindowFeatures& aFeatures,
|
static bool ShouldOpenPopup(const mozilla::dom::WindowFeatures& aFeatures);
|
||||||
const SizeSpec& aSizeSpec);
|
|
||||||
|
|
||||||
static uint32_t CalculateChromeFlagsForContent(
|
static uint32_t CalculateChromeFlagsForContent(
|
||||||
const mozilla::dom::WindowFeatures& aFeatures, const SizeSpec& aSizeSpec);
|
const mozilla::dom::WindowFeatures& aFeatures);
|
||||||
|
|
||||||
static uint32_t CalculateChromeFlagsForSystem(
|
static uint32_t CalculateChromeFlagsForSystem(
|
||||||
const mozilla::dom::WindowFeatures& aFeatures, bool aDialog,
|
const mozilla::dom::WindowFeatures& aFeatures, bool aDialog,
|
||||||
|
|
|
||||||
|
|
@ -15,11 +15,6 @@ add_task(async function test_popup_conditions() {
|
||||||
// * resizable (defaults to true)
|
// * resizable (defaults to true)
|
||||||
// * scrollbars (defaults to false)
|
// * scrollbars (defaults to false)
|
||||||
// * status (defaults to false)
|
// * status (defaults to false)
|
||||||
// and also the following shouldn't be specified:
|
|
||||||
// * left or screenX
|
|
||||||
// * top or screenY
|
|
||||||
// * width or innerWidth
|
|
||||||
// * height or innerHeight
|
|
||||||
{ features: "location,menubar,resizable,scrollbars,status", popup: false },
|
{ features: "location,menubar,resizable,scrollbars,status", popup: false },
|
||||||
{ features: "toolbar,menubar,resizable,scrollbars,status", popup: false },
|
{ features: "toolbar,menubar,resizable,scrollbars,status", popup: false },
|
||||||
{
|
{
|
||||||
|
|
@ -76,11 +71,11 @@ add_task(async function test_popup_conditions() {
|
||||||
{ features: "location,menubar,resizable,scrollbars", popup: true },
|
{ features: "location,menubar,resizable,scrollbars", popup: true },
|
||||||
{ features: "location,menubar,resizable,scrollbars,status=0", popup: true },
|
{ features: "location,menubar,resizable,scrollbars,status=0", popup: true },
|
||||||
|
|
||||||
// If either width or innerWidth is specified, popup.
|
// width and innerWidth have no effect.
|
||||||
{ features: "location,menubar,scrollbars,status,width=100", popup: true },
|
{ features: "location,menubar,scrollbars,status,width=100", popup: false },
|
||||||
{
|
{
|
||||||
features: "location,menubar,scrollbars,status,innerWidth=100",
|
features: "location,menubar,scrollbars,status,innerWidth=100",
|
||||||
popup: true,
|
popup: false,
|
||||||
},
|
},
|
||||||
|
|
||||||
// outerWidth has no effect.
|
// outerWidth has no effect.
|
||||||
|
|
|
||||||
|
|
@ -519,12 +519,14 @@ NS_IMETHODIMP nsContentTreeOwner::SetTitle(const nsAString& aTitle) {
|
||||||
// nsContentTreeOwner: nsIWindowProvider
|
// nsContentTreeOwner: nsIWindowProvider
|
||||||
//*****************************************************************************
|
//*****************************************************************************
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsContentTreeOwner::ProvideWindow(
|
nsContentTreeOwner::ProvideWindow(nsIOpenWindowInfo* aOpenWindowInfo,
|
||||||
nsIOpenWindowInfo* aOpenWindowInfo, uint32_t aChromeFlags,
|
uint32_t aChromeFlags, bool aCalledFromJS,
|
||||||
bool aCalledFromJS, bool aWidthSpecified, nsIURI* aURI,
|
nsIURI* aURI, const nsAString& aName,
|
||||||
const nsAString& aName, const nsACString& aFeatures, bool aForceNoOpener,
|
const nsACString& aFeatures,
|
||||||
bool aForceNoReferrer, nsDocShellLoadState* aLoadState, bool* aWindowIsNew,
|
bool aForceNoOpener, bool aForceNoReferrer,
|
||||||
dom::BrowsingContext** aReturn) {
|
nsDocShellLoadState* aLoadState,
|
||||||
|
bool* aWindowIsNew,
|
||||||
|
dom::BrowsingContext** aReturn) {
|
||||||
NS_ENSURE_ARG_POINTER(aOpenWindowInfo);
|
NS_ENSURE_ARG_POINTER(aOpenWindowInfo);
|
||||||
|
|
||||||
RefPtr<dom::BrowsingContext> parent = aOpenWindowInfo->GetParent();
|
RefPtr<dom::BrowsingContext> parent = aOpenWindowInfo->GetParent();
|
||||||
|
|
@ -545,7 +547,7 @@ nsContentTreeOwner::ProvideWindow(
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int32_t openLocation = nsWindowWatcher::GetWindowOpenLocation(
|
int32_t openLocation = nsWindowWatcher::GetWindowOpenLocation(
|
||||||
parent->GetDOMWindow(), aChromeFlags, aCalledFromJS, aWidthSpecified,
|
parent->GetDOMWindow(), aChromeFlags, aCalledFromJS,
|
||||||
aOpenWindowInfo->GetIsForPrinting());
|
aOpenWindowInfo->GetIsForPrinting());
|
||||||
|
|
||||||
if (openLocation != nsIBrowserDOMWindow::OPEN_NEWTAB &&
|
if (openLocation != nsIBrowserDOMWindow::OPEN_NEWTAB &&
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue