From c68bfd1bc3ff1f810ff62c21bc44261b913b3ba0 Mon Sep 17 00:00:00 2001 From: Nikhil Marathe Date: Thu, 10 Sep 2015 16:45:54 -0700 Subject: [PATCH] Bug 1189656 - Fix fetch-request-fallback test paths. r=bkelly Update web-platform-tests expected data --HG-- extra : commitid : 66I37Isc5zz extra : rebase_source : dbef1623c5f8f3c0304c7f6eca0deef28ccb6604 --- .../fetch-request-fallback.https.html.ini | 6 ------ .../fetch-request-fallback.https.html | 21 ++++++++++--------- .../fetch-request-fallback-worker.js | 1 + 3 files changed, 12 insertions(+), 16 deletions(-) delete mode 100644 testing/web-platform/mozilla/meta/service-workers/service-worker/fetch-request-fallback.https.html.ini diff --git a/testing/web-platform/mozilla/meta/service-workers/service-worker/fetch-request-fallback.https.html.ini b/testing/web-platform/mozilla/meta/service-workers/service-worker/fetch-request-fallback.https.html.ini deleted file mode 100644 index 806dcfabb53d..000000000000 --- a/testing/web-platform/mozilla/meta/service-workers/service-worker/fetch-request-fallback.https.html.ini +++ /dev/null @@ -1,6 +0,0 @@ -[fetch-request-fallback.https.html] - type: testharness - expected: TIMEOUT - [Verify the fallback behavior of FetchEvent] - expected: TIMEOUT - diff --git a/testing/web-platform/mozilla/tests/service-workers/service-worker/fetch-request-fallback.https.html b/testing/web-platform/mozilla/tests/service-workers/service-worker/fetch-request-fallback.https.html index 41c120a37917..7420b831434a 100644 --- a/testing/web-platform/mozilla/tests/service-workers/service-worker/fetch-request-fallback.https.html +++ b/testing/web-platform/mozilla/tests/service-workers/service-worker/fetch-request-fallback.https.html @@ -12,7 +12,7 @@ function xhr_fail_test(frame, url) { return new Promise(function(resolve, reject) { frame.contentWindow.xhr(url) .then(function(){ - reject(msg + ' should fail.'); + reject(url + ' should fail.'); }) .catch(function(){ resolve(); @@ -28,21 +28,22 @@ function xhr_succeed_test(frame, url) { resolve(); }) .catch(function(){ - reject(msg + ' should succeed.'); + reject(url + ' should succeed.'); }); }); } async_test(function(t) { + var path = new URL(".", window.location).pathname; var SCOPE = 'resources/fetch-request-fallback-iframe.html'; var SCRIPT = 'resources/fetch-request-fallback-worker.js'; var host_info = get_host_info(); - var BASE_URL = host_info['HTTP_ORIGIN'] + - '/service-worker/resources/fetch-access-control.py?'; - var OTHER_BASE_URL = host_info['HTTP_REMOTE_ORIGIN'] + - '/service-worker/resources/fetch-access-control.py?'; - var REDIRECT_URL = host_info['HTTP_ORIGIN'] + - '/service-worker/resources/redirect.py?Redirect='; + var BASE_URL = host_info['HTTPS_ORIGIN'] + + path + 'resources/fetch-access-control.py?'; + var OTHER_BASE_URL = host_info['HTTPS_REMOTE_ORIGIN'] + + path + 'resources/fetch-access-control.py?'; + var REDIRECT_URL = host_info['HTTPS_ORIGIN'] + + path + 'resources/redirect.py?Redirect='; var frame; var worker; service_worker_unregister_and_register(t, SCRIPT, SCOPE) @@ -94,9 +95,9 @@ async_test(function(t) { assert_equals(requests[0].url, new URL(SCOPE, location).toString(), 'The first request to the SW must be the request for ' + 'the page.'); - assert_equals(requests[0].mode, 'no-cors', + assert_equals(requests[0].mode, 'same-origin', 'The mode of the first request to the SW must be ' + - 'no-cors.'); + 'same-origin'); for (var i = 0; i < expected_urls.length; ++i) { assert_equals(requests[i + 1].url, expected_urls[i], 'The URL of the request which was passed from XHR ' + diff --git a/testing/web-platform/mozilla/tests/service-workers/service-worker/resources/fetch-request-fallback-worker.js b/testing/web-platform/mozilla/tests/service-workers/service-worker/resources/fetch-request-fallback-worker.js index 0e12911d4221..3b028b24bde4 100644 --- a/testing/web-platform/mozilla/tests/service-workers/service-worker/resources/fetch-request-fallback-worker.js +++ b/testing/web-platform/mozilla/tests/service-workers/service-worker/resources/fetch-request-fallback-worker.js @@ -2,6 +2,7 @@ var requests = []; self.addEventListener('message', function(event) { event.data.port.postMessage({requests: requests}); + requests = []; }); self.addEventListener('fetch', function(event) {