Bug 1283674 P2 Add wpt test verifying serviceWorker.controller behavior on disconnected window. r=baku
authorBen Kelly <ben@wanderview.com>
Mon, 04 Jul 2016 06:50:25 -0700
changeset 303502 e28b6e2e44d1273e84f93ede285ba5d363023ba8
parent 303501 a2fd213837b84fab63104d1ab5bb034909647c33
child 303503 7f6ff2e767e36e7b0f6edf15a44cfb948faa0eea
push id79106
push userbkelly@mozilla.com
push dateMon, 04 Jul 2016 13:50:34 +0000
treeherdermozilla-inbound@e28b6e2e44d1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbaku
bugs1283674
milestone50.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 1283674 P2 Add wpt test verifying serviceWorker.controller behavior on disconnected window. r=baku
testing/web-platform/meta/MANIFEST.json
testing/web-platform/tests/service-workers/service-worker/controller-on-disconnect.https.html
--- a/testing/web-platform/meta/MANIFEST.json
+++ b/testing/web-platform/meta/MANIFEST.json
@@ -36386,16 +36386,22 @@
         ],
         "editing/run/multitest.html": [
           {
             "path": "editing/run/multitest.html",
             "timeout": "long",
             "url": "/editing/run/multitest.html"
           }
         ],
+        "service-workers/service-worker/controller-on-disconnect.https.html": [
+          {
+            "path": "service-workers/service-worker/controller-on-disconnect.https.html",
+            "url": "/service-workers/service-worker/controller-on-disconnect.https.html"
+          }
+        ],
         "web-animations/animation-model/keyframe-effects/spacing-keyframes.html": [
           {
             "path": "web-animations/animation-model/keyframe-effects/spacing-keyframes.html",
             "url": "/web-animations/animation-model/keyframe-effects/spacing-keyframes.html"
           }
         ],
         "web-animations/interfaces/DocumentTimeline/constructor.html": [
           {
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/service-workers/service-worker/controller-on-disconnect.https.html
@@ -0,0 +1,40 @@
+<!DOCTYPE html>
+<title>Service Worker: Controller on load</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="resources/test-helpers.sub.js"></script>
+<body>
+<script>
+var t = async_test('controller is cleared on disconnected window');
+t.step(function() {
+    var url = 'resources/empty-worker.js';
+    var scope = 'resources/blank.html';
+    var registration;
+    var controller;
+    var frame;
+    service_worker_unregister_and_register(t, url, scope)
+      .then(t.step_func(function(swr) {
+          registration = swr;
+          return wait_for_state(t, registration.installing, 'activated');
+        }))
+      .then(t.step_func(function() {
+          return with_iframe(scope)
+        }))
+      .then(t.step_func(function(f) {
+          frame = f;
+          var w = frame.contentWindow;
+          var swc = w.navigator.serviceWorker;
+          assert_true(swc.controller instanceof w.ServiceWorker,
+                      'controller should be a ServiceWorker object');
+
+          frame.remove();
+
+          assert_equals(swc.controller, null,
+                        'disconnected frame should not be controlled');
+
+          service_worker_unregister_and_done(t, scope);
+        }))
+      .catch(unreached_rejection(t));
+  });
+</script>
+</body>