From e183b1ce5d629f2bb99497ebe65bbf20005976a1 Mon Sep 17 00:00:00 2001 From: Sebastian Hengst Date: Mon, 19 Sep 2016 17:10:09 +0200 Subject: [PATCH] Backed out changeset 6036b8acdab5 (bug 1284395) for asserting in ChromeUtils::IsOriginAttributesEqualIgnoringAddonId at nsDocShell.cpp:8007 for Windows debug builds. r=backout --- browser/base/content/browser.js | 26 +++++----------- browser/base/content/content.js | 1 - browser/base/content/nsContextMenu.js | 1 - browser/base/content/tabbrowser.xml | 9 ------ browser/base/content/test/general/browser.ini | 1 - ...browser_modifiedclick_inherit_principal.js | 30 ------------------- browser/base/content/utilityOverlay.js | 11 +------ browser/modules/ContentClick.jsm | 15 ++++------ toolkit/content/browser-child.js | 7 ----- toolkit/content/widgets/browser.xml | 9 ------ toolkit/content/widgets/remote-browser.xml | 9 ------ 11 files changed, 15 insertions(+), 104 deletions(-) delete mode 100644 browser/base/content/test/general/browser_modifiedclick_inherit_principal.js diff --git a/browser/base/content/browser.js b/browser/base/content/browser.js index b98886672845..8ab0c8bdd67c 100755 --- a/browser/base/content/browser.js +++ b/browser/base/content/browser.js @@ -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, - allowMixedContent: persistAllowMixedContentInChildTab, - referrerURI: referrerURI, - referrerPolicy: referrerPolicy, - noReferrer: BrowserUtils.linkHasNoReferrer(linkNode), - originPrincipal: doc.nodePrincipal, - }; + let params = { charset: doc.characterSet, + allowMixedContent: persistAllowMixedContentInChildTab, + referrerURI: referrerURI, + referrerPolicy: referrerPolicy, + noReferrer: BrowserUtils.linkHasNoReferrer(linkNode) }; // The new tab/window must use the same userContextId if (doc.nodePrincipal.originAttributes.userContextId) { diff --git a/browser/base/content/content.js b/browser/base/content/content.js index 6a2cdb9babaa..b677a8984480 100644 --- a/browser/base/content/content.js +++ b/browser/base/content/content.js @@ -503,7 +503,6 @@ var ClickEventHandler = { json.allowMixedContent = true; } catch (e) {} } - json.originPrincipal = ownerDoc.nodePrincipal; sendAsyncMessage("Content:Click", json); return; diff --git a/browser/base/content/nsContextMenu.js b/browser/base/content/nsContextMenu.js index dc483b14a93a..4b380656a683 100644 --- a/browser/base/content/nsContextMenu.js +++ b/browser/base/content/nsContextMenu.js @@ -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 }; diff --git a/browser/base/content/tabbrowser.xml b/browser/base/content/tabbrowser.xml index 29d3cac18f26..976a888bc678 100644 --- a/browser/base/content/tabbrowser.xml +++ b/browser/base/content/tabbrowser.xml @@ -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) { diff --git a/browser/base/content/test/general/browser.ini b/browser/base/content/test/general/browser.ini index 2e1e1abb7fd3..97b14222fe5a 100644 --- a/browser/base/content/test/general/browser.ini +++ b/browser/base/content/test/general/browser.ini @@ -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] diff --git a/browser/base/content/test/general/browser_modifiedclick_inherit_principal.js b/browser/base/content/test/general/browser_modifiedclick_inherit_principal.js deleted file mode 100644 index 3b5a5a149492..000000000000 --- a/browser/base/content/test/general/browser_modifiedclick_inherit_principal.js +++ /dev/null @@ -1,30 +0,0 @@ -"use strict"; - -const kURL = - "http://example.com/browser/browser/base/content/test/general/dummy_page.html"; - "data:text/html,Middle-click me"; - -/* - * 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); - }); -}); diff --git a/browser/base/content/utilityOverlay.js b/browser/base/content/utilityOverlay.js index bfc73e9868ff..24de93c9a919 100644 --- a/browser/base/content/utilityOverlay.js +++ b/browser/base/content/utilityOverlay.js @@ -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; } diff --git a/browser/modules/ContentClick.jsm b/browser/modules/ContentClick.jsm index 8abc32525c63..679bcca71b79 100644 --- a/browser/modules/ContentClick.jsm +++ b/browser/modules/ContentClick.jsm @@ -77,15 +77,12 @@ var ContentClick = { // Todo(903022): code for where == save - let params = { - charset: browser.characterSet, - referrerURI: browser.documentURI, - referrerPolicy: json.referrerPolicy, - noReferrer: json.noReferrer, - allowMixedContent: json.allowMixedContent, - isContentWindowPrivate: json.isContentWindowPrivate, - originPrincipal: json.originPrincipal, - }; + let params = { charset: browser.characterSet, + referrerURI: browser.documentURI, + referrerPolicy: json.referrerPolicy, + noReferrer: json.noReferrer, + allowMixedContent: json.allowMixedContent, + isContentWindowPrivate: json.isContentWindowPrivate}; // The new tab/window must use the same userContextId. if (json.originAttributes.userContextId) { diff --git a/toolkit/content/browser-child.js b/toolkit/content/browser-child.js index 16fd9036702a..9d7c1e67eb19 100644 --- a/toolkit/content/browser-child.js +++ b/toolkit/content/browser-child.js @@ -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); diff --git a/toolkit/content/widgets/browser.xml b/toolkit/content/widgets/browser.xml index f832844755d7..eefc8807b7e5 100644 --- a/toolkit/content/widgets/browser.xml +++ b/toolkit/content/widgets/browser.xml @@ -1038,15 +1038,6 @@ - - - - - - - 10 false null diff --git a/toolkit/content/widgets/remote-browser.xml b/toolkit/content/widgets/remote-browser.xml index 5f2059295dcc..dd7f74092ab2 100644 --- a/toolkit/content/widgets/remote-browser.xml +++ b/toolkit/content/widgets/remote-browser.xml @@ -561,15 +561,6 @@ ]]> - - - - - - -