Backed out 4 changesets (bug 1737832, bug 1701001) for causing geckoview failures on noopener-noreferrer-BarProp.window.html. CLOSED TREE
Backed out changeset ff439d9c0391 (bug 1701001) Backed out changeset b0e47b1f4d39 (bug 1701001) Backed out changeset 0e2ca3cc650e (bug 1701001) Backed out changeset 712b897cbc76 (bug 1737832)
This commit is contained in:
@@ -294,7 +294,7 @@ bool BrowsingContext::SameOriginWithTop() {
|
|||||||
already_AddRefed<BrowsingContext> BrowsingContext::CreateDetached(
|
already_AddRefed<BrowsingContext> BrowsingContext::CreateDetached(
|
||||||
nsGlobalWindowInner* aParent, BrowsingContext* aOpener,
|
nsGlobalWindowInner* aParent, BrowsingContext* aOpener,
|
||||||
BrowsingContextGroup* aSpecificGroup, const nsAString& aName, Type aType,
|
BrowsingContextGroup* aSpecificGroup, const nsAString& aName, Type aType,
|
||||||
bool aIsPopupRequested, bool aCreatedDynamically) {
|
bool aCreatedDynamically) {
|
||||||
if (aParent) {
|
if (aParent) {
|
||||||
MOZ_DIAGNOSTIC_ASSERT(aParent->GetWindowContext());
|
MOZ_DIAGNOSTIC_ASSERT(aParent->GetWindowContext());
|
||||||
MOZ_DIAGNOSTIC_ASSERT(aParent->GetBrowsingContext()->mType == aType);
|
MOZ_DIAGNOSTIC_ASSERT(aParent->GetBrowsingContext()->mType == aType);
|
||||||
@@ -410,8 +410,6 @@ already_AddRefed<BrowsingContext> BrowsingContext::CreateDetached(
|
|||||||
|
|
||||||
fields.mAllowJavascript = inherit ? inherit->GetAllowJavascript() : true;
|
fields.mAllowJavascript = inherit ? inherit->GetAllowJavascript() : true;
|
||||||
|
|
||||||
fields.mIsPopupRequested = aIsPopupRequested;
|
|
||||||
|
|
||||||
if (!parentBC) {
|
if (!parentBC) {
|
||||||
fields.mShouldDelayMediaFromStart =
|
fields.mShouldDelayMediaFromStart =
|
||||||
StaticPrefs::media_block_autoplay_until_in_foreground();
|
StaticPrefs::media_block_autoplay_until_in_foreground();
|
||||||
@@ -456,7 +454,7 @@ already_AddRefed<BrowsingContext> BrowsingContext::CreateIndependent(
|
|||||||
"BCs created in the content process must be related to "
|
"BCs created in the content process must be related to "
|
||||||
"some BrowserChild");
|
"some BrowserChild");
|
||||||
RefPtr<BrowsingContext> bc(
|
RefPtr<BrowsingContext> bc(
|
||||||
CreateDetached(nullptr, nullptr, nullptr, u""_ns, aType, false));
|
CreateDetached(nullptr, nullptr, nullptr, u""_ns, aType));
|
||||||
bc->mWindowless = bc->IsContent();
|
bc->mWindowless = bc->IsContent();
|
||||||
bc->mEmbeddedByThisProcess = true;
|
bc->mEmbeddedByThisProcess = true;
|
||||||
bc->EnsureAttached();
|
bc->EnsureAttached();
|
||||||
|
|||||||
@@ -156,14 +156,6 @@ enum class ExplicitActiveStatus : uint8_t {
|
|||||||
FIELD(ForceEnableTrackingProtection, bool) \
|
FIELD(ForceEnableTrackingProtection, bool) \
|
||||||
FIELD(UseGlobalHistory, bool) \
|
FIELD(UseGlobalHistory, bool) \
|
||||||
FIELD(FullscreenAllowedByOwner, bool) \
|
FIELD(FullscreenAllowedByOwner, bool) \
|
||||||
/* \
|
|
||||||
* "is popup" in the spec. \
|
|
||||||
* Set only on top browsing contexts. \
|
|
||||||
* This doesn't indicate whether this is actually a popup or not, \
|
|
||||||
* but whether this browsing context is created by requesting popup or not. \
|
|
||||||
* See also: nsWindowWatcher::ShouldOpenPopup. \
|
|
||||||
*/ \
|
|
||||||
FIELD(IsPopupRequested, bool) \
|
|
||||||
/* These field are used to store the states of autoplay media request on \
|
/* These field are used to store the states of autoplay media request on \
|
||||||
* GeckoView only, and it would only be modified on the top level browsing \
|
* GeckoView only, and it would only be modified on the top level browsing \
|
||||||
* context. */ \
|
* context. */ \
|
||||||
@@ -291,7 +283,7 @@ class BrowsingContext : public nsILoadContext, public nsWrapperCache {
|
|||||||
static already_AddRefed<BrowsingContext> CreateDetached(
|
static already_AddRefed<BrowsingContext> CreateDetached(
|
||||||
nsGlobalWindowInner* aParent, BrowsingContext* aOpener,
|
nsGlobalWindowInner* aParent, BrowsingContext* aOpener,
|
||||||
BrowsingContextGroup* aSpecificGroup, const nsAString& aName, Type aType,
|
BrowsingContextGroup* aSpecificGroup, const nsAString& aName, Type aType,
|
||||||
bool aIsPopupRequested, bool aCreatedDynamically = false);
|
bool aCreatedDynamically = false);
|
||||||
|
|
||||||
void EnsureAttached();
|
void EnsureAttached();
|
||||||
|
|
||||||
|
|||||||
@@ -35,27 +35,7 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(BarProp)
|
|||||||
NS_INTERFACE_MAP_ENTRY(nsISupports)
|
NS_INTERFACE_MAP_ENTRY(nsISupports)
|
||||||
NS_INTERFACE_MAP_END
|
NS_INTERFACE_MAP_END
|
||||||
|
|
||||||
bool BarProp::GetVisibleByIsPopup() {
|
bool BarProp::GetVisibleByFlag(uint32_t aChromeFlag, ErrorResult& aRv) {
|
||||||
// For web content, return the value defined by the spec, instead of
|
|
||||||
// the actual visibility of each bar.
|
|
||||||
//
|
|
||||||
// If this browsing context is created by requesting a popup, all
|
|
||||||
// `BarProp.visible` should return false.
|
|
||||||
RefPtr<BrowsingContext> bc = GetBrowsingContext();
|
|
||||||
if (!bc || bc->IsDiscarded()) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
bc = bc->Top();
|
|
||||||
bool isPopup = bc->GetIsPopupRequested();
|
|
||||||
return !isPopup;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool BarProp::GetVisibleByFlag(uint32_t aChromeFlag, CallerType aCallerType,
|
|
||||||
ErrorResult& aRv) {
|
|
||||||
if (aCallerType != CallerType::System) {
|
|
||||||
return GetVisibleByIsPopup();
|
|
||||||
}
|
|
||||||
|
|
||||||
nsCOMPtr<nsIWebBrowserChrome> browserChrome = GetBrowserChrome();
|
nsCOMPtr<nsIWebBrowserChrome> browserChrome = GetBrowserChrome();
|
||||||
NS_ENSURE_TRUE(browserChrome, false);
|
NS_ENSURE_TRUE(browserChrome, false);
|
||||||
|
|
||||||
@@ -103,14 +83,6 @@ already_AddRefed<nsIWebBrowserChrome> BarProp::GetBrowserChrome() {
|
|||||||
return mDOMWindow->GetWebBrowserChrome();
|
return mDOMWindow->GetWebBrowserChrome();
|
||||||
}
|
}
|
||||||
|
|
||||||
BrowsingContext* BarProp::GetBrowsingContext() {
|
|
||||||
if (!mDOMWindow) {
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
return mDOMWindow->GetBrowsingContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// MenubarProp class implementation
|
// MenubarProp class implementation
|
||||||
//
|
//
|
||||||
@@ -120,8 +92,7 @@ MenubarProp::MenubarProp(nsGlobalWindowInner* aWindow) : BarProp(aWindow) {}
|
|||||||
MenubarProp::~MenubarProp() = default;
|
MenubarProp::~MenubarProp() = default;
|
||||||
|
|
||||||
bool MenubarProp::GetVisible(CallerType aCallerType, ErrorResult& aRv) {
|
bool MenubarProp::GetVisible(CallerType aCallerType, ErrorResult& aRv) {
|
||||||
return BarProp::GetVisibleByFlag(nsIWebBrowserChrome::CHROME_MENUBAR,
|
return BarProp::GetVisibleByFlag(nsIWebBrowserChrome::CHROME_MENUBAR, aRv);
|
||||||
aCallerType, aRv);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MenubarProp::SetVisible(bool aVisible, CallerType aCallerType,
|
void MenubarProp::SetVisible(bool aVisible, CallerType aCallerType,
|
||||||
@@ -139,8 +110,7 @@ ToolbarProp::ToolbarProp(nsGlobalWindowInner* aWindow) : BarProp(aWindow) {}
|
|||||||
ToolbarProp::~ToolbarProp() = default;
|
ToolbarProp::~ToolbarProp() = default;
|
||||||
|
|
||||||
bool ToolbarProp::GetVisible(CallerType aCallerType, ErrorResult& aRv) {
|
bool ToolbarProp::GetVisible(CallerType aCallerType, ErrorResult& aRv) {
|
||||||
return BarProp::GetVisibleByFlag(nsIWebBrowserChrome::CHROME_TOOLBAR,
|
return BarProp::GetVisibleByFlag(nsIWebBrowserChrome::CHROME_TOOLBAR, aRv);
|
||||||
aCallerType, aRv);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ToolbarProp::SetVisible(bool aVisible, CallerType aCallerType,
|
void ToolbarProp::SetVisible(bool aVisible, CallerType aCallerType,
|
||||||
@@ -160,7 +130,7 @@ LocationbarProp::~LocationbarProp() = default;
|
|||||||
|
|
||||||
bool LocationbarProp::GetVisible(CallerType aCallerType, ErrorResult& aRv) {
|
bool LocationbarProp::GetVisible(CallerType aCallerType, ErrorResult& aRv) {
|
||||||
return BarProp::GetVisibleByFlag(nsIWebBrowserChrome::CHROME_LOCATIONBAR,
|
return BarProp::GetVisibleByFlag(nsIWebBrowserChrome::CHROME_LOCATIONBAR,
|
||||||
aCallerType, aRv);
|
aRv);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LocationbarProp::SetVisible(bool aVisible, CallerType aCallerType,
|
void LocationbarProp::SetVisible(bool aVisible, CallerType aCallerType,
|
||||||
@@ -180,7 +150,7 @@ PersonalbarProp::~PersonalbarProp() = default;
|
|||||||
|
|
||||||
bool PersonalbarProp::GetVisible(CallerType aCallerType, ErrorResult& aRv) {
|
bool PersonalbarProp::GetVisible(CallerType aCallerType, ErrorResult& aRv) {
|
||||||
return BarProp::GetVisibleByFlag(nsIWebBrowserChrome::CHROME_PERSONAL_TOOLBAR,
|
return BarProp::GetVisibleByFlag(nsIWebBrowserChrome::CHROME_PERSONAL_TOOLBAR,
|
||||||
aCallerType, aRv);
|
aRv);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PersonalbarProp::SetVisible(bool aVisible, CallerType aCallerType,
|
void PersonalbarProp::SetVisible(bool aVisible, CallerType aCallerType,
|
||||||
@@ -198,8 +168,7 @@ StatusbarProp::StatusbarProp(nsGlobalWindowInner* aWindow) : BarProp(aWindow) {}
|
|||||||
StatusbarProp::~StatusbarProp() = default;
|
StatusbarProp::~StatusbarProp() = default;
|
||||||
|
|
||||||
bool StatusbarProp::GetVisible(CallerType aCallerType, ErrorResult& aRv) {
|
bool StatusbarProp::GetVisible(CallerType aCallerType, ErrorResult& aRv) {
|
||||||
return BarProp::GetVisibleByFlag(nsIWebBrowserChrome::CHROME_STATUSBAR,
|
return BarProp::GetVisibleByFlag(nsIWebBrowserChrome::CHROME_STATUSBAR, aRv);
|
||||||
aCallerType, aRv);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void StatusbarProp::SetVisible(bool aVisible, CallerType aCallerType,
|
void StatusbarProp::SetVisible(bool aVisible, CallerType aCallerType,
|
||||||
@@ -218,10 +187,6 @@ ScrollbarsProp::ScrollbarsProp(nsGlobalWindowInner* aWindow)
|
|||||||
ScrollbarsProp::~ScrollbarsProp() = default;
|
ScrollbarsProp::~ScrollbarsProp() = default;
|
||||||
|
|
||||||
bool ScrollbarsProp::GetVisible(CallerType aCallerType, ErrorResult& aRv) {
|
bool ScrollbarsProp::GetVisible(CallerType aCallerType, ErrorResult& aRv) {
|
||||||
if (aCallerType != CallerType::System) {
|
|
||||||
return BarProp::GetVisibleByIsPopup();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!mDOMWindow) {
|
if (!mDOMWindow) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,7 +18,6 @@
|
|||||||
#include "nsWrapperCache.h"
|
#include "nsWrapperCache.h"
|
||||||
#include "nsPIDOMWindow.h"
|
#include "nsPIDOMWindow.h"
|
||||||
#include "mozilla/dom/BindingDeclarations.h"
|
#include "mozilla/dom/BindingDeclarations.h"
|
||||||
#include "mozilla/dom/BrowsingContext.h"
|
|
||||||
|
|
||||||
class nsGlobalWindowInner;
|
class nsGlobalWindowInner;
|
||||||
class nsIWebBrowserChrome;
|
class nsIWebBrowserChrome;
|
||||||
@@ -48,16 +47,12 @@ class BarProp : public nsISupports, public nsWrapperCache {
|
|||||||
protected:
|
protected:
|
||||||
virtual ~BarProp();
|
virtual ~BarProp();
|
||||||
|
|
||||||
bool GetVisibleByIsPopup();
|
bool GetVisibleByFlag(uint32_t aChromeFlag, ErrorResult& aRv);
|
||||||
bool GetVisibleByFlag(uint32_t aChromeFlag, CallerType aCallerType,
|
|
||||||
ErrorResult& aRv);
|
|
||||||
void SetVisibleByFlag(bool aVisible, uint32_t aChromeFlag,
|
void SetVisibleByFlag(bool aVisible, uint32_t aChromeFlag,
|
||||||
CallerType aCallerType, ErrorResult& aRv);
|
CallerType aCallerType, ErrorResult& aRv);
|
||||||
|
|
||||||
already_AddRefed<nsIWebBrowserChrome> GetBrowserChrome();
|
already_AddRefed<nsIWebBrowserChrome> GetBrowserChrome();
|
||||||
|
|
||||||
BrowsingContext* GetBrowsingContext();
|
|
||||||
|
|
||||||
RefPtr<nsGlobalWindowInner> mDOMWindow;
|
RefPtr<nsGlobalWindowInner> mDOMWindow;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -345,9 +345,9 @@ static already_AddRefed<BrowsingContext> CreateBrowsingContext(
|
|||||||
// for the BrowsingContext, and cause no end of trouble.
|
// for the BrowsingContext, and cause no end of trouble.
|
||||||
if (IsTopContent(parentBC, aOwner)) {
|
if (IsTopContent(parentBC, aOwner)) {
|
||||||
// Create toplevel context without a parent & as Type::Content.
|
// Create toplevel context without a parent & as Type::Content.
|
||||||
return BrowsingContext::CreateDetached(
|
return BrowsingContext::CreateDetached(nullptr, opener, aSpecificGroup,
|
||||||
nullptr, opener, aSpecificGroup, frameName,
|
frameName,
|
||||||
BrowsingContext::Type::Content, false);
|
BrowsingContext::Type::Content);
|
||||||
}
|
}
|
||||||
|
|
||||||
MOZ_ASSERT(!aOpenWindowInfo,
|
MOZ_ASSERT(!aOpenWindowInfo,
|
||||||
@@ -356,7 +356,7 @@ static already_AddRefed<BrowsingContext> CreateBrowsingContext(
|
|||||||
MOZ_ASSERT(!aSpecificGroup,
|
MOZ_ASSERT(!aSpecificGroup,
|
||||||
"Can't force BrowsingContextGroup for non-toplevel context");
|
"Can't force BrowsingContextGroup for non-toplevel context");
|
||||||
return BrowsingContext::CreateDetached(parentInner, nullptr, nullptr,
|
return BrowsingContext::CreateDetached(parentInner, nullptr, nullptr,
|
||||||
frameName, parentBC->GetType(), false,
|
frameName, parentBC->GetType(),
|
||||||
!aNetworkCreated);
|
!aNetworkCreated);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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,
|
||||||
nsIURI* aURI, const nsAString& aName,
|
bool aWidthSpecified, nsIURI* aURI,
|
||||||
const nsACString& aFeatures, bool aForceNoOpener,
|
const nsAString& aName, const nsACString& aFeatures,
|
||||||
bool aForceNoReferrer, bool aIsPopupRequested,
|
bool aForceNoOpener, 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,
|
parent->GetDOMWindow(), aChromeFlags, aCalledFromJS, aWidthSpecified,
|
||||||
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
|
||||||
@@ -848,10 +848,10 @@ BrowserChild::ProvideWindow(nsIOpenWindowInfo* aOpenWindowInfo,
|
|||||||
// open window call was canceled. It's important that we pass this error
|
// open window call was canceled. It's important that we pass this error
|
||||||
// code back to our caller.
|
// code back to our caller.
|
||||||
ContentChild* cc = ContentChild::GetSingleton();
|
ContentChild* cc = ContentChild::GetSingleton();
|
||||||
return cc->ProvideWindowCommon(
|
return cc->ProvideWindowCommon(this, aOpenWindowInfo, aChromeFlags,
|
||||||
this, aOpenWindowInfo, aChromeFlags, aCalledFromJS, aURI, aName,
|
aCalledFromJS, aWidthSpecified, aURI, aName,
|
||||||
aFeatures, aForceNoOpener, aForceNoReferrer, aIsPopupRequested,
|
aFeatures, aForceNoOpener, aForceNoReferrer,
|
||||||
aLoadState, aWindowIsNew, aReturn);
|
aLoadState, aWindowIsNew, aReturn);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BrowserChild::DestroyWindow() {
|
void BrowserChild::DestroyWindow() {
|
||||||
|
|||||||
@@ -966,11 +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, nsIURI* aURI,
|
uint32_t aChromeFlags, bool aCalledFromJS, bool aWidthSpecified,
|
||||||
const nsAString& aName, const nsACString& aFeatures, bool aForceNoOpener,
|
nsIURI* aURI, const nsAString& aName, const nsACString& aFeatures,
|
||||||
bool aForceNoReferrer, bool aIsPopupRequested,
|
bool aForceNoOpener, bool aForceNoReferrer, nsDocShellLoadState* aLoadState,
|
||||||
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;
|
||||||
@@ -1038,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, aURI, features,
|
aTabOpener, parent, aChromeFlags, aCalledFromJS, aWidthSpecified,
|
||||||
fullZoom, name, triggeringPrincipal, csp, referrerInfo,
|
aURI, features, fullZoom, name, triggeringPrincipal, csp,
|
||||||
aOpenWindowInfo->GetOriginAttributes());
|
referrerInfo, 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.
|
||||||
@@ -1059,8 +1058,7 @@ nsresult ContentChild::ProvideWindowCommon(
|
|||||||
}
|
}
|
||||||
|
|
||||||
RefPtr<BrowsingContext> browsingContext = BrowsingContext::CreateDetached(
|
RefPtr<BrowsingContext> browsingContext = BrowsingContext::CreateDetached(
|
||||||
nullptr, openerBC, nullptr, aName, BrowsingContext::Type::Content,
|
nullptr, openerBC, nullptr, aName, BrowsingContext::Type::Content);
|
||||||
aIsPopupRequested);
|
|
||||||
MOZ_ALWAYS_SUCCEEDS(browsingContext->SetRemoteTabs(true));
|
MOZ_ALWAYS_SUCCEEDS(browsingContext->SetRemoteTabs(true));
|
||||||
MOZ_ALWAYS_SUCCEEDS(browsingContext->SetRemoteSubframes(useRemoteSubframes));
|
MOZ_ALWAYS_SUCCEEDS(browsingContext->SetRemoteSubframes(useRemoteSubframes));
|
||||||
MOZ_ALWAYS_SUCCEEDS(browsingContext->SetOriginAttributes(
|
MOZ_ALWAYS_SUCCEEDS(browsingContext->SetOriginAttributes(
|
||||||
@@ -1241,7 +1239,7 @@ nsresult ContentChild::ProvideWindowCommon(
|
|||||||
}
|
}
|
||||||
|
|
||||||
SendCreateWindow(aTabOpener, parent, newChild, aChromeFlags, aCalledFromJS,
|
SendCreateWindow(aTabOpener, parent, newChild, aChromeFlags, aCalledFromJS,
|
||||||
aOpenWindowInfo->GetIsForPrinting(),
|
aWidthSpecified, 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,9 +113,9 @@ 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, nsIURI* aURI,
|
uint32_t aChromeFlags, bool aCalledFromJS, bool aWidthSpecified,
|
||||||
const nsAString& aName, const nsACString& aFeatures, bool aForceNoOpener,
|
nsIURI* aURI, const nsAString& aName, const nsACString& aFeatures,
|
||||||
bool aForceNoReferrer, bool aIsPopupRequested,
|
bool aForceNoOpener, bool aForceNoReferrer,
|
||||||
nsDocShellLoadState* aLoadState, bool* aWindowIsNew,
|
nsDocShellLoadState* aLoadState, bool* aWindowIsNew,
|
||||||
BrowsingContext** aReturn);
|
BrowsingContext** aReturn);
|
||||||
|
|
||||||
|
|||||||
@@ -5129,8 +5129,9 @@ 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& aForPrinting, const bool& aForWindowDotPrint,
|
const bool& aWidthSpecified, const bool& aForPrinting,
|
||||||
nsIURI* aURIToLoad, const nsCString& aFeatures, const float& aFullZoom,
|
const bool& aForWindowDotPrint, nsIURI* aURIToLoad,
|
||||||
|
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,
|
||||||
@@ -5218,7 +5219,7 @@ mozilla::ipc::IPCResult ContentParent::CommonCreateWindow(
|
|||||||
}
|
}
|
||||||
|
|
||||||
aOpenLocation = nsWindowWatcher::GetWindowOpenLocation(
|
aOpenLocation = nsWindowWatcher::GetWindowOpenLocation(
|
||||||
outerWin, aChromeFlags, aCalledFromJS, aForPrinting);
|
outerWin, aChromeFlags, aCalledFromJS, aWidthSpecified, aForPrinting);
|
||||||
|
|
||||||
MOZ_ASSERT(aOpenLocation == nsIBrowserDOMWindow::OPEN_NEWTAB ||
|
MOZ_ASSERT(aOpenLocation == nsIBrowserDOMWindow::OPEN_NEWTAB ||
|
||||||
aOpenLocation == nsIBrowserDOMWindow::OPEN_NEWWINDOW ||
|
aOpenLocation == nsIBrowserDOMWindow::OPEN_NEWWINDOW ||
|
||||||
@@ -5346,8 +5347,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& aForPrinting,
|
const bool& aCalledFromJS, const bool& aWidthSpecified,
|
||||||
const bool& aForPrintPreview, nsIURI* aURIToLoad,
|
const bool& aForPrinting, 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,
|
||||||
@@ -5431,10 +5432,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,
|
||||||
aForPrinting, aForPrintPreview, aURIToLoad, aFeatures, aFullZoom, newTab,
|
aWidthSpecified, aForPrinting, aForPrintPreview, aURIToLoad, aFeatures,
|
||||||
VoidString(), rv, newRemoteTab, &cwi.windowOpened(), openLocation,
|
aFullZoom, newTab, VoidString(), rv, newRemoteTab, &cwi.windowOpened(),
|
||||||
aTriggeringPrincipal, aReferrerInfo, /* aLoadUri = */ false, aCsp,
|
openLocation, aTriggeringPrincipal, aReferrerInfo, /* aLoadUri = */ false,
|
||||||
aOriginAttributes);
|
aCsp, aOriginAttributes);
|
||||||
if (!ipcResult) {
|
if (!ipcResult) {
|
||||||
return ipcResult;
|
return ipcResult;
|
||||||
}
|
}
|
||||||
@@ -5462,8 +5463,9 @@ 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, nsIURI* aURIToLoad,
|
const uint32_t& aChromeFlags, const bool& aCalledFromJS,
|
||||||
const nsCString& aFeatures, const float& aFullZoom, const nsString& aName,
|
const bool& aWidthSpecified, nsIURI* aURIToLoad, const nsCString& aFeatures,
|
||||||
|
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));
|
||||||
@@ -5506,7 +5508,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,
|
||||||
/* aForPrinting = */ false,
|
aWidthSpecified, /* 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,8 +518,9 @@ 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& aForPrinting, const bool& aForWindowDotPrint,
|
const bool& aWidthSpecified, const bool& aForPrinting,
|
||||||
nsIURI* aURIToLoad, const nsCString& aFeatures, const float& aFullZoom,
|
const bool& aForWindowDotPrint, nsIURI* aURIToLoad,
|
||||||
|
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,
|
||||||
@@ -528,9 +529,10 @@ 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,
|
||||||
nsIURI* aURIToLoad, const nsCString& aFeatures, const float& aFullZoom,
|
const bool& aWidthSpecified, nsIURI* aURIToLoad,
|
||||||
const nsString& aName, nsIPrincipal* aTriggeringPrincipal,
|
const nsCString& aFeatures, const float& aFullZoom, const nsString& aName,
|
||||||
nsIContentSecurityPolicy* aCsp, nsIReferrerInfo* aReferrerInfo,
|
nsIPrincipal* aTriggeringPrincipal, nsIContentSecurityPolicy* aCsp,
|
||||||
|
nsIReferrerInfo* aReferrerInfo,
|
||||||
const OriginAttributes& aOriginAttributes);
|
const OriginAttributes& aOriginAttributes);
|
||||||
|
|
||||||
static void BroadcastBlobURLRegistration(
|
static void BroadcastBlobURLRegistration(
|
||||||
@@ -762,8 +764,9 @@ 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& aForPrinting, const bool& aForWindowDotPrint,
|
const bool& aWidthSpecified, const bool& aForPrinting,
|
||||||
nsIURI* aURIToLoad, const nsCString& aFeatures, const float& aFullZoom,
|
const bool& aForWindowDotPrint, nsIURI* aURIToLoad,
|
||||||
|
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,6 +1476,7 @@ 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,
|
||||||
@@ -1492,6 +1493,7 @@ 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,
|
||||||
|
|||||||
@@ -18,51 +18,13 @@ const TARGET_PAGE = ROOT + "dummy.html";
|
|||||||
*/
|
*/
|
||||||
function getToolbarsFromBrowserContent(aBrowser) {
|
function getToolbarsFromBrowserContent(aBrowser) {
|
||||||
return SpecialPowers.spawn(aBrowser, [], async function() {
|
return SpecialPowers.spawn(aBrowser, [], async function() {
|
||||||
// This is still chrome context.
|
return {
|
||||||
// Inject a script that runs on content context, and gather the result.
|
toolbar: content.toolbar.visible,
|
||||||
|
menubar: content.menubar.visible,
|
||||||
let script = content.document.createElement("script");
|
personalbar: content.personalbar.visible,
|
||||||
script.textContent = `
|
statusbar: content.statusbar.visible,
|
||||||
let bars = [
|
locationbar: content.locationbar.visible,
|
||||||
"toolbar",
|
};
|
||||||
"menubar",
|
|
||||||
"personalbar",
|
|
||||||
"statusbar",
|
|
||||||
"scrollbars",
|
|
||||||
"locationbar",
|
|
||||||
];
|
|
||||||
|
|
||||||
for (let bar of bars) {
|
|
||||||
let node = document.createElement("span");
|
|
||||||
node.id = bar;
|
|
||||||
node.textContent = window[bar].visible;
|
|
||||||
document.body.appendChild(node);
|
|
||||||
}
|
|
||||||
`;
|
|
||||||
content.document.body.appendChild(script);
|
|
||||||
|
|
||||||
let result = {};
|
|
||||||
|
|
||||||
let bars = [
|
|
||||||
"toolbar",
|
|
||||||
"menubar",
|
|
||||||
"personalbar",
|
|
||||||
"statusbar",
|
|
||||||
"scrollbars",
|
|
||||||
"locationbar",
|
|
||||||
];
|
|
||||||
|
|
||||||
for (let bar of bars) {
|
|
||||||
let node = content.document.getElementById(bar);
|
|
||||||
let value = node.textContent;
|
|
||||||
if (value !== "true" && value !== "false") {
|
|
||||||
throw new Error("bar visibility isn't set");
|
|
||||||
}
|
|
||||||
result[bar] = value === "true";
|
|
||||||
node.remove();
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -81,7 +43,6 @@ function getToolbarsFromWindowChrome(win) {
|
|||||||
menubar: win.menubar.visible,
|
menubar: win.menubar.visible,
|
||||||
personalbar: win.personalbar.visible,
|
personalbar: win.personalbar.visible,
|
||||||
statusbar: win.statusbar.visible,
|
statusbar: win.statusbar.visible,
|
||||||
scrollbars: win.scrollbars.visible,
|
|
||||||
locationbar: win.locationbar.visible,
|
locationbar: win.locationbar.visible,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -106,42 +67,19 @@ function testDefaultToolbars(toolbars) {
|
|||||||
toolbars.statusbar,
|
toolbars.statusbar,
|
||||||
"statusbar should be visible on default window.open()"
|
"statusbar should be visible on default window.open()"
|
||||||
);
|
);
|
||||||
ok(
|
|
||||||
toolbars.scrollbars,
|
|
||||||
"scrollbars should be visible on default window.open()"
|
|
||||||
);
|
|
||||||
ok(toolbars.toolbar, "toolbar should be visible on default window.open()");
|
ok(toolbars.toolbar, "toolbar should be visible on default window.open()");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests toolbar visibility when opening a popup window on the content context,
|
* Tests toolbar visibility when opening a window with non default parameters
|
||||||
* and reading the value from context context.
|
* on the content context.
|
||||||
|
*
|
||||||
|
* Ensure that locationbar can't be hidden in the content context, see bug#337344.
|
||||||
*
|
*
|
||||||
* @param toolbars
|
* @param toolbars
|
||||||
* the visibility state of the toolbar elements
|
* the visibility state of the toolbar elements
|
||||||
*/
|
*/
|
||||||
function testNonDefaultContentToolbarsFromContent(toolbars) {
|
function testNonDefaultContentToolbars(toolbars) {
|
||||||
// Accessing BarProp.visible from content context should return false for
|
|
||||||
// popup, regardless of the each feature value in window.open parameter.
|
|
||||||
ok(!toolbars.locationbar, "locationbar.visible should be false for popup");
|
|
||||||
ok(!toolbars.menubar, "menubar.visible should be false for popup");
|
|
||||||
ok(!toolbars.personalbar, "personalbar.visible should be false for popup");
|
|
||||||
ok(!toolbars.statusbar, "statusbar.visible should be false for popup");
|
|
||||||
ok(!toolbars.scrollbars, "scrollbars.visible should be false for popup");
|
|
||||||
ok(!toolbars.toolbar, "toolbar.visible should be false for popup");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Tests toolbar visibility when opening a popup window on the content context,
|
|
||||||
* and reading the value from chrome context.
|
|
||||||
*
|
|
||||||
* @param toolbars
|
|
||||||
* the visibility state of the toolbar elements
|
|
||||||
*/
|
|
||||||
function testNonDefaultContentToolbarsFromChrome(toolbars) {
|
|
||||||
// Accessing BarProp.visible from chrome context should return the
|
|
||||||
// actual visibility.
|
|
||||||
|
|
||||||
// Locationbar should always be visible on content context
|
// Locationbar should always be visible on content context
|
||||||
ok(
|
ok(
|
||||||
toolbars.locationbar,
|
toolbars.locationbar,
|
||||||
@@ -154,10 +92,6 @@ function testNonDefaultContentToolbarsFromChrome(toolbars) {
|
|||||||
);
|
);
|
||||||
// statusbar will report visible=true even when it's hidden because of bug#55820
|
// statusbar will report visible=true even when it's hidden because of bug#55820
|
||||||
todo(!toolbars.statusbar, "statusbar shouldn't be visible when status=no");
|
todo(!toolbars.statusbar, "statusbar shouldn't be visible when status=no");
|
||||||
ok(
|
|
||||||
toolbars.scrollbars,
|
|
||||||
"scrollbars should be visible even with scrollbars=no"
|
|
||||||
);
|
|
||||||
ok(!toolbars.toolbar, "toolbar shouldn't be visible when toolbar=no");
|
ok(!toolbars.toolbar, "toolbar shouldn't be visible when toolbar=no");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -180,10 +114,6 @@ function testNonDefaultChromeToolbars(toolbars) {
|
|||||||
"personalbar should not be visible with personalbar=no"
|
"personalbar should not be visible with personalbar=no"
|
||||||
);
|
);
|
||||||
ok(!toolbars.statusbar, "statusbar should not be visible with status=no");
|
ok(!toolbars.statusbar, "statusbar should not be visible with status=no");
|
||||||
ok(
|
|
||||||
toolbars.scrollbars,
|
|
||||||
"scrollbars should be visible even with scrollbars=no"
|
|
||||||
);
|
|
||||||
ok(!toolbars.toolbar, "toolbar should not be visible with toolbar=no");
|
ok(!toolbars.toolbar, "toolbar should not be visible with toolbar=no");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -232,13 +162,13 @@ add_task(async function() {
|
|||||||
|
|
||||||
let popupBrowser = popupWindow.gBrowser.selectedBrowser;
|
let popupBrowser = popupWindow.gBrowser.selectedBrowser;
|
||||||
|
|
||||||
// Test toolbars visibility value from content.
|
// Test toolbars visibility
|
||||||
let popupToolbars = await getToolbarsFromBrowserContent(popupBrowser);
|
let popupToolbars = await getToolbarsFromBrowserContent(popupBrowser);
|
||||||
testNonDefaultContentToolbarsFromContent(popupToolbars);
|
testNonDefaultContentToolbars(popupToolbars);
|
||||||
|
|
||||||
// Test toolbars visibility value from chrome.
|
// Ensure that chrome toolbars agree with content
|
||||||
let chromeToolbars = getToolbarsFromWindowChrome(popupWindow);
|
let chromeToolbars = getToolbarsFromWindowChrome(popupWindow);
|
||||||
testNonDefaultContentToolbarsFromChrome(chromeToolbars);
|
testNonDefaultContentToolbars(chromeToolbars);
|
||||||
|
|
||||||
// Close the new window
|
// Close the new window
|
||||||
await BrowserTestUtils.closeWindow(popupWindow);
|
await BrowserTestUtils.closeWindow(popupWindow);
|
||||||
@@ -272,10 +202,11 @@ add_task(async function() {
|
|||||||
// No need to wait for this window to load, since it's loading about:blank
|
// No need to wait for this window to load, since it's loading about:blank
|
||||||
let popupBrowser = popupWindow.gBrowser.selectedBrowser;
|
let popupBrowser = popupWindow.gBrowser.selectedBrowser;
|
||||||
let popupToolbars = await getToolbarsFromBrowserContent(popupBrowser);
|
let popupToolbars = await getToolbarsFromBrowserContent(popupBrowser);
|
||||||
testNonDefaultContentToolbarsFromContent(popupToolbars);
|
testNonDefaultContentToolbars(popupToolbars);
|
||||||
|
|
||||||
|
// Ensure that chrome toolbars agree with content
|
||||||
let chromeToolbars = getToolbarsFromWindowChrome(popupWindow);
|
let chromeToolbars = getToolbarsFromWindowChrome(popupWindow);
|
||||||
testNonDefaultContentToolbarsFromChrome(chromeToolbars);
|
testNonDefaultContentToolbars(chromeToolbars);
|
||||||
|
|
||||||
// Close the new window
|
// Close the new window
|
||||||
await BrowserTestUtils.closeWindow(popupWindow);
|
await BrowserTestUtils.closeWindow(popupWindow);
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=642338
|
|||||||
// * resizable is false
|
// * resizable is false
|
||||||
// * scrollbars is false
|
// * scrollbars is false
|
||||||
// * status is false
|
// * status is false
|
||||||
|
// * width is specified
|
||||||
var featuresList = [
|
var featuresList = [
|
||||||
{
|
{
|
||||||
type: 'non-popup',
|
type: 'non-popup',
|
||||||
@@ -77,18 +78,11 @@ var featuresList = [
|
|||||||
+ ',resizable=no',
|
+ ',resizable=no',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: 'non-popup',
|
type: 'popup',
|
||||||
target: 'width-sized',
|
target: 'width-sized',
|
||||||
features: 'toolbar=yes,menubar=yes,status=yes,scrollbars=yes'
|
features: 'toolbar=yes,menubar=yes,status=yes,scrollbars=yes'
|
||||||
+ ',width=500',
|
+ ',width=500',
|
||||||
},
|
},
|
||||||
{
|
|
||||||
// if features isnt empty, toolbar and location defaults to false,
|
|
||||||
// and that results in popup.
|
|
||||||
type: 'popup',
|
|
||||||
target: 'only-width-sized',
|
|
||||||
features: 'width=500',
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
type: 'non-popup',
|
type: 'non-popup',
|
||||||
target: 'height-sized',
|
target: 'height-sized',
|
||||||
@@ -96,16 +90,11 @@ var featuresList = [
|
|||||||
+ ',height=500',
|
+ ',height=500',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: 'non-popup',
|
type: 'popup',
|
||||||
target: 'sized',
|
target: 'sized',
|
||||||
features: 'toolbar=yes,menubar=yes,status=yes,scrollbars=yes'
|
features: 'toolbar=yes,menubar=yes,status=yes,scrollbars=yes'
|
||||||
+ ',width=500,height=500',
|
+ ',width=500,height=500',
|
||||||
},
|
},
|
||||||
{
|
|
||||||
type: 'popup',
|
|
||||||
target: 'only-sized',
|
|
||||||
features: 'width=500,height=500',
|
|
||||||
},
|
|
||||||
];
|
];
|
||||||
|
|
||||||
var numWindows = 0;
|
var numWindows = 0;
|
||||||
@@ -121,13 +110,19 @@ function testWindow(w)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// If popup is opened, all BarProp.visible become false.
|
// If popup is opened, the following properties become false:
|
||||||
|
// * menubar.visible
|
||||||
|
// * toolbar.visible
|
||||||
|
// * personalbar.visible
|
||||||
|
// * status.visible
|
||||||
checkFeature('menubar');
|
checkFeature('menubar');
|
||||||
checkFeature('toolbar');
|
checkFeature('toolbar');
|
||||||
checkFeature('personalbar');
|
checkFeature('personalbar');
|
||||||
checkFeature('scrollbars');
|
|
||||||
checkFeature('statusbar');
|
// The following aren't affected by feature.
|
||||||
checkFeature('locationbar');
|
is(w.scrollbars.visible, true, `scrollbars should always be visible (${w.name}).`);
|
||||||
|
is(w.statusbar.visible, true, `statusbar should always be visible (${w.name}).`);
|
||||||
|
is(w.locationbar.visible, true, `locationbar should always be visible (${w.name}).`);
|
||||||
|
|
||||||
w.close();
|
w.close();
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,159 @@
|
|||||||
|
[open-features-is-popup-condition.html?combination]
|
||||||
|
["resizable,scrollbars,status" should set BarProp visibility to false]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
["location=no,menubar=no,resizable,scrollbars,status" should set BarProp visibility to false]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
["location,toolbar,resizable,scrollbars,status" should set BarProp visibility to false]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
["location,toolbar,menubar,resizable=no,scrollbars,status" should set BarProp visibility to false]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
["location,toolbar,menubar,resizable,status" should set BarProp visibility to false]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
["location,toolbar,menubar,resizable,scrollbars" should set BarProp visibility to false]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
["popup=1,location,toolbar,menubar,resizable,scrollbars,status" should set BarProp visibility to false]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
["popup=0,location,toolbar,menubar,resizable,scrollbars" should set BarProp visibility to true]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
|
||||||
|
[open-features-is-popup-condition.html?single-1]
|
||||||
|
["popup" should set BarProp visibility to false]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
["popup=1" should set BarProp visibility to false]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
["popup=0" should set BarProp visibility to true]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
["location" should set BarProp visibility to false]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
["location=yes" should set BarProp visibility to false]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
["location=no" should set BarProp visibility to false]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
["toolbar" should set BarProp visibility to false]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
["toolbar=yes" should set BarProp visibility to false]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
["toolbar=no" should set BarProp visibility to false]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
["menubar" should set BarProp visibility to false]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
["menubar=yes" should set BarProp visibility to false]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
["menubar=no" should set BarProp visibility to false]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
["resizable" should set BarProp visibility to false]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
["resizable=yes" should set BarProp visibility to false]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
["resizable=no" should set BarProp visibility to false]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
|
||||||
|
[open-features-is-popup-condition.html?position]
|
||||||
|
["left=500" should set BarProp visibility to false]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
["screenX=500" should set BarProp visibility to false]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
["top=500" should set BarProp visibility to false]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
["screenY=500" should set BarProp visibility to false]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
["width=500" should set BarProp visibility to false]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
["innerWidth=500" should set BarProp visibility to false]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
["outerWidth=500" should set BarProp visibility to false]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
["height=500" should set BarProp visibility to false]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
["innerHeight=500" should set BarProp visibility to false]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
["outerHeight=500" should set BarProp visibility to false]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
|
||||||
|
[open-features-is-popup-condition.html?single-2]
|
||||||
|
["scrollbars" should set BarProp visibility to false]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
["scrollbars=yes" should set BarProp visibility to false]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
["scrollbars=no" should set BarProp visibility to false]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
["status" should set BarProp visibility to false]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
["status=yes" should set BarProp visibility to false]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
["status=no" should set BarProp visibility to false]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
["titlebar" should set BarProp visibility to false]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
["titlebar=yes" should set BarProp visibility to false]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
["titlebar=no" should set BarProp visibility to false]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
["close" should set BarProp visibility to false]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
["close=yes" should set BarProp visibility to false]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
["close=no" should set BarProp visibility to false]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
["minimizable" should set BarProp visibility to false]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
["minimizable=yes" should set BarProp visibility to false]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
["minimizable=no" should set BarProp visibility to false]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
["personalbar" should set BarProp visibility to false]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
["personalbar=yes" should set BarProp visibility to false]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
["personalbar=no" should set BarProp visibility to false]
|
||||||
|
expected: FAIL
|
||||||
@@ -91,11 +91,6 @@ interface nsIWebBrowserChrome : nsISupports
|
|||||||
|
|
||||||
const unsigned long CHROME_ALL = 0x00000ffe;
|
const unsigned long CHROME_ALL = 0x00000ffe;
|
||||||
|
|
||||||
const unsigned long CHROME_MINIMAL_POPUP =
|
|
||||||
CHROME_WINDOW_BORDERS | CHROME_WINDOW_CLOSE | CHROME_WINDOW_RESIZE |
|
|
||||||
CHROME_LOCATIONBAR | CHROME_STATUSBAR | CHROME_SCROLLBARS |
|
|
||||||
CHROME_TITLEBAR | CHROME_WINDOW_MIN;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The chrome flags for this browser chrome. The implementation should
|
* The chrome flags for this browser chrome. The implementation should
|
||||||
* reflect the value of this attribute by hiding or showing its chrome
|
* reflect the value of this attribute by hiding or showing its chrome
|
||||||
|
|||||||
@@ -47,6 +47,9 @@ 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
|
||||||
@@ -69,10 +72,6 @@ interface nsIWindowProvider : nsISupports
|
|||||||
* the feature string to the window it returns in any way it sees fit.
|
* the feature string to the window it returns in any way it sees fit.
|
||||||
* See the nsIWindowWatcher interface for details on feature strings.
|
* See the nsIWindowWatcher interface for details on feature strings.
|
||||||
*
|
*
|
||||||
* @param aIsPopupRequested True if this window is opened by window.open
|
|
||||||
* with requesting a popup window. This doesn't necessarily mean
|
|
||||||
* whether the actual window is shown as minimal popup or not.
|
|
||||||
*
|
|
||||||
* @param aLoadState Specify setup information of the load in the new window
|
* @param aLoadState Specify setup information of the load in the new window
|
||||||
*
|
*
|
||||||
* @param aWindowIsNew [out] Whether the window being returned was just
|
* @param aWindowIsNew [out] Whether the window being returned was just
|
||||||
@@ -98,12 +97,12 @@ 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,
|
||||||
in boolean aForceNoOpener,
|
in boolean aForceNoOpener,
|
||||||
in boolean aForceNoReferrer,
|
in boolean aForceNoReferrer,
|
||||||
in boolean aIsPopupRequested,
|
|
||||||
in nsDocShellLoadStatePtr aLoadState,
|
in nsDocShellLoadStatePtr aLoadState,
|
||||||
out boolean aWindowIsNew);
|
out boolean aWindowIsNew);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -520,11 +520,7 @@ nsWindowWatcher::OpenWindowWithRemoteTab(nsIRemoteTab* aRemoteTab,
|
|||||||
SizeSpec sizeSpec;
|
SizeSpec sizeSpec;
|
||||||
CalcSizeSpec(features, false, sizeSpec);
|
CalcSizeSpec(features, false, sizeSpec);
|
||||||
|
|
||||||
// This is not initiated by window.open call in content context, and we
|
uint32_t chromeFlags = CalculateChromeFlagsForContent(features, sizeSpec);
|
||||||
// don't need to propagate isPopupRequested out-parameter to the resulting
|
|
||||||
// browsing context.
|
|
||||||
bool unused = false;
|
|
||||||
uint32_t chromeFlags = CalculateChromeFlagsForContent(features, &unused);
|
|
||||||
|
|
||||||
if (isPrivateBrowsingWindow) {
|
if (isPrivateBrowsingWindow) {
|
||||||
chromeFlags |= nsIWebBrowserChrome::CHROME_PRIVATE_WINDOW;
|
chromeFlags |= nsIWebBrowserChrome::CHROME_PRIVATE_WINDOW;
|
||||||
@@ -701,19 +697,17 @@ nsresult nsWindowWatcher::OpenWindowInternal(
|
|||||||
SizeSpec sizeSpec;
|
SizeSpec sizeSpec;
|
||||||
CalcSizeSpec(features, hasChromeParent, sizeSpec);
|
CalcSizeSpec(features, hasChromeParent, sizeSpec);
|
||||||
|
|
||||||
bool isPopupRequested = false;
|
|
||||||
|
|
||||||
// Make sure we calculate the chromeFlags *before* we push the
|
// Make sure we calculate the chromeFlags *before* we push the
|
||||||
// callee context onto the context stack so that
|
// callee context onto the context stack so that
|
||||||
// the calculation sees the actual caller when doing its
|
// the calculation sees the actual caller when doing its
|
||||||
// security checks.
|
// security checks.
|
||||||
if (hasChromeParent && isCallerChrome && XRE_IsParentProcess()) {
|
if (isCallerChrome && XRE_IsParentProcess()) {
|
||||||
chromeFlags =
|
chromeFlags = CalculateChromeFlagsForSystem(
|
||||||
CalculateChromeFlagsForSystem(features, aDialog, uriToLoadIsChrome);
|
features, sizeSpec, aDialog, uriToLoadIsChrome, hasChromeParent);
|
||||||
} 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, &isPopupRequested);
|
chromeFlags = CalculateChromeFlagsForContent(features, sizeSpec);
|
||||||
|
|
||||||
if (aDialog) {
|
if (aDialog) {
|
||||||
MOZ_ASSERT(XRE_IsParentProcess());
|
MOZ_ASSERT(XRE_IsParentProcess());
|
||||||
@@ -845,10 +839,11 @@ nsresult nsWindowWatcher::OpenWindowInternal(
|
|||||||
|
|
||||||
nsCOMPtr<nsIWindowProvider> provider = do_GetInterface(parentTreeOwner);
|
nsCOMPtr<nsIWindowProvider> provider = do_GetInterface(parentTreeOwner);
|
||||||
if (provider) {
|
if (provider) {
|
||||||
rv = provider->ProvideWindow(
|
rv = provider->ProvideWindow(openWindowInfo, chromeFlags, aCalledFromJS,
|
||||||
openWindowInfo, chromeFlags, aCalledFromJS, uriToLoad, name,
|
sizeSpec.WidthSpecified(), uriToLoad, name,
|
||||||
featuresStr, aForceNoOpener, aForceNoReferrer, isPopupRequested,
|
featuresStr, aForceNoOpener,
|
||||||
aLoadState, &windowIsNew, getter_AddRefs(newBC));
|
aForceNoReferrer, aLoadState, &windowIsNew,
|
||||||
|
getter_AddRefs(newBC));
|
||||||
|
|
||||||
if (NS_SUCCEEDED(rv) && newBC) {
|
if (NS_SUCCEEDED(rv) && newBC) {
|
||||||
nsCOMPtr<nsIDocShell> newDocShell = newBC->GetDocShell();
|
nsCOMPtr<nsIDocShell> newDocShell = newBC->GetDocShell();
|
||||||
@@ -1689,7 +1684,7 @@ nsresult nsWindowWatcher::URIfromURL(const nsACString& aURL,
|
|||||||
// static
|
// static
|
||||||
uint32_t nsWindowWatcher::CalculateChromeFlagsHelper(
|
uint32_t nsWindowWatcher::CalculateChromeFlagsHelper(
|
||||||
uint32_t aInitialFlags, const WindowFeatures& aFeatures,
|
uint32_t aInitialFlags, const WindowFeatures& aFeatures,
|
||||||
bool* presenceFlag) {
|
const SizeSpec& aSizeSpec, bool* presenceFlag, bool aHasChromeParent) {
|
||||||
uint32_t chromeFlags = aInitialFlags;
|
uint32_t chromeFlags = aInitialFlags;
|
||||||
|
|
||||||
if (aFeatures.GetBoolWithDefault("titlebar", false, presenceFlag)) {
|
if (aFeatures.GetBoolWithDefault("titlebar", false, presenceFlag)) {
|
||||||
@@ -1724,21 +1719,68 @@ uint32_t nsWindowWatcher::CalculateChromeFlagsHelper(
|
|||||||
chromeFlags |= nsIWebBrowserChrome::CHROME_SCROLLBARS;
|
chromeFlags |= nsIWebBrowserChrome::CHROME_SCROLLBARS;
|
||||||
}
|
}
|
||||||
|
|
||||||
return chromeFlags;
|
if (aHasChromeParent) {
|
||||||
|
return chromeFlags;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Web content isn't allowed to control UI visibility separately, but only
|
||||||
|
// whether to open a popup or not.
|
||||||
|
//
|
||||||
|
// The above code is still necessary to calculate `presenceFlag`.
|
||||||
|
// (`ShouldOpenPopup` early returns and doesn't check all feature)
|
||||||
|
|
||||||
|
if (ShouldOpenPopup(aFeatures, aSizeSpec)) {
|
||||||
|
// Flags for opening a popup, that doesn't have the following:
|
||||||
|
// * nsIWebBrowserChrome::CHROME_TOOLBAR
|
||||||
|
// * nsIWebBrowserChrome::CHROME_PERSONAL_TOOLBAR
|
||||||
|
// * nsIWebBrowserChrome::CHROME_MENUBAR
|
||||||
|
return aInitialFlags | nsIWebBrowserChrome::CHROME_TITLEBAR |
|
||||||
|
nsIWebBrowserChrome::CHROME_WINDOW_CLOSE |
|
||||||
|
nsIWebBrowserChrome::CHROME_LOCATIONBAR |
|
||||||
|
nsIWebBrowserChrome::CHROME_STATUSBAR |
|
||||||
|
nsIWebBrowserChrome::CHROME_WINDOW_RESIZE |
|
||||||
|
nsIWebBrowserChrome::CHROME_WINDOW_MIN |
|
||||||
|
nsIWebBrowserChrome::CHROME_SCROLLBARS;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Otherwise open the current/new tab in the current/new window
|
||||||
|
// (depends on browser.link.open_newwindow).
|
||||||
|
return aInitialFlags | nsIWebBrowserChrome::CHROME_ALL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// static
|
// static
|
||||||
bool nsWindowWatcher::ShouldOpenPopup(const WindowFeatures& aFeatures) {
|
uint32_t nsWindowWatcher::EnsureFlagsSafeForContent(uint32_t aChromeFlags,
|
||||||
|
bool aChromeURL) {
|
||||||
|
aChromeFlags |= nsIWebBrowserChrome::CHROME_TITLEBAR;
|
||||||
|
aChromeFlags |= nsIWebBrowserChrome::CHROME_WINDOW_CLOSE;
|
||||||
|
aChromeFlags &= ~nsIWebBrowserChrome::CHROME_WINDOW_LOWERED;
|
||||||
|
aChromeFlags &= ~nsIWebBrowserChrome::CHROME_WINDOW_RAISED;
|
||||||
|
aChromeFlags &= ~nsIWebBrowserChrome::CHROME_WINDOW_POPUP;
|
||||||
|
/* Untrusted script is allowed to pose modal windows with a chrome
|
||||||
|
scheme. This check could stand to be better. But it effectively
|
||||||
|
prevents untrusted script from opening modal windows in general
|
||||||
|
while still allowing alerts and the like. */
|
||||||
|
if (!aChromeURL) {
|
||||||
|
aChromeFlags &= ~(nsIWebBrowserChrome::CHROME_MODAL |
|
||||||
|
nsIWebBrowserChrome::CHROME_OPENAS_CHROME);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!(aChromeFlags & nsIWebBrowserChrome::CHROME_OPENAS_CHROME)) {
|
||||||
|
aChromeFlags &= ~nsIWebBrowserChrome::CHROME_DEPENDENT;
|
||||||
|
}
|
||||||
|
|
||||||
|
return aChromeFlags;
|
||||||
|
}
|
||||||
|
|
||||||
|
// static
|
||||||
|
bool nsWindowWatcher::ShouldOpenPopup(const WindowFeatures& aFeatures,
|
||||||
|
const SizeSpec& aSizeSpec) {
|
||||||
if (aFeatures.IsEmpty()) {
|
if (aFeatures.IsEmpty()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// NOTE: This is different than chrome-only "popup" feature that is handled
|
// Follow Google Chrome's behavior that opens a popup depending on
|
||||||
// in nsWindowWatcher::CalculateChromeFlagsForSystem.
|
// the following features.
|
||||||
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;
|
||||||
@@ -1760,6 +1802,11 @@ 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;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1768,22 +1815,20 @@ 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 aIsPopupRequested an out parameter that indicates whether a popup
|
* @param aSizeSpec the result of CalcSizeSpec
|
||||||
* is requested by aFeatures
|
|
||||||
* @return the chrome bitmask
|
* @return the chrome bitmask
|
||||||
*/
|
*/
|
||||||
// static
|
// static
|
||||||
uint32_t nsWindowWatcher::CalculateChromeFlagsForContent(
|
uint32_t nsWindowWatcher::CalculateChromeFlagsForContent(
|
||||||
const WindowFeatures& aFeatures, bool* aIsPopupRequested) {
|
const WindowFeatures& aFeatures, const SizeSpec& aSizeSpec) {
|
||||||
if (aFeatures.IsEmpty() || !ShouldOpenPopup(aFeatures)) {
|
if (aFeatures.IsEmpty()) {
|
||||||
// Open the current/new tab in the current/new window
|
|
||||||
// (depends on browser.link.open_newwindow).
|
|
||||||
return nsIWebBrowserChrome::CHROME_ALL;
|
return nsIWebBrowserChrome::CHROME_ALL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Open a minimal popup.
|
uint32_t chromeFlags = CalculateChromeFlagsHelper(
|
||||||
*aIsPopupRequested = true;
|
nsIWebBrowserChrome::CHROME_WINDOW_BORDERS, aFeatures, aSizeSpec);
|
||||||
return nsIWebBrowserChrome::CHROME_MINIMAL_POPUP;
|
|
||||||
|
return EnsureFlagsSafeForContent(chromeFlags);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1792,11 +1837,13 @@ uint32_t nsWindowWatcher::CalculateChromeFlagsForContent(
|
|||||||
* @param aFeatures a string containing a list of named chrome features
|
* @param aFeatures a string containing a list of named chrome features
|
||||||
* @param aDialog affects the assumptions made about unnamed features
|
* @param aDialog affects the assumptions made about unnamed features
|
||||||
* @param aChromeURL true if the window is being sent to a chrome:// URL
|
* @param aChromeURL true if the window is being sent to a chrome:// URL
|
||||||
|
* @param aHasChromeParent true if the parent window is privileged
|
||||||
* @return the chrome bitmask
|
* @return the chrome bitmask
|
||||||
*/
|
*/
|
||||||
// static
|
// static
|
||||||
uint32_t nsWindowWatcher::CalculateChromeFlagsForSystem(
|
uint32_t nsWindowWatcher::CalculateChromeFlagsForSystem(
|
||||||
const WindowFeatures& aFeatures, bool aDialog, bool aChromeURL) {
|
const WindowFeatures& aFeatures, const SizeSpec& aSizeSpec, bool aDialog,
|
||||||
|
bool aChromeURL, bool aHasChromeParent) {
|
||||||
MOZ_ASSERT(XRE_IsParentProcess());
|
MOZ_ASSERT(XRE_IsParentProcess());
|
||||||
MOZ_ASSERT(nsContentUtils::LegacyIsCallerChromeOrNativeCode());
|
MOZ_ASSERT(nsContentUtils::LegacyIsCallerChromeOrNativeCode());
|
||||||
|
|
||||||
@@ -1828,8 +1875,8 @@ uint32_t nsWindowWatcher::CalculateChromeFlagsForSystem(
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Next, allow explicitly named options to override the initial settings */
|
/* Next, allow explicitly named options to override the initial settings */
|
||||||
chromeFlags =
|
chromeFlags = CalculateChromeFlagsHelper(chromeFlags, aFeatures, aSizeSpec,
|
||||||
CalculateChromeFlagsHelper(chromeFlags, aFeatures, &presenceFlag);
|
&presenceFlag, aHasChromeParent);
|
||||||
|
|
||||||
// Determine whether the window is a private browsing window
|
// Determine whether the window is a private browsing window
|
||||||
if (aFeatures.GetBoolWithDefault("private", false, &presenceFlag)) {
|
if (aFeatures.GetBoolWithDefault("private", false, &presenceFlag)) {
|
||||||
@@ -1955,6 +2002,11 @@ uint32_t nsWindowWatcher::CalculateChromeFlagsForSystem(
|
|||||||
chromeFlags->copy_history
|
chromeFlags->copy_history
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// Check security state for use in determing window dimensions
|
||||||
|
if (!aHasChromeParent) {
|
||||||
|
chromeFlags = EnsureFlagsSafeForContent(chromeFlags, aChromeURL);
|
||||||
|
}
|
||||||
|
|
||||||
return chromeFlags;
|
return chromeFlags;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2409,6 +2461,7 @@ 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.
|
||||||
@@ -2464,16 +2517,16 @@ int32_t nsWindowWatcher::GetWindowOpenLocation(nsPIDOMWindowOuter* aParent,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (restrictionPref == 2) {
|
if (restrictionPref == 2) {
|
||||||
// Only continue if there is no special chrome flags - with the exception
|
// Only continue if there are no width feature and no special
|
||||||
// of the remoteness and private flags, which might have been
|
// chrome flags - with the exception of the remoteness and private flags,
|
||||||
// automatically flipped by Gecko.
|
// which might have been 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) {
|
if (uiChromeFlags != nsIWebBrowserChrome::CHROME_ALL || aWidthSpecified) {
|
||||||
return nsIBrowserDOMWindow::OPEN_NEWWINDOW;
|
return nsIBrowserDOMWindow::OPEN_NEWWINDOW;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,7 +54,8 @@ 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 aIsForPrinting);
|
bool aCalledFromJS, bool aWidthSpecified,
|
||||||
|
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.
|
||||||
@@ -87,14 +88,15 @@ 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, bool* aIsPopupRequested);
|
const mozilla::dom::WindowFeatures& aFeatures, const SizeSpec& aSizeSpec);
|
||||||
|
|
||||||
static uint32_t CalculateChromeFlagsForSystem(
|
static uint32_t CalculateChromeFlagsForSystem(
|
||||||
const mozilla::dom::WindowFeatures& aFeatures, bool aDialog,
|
const mozilla::dom::WindowFeatures& aFeatures, const SizeSpec& aSizeSpec,
|
||||||
bool aChromeURL);
|
bool aDialog, bool aChromeURL, bool aHasChromeParent);
|
||||||
|
|
||||||
/* Compute the right SizeSpec based on aFeatures */
|
/* Compute the right SizeSpec based on aFeatures */
|
||||||
static void CalcSizeSpec(const mozilla::dom::WindowFeatures& aFeatures,
|
static void CalcSizeSpec(const mozilla::dom::WindowFeatures& aFeatures,
|
||||||
@@ -115,7 +117,10 @@ class nsWindowWatcher : public nsIWindowWatcher,
|
|||||||
|
|
||||||
static uint32_t CalculateChromeFlagsHelper(
|
static uint32_t CalculateChromeFlagsHelper(
|
||||||
uint32_t aInitialFlags, const mozilla::dom::WindowFeatures& aFeatures,
|
uint32_t aInitialFlags, const mozilla::dom::WindowFeatures& aFeatures,
|
||||||
bool* presenceFlag = nullptr);
|
const SizeSpec& aSizeSpec, bool* presenceFlag = nullptr,
|
||||||
|
bool aHasChromeParent = false);
|
||||||
|
static uint32_t EnsureFlagsSafeForContent(uint32_t aChromeFlags,
|
||||||
|
bool aChromeURL = false);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
nsTArray<nsWatcherWindowEnumerator*> mEnumeratorList;
|
nsTArray<nsWatcherWindowEnumerator*> mEnumeratorList;
|
||||||
|
|||||||
@@ -15,6 +15,11 @@ 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 },
|
||||||
{
|
{
|
||||||
@@ -71,11 +76,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 },
|
||||||
|
|
||||||
// width and innerWidth have no effect.
|
// If either width or innerWidth is specified, popup.
|
||||||
{ features: "location,menubar,scrollbars,status,width=100", popup: false },
|
{ features: "location,menubar,scrollbars,status,width=100", popup: true },
|
||||||
{
|
{
|
||||||
features: "location,menubar,scrollbars,status,innerWidth=100",
|
features: "location,menubar,scrollbars,status,innerWidth=100",
|
||||||
popup: false,
|
popup: true,
|
||||||
},
|
},
|
||||||
|
|
||||||
// outerWidth has no effect.
|
// outerWidth has no effect.
|
||||||
|
|||||||
@@ -521,9 +521,9 @@ NS_IMETHODIMP nsContentTreeOwner::SetTitle(const nsAString& aTitle) {
|
|||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsContentTreeOwner::ProvideWindow(
|
nsContentTreeOwner::ProvideWindow(
|
||||||
nsIOpenWindowInfo* aOpenWindowInfo, uint32_t aChromeFlags,
|
nsIOpenWindowInfo* aOpenWindowInfo, uint32_t aChromeFlags,
|
||||||
bool aCalledFromJS, nsIURI* aURI, const nsAString& aName,
|
bool aCalledFromJS, bool aWidthSpecified, nsIURI* aURI,
|
||||||
const nsACString& aFeatures, bool aForceNoOpener, bool aForceNoReferrer,
|
const nsAString& aName, const nsACString& aFeatures, bool aForceNoOpener,
|
||||||
bool aIsPopupRequested, nsDocShellLoadState* aLoadState, bool* aWindowIsNew,
|
bool aForceNoReferrer, nsDocShellLoadState* aLoadState, bool* aWindowIsNew,
|
||||||
dom::BrowsingContext** aReturn) {
|
dom::BrowsingContext** aReturn) {
|
||||||
NS_ENSURE_ARG_POINTER(aOpenWindowInfo);
|
NS_ENSURE_ARG_POINTER(aOpenWindowInfo);
|
||||||
|
|
||||||
@@ -545,7 +545,7 @@ nsContentTreeOwner::ProvideWindow(
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
int32_t openLocation = nsWindowWatcher::GetWindowOpenLocation(
|
int32_t openLocation = nsWindowWatcher::GetWindowOpenLocation(
|
||||||
parent->GetDOMWindow(), aChromeFlags, aCalledFromJS,
|
parent->GetDOMWindow(), aChromeFlags, aCalledFromJS, aWidthSpecified,
|
||||||
aOpenWindowInfo->GetIsForPrinting());
|
aOpenWindowInfo->GetIsForPrinting());
|
||||||
|
|
||||||
if (openLocation != nsIBrowserDOMWindow::OPEN_NEWTAB &&
|
if (openLocation != nsIBrowserDOMWindow::OPEN_NEWTAB &&
|
||||||
|
|||||||
Reference in New Issue
Block a user