Bug 1255692. Add another test for calling ServiceWorkerRegistration.showNotification. r=wchen
authorBoris Zbarsky <bzbarsky@mit.edu>
Thu, 10 Mar 2016 23:14:01 -0500
changeset 339697 70cc89f753aeebb88f2617ab22b1e265ea587b35
parent 339696 5c9c719705b1cdf7dd0cb9ec142e15764551f093
child 339698 6e046657dad1874068200604238452b6f6d8d26f
push id12803
push userjbeich@FreeBSD.org
push dateSun, 13 Mar 2016 09:48:54 +0000
reviewerswchen
bugs1255692
milestone48.0a1
Bug 1255692. Add another test for calling ServiceWorkerRegistration.showNotification. r=wchen
dom/workers/test/serviceworkers/mochitest.ini
dom/workers/test/serviceworkers/notificationclick-otherwindow.html
dom/workers/test/serviceworkers/test_notificationclick-otherwindow.html
--- a/dom/workers/test/serviceworkers/mochitest.ini
+++ b/dom/workers/test/serviceworkers/mochitest.ini
@@ -123,16 +123,17 @@ support-files =
   source_message_posting_worker.js
   scope/scope_worker.js
   redirect_serviceworker.sjs
   importscript.sjs
   importscript_worker.js
   bug1151916_worker.js
   bug1151916_driver.html
   notificationclick.html
+  notificationclick-otherwindow.html
   notificationclick.js
   notificationclick_focus.html
   notificationclick_focus.js
   worker_updatefoundevent.js
   worker_updatefoundevent2.js
   updatefoundevent.html
   empty.js
   notification_constructor_error.js
@@ -259,16 +260,18 @@ support-files =
 [test_request_context_worker.html]
 [test_request_context_xhr.html]
 [test_request_context_xslt.html]
 [test_scopes.html]
 [test_sandbox_intercept.html]
 skip-if = e10s && debug && os == 'win'
 [test_notificationclick.html]
 skip-if = e10s && debug && os == 'win'
+[test_notificationclick-otherwindow.html]
+skip-if = e10s && debug && os == 'win'
 [test_notificationclick_focus.html]
 skip-if = toolkit == "android" || toolkit == "gonk" || (e10s && debug && os == 'win')
 [test_notification_constructor_error.html]
 skip-if = e10s && debug && os == 'win'
 [test_notification_get.html]
 skip-if = e10s && debug && os == 'win'
 [test_sanitize.html]
 [test_sanitize_domain.html]
copy from dom/workers/test/serviceworkers/notificationclick.html
copy to dom/workers/test/serviceworkers/notificationclick-otherwindow.html
--- a/dom/workers/test/serviceworkers/notificationclick.html
+++ b/dom/workers/test/serviceworkers/notificationclick-otherwindow.html
@@ -8,17 +8,20 @@
   <title>Bug 1114554 - controlled page</title>
 <script class="testbody" type="text/javascript">
   var testWindow = parent;
   if (opener) {
     testWindow = opener;
   }
 
   navigator.serviceWorker.ready.then(function(swr) {
-    swr.showNotification("Hi there. The ServiceWorker should receive a click event for this.", { data: { complex: ["jsval", 5] }});
+    var ifr = document.createElement("iframe");
+    document.documentElement.appendChild(ifr);
+    ifr.contentWindow.ServiceWorkerRegistration.prototype.showNotification
+       .call(swr, "Hi there. The ServiceWorker should receive a click event for this.", { data: { complex: ["jsval", 5] }});
   });
 
   navigator.serviceWorker.onmessage = function(msg) {
     testWindow.callback(msg.data.result);
   };
 </script>
 
 </head>
copy from dom/workers/test/serviceworkers/test_notificationclick.html
copy to dom/workers/test/serviceworkers/test_notificationclick-otherwindow.html
--- a/dom/workers/test/serviceworkers/test_notificationclick.html
+++ b/dom/workers/test/serviceworkers/test_notificationclick-otherwindow.html
@@ -35,18 +35,18 @@ https://bugzilla.mozilla.org/show_bug.cg
     };
     document.body.appendChild(iframe);
   }
 
   var registration;
 
   function runTest() {
     MockServices.register();
-    testFrame('notificationclick.html');
-    navigator.serviceWorker.register("notificationclick.js", { scope: "notificationclick.html" }).then(function(reg) {
+    testFrame('notificationclick-otherwindow.html');
+    navigator.serviceWorker.register("notificationclick.js", { scope: "notificationclick-otherwindow.html" }).then(function(reg) {
       registration = reg;
     }, function(e) {
       ok(false, "registration should have passed!");
     });
   };
 
   SimpleTest.waitForExplicitFinish();
   SpecialPowers.pushPrefEnv({"set": [