Bug 1371100 - Check userContextId in the content process instead of in the chrome process, r=smaug
authorMichael Layzell <michael@thelayzells.com>
Thu, 08 Jun 2017 12:57:51 -0400
changeset 411246 66a83f17d67b97e32e65600fb636f05336114bc4
parent 411245 ed9bcfd60646b4e0def9b5ca80e67fa24d55af58
child 411247 df6304204f6a3a2e22d92c47b4ddd48bffd6697a
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)
reviewerssmaug
bugs1371100
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 1371100 - Check userContextId in the content process instead of in the chrome process, r=smaug This is necessary because we asynchronously send the updated UserContextId back from the child to the parent process, and we would occasionally lose the race on infrastructure causing us to see the non-updated version. With this change we explicitly ask the content process, which is not racey. MozReview-Commit-ID: LODNi1YmBI8
dom/tests/browser/browser_noopener.js
--- a/dom/tests/browser/browser_noopener.js
+++ b/dom/tests/browser/browser_noopener.js
@@ -56,24 +56,24 @@ async function doTests(private, containe
     if (test.newWindow || alwaysNewWindow) {
       let window = await waitFor;
       is(PrivateBrowsingUtils.isWindowPrivate(window), private, "Private status should match for " + testid);
       tab = window.gBrowser.selectedTab;
     } else {
       tab = await waitFor;
     }
 
-    if (container) {
-      is(tab.linkedBrowser.getAttribute("usercontextid"), 1, "Should have usercontextid set for " + testid);
-    } else {
-      ok(!tab.linkedBrowser.hasAttribute("usercontextid"), "Should have usercontextid set for " + testid);
-    }
+    // Check that the name matches.
+    await ContentTask.spawn(tab.linkedBrowser, [test, container, testid], async ([test, container, testid]) => {
+      if (container) {
+        is(content.document.nodePrincipal.originAttributes.userContextId, 1);
+      } else {
+        is(content.document.nodePrincipal.originAttributes.userContextId, 0);
+      }
 
-    // Check that the name matches.
-    await ContentTask.spawn(tab.linkedBrowser, [test, testid], async ([test, testid]) => {
       is(content.window.name, test.name, "Name should match for " + testid);
       if (test.opener) {
         ok(content.window.opener, "Opener should have been set for " + testid);
       } else {
         ok(!content.window.opener, "Opener should not have been set for " + testid);
       }
     });
 
@@ -117,12 +117,8 @@ add_task(async function newwindow_samepr
   await doAllTests();
 });
 
 add_task(async function newwindow_newproc() {
   await SpecialPowers.pushPrefEnv({set: [[OPEN_NEWWINDOW_PREF, OPEN_NEWWINDOW],
                                          [NOOPENER_NEWPROC_PREF, true]]});
   await doAllTests();
 });
-
-// add_task(async function() {
-//   await doTests(false, true);
-// })