Bug 1189581 - Make service-workers/service-worker/fetch-cors-xhr.https.html pass; r=bkelly
authorEhsan Akhgari <ehsan@mozilla.com>
Tue, 20 Oct 2015 09:41:49 -0400
changeset 268654 5d2eed6c293c08c000187d6751fd99b571d96b89
parent 268653 ea407fe50888b54de1ada0680017ac5dd6da7701
child 268655 4769c00a33aa43b4ec951bd58ec1cb20daf0bc8e
push id66896
push usereakhgari@mozilla.com
push dateWed, 21 Oct 2015 05:46:44 +0000
treeherdermozilla-inbound@da0a5c6ed61a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbkelly
bugs1189581
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 1189581 - Make service-workers/service-worker/fetch-cors-xhr.https.html pass; r=bkelly
testing/web-platform/mozilla/meta/service-workers/service-worker/fetch-cors-xhr.https.html.ini
testing/web-platform/mozilla/tests/service-workers/service-worker/fetch-cors-xhr.https.html
testing/web-platform/mozilla/tests/service-workers/service-worker/resources/fetch-cors-xhr-iframe.html
testing/web-platform/mozilla/tests/service-workers/service-worker/resources/test-helpers.sub.js
deleted file mode 100644
--- a/testing/web-platform/mozilla/meta/service-workers/service-worker/fetch-cors-xhr.https.html.ini
+++ /dev/null
@@ -1,6 +0,0 @@
-[fetch-cors-xhr.https.html]
-  type: testharness
-  expected: TIMEOUT
-  [Verify CORS XHR of fetch() in a Service Worker]
-    expected: TIMEOUT
-
--- a/testing/web-platform/mozilla/tests/service-workers/service-worker/fetch-cors-xhr.https.html
+++ b/testing/web-platform/mozilla/tests/service-workers/service-worker/fetch-cors-xhr.https.html
@@ -6,33 +6,33 @@
 <script src="resources/test-helpers.sub.js?pipe=sub"></script>
 <body>
 <script>
 async_test(function(t) {
     var SCOPE = 'resources/fetch-cors-xhr-iframe.html';
     var SCRIPT = 'resources/fetch-rewrite-worker.js';
     var host_info = get_host_info();
 
-    login(t)
+    login_https(t)
       .then(function() {
           return service_worker_unregister_and_register(t, SCRIPT, SCOPE);
         })
       .then(function(registration) {
           return wait_for_state(t, registration.installing, 'activated');
         })
       .then(function() { return with_iframe(SCOPE); })
       .then(function(frame) {
           return new Promise(function(resolve, reject) {
               var channel = new MessageChannel();
               channel.port1.onmessage = t.step_func(function(e) {
                   assert_equals(e.data.results, 'finish');
                   frame.remove();
                   service_worker_unregister_and_done(t, SCOPE);
                 });
               frame.contentWindow.postMessage({},
-                                              host_info['HTTP_ORIGIN'],
+                                              host_info['HTTPS_ORIGIN'],
                                               [channel.port2]);
             });
         })
       .catch(unreached_rejection(t));
   }, 'Verify CORS XHR of fetch() in a Service Worker');
 </script>
 </body>
--- a/testing/web-platform/mozilla/tests/service-workers/service-worker/resources/fetch-cors-xhr-iframe.html
+++ b/testing/web-platform/mozilla/tests/service-workers/service-worker/resources/fetch-cors-xhr-iframe.html
@@ -49,18 +49,18 @@ function create_serial_promise(test_case
           return create_test_promise(test_case[0], test_case[1], test_case[2]);
         });
     });
     return promise;
 }
 
 window.addEventListener('message', function(evt) {
     var port = evt.ports[0];
-    var url = host_info['HTTP_ORIGIN'] + path;
-    var remote_url = host_info['HTTP_REMOTE_ORIGIN'] + path;
+    var url = host_info['HTTPS_ORIGIN'] + path;
+    var remote_url = host_info['HTTPS_REMOTE_ORIGIN'] + path;
     // If the 4th value of the item of TEST_CASES is true, the test case outputs
     // warning messages. So such tests must be executed in serial to match the
     // expected output text.
     var TEST_CASES = [
       // Reject tests
       [url + '?reject', false, FAIL],
       [url + '?reject', true, FAIL],
       [remote_url + '?reject', false, FAIL],
@@ -71,43 +71,43 @@ window.addEventListener('message', funct
       [remote_url + '?resolve-null', false, FAIL],
       [remote_url + '?resolve-null', true, FAIL],
       // Fallback tests
       [url + '?ignore', false, SUCCESS],
       [url + '?ignore', true, SUCCESS],
       [remote_url + '?ignore', false, FAIL, true],  // Executed in serial.
       [remote_url + '?ignore', true, FAIL, true],  // Executed in serial.
       [
-        remote_url + '?ACAOrigin=' + host_info['HTTP_ORIGIN'] + '&ignore',
+        remote_url + '?ACAOrigin=' + host_info['HTTPS_ORIGIN'] + '&ignore',
         false, SUCCESS
       ],
       [
-        remote_url + '?ACAOrigin=' + host_info['HTTP_ORIGIN'] + '&ignore',
+        remote_url + '?ACAOrigin=' + host_info['HTTPS_ORIGIN'] + '&ignore',
         true, FAIL, true  // Executed in serial.
       ],
       [
-        remote_url + '?ACAOrigin=' + host_info['HTTP_ORIGIN'] +
+        remote_url + '?ACAOrigin=' + host_info['HTTPS_ORIGIN'] +
         '&ACACredentials=true&ignore',
         true, SUCCESS
       ],
       // Credential test (fallback)
       [url + '?Auth&ignore', false, SUCCESS],
       [url + '?Auth&ignore', true, SUCCESS],
       [remote_url + '?Auth&ignore', false, FAIL, true],  // Executed in serial.
       [remote_url + '?Auth&ignore', true, FAIL, true],  // Executed in serial.
       [
-        remote_url + '?Auth&ACAOrigin=' + host_info['HTTP_ORIGIN'] + '&ignore',
+        remote_url + '?Auth&ACAOrigin=' + host_info['HTTPS_ORIGIN'] + '&ignore',
         false, 'STATUS401'
       ],
       [
-        remote_url + '?Auth&ACAOrigin=' + host_info['HTTP_ORIGIN'] + '&ignore',
+        remote_url + '?Auth&ACAOrigin=' + host_info['HTTPS_ORIGIN'] + '&ignore',
         true, FAIL, true  // Executed in serial.
       ],
       [
-        remote_url + '?Auth&ACAOrigin=' + host_info['HTTP_ORIGIN'] +
+        remote_url + '?Auth&ACAOrigin=' + host_info['HTTPS_ORIGIN'] +
         '&ACACredentials=true&ignore',
         true, SUCCESS
       ],
       // Basic response
       [
         url + '?mode=same-origin&url=' + encodeURIComponent(url),
         false, SUCCESS
       ],
@@ -139,36 +139,51 @@ window.addEventListener('message', funct
       [
         remote_url + '?mode=no-cors&url=' + encodeURIComponent(remote_url),
         false, FAIL
       ],
       // CORS response
       [
         url + '?mode=cors&url=' +
         encodeURIComponent(remote_url + '?ACAOrigin=' +
-                           host_info['HTTP_ORIGIN']),
+                           host_info['HTTPS_ORIGIN']),
         false, SUCCESS
       ],
       [
         url + '?mode=cors&url=' +
         encodeURIComponent(remote_url + '?ACAOrigin=' +
-                           host_info['HTTP_ORIGIN']),
+                           host_info['HTTPS_ORIGIN']),
+        true, FAIL
+      ],
+      [
+        url + '?mode=cors&url=' +
+        encodeURIComponent(remote_url + '?ACAOrigin=' +
+                           host_info['HTTPS_ORIGIN'] +
+                           '&ACACredentials=true'),
         true, SUCCESS
       ],
       [
         remote_url + '?mode=cors&url=' +
         encodeURIComponent(remote_url + '?ACAOrigin=' +
-                           host_info['HTTP_ORIGIN']),
+                           host_info['HTTPS_ORIGIN']),
         false, SUCCESS
       ],
       [
         remote_url +
         '?mode=cors&url=' +
         encodeURIComponent(remote_url + '?ACAOrigin=' +
-                           host_info['HTTP_ORIGIN']),
+                           host_info['HTTPS_ORIGIN']),
+        true, FAIL
+      ],
+      [
+        remote_url +
+        '?mode=cors&url=' +
+        encodeURIComponent(remote_url + '?ACAOrigin=' +
+                           host_info['HTTPS_ORIGIN'] +
+                           '&ACACredentials=true'),
         true, SUCCESS
       ]
     ];
     var promises = [];
     var serial_tests = [];
     for (var i = 0; i < TEST_CASES.length ; ++i) {
       if (!TEST_CASES[i][3]) {
         promises.push(create_test_promise(TEST_CASES[i][0],
--- a/testing/web-platform/mozilla/tests/service-workers/service-worker/resources/test-helpers.sub.js
+++ b/testing/web-platform/mozilla/tests/service-workers/service-worker/resources/test-helpers.sub.js
@@ -161,40 +161,40 @@ function service_worker_test(url, descri
 
 function base_path() {
   return location.pathname.replace(/\/[^\/]*$/, '/');
 }
 
 function test_login(test, origin, username, password, cookie) {
   return new Promise(function(resolve, reject) {
       with_iframe(
-        origin +
-        '/service-worker/resources/fetch-access-control-login.html')
+        origin + base_path() +
+        'resources/fetch-access-control-login.html')
         .then(test.step_func(function(frame) {
             var channel = new MessageChannel();
             channel.port1.onmessage = test.step_func(function() {
                 frame.remove();
                 resolve();
               });
             frame.contentWindow.postMessage(
               {username: username, password: password, cookie: cookie},
               origin, [channel.port2]);
           }));
     });
 }
 
 function login(test) {
-  return test_login(test, 'http://{{domains[www]}}:{{ports[http][0]}}',
+  return test_login(test, 'http://{{domains[www1]}}:{{ports[http][0]}}',
                     'username1', 'password1', 'cookie1')
     .then(function() {
         return test_login(test, 'http://{{host}}:{{ports[http][0]}}',
                           'username2', 'password2', 'cookie2');
       });
 }
 
 function login_https(test) {
-  return test_login(test, 'https://{{domains[www]}}:8443',
+  return test_login(test, 'https://{{domains[www1]}}:{{ports[https][0]}}',
                     'username1s', 'password1s', 'cookie1')
     .then(function() {
-        return test_login(test, 'https://{{host}}:8443',
+        return test_login(test, 'https://{{host}}:{{ports[https][0]}}',
                           'username2s', 'password2s', 'cookie2');
       });
 }