Backed out changeset c9b0ce46ad4f (bug 1466801) for pause-remove-from-document-networkState.html failures CLOSED TREE

--HG--
rename : browser/base/content/test/contextMenu/browser_utilityOverlay.js => browser/base/content/test/general/browser_utilityOverlay.js
This commit is contained in:
Bogdan Tara 2018-08-11 03:20:30 +03:00
Родитель d4b83a4a08
Коммит 89268618f4
17 изменённых файлов: 27 добавлений и 107 удалений

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

@ -1695,10 +1695,7 @@ var gBrowserInit = {
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[8],
// TODO fix allowInheritPrincipal
// (this is required by javascript: drop to the new window) Bug 1475201
true);
window.arguments[7], !!window.arguments[7], window.arguments[8]);
window.focus();
} else {
// Note: loadOneOrMoreURIs *must not* be called if window.arguments.length >= 3.
@ -2387,7 +2384,7 @@ function BrowserTryToCloseWindow() {
function loadURI(uri, referrer, postData, allowThirdPartyFixup, referrerPolicy,
userContextId, originPrincipal, forceAboutBlankViewerInCurrent,
triggeringPrincipal, allowInheritPrincipal = false) {
triggeringPrincipal) {
try {
openLinkIn(uri, "current",
{ referrerURI: referrer,
@ -2398,7 +2395,6 @@ function loadURI(uri, referrer, postData, allowThirdPartyFixup, referrerPolicy,
originPrincipal,
triggeringPrincipal,
forceAboutBlankViewerInCurrent,
allowInheritPrincipal,
});
} catch (e) {}
}
@ -3567,9 +3563,6 @@ var newTabButtonObserver = {
let data = await getShortcutOrURIAndPostData(link.url);
// Allow third-party services to fixup this URL.
openNewTabWith(data.url, shiftKey, {
// TODO fix allowInheritPrincipal
// (this is required by javascript: drop to the new window) Bug 1475201
allowInheritPrincipal: true,
postData: data.postData,
allowThirdPartyFixup: true,
triggeringPrincipal,
@ -3602,9 +3595,6 @@ var newWindowButtonObserver = {
let data = await getShortcutOrURIAndPostData(link.url);
// Allow third-party services to fixup this URL.
openNewWindowWith(data.url, {
// TODO fix allowInheritPrincipal
// (this is required by javascript: drop to the new window) Bug 1475201
allowInheritPrincipal: true,
postData: data.postData,
allowThirdPartyFixup: true,
triggeringPrincipal,
@ -6106,7 +6096,7 @@ function middleMousePaste(event) {
lastLocationChange == gBrowser.selectedBrowser.lastLocationChange) {
openUILink(data.url, event,
{ ignoreButton: true,
allowInheritPrincipal: data.mayInheritPrincipal,
disallowInheritPrincipal: !data.mayInheritPrincipal,
triggeringPrincipal: gBrowser.selectedBrowser.contentPrincipal,
});
}

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

@ -855,6 +855,7 @@ nsContextMenu.prototype = {
Ci.nsIScriptSecurityManager.DISALLOW_SCRIPT);
let referrer = gContextMenuContentData.referrer;
openWebLinkIn(gContextMenuContentData.docLocation, "current", {
disallowInheritPrincipal: true,
referrerURI: referrer ? makeURI(referrer) : null,
triggeringPrincipal: this.browser.contentPrincipal,
});
@ -912,7 +913,8 @@ nsContextMenu.prototype = {
urlSecurityCheck(this.imageDescURL,
this.principal,
Ci.nsIScriptSecurityManager.DISALLOW_SCRIPT);
openUILink(this.imageDescURL, e, { referrerURI: gContextMenuContentData.documentURIObject,
openUILink(this.imageDescURL, e, { disallowInheritPrincipal: true,
referrerURI: gContextMenuContentData.documentURIObject,
triggeringPrincipal: this.principal,
});
},
@ -950,14 +952,16 @@ nsContextMenu.prototype = {
let systemPrincipal = Services.scriptSecurityManager.getSystemPrincipal();
if (this.onCanvas) {
this._canvasToBlobURL(this.target).then(function(blobURL) {
openUILink(blobURL, e, { referrerURI,
openUILink(blobURL, e, { disallowInheritPrincipal: true,
referrerURI,
triggeringPrincipal: systemPrincipal});
}, Cu.reportError);
} else {
urlSecurityCheck(this.mediaURL,
this.principal,
Ci.nsIScriptSecurityManager.DISALLOW_SCRIPT);
openUILink(this.mediaURL, e, { referrerURI,
openUILink(this.mediaURL, e, { disallowInheritPrincipal: true,
referrerURI,
forceAllowDataURI: true,
triggeringPrincipal: this.principal,
});
@ -1014,7 +1018,8 @@ nsContextMenu.prototype = {
this.principal,
Ci.nsIScriptSecurityManager.DISALLOW_SCRIPT);
openUILink(this.bgImageURL, e, { referrerURI: gContextMenuContentData.documentURIObject,
openUILink(this.bgImageURL, e, { disallowInheritPrincipal: true,
referrerURI: gContextMenuContentData.documentURIObject,
triggeringPrincipal: this.principal,
});
},

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

@ -1330,7 +1330,6 @@ window._gBrowser = {
var aReferrerPolicy;
var aFromExternal;
var aRelatedToCurrent;
var aAllowInheritPrincipal;
var aAllowMixedContent;
var aSkipAnimation;
var aForceNotRemote;
@ -1358,7 +1357,6 @@ window._gBrowser = {
aAllowThirdPartyFixup = params.allowThirdPartyFixup;
aFromExternal = params.fromExternal;
aRelatedToCurrent = params.relatedToCurrent;
aAllowInheritPrincipal = !!params.allowInheritPrincipal;
aAllowMixedContent = params.allowMixedContent;
aSkipAnimation = params.skipAnimation;
aForceNotRemote = params.forceNotRemote;
@ -1391,7 +1389,6 @@ window._gBrowser = {
charset: aCharset,
postData: aPostData,
ownerTab: owner,
allowInheritPrincipal: aAllowInheritPrincipal,
allowThirdPartyFixup: aAllowThirdPartyFixup,
fromExternal: aFromExternal,
relatedToCurrent: aRelatedToCurrent,
@ -2168,12 +2165,12 @@ window._gBrowser = {
// eslint-disable-next-line complexity
addTab(aURI, {
allowInheritPrincipal,
allowMixedContent,
allowThirdPartyFixup,
bulkOrderedOpen,
charset,
createLazyBrowser,
disallowInheritPrincipal,
eventDetail,
focusUrlBar,
forceNotRemote,
@ -2475,7 +2472,7 @@ window._gBrowser = {
// If we didn't swap docShells with a preloaded browser
// then let's just continue loading the page normally.
if (!usingPreloadedContent && (!uriIsAboutBlank || !allowInheritPrincipal)) {
if (!usingPreloadedContent && (!uriIsAboutBlank || disallowInheritPrincipal)) {
// pretend the user typed this so it'll be available till
// the document successfully loads
if (aURI && !gInitialPages.includes(aURI)) {
@ -2493,7 +2490,7 @@ window._gBrowser = {
if (allowMixedContent) {
flags |= Ci.nsIWebNavigation.LOAD_FLAGS_ALLOW_MIXED_CONTENT;
}
if (!allowInheritPrincipal) {
if (disallowInheritPrincipal) {
flags |= Ci.nsIWebNavigation.LOAD_FLAGS_DISALLOW_INHERIT_PRINCIPAL;
}
try {

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

@ -7,5 +7,3 @@ support-files =
[browser_contextmenu_touch.js]
skip-if = !(os == 'win' && os_version == '10.0')
[browser_contextmenu_linkopen.js]
[browser_utilityOverlay.js]
[browser_utilityOverlayPrincipal.js]

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

@ -1,54 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
const gTests = [
test_openUILink_checkPrincipal,
];
function test() {
waitForExplicitFinish();
executeSoon(runNextTest);
}
function runNextTest() {
if (gTests.length) {
let testFun = gTests.shift();
info("Running " + testFun.name);
testFun();
} else {
finish();
}
}
function test_openUILink_checkPrincipal() {
let tab = gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser, "http://example.com/"); // remote tab
BrowserTestUtils.browserLoaded(tab.linkedBrowser).then(async function() {
is(tab.linkedBrowser.currentURI.spec, "http://example.com/", "example.com loaded");
await ContentTask.spawn(tab.linkedBrowser, null, function() {
let channel = content.docShell.currentDocumentChannel;
const loadingPrincipal = channel.loadInfo.loadingPrincipal;
is(loadingPrincipal, null, "sanity: correct loadingPrincipal");
const triggeringPrincipal = channel.loadInfo.triggeringPrincipal;
ok(Services.scriptSecurityManager.isSystemPrincipal(triggeringPrincipal),
"sanity: correct triggeringPrincipal");
const principalToInherit = channel.loadInfo.principalToInherit;
ok(principalToInherit.isNullPrincipal, "sanity: correct principalToInherit");
ok(content.document.nodePrincipal.isCodebasePrincipal,
"sanity: correct doc.nodePrincipal");
is(content.document.nodePrincipal.URI.asciiSpec, "http://example.com/",
"sanity: correct doc.nodePrincipal URL");
});
gBrowser.removeCurrentTab();
runNextTest();
});
// Ensure we get the correct default of "allowInheritPrincipal: false" from openUILink
openUILink("http://example.com", null, {
triggeringPrincipal: Services.scriptSecurityManager.getSystemPrincipal({}),
}); // defaults to "current"
}

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

@ -446,6 +446,8 @@ run-if = e10s
# DO NOT ADD MORE TESTS HERE. USE A TOPICAL DIRECTORY INSTEAD.
[browser_unloaddialogs.js]
# DO NOT ADD MORE TESTS HERE. USE A TOPICAL DIRECTORY INSTEAD.
[browser_utilityOverlay.js]
# DO NOT ADD MORE TESTS HERE. USE A TOPICAL DIRECTORY INSTEAD.
[browser_viewSourceInTabOnViewSource.js]
# DO NOT ADD MORE TESTS HERE. USE A TOPICAL DIRECTORY INSTEAD.
[browser_visibleFindSelection.js]

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

@ -7,7 +7,7 @@ const gTests = [
test_getTopWin,
test_getBoolPref,
test_openNewTabWith,
test_openUILink,
test_openUILink
];
function test() {

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

@ -932,7 +932,7 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
params.targetBrowser = browser;
params.indicateErrorPageLoad = true;
params.allowPinnedTabHostChange = true;
params.allowInheritPrincipal = mayInheritPrincipal;
params.disallowInheritPrincipal = !mayInheritPrincipal;
params.allowPopups = url.startsWith("javascript:");
} else {
params.initiatingDoc = document;

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

@ -282,10 +282,10 @@ function openLinkIn(url, where, params) {
var aReferrerPolicy = ("referrerPolicy" in params ?
params.referrerPolicy : Ci.nsIHttpChannel.REFERRER_POLICY_UNSET);
var aRelatedToCurrent = params.relatedToCurrent;
var aAllowInheritPrincipal = !!params.allowInheritPrincipal;
var aAllowMixedContent = params.allowMixedContent;
var aForceAllowDataURI = params.forceAllowDataURI;
var aInBackground = params.inBackground;
var aDisallowInheritPrincipal = params.disallowInheritPrincipal;
var aInitiatingDoc = params.initiatingDoc;
var aIsPrivate = params.private;
var aSkipTabAnimation = params.skipTabAnimation;
@ -482,10 +482,12 @@ function openLinkIn(url, where, params) {
flags |= Ci.nsIWebNavigation.LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP;
flags |= Ci.nsIWebNavigation.LOAD_FLAGS_FIXUP_SCHEME_TYPOS;
}
// LOAD_FLAGS_DISALLOW_INHERIT_PRINCIPAL isn't supported for javascript URIs,
// i.e. it causes them not to load at all. Callers should strip
// "javascript:" from pasted strings to prevent blank tabs
if (!aAllowInheritPrincipal) {
// "javascript:" from pasted strings to protect users from malicious URIs
// (see stripUnsafeProtocolOnPaste).
if (aDisallowInheritPrincipal && !(uriObj && uriObj.schemeIs("javascript"))) {
flags |= Ci.nsIWebNavigation.LOAD_FLAGS_DISALLOW_INHERIT_PRINCIPAL;
}
@ -543,7 +545,6 @@ function openLinkIn(url, where, params) {
userContextId: aUserContextId,
originPrincipal: aPrincipal,
triggeringPrincipal: aTriggeringPrincipal,
allowInheritPrincipal: aAllowInheritPrincipal,
focusUrlBar,
});
targetBrowser = tabUsedForLoad.linkedBrowser;

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

@ -572,7 +572,7 @@ this.tabs = class extends ExtensionAPI {
} else {
url = window.BROWSER_NEW_TAB_URL;
}
// Only set allowInheritPrincipal on discardable urls as it
// Only set disallowInheritPrincipal on non-discardable urls as it
// will override creating a lazy browser. Setting triggeringPrincipal
// will ensure other cases are handled, but setting it may prevent
// creating about and data urls.
@ -580,15 +580,12 @@ this.tabs = class extends ExtensionAPI {
if (!discardable) {
// Make sure things like about:blank and data: URIs never inherit,
// and instead always get a NullPrincipal.
options.allowInheritPrincipal = false;
options.disallowInheritPrincipal = true;
// Falling back to codebase here as about: requires it, however is safe.
principal = Services.scriptSecurityManager.createCodebasePrincipal(Services.io.newURI(url), {
userContextId: options.userContextId,
privateBrowsingId: PrivateBrowsingUtils.isBrowserPrivate(window.gBrowser) ? 1 : 0,
});
} else {
options.allowInheritPrincipal = true;
options.triggeringPrincipal = context.principal;
}
tabListener.initTabReady();

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

@ -3498,7 +3498,6 @@ var SessionStoreInternal = {
tab = tabbrowser.addTrustedTab(url,
{ createLazyBrowser,
skipAnimation: true,
allowInheritPrincipal: true,
noInitialLabel: true,
userContextId,
skipBackgroundNotify: true,

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

@ -77,8 +77,6 @@ var ContentClick = {
params.userContextId = json.originAttributes.userContextId;
}
params.allowInheritPrincipal = true;
window.openLinkIn(json.href, where, params);
}
};

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

@ -1785,9 +1785,6 @@ var BrowserTestUtils = {
if (!params.triggeringPrincipal) {
params.triggeringPrincipal = Services.scriptSecurityManager.getSystemPrincipal();
}
if (!params.allowInheritPrincipal) {
params.allowInheritPrincipal = true;
}
if (beforeLoadFunc) {
let window = tabbrowser.ownerGlobal;
window.addEventListener("TabOpen", function(e) {

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

@ -1,9 +1,8 @@
[autoplay-with-broken-track.html]
expected: TIMEOUT
disabled:
if debug and (os == "linux") and (processor == "x86") and (bits == 32): https://bugzilla.mozilla.org/show_bug.cgi?id=1482405
[<video autoplay> with <track src="invalid://url" default=""> child]
expected: TIMEOUT
[<video autoplay> with <track src="" default=""> child]
expected: TIMEOUT

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

@ -1,3 +0,0 @@
[event_pause_noautoplay.html]
disabled:
if debug and (os == "linux") and (processor == "x86") and (bits == 32): https://bugzilla.mozilla.org/show_bug.cgi?id=1482405

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

@ -1,3 +0,0 @@
[paused_true_during_pause.html]
disabled:
if debug and (os == "linux") and (processor == "x86") and (bits == 32): https://bugzilla.mozilla.org/show_bug.cgi?id=1482405

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

@ -1,3 +0,0 @@
[autoplay.html]
disabled:
if debug and (os == "linux") and (processor == "x86") and (bits == 32): https://bugzilla.mozilla.org/show_bug.cgi?id=1482405