Bug 1420672 - P2: Add wpt tests to verify service workers redirect the hash fragment if the redirect URL doesn't have one. r=bkelly a=jcristau
authorTom Tung <shes050117@gmail.com>
Fri, 08 Dec 2017 17:26:52 +0800
changeset 445422 9e467d43a27a7b45364f03a3ec5e7a2d23adfb51
parent 445421 9ea92fd889d8a1edf8c2e4a9ce023852a1b0b6e1
child 445423 e3fc217044d7d8bec8d8ce316bc33d2a86b716e9
push id1618
push userCallek@gmail.com
push dateThu, 11 Jan 2018 17:45:48 +0000
treeherdermozilla-release@882ca853e05a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbkelly, jcristau
bugs1420672
milestone58.0
Bug 1420672 - P2: Add wpt tests to verify service workers redirect the hash fragment if the redirect URL doesn't have one. r=bkelly a=jcristau
testing/web-platform/tests/service-workers/service-worker/navigation-redirect.https.html
--- a/testing/web-platform/tests/service-workers/service-worker/navigation-redirect.https.html
+++ b/testing/web-platform/tests/service-workers/service-worker/navigation-redirect.https.html
@@ -151,16 +151,32 @@ promise_test(function(t) {
             OUT_SCOPE + 'url=' + encodeURIComponent(SCOPE1),
             SCOPE1,
             [[SCOPE1], [], []]);
       });
   }, 'Normal redirect to same-origin scope.');
 promise_test(function(t) {
     return setup_environment(t).then(function() {
         return test_redirect(
+            OUT_SCOPE + 'url=' + encodeURIComponent(SCOPE1) + '#ref',
+            SCOPE1 + '#ref',
+            [[SCOPE1 + '#ref'], [], []]);
+      });
+  }, 'Normal redirect to same-origin scope with a hash fragment.');
+promise_test(function(t) {
+    return setup_environment(t).then(function() {
+        return test_redirect(
+            OUT_SCOPE + 'url=' + encodeURIComponent(SCOPE1 + '#ref2') + '#ref',
+            SCOPE1 + '#ref2',
+            [[SCOPE1 + '#ref2'], [], []]);
+      });
+  }, 'Normal redirect to same-origin scope with different hash fragments.');
+promise_test(function(t) {
+    return setup_environment(t).then(function() {
+        return test_redirect(
             OUT_SCOPE + 'url=' + encodeURIComponent(OTHER_ORIGIN_SCOPE),
             OTHER_ORIGIN_SCOPE,
             [[], [], [OTHER_ORIGIN_SCOPE]]);
       });
   }, 'Normal redirect to other-origin scope.');
 
 // SW fallbacked redirect. SW doesn't handle the fetch request.
 promise_test(function(t) {
@@ -177,16 +193,37 @@ promise_test(function(t) {
             SCOPE1 + 'url=' + encodeURIComponent(SCOPE1),
             SCOPE1,
             [[SCOPE1 + 'url=' + encodeURIComponent(SCOPE1), SCOPE1], [], []]);
       });
   }, 'SW-fallbacked redirect to same-origin same-scope.');
 promise_test(function(t) {
     return setup_environment(t).then(function() {
         return test_redirect(
+            SCOPE1 + 'url=' + encodeURIComponent(SCOPE1) + '#ref',
+            SCOPE1 + '#ref',
+            [[SCOPE1 + 'url=' + encodeURIComponent(SCOPE1) + '#ref',
+              SCOPE1 + '#ref'],
+             [], []]);
+      });
+  }, 'SW-fallbacked redirect to same-origin same-scope with a hash fragment.');
+promise_test(function(t) {
+    return setup_environment(t).then(function() {
+        return test_redirect(
+            SCOPE1 + 'url=' + encodeURIComponent(SCOPE1 + '#ref2') + '#ref',
+            SCOPE1 + '#ref2',
+            [[SCOPE1 + 'url=' + encodeURIComponent(SCOPE1 + '#ref2') + '#ref',
+              SCOPE1 + '#ref2'],
+             [], []]);
+      });
+  }, 'SW-fallbacked redirect to same-origin same-scope with different hash ' +
+     'fragments.');
+promise_test(function(t) {
+    return setup_environment(t).then(function() {
+        return test_redirect(
             SCOPE1 + 'url=' + encodeURIComponent(SCOPE2),
             SCOPE2,
             [[SCOPE1 + 'url=' + encodeURIComponent(SCOPE2)], [SCOPE2], []]);
       });
   }, 'SW-fallbacked redirect to same-origin other-scope.');
 promise_test(function(t) {
     return setup_environment(t).then(function() {
         return test_redirect(
@@ -216,16 +253,37 @@ promise_test(function(t) {
             SCOPE1 + 'sw=gen&url=' + encodeURIComponent(OUT_SCOPE),
             OUT_SCOPE,
             [[SCOPE1 + 'sw=gen&url=' + encodeURIComponent(OUT_SCOPE)], [], []]);
       });
   }, 'SW-generated redirect to same-origin out-scope.');
 promise_test(function(t) {
     return setup_environment(t).then(function() {
         return test_redirect(
+            SCOPE1 + 'sw=gen&url=' + encodeURIComponent(OUT_SCOPE) + '#ref',
+            OUT_SCOPE + '#ref',
+            [[SCOPE1 + 'sw=gen&url=' + encodeURIComponent(OUT_SCOPE) + '#ref'],
+              [], []]);
+      });
+  }, 'SW-generated redirect to same-origin out-scope with a hash fragment.');
+promise_test(function(t) {
+    return setup_environment(t).then(function() {
+        return test_redirect(
+            SCOPE1 + 'sw=gen&url=' + encodeURIComponent(OUT_SCOPE + '#ref2') +
+            '#ref',
+            OUT_SCOPE + '#ref2',
+            [[SCOPE1 + 'sw=gen&url=' + encodeURIComponent(OUT_SCOPE + '#ref2') +
+              '#ref'],
+             [], []]);
+      });
+  }, 'SW-generated redirect to same-origin out-scope with different hash' +
+     'fragments.');
+promise_test(function(t) {
+    return setup_environment(t).then(function() {
+        return test_redirect(
             SCOPE1 + 'sw=gen&url=' + encodeURIComponent(SCOPE1),
             SCOPE1,
             [[SCOPE1 + 'sw=gen&url=' + encodeURIComponent(SCOPE1), SCOPE1],
              [],
              []]);
       });
   }, 'SW-generated redirect to same-origin same-scope.');
 promise_test(function(t) {