Bug 1363689 - Have gBrowser.loadTabs() provide a valid triggeringPrincipal. r=gijs

This commit is contained in:
Christoph Kerschbaumer 2017-05-11 08:44:13 +02:00
Родитель 8972930163
Коммит a38d7ccf1e
3 изменённых файлов: 15 добавлений и 5 удалений

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

@ -1549,6 +1549,7 @@
<parameter name="aLoadInBackground"/>
<parameter name="aReplace"/>
<body><![CDATA[
let aTriggeringPrincipal;
let aAllowThirdPartyFixup;
let aTargetTab;
let aNewIndex = -1;
@ -1565,6 +1566,7 @@
params.newIndex : aNewIndex;
aPostDatas = params.postDatas || aPostDatas;
aUserContextId = params.userContextId;
aTriggeringPrincipal = params.triggeringPrincipal;
}
if (!aURIs.length)
@ -1602,7 +1604,8 @@
}
try {
browser.loadURIWithFlags(aURIs[0], {
flags, postData: aPostDatas[0]
flags, postData: aPostDatas[0],
triggeringPrincipal: aTriggeringPrincipal,
});
} catch (e) {
// Ignore failure in case a URI is wrong, so we can continue
@ -1614,7 +1617,8 @@
skipAnimation: multiple,
allowThirdPartyFixup: aAllowThirdPartyFixup,
postData: aPostDatas[0],
userContextId: aUserContextId
userContextId: aUserContextId,
triggeringPrincipal: aTriggeringPrincipal,
});
if (aNewIndex !== -1) {
this.moveTabTo(firstTabAdded, aNewIndex);
@ -1628,7 +1632,8 @@
skipAnimation: true,
allowThirdPartyFixup: aAllowThirdPartyFixup,
postData: aPostDatas[i],
userContextId: aUserContextId
userContextId: aUserContextId,
triggeringPrincipal: aTriggeringPrincipal,
});
if (targetTabIndex !== -1)
this.moveTabTo(tab, ++tabNum);

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

@ -207,7 +207,9 @@ function test() {
runNextTest();
}
gBrowser.loadTabs(uris);
gBrowser.loadTabs(uris, {
triggeringPrincipal: Services.scriptSecurityManager.getSystemPrincipal(),
});
}
// This simulates setting a userTypedValue and ensures that just typing in the

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

@ -84,7 +84,10 @@ function waitForDelayedStartup(win) {
*/
function loadTabs(gBrowser, urls) {
return new Promise((resolve) => {
gBrowser.loadTabs(urls, true);
gBrowser.loadTabs(urls, {
inBackground: true,
triggeringPrincipal: Services.scriptSecurityManager.getSystemPrincipal(),
});
let waitingToLoad = new Set(urls);