mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-02 10:00:54 +00:00
Bug 1364392 - Provide correct triggeringPrincipal to openLinkIn r=Gijs
Differential Revision: https://phabricator.services.mozilla.com/D3873 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
3fbc856a30
commit
3d93e94550
@ -847,6 +847,7 @@ nsContextMenu.prototype = {
|
||||
let referrer = gContextMenuContentData.referrer;
|
||||
openLinkIn(gContextMenuContentData.docLocation, "window",
|
||||
{ charset: gContextMenuContentData.charSet,
|
||||
triggeringPrincipal: this.browser.contentPrincipal,
|
||||
referrerURI: referrer ? makeURI(referrer) : null });
|
||||
},
|
||||
|
||||
|
@ -300,6 +300,10 @@ function openLinkIn(url, where, params) {
|
||||
params.forceAboutBlankViewerInCurrent;
|
||||
var aResolveOnNewTabCreated = params.resolveOnNewTabCreated;
|
||||
|
||||
if (!aTriggeringPrincipal) {
|
||||
throw new Error("Must load with a triggering Principal");
|
||||
}
|
||||
|
||||
if (where == "save") {
|
||||
// TODO(1073187): propagate referrerPolicy.
|
||||
|
||||
|
@ -602,10 +602,19 @@ class _ASRouter {
|
||||
target.browser.ownerGlobal.OpenBrowserWindow({private: true});
|
||||
break;
|
||||
case ra.OPEN_URL:
|
||||
this.openLinkIn(action.data.url, target, {isPrivate: false, where: "tabshifted"});
|
||||
this.openLinkIn(action.data.url, target, {
|
||||
isPrivate: false,
|
||||
where: "tabshifted",
|
||||
triggeringPrincipal: Services.scriptSecurityManager.getNullPrincipal({})
|
||||
});
|
||||
break;
|
||||
case ra.OPEN_ABOUT_PAGE:
|
||||
this.openLinkIn(`about:${action.data.page}`, target, {isPrivate: false, trusted: true, where: "tab"});
|
||||
this.openLinkIn(`about:${action.data.page}`, target, {
|
||||
isPrivate: false,
|
||||
trusted: true,
|
||||
where: "tab",
|
||||
triggeringPrincipal: Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
});
|
||||
break;
|
||||
case ra.OPEN_APPLICATIONS_MENU:
|
||||
UITour.showMenu(target.browser.ownerGlobal, action.data.target);
|
||||
|
@ -1364,7 +1364,11 @@ var UITour = {
|
||||
},
|
||||
|
||||
showNewTab(aWindow, aBrowser) {
|
||||
aWindow.openLinkIn("about:newtab", "current", {targetBrowser: aBrowser});
|
||||
let url = "about:newtab";
|
||||
aWindow.openLinkIn(url, "current", {
|
||||
targetBrowser: aBrowser,
|
||||
triggeringPrincipal: Services.scriptSecurityManager.createCodebasePrincipal(Services.io.newURI(url), {}),
|
||||
});
|
||||
aWindow.gURLBar.focus();
|
||||
},
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user