Bug 1221351 - P2 Add a web-platform-test to check for crash when calling .register() on closed window. r=catalinb, a=test-only
authorBen Kelly <ben@wanderview.com>
Thu, 05 Nov 2015 09:33:34 -0800
changeset 291483 17c4936c9a0ee82f7ac3f7c1392ce619170419ab
parent 291482 4bf317aa1f747b17bba3d293972617bfa1d7aa2b
child 291484 77e2c8fab108b4804defcc5816e93815ed6cf41b
push id8711
push usercbook@mozilla.com
push dateThu, 12 Nov 2015 10:43:53 +0000
treeherdermozilla-aurora@0e9c6096f7e9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerscatalinb, test-only
bugs1221351
milestone44.0a2
Bug 1221351 - P2 Add a web-platform-test to check for crash when calling .register() on closed window. r=catalinb, a=test-only
testing/web-platform/meta/MANIFEST.json
testing/web-platform/mozilla/meta/MANIFEST.json
testing/web-platform/mozilla/tests/service-workers/service-worker/register-closed-window.https.html
testing/web-platform/mozilla/tests/service-workers/service-worker/resources/register-closed-window-iframe.html
--- a/testing/web-platform/meta/MANIFEST.json
+++ b/testing/web-platform/meta/MANIFEST.json
@@ -26297,24 +26297,24 @@
         "path": "webaudio/the-audio-api/the-audiobuffer-interface/idl-test.html",
         "url": "/webaudio/the-audio-api/the-audiobuffer-interface/idl-test.html"
       },
       {
         "path": "webaudio/the-audio-api/the-audiodestinationnode-interface/idl-test.html",
         "url": "/webaudio/the-audio-api/the-audiodestinationnode-interface/idl-test.html"
       },
       {
+        "path": "webaudio/the-audio-api/the-audionode-interface/audionode-connect-return-value.html",
+        "url": "/webaudio/the-audio-api/the-audionode-interface/audionode-connect-return-value.html"
+      },
+      {
         "path": "webaudio/the-audio-api/the-audioparam-interface/retrospective-setValueAtTime.html",
         "url": "/webaudio/the-audio-api/the-audioparam-interface/retrospective-setValueAtTime.html"
       },
       {
-        "path": "webaudio/the-audio-api/the-audionode-interface/audionode-connect-return-value.html",
-        "url": "/webaudio/the-audio-api/the-audionode-interface/audionode-connect-return-value.html"
-      },
-      {
         "path": "webaudio/the-audio-api/the-delaynode-interface/idl-test.html",
         "url": "/webaudio/the-audio-api/the-delaynode-interface/idl-test.html"
       },
       {
         "path": "webaudio/the-audio-api/the-gainnode-interface/idl-test.html",
         "url": "/webaudio/the-audio-api/the-gainnode-interface/idl-test.html"
       },
       {
@@ -35318,9 +35318,9 @@
         ],
         "url": "/webvtt/rendering/cues-with-video/processing-model/too_many_cues_wrapped.html"
       }
     ]
   },
   "rev": "886dea2c3dbb79925360319a6a0f662ce196ab3c",
   "url_base": "/",
   "version": 2
-}
+}
\ No newline at end of file
--- a/testing/web-platform/mozilla/meta/MANIFEST.json
+++ b/testing/web-platform/mozilla/meta/MANIFEST.json
@@ -326,16 +326,23 @@
           }
         ],
         "service-workers/service-worker/referer.https.html": [
           {
             "path": "service-workers/service-worker/referer.https.html",
             "url": "/_mozilla/service-workers/service-worker/referer.https.html"
           }
         ],
+        "service-workers/service-worker/register-closed-window.https.html": [
+          {
+            "path": "service-workers/service-worker/register-closed-window.https.html",
+            "timeout": "long",
+            "url": "/_mozilla/service-workers/service-worker/register-closed-window.https.html"
+          }
+        ],
         "service-workers/service-worker/register-default-scope.https.html": [
           {
             "path": "service-workers/service-worker/register-default-scope.https.html",
             "url": "/_mozilla/service-workers/service-worker/register-default-scope.https.html"
           }
         ],
         "service-workers/service-worker/register-same-scope-different-script-url.https.html": [
           {
@@ -494,34 +501,34 @@
           }
         ],
         "service-workers/service-worker/unregister.https.html": [
           {
             "path": "service-workers/service-worker/unregister.https.html",
             "url": "/_mozilla/service-workers/service-worker/unregister.https.html"
           }
         ],
+        "service-workers/service-worker/update-after-navigation-fetch-event.https.html": [
+          {
+            "path": "service-workers/service-worker/update-after-navigation-fetch-event.https.html",
+            "url": "/_mozilla/service-workers/service-worker/update-after-navigation-fetch-event.https.html"
+          }
+        ],
+        "service-workers/service-worker/update-after-oneday.https.html": [
+          {
+            "path": "service-workers/service-worker/update-after-oneday.https.html",
+            "url": "/_mozilla/service-workers/service-worker/update-after-oneday.https.html"
+          }
+        ],
         "service-workers/service-worker/update.https.html": [
           {
             "path": "service-workers/service-worker/update.https.html",
             "url": "/_mozilla/service-workers/service-worker/update.https.html"
           }
         ],
-        "service-workers/service-worker/update-after-navigation-fetch-event.https.html": [
-          {
-            "path": "service-workers/service-worker//update-after-navigation-fetch-event.https.html",
-            "url": "/_mozilla/service-workers/service-worker//update-after-navigation-fetch-event.https.html"
-          }
-        ],
-        "service-workers/service-worker/update-after-oneday.https.html": [
-          {
-            "path": "service-workers/service-worker//update-after-oneday.https.html",
-            "url": "/_mozilla/service-workers/service-worker//update-after-oneday.https.html"
-          }
-        ],
         "service-workers/service-worker/waiting.https.html": [
           {
             "path": "service-workers/service-worker/waiting.https.html",
             "url": "/_mozilla/service-workers/service-worker/waiting.https.html"
           }
         ],
         "service-workers/service-worker/worker-interception.https.html": [
           {
@@ -538,9 +545,9 @@
       }
     },
     "reftest_nodes": {}
   },
   "reftest_nodes": {},
   "rev": null,
   "url_base": "/_mozilla/",
   "version": 2
-}
+}
\ No newline at end of file
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/service-workers/service-worker/register-closed-window.https.html
@@ -0,0 +1,35 @@
+<!DOCTYPE html>
+<title>Service Worker: Register() on Closed Window</title>
+<meta name=timeout content=long>
+<script src="/resources/testharness.js"></script>
+<script src="resources/testharness-helpers.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="resources/get-host-info.sub.js"></script>
+<script src="resources/test-helpers.sub.js"></script>
+<body>
+<script>
+
+var host_info = get_host_info();
+var frameURL = host_info['HTTPS_ORIGIN'] + base_path() +
+               'resources/register-closed-window-iframe.html';
+
+async_test(function(t) {
+  var frame;
+  with_iframe(frameURL).then(function(f) {
+    frame = f;
+    return new Promise(function(resolve) {
+      window.addEventListener('message', function messageHandler(evt) {
+        window.removeEventListener('message', messageHandler);
+        resolve(evt.data);
+      });
+      frame.contentWindow.postMessage('START', '*');
+    });
+  }).then(function(result) {
+    assert_equals(result, 'OK', 'frame should complete without crashing');
+    frame.remove();
+    t.done();
+  }).catch(unreached_rejection(t));
+}, 'TODO');
+
+</script>
+</body>
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/service-workers/service-worker/resources/register-closed-window-iframe.html
@@ -0,0 +1,16 @@
+<html>
+<head>
+<script>
+window.addEventListener('message', function(evt) {
+  if (evt.data === 'START') {
+    var w = window.open('./');
+    var sw = w.navigator.serviceWorker;
+    w.close();
+    w = null;
+    sw.register('doesntmatter.js');
+    parent.postMessage('OK', '*');
+  }
+});
+</script>
+</head>
+</html>