Bug 1383299 - Fix test case error, r=mconley draft
authorEvelyn Hung <jj.evelyn@gmail.com>
Tue, 08 Aug 2017 19:15:23 +0800
changeset 648835 45400dedba8a65e58327b3265bdde68dbd8d63e6
parent 648834 d8f47350c04d709673abb10866eaec794c851b7f
child 726955 5e022774179ffe76199b2a99d078d29bdbb32ac0
push id74897
push userbmo:ehung@mozilla.com
push dateFri, 18 Aug 2017 10:52:57 +0000
reviewersmconley
bugs1383299
milestone57.0a1
Bug 1383299 - Fix test case error, r=mconley MozReview-Commit-ID: JtSlnpaq5un
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};