Bug 1592776 - Reformat test_notification_tag.html. r=dom-workers-and-storage-reviewers,asuth
☠☠ backed out by 7206207af8c4 ☠ ☠
authorSimon Giesecke <sgiesecke@mozilla.com>
Tue, 26 May 2020 16:18:36 +0000
changeset 532322 aa836c2449d5b3a8342a836fba49231aedeac1e9
parent 532321 1109bd345ac2f3c610c2baa0791825f95c1b6bdd
child 532323 edaf8a5f8d5364db88956636a24f6623b05b5f0d
push id37454
push userccoroiu@mozilla.com
push dateWed, 27 May 2020 16:14:31 +0000
treeherdermozilla-central@a1dd9afbfdf5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdom-workers-and-storage-reviewers, asuth
bugs1592776
milestone78.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 1592776 - Reformat test_notification_tag.html. r=dom-workers-and-storage-reviewers,asuth Differential Revision: https://phabricator.services.mozilla.com/D76823
dom/notification/test/mochitest/test_notification_tag.html
--- a/dom/notification/test/mochitest/test_notification_tag.html
+++ b/dom/notification/test/mochitest/test_notification_tag.html
@@ -15,36 +15,49 @@ https://bugzilla.mozilla.org/show_bug.cg
 <iframe name="anotherSameDomain"></iframe>
 <iframe name="crossDomain"></iframe>
 <div id="content" style="display: none">
 </div>
 <pre id="test">
 </pre>
 <script type="text/javascript">
   /* eslint-disable mozilla/use-chromeutils-generateqi */
-  const MOCK_CID = SpecialPowers.wrap(SpecialPowers.Components).ID("{dbe37e64-d9a3-402c-8d8a-0826c619f7ad}");
+  const MOCK_CID = SpecialPowers.wrap(SpecialPowers.Components).ID(
+    "{dbe37e64-d9a3-402c-8d8a-0826c619f7ad}"
+  );
   const ALERTS_SERVICE_CONTRACT_ID = "@mozilla.org/alerts-service;1";
 
   var mockAlertsService = {
     showAlert(alert, alertListener) {
       notificationsCreated.push(alert.name);
       if (notificationsCreated.length == 3) {
         checkNotifications();
       }
     },
 
-    showAlertNotification(imageUrl, title, text, textClickable,
-                          cookie, alertListener, name, dir,
-                          lang, data) {
+    showAlertNotification(
+      imageUrl,
+      title,
+      text,
+      textClickable,
+      cookie,
+      alertListener,
+      name,
+      dir,
+      lang,
+      data
+    ) {
       this.showAlert({ name });
     },
 
     QueryInterface(aIID) {
-      if (SpecialPowers.wrap(aIID).equals(SpecialPowers.Ci.nsISupports) ||
-          SpecialPowers.wrap(aIID).equals(SpecialPowers.Ci.nsIAlertsService)) {
+      if (
+        SpecialPowers.wrap(aIID).equals(SpecialPowers.Ci.nsISupports) ||
+        SpecialPowers.wrap(aIID).equals(SpecialPowers.Ci.nsIAlertsService)
+      ) {
         return this;
       }
       throw SpecialPowers.Components.results.NS_ERROR_NO_INTERFACE;
     },
 
     createInstance(aOuter, aIID) {
       if (aOuter != null) {
         throw SpecialPowers.Components.results.NS_ERROR_NO_AGGREGATION;
@@ -64,47 +77,73 @@ https://bugzilla.mozilla.org/show_bug.cg
       var notificationName = notificationsCreated[i];
       if (notificationName.includes("test1")) {
         test1notifications.push(notificationsCreated[i]);
       } else if (notificationName.includes("test2")) {
         test2notifications.push(notificationsCreated[i]);
       }
     }
 
-    is(test1notifications.length, 2, "2 notifications should be created by test1.example.org:80 origin.");
-    is(test1notifications[0], test1notifications[1], "notification names should be identical.");
-    is(test2notifications.length, 1, "1 notification should be created by test2.example.org:80 origin.");
+    is(
+      test1notifications.length,
+      2,
+      "2 notifications should be created by test1.example.org:80 origin."
+    );
+    is(
+      test1notifications[0],
+      test1notifications[1],
+      "notification names should be identical."
+    );
+    is(
+      test2notifications.length,
+      1,
+      "1 notification should be created by test2.example.org:80 origin."
+    );
 
     // Register original alerts service.
-    SpecialPowers.wrap(SpecialPowers.Components).
-      manager.QueryInterface(SpecialPowers.Ci.nsIComponentRegistrar).
-      unregisterFactory(MOCK_CID, mockAlertsService);
+    SpecialPowers.wrap(SpecialPowers.Components)
+      .manager.QueryInterface(SpecialPowers.Ci.nsIComponentRegistrar)
+      .unregisterFactory(MOCK_CID, mockAlertsService);
 
     SimpleTest.finish();
   }
 
   if (window.Notification) {
     SimpleTest.waitForExplicitFinish();
 
     function showNotifications() {
-      SpecialPowers.wrap(SpecialPowers.Components).
-        manager.QueryInterface(SpecialPowers.Ci.nsIComponentRegistrar).
-        registerFactory(MOCK_CID, "alerts service", ALERTS_SERVICE_CONTRACT_ID, mockAlertsService);
+      SpecialPowers.wrap(SpecialPowers.Components)
+        .manager.QueryInterface(SpecialPowers.Ci.nsIComponentRegistrar)
+        .registerFactory(
+          MOCK_CID,
+          "alerts service",
+          ALERTS_SERVICE_CONTRACT_ID,
+          mockAlertsService
+        );
 
       // Load two frames with the same origin that create notification with the same tag.
       // Both pages should generate notifications with the same name, and thus the second
       // notification should replace the first.
-      frames.sameDomain.location.href = "http://test1.example.org:80/tests/dom/notification/test/mochitest/create_notification.html";
-      frames.anotherSameDomain.location.href = "http://test1.example.org:80/tests/dom/notification/test/mochitest/create_notification.html";
+      frames.sameDomain.location.href =
+        "http://test1.example.org:80/tests/dom/notification/test/mochitest/create_notification.html";
+      frames.anotherSameDomain.location.href =
+        "http://test1.example.org:80/tests/dom/notification/test/mochitest/create_notification.html";
       // Load a frame with a different origin that creates a notification with the same tag.
       // The notification name should be different and thus no notifications should be replaced.
-      frames.crossDomain.location.href = "http://test2.example.org:80/tests/dom/notification/test/mochitest/create_notification.html";
+      frames.crossDomain.location.href =
+        "http://test2.example.org:80/tests/dom/notification/test/mochitest/create_notification.html";
     }
 
-    SpecialPowers.pushPrefEnv({"set": [["notification.prompt.testing", true],
-                                       ["notification.prompt.testing.allow", true]]},
-                              showNotifications);
+    SpecialPowers.pushPrefEnv(
+      {
+        set: [
+          ["notification.prompt.testing", true],
+          ["notification.prompt.testing.allow", true],
+        ],
+      },
+      showNotifications
+    );
   } else {
     ok(true, "Notifications are not enabled on the platform.");
   }
 </script>
 </body>
 </html>