Backed out changeset 6036b8acdab5 (bug 1284395) for asserting in ChromeUtils::IsOriginAttributesEqualIgnoringAddonId at nsDocShell.cpp:8007 for Windows debug builds. r=backout

This commit is contained in:
Sebastian Hengst 2016-09-19 17:10:09 +02:00
Родитель 8abbf66ced
Коммит e183b1ce5d
11 изменённых файлов: 15 добавлений и 104 удалений

Просмотреть файл

@ -1128,7 +1128,6 @@ var gBrowserInit = {
// [4]: allowThirdPartyFixup (bool)
// [5]: referrerPolicy (int)
// [6]: userContextId (int)
// [7]: originPrincipal (nsIPrincipal)
else if (window.arguments.length >= 3) {
let referrerURI = window.arguments[2];
if (typeof(referrerURI) == "string") {
@ -1143,10 +1142,7 @@ var gBrowserInit = {
let userContextId = (window.arguments[6] != undefined ?
window.arguments[6] : Ci.nsIScriptSecurityManager.DEFAULT_USER_CONTEXT_ID);
loadURI(uriToLoad, referrerURI, window.arguments[3] || null,
window.arguments[4] || false, referrerPolicy, userContextId,
// pass the origin principal (if any) and force its use to create
// an initial about:blank viewer if present:
window.arguments[7], !!window.arguments[7]);
window.arguments[4] || false, referrerPolicy, userContextId);
window.focus();
}
// Note: loadOneOrMoreURIs *must not* be called if window.arguments.length >= 3.
@ -2037,17 +2033,14 @@ function BrowserTryToCloseWindow()
}
function loadURI(uri, referrer, postData, allowThirdPartyFixup, referrerPolicy,
userContextId, originPrincipal, forceAboutBlankViewerInCurrent) {
userContextId) {
try {
openLinkIn(uri, "current",
{ referrerURI: referrer,
referrerPolicy: referrerPolicy,
postData: postData,
allowThirdPartyFixup: allowThirdPartyFixup,
userContextId: userContextId,
originPrincipal,
forceAboutBlankViewerInCurrent,
});
userContextId: userContextId });
} catch (e) {}
}
@ -5577,14 +5570,11 @@ function handleLinkClick(event, href, linkNode) {
}
urlSecurityCheck(href, doc.nodePrincipal);
let params = {
charset: doc.characterSet,
let params = { charset: doc.characterSet,
allowMixedContent: persistAllowMixedContentInChildTab,
referrerURI: referrerURI,
referrerPolicy: referrerPolicy,
noReferrer: BrowserUtils.linkHasNoReferrer(linkNode),
originPrincipal: doc.nodePrincipal,
};
noReferrer: BrowserUtils.linkHasNoReferrer(linkNode) };
// The new tab/window must use the same userContextId
if (doc.nodePrincipal.originAttributes.userContextId) {

Просмотреть файл

@ -503,7 +503,6 @@ var ClickEventHandler = {
json.allowMixedContent = true;
} catch (e) {}
}
json.originPrincipal = ownerDoc.nodePrincipal;
sendAsyncMessage("Content:Click", json);
return;

Просмотреть файл

@ -965,7 +965,6 @@ nsContextMenu.prototype = {
_openLinkInParameters : function (extra) {
let params = { charset: gContextMenuContentData.charSet,
originPrincipal: this.principal,
referrerURI: gContextMenuContentData.documentURIObject,
referrerPolicy: gContextMenuContentData.referrerPolicy,
noReferrer: this.linkHasNoReferrer };

Просмотреть файл

@ -1500,7 +1500,6 @@
var aNoReferrer;
var aUserContextId;
var aRelatedBrowser;
var aOriginPrincipal;
if (arguments.length == 2 &&
typeof arguments[1] == "object" &&
!(arguments[1] instanceof Ci.nsIURI)) {
@ -1519,7 +1518,6 @@
aNoReferrer = params.noReferrer;
aUserContextId = params.userContextId;
aRelatedBrowser = params.relatedBrowser;
aOriginPrincipal = params.originPrincipal;
}
var bgLoad = (aLoadInBackground != null) ? aLoadInBackground :
@ -1539,7 +1537,6 @@
forceNotRemote: aForceNotRemote,
noReferrer: aNoReferrer,
userContextId: aUserContextId,
originPrincipal: aOriginPrincipal,
relatedBrowser: aRelatedBrowser });
if (!bgLoad)
this.selectedTab = tab;
@ -1997,7 +1994,6 @@
var aUserContextId;
var aEventDetail;
var aRelatedBrowser;
var aOriginPrincipal;
if (arguments.length == 2 &&
typeof arguments[1] == "object" &&
!(arguments[1] instanceof Ci.nsIURI)) {
@ -2017,7 +2013,6 @@
aUserContextId = params.userContextId;
aEventDetail = params.eventDetail;
aRelatedBrowser = params.relatedBrowser;
aOriginPrincipal = params.originPrincipal;
}
// if we're adding tabs, we're past interrupt mode, ditch the owner
@ -2097,10 +2092,6 @@
var evt = new CustomEvent("TabOpen", { bubbles: true, detail });
t.dispatchEvent(evt);
if (!usingPreloadedContent && aOriginPrincipal) {
b.createAboutBlankContentViewer(aOriginPrincipal);
}
// If we didn't swap docShells with a preloaded browser
// then let's just continue loading the page normally.
if (!usingPreloadedContent && !uriIsAboutBlank) {

Просмотреть файл

@ -342,7 +342,6 @@ subsuite = clipboard
[browser_mixed_content_cert_override.js]
[browser_mixedcontent_securityflags.js]
tags = mcb
[browser_modifiedclick_inherit_principal.js]
[browser_offlineQuotaNotification.js]
skip-if = buildapp == 'mulet'
[browser_feed_discovery.js]

Просмотреть файл

@ -1,30 +0,0 @@
"use strict";
const kURL =
"http://example.com/browser/browser/base/content/test/general/dummy_page.html";
"data:text/html,<a href=''>Middle-click me</a>";
/*
* Check that when manually opening content JS links in new tabs/windows,
* we use the correct principal, and we don't clear the URL bar.
*/
add_task(function* () {
yield BrowserTestUtils.withNewTab(kURL, function* (browser) {
let newTabPromise = BrowserTestUtils.waitForNewTab(gBrowser);
yield ContentTask.spawn(browser, null, function* () {
let a = content.document.createElement("a");
a.href = "javascript:document.write('spoof'); void(0);";
a.textContent = "Some link";
content.document.body.appendChild(a);
});
info("Added element");
yield BrowserTestUtils.synthesizeMouseAtCenter("a", {button: 1}, browser);
let newTab = yield newTabPromise;
is(newTab.linkedBrowser.contentPrincipal.origin, "http://example.com",
"Principal should be for example.com");
yield BrowserTestUtils.switchTab(gBrowser, newTab);
info(gURLBar.value);
isnot(gURLBar.value, "", "URL bar should not be empty.");
yield BrowserTestUtils.removeTab(newTab);
});
});

Просмотреть файл

@ -222,9 +222,6 @@ function openLinkIn(url, where, params) {
var aAllowPopups = !!params.allowPopups;
var aUserContextId = params.userContextId;
var aIndicateErrorPageLoad = params.indicateErrorPageLoad;
var aPrincipal = params.originPrincipal;
var aForceAboutBlankViewerInCurrent =
params.forceAboutBlankViewerInCurrent;
if (where == "save") {
// TODO(1073187): propagate referrerPolicy.
@ -293,7 +290,6 @@ function openLinkIn(url, where, params) {
sa.AppendElement(allowThirdPartyFixupSupports);
sa.AppendElement(referrerPolicySupports);
sa.AppendElement(userContextIdSupports);
sa.AppendElement(aPrincipal);
let features = "chrome,dialog=no,all";
if (aIsPrivate) {
@ -361,10 +357,6 @@ function openLinkIn(url, where, params) {
flags |= Ci.nsIWebNavigation.LOAD_FLAGS_ERROR_LOAD_CHANGES_RV;
}
if (aForceAboutBlankViewerInCurrent) {
w.gBrowser.selectedBrowser.createAboutBlankContentViewer(aPrincipal);
}
w.gBrowser.loadURIWithFlags(url, {
flags: flags,
referrerURI: aNoReferrer ? null : aReferrerURI,
@ -388,8 +380,7 @@ function openLinkIn(url, where, params) {
skipAnimation: aSkipTabAnimation,
allowMixedContent: aAllowMixedContent,
noReferrer: aNoReferrer,
userContextId: aUserContextId,
originPrincipal: aPrincipal,
userContextId: aUserContextId
});
break;
}

Просмотреть файл

@ -77,15 +77,12 @@ var ContentClick = {
// Todo(903022): code for where == save
let params = {
charset: browser.characterSet,
let params = { charset: browser.characterSet,
referrerURI: browser.documentURI,
referrerPolicy: json.referrerPolicy,
noReferrer: json.noReferrer,
allowMixedContent: json.allowMixedContent,
isContentWindowPrivate: json.isContentWindowPrivate,
originPrincipal: json.originPrincipal,
};
isContentWindowPrivate: json.isContentWindowPrivate};
// The new tab/window must use the same userContextId.
if (json.originAttributes.userContextId) {

Просмотреть файл

@ -565,13 +565,6 @@ addMessageListener("Browser:Thumbnail:GetOriginalURL", function (aMessage) {
});
});
/**
* Remote createAboutBlankContentViewer request handler.
*/
addMessageListener("Browser:CreateAboutBlank", function(aMessage) {
docShell.createAboutBlankContentViewer(aMessage.data);
});
// The AddonsChild needs to be rooted so that it stays alive as long as
// the tab.
var AddonsChild = RemoteAddonsChild.init(this);

Просмотреть файл

@ -1038,15 +1038,6 @@
</body>
</method>
<method name="createAboutBlankContentViewer">
<parameter name="aPrincipal"/>
<body>
<![CDATA[
this.docShell.createAboutBlankContentViewer(aPrincipal);
]]>
</body>
</method>
<field name="_AUTOSCROLL_SNAP">10</field>
<field name="_scrolling">false</field>
<field name="_startX">null</field>

Просмотреть файл

@ -561,15 +561,6 @@
]]>
</body>
</method>
<method name="createAboutBlankContentViewer">
<parameter name="aPrincipal"/>
<body>
<![CDATA[
this.messageManager.sendAsyncMessage("Browser:CreateAboutBlank", aPrincipal);
]]>
</body>
</method>
</implementation>
<handlers>
<handler event="dragstart">