Bug 1216833 - Make referer.https.html pass; r=bkelly
authorEhsan Akhgari <ehsan@mozilla.com>
Tue, 20 Oct 2015 20:43:03 -0400
changeset 304272 9433d531591c81fa31dd9d1c4c754d90d9ec5212
parent 304271 66dae447c29803b0f1bed088d0cfb0fef718d06e
child 304273 9268f83a6e4347c5d6f1758d4721c7864689914a
push id1001
push userraliiev@mozilla.com
push dateMon, 18 Jan 2016 19:06:03 +0000
treeherdermozilla-release@8b89261f3ac4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbkelly
bugs1216833
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 1216833 - Make referer.https.html pass; r=bkelly
testing/web-platform/mozilla/meta/service-workers/service-worker/referer.https.html.ini
testing/web-platform/mozilla/tests/service-workers/service-worker/resources/referer-iframe.html
testing/web-platform/mozilla/tests/service-workers/service-worker/resources/request-headers.py
deleted file mode 100644
--- a/testing/web-platform/mozilla/meta/service-workers/service-worker/referer.https.html.ini
+++ /dev/null
@@ -1,5 +0,0 @@
-[referer.https.html]
-  type: testharness
-  [Verify the referer]
-    expected: FAIL
-
--- a/testing/web-platform/mozilla/tests/service-workers/service-worker/resources/referer-iframe.html
+++ b/testing/web-platform/mozilla/tests/service-workers/service-worker/resources/referer-iframe.html
@@ -1,38 +1,39 @@
 <script src="../resources/get-host-info.sub.js"></script>
+<script src="test-helpers.sub.js"></script>
 <script>
 function check_referer(url, expected_referer) {
   return fetch(url)
     .then(function(res) { return res.json(); })
     .then(function(headers) {
-        if (headers['Referer'] === expected_referer) {
+        if (headers['referer'] === expected_referer) {
           return Promise.resolve();
         } else {
           return Promise.reject('Referer for ' + url + ' must be ' +
                                 expected_referer + ' but got ' +
-                                headers['Referer']);
+                                headers['referer']);
         }
       });
 }
 
 window.addEventListener('message', function(evt) {
     var host_info = get_host_info();
     var port = evt.ports[0];
     check_referer('request-headers.py?ignore=true',
                   host_info['HTTPS_ORIGIN'] +
-                  '/service-worker/resources/referer-iframe.html')
+                  base_path() + 'referer-iframe.html')
       .then(function() {
           return check_referer(
               'request-headers.py',
               host_info['HTTPS_ORIGIN'] +
-              '/service-worker/resources/fetch-rewrite-worker.js');
+              base_path() + 'fetch-rewrite-worker.js');
         })
       .then(function() {
           return check_referer(
               'request-headers.py?url=request-headers.py',
               host_info['HTTPS_ORIGIN'] +
-              '/service-worker/resources/fetch-rewrite-worker.js');
+              base_path() + 'fetch-rewrite-worker.js');
         })
       .then(function() { port.postMessage({results: 'finish'}); })
       .catch(function(e) { port.postMessage({results: 'failure:' + e}); });
   });
 </script>
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/service-workers/service-worker/resources/request-headers.py
@@ -0,0 +1,6 @@
+import json
+
+def main(request, response):
+    data = {key:request.headers[key] for key,value in request.headers.iteritems()}
+
+    return [("Content-Type", "application/json")], json.dumps(data)