Bug 1383299 - Fix test case error, r=jkt,mconley draft
authorEvelyn Hung <jj.evelyn@gmail.com>
Tue, 22 Aug 2017 12:01:13 +0800
changeset 650264 0a7870ce989b679f8aa6a4f6eb5e2b25d6289044
parent 650263 1b911c736d549f1ebc64d966ebd52f88f79e5ea6
child 650265 de4b6fc85519823f42046c070118d99ad0ca61ee
child 651163 cb77298910560a568cc03887f3739f235a4ad20d
push id75319
push userbmo:ehung@mozilla.com
push dateTue, 22 Aug 2017 04:08:53 +0000
reviewersjkt, mconley
bugs1383299
milestone57.0a1
Bug 1383299 - Fix test case error, r=jkt,mconley The triggeringPrincipal needs to be consistent with the given userContextId. MozReview-Commit-ID: Ao4hokoIcLb
browser/components/originattributes/test/browser/head.js
--- a/browser/components/originattributes/test/browser/head.js
+++ b/browser/components/originattributes/test/browser/head.js
@@ -32,18 +32,22 @@ let gFirstPartyBasicPage = TEST_URL_PATH
  *    The url of the page.
  * @param aUserContextId
  *    The user context id for this tab.
  *
  * @return tab     - The tab object of this tab.
  *         browser - The browser object of this tab.
  */
 async function openTabInUserContext(aURL, aUserContextId) {
+  let originAttributes =  {
+    userContextId: aUserContextId
+  };
+  let triggeringPrincipal = Services.scriptSecurityManager.createCodebasePrincipal(makeURI(aURL), originAttributes);
   // Open the tab in the correct userContextId.
-  let tab = BrowserTestUtils.addTab(gBrowser, aURL, {userContextId: aUserContextId});
+  let tab = BrowserTestUtils.addTab(gBrowser, aURL, {userContextId: aUserContextId, triggeringPrincipal});
 
   // Select tab and make sure its browser is focused.
   gBrowser.selectedTab = tab;
   tab.ownerGlobal.focus();
 
   let browser = gBrowser.getBrowserForTab(tab);
   await BrowserTestUtils.browserLoaded(browser);
   return {tab, browser};