Commit 056e6a7d authored by Ehsan Akhgari's avatar Ehsan Akhgari
Browse files

Bug 1574019 - Enable test_notification_crossorigin_iframe.html under Fission; r=kmag

Differential Revision: https://phabricator.services.mozilla.com/D42060

--HG--
extra : moz-landing-system : lando
parent 605d83cb
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -515,12 +515,15 @@ nsContentPermissionRequester::GetOnVisibilityChange(
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;
  }
+0 −1
Original line number Diff line number Diff line
@@ -9,7 +9,6 @@ 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]
+11 −5
Original line number Diff line number Diff line
@@ -31,14 +31,20 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1560741
      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");