Bug 1212683 - Fix and enable update.https.html; r=jdm
authorEhsan Akhgari <ehsan@mozilla.com>
Wed, 07 Oct 2015 21:33:55 -0400
changeset 266864 7893f2b7fd2513a0229b40579d0ee8c4a042c37e
parent 266863 becb0ef361369d441b74a18d4b25bc0d1c7d6f6a
child 266865 cb177e743d72a2dc6cb8acf441fca24a6431d4ab
push id29499
push userkwierso@gmail.com
push dateThu, 08 Oct 2015 21:29:10 +0000
treeherdermozilla-central@46da59584acb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjdm
bugs1212683
milestone44.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 1212683 - Fix and enable update.https.html; r=jdm The source of the missing python script is: https://chromium.googlesource.com/chromium/src/+/8a0f7fc/third_party/WebKit/LayoutTests/http/tests/serviceworker/ServiceWorkerGlobalScope/resources/update-worker.php
testing/web-platform/mozilla/meta/service-workers/service-worker/ServiceWorkerGlobalScope/update.https.html.ini
testing/web-platform/mozilla/tests/service-workers/service-worker/ServiceWorkerGlobalScope/resources/update-worker.js
testing/web-platform/mozilla/tests/service-workers/service-worker/ServiceWorkerGlobalScope/resources/update-worker.py
deleted file mode 100644
--- a/testing/web-platform/mozilla/meta/service-workers/service-worker/ServiceWorkerGlobalScope/update.https.html.ini
+++ /dev/null
@@ -1,5 +0,0 @@
-[update.https.html]
-  type: testharness
-  [Update a registration on ServiceWorkerGlobalScope]
-    expected: FAIL
-
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/service-workers/service-worker/ServiceWorkerGlobalScope/resources/update-worker.js
@@ -0,0 +1,25 @@
+importScripts('../../resources/test-helpers.sub.js');
+importScripts('../../resources/worker-testharness.js');
+
+var events_seen = [];
+
+self.registration.addEventListener('updatefound', function() {
+    events_seen.push('updatefound');
+  });
+
+self.addEventListener('activate', function(e) {
+    events_seen.push('activate');
+  });
+
+self.addEventListener('fetch', function(e) {
+    events_seen.push('fetch');
+    e.respondWith(new Response(events_seen));
+  });
+
+self.addEventListener('message', function(e) {
+    events_seen.push('message');
+    self.registration.update();
+  });
+
+// update() during the script evaluation should be ignored.
+self.registration.update();
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/service-workers/service-worker/ServiceWorkerGlobalScope/resources/update-worker.py
@@ -0,0 +1,14 @@
+import os
+import time
+
+def main(request, response):
+    # update() does not bypass cache so set the max-age to 0 such that update()
+    # can find a new version in the network.
+    headers = [('Cache-Control', 'max-age: 0'),
+               ('Content-Type', 'application/javascript')]
+    with open(os.path.join(os.path.dirname(__file__),
+                           'update-worker.js'), 'r') as file:
+        script = file.read()
+    # Return a different script for each access.
+    return headers, '// %s\n%s' % (time.time(), script)
+