зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1424380 - Require triggering principal passed into openUILink(). r=Gijs
MozReview-Commit-ID: BsQqZzfm2Ra --HG-- extra : rebase_source : 1c9de99aad978632a55afaaf55f247d3997b3b91
This commit is contained in:
Родитель
b6c1ea5823
Коммит
ca246e6abc
|
@ -610,7 +610,7 @@
|
|||
label="&reportDeceptiveSiteMenu.title;"
|
||||
accesskey="&reportDeceptiveSiteMenu.accesskey;"
|
||||
observes="reportPhishingBroadcaster"
|
||||
oncommand="openUILink(gSafeBrowsing.getReportURL('Phish'), event);"
|
||||
oncommand="openUILink(gSafeBrowsing.getReportURL('Phish'), event, {triggeringPrincipal: Services.scriptSecurityManager.createNullPrincipal({})});"
|
||||
onclick="checkForMiddleClick(this, event);"
|
||||
hidden="true"/>
|
||||
<menuitem id="menu_HelpPopup_reportPhishingErrortoolmenu"
|
||||
|
|
|
@ -45,7 +45,7 @@ function addRow(name, type, url) {
|
|||
urlLabel.className = "text-link";
|
||||
urlLabel.textContent = url;
|
||||
urlLabel.setAttribute("tooltiptext", url);
|
||||
urlLabel.addEventListener("click", ev => openUILink(this.value, ev));
|
||||
urlLabel.addEventListener("click", ev => openUILink(this.value, ev, {triggeringPrincipal: Services.scriptSecurityManager.createNullPrincipal({})}));
|
||||
urlContainer.appendChild(urlLabel);
|
||||
|
||||
const subscribeButton = document.createElement("button");
|
||||
|
|
|
@ -107,5 +107,5 @@ function test_openUILink() {
|
|||
runNextTest();
|
||||
});
|
||||
|
||||
openUILink("http://example.org/"); // defaults to "current"
|
||||
openUILink("http://example.org/", null, {triggeringPrincipal: Services.scriptSecurityManager.createNullPrincipal({})}); // defaults to "current"
|
||||
}
|
||||
|
|
|
@ -120,12 +120,7 @@ function openUILink(url, event, aIgnoreButton, aIgnoreAlt, aAllowThirdPartyFixup
|
|||
}
|
||||
|
||||
if (!params.triggeringPrincipal) {
|
||||
let dt = event ? event.dataTransfer : null;
|
||||
if (!!dt && dt.mozSourceNode) {
|
||||
params.triggeringPrincipal = dt.mozSourceNode.nodePrincipal;
|
||||
} else {
|
||||
params.triggeringPrincipal = Services.scriptSecurityManager.createNullPrincipal({});
|
||||
}
|
||||
throw new Error("Required argument triggeringPrincipal missing within openUILink");
|
||||
}
|
||||
|
||||
let where = whereToOpenLink(event, aIgnoreButton, aIgnoreAlt);
|
||||
|
|
Загрузка…
Ссылка в новой задаче