Bug 1574019 - Enable test_notification_crossorigin_iframe.html under Fission; r=kmag
authorEhsan Akhgari <ehsan@mozilla.com>
Thu, 15 Aug 2019 20:53:06 +0000
changeset 488348 bbea72a272682a99f225f01b9c54a3a866af839d
parent 488347 7bf4620ce1a6210798f737e9e518e79123094bdf
child 488349 d12c8cc8576cd3f0e2209f21cc98a53f16ed8eca
push id113906
push userncsoregi@mozilla.com
push dateFri, 16 Aug 2019 04:07:24 +0000
treeherdermozilla-inbound@d887276421d3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskmag
bugs1574019
milestone70.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 1574019 - Enable test_notification_crossorigin_iframe.html under Fission; r=kmag Differential Revision: https://phabricator.services.mozilla.com/D42060
dom/base/nsContentPermissionHelper.cpp
dom/notification/test/mochitest/mochitest.ini
dom/notification/test/mochitest/test_notification_crossorigin_iframe.html
--- a/dom/base/nsContentPermissionHelper.cpp
+++ b/dom/base/nsContentPermissionHelper.cpp
@@ -510,22 +510,25 @@ nsContentPermissionRequester::GetOnVisib
       mListener->GetCallback();
   callback.forget(aCallback);
   return NS_OK;
 }
 
 static nsIPrincipal* GetTopLevelPrincipal(nsPIDOMWindowInner* aWindow) {
   MOZ_ASSERT(aWindow);
 
-  nsPIDOMWindowOuter* top = aWindow->GetInProcessScriptableTop();
-  if (!top) {
+  BrowsingContext* top = aWindow->GetBrowsingContext()->Top();
+  MOZ_ASSERT(top);
+
+  nsPIDOMWindowOuter* outer = top->GetDOMWindow();
+  if (!outer) {
     return nullptr;
   }
 
-  nsPIDOMWindowInner* inner = top->GetCurrentInnerWindow();
+  nsPIDOMWindowInner* inner = outer->GetCurrentInnerWindow();
   if (!inner) {
     return nullptr;
   }
 
   return nsGlobalWindowInner::Cast(inner)->GetPrincipal();
 }
 
 NS_IMPL_CYCLE_COLLECTION(ContentPermissionRequestBase, mPrincipal,
--- a/dom/notification/test/mochitest/mochitest.ini
+++ b/dom/notification/test/mochitest/mochitest.ini
@@ -4,16 +4,15 @@ support-files =
   blank.html
   create_notification.html
   MockServices.js
   NotificationTest.js
 skip-if = toolkit == 'android' && !is_fennec # Bug 1531097
 
 [test_notification_basics.html]
 [test_notification_crossorigin_iframe.html]
-skip-if = fission
 # This test needs to be run on HTTP (not HTTPS).
 [test_notification_insecure_context.html]
 [test_notification_storage.html]
 [test_bug931307.html]
 skip-if = (os == 'android') # Bug 1258975 on android.
 [test_notification_tag.html]
 fail-if = fission
--- a/dom/notification/test/mochitest/test_notification_crossorigin_iframe.html
+++ b/dom/notification/test/mochitest/test_notification_crossorigin_iframe.html
@@ -26,24 +26,30 @@ https://bugzilla.mozilla.org/show_bug.cg
 
     let iframe = document.createElement("iframe");
     iframe.src = kBlankURL;
     document.body.appendChild(iframe);
     await new Promise(resolve => {
       iframe.onload = resolve;
     });
 
-    const Notif = SpecialPowers.wrap(iframe.contentWindow).Notification;
-    let response = await Notif.requestPermission();
-    is(response, "denied", "Denied permission in cross-origin iframe");
+    let checkRequest = async (expectedResponse, msg) => {
+      let response = await this.content.Notification.requestPermission();
+      Assert.equal(response, expectedResponse, msg);
+    };
+
+    await SpecialPowers.spawn(iframe,
+                              ["denied", "Denied permission in cross-origin iframe"],
+                              checkRequest);
 
     await SpecialPowers.pushPrefEnv({"set": [["dom.webnotifications.allowcrossoriginiframe", true]]});
 
-    response = await Notif.requestPermission();
-    is(response, "granted", "Granted permission in cross-origin iframe with pref set");
+    await SpecialPowers.spawn(iframe,
+                              ["granted", "Granted permission in cross-origin iframe with pref set"],
+                              checkRequest);
 
     await SpecialPowers.clearUserPref("notification.prompt.testing");
     await SpecialPowers.clearUserPref("notification.prompt.testing.allow");
     await SpecialPowers.clearUserPref("dom.webnotifications.allowinsecure");
 
     SimpleTest.finish();
   })();
   </script>