зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset ce050fe2bd45 (bug 1527287) for causing merge conflicts. CLOSED TREE
This commit is contained in:
Родитель
162eb47938
Коммит
72339d0385
|
@ -5749,13 +5749,8 @@ nsBrowserAccess.prototype = {
|
|||
aWhere = Services.prefs.getIntPref("browser.link.open_newwindow");
|
||||
}
|
||||
|
||||
let referrerInfo;
|
||||
if (aFlags & Ci.nsIBrowserDOMWindow.OPEN_NO_REFERRER) {
|
||||
referrerInfo = new ReferrerInfo(Ci.nsIHttpChannel.REFERRER_POLICY_UNSET, false, null);
|
||||
} else {
|
||||
referrerInfo = new ReferrerInfo(Ci.nsIHttpChannel.REFERRER_POLICY_UNSET, true,
|
||||
aOpener ? makeURI(aOpener.location.href) : null);
|
||||
}
|
||||
let referrerInfo = new ReferrerInfo(Ci.nsIHttpChannel.REFERRER_POLICY_UNSET, true,
|
||||
aOpener ? makeURI(aOpener.location.href) : null);
|
||||
if (aOpener && aOpener.document) {
|
||||
referrerInfo.referrerPolicy = aOpener.document.referrerPolicy;
|
||||
}
|
||||
|
|
|
@ -263,16 +263,13 @@ function tunnelToInnerBrowser(outer, inner) {
|
|||
const { detail } = event;
|
||||
event.preventDefault();
|
||||
const uri = Services.io.newURI(detail.url);
|
||||
let flags = Ci.nsIBrowserDOMWindow.OPEN_NEWTAB;
|
||||
if (detail.forceNoReferrer) {
|
||||
flags |= Ci.nsIBrowserDOMWindow.OPEN_NO_REFERRER;
|
||||
}
|
||||
// This API is used mainly because it's near the path used for <a target/> with
|
||||
// regular browser tabs (which calls `openURIInFrame`). The more elaborate APIs
|
||||
// that support openers, window features, etc. didn't seem callable from JS and / or
|
||||
// this event doesn't give enough info to use them.
|
||||
browserWindow.browserDOMWindow
|
||||
.openURI(uri, null, flags, Ci.nsIBrowserDOMWindow.OPEN_NEW,
|
||||
.openURI(uri, null, Ci.nsIBrowserDOMWindow.OPEN_NEWTAB,
|
||||
Ci.nsIBrowserDOMWindow.OPEN_NEW,
|
||||
outer.contentPrincipal);
|
||||
},
|
||||
|
||||
|
|
|
@ -7070,7 +7070,6 @@ nsresult nsGlobalWindowOuter::OpenInternal(
|
|||
|
||||
nsAutoCString options;
|
||||
bool forceNoOpener = aForceNoOpener;
|
||||
bool forceNoReferrer = false;
|
||||
// Unlike other window flags, "noopener" comes from splitting on commas with
|
||||
// HTML whitespace trimming...
|
||||
nsCharSeparatedTokenizerTemplate<nsContentUtils::IsHTMLWhitespace> tok(
|
||||
|
@ -7081,13 +7080,6 @@ nsresult nsGlobalWindowOuter::OpenInternal(
|
|||
forceNoOpener = true;
|
||||
continue;
|
||||
}
|
||||
if (StaticPrefs::dom_window_open_noreferrer_enabled() &&
|
||||
nextTok.LowerCaseEqualsLiteral("noreferrer")) {
|
||||
forceNoReferrer = true;
|
||||
// noreferrer implies noopener
|
||||
forceNoOpener = true;
|
||||
continue;
|
||||
}
|
||||
// Want to create a copy of the options without 'noopener' because having
|
||||
// 'noopener' in the options affects other window features.
|
||||
if (!options.IsEmpty()) {
|
||||
|
@ -7193,7 +7185,7 @@ nsresult nsGlobalWindowOuter::OpenInternal(
|
|||
rv = pwwatch->OpenWindow2(
|
||||
this, url.IsVoid() ? nullptr : url.get(), name_ptr, options_ptr,
|
||||
/* aCalledFromScript = */ true, aDialog, aNavigate, argv,
|
||||
isPopupSpamWindow, forceNoOpener, forceNoReferrer, aLoadState,
|
||||
isPopupSpamWindow, forceNoOpener, aLoadState,
|
||||
getter_AddRefs(domReturn));
|
||||
} else {
|
||||
// Force a system caller here so that the window watcher won't screw us
|
||||
|
@ -7213,7 +7205,7 @@ nsresult nsGlobalWindowOuter::OpenInternal(
|
|||
rv = pwwatch->OpenWindow2(
|
||||
this, url.IsVoid() ? nullptr : url.get(), name_ptr, options_ptr,
|
||||
/* aCalledFromScript = */ false, aDialog, aNavigate, aExtraArgument,
|
||||
isPopupSpamWindow, forceNoOpener, forceNoReferrer, aLoadState,
|
||||
isPopupSpamWindow, forceNoOpener, aLoadState,
|
||||
getter_AddRefs(domReturn));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -114,7 +114,6 @@ BrowserElementParent::DispatchOpenWindowEvent(Element* aOpenerFrameElement,
|
|||
Element* aPopupFrameElement,
|
||||
const nsAString& aURL,
|
||||
const nsAString& aName,
|
||||
bool aForceNoReferrer,
|
||||
const nsAString& aFeatures) {
|
||||
// Dispatch a CustomEvent at aOpenerFrameElement with a detail object
|
||||
// (OpenWindowEventDetail) containing aPopupFrameElement, aURL, aName, and
|
||||
|
@ -131,7 +130,6 @@ BrowserElementParent::DispatchOpenWindowEvent(Element* aOpenerFrameElement,
|
|||
detail.mName = aName;
|
||||
detail.mFeatures = aFeatures;
|
||||
detail.mFrameElement = aPopupFrameElement;
|
||||
detail.mForceNoReferrer = aForceNoReferrer;
|
||||
|
||||
nsIGlobalObject* sgo = aPopupFrameElement->OwnerDoc()->GetScopeObject();
|
||||
if (!sgo) {
|
||||
|
@ -175,8 +173,7 @@ BrowserElementParent::DispatchOpenWindowEvent(Element* aOpenerFrameElement,
|
|||
/*static*/
|
||||
BrowserElementParent::OpenWindowResult BrowserElementParent::OpenWindowOOP(
|
||||
TabParent* aOpenerTabParent, TabParent* aPopupTabParent,
|
||||
const nsAString& aURL, const nsAString& aName, bool aForceNoReferrer,
|
||||
const nsAString& aFeatures) {
|
||||
const nsAString& aURL, const nsAString& aName, const nsAString& aFeatures) {
|
||||
// Create an iframe owned by the same document which owns openerFrameElement.
|
||||
nsCOMPtr<Element> openerFrameElement = aOpenerTabParent->GetOwnerElement();
|
||||
NS_ENSURE_TRUE(openerFrameElement, BrowserElementParent::OPEN_WINDOW_IGNORED);
|
||||
|
@ -195,9 +192,8 @@ BrowserElementParent::OpenWindowResult BrowserElementParent::OpenWindowOOP(
|
|||
// allowed.
|
||||
popupFrameElement->DisallowCreateFrameLoader();
|
||||
|
||||
OpenWindowResult opened =
|
||||
DispatchOpenWindowEvent(openerFrameElement, popupFrameElement, aURL,
|
||||
aName, aForceNoReferrer, aFeatures);
|
||||
OpenWindowResult opened = DispatchOpenWindowEvent(
|
||||
openerFrameElement, popupFrameElement, aURL, aName, aFeatures);
|
||||
|
||||
if (opened != BrowserElementParent::OPEN_WINDOW_ADDED) {
|
||||
return opened;
|
||||
|
@ -253,7 +249,7 @@ BrowserElementParent::OpenWindowInProcess(BrowsingContext* aOpenerWindow,
|
|||
|
||||
OpenWindowResult opened = DispatchOpenWindowEvent(
|
||||
openerFrameElement, popupFrameElement, NS_ConvertUTF8toUTF16(spec), aName,
|
||||
false, NS_ConvertUTF8toUTF16(aFeatures));
|
||||
NS_ConvertUTF8toUTF16(aFeatures));
|
||||
|
||||
if (opened != BrowserElementParent::OPEN_WINDOW_ADDED) {
|
||||
return opened;
|
||||
|
|
|
@ -90,7 +90,6 @@ class BrowserElementParent {
|
|||
dom::TabParent* aPopupTabParent,
|
||||
const nsAString& aURL,
|
||||
const nsAString& aName,
|
||||
bool aForceNoReferrer,
|
||||
const nsAString& aFeatures);
|
||||
|
||||
/**
|
||||
|
@ -112,7 +111,7 @@ class BrowserElementParent {
|
|||
private:
|
||||
static OpenWindowResult DispatchOpenWindowEvent(
|
||||
dom::Element* aOpenerFrameElement, dom::Element* aPopupFrameElement,
|
||||
const nsAString& aURL, const nsAString& aName, bool aForceNoReferrer,
|
||||
const nsAString& aURL, const nsAString& aName,
|
||||
const nsAString& aFeatures);
|
||||
};
|
||||
|
||||
|
|
|
@ -241,7 +241,6 @@ nsresult OpenWindow(const ClientOpenWindowArgs& aArgs,
|
|||
// opener anyway, and we _do_ want the returned
|
||||
// window.
|
||||
/* aForceNoOpener = */ false,
|
||||
/* aForceNoReferrer = */ false,
|
||||
/* aLoadInfp = */ nullptr, getter_AddRefs(newWindow));
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
|
|
|
@ -95,12 +95,6 @@ interface nsIBrowserDOMWindow : nsISupports
|
|||
*/
|
||||
const long OPEN_NO_OPENER = 0x4;
|
||||
|
||||
/**
|
||||
* Don't set the referrer on the navigation inside the window which is
|
||||
* being opened.
|
||||
*/
|
||||
const long OPEN_NO_REFERRER = 0x8;
|
||||
|
||||
/**
|
||||
* Create the content window for the given URI.
|
||||
|
||||
|
|
|
@ -754,18 +754,18 @@ ContentChild::ProvideWindow(mozIDOMWindowProxy* aParent, uint32_t aChromeFlags,
|
|||
bool aCalledFromJS, bool aPositionSpecified,
|
||||
bool aSizeSpecified, nsIURI* aURI,
|
||||
const nsAString& aName, const nsACString& aFeatures,
|
||||
bool aForceNoOpener, bool aForceNoReferrer,
|
||||
bool aForceNoOpener,
|
||||
nsDocShellLoadState* aLoadState, bool* aWindowIsNew,
|
||||
mozIDOMWindowProxy** aReturn) {
|
||||
return ProvideWindowCommon(
|
||||
nullptr, aParent, false, aChromeFlags, aCalledFromJS, aPositionSpecified,
|
||||
aSizeSpecified, aURI, aName, aFeatures, aForceNoOpener, aForceNoReferrer,
|
||||
aLoadState, aWindowIsNew, aReturn);
|
||||
return ProvideWindowCommon(nullptr, aParent, false, aChromeFlags,
|
||||
aCalledFromJS, aPositionSpecified, aSizeSpecified,
|
||||
aURI, aName, aFeatures, aForceNoOpener, aLoadState,
|
||||
aWindowIsNew, aReturn);
|
||||
}
|
||||
|
||||
static nsresult GetCreateWindowParams(mozIDOMWindowProxy* aParent,
|
||||
nsDocShellLoadState* aLoadState,
|
||||
bool aForceNoReferrer, float* aFullZoom,
|
||||
float* aFullZoom,
|
||||
nsIReferrerInfo** aReferrerInfo,
|
||||
nsIPrincipal** aTriggeringPrincipal,
|
||||
nsIContentSecurityPolicy** aCsp) {
|
||||
|
@ -781,11 +781,7 @@ static nsresult GetCreateWindowParams(mozIDOMWindowProxy* aParent,
|
|||
}
|
||||
|
||||
nsCOMPtr<nsIReferrerInfo> referrerInfo;
|
||||
if (aForceNoReferrer) {
|
||||
referrerInfo = new ReferrerInfo(
|
||||
nullptr, mozilla::net::ReferrerPolicy::RP_Unset, false);
|
||||
}
|
||||
if (aLoadState && !referrerInfo) {
|
||||
if (aLoadState) {
|
||||
referrerInfo = aLoadState->GetReferrerInfo();
|
||||
}
|
||||
|
||||
|
@ -846,7 +842,7 @@ nsresult ContentChild::ProvideWindowCommon(
|
|||
TabChild* aTabOpener, mozIDOMWindowProxy* aParent, bool aIframeMoz,
|
||||
uint32_t aChromeFlags, bool aCalledFromJS, bool aPositionSpecified,
|
||||
bool aSizeSpecified, nsIURI* aURI, const nsAString& aName,
|
||||
const nsACString& aFeatures, bool aForceNoOpener, bool aForceNoReferrer,
|
||||
const nsACString& aFeatures, bool aForceNoOpener,
|
||||
nsDocShellLoadState* aLoadState, bool* aWindowIsNew,
|
||||
mozIDOMWindowProxy** aReturn) {
|
||||
*aReturn = nullptr;
|
||||
|
@ -892,10 +888,9 @@ nsresult ContentChild::ProvideWindowCommon(
|
|||
nsCOMPtr<nsIPrincipal> triggeringPrincipal;
|
||||
nsCOMPtr<nsIContentSecurityPolicy> csp;
|
||||
nsCOMPtr<nsIReferrerInfo> referrerInfo;
|
||||
rv = GetCreateWindowParams(aParent, aLoadState, aForceNoReferrer, &fullZoom,
|
||||
getter_AddRefs(referrerInfo),
|
||||
getter_AddRefs(triggeringPrincipal),
|
||||
getter_AddRefs(csp));
|
||||
rv = GetCreateWindowParams(
|
||||
aParent, aLoadState, &fullZoom, getter_AddRefs(referrerInfo),
|
||||
getter_AddRefs(triggeringPrincipal), getter_AddRefs(csp));
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
|
@ -1111,18 +1106,17 @@ nsresult ContentChild::ProvideWindowCommon(
|
|||
|
||||
// NOTE: BrowserFrameOpenWindowPromise is the same type as
|
||||
// CreateWindowPromise, and this code depends on that fact.
|
||||
newChild->SendBrowserFrameOpenWindow(
|
||||
aTabOpener, NS_ConvertUTF8toUTF16(url), name, aForceNoReferrer,
|
||||
NS_ConvertUTF8toUTF16(features), std::move(resolve), std::move(reject));
|
||||
newChild->SendBrowserFrameOpenWindow(aTabOpener, NS_ConvertUTF8toUTF16(url),
|
||||
name, NS_ConvertUTF8toUTF16(features),
|
||||
std::move(resolve), std::move(reject));
|
||||
} else {
|
||||
float fullZoom;
|
||||
nsCOMPtr<nsIPrincipal> triggeringPrincipal;
|
||||
nsCOMPtr<nsIContentSecurityPolicy> csp;
|
||||
nsCOMPtr<nsIReferrerInfo> referrerInfo;
|
||||
rv = GetCreateWindowParams(aParent, aLoadState, aForceNoReferrer, &fullZoom,
|
||||
getter_AddRefs(referrerInfo),
|
||||
getter_AddRefs(triggeringPrincipal),
|
||||
getter_AddRefs(csp));
|
||||
rv = GetCreateWindowParams(
|
||||
aParent, aLoadState, &fullZoom, getter_AddRefs(referrerInfo),
|
||||
getter_AddRefs(triggeringPrincipal), getter_AddRefs(csp));
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
|
|
|
@ -109,13 +109,15 @@ class ContentChild final : public PContentChild,
|
|||
nsCString sourceURL;
|
||||
};
|
||||
|
||||
nsresult ProvideWindowCommon(
|
||||
TabChild* aTabOpener, mozIDOMWindowProxy* aParent, bool aIframeMoz,
|
||||
uint32_t aChromeFlags, bool aCalledFromJS, bool aPositionSpecified,
|
||||
bool aSizeSpecified, nsIURI* aURI, const nsAString& aName,
|
||||
const nsACString& aFeatures, bool aForceNoOpener, bool aForceNoReferrer,
|
||||
nsDocShellLoadState* aLoadState, bool* aWindowIsNew,
|
||||
mozIDOMWindowProxy** aReturn);
|
||||
nsresult ProvideWindowCommon(TabChild* aTabOpener,
|
||||
mozIDOMWindowProxy* aOpener, bool aIframeMoz,
|
||||
uint32_t aChromeFlags, bool aCalledFromJS,
|
||||
bool aPositionSpecified, bool aSizeSpecified,
|
||||
nsIURI* aURI, const nsAString& aName,
|
||||
const nsACString& aFeatures, bool aForceNoOpener,
|
||||
nsDocShellLoadState* aLoadState,
|
||||
bool* aWindowIsNew,
|
||||
mozIDOMWindowProxy** aReturn);
|
||||
|
||||
bool Init(MessageLoop* aIOLoop, base::ProcessId aParentPid,
|
||||
const char* aParentBuildID, IPC::Channel* aChannel,
|
||||
|
|
|
@ -454,8 +454,7 @@ parent:
|
|||
* @param opener the PBrowser whose content called window.open.
|
||||
*/
|
||||
async BrowserFrameOpenWindow(PBrowser opener,
|
||||
nsString aURL, nsString aName,
|
||||
bool aForceNoReferrer, nsString aFeatures)
|
||||
nsString aURL, nsString aName, nsString aFeatures)
|
||||
returns (CreatedWindowInfo window);
|
||||
|
||||
/**
|
||||
|
|
|
@ -901,9 +901,8 @@ TabChild::ProvideWindow(mozIDOMWindowProxy* aParent, uint32_t aChromeFlags,
|
|||
bool aCalledFromJS, bool aPositionSpecified,
|
||||
bool aSizeSpecified, nsIURI* aURI,
|
||||
const nsAString& aName, const nsACString& aFeatures,
|
||||
bool aForceNoOpener, bool aForceNoReferrer,
|
||||
nsDocShellLoadState* aLoadState, bool* aWindowIsNew,
|
||||
mozIDOMWindowProxy** aReturn) {
|
||||
bool aForceNoOpener, nsDocShellLoadState* aLoadState,
|
||||
bool* aWindowIsNew, mozIDOMWindowProxy** aReturn) {
|
||||
*aReturn = nullptr;
|
||||
|
||||
// If aParent is inside an <iframe mozbrowser> and this isn't a request to
|
||||
|
@ -936,8 +935,8 @@ TabChild::ProvideWindow(mozIDOMWindowProxy* aParent, uint32_t aChromeFlags,
|
|||
ContentChild* cc = ContentChild::GetSingleton();
|
||||
return cc->ProvideWindowCommon(
|
||||
this, aParent, iframeMoz, aChromeFlags, aCalledFromJS, aPositionSpecified,
|
||||
aSizeSpecified, aURI, aName, aFeatures, aForceNoOpener, aForceNoReferrer,
|
||||
aLoadState, aWindowIsNew, aReturn);
|
||||
aSizeSpecified, aURI, aName, aFeatures, aForceNoOpener, aLoadState,
|
||||
aWindowIsNew, aReturn);
|
||||
}
|
||||
|
||||
void TabChild::DestroyWindow() {
|
||||
|
|
|
@ -2875,16 +2875,14 @@ void TabParent::ApzAwareEventRoutingToChild(ScrollableLayerGuid* aOutTargetGuid,
|
|||
|
||||
mozilla::ipc::IPCResult TabParent::RecvBrowserFrameOpenWindow(
|
||||
PBrowserParent* aOpener, const nsString& aURL, const nsString& aName,
|
||||
bool aForceNoReferrer, const nsString& aFeatures,
|
||||
BrowserFrameOpenWindowResolver&& aResolve) {
|
||||
const nsString& aFeatures, BrowserFrameOpenWindowResolver&& aResolve) {
|
||||
CreatedWindowInfo cwi;
|
||||
cwi.rv() = NS_OK;
|
||||
cwi.maxTouchPoints() = 0;
|
||||
|
||||
BrowserElementParent::OpenWindowResult opened =
|
||||
BrowserElementParent::OpenWindowOOP(TabParent::GetFrom(aOpener), this,
|
||||
aURL, aName, aForceNoReferrer,
|
||||
aFeatures);
|
||||
aURL, aName, aFeatures);
|
||||
cwi.windowOpened() = (opened == BrowserElementParent::OPEN_WINDOW_ADDED);
|
||||
nsCOMPtr<nsIWidget> widget = GetWidget();
|
||||
if (widget) {
|
||||
|
|
|
@ -192,8 +192,7 @@ class TabParent final : public PBrowserParent,
|
|||
|
||||
mozilla::ipc::IPCResult RecvBrowserFrameOpenWindow(
|
||||
PBrowserParent* aOpener, const nsString& aURL, const nsString& aName,
|
||||
bool aForceNoReferrer, const nsString& aFeatures,
|
||||
BrowserFrameOpenWindowResolver&& aResolve);
|
||||
const nsString& aFeatures, BrowserFrameOpenWindowResolver&& aResolve);
|
||||
|
||||
mozilla::ipc::IPCResult RecvSyncMessage(
|
||||
const nsString& aMessage, const ClonedMessageData& aData,
|
||||
|
|
|
@ -10,11 +10,11 @@ const TESTS = [
|
|||
|
||||
{id: "#test7", name: "", opener: true, newWindow: false},
|
||||
{id: "#test8", name: "", opener: false, newWindow: false},
|
||||
{id: "#test9", name: "", opener: false, newWindow: false},
|
||||
{id: "#test9", name: "", opener: true, newWindow: true},
|
||||
|
||||
{id: "#test10", name: "uniquename1", opener: true, newWindow: false},
|
||||
{id: "#test11", name: "uniquename2", opener: false, newWindow: false},
|
||||
{id: "#test12", name: "uniquename3", opener: false, newWindow: false},
|
||||
{id: "#test12", name: "uniquename3", opener: true, newWindow: true},
|
||||
];
|
||||
|
||||
const TEST_URL = "http://mochi.test:8888/browser/dom/tests/browser/test_noopener_source.html";
|
||||
|
@ -99,10 +99,6 @@ async function doAllTests() {
|
|||
// constant starting and stopping processes, and opens a new window ~144 times.
|
||||
requestLongerTimeout(25);
|
||||
|
||||
add_task(async function prepare() {
|
||||
await SpecialPowers.pushPrefEnv({set: [["dom.window.open.noreferrer.enabled", true]]});
|
||||
});
|
||||
|
||||
add_task(async function newtab_sameproc() {
|
||||
await SpecialPowers.pushPrefEnv({set: [[OPEN_NEWWINDOW_PREF, OPEN_NEWTAB],
|
||||
[NOOPENER_NEWPROC_PREF, false]]});
|
||||
|
|
|
@ -12,7 +12,6 @@ dictionary OpenWindowEventDetail {
|
|||
DOMString name = "";
|
||||
DOMString features = "";
|
||||
Node? frameElement = null;
|
||||
boolean forceNoReferrer = false;
|
||||
};
|
||||
|
||||
dictionary DOMWindowResizeEventDetail {
|
||||
|
|
|
@ -3412,11 +3412,10 @@ nsBrowserAccess.prototype = {
|
|||
Services.io.offline = false;
|
||||
|
||||
let referrer;
|
||||
let forceNoReferrer = !!(aFlags & Ci.nsIBrowserDOMWindow.OPEN_NO_REFERRER);
|
||||
if (aOpener) {
|
||||
try {
|
||||
let location = aOpener.location;
|
||||
referrer = forceNoReferrer ? null : Services.io.newURI(location);
|
||||
referrer = Services.io.newURI(location);
|
||||
} catch(e) { }
|
||||
}
|
||||
|
||||
|
|
|
@ -590,14 +590,6 @@ VARCACHE_PREF(
|
|||
bool, true
|
||||
)
|
||||
|
||||
// Enable the "noreferrer" feature argument for window.open()
|
||||
VARCACHE_PREF(
|
||||
"dom.window.open.noreferrer.enabled",
|
||||
dom_window_open_noreferrer_enabled,
|
||||
bool, true
|
||||
)
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Extension prefs
|
||||
//---------------------------------------------------------------------------
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
[window-open-noreferrer.html]
|
||||
[window.open() with "noreferrer" tests]
|
||||
expected: FAIL
|
||||
|
|
@ -106,7 +106,6 @@ interface nsIWindowProvider : nsISupports
|
|||
in AString aName,
|
||||
in AUTF8String aFeatures,
|
||||
in boolean aForceNoOpener,
|
||||
in boolean aForceNoReferrer,
|
||||
in nsDocShellLoadStatePtr aLoadState,
|
||||
out boolean aWindowIsNew);
|
||||
};
|
||||
|
|
|
@ -89,7 +89,6 @@ interface nsPIWindowWatcher : nsISupports
|
|||
in nsISupports aArgs,
|
||||
in boolean aIsPopupSpam,
|
||||
in boolean aForceNoOpener,
|
||||
in boolean aForceNoReferrer,
|
||||
in nsDocShellLoadStatePtr aLoadState);
|
||||
|
||||
/**
|
||||
|
|
|
@ -292,7 +292,6 @@ nsWindowWatcher::OpenWindow(mozIDOMWindowProxy* aParent, const char* aUrl,
|
|||
/* navigate = */ true, argv,
|
||||
/* aIsPopupSpam = */ false,
|
||||
/* aForceNoOpener = */ false,
|
||||
/* aForceNoReferrer = */ false,
|
||||
/* aLoadState = */ nullptr, aResult);
|
||||
}
|
||||
|
||||
|
@ -348,7 +347,6 @@ nsWindowWatcher::OpenWindow2(mozIDOMWindowProxy* aParent, const char* aUrl,
|
|||
bool aCalledFromScript, bool aDialog,
|
||||
bool aNavigate, nsISupports* aArguments,
|
||||
bool aIsPopupSpam, bool aForceNoOpener,
|
||||
bool aForceNoReferrer,
|
||||
nsDocShellLoadState* aLoadState,
|
||||
mozIDOMWindowProxy** aResult) {
|
||||
nsCOMPtr<nsIArray> argv = ConvertArgsToArray(aArguments);
|
||||
|
@ -368,8 +366,7 @@ nsWindowWatcher::OpenWindow2(mozIDOMWindowProxy* aParent, const char* aUrl,
|
|||
|
||||
return OpenWindowInternal(aParent, aUrl, aName, aFeatures, aCalledFromScript,
|
||||
dialog, aNavigate, argv, aIsPopupSpam,
|
||||
aForceNoOpener, aForceNoReferrer, aLoadState,
|
||||
aResult);
|
||||
aForceNoOpener, aLoadState, aResult);
|
||||
}
|
||||
|
||||
// This static function checks if the aDocShell uses an UserContextId equal to
|
||||
|
@ -581,10 +578,7 @@ nsresult nsWindowWatcher::OpenWindowInternal(
|
|||
mozIDOMWindowProxy* aParent, const char* aUrl, const char* aName,
|
||||
const char* aFeatures, bool aCalledFromJS, bool aDialog, bool aNavigate,
|
||||
nsIArray* aArgv, bool aIsPopupSpam, bool aForceNoOpener,
|
||||
bool aForceNoReferrer, nsDocShellLoadState* aLoadState,
|
||||
mozIDOMWindowProxy** aResult) {
|
||||
MOZ_ASSERT_IF(aForceNoReferrer, aForceNoOpener);
|
||||
|
||||
nsDocShellLoadState* aLoadState, mozIDOMWindowProxy** aResult) {
|
||||
nsresult rv = NS_OK;
|
||||
bool isNewToplevelWindow = false;
|
||||
bool windowIsNew = false;
|
||||
|
@ -767,8 +761,7 @@ nsresult nsWindowWatcher::OpenWindowInternal(
|
|||
rv = provider->ProvideWindow(
|
||||
aParent, chromeFlags, aCalledFromJS, sizeSpec.PositionSpecified(),
|
||||
sizeSpec.SizeSpecified(), uriToLoad, name, features, aForceNoOpener,
|
||||
aForceNoReferrer, aLoadState, &windowIsNew,
|
||||
getter_AddRefs(newWindow));
|
||||
aLoadState, &windowIsNew, getter_AddRefs(newWindow));
|
||||
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
GetWindowTreeItem(newWindow, getter_AddRefs(newDocShellItem));
|
||||
|
@ -1086,22 +1079,20 @@ nsresult nsWindowWatcher::OpenWindowInternal(
|
|||
"nsWindowWatcher: triggeringPrincipal required");
|
||||
#endif
|
||||
|
||||
if (!aForceNoReferrer) {
|
||||
/* use the URL from the *extant* document, if any. The usual accessor
|
||||
GetDocument will synchronously create an about:blank document if
|
||||
it has no better answer, and we only care about a real document.
|
||||
Also using GetDocument to force document creation seems to
|
||||
screw up focus in the hidden window; see bug 36016.
|
||||
*/
|
||||
RefPtr<Document> doc = GetEntryDocument();
|
||||
if (!doc && parentWindow) {
|
||||
doc = parentWindow->GetExtantDoc();
|
||||
}
|
||||
if (doc) {
|
||||
nsCOMPtr<nsIReferrerInfo> referrerInfo =
|
||||
new ReferrerInfo(doc->GetDocumentURI(), doc->GetReferrerPolicy());
|
||||
loadState->SetReferrerInfo(referrerInfo);
|
||||
}
|
||||
/* use the URL from the *extant* document, if any. The usual accessor
|
||||
GetDocument will synchronously create an about:blank document if
|
||||
it has no better answer, and we only care about a real document.
|
||||
Also using GetDocument to force document creation seems to
|
||||
screw up focus in the hidden window; see bug 36016.
|
||||
*/
|
||||
RefPtr<Document> doc = GetEntryDocument();
|
||||
if (!doc && parentWindow) {
|
||||
doc = parentWindow->GetExtantDoc();
|
||||
}
|
||||
if (doc) {
|
||||
nsCOMPtr<nsIReferrerInfo> referrerInfo =
|
||||
new ReferrerInfo(doc->GetDocumentURI(), doc->GetReferrerPolicy());
|
||||
loadState->SetReferrerInfo(referrerInfo);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -84,7 +84,7 @@ class nsWindowWatcher : public nsIWindowWatcher,
|
|||
const char* aName, const char* aFeatures,
|
||||
bool aCalledFromJS, bool aDialog, bool aNavigate,
|
||||
nsIArray* aArgv, bool aIsPopupSpam,
|
||||
bool aForceNoOpener, bool aForceNoReferrer,
|
||||
bool aForceNoOpener,
|
||||
nsDocShellLoadState* aLoadState,
|
||||
mozIDOMWindowProxy** aResult);
|
||||
|
||||
|
|
|
@ -703,7 +703,7 @@ nsContentTreeOwner::ProvideWindow(
|
|||
mozIDOMWindowProxy* aParent, uint32_t aChromeFlags, bool aCalledFromJS,
|
||||
bool aPositionSpecified, bool aSizeSpecified, nsIURI* aURI,
|
||||
const nsAString& aName, const nsACString& aFeatures, bool aForceNoOpener,
|
||||
bool aForceNoReferrer, nsDocShellLoadState* aLoadState, bool* aWindowIsNew,
|
||||
nsDocShellLoadState* aLoadState, bool* aWindowIsNew,
|
||||
mozIDOMWindowProxy** aReturn) {
|
||||
NS_ENSURE_ARG_POINTER(aParent);
|
||||
|
||||
|
@ -797,9 +797,6 @@ nsContentTreeOwner::ProvideWindow(
|
|||
if (aForceNoOpener) {
|
||||
flags |= nsIBrowserDOMWindow::OPEN_NO_OPENER;
|
||||
}
|
||||
if (aForceNoReferrer) {
|
||||
flags |= nsIBrowserDOMWindow::OPEN_NO_REFERRER;
|
||||
}
|
||||
|
||||
// Get a new rendering area from the browserDOMWin.
|
||||
// Since we are not loading any URI, we follow the principle of least
|
||||
|
|
Загрузка…
Ссылка в новой задаче