Bug 1340654 P3 Test referrer-policy in service workers. r=baku
authorBen Kelly <ben@wanderview.com>
Thu, 23 Feb 2017 10:54:43 -0500
changeset 344606 88206a320746c25d87e509fda81950d89ccb2696
parent 344605 b8ae4c3de32817cccc7d57bb28195de3254c021a
child 344607 68ada0ef9842896b6fd96d0853022e0e131c04d5
push id31414
push usercbook@mozilla.com
push dateFri, 24 Feb 2017 10:47:41 +0000
treeherdermozilla-central@be661bae6cb9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbaku
bugs1340654
milestone54.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 1340654 P3 Test referrer-policy in service workers. r=baku
testing/web-platform/meta/MANIFEST.json
testing/web-platform/meta/fetch/api/policies/referrer-origin-service-worker.https.html.ini
testing/web-platform/tests/fetch/api/policies/referrer-no-referrer-service-worker.https.html
testing/web-platform/tests/fetch/api/policies/referrer-origin-service-worker.https.html
testing/web-platform/tests/fetch/api/policies/referrer-origin-when-cross-origin-service-worker.https.html
testing/web-platform/tests/fetch/api/policies/referrer-origin-when-cross-origin.js
testing/web-platform/tests/fetch/api/policies/referrer-origin.html
testing/web-platform/tests/fetch/api/policies/referrer-origin.js
testing/web-platform/tests/fetch/api/policies/referrer-unsafe-url-service-worker.https.html
--- a/testing/web-platform/meta/MANIFEST.json
+++ b/testing/web-platform/meta/MANIFEST.json
@@ -87468,28 +87468,46 @@
     ]
    ],
    "fetch/api/policies/csp-blocked.html": [
     [
      "/fetch/api/policies/csp-blocked.html",
      {}
     ]
    ],
+   "fetch/api/policies/referrer-no-referrer-service-worker.https.html": [
+    [
+     "/fetch/api/policies/referrer-no-referrer-service-worker.https.html",
+     {}
+    ]
+   ],
    "fetch/api/policies/referrer-no-referrer-worker.html": [
     [
      "/fetch/api/policies/referrer-no-referrer-worker.html",
      {}
     ]
    ],
    "fetch/api/policies/referrer-no-referrer.html": [
     [
      "/fetch/api/policies/referrer-no-referrer.html",
      {}
     ]
    ],
+   "fetch/api/policies/referrer-origin-service-worker.https.html": [
+    [
+     "/fetch/api/policies/referrer-origin-service-worker.https.html",
+     {}
+    ]
+   ],
+   "fetch/api/policies/referrer-origin-when-cross-origin-service-worker.https.html": [
+    [
+     "/fetch/api/policies/referrer-origin-when-cross-origin-service-worker.https.html",
+     {}
+    ]
+   ],
    "fetch/api/policies/referrer-origin-when-cross-origin-worker.html": [
     [
      "/fetch/api/policies/referrer-origin-when-cross-origin-worker.html",
      {}
     ]
    ],
    "fetch/api/policies/referrer-origin-when-cross-origin.html": [
     [
@@ -87504,16 +87522,22 @@
     ]
    ],
    "fetch/api/policies/referrer-origin.html": [
     [
      "/fetch/api/policies/referrer-origin.html",
      {}
     ]
    ],
+   "fetch/api/policies/referrer-unsafe-url-service-worker.https.html": [
+    [
+     "/fetch/api/policies/referrer-unsafe-url-service-worker.https.html",
+     {}
+    ]
+   ],
    "fetch/api/policies/referrer-unsafe-url-worker.html": [
     [
      "/fetch/api/policies/referrer-unsafe-url-worker.html",
      {}
     ]
    ],
    "fetch/api/policies/referrer-unsafe-url.html": [
     [
@@ -163687,16 +163711,20 @@
   "fetch/api/policies/nested-policy.js": [
    "57cfc2060102695b601209e4927861aaee377c4e",
    "support"
   ],
   "fetch/api/policies/nested-policy.js.headers": [
    "fab90d344cbb78bad6445288c418b87736a830ae",
    "support"
   ],
+  "fetch/api/policies/referrer-no-referrer-service-worker.https.html": [
+   "274797274e05e467499b98179dd23a19a960a014",
+   "testharness"
+  ],
   "fetch/api/policies/referrer-no-referrer-worker.html": [
    "cc9274c1b182a487dbe945e6d8754a671d78e3c4",
    "testharness"
   ],
   "fetch/api/policies/referrer-no-referrer.html": [
    "e1ecb25e8294ad2a50cf079d0b164a6d3fa6d40f",
    "testharness"
   ],
@@ -163707,56 +163735,68 @@
   "fetch/api/policies/referrer-no-referrer.js": [
    "13e511999d7bee96aa568479fe608434f588cd8c",
    "support"
   ],
   "fetch/api/policies/referrer-no-referrer.js.headers": [
    "fab90d344cbb78bad6445288c418b87736a830ae",
    "support"
   ],
+  "fetch/api/policies/referrer-origin-service-worker.https.html": [
+   "cf400b001e381251b0eaca8290e975dc27f6ff0f",
+   "testharness"
+  ],
+  "fetch/api/policies/referrer-origin-when-cross-origin-service-worker.https.html": [
+   "c2d6e3abb2b4ec0342ac9c16c468adb8b03e0426",
+   "testharness"
+  ],
   "fetch/api/policies/referrer-origin-when-cross-origin-worker.html": [
    "3242db3a9319923287f36987f6f14581c239ced2",
    "testharness"
   ],
   "fetch/api/policies/referrer-origin-when-cross-origin.html": [
    "eb46215635a3d26d20595533c24abdc79192264f",
    "testharness"
   ],
   "fetch/api/policies/referrer-origin-when-cross-origin.html.headers": [
    "ad4eae9b2a1368f4b251579b9a246177f1c5ebbc",
    "support"
   ],
   "fetch/api/policies/referrer-origin-when-cross-origin.js": [
-   "f6b25aad46ba48422fab737582e82179666b5233",
+   "802ebd6d423099439a790c3db9b7ae37cbe5d9a0",
    "support"
   ],
   "fetch/api/policies/referrer-origin-when-cross-origin.js.headers": [
    "ad4eae9b2a1368f4b251579b9a246177f1c5ebbc",
    "support"
   ],
   "fetch/api/policies/referrer-origin-worker.html": [
    "66feccfd0f0f2e5f0a82d6e591e03621c593acc8",
    "testharness"
   ],
   "fetch/api/policies/referrer-origin.html": [
-   "0ab191b8e4c349d47569a8d7cfeebec89711a0cb",
+   "ae8bfdfb5b9ae86522378ec798908b7db442797d",
    "testharness"
   ],
   "fetch/api/policies/referrer-origin.html.headers": [
    "56b5f91097bb278ebc69345c0b56c65eb16cc3db",
    "support"
   ],
   "fetch/api/policies/referrer-origin.js": [
-   "8d8b58a4d5046e55e6bd97289cf6e515614e9577",
+   "e863bed9479b1b89cb0d8fae680e471ca66c757f",
    "support"
   ],
   "fetch/api/policies/referrer-origin.js.headers": [
    "56b5f91097bb278ebc69345c0b56c65eb16cc3db",
    "support"
   ],
+  "fetch/api/policies/referrer-unsafe-url-service-worker.https.html": [
+   "d2fa5c7813f57909228b51417df0267cd7ec0c20",
+   "testharness"
+  ],
   "fetch/api/policies/referrer-unsafe-url-worker.html": [
    "70e7ec27a61ee68fb419213be149816ed618ce24",
    "testharness"
   ],
   "fetch/api/policies/referrer-unsafe-url.html": [
    "906c41a44364be3e1bff38982ab920d85a3a3fbd",
    "testharness"
   ],
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/meta/fetch/api/policies/referrer-origin-service-worker.https.html.ini
@@ -0,0 +1,5 @@
+[referrer-origin-service-worker.https.html]
+  type: testharness
+  [Cross-origin referrer is overridden by client origin]
+    expected: FAIL
+    bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1341223
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/fetch/api/policies/referrer-no-referrer-service-worker.https.html
@@ -0,0 +1,18 @@
+<!doctype html>
+<html>
+  <head>
+    <meta charset="utf-8">
+    <title>Fetch in service worker: referrer with no-referrer policy</title>
+    <meta name="help" href="https://fetch.spec.whatwg.org/#main-fetch">
+    <meta name="help" href="https://fetch.spec.whatwg.org/#http-network-or-cache-fetch">
+    <meta name="author" title="Canon Research France" href="https://www.crf.canon.fr">
+    <script src="/resources/testharness.js"></script>
+    <script src="/resources/testharnessreport.js"></script>
+    <script src="/service-workers/service-worker/resources/test-helpers.sub.js"></script>
+  </head>
+  <body>
+    <script>
+      service_worker_test("referrer-no-referrer.js?pipe=sub");
+    </script>
+  </body>
+</html>
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/fetch/api/policies/referrer-origin-service-worker.https.html
@@ -0,0 +1,18 @@
+<!doctype html>
+<html>
+  <head>
+    <meta charset="utf-8">
+    <title>Fetch in service worker: referrer with no-referrer policy</title>
+    <meta name="help" href="https://fetch.spec.whatwg.org/#main-fetch">
+    <meta name="help" href="https://fetch.spec.whatwg.org/#http-network-or-cache-fetch">
+    <meta name="author" title="Canon Research France" href="https://www.crf.canon.fr">
+    <script src="/resources/testharness.js"></script>
+    <script src="/resources/testharnessreport.js"></script>
+    <script src="/service-workers/service-worker/resources/test-helpers.sub.js"></script>
+  </head>
+  <body>
+    <script>
+      service_worker_test("referrer-origin.js?pipe=sub");
+    </script>
+  </body>
+</html>
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/fetch/api/policies/referrer-origin-when-cross-origin-service-worker.https.html
@@ -0,0 +1,17 @@
+<!doctype html>
+<html>
+  <head>
+    <meta charset="utf-8">
+    <title>Fetch in service worker: referrer with origin-when-cross-origin policy</title>
+    <meta name="help" href="https://fetch.spec.whatwg.org/#main-fetch">
+    <meta name="help" href="https://fetch.spec.whatwg.org/#http-network-or-cache-fetch">
+    <script src="/resources/testharness.js"></script>
+    <script src="/resources/testharnessreport.js"></script>
+    <script src="/service-workers/service-worker/resources/test-helpers.sub.js"></script>
+  </head>
+  <body>
+    <script>
+      service_worker_test("referrer-origin-when-cross-origin.js?pipe=sub");
+    </script>
+  </body>
+</html>
--- a/testing/web-platform/tests/fetch/api/policies/referrer-origin-when-cross-origin.js
+++ b/testing/web-platform/tests/fetch/api/policies/referrer-origin-when-cross-origin.js
@@ -2,18 +2,18 @@ if (this.document === undefined) {
   importScripts("/resources/testharness.js");
   importScripts("../resources/utils.js");
 
   // A nested importScripts() with a referrer-policy should have no effect
   // on overall worker policy.
   importScripts("nested-policy.js");
 }
 
-var referrerOrigin = "http://{{host}}:{{ports[http][0]}}/";
-var fetchedUrl = "http://{{host}}:{{ports[http][1]}}" + dirname(location.pathname) + RESOURCES_DIR + "inspect-headers.py?cors&headers=referer";
+var referrerOrigin = location.origin + '/';
+var fetchedUrl = "https://{{domains[www]}}:{{ports[https][0]}}" + dirname(location.pathname) + RESOURCES_DIR + "inspect-headers.py?cors&headers=referer";
 
 promise_test(function(test) {
   return fetch(fetchedUrl).then(function(resp) {
     assert_equals(resp.status, 200, "HTTP status is 200");
     assert_equals(resp.headers.get("x-request-referer"), referrerOrigin, "request's referrer is " + referrerOrigin);
   });
 }, "Request's referrer is origin");
 
--- a/testing/web-platform/tests/fetch/api/policies/referrer-origin.html
+++ b/testing/web-platform/tests/fetch/api/policies/referrer-origin.html
@@ -8,9 +8,9 @@
     <meta name="author" title="Canon Research France" href="https://www.crf.canon.fr">
     <script src="/resources/testharness.js"></script>
     <script src="/resources/testharnessreport.js"></script>
   </head>
   <body>
     <script src="../resources/utils.js"></script>
     <script src="referrer-origin.js?pipe=sub"></script>
   </body>
-</html>
\ No newline at end of file
+</html>
--- a/testing/web-platform/tests/fetch/api/policies/referrer-origin.js
+++ b/testing/web-platform/tests/fetch/api/policies/referrer-origin.js
@@ -2,29 +2,29 @@ if (this.document === undefined) {
   importScripts("/resources/testharness.js");
   importScripts("../resources/utils.js");
 
   // A nested importScripts() with a referrer-policy should have no effect
   // on overall worker policy.
   importScripts("nested-policy.js");
 }
 
-var referrerOrigin = "http://{{host}}:{{ports[http][0]}}/";
+var referrerOrigin = self.location.origin + '/';
 var fetchedUrl = RESOURCES_DIR + "inspect-headers.py?headers=referer";
 
 promise_test(function(test) {
   return fetch(fetchedUrl).then(function(resp) {
     assert_equals(resp.status, 200, "HTTP status is 200");
     assert_equals(resp.type , "basic", "Response's type is basic");
     assert_equals(resp.headers.get("x-request-referer"), referrerOrigin, "request's referrer is " + referrerOrigin);
   });
 }, "Request's referrer is origin");
 
 promise_test(function(test) {
-  var referrerUrl = "http://{{domains[www]}}:{{ports[http][0]}}/";
+  var referrerUrl = "https://{{domains[www]}}:{{ports[https][0]}}/";
   return fetch(fetchedUrl, { "referrer": referrerUrl }).then(function(resp) {
     assert_equals(resp.status, 200, "HTTP status is 200");
     assert_equals(resp.type , "basic", "Response's type is basic");
     assert_equals(resp.headers.get("x-request-referer"), referrerOrigin, "request's referrer is " + referrerOrigin);
   });
 }, "Cross-origin referrer is overridden by client origin");
 
 done();
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/fetch/api/policies/referrer-unsafe-url-service-worker.https.html
@@ -0,0 +1,18 @@
+<!doctype html>
+<html>
+  <head>
+    <meta charset="utf-8">
+    <title>Fetch in worker: referrer with unsafe-url policy</title>
+    <meta name="help" href="https://fetch.spec.whatwg.org/#main-fetch">
+    <meta name="help" href="https://fetch.spec.whatwg.org/#http-network-or-cache-fetch">
+    <meta name="author" title="Canon Research France" href="https://www.crf.canon.fr">
+    <script src="/resources/testharness.js"></script>
+    <script src="/resources/testharnessreport.js"></script>
+    <script src="/service-workers/service-worker/resources/test-helpers.sub.js"></script>
+  </head>
+  <body>
+    <script>
+      service_worker_test("referrer-unsafe-url.js?pipe=sub");
+    </script>
+  </body>
+</html>