diff --git a/testing/web-platform/meta/MANIFEST.json b/testing/web-platform/meta/MANIFEST.json index 1f3b1d561143..f887e036b80a 100644 --- a/testing/web-platform/meta/MANIFEST.json +++ b/testing/web-platform/meta/MANIFEST.json @@ -16009,6 +16009,10 @@ "path": "fetch/api/basic/accept-header.html", "url": "/fetch/api/basic/accept-header.html" }, + { + "path": "fetch/api/basic/integrity-sharedworker.html", + "url": "/fetch/api/basic/integrity-sharedworker.html" + }, { "path": "fetch/api/basic/integrity-worker.html", "url": "/fetch/api/basic/integrity-worker.html" diff --git a/testing/web-platform/meta/fetch/api/basic/integrity-worker.html.ini b/testing/web-platform/meta/fetch/api/basic/integrity-worker.html.ini deleted file mode 100644 index ac2c3309cd93..000000000000 --- a/testing/web-platform/meta/fetch/api/basic/integrity-worker.html.ini +++ /dev/null @@ -1,14 +0,0 @@ -[integrity-worker.html] - type: testharness - [Invalid integrity] - expected: FAIL - - [Multiple integrities: invalid stronger than valid] - expected: FAIL - - [Multiple integrities: both are invalid] - expected: FAIL - - [CORS invalid integrity] - expected: FAIL - diff --git a/testing/web-platform/meta/fetch/api/basic/integrity.html.ini b/testing/web-platform/meta/fetch/api/basic/integrity.html.ini deleted file mode 100644 index caefc524dc19..000000000000 --- a/testing/web-platform/meta/fetch/api/basic/integrity.html.ini +++ /dev/null @@ -1,14 +0,0 @@ -[integrity.html] - type: testharness - [Invalid integrity] - expected: FAIL - - [Multiple integrities: invalid stronger than valid] - expected: FAIL - - [Multiple integrities: both are invalid] - expected: FAIL - - [CORS invalid integrity] - expected: FAIL - diff --git a/testing/web-platform/meta/fetch/api/request/request-clone.sub.html.ini b/testing/web-platform/meta/fetch/api/request/request-clone.sub.html.ini deleted file mode 100644 index 9f670c672e08..000000000000 --- a/testing/web-platform/meta/fetch/api/request/request-clone.sub.html.ini +++ /dev/null @@ -1,5 +0,0 @@ -[request-clone.sub.html] - type: testharness - [Check cloning a request] - expected: FAIL - diff --git a/testing/web-platform/meta/fetch/api/request/request-error.html.ini b/testing/web-platform/meta/fetch/api/request/request-error.html.ini index 7c9b0cf8a096..fc4710461677 100644 --- a/testing/web-platform/meta/fetch/api/request/request-error.html.ini +++ b/testing/web-platform/meta/fetch/api/request/request-error.html.ini @@ -3,6 +3,3 @@ [RequestInit's window is not null] expected: FAIL - [RequestInit's mode is no-cors and integrity is not empty] - expected: FAIL - diff --git a/testing/web-platform/meta/fetch/api/request/request-idl.html.ini b/testing/web-platform/meta/fetch/api/request/request-idl.html.ini index bfcf39dbe45d..4eb207662240 100644 --- a/testing/web-platform/meta/fetch/api/request/request-idl.html.ini +++ b/testing/web-platform/meta/fetch/api/request/request-idl.html.ini @@ -6,15 +6,9 @@ [Request interface: attribute destination] expected: FAIL - [Request interface: attribute integrity] - expected: FAIL - [Request interface: new Request("") must inherit property "type" with the proper type (3)] expected: FAIL [Request interface: new Request("") must inherit property "destination" with the proper type (4)] expected: FAIL - [Request interface: new Request("") must inherit property "integrity" with the proper type (11)] - expected: FAIL - diff --git a/testing/web-platform/meta/fetch/api/request/request-init-001.sub.html.ini b/testing/web-platform/meta/fetch/api/request/request-init-001.sub.html.ini deleted file mode 100644 index 1efcdfaf493b..000000000000 --- a/testing/web-platform/meta/fetch/api/request/request-init-001.sub.html.ini +++ /dev/null @@ -1,8 +0,0 @@ -[request-init-001.sub.html] - type: testharness - [Check integrity init value of and associated getter] - expected: FAIL - - [Check integrity init value of AZERTYUIOP1234567890 and associated getter] - expected: FAIL - diff --git a/testing/web-platform/meta/fetch/api/request/request-init-003.sub.html.ini b/testing/web-platform/meta/fetch/api/request/request-init-003.sub.html.ini index e5e3d9856c64..afd15ff271a9 100644 --- a/testing/web-platform/meta/fetch/api/request/request-init-003.sub.html.ini +++ b/testing/web-platform/meta/fetch/api/request/request-init-003.sub.html.ini @@ -1,11 +1,5 @@ [request-init-003.sub.html] type: testharness - [Check request values when initialized from Request] - expected: FAIL - - [Check request values when initialized from Request and init values] - expected: FAIL - [Check request values when initialized from url string] expected: FAIL diff --git a/testing/web-platform/meta/fetch/api/request/request-structure.html.ini b/testing/web-platform/meta/fetch/api/request/request-structure.html.ini index 1764b2e7d5f0..876cd71fbfa4 100644 --- a/testing/web-platform/meta/fetch/api/request/request-structure.html.ini +++ b/testing/web-platform/meta/fetch/api/request/request-structure.html.ini @@ -6,6 +6,3 @@ [Check destination attribute] expected: FAIL - [Check integrity attribute] - expected: FAIL - diff --git a/testing/web-platform/tests/fetch/api/basic/integrity-sharedworker.html b/testing/web-platform/tests/fetch/api/basic/integrity-sharedworker.html new file mode 100644 index 000000000000..fa90a60ce982 --- /dev/null +++ b/testing/web-platform/tests/fetch/api/basic/integrity-sharedworker.html @@ -0,0 +1,15 @@ + + + + + Fetch in sharedworker: integrity handling + + + + + + + + diff --git a/testing/web-platform/tests/service-workers/service-worker/fetch-event.https.html b/testing/web-platform/tests/service-workers/service-worker/fetch-event.https.html index b7eda16494a1..a9b0d6ca286e 100644 --- a/testing/web-platform/tests/service-workers/service-worker/fetch-event.https.html +++ b/testing/web-platform/tests/service-workers/service-worker/fetch-event.https.html @@ -533,5 +533,44 @@ async_test(function(t) { .catch(unreached_rejection(t)); }, 'Service Worker should intercept EventSource'); +async_test(function(t) { + var scope = 'resources/simple.html?integrity'; + var frame; + var integrity_metadata = 'gs0nqru8KbsrIt5YToQqS9fYao4GQJXtcId610g7cCU='; + + service_worker_unregister_and_register(t, worker, scope) + .then(function(reg) { + return wait_for_state(t, reg.installing, 'activated'); + }) + .then(function() { return with_iframe(scope); }) + .then(function(f) { + frame = f; + // A request has associated integrity metadata (a string). + // Unless stated otherwise, it is the empty string. + assert_equals( + frame.contentDocument.body.textContent, ''); + + return new Promise(function(resolve, reject) { + return frame.contentWindow.fetch(scope, + {'integrity': integrity_metadata}) + .then(function(response) { + return response.text(); + }) + .then(function(response_text) { + // Should get the same integrity metadata. + assert_equals(response_text, integrity_metadata, + 'Service Worker should respond to fetch with the correct integrity'); + }) + .then(resolve()) + .catch(reject()); + }); + }) + .then(function() { + frame.remove(); + return service_worker_unregister_and_done(t, scope); + }) + .catch(unreached_rejection(t)); + }, 'Service Worker responds to fetch event with the correct integrity_metadata'); + diff --git a/testing/web-platform/tests/service-workers/service-worker/resources/fetch-event-test-worker.js b/testing/web-platform/tests/service-workers/service-worker/resources/fetch-event-test-worker.js index 44ea828c6860..32a1b4f24970 100644 --- a/testing/web-platform/tests/service-workers/service-worker/resources/fetch-event-test-worker.js +++ b/testing/web-platform/tests/service-workers/service-worker/resources/fetch-event-test-worker.js @@ -111,6 +111,10 @@ function handleEventSource(event) { )); } +function handleIntegrity(event) { + event.respondWith(new Response(event.request.integrity)); +} + self.addEventListener('fetch', function(event) { var url = event.request.url; var handlers = [ @@ -129,6 +133,7 @@ self.addEventListener('fetch', function(event) { { pattern: '?fragment-check', fn: handleFragmentCheck }, { pattern: '?cache', fn: handleCache }, { pattern: '?eventsource', fn: handleEventSource }, + { pattern: '?integrity', fn: handleIntegrity }, ]; var handler = null;