Bug 1200884: Make postmessage-to-client.https.html pass. r=jdm
authorKyle Huey <khuey@kylehuey.com>
Wed, 02 Sep 2015 17:17:09 -0700
changeset 260646 5818bea794a6a771a6db1fbed45e9b1f6f02e663
parent 260645 e9bce7012a9d23376ef6f2c9e28f7f6e55980038
child 260647 a05bfd76c34c42dd351cd96d68bdfefb4115d597
push id17297
push usercbook@mozilla.com
push dateThu, 03 Sep 2015 12:21:04 +0000
treeherderb2g-inbound@70f7c00f7fe6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjdm
bugs1200884
milestone43.0a1
Bug 1200884: Make postmessage-to-client.https.html pass. r=jdm
testing/web-platform/mozilla/meta/service-workers/service-worker/postmessage-to-client.https.html.ini
testing/web-platform/mozilla/tests/service-workers/service-worker/postmessage-to-client.https.html
deleted file mode 100644
--- a/testing/web-platform/mozilla/meta/service-workers/service-worker/postmessage-to-client.https.html.ini
+++ /dev/null
@@ -1,6 +0,0 @@
-[postmessage-to-client.https.html]
-  type: testharness
-  expected: TIMEOUT
-  [postMessage from ServiceWorker to Client]
-    expected: TIMEOUT
-
--- a/testing/web-platform/mozilla/tests/service-workers/service-worker/postmessage-to-client.https.html
+++ b/testing/web-platform/mozilla/tests/service-workers/service-worker/postmessage-to-client.https.html
@@ -1,34 +1,40 @@
 <!DOCTYPE html>
 <title>Service Worker: postMessage to Client</title>
 <script src="/resources/testharness.js"></script>
 <script src="/resources/testharnessreport.js"></script>
 <script src="resources/test-helpers.sub.js"></script>
 <script>
 var t = async_test('postMessage from ServiceWorker to Client');
 t.step(function() {
-    var scope = 'resources/blank.html'
+    var scope = 'resources/blank.html';
+    var sw;
     service_worker_unregister_and_register(
         t, 'resources/postmessage-to-client-worker.js', scope)
       .then(function(registration) {
           return wait_for_state(t, registration.installing, 'activated');
         })
       .then(function() { return with_iframe(scope); })
       .then(function(frame) {
-          var w = frame.contentWindow;
-          w.onmessage = t.step_func(onMessage);
-          w.navigator.serviceWorker.controller.postMessage('ping');
+          sw = frame.contentWindow.navigator.serviceWorker;
+          sw.onmessage = t.step_func(onMessage);
+          sw.controller.postMessage('ping');
         })
       .catch(unreached_rejection(t));
 
     var result = [];
     var expected = ['Sending message via clients'];
 
     function onMessage(e) {
+      assert_equals(e.bubbles, false, 'message events should not bubble.');
+      assert_equals(e.cancelable, false, 'message events should not be cancelable.');
+// XXXkhuey fixme!
+//      assert_equals(e.source, sw.controller, 'source should be ServiceWorker.');
+
       var message = e.data;
       if (message === 'quit') {
         assert_array_equals(result, expected,
                             'Worker should post back expected messages.');
         service_worker_unregister_and_done(t, scope);
       } else {
         result.push(message);
       }