Bug 1357386: Have loadTabs() tests provide the correct triggeringPrincipal. r=gijs,kit
☠☠ backed out by c51a2eaa0078 ☠ ☠
authorChristoph Kerschbaumer <ckerschb@christophkerschbaumer.com>
Tue, 30 May 2017 08:30:50 +0200
changeset 409368 59567c6c1e710bd78eb507fcebe2200543f507c3
parent 409336 2a5ce0b6f2cd2d6567e307942990329697661ac1
child 409369 2b92af4575ae1d53e106db325df70d555d56c701
push id7391
push usermtabara@mozilla.com
push dateMon, 12 Jun 2017 13:08:53 +0000
treeherdermozilla-beta@2191d7f87e2e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgijs, kit
bugs1357386
milestone55.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1357386: Have loadTabs() tests provide the correct triggeringPrincipal. r=gijs,kit
accessible/tests/mochitest/relations/test_tabbrowser.xul
accessible/tests/mochitest/tree/test_tabbrowser.xul
browser/components/syncedtabs/test/xpcshell/test_TabListComponent.js
browser/tools/mozscreenshots/mozscreenshots/extension/configurations/Tabs.jsm
--- a/accessible/tests/mochitest/relations/test_tabbrowser.xul
+++ b/accessible/tests/mochitest/relations/test_tabbrowser.xul
@@ -31,17 +31,21 @@
       this.eventSeq = [
         new asyncInvokerChecker(EVENT_DOCUMENT_LOAD_COMPLETE, tabDocumentAt, 0),
         new asyncInvokerChecker(EVENT_DOCUMENT_LOAD_COMPLETE, tabDocumentAt, 1)
      ];
 
       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)
       {
         ////////////////////////////////////////////////////////////////////////
         // 'labelled by'/'label for' relations for xul:tab and xul:tabpanel
 
         var tabs = tabBrowser().tabContainer.childNodes;
--- a/accessible/tests/mochitest/tree/test_tabbrowser.xul
+++ b/accessible/tests/mochitest/tree/test_tabbrowser.xul
@@ -30,17 +30,21 @@
       this.eventSeq = [
         new asyncInvokerChecker(EVENT_DOCUMENT_LOAD_COMPLETE, tabDocumentAt, 0),
         new asyncInvokerChecker(EVENT_DOCUMENT_LOAD_COMPLETE, tabDocumentAt, 1)
       ];
 
       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)
       {
         ////////////////////
         // Tab bar
         ////////////////////
         var tabsAccTree = {
--- a/browser/components/syncedtabs/test/xpcshell/test_TabListComponent.js
+++ b/browser/components/syncedtabs/test/xpcshell/test_TabListComponent.js
@@ -1,14 +1,15 @@
 "use strict";
 
 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",
   "onOpenTab",
   "onOpenTabs",
   "onMoveSelectionDown",
   "onMoveSelectionUp",
   "onToggleBranch",
@@ -134,19 +135,27 @@ add_task(function* testActions() {
   sinon.spy(windowMock, "openUILinkIn");
   component.onOpenTab("uri", "where", "params");
   Assert.ok(windowMock.openUILinkIn.calledWith("uri", "where", "params"));
 
   sinon.spy(chromeWindowMock.gBrowser, "loadTabs");
   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");
   Assert.ok(clipboardHelperMock.copyString.calledWith("uri"));
 
   sinon.stub(SyncedTabs, "syncTabs");
   component.onSyncRefresh();
   Assert.ok(SyncedTabs.syncTabs.calledWith(true));
--- a/browser/tools/mozscreenshots/mozscreenshots/extension/configurations/Tabs.jsm
+++ b/browser/tools/mozscreenshots/mozscreenshots/extension/configurations/Tabs.jsm
@@ -87,17 +87,22 @@ this.Tabs = {
           "about:addons",
           "about:home",
           DEFAULT_FAVICON_TAB,
           "about:newtab",
           "about:addons",
           "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);
         hoverTab(browserWindow.gBrowser.tabs[5]);
         await new Promise((resolve, reject) => {
           setTimeout(resolve, 3000);
         });
       },
@@ -114,17 +119,22 @@ function fiveTabsHelper() {
 
   let browserWindow = Services.wm.getMostRecentWindow("navigator:browser");
   browserWindow.gBrowser.loadTabs([
     "about:addons",
     "about:home",
     DEFAULT_FAVICON_TAB,
     "about:newtab",
     CUST_TAB,
-  ], true, true);
+  ],
+  {
+    inBackground: true,
+    replace: true,
+    triggeringPrincipal: Services.scriptSecurityManager.getSystemPrincipal()
+  });
   browserWindow.gBrowser.selectTabAtIndex(1);
 }
 
 function closeAllButOneTab(url = "about:blank") {
   let browserWindow = Services.wm.getMostRecentWindow("navigator:browser");
   let gBrowser = browserWindow.gBrowser;
   // Close all tabs except the last so we don't quit the browser.
   while (gBrowser.tabs.length > 1)