Bug 1363977 - Have loadTabs() tests provide the correct triggeringPrincipal. r=gijs,kit

This commit is contained in:
Christoph Kerschbaumer 2017-05-29 17:57:08 +02:00
Родитель 96eb17dd36
Коммит 7c3421e842
4 изменённых файлов: 33 добавлений и 6 удалений

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

@ -36,7 +36,11 @@
this.invoke = function testTabRelations_invoke()
{
var docURIs = ["about:", "about:mozilla"];
tabBrowser().loadTabs(docURIs, false, true);
tabBrowser().loadTabs(docURIs, {
inBackground: false,
replace: true,
triggeringPrincipal: Services.scriptSecurityManager.getSystemPrincipal(),
});
}
this.finalCheck = function testTabRelations_finalCheck(aEvent)

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

@ -35,7 +35,11 @@
this.invoke = function testTabHierarchy_invoke()
{
var docURIs = ["about:", "about:mozilla"];
tabBrowser().loadTabs(docURIs, false, true);
tabBrowser().loadTabs(docURIs, {
inBackground: false,
replace: true,
triggeringPrincipal: Services.scriptSecurityManager.getSystemPrincipal(),
});
}
this.finalCheck = function testTabHierarchy_finalCheck(aEvent)

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

@ -4,6 +4,7 @@ let { SyncedTabs } = Cu.import("resource://services-sync/SyncedTabs.jsm", {});
let { TabListComponent } = Cu.import("resource:///modules/syncedtabs/TabListComponent.js", {});
let { SyncedTabsListStore } = Cu.import("resource:///modules/syncedtabs/SyncedTabsListStore.js", {});
let { View } = Cu.import("resource:///modules/syncedtabs/TabListView.js", {});
let { Services } = Cu.import("resource://gre/modules/Services.jsm", {});
const ACTION_METHODS = [
"onSelectRow",
@ -139,9 +140,17 @@ add_task(function* testActions() {
let tabsToOpen = ["uri1", "uri2"];
component.onOpenTabs(tabsToOpen, "where");
Assert.ok(getChromeWindowMock.calledWith(windowMock));
Assert.ok(chromeWindowMock.gBrowser.loadTabs.calledWith(tabsToOpen, false, false));
Assert.ok(chromeWindowMock.gBrowser.loadTabs.calledWith(tabsToOpen, {
inBackground: false,
replace: false,
triggeringPrincipal: Services.scriptSecurityManager.getSystemPrincipal(),
}));
component.onOpenTabs(tabsToOpen, "tabshifted");
Assert.ok(chromeWindowMock.gBrowser.loadTabs.calledWith(tabsToOpen, true, false));
Assert.ok(chromeWindowMock.gBrowser.loadTabs.calledWith(tabsToOpen, {
inBackground: true,
replace: false,
triggeringPrincipal: Services.scriptSecurityManager.getSystemPrincipal(),
}));
sinon.spy(clipboardHelperMock, "copyString");
component.onCopyTabLocation("uri");

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

@ -92,7 +92,12 @@ this.Tabs = {
"about:home",
DEFAULT_FAVICON_TAB,
"about:newtab",
], true, true);
],
{
inBackground: true,
replace: true,
triggeringPrincipal: Services.scriptSecurityManager.getSystemPrincipal()
});
browserWindow.gBrowser.pinTab(browserWindow.gBrowser.tabs[1]);
browserWindow.gBrowser.pinTab(browserWindow.gBrowser.tabs[2]);
browserWindow.gBrowser.selectTabAtIndex(3);
@ -119,7 +124,12 @@ function fiveTabsHelper() {
DEFAULT_FAVICON_TAB,
"about:newtab",
CUST_TAB,
], true, true);
],
{
inBackground: true,
replace: true,
triggeringPrincipal: Services.scriptSecurityManager.getSystemPrincipal()
});
browserWindow.gBrowser.selectTabAtIndex(1);
}