Re-sync Service Workers web-platform-tests from upstream
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 4 Dec 2017 02:15:09 +0000 (02:15 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 4 Dec 2017 02:15:09 +0000 (02:15 +0000)
https://bugs.webkit.org/show_bug.cgi?id=180336

Reviewed by Darin Adler.

LayoutTests/imported/w3c:

Re-sync Service Workers web-platform-tests from upstream 6df98083a2be.

* web-platform-tests/service-workers/service-worker/ServiceWorkerGlobalScope/resources/unregister-controlling-worker.html: Added.
* web-platform-tests/service-workers/service-worker/about-blank-replacement.https-expected.txt: Added.
* web-platform-tests/service-workers/service-worker/about-blank-replacement.https.html: Added.
* web-platform-tests/service-workers/service-worker/activation.https.html:
* web-platform-tests/service-workers/service-worker/fetch-canvas-tainting.https-expected.txt:
* web-platform-tests/service-workers/service-worker/fetch-event-respond-with-partial-stream.https-expected.txt: Added.
* web-platform-tests/service-workers/service-worker/fetch-event-respond-with-partial-stream.https.html: Added.
* web-platform-tests/service-workers/service-worker/fetch-event.https-expected.txt:
* web-platform-tests/service-workers/service-worker/foreign-fetch-basics.https-expected.txt: Removed.
* web-platform-tests/service-workers/service-worker/foreign-fetch-basics.https.html: Removed.
* web-platform-tests/service-workers/service-worker/foreign-fetch-cors.https-expected.txt: Removed.
* web-platform-tests/service-workers/service-worker/foreign-fetch-cors.https.html: Removed.
* web-platform-tests/service-workers/service-worker/foreign-fetch-event.https-expected.txt: Removed.
* web-platform-tests/service-workers/service-worker/foreign-fetch-event.https.html: Removed.
* web-platform-tests/service-workers/service-worker/foreign-fetch-workers.https-expected.txt: Removed.
* web-platform-tests/service-workers/service-worker/foreign-fetch-workers.https.html: Removed.
* web-platform-tests/service-workers/service-worker/iframe-sandbox-register-link-element.https-expected.txt: Removed.
* web-platform-tests/service-workers/service-worker/iframe-sandbox-register-link-element.https.html: Removed.
* web-platform-tests/service-workers/service-worker/interfaces-window.https-expected.txt:
* web-platform-tests/service-workers/service-worker/link-element-register-basic.https-expected.txt: Removed.
* web-platform-tests/service-workers/service-worker/link-element-register-basic.https.html: Removed.
* web-platform-tests/service-workers/service-worker/link-element-register-mime-types.https-expected.txt: Removed.
* web-platform-tests/service-workers/service-worker/link-element-register-mime-types.https.html: Removed.
* web-platform-tests/service-workers/service-worker/link-element-register-scope.https-expected.txt: Removed.
* web-platform-tests/service-workers/service-worker/link-element-register-scope.https.html: Removed.
* web-platform-tests/service-workers/service-worker/link-element-register-script-url.https-expected.txt: Removed.
* web-platform-tests/service-workers/service-worker/link-element-register-script-url.https.html: Removed.
* web-platform-tests/service-workers/service-worker/link-element-register-script.https-expected.txt: Removed.
* web-platform-tests/service-workers/service-worker/link-element-register-script.https.html: Removed.
* web-platform-tests/service-workers/service-worker/link-element-register-security-error.https-expected.txt: Removed.
* web-platform-tests/service-workers/service-worker/link-element-register-security-error.https.html: Removed.
* web-platform-tests/service-workers/service-worker/navigation-preload/empty-preload-response-body.https-expected.txt:
* web-platform-tests/service-workers/service-worker/navigation-preload/resources/empty-preload-response-body-scope.html: Added.
* web-platform-tests/service-workers/service-worker/register-foreign-fetch-errors.https-expected.txt: Removed.
* web-platform-tests/service-workers/service-worker/register-foreign-fetch-errors.https.html: Removed.
* web-platform-tests/service-workers/service-worker/register-link-header.https-expected.txt: Removed.
* web-platform-tests/service-workers/service-worker/register-link-header.https.html: Removed.
* web-platform-tests/service-workers/service-worker/registration-iframe.https.html:
* web-platform-tests/service-workers/service-worker/registration-updateviacache.https-expected.txt:
* web-platform-tests/service-workers/service-worker/registration-updateviacache.https.html:
* web-platform-tests/service-workers/service-worker/resource-timing.https-expected.txt:
* web-platform-tests/service-workers/service-worker/resource-timing.https.html:
* web-platform-tests/service-workers/service-worker/resources/about-blank-replacement-frame.py: Added.
(main):
* web-platform-tests/service-workers/service-worker/resources/about-blank-replacement-ping-frame.py: Added.
(main):
* web-platform-tests/service-workers/service-worker/resources/about-blank-replacement-popup-frame.py: Added.
(main):
* web-platform-tests/service-workers/service-worker/resources/about-blank-replacement-uncontrolled-nested-frame.html: Added.
* web-platform-tests/service-workers/service-worker/resources/about-blank-replacement-worker.js: Added.
(async.getClientByURL):
(async.pingPong.waitForPong.return.new.Promise):
(async.pingPong.waitForPong):
(async.pingPong):
(async.evt.url.searchParams):
(async.evt.evt.respondWith.async):
(evt.evt.waitUntil.async):
* web-platform-tests/service-workers/service-worker/resources/clients-get-worker.js:
(self.onfetch):
* web-platform-tests/service-workers/service-worker/resources/empty.js: Added.
* web-platform-tests/service-workers/service-worker/resources/fetch-event-respond-with-partial-stream-worker.js: Added.
(evt.evt.request.url.includes):
* web-platform-tests/service-workers/service-worker/resources/fetch-event-test-worker.js:
(handleClientId):
* web-platform-tests/service-workers/service-worker/resources/foreign-fetch-cors-worker.js: Removed.
* web-platform-tests/service-workers/service-worker/resources/foreign-fetch-event-worker.js: Removed.
* web-platform-tests/service-workers/service-worker/resources/foreign-fetch-helper-iframe.html: Removed.
* web-platform-tests/service-workers/service-worker/resources/foreign-fetch-helper-script.js: Removed.
* web-platform-tests/service-workers/service-worker/resources/foreign-fetch-helper-worker.js: Removed.
* web-platform-tests/service-workers/service-worker/resources/foreign-fetch-helpers.js: Removed.
* web-platform-tests/service-workers/service-worker/resources/foreign-fetch-worker.js: Removed.
* web-platform-tests/service-workers/service-worker/resources/iframe-register-link-element.html: Removed.
* web-platform-tests/service-workers/service-worker/resources/install-worker-helper.html: Removed.
* web-platform-tests/service-workers/service-worker/resources/interfaces-idls.js:
* web-platform-tests/service-workers/service-worker/resources/link-header.py: Removed.
* web-platform-tests/service-workers/service-worker/resources/register-foreign-fetch-errors-worker.js: Removed.
* web-platform-tests/service-workers/service-worker/resources/resource-timing-iframe.sub.html: Renamed from LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/resource-timing-iframe.html.
* web-platform-tests/service-workers/service-worker/resources/sandboxed-iframe-fetch-event-iframe.html: Added.
* web-platform-tests/service-workers/service-worker/resources/sandboxed-iframe-fetch-event-worker.js: Added.
(event.waitUntil.self.clients.matchAll.then):
* web-platform-tests/service-workers/service-worker/resources/sandboxed-iframe-navigator-serviceworker-iframe.html: Added.
* web-platform-tests/service-workers/service-worker/resources/test-helpers.sub.js:
* web-platform-tests/service-workers/service-worker/resources/w3c-import.log:
* web-platform-tests/service-workers/service-worker/sandboxed-iframe-fetch-event.https-expected.txt: Added.
* web-platform-tests/service-workers/service-worker/sandboxed-iframe-fetch-event.https.html: Added.
* web-platform-tests/service-workers/service-worker/sandboxed-iframe-navigator-serviceworker.https-expected.txt: Added.
* web-platform-tests/service-workers/service-worker/sandboxed-iframe-navigator-serviceworker.https.html: Added.
* web-platform-tests/service-workers/service-worker/service-worker-csp-connect.https-expected.txt:
* web-platform-tests/service-workers/service-worker/service-worker-csp-default.https-expected.txt:
* web-platform-tests/service-workers/service-worker/service-worker-csp-script.https-expected.txt:
* web-platform-tests/service-workers/service-worker/w3c-import.log:

LayoutTests:

Skip new tests that are timing out and remove entries for tests
that were removed.

* TestExpectations:
* tests-options.json:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@225467 268f45cc-cd09-0410-ab3c-d52691b4dbfc

72 files changed:
LayoutTests/ChangeLog
LayoutTests/TestExpectations
LayoutTests/imported/w3c/ChangeLog
LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/about-blank-replacement.https-expected.txt [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/about-blank-replacement.https.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-canvas-tainting.https-expected.txt
LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-event-respond-with-partial-stream.https-expected.txt [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-event-respond-with-partial-stream.https.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/foreign-fetch-basics.https-expected.txt [deleted file]
LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/foreign-fetch-basics.https.html [deleted file]
LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/foreign-fetch-cors.https-expected.txt [deleted file]
LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/foreign-fetch-cors.https.html [deleted file]
LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/foreign-fetch-event.https-expected.txt [deleted file]
LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/foreign-fetch-event.https.html [deleted file]
LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/foreign-fetch-workers.https-expected.txt [deleted file]
LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/foreign-fetch-workers.https.html [deleted file]
LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/iframe-sandbox-register-link-element.https-expected.txt [deleted file]
LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/iframe-sandbox-register-link-element.https.html [deleted file]
LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/interfaces-window.https-expected.txt
LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/link-element-register-basic.https-expected.txt [deleted file]
LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/link-element-register-basic.https.html [deleted file]
LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/link-element-register-mime-types.https-expected.txt [deleted file]
LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/link-element-register-mime-types.https.html [deleted file]
LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/link-element-register-scope.https-expected.txt [deleted file]
LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/link-element-register-scope.https.html [deleted file]
LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/link-element-register-script-url.https-expected.txt [deleted file]
LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/link-element-register-script-url.https.html [deleted file]
LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/link-element-register-script.https-expected.txt [deleted file]
LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/link-element-register-script.https.html [deleted file]
LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/link-element-register-security-error.https-expected.txt [deleted file]
LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/link-element-register-security-error.https.html [deleted file]
LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/register-foreign-fetch-errors.https-expected.txt [deleted file]
LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/register-foreign-fetch-errors.https.html [deleted file]
LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/register-link-header.https-expected.txt [deleted file]
LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/register-link-header.https.html [deleted file]
LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/registration-updateviacache.https-expected.txt
LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/registration-updateviacache.https.html
LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resource-timing.https-expected.txt
LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resource-timing.https.html
LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/about-blank-replacement-frame.py [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/about-blank-replacement-ping-frame.py [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/about-blank-replacement-popup-frame.py [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/about-blank-replacement-uncontrolled-nested-frame.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/about-blank-replacement-worker.js [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/fetch-event-respond-with-partial-stream-worker.js [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/foreign-fetch-cors-worker.js [deleted file]
LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/foreign-fetch-event-worker.js [deleted file]
LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/foreign-fetch-helper-iframe.html [deleted file]
LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/foreign-fetch-helper-script.js [deleted file]
LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/foreign-fetch-helper-worker.js [deleted file]
LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/foreign-fetch-helpers.js [deleted file]
LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/foreign-fetch-worker.js [deleted file]
LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/iframe-register-link-element.html [deleted file]
LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/install-worker-helper.html [deleted file]
LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/interfaces-idls.js
LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/link-header.py [deleted file]
LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/register-foreign-fetch-errors-worker.js [deleted file]
LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/resource-timing-iframe.sub.html [moved from LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/resource-timing-iframe.html with 50% similarity]
LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/sandboxed-iframe-fetch-event-iframe.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/sandboxed-iframe-fetch-event-worker.js [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/sandboxed-iframe-navigator-serviceworker-iframe.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/test-helpers.sub.js
LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/w3c-import.log
LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/sandboxed-iframe-fetch-event.https-expected.txt [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/sandboxed-iframe-fetch-event.https.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/sandboxed-iframe-navigator-serviceworker.https-expected.txt [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/sandboxed-iframe-navigator-serviceworker.https.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/service-worker-csp-connect.https-expected.txt
LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/service-worker-csp-default.https-expected.txt
LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/service-worker-csp-script.https-expected.txt
LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/w3c-import.log
LayoutTests/tests-options.json

index 23789ce..7835aba 100644 (file)
@@ -1,5 +1,18 @@
 2017-12-03  Chris Dumez  <cdumez@apple.com>
 
+        Re-sync Service Workers web-platform-tests from upstream
+        https://bugs.webkit.org/show_bug.cgi?id=180336
+
+        Reviewed by Darin Adler.
+
+        Skip new tests that are timing out and remove entries for tests
+        that were removed.
+
+        * TestExpectations:
+        * tests-options.json:
+
+2017-12-03  Chris Dumez  <cdumez@apple.com>
+
         Unreviewed, mark imported/w3c/web-platform-tests/service-workers/service-worker/registration-service-worker-attributes.https.html as flaky
 
         * TestExpectations:
index 19a7237..0aee6e7 100644 (file)
@@ -147,18 +147,9 @@ imported/w3c/web-platform-tests/secure-contexts/shared-worker-secure-first.https
 imported/w3c/web-platform-tests/fetch/api/abort/general-serviceworker.https.html [ Skip ]
 imported/w3c/web-platform-tests/service-workers/service-worker/detached-context.https.html [ Skip ]
 imported/w3c/web-platform-tests/service-workers/service-worker/extendable-event-waituntil.https.html [ Skip ]
-imported/w3c/web-platform-tests/service-workers/service-worker/foreign-fetch-basics.https.html [ Skip ]
-imported/w3c/web-platform-tests/service-workers/service-worker/foreign-fetch-event.https.html [ Skip ]
-imported/w3c/web-platform-tests/service-workers/service-worker/foreign-fetch-workers.https.html [ Skip ]
+imported/w3c/web-platform-tests/service-workers/service-worker/fetch-event-respond-with-partial-stream.https.html [ Skip ]
 imported/w3c/web-platform-tests/service-workers/service-worker/http-to-https-redirect-and-register.https.html [ Skip ]
-imported/w3c/web-platform-tests/service-workers/service-worker/iframe-sandbox-register-link-element.https.html [ Skip ]
 imported/w3c/web-platform-tests/service-workers/service-worker/interfaces-sw.https.html [ Skip ]
-imported/w3c/web-platform-tests/service-workers/service-worker/link-element-register-basic.https.html [ Skip ]
-imported/w3c/web-platform-tests/service-workers/service-worker/link-element-register-mime-types.https.html [ Skip ]
-imported/w3c/web-platform-tests/service-workers/service-worker/link-element-register-scope.https.html [ Skip ]
-imported/w3c/web-platform-tests/service-workers/service-worker/link-element-register-script-url.https.html [ Skip ]
-imported/w3c/web-platform-tests/service-workers/service-worker/link-element-register-script.https.html [ Skip ]
-imported/w3c/web-platform-tests/service-workers/service-worker/link-element-register-security-error.https.html [ Skip ]
 imported/w3c/web-platform-tests/service-workers/service-worker/navigation-preload/broken-chunked-encoding.https.html [ Skip ]
 imported/w3c/web-platform-tests/service-workers/service-worker/navigation-preload/chunked-encoding.https.html [ Skip ]
 imported/w3c/web-platform-tests/service-workers/service-worker/navigation-preload/get-state.https.html [ Skip ]
@@ -167,9 +158,9 @@ imported/w3c/web-platform-tests/service-workers/service-worker/navigation-preloa
 imported/w3c/web-platform-tests/service-workers/service-worker/navigation-redirect.https.html [ Skip ]
 imported/w3c/web-platform-tests/service-workers/service-worker/postmessage.https.html [ Skip ]
 imported/w3c/web-platform-tests/service-workers/service-worker/postmessage-msgport-to-client.https.html [ Skip ]
-imported/w3c/web-platform-tests/service-workers/service-worker/register-foreign-fetch-errors.https.html [ Skip ]
 webkit.org/b/179452 imported/w3c/web-platform-tests/service-workers/service-worker/register-same-scope-different-script-url.https.html [ Skip ]
 imported/w3c/web-platform-tests/service-workers/service-worker/respond-with-body-accessed-response.https.html [ Skip ]
+imported/w3c/web-platform-tests/service-workers/service-worker/sandboxed-iframe-fetch-event.https.html [ Skip ]
 imported/w3c/web-platform-tests/service-workers/service-worker/skip-waiting-using-registration.https.html [ Skip ]
 imported/w3c/web-platform-tests/service-workers/service-worker/unregister-then-register-new-script.https.html [ Skip ]
 imported/w3c/web-platform-tests/service-workers/service-worker/update-after-navigation-fetch-event.https.html [ Skip ]
@@ -179,13 +170,13 @@ imported/w3c/web-platform-tests/service-workers/service-worker/websocket-in-serv
 imported/w3c/web-platform-tests/service-workers/service-worker/client-navigate.https.html [ Skip ]
 
 http/tests/workers/service/service-worker-cache-api.https.html [ Pass Failure ]
+imported/w3c/web-platform-tests/service-workers/service-worker/about-blank-replacement.https.html [ Pass Failure ]
 webkit.org/b/179137 imported/w3c/web-platform-tests/service-workers/cache-storage/serviceworker/cache-match.https.html [ Pass Failure ]
 imported/w3c/web-platform-tests/service-workers/service-worker/fetch-event.https.html [ Pass Failure ]
 webkit.org/b/179248 imported/w3c/web-platform-tests/service-workers/service-worker/fetch-event-within-sw.https.html [ Pass Failure ]
 imported/w3c/web-platform-tests/service-workers/service-worker/fetch-event-respond-with-response-body-with-invalid-chunk.https.html [ Pass Failure ]
 imported/w3c/web-platform-tests/service-workers/service-worker/fetch-request-redirect.https.html [ Pass Failure Timeout ]
 imported/w3c/web-platform-tests/service-workers/service-worker/fetch-request-xhr.https.html [ Pass Failure ]
-imported/w3c/web-platform-tests/service-workers/service-worker/foreign-fetch-cors.https.html [ Pass Failure ]
 imported/w3c/web-platform-tests/service-workers/service-worker/multiple-update.https.html [ Pass Failure ]
 imported/w3c/web-platform-tests/service-workers/service-worker/performance-timeline.https.html [ Pass Failure ]
 webkit.org/b/179194 imported/w3c/web-platform-tests/service-workers/service-worker/registration-mime-types.https.html [ Pass Failure ]
index f02f85d..9b7342a 100644 (file)
@@ -1,5 +1,106 @@
 2017-12-03  Chris Dumez  <cdumez@apple.com>
 
+        Re-sync Service Workers web-platform-tests from upstream
+        https://bugs.webkit.org/show_bug.cgi?id=180336
+
+        Reviewed by Darin Adler.
+
+        Re-sync Service Workers web-platform-tests from upstream 6df98083a2be.
+
+        * web-platform-tests/service-workers/service-worker/ServiceWorkerGlobalScope/resources/unregister-controlling-worker.html: Added.
+        * web-platform-tests/service-workers/service-worker/about-blank-replacement.https-expected.txt: Added.
+        * web-platform-tests/service-workers/service-worker/about-blank-replacement.https.html: Added.
+        * web-platform-tests/service-workers/service-worker/activation.https.html:
+        * web-platform-tests/service-workers/service-worker/fetch-canvas-tainting.https-expected.txt:
+        * web-platform-tests/service-workers/service-worker/fetch-event-respond-with-partial-stream.https-expected.txt: Added.
+        * web-platform-tests/service-workers/service-worker/fetch-event-respond-with-partial-stream.https.html: Added.
+        * web-platform-tests/service-workers/service-worker/fetch-event.https-expected.txt:
+        * web-platform-tests/service-workers/service-worker/foreign-fetch-basics.https-expected.txt: Removed.
+        * web-platform-tests/service-workers/service-worker/foreign-fetch-basics.https.html: Removed.
+        * web-platform-tests/service-workers/service-worker/foreign-fetch-cors.https-expected.txt: Removed.
+        * web-platform-tests/service-workers/service-worker/foreign-fetch-cors.https.html: Removed.
+        * web-platform-tests/service-workers/service-worker/foreign-fetch-event.https-expected.txt: Removed.
+        * web-platform-tests/service-workers/service-worker/foreign-fetch-event.https.html: Removed.
+        * web-platform-tests/service-workers/service-worker/foreign-fetch-workers.https-expected.txt: Removed.
+        * web-platform-tests/service-workers/service-worker/foreign-fetch-workers.https.html: Removed.
+        * web-platform-tests/service-workers/service-worker/iframe-sandbox-register-link-element.https-expected.txt: Removed.
+        * web-platform-tests/service-workers/service-worker/iframe-sandbox-register-link-element.https.html: Removed.
+        * web-platform-tests/service-workers/service-worker/interfaces-window.https-expected.txt:
+        * web-platform-tests/service-workers/service-worker/link-element-register-basic.https-expected.txt: Removed.
+        * web-platform-tests/service-workers/service-worker/link-element-register-basic.https.html: Removed.
+        * web-platform-tests/service-workers/service-worker/link-element-register-mime-types.https-expected.txt: Removed.
+        * web-platform-tests/service-workers/service-worker/link-element-register-mime-types.https.html: Removed.
+        * web-platform-tests/service-workers/service-worker/link-element-register-scope.https-expected.txt: Removed.
+        * web-platform-tests/service-workers/service-worker/link-element-register-scope.https.html: Removed.
+        * web-platform-tests/service-workers/service-worker/link-element-register-script-url.https-expected.txt: Removed.
+        * web-platform-tests/service-workers/service-worker/link-element-register-script-url.https.html: Removed.
+        * web-platform-tests/service-workers/service-worker/link-element-register-script.https-expected.txt: Removed.
+        * web-platform-tests/service-workers/service-worker/link-element-register-script.https.html: Removed.
+        * web-platform-tests/service-workers/service-worker/link-element-register-security-error.https-expected.txt: Removed.
+        * web-platform-tests/service-workers/service-worker/link-element-register-security-error.https.html: Removed.
+        * web-platform-tests/service-workers/service-worker/navigation-preload/empty-preload-response-body.https-expected.txt:
+        * web-platform-tests/service-workers/service-worker/navigation-preload/resources/empty-preload-response-body-scope.html: Added.
+        * web-platform-tests/service-workers/service-worker/register-foreign-fetch-errors.https-expected.txt: Removed.
+        * web-platform-tests/service-workers/service-worker/register-foreign-fetch-errors.https.html: Removed.
+        * web-platform-tests/service-workers/service-worker/register-link-header.https-expected.txt: Removed.
+        * web-platform-tests/service-workers/service-worker/register-link-header.https.html: Removed.
+        * web-platform-tests/service-workers/service-worker/registration-iframe.https.html:
+        * web-platform-tests/service-workers/service-worker/registration-updateviacache.https-expected.txt:
+        * web-platform-tests/service-workers/service-worker/registration-updateviacache.https.html:
+        * web-platform-tests/service-workers/service-worker/resource-timing.https-expected.txt:
+        * web-platform-tests/service-workers/service-worker/resource-timing.https.html:
+        * web-platform-tests/service-workers/service-worker/resources/about-blank-replacement-frame.py: Added.
+        (main):
+        * web-platform-tests/service-workers/service-worker/resources/about-blank-replacement-ping-frame.py: Added.
+        (main):
+        * web-platform-tests/service-workers/service-worker/resources/about-blank-replacement-popup-frame.py: Added.
+        (main):
+        * web-platform-tests/service-workers/service-worker/resources/about-blank-replacement-uncontrolled-nested-frame.html: Added.
+        * web-platform-tests/service-workers/service-worker/resources/about-blank-replacement-worker.js: Added.
+        (async.getClientByURL):
+        (async.pingPong.waitForPong.return.new.Promise):
+        (async.pingPong.waitForPong):
+        (async.pingPong):
+        (async.evt.url.searchParams):
+        (async.evt.evt.respondWith.async):
+        (evt.evt.waitUntil.async):
+        * web-platform-tests/service-workers/service-worker/resources/clients-get-worker.js:
+        (self.onfetch):
+        * web-platform-tests/service-workers/service-worker/resources/empty.js: Added.
+        * web-platform-tests/service-workers/service-worker/resources/fetch-event-respond-with-partial-stream-worker.js: Added.
+        (evt.evt.request.url.includes):
+        * web-platform-tests/service-workers/service-worker/resources/fetch-event-test-worker.js:
+        (handleClientId):
+        * web-platform-tests/service-workers/service-worker/resources/foreign-fetch-cors-worker.js: Removed.
+        * web-platform-tests/service-workers/service-worker/resources/foreign-fetch-event-worker.js: Removed.
+        * web-platform-tests/service-workers/service-worker/resources/foreign-fetch-helper-iframe.html: Removed.
+        * web-platform-tests/service-workers/service-worker/resources/foreign-fetch-helper-script.js: Removed.
+        * web-platform-tests/service-workers/service-worker/resources/foreign-fetch-helper-worker.js: Removed.
+        * web-platform-tests/service-workers/service-worker/resources/foreign-fetch-helpers.js: Removed.
+        * web-platform-tests/service-workers/service-worker/resources/foreign-fetch-worker.js: Removed.
+        * web-platform-tests/service-workers/service-worker/resources/iframe-register-link-element.html: Removed.
+        * web-platform-tests/service-workers/service-worker/resources/install-worker-helper.html: Removed.
+        * web-platform-tests/service-workers/service-worker/resources/interfaces-idls.js:
+        * web-platform-tests/service-workers/service-worker/resources/link-header.py: Removed.
+        * web-platform-tests/service-workers/service-worker/resources/register-foreign-fetch-errors-worker.js: Removed.
+        * web-platform-tests/service-workers/service-worker/resources/resource-timing-iframe.sub.html: Renamed from LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/resource-timing-iframe.html.
+        * web-platform-tests/service-workers/service-worker/resources/sandboxed-iframe-fetch-event-iframe.html: Added.
+        * web-platform-tests/service-workers/service-worker/resources/sandboxed-iframe-fetch-event-worker.js: Added.
+        (event.waitUntil.self.clients.matchAll.then):
+        * web-platform-tests/service-workers/service-worker/resources/sandboxed-iframe-navigator-serviceworker-iframe.html: Added.
+        * web-platform-tests/service-workers/service-worker/resources/test-helpers.sub.js:
+        * web-platform-tests/service-workers/service-worker/resources/w3c-import.log:
+        * web-platform-tests/service-workers/service-worker/sandboxed-iframe-fetch-event.https-expected.txt: Added.
+        * web-platform-tests/service-workers/service-worker/sandboxed-iframe-fetch-event.https.html: Added.
+        * web-platform-tests/service-workers/service-worker/sandboxed-iframe-navigator-serviceworker.https-expected.txt: Added.
+        * web-platform-tests/service-workers/service-worker/sandboxed-iframe-navigator-serviceworker.https.html: Added.
+        * web-platform-tests/service-workers/service-worker/service-worker-csp-connect.https-expected.txt:
+        * web-platform-tests/service-workers/service-worker/service-worker-csp-default.https-expected.txt:
+        * web-platform-tests/service-workers/service-worker/service-worker-csp-script.https-expected.txt:
+        * web-platform-tests/service-workers/service-worker/w3c-import.log:
+
+2017-12-03  Chris Dumez  <cdumez@apple.com>
+
         Support serviceWorker.postMessage() inside service workers
         https://bugs.webkit.org/show_bug.cgi?id=180328
 
diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/about-blank-replacement.https-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/about-blank-replacement.https-expected.txt
new file mode 100644 (file)
index 0000000..9f8a776
--- /dev/null
@@ -0,0 +1,7 @@
+
+
+FAIL Initial about:blank is controlled, exposed to clients.matchAll(), and matches final Client. assert_false: result: failure: could not find about:blank client expected false got true
+FAIL Initial about:blank modified by parent is controlled, exposed to clients.matchAll(), and matches final Client. assert_false: result: failure: could not find about:blank client expected false got true
+FAIL Popup initial about:blank is controlled, exposed to clients.matchAll(), and matches final Client. promise_test: Unhandled rejection with value: object "TypeError: undefined is not an object (evaluating 'frame.contentWindow.nested().document.body')"
+PASS Initial about:blank is controlled, exposed to clients.matchAll(), and final Client is not controlled by a service worker. 
+
diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/about-blank-replacement.https.html b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/about-blank-replacement.https.html
new file mode 100644 (file)
index 0000000..3acfe1b
--- /dev/null
@@ -0,0 +1,146 @@
+<!DOCTYPE html>
+<title>Service Worker: about:blank replacement handling</title>
+<meta name=timeout content=long>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/common/get-host-info.sub.js"></script>
+<script src="resources/test-helpers.sub.js"></script>
+<body>
+<script>
+// This test attempts to verify various initial about:blank document
+// creation is accurately reflected via the Clients API.  The goal is
+// for Clients API to reflect what the browser actually does and not
+// to make special cases for the API.
+//
+// If your browser does not create an about:blank document in certain
+// cases then please just mark the test expected fail for now.  The
+// reuse of globals from about:blank documents to the final load document
+// has particularly bad interop at the moment.  Hopefully we can evolve
+// tests like this to eventually align browsers.
+
+const worker = 'resources/about-blank-replacement-worker.js';
+
+// Helper routine that creates an iframe that internally has some kind
+// of nested window.  The nested window could be another iframe or
+// it could be a popup window.
+function createFrameWithNestedWindow(url) {
+  return new Promise((resolve, reject) => {
+    let frame = document.createElement('iframe');
+    frame.src = url;
+    document.body.appendChild(frame);
+
+    window.addEventListener('message', function onMsg(evt) {
+      if (evt.data.type !== 'NESTED_LOADED') {
+        return;
+      }
+      window.removeEventListener('message', onMsg);
+      if (evt.data.result && evt.data.result.startsWith('failure:')) {
+        reject(evt.data.result);
+        return;
+      }
+      resolve(frame);
+    });
+  });
+}
+
+// Helper routine to request the given worker find the client with
+// the specified URL using the clients.matchAll() API.
+function getClientIdByURL(worker, url) {
+  return new Promise(resolve => {
+    navigator.serviceWorker.addEventListener('message', function onMsg(evt) {
+      if (evt.data.type !== 'GET_CLIENT_ID') {
+        return;
+      }
+      navigator.serviceWorker.removeEventListener('message', onMsg);
+      resolve(evt.data.result);
+    });
+    worker.postMessage({ type: 'GET_CLIENT_ID', url: url.toString() });
+  });
+}
+
+async function doAsyncTest(t, scope, extraSearchParams) {
+  let reg = await service_worker_unregister_and_register(t, worker, scope);
+  await wait_for_state(t, reg.installing, 'activated');
+
+  // Load the scope as a frame.  We expect this in turn to have a nested
+  // iframe.  The service worker will intercept the load of the nested
+  // iframe and populate its body with the client ID of the initial
+  // about:blank document it sees via clients.matchAll().
+  let frame = await createFrameWithNestedWindow(scope);
+  let initialResult = frame.contentWindow.nested().document.body.textContent;
+  assert_false(initialResult.startsWith('failure:'), `result: ${initialResult}`);
+
+  // Next, ask the service worker to find the final client ID for the fully
+  // loaded nested frame.
+  let nestedURL = new URL(scope, window.location);
+  nestedURL.searchParams.set('nested', true);
+  extraSearchParams = extraSearchParams || {};
+  for (let p in extraSearchParams) {
+    nestedURL.searchParams.set(p, extraSearchParams[p]);
+  }
+  let finalResult = await getClientIdByURL(reg.active, nestedURL);
+  assert_false(finalResult.startsWith('failure:'), `result: ${finalResult}`);
+
+  // The initial about:blank client and the final loaded client should have
+  // the same ID value.
+  assert_equals(initialResult, finalResult, 'client ID values should match');
+
+  frame.remove();
+  await service_worker_unregister_and_done(t, scope);
+}
+
+promise_test(async function(t) {
+  // Execute a test where the nested frame is simply loaded normally.
+  await doAsyncTest(t, 'resources/about-blank-replacement-frame.py');
+}, 'Initial about:blank is controlled, exposed to clients.matchAll(), and ' +
+   'matches final Client.');
+
+promise_test(async function(t) {
+  // Execute a test where the nested frame is modified immediately by
+  // its parent.  In this case we add a message listener so the service
+  // worker can ping the client to verify its existence.  This ping-pong
+  // check is performed during the initial load and when verifying the
+  // final loaded client.
+  await doAsyncTest(t, 'resources/about-blank-replacement-ping-frame.py',
+                    { 'ping': true });
+}, 'Initial about:blank modified by parent is controlled, exposed to ' +
+   'clients.matchAll(), and matches final Client.');
+
+promise_test(async function(t) {
+  // Execute a test where the nested window is a popup window instead of
+  // an iframe.  This should behave the same as the simple iframe case.
+  await doAsyncTest(t, 'resources/about-blank-replacement-popup-frame.py');
+}, 'Popup initial about:blank is controlled, exposed to clients.matchAll(), and ' +
+   'matches final Client.');
+
+promise_test(async function(t) {
+  const scope = 'resources/about-blank-replacement-uncontrolled-nested-frame.html';
+
+  let reg = await service_worker_unregister_and_register(t, worker, scope);
+  await wait_for_state(t, reg.installing, 'activated');
+
+  // Load the scope as a frame.  We expect this in turn to have a nested
+  // iframe.  Unlike the other tests in this file the nested iframe URL
+  // is not covered by a service worker scope.  It should end up as
+  // uncontrolled even though its initial about:blank is controlled.
+  let frame = await createFrameWithNestedWindow(scope);
+  let nested = frame.contentWindow.nested();
+  let initialResult = nested.document.body.textContent;
+
+  // The nested iframe should not have been intercepted by the service
+  // worker.  The empty.html nested frame has "hello world" for its body.
+  assert_equals(initialResult.trim(), 'hello world', `result: ${initialResult}`);
+
+  assert_not_equals(frame.contentWindow.navigator.serviceWorker.controller, null,
+                'outer frame should be controlled');
+
+  assert_equals(nested.navigator.serviceWorker.controller, null,
+                'nested frame should not be controlled');
+
+  frame.remove();
+  await service_worker_unregister_and_done(t, scope);
+}, 'Initial about:blank is controlled, exposed to clients.matchAll(), and ' +
+   'final Client is not controlled by a service worker.');
+
+</script>
+</body>
index 4a9f0e1..c49ed0e 100644 (file)
@@ -1,4 +1,4 @@
  
 
-FAIL Verify canvas tainting of fetched image in a Service Worker assert_equals: expected "finish" but got "failure:Result of url:https://localhost:9443/service-workers/service-worker/resources/fetch-access-control.py?PNGIMAGE&mode=no-cors&url=https%3A%2F%2F127.0.0.1%3A9443%2Fservice-workers%2Fservice-worker%2Fresources%2Ffetch-access-control.py%3FPNGIMAGE  cross_origin:  must be TAINTED but NOT_TAINTED"
+FAIL Verify canvas tainting of fetched image in a Service Worker assert_equals: expected "finish" but got "failure:Result of url:https://localhost:9443/service-workers/service-worker/resources/fetch-access-control.py?PNGIMAGE&mode=no-cors&url=https%3A%2F%2F127.0.0.1%3A9443%2Fservice-workers%2Fservice-worker%2Fresources%2Ffetch-access-control.py%3FPNGIMAGE  cross_origin: use-credentials must be LOAD_ERROR but NOT_TAINTED"
 
diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-event-respond-with-partial-stream.https-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-event-respond-with-partial-stream.https-expected.txt
new file mode 100644 (file)
index 0000000..3d7d514
--- /dev/null
@@ -0,0 +1,5 @@
+
+Harness Error (TIMEOUT), message = null
+
+TIMEOUT respondWith() streams data to an intercepted fetch() Test timed out
+
diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-event-respond-with-partial-stream.https.html b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-event-respond-with-partial-stream.https.html
new file mode 100644 (file)
index 0000000..505cef2
--- /dev/null
@@ -0,0 +1,62 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>respondWith streams data to an intercepted fetch()</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="resources/test-helpers.sub.js"></script>
+<script>
+'use strict';
+
+const WORKER =
+  'resources/fetch-event-respond-with-partial-stream-worker.js';
+const SCOPE =
+  'resources/fetch-event-respond-with-partial-stream-iframe.html';
+
+promise_test(async t => {
+  let reg = await service_worker_unregister_and_register(t, WORKER, SCOPE)
+  add_completion_callback(() => reg.unregister());
+
+  await wait_for_state(t, reg.installing, 'activated');
+
+  let frame = await with_iframe(SCOPE);
+  t.add_cleanup(_ => frame.remove());
+
+  let response = await frame.contentWindow.fetch('partial-stream.txt');
+
+  let reader = response.body.getReader();
+
+  let encoder = new TextEncoder();
+  let decoder = new TextDecoder();
+
+  let expected = 'partial-stream-content';
+  let encodedExpected = encoder.encode(expected);
+  let received = '';
+  let encodedReceivedLength = 0;
+
+  // Accumulate response data from the service worker.  We do this as a loop
+  // to allow the browser the flexibility of rebuffering if it chooses.  We
+  // do expect to get the partial data within the test timeout period, though.
+  // The spec is a bit vague at the moment about this, but it seems reasonable
+  // that the browser should not stall the response stream when the service
+  // worker has only written a partial result, but not closed the stream.
+  while (encodedReceivedLength < encodedExpected.length) {
+    let chunk = await reader.read();
+    assert_false(chunk.done, 'partial body stream should not be closed yet');
+
+    encodedReceivedLength += chunk.value.length;
+    received += decoder.decode(chunk.value);
+  }
+
+  // Note, the spec may allow some re-buffering between the service worker
+  // and the outer intercepted fetch.  We could relax this exact chunk value
+  // match if necessary.  The goal, though, is to ensure the outer fetch is
+  // not completely blocked until the service worker body is closed.
+  assert_equals(received, expected,
+                'should receive partial content through service worker interception');
+
+  reg.active.postMessage('done');
+
+  await reader.closed;
+
+  }, 'respondWith() streams data to an intercepted fetch()');
+</script>
diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/foreign-fetch-basics.https-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/foreign-fetch-basics.https-expected.txt
deleted file mode 100644 (file)
index a278e30..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-CONSOLE MESSAGE: Origin https://localhost:9443 is not allowed by Access-Control-Allow-Origin.
-CONSOLE MESSAGE: Fetch API cannot load https://127.0.0.1:9443/service-workers/service-worker/resources/foreign-fetch/scope/wildcard/foo?basic. Origin https://localhost:9443 is not allowed by Access-Control-Allow-Origin.
-CONSOLE MESSAGE: Origin https://localhost:9443 is not allowed by Access-Control-Allow-Origin.
-CONSOLE MESSAGE: Fetch API cannot load https://127.0.0.1:9443/service-workers/service-worker/resources/foreign-fetch/scope/wildcard/intercept/foo?basic. Origin https://localhost:9443 is not allowed by Access-Control-Allow-Origin.
-CONSOLE MESSAGE: Origin https://localhost:9443 is not allowed by Access-Control-Allow-Origin.
-CONSOLE MESSAGE: Fetch API cannot load https://127.0.0.1:9443/service-workers/service-worker/resources/foreign-fetch/scope/match-origin/intercept/foo?basic. Origin https://localhost:9443 is not allowed by Access-Control-Allow-Origin.
-CONSOLE MESSAGE: Origin https://localhost:9443 is not allowed by Access-Control-Allow-Origin.
-CONSOLE MESSAGE: Fetch API cannot load https://127.0.0.1:9443/service-workers/service-worker/resources/foreign-fetch/scope/nomatch-origin/foo?basic. Origin https://localhost:9443 is not allowed by Access-Control-Allow-Origin.
-CONSOLE MESSAGE: Origin https://localhost:9443 is not allowed by Access-Control-Allow-Origin.
-CONSOLE MESSAGE: Fetch API cannot load https://127.0.0.1:9443/service-workers/service-worker/resources/foreign-fetch/scope/origin-list/intercept/foo?basic. Origin https://localhost:9443 is not allowed by Access-Control-Allow-Origin.
-CONSOLE MESSAGE: Origin https://localhost:9443 is not allowed by Access-Control-Allow-Origin.
-CONSOLE MESSAGE: Fetch API cannot load https://127.0.0.1:9443/service-workers/service-worker/resources/simple.txt?fallback. Origin https://localhost:9443 is not allowed by Access-Control-Allow-Origin.
-CONSOLE MESSAGE: Origin https://localhost:9443 is not allowed by Access-Control-Allow-Origin.
-CONSOLE MESSAGE: Fetch API cannot load https://127.0.0.1:9443/service-workers/service-worker/resources/foreign-fetch/scope/controlled?basic. Origin https://localhost:9443 is not allowed by Access-Control-Allow-Origin.
-CONSOLE MESSAGE: Origin https://localhost:9443 is not allowed by Access-Control-Allow-Origin.
-CONSOLE MESSAGE: Cross-origin script load denied by Cross-Origin Resource Sharing policy.
-  
-
-Harness Error (TIMEOUT), message = null
-
-FAIL Service Worker intercepts fetches in scope with wildcard origin. promise_test: Unhandled rejection with value: object "TypeError: Origin https://localhost:9443 is not allowed by Access-Control-Allow-Origin."
-FAIL Service Worker intercepts fetches in scope with explicit origin. promise_test: Unhandled rejection with value: object "TypeError: Origin https://localhost:9443 is not allowed by Access-Control-Allow-Origin."
-PASS Service Worker doesn't intercept fetches with non matching origin. 
-FAIL Service Worker intercepts fetches in scope with explicit origin list. promise_test: Unhandled rejection with value: object "TypeError: Origin https://localhost:9443 is not allowed by Access-Control-Allow-Origin."
-PASS Service Worker does not intercept same origin fetches. 
-PASS Service Worker does not intercept navigations. 
-PASS Service Worker that fallback to network should fallback to network. 
-PASS Service Worker that fetch from the network should fallback to network. 
-PASS Falling back to network should still respect CORS. 
-FAIL Foreign fetch can intercept fetch requests from SW controlled pages. promise_test: Unhandled rejection with value: object "TypeError: Origin https://localhost:9443 is not allowed by Access-Control-Allow-Origin."
-TIMEOUT Foreign fetch can intercept resource requests from SW controlled pages. Test timed out
-NOTRUN Referrer and origin are set correctly in ForeignFetchEvent. 
-NOTRUN Service Worker does not intercept fetches from an insecure context. 
-NOTRUN Service Worker does not intercept fetches with CORS preflight 
-NOTRUN Foreign fetch rejects if resolved with a null response. 
-
diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/foreign-fetch-basics.https.html b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/foreign-fetch-basics.https.html
deleted file mode 100644 (file)
index 8519f8f..0000000
+++ /dev/null
@@ -1,241 +0,0 @@
-<!DOCTYPE html>
-<title>Service Worker: basic Foreign Fetch functionality</title>
-<script src="/resources/testharness.js"></script>
-<script src="/resources/testharnessreport.js"></script>
-<script src="/common/get-host-info.sub.js"></script>
-<script src="resources/test-helpers.sub.js"></script>
-<script src="resources/foreign-fetch-helpers.js"></script>
-<body>
-<script>
-var host_info = get_host_info();
-var resource_path = new URL('resources/', location).pathname;
-
-function worker_for_origins(origins) {
-  var worker = 'foreign-fetch-worker.js?';
-  var params = {origins: origins, relscopes: ['/intercept']};
-  return worker + encodeURIComponent(JSON.stringify(params));
-}
-
-function worker_for_scopes(relative_scopes) {
-  var worker = 'foreign-fetch-worker.js?';
-  var params = {relscopes: relative_scopes};
-  return worker + encodeURIComponent(JSON.stringify(params));
-}
-
-function intercepted_url(scope) {
-  return host_info.HTTPS_REMOTE_ORIGIN + resource_path + scope + '/intercept/foo?basic';
-}
-
-function non_intercepted_url(scope) {
-  return host_info.HTTPS_REMOTE_ORIGIN + resource_path + scope + '/foo?basic';
-}
-
-promise_test(t => {
-    var scope = 'foreign-fetch/scope/wildcard';
-    return install_cross_origin_worker(t, worker_for_origins(['*']), scope)
-      .then(() => promise_rejects(t, new TypeError(),
-                                  fetch(non_intercepted_url(scope))))
-      .then(() => fetch(intercepted_url(scope)))
-      .then(response => response.text())
-      .then(response_text => {
-          assert_equals(response_text, 'Foreign Fetch');
-        });
-  }, 'Service Worker intercepts fetches in scope with wildcard origin.');
-
-promise_test(t => {
-    var scope = 'foreign-fetch/scope/match-origin';
-    return install_cross_origin_worker(
-        t, worker_for_origins([location.origin]), scope)
-      .then(() => fetch(intercepted_url(scope)))
-      .then(response => response.text())
-      .then(response_text => {
-          assert_equals(response_text, 'Foreign Fetch');
-        });
-  }, 'Service Worker intercepts fetches in scope with explicit origin.');
-
-promise_test(t => {
-    var scope = 'foreign-fetch/scope/nomatch-origin';
-    return install_cross_origin_worker(
-        t, worker_for_origins(['https://example.com']), scope)
-      .then(() => promise_rejects(t, new TypeError(),
-                                  fetch(non_intercepted_url(scope))));
-  }, 'Service Worker doesn\'t intercept fetches with non matching origin.');
-
-promise_test(t => {
-    var scope = 'foreign-fetch/scope/origin-list';
-    return install_cross_origin_worker(
-        t, worker_for_origins([location.origin, 'https://example.com']), scope)
-      .then(() => fetch(intercepted_url(scope)))
-      .then(response => response.text())
-      .then(response_text => {
-          assert_equals(response_text, 'Foreign Fetch');
-        });
-  }, 'Service Worker intercepts fetches in scope with explicit origin list.');
-
-promise_test(t => {
-    var scope = 'resources/foreign-fetch/same-origin';
-    return service_worker_unregister_and_register(
-        t, 'resources/' + worker_for_origins(['*']), scope)
-      .then(r => {
-          add_completion_callback(() => r.unregister());
-          return wait_for_state(t, r.installing, 'activated');
-        })
-      .then(() => fetch(scope + '/intercept/foo?basic'))
-      .then(response => {
-          assert_equals(response.status, 404);
-        });
-  }, 'Service Worker does not intercept same origin fetches.');
-
-promise_test(t => {
-    var scope = 'reply-to-message.html?onmessage';
-    var remote_url =
-        host_info.HTTPS_REMOTE_ORIGIN + resource_path + scope;
-    return install_cross_origin_worker(t, worker_for_scopes(['']), scope)
-      .then(() => with_iframe(remote_url))
-      .then(frame => new Promise(resolve => {
-          var channel = new MessageChannel();
-          frame.contentWindow.postMessage('ping', '*', [channel.port1]);
-          channel.port2.onmessage = reply => resolve(reply.data);
-        }))
-      .then(reply => {
-          assert_equals(reply, 'ping');
-        });
-  }, 'Service Worker does not intercept navigations.');
-
-promise_test(t => {
-    var scope = 'fetch-access-control.py?fallback&ACAOrigin=*';
-    var remote_url =
-        host_info.HTTPS_REMOTE_ORIGIN + resource_path + scope;
-    return install_cross_origin_worker(t, worker_for_scopes(['']), scope)
-      .then(() => fetch(remote_url))
-      .then(response => response.text())
-      .then(response_text => assert_true(response_text.startsWith('report(')));
-  }, 'Service Worker that fallback to network should fallback to network.');
-
-promise_test(t => {
-    var scope = 'fetch-access-control.py?fetch&ACAOrigin=*';
-    var remote_url =
-        host_info.HTTPS_REMOTE_ORIGIN + resource_path + scope;
-    return install_cross_origin_worker(t, worker_for_scopes(['']), scope)
-      .then(() => fetch(remote_url))
-      .then(response => response.text())
-      .then(response_text => assert_true(response_text.startsWith('report(')));
-  }, 'Service Worker that fetch from the network should fallback to network.');
-
-promise_test(t => {
-    var scope = 'simple.txt?fallback';
-    var remote_url =
-        host_info.HTTPS_REMOTE_ORIGIN + resource_path + scope;
-    return install_cross_origin_worker(t, worker_for_scopes(['']), scope)
-      .then(() => fetch(remote_url, {mode: 'no-cors'}))
-      .then(response => assert_equals(response.type, 'opaque'))
-      .then(() => promise_rejects(t, new TypeError(), fetch(remote_url)));
-  }, 'Falling back to network should still respect CORS.');
-
-promise_test(t => {
-    var ff_scope = 'foreign-fetch/scope/controlled?basic';
-    var remote_url =
-        host_info.HTTPS_REMOTE_ORIGIN + resource_path + ff_scope;
-    var scope = 'resources/simple.html?fetch';
-    var worker = 'resources/empty-worker.js';
-    return install_cross_origin_worker(t, worker_for_scopes(['']), ff_scope)
-      .then(() => service_worker_unregister_and_register(t, worker, scope))
-      .then(r => {
-          add_completion_callback(() => r.unregister());
-          return wait_for_state(t, r.installing, 'activated');
-        })
-      .then(() => with_iframe(scope))
-      .then(frame => frame.contentWindow.fetch(remote_url))
-      .then(response => response.text())
-      .then(response_text => {
-          assert_equals(response_text, 'Foreign Fetch');
-        });
-  }, 'Foreign fetch can intercept fetch requests from SW controlled pages.');
-
-promise_test(t => {
-    var ff_scope = 'foreign-fetch/scope/controlled?script';
-    var remote_url =
-        host_info.HTTPS_REMOTE_ORIGIN + resource_path + ff_scope;
-    var scope = 'resources/simple.html?script';
-    var worker = 'resources/empty-worker.js';
-    return install_cross_origin_worker(t, worker_for_scopes(['']), ff_scope)
-      .then(() => service_worker_unregister_and_register(t, worker, scope))
-      .then(r => {
-          add_completion_callback(() => r.unregister());
-          return wait_for_state(t, r.installing, 'activated');
-        })
-      .then(() => with_iframe(scope))
-      .then(frame => new Promise(resolve => {
-          frame.contentWindow.DidLoad = resolve;
-          let script = frame.contentWindow.document.createElement('script');
-          script.setAttribute('src', remote_url);
-          script.setAttribute('crossorigin', 'use-credentials');
-          frame.contentWindow.document.head.appendChild(script);
-        }))
-      .then(response_text => {
-          assert_equals(response_text, 'Foreign Fetch');
-        });
-  }, 'Foreign fetch can intercept resource requests from SW controlled pages.');
-
-promise_test(t => {
-    var scope = 'simple.txt?meta';
-    var remote_url =
-        host_info.HTTPS_REMOTE_ORIGIN + resource_path + scope;
-    return install_cross_origin_worker(t, worker_for_scopes(['']), scope)
-      .then(() => fetch(remote_url, {mode: 'no-cors'}))
-      .then(response => response.json())
-      .then(response_data => {
-          assert_equals(self.location.href, response_data.referrer);
-          assert_equals(self.location.origin, response_data.origin);
-        })
-      .then(() => with_iframe('resources/blank.html'))
-      .then(frame => {
-          var meta = frame.contentDocument.createElement('meta');
-          meta.setAttribute('name', 'referrer');
-          meta.setAttribute('content', 'no-referrer');
-          frame.contentDocument.head.appendChild(meta);
-          return frame.contentWindow.fetch(remote_url, {mode: 'no-cors'});
-        })
-      .then(response => response.json())
-      .then(response_data => {
-          assert_equals('', response_data.referrer);
-          assert_equals('null', response_data.origin);
-        });
-  }, 'Referrer and origin are set correctly in ForeignFetchEvent.');
-
-promise_test(t => {
-    var scope = 'simple.txt?basic_insecure';
-    var remote_url =
-        host_info.AUTHENTICATED_ORIGIN + resource_path + scope;
-    return install_cross_origin_worker(t, worker_for_scopes(['']), scope,
-                                       host_info.AUTHENTICATED_ORIGIN)
-      .then(() => fetch_from_different_origin(host_info.HTTPS_REMOTE_ORIGIN, remote_url))
-      .then(response => assert_equals(response, 'Success: Foreign Fetch'))
-      .then(() => fetch_from_different_origin(host_info.UNAUTHENTICATED_ORIGIN,
-                                    remote_url))
-      .then(response => assert_true(response.startsWith('Error: TypeError')));
-  }, 'Service Worker does not intercept fetches from an insecure context.');
-
-promise_test(t => {
-    var scope = 'fetch-access-control.py?basic&ACAOrigin=*&ACAMethods=SPECIAL';
-    var remote_url =
-        host_info.HTTPS_REMOTE_ORIGIN + resource_path + scope;
-    return install_cross_origin_worker(t, worker_for_scopes(['']), scope)
-      .then(() => fetch(remote_url, {method: 'SPECIAL'}))
-      .then(response => response.text())
-      .then(response_text => assert_true(response_text.startsWith('report(')))
-      // Do the whole thing twice to test CORS preflight cache behavior.
-      .then(() => fetch(remote_url, {method: 'SPECIAL'}))
-      .then(response => response.text())
-      .then(response_text => assert_true(response_text.startsWith('report(')));
-  }, 'Service Worker does not intercept fetches with CORS preflight');
-
-promise_test(t => {
-  var scope = 'simple.txt?null';
-  var remote_url =
-  host_info.HTTPS_REMOTE_ORIGIN + resource_path + scope;
-  return install_cross_origin_worker(t, worker_for_scopes(['']), scope)
-    .then(() => promise_rejects(t, new TypeError(), fetch(remote_url)));
-}, 'Foreign fetch rejects if resolved with a null response.');
-</script>
-</body>
diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/foreign-fetch-cors.https-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/foreign-fetch-cors.https-expected.txt
deleted file mode 100644 (file)
index 4412aec..0000000
+++ /dev/null
@@ -1,67 +0,0 @@
-CONSOLE MESSAGE: Origin https://localhost:9443 is not allowed by Access-Control-Allow-Origin.
-CONSOLE MESSAGE: Fetch API cannot load https://127.0.0.1:9443/service-workers/service-worker/resources/simple.txt?%7B%22cross_origin%22%3Afalse%2C%22with_aceheaders%22%3Afalse%2C%22with_acaorigin%22%3Afalse%7D. Origin https://localhost:9443 is not allowed by Access-Control-Allow-Origin.
-CONSOLE MESSAGE: Origin https://localhost:9443 is not allowed by Access-Control-Allow-Origin.
-CONSOLE MESSAGE: XMLHttpRequest cannot load https://127.0.0.1:9443/service-workers/service-worker/resources/simple.txt?%7B%22cross_origin%22%3Afalse%2C%22with_aceheaders%22%3Afalse%2C%22with_acaorigin%22%3Afalse%7D due to access control checks.
-CONSOLE MESSAGE: Origin https://localhost:9443 is not allowed by Access-Control-Allow-Origin.
-CONSOLE MESSAGE: Fetch API cannot load https://127.0.0.1:9443/service-workers/service-worker/resources/simple.txt?%7B%22cross_origin%22%3Afalse%2C%22with_aceheaders%22%3Afalse%2C%22with_acaorigin%22%3Afalse%7D. Origin https://localhost:9443 is not allowed by Access-Control-Allow-Origin.
-CONSOLE MESSAGE: Origin https://localhost:9443 is not allowed by Access-Control-Allow-Origin.
-CONSOLE MESSAGE: Fetch API cannot load https://127.0.0.1:9443/service-workers/service-worker/resources/simple.txt?%7B%22cross_origin%22%3Afalse%2C%22with_aceheaders%22%3Afalse%2C%22with_acaorigin%22%3Afalse%7D. Origin https://localhost:9443 is not allowed by Access-Control-Allow-Origin.
-CONSOLE MESSAGE: Origin https://localhost:9443 is not allowed by Access-Control-Allow-Origin.
-CONSOLE MESSAGE: Fetch API cannot load https://127.0.0.1:9443/service-workers/service-worker/resources/simple.txt?%7B%22cross_origin%22%3Afalse%2C%22with_aceheaders%22%3Afalse%2C%22with_acaorigin%22%3Afalse%7D. Origin https://localhost:9443 is not allowed by Access-Control-Allow-Origin.
-CONSOLE MESSAGE: Origin https://localhost:9443 is not allowed by Access-Control-Allow-Origin.
-CONSOLE MESSAGE: XMLHttpRequest cannot load https://127.0.0.1:9443/service-workers/service-worker/resources/simple.txt?%7B%22cross_origin%22%3Afalse%2C%22with_aceheaders%22%3Afalse%2C%22with_acaorigin%22%3Afalse%7D due to access control checks.
-CONSOLE MESSAGE: Origin https://localhost:9443 is not allowed by Access-Control-Allow-Origin.
-CONSOLE MESSAGE: Fetch API cannot load https://127.0.0.1:9443/service-workers/service-worker/resources/simple.txt?%7B%22cross_origin%22%3Afalse%2C%22with_aceheaders%22%3Atrue%2C%22with_acaorigin%22%3Atrue%7D. Origin https://localhost:9443 is not allowed by Access-Control-Allow-Origin.
-CONSOLE MESSAGE: Origin https://localhost:9443 is not allowed by Access-Control-Allow-Origin.
-CONSOLE MESSAGE: XMLHttpRequest cannot load https://127.0.0.1:9443/service-workers/service-worker/resources/simple.txt?%7B%22cross_origin%22%3Afalse%2C%22with_aceheaders%22%3Atrue%2C%22with_acaorigin%22%3Atrue%7D due to access control checks.
-CONSOLE MESSAGE: Origin https://localhost:9443 is not allowed by Access-Control-Allow-Origin.
-CONSOLE MESSAGE: Fetch API cannot load https://127.0.0.1:9443/service-workers/service-worker/resources/simple.txt?%7B%22cross_origin%22%3Afalse%2C%22with_aceheaders%22%3Atrue%2C%22with_acaorigin%22%3Atrue%7D. Origin https://localhost:9443 is not allowed by Access-Control-Allow-Origin.
-CONSOLE MESSAGE: Origin https://localhost:9443 is not allowed by Access-Control-Allow-Origin.
-CONSOLE MESSAGE: Fetch API cannot load https://127.0.0.1:9443/service-workers/service-worker/resources/simple.txt?%7B%22cross_origin%22%3Afalse%2C%22with_aceheaders%22%3Atrue%2C%22with_acaorigin%22%3Atrue%7D. Origin https://localhost:9443 is not allowed by Access-Control-Allow-Origin.
-CONSOLE MESSAGE: Origin https://localhost:9443 is not allowed by Access-Control-Allow-Origin.
-CONSOLE MESSAGE: Fetch API cannot load https://127.0.0.1:9443/service-workers/service-worker/resources/simple.txt?%7B%22cross_origin%22%3Afalse%2C%22with_aceheaders%22%3Atrue%2C%22with_acaorigin%22%3Atrue%7D. Origin https://localhost:9443 is not allowed by Access-Control-Allow-Origin.
-CONSOLE MESSAGE: Origin https://localhost:9443 is not allowed by Access-Control-Allow-Origin.
-CONSOLE MESSAGE: XMLHttpRequest cannot load https://127.0.0.1:9443/service-workers/service-worker/resources/simple.txt?%7B%22cross_origin%22%3Afalse%2C%22with_aceheaders%22%3Atrue%2C%22with_acaorigin%22%3Atrue%7D due to access control checks.
-CONSOLE MESSAGE: Origin https://localhost:9443 is not allowed by Access-Control-Allow-Origin.
-CONSOLE MESSAGE: Fetch API cannot load https://127.0.0.1:9443/service-workers/service-worker/resources/simple.txt?%7B%22cross_origin%22%3Atrue%2C%22with_aceheaders%22%3Afalse%2C%22with_acaorigin%22%3Afalse%7D. Origin https://localhost:9443 is not allowed by Access-Control-Allow-Origin.
-CONSOLE MESSAGE: Origin https://localhost:9443 is not allowed by Access-Control-Allow-Origin.
-CONSOLE MESSAGE: XMLHttpRequest cannot load https://127.0.0.1:9443/service-workers/service-worker/resources/simple.txt?%7B%22cross_origin%22%3Atrue%2C%22with_aceheaders%22%3Afalse%2C%22with_acaorigin%22%3Afalse%7D due to access control checks.
-CONSOLE MESSAGE: Origin https://localhost:9443 is not allowed by Access-Control-Allow-Origin.
-CONSOLE MESSAGE: Fetch API cannot load https://127.0.0.1:9443/service-workers/service-worker/resources/simple.txt?%7B%22cross_origin%22%3Atrue%2C%22with_aceheaders%22%3Atrue%2C%22with_acaorigin%22%3Atrue%7D. Origin https://localhost:9443 is not allowed by Access-Control-Allow-Origin.
-CONSOLE MESSAGE: Origin https://localhost:9443 is not allowed by Access-Control-Allow-Origin.
-CONSOLE MESSAGE: XMLHttpRequest cannot load https://127.0.0.1:9443/service-workers/service-worker/resources/simple.txt?%7B%22cross_origin%22%3Atrue%2C%22with_aceheaders%22%3Atrue%2C%22with_acaorigin%22%3Atrue%7D due to access control checks.
-CONSOLE MESSAGE: Origin https://localhost:9443 is not allowed by Access-Control-Allow-Origin.
-CONSOLE MESSAGE: Fetch API cannot load https://127.0.0.1:9443/service-workers/service-worker/resources/simple.txt?%7B%22cross_origin%22%3Atrue%2C%22with_aceheaders%22%3Atrue%2C%22with_acaorigin%22%3Atrue%7D. Origin https://localhost:9443 is not allowed by Access-Control-Allow-Origin.
-CONSOLE MESSAGE: Origin https://localhost:9443 is not allowed by Access-Control-Allow-Origin.
-CONSOLE MESSAGE: Fetch API cannot load https://127.0.0.1:9443/service-workers/service-worker/resources/simple.txt?%7B%22cross_origin%22%3Atrue%2C%22with_aceheaders%22%3Atrue%2C%22with_acaorigin%22%3Atrue%7D. Origin https://localhost:9443 is not allowed by Access-Control-Allow-Origin.
-CONSOLE MESSAGE: Origin https://localhost:9443 is not allowed by Access-Control-Allow-Origin.
-CONSOLE MESSAGE: Fetch API cannot load https://127.0.0.1:9443/service-workers/service-worker/resources/simple.txt?%7B%22cross_origin%22%3Atrue%2C%22with_aceheaders%22%3Atrue%2C%22with_acaorigin%22%3Atrue%7D. Origin https://localhost:9443 is not allowed by Access-Control-Allow-Origin.
-CONSOLE MESSAGE: Origin https://localhost:9443 is not allowed by Access-Control-Allow-Origin.
-CONSOLE MESSAGE: XMLHttpRequest cannot load https://127.0.0.1:9443/service-workers/service-worker/resources/simple.txt?%7B%22cross_origin%22%3Atrue%2C%22with_aceheaders%22%3Atrue%2C%22with_acaorigin%22%3Atrue%7D due to access control checks.
-CONSOLE MESSAGE: Origin https://localhost:9443 is not allowed by Access-Control-Allow-Origin.
-CONSOLE MESSAGE: Fetch API cannot load https://127.0.0.1:9443/service-workers/service-worker/resources/simple.txt?%7B%22cross_origin%22%3Atrue%2C%22with_aceheaders%22%3Afalse%2C%22with_acaorigin%22%3Atrue%7D. Origin https://localhost:9443 is not allowed by Access-Control-Allow-Origin.
-CONSOLE MESSAGE: Origin https://localhost:9443 is not allowed by Access-Control-Allow-Origin.
-CONSOLE MESSAGE: XMLHttpRequest cannot load https://127.0.0.1:9443/service-workers/service-worker/resources/simple.txt?%7B%22cross_origin%22%3Atrue%2C%22with_aceheaders%22%3Afalse%2C%22with_acaorigin%22%3Atrue%7D due to access control checks.
-CONSOLE MESSAGE: Origin https://localhost:9443 is not allowed by Access-Control-Allow-Origin.
-CONSOLE MESSAGE: Fetch API cannot load https://127.0.0.1:9443/service-workers/service-worker/resources/simple.txt?%7B%22cross_origin%22%3Atrue%2C%22with_aceheaders%22%3Afalse%2C%22with_acaorigin%22%3Atrue%7D. Origin https://localhost:9443 is not allowed by Access-Control-Allow-Origin.
-CONSOLE MESSAGE: Origin https://localhost:9443 is not allowed by Access-Control-Allow-Origin.
-CONSOLE MESSAGE: Fetch API cannot load https://127.0.0.1:9443/service-workers/service-worker/resources/simple.txt?%7B%22cross_origin%22%3Atrue%2C%22with_aceheaders%22%3Afalse%2C%22with_acaorigin%22%3Atrue%7D. Origin https://localhost:9443 is not allowed by Access-Control-Allow-Origin.
-  
-
-PASS Same origin fetch without CORS headers, not exposed 
-FAIL Same origin fetch without CORS headers, only origin exposed promise_test: Unhandled rejection with value: object "TypeError: Origin https://localhost:9443 is not allowed by Access-Control-Allow-Origin."
-FAIL Same origin fetch without CORS headers, headers and origin exposed promise_test: Unhandled rejection with value: object "TypeError: Origin https://localhost:9443 is not allowed by Access-Control-Allow-Origin."
-FAIL Same origin fetch without CORS headers, exposed to wrong origin assert_unreached: Should have rejected: undefined Reached unreachable code
-PASS Same origin fetch with CORS headers, not exposed 
-FAIL Same origin fetch with CORS headers, only origin exposed promise_test: Unhandled rejection with value: object "TypeError: Origin https://localhost:9443 is not allowed by Access-Control-Allow-Origin."
-FAIL Same origin fetch with CORS headers, headers and origin exposed promise_test: Unhandled rejection with value: object "TypeError: Origin https://localhost:9443 is not allowed by Access-Control-Allow-Origin."
-FAIL Same origin fetch with CORS headers, exposed to wrong origin assert_unreached: Should have rejected: undefined Reached unreachable code
-PASS Cross origin fetch without CORS headers, not exposed 
-PASS Cross origin fetch with ACEHeaders header, not exposed 
-FAIL Cross origin fetch with ACEHeaders header, only origin exposed promise_test: Unhandled rejection with value: object "TypeError: Origin https://localhost:9443 is not allowed by Access-Control-Allow-Origin."
-FAIL Cross origin fetch with ACEHeaders header, headers and origin exposed promise_test: Unhandled rejection with value: object "TypeError: Origin https://localhost:9443 is not allowed by Access-Control-Allow-Origin."
-FAIL Cross origin fetch with ACEHeaders header, exposed to wrong origin assert_unreached: Should have rejected: undefined Reached unreachable code
-PASS Cross origin fetch without ACEHeaders header, not exposed 
-FAIL Cross origin fetch without ACEHeaders header, only origin exposed promise_test: Unhandled rejection with value: object "TypeError: Origin https://localhost:9443 is not allowed by Access-Control-Allow-Origin."
-FAIL Cross origin fetch without ACEHeaders header, headers and origin exposed promise_test: Unhandled rejection with value: object "TypeError: Origin https://localhost:9443 is not allowed by Access-Control-Allow-Origin."
-
diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/foreign-fetch-cors.https.html b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/foreign-fetch-cors.https.html
deleted file mode 100644 (file)
index c111a31..0000000
+++ /dev/null
@@ -1,306 +0,0 @@
-<!DOCTYPE html>
-<title>Service Worker: Foreign Fetch CORS functionality</title>
-<script src="/resources/testharness.js"></script>
-<script src="/resources/testharnessreport.js"></script>
-<script src="/common/get-host-info.sub.js"></script>
-<script src="resources/test-helpers.sub.js"></script>
-<script src="resources/foreign-fetch-helpers.js"></script>
-<body>
-<script>
-var host_info = get_host_info();
-var origin = new URL(self.location).origin;
-var wrong_origin = 'https://example.com/';
-var test_header = 'X-ServiceWorker-ServerHeader';
-
-function url_to_fetch(scope) {
-  return host_info.HTTPS_REMOTE_ORIGIN + new URL('resources/', location).pathname + scope;
-}
-
-function worker_for_response(response) {
-  return 'foreign-fetch-cors-worker.js?' +
-      encodeURIComponent(JSON.stringify(response));
-}
-
-function scope_for_params(params) {
-  return 'simple.txt?' + encodeURIComponent(JSON.stringify(params));
-}
-
-// Method used for tests that expect to result in an opaque response.
-function verify_opaque_fetch(url, t) {
-  return promise_rejects(t, new TypeError(), fetch(url))
-    .then(() => fetch(url, {mode: 'no-cors'}))
-    .then(response => assert_equals(response.type, 'opaque'))
-    .then(() => new Promise(resolve => {
-        var request = new XMLHttpRequest();
-        request.open('GET', url);
-        request.onreadystatechange = () => {
-          if (request.readyState == 4) resolve(request);
-        };
-        request.send();
-      }))
-    .then(xhr => {
-        assert_equals(xhr.status, 0);
-        assert_equals(xhr.responseText, '');
-      });
-}
-
-// Verify that fetching an url results in a network error.
-function verify_network_error(url, t) {
-  return promise_rejects(t, new TypeError(), fetch(url))
-    .then(() => promise_rejects(t, new TypeError(),
-                                fetch(url, {mode: 'no-cors'})))
-    .then(() => new Promise(resolve => {
-        var request = new XMLHttpRequest();
-        request.open('GET', url);
-        request.onreadystatechange = () => {
-          if (request.readyState == 4) resolve(request);
-        };
-        request.send();
-      }))
-    .then(xhr => {
-        assert_equals(xhr.status, 0);
-        assert_equals(xhr.responseText, '');
-      });
-}
-
-// Verifies that fetching the URL returns a cors response, with a specific value
-// for a test_header on the response. Also verifies that round-tripping this
-// response through the cache doesn't cause issues.
-function verify_cors_fetch_with_header_value(url, header_value) {
-  var response;
-  var cache;
-  return fetch(url)
-    .then(r => {
-        response = r.clone();
-        assert_equals(r.type, 'cors');
-        assert_equals(r.headers.get(test_header), header_value, 'From fetch');
-        return r.text();
-      })
-    .then(response_text => {
-        assert_true(response_text.startsWith('report('),
-            'Correct content via fetch');
-        return self.caches.open(url);
-      })
-    .then(c => {
-        cache = c;
-        return cache.put(url, response);
-      })
-    .then(() => cache.match(url))
-    .then(r => {
-        assert_equals(r.type, 'cors');
-        assert_equals(r.headers.get(test_header), header_value, 'From cache');
-        return r.text();
-      })
-    .then(response_text => {
-        assert_true(response_text.startsWith('report('),
-            'Correct content via cache');
-        return self.caches.delete(url);
-      })
-    .then(() => new Promise(resolve => {
-        var request = new XMLHttpRequest();
-        request.open('GET', url);
-        request.onreadystatechange = () => {
-          if (request.readyState == 4) resolve(request);
-        };
-        request.send();
-      }))
-    .then(xhr => {
-        assert_true(xhr.responseText.startsWith('report('),
-            'Correct content via xhr');
-        assert_equals(xhr.getResponseHeader(test_header), header_value);
-        var headers = xhr.getAllResponseHeaders().toLowerCase();
-        if (header_value) {
-          assert_true(headers.includes(test_header.toLowerCase() + ': ' +
-                                       header_value.toLowerCase()));
-        } else {
-          assert_false(headers.includes(test_header.toLowerCase()));
-        }
-      });
-}
-
-verify_cors_fetch_with_header =
-    url => verify_cors_fetch_with_header_value(url, 'SetInTheServer');
-verify_cors_fetch_without_header =
-    url => verify_cors_fetch_with_header_value(url, null);
-
-var tests = [
-  {
-    description: 'Same origin fetch without CORS headers, not exposed',
-    params: {
-      cross_origin: false,
-      with_aceheaders: false,
-      with_acaorigin: false
-    },
-    response: {},
-    expectation: verify_opaque_fetch
-  },
-  {
-    description: 'Same origin fetch without CORS headers, only origin exposed',
-    params: {
-      cross_origin: false,
-      with_aceheaders: false,
-      with_acaorigin: false
-    },
-    response: {origin: origin},
-    expectation: verify_cors_fetch_without_header
-  },
-  {
-    description:
-        'Same origin fetch without CORS headers, headers and origin exposed',
-    params: {
-      cross_origin: false,
-      with_aceheaders: false,
-      with_acaorigin: false
-    },
-    response: {origin: origin, headers: [test_header]},
-    expectation: verify_cors_fetch_with_header
-  },
-  {
-    description:
-        'Same origin fetch without CORS headers, exposed to wrong origin',
-    params: {
-      cross_origin: false,
-      with_aceheaders: false,
-      with_acaorigin: false
-    },
-    response: {origin: wrong_origin, headers: [test_header]},
-    expectation: verify_network_error
-  },
-  {
-    description: 'Same origin fetch with CORS headers, not exposed',
-    params: {
-      cross_origin: false,
-      with_aceheaders: true,
-      with_acaorigin: true
-    },
-    response: {},
-    expectation: verify_opaque_fetch
-  },
-  {
-    description: 'Same origin fetch with CORS headers, only origin exposed',
-    params: {
-      cross_origin: false,
-      with_aceheaders: true,
-      with_acaorigin: true
-    },
-    response: {origin: origin},
-    expectation: verify_cors_fetch_without_header
-  },
-  {
-    description:
-        'Same origin fetch with CORS headers, headers and origin exposed',
-    params: {
-      cross_origin: false,
-      with_aceheaders: true,
-      with_acaorigin: true
-    },
-    response: {origin: origin, headers: [test_header]},
-    expectation: verify_cors_fetch_with_header
-  },
-  {
-    description: 'Same origin fetch with CORS headers, exposed to wrong origin',
-    params: {
-      cross_origin: false,
-      with_aceheaders: true,
-      with_acaorigin: true
-    },
-    response: {origin: wrong_origin, headers: [test_header]},
-    expectation: verify_network_error
-  },
-  {
-    description: 'Cross origin fetch without CORS headers, not exposed',
-    params: {
-      cross_origin: true,
-      with_aceheaders: false,
-      with_acaorigin: false
-    },
-    response: {},
-    expectation: verify_opaque_fetch
-  },
-  {
-    description: 'Cross origin fetch with ACEHeaders header, not exposed',
-    params: {
-      cross_origin: true,
-      with_aceheaders: true,
-      with_acaorigin: true
-    },
-    response: {},
-    expectation: verify_opaque_fetch
-  },
-  {
-    description:
-        'Cross origin fetch with ACEHeaders header, only origin exposed',
-    params: {
-      cross_origin: true,
-      with_aceheaders: true,
-      with_acaorigin: true
-    },
-    response: {origin: origin},
-    expectation: verify_cors_fetch_without_header
-  },
-  {
-    description:
-        'Cross origin fetch with ACEHeaders header, headers and origin exposed',
-    params: {
-      cross_origin: true,
-      with_aceheaders: true,
-      with_acaorigin: true
-    },
-    response: {origin: origin, headers: [test_header]},
-    expectation: verify_cors_fetch_with_header
-  },
-  {
-    description:
-        'Cross origin fetch with ACEHeaders header, exposed to wrong origin',
-    params: {
-      cross_origin: true,
-      with_aceheaders: true,
-      with_acaorigin: true
-    },
-    response: {origin: wrong_origin, headers: [test_header]},
-    expectation: verify_network_error
-  },
-  {
-    description: 'Cross origin fetch without ACEHeaders header, not exposed',
-    params: {
-      cross_origin: true,
-      with_aceheaders: false,
-      with_acaorigin: true
-    },
-    response: {},
-    expectation: verify_opaque_fetch
-  },
-  {
-    description:
-        'Cross origin fetch without ACEHeaders header, only origin exposed',
-    params: {
-      cross_origin: true,
-      with_aceheaders: false,
-      with_acaorigin: true
-    },
-    response: {origin: origin},
-    expectation: verify_cors_fetch_without_header
-  },
-  {
-    description: 'Cross origin fetch without ACEHeaders header, ' +
-                 'headers and origin exposed',
-    params: {
-      cross_origin: true,
-      with_aceheaders: false,
-      with_acaorigin: true
-    },
-    response: {origin: origin, headers: [test_header]},
-    expectation: verify_cors_fetch_without_header
-  }
-];
-
-for (var i = 0; i < tests.length; ++i) (data => {
-  promise_test(t => {
-      var scope = scope_for_params(data.params);
-      var worker = worker_for_response(data.response);
-      return install_cross_origin_worker(t, worker, scope)
-        .then(() => data.expectation(url_to_fetch(scope), t));
-    }, data.description);
-})(tests[i]);
-</script>
-</body>
diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/foreign-fetch-event.https-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/foreign-fetch-event.https-expected.txt
deleted file mode 100644 (file)
index afabfbd..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-
-PASS ForeignFetchEvent constructor 
-FAIL ForeignFetchEvent constructor with no init dict assert_throws: function "function () {
-            new ForeignFetchEvent('type');
-          }" threw object "ReferenceError: Can't find variable: ForeignFetchEvent" ("ReferenceError") expected object "TypeError" ("TypeError")
-FAIL ForeignFetchEvent constructor with empty init dict assert_throws: function "function () {
-            new ForeignFetchEvent('type', {});
-          }" threw object "ReferenceError: Can't find variable: ForeignFetchEvent" ("ReferenceError") expected object "TypeError" ("TypeError")
-FAIL ForeignFetchEvent constructor with null request assert_throws: function "function () {
-            new ForeignFetchEvent('type', { request: null });
-          }" threw object "ReferenceError: Can't find variable: ForeignFetchEvent" ("ReferenceError") expected object "TypeError" ("TypeError")
-FAIL ForeignFetchEvent constructor with all init dict members Can't find variable: ForeignFetchEvent
-
diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/foreign-fetch-event.https.html b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/foreign-fetch-event.https.html
deleted file mode 100644 (file)
index 94eeda3..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-<!DOCTYPE html>
-<title>Service Worker: ForeignFetchEvent</title>
-<script src="/resources/testharness.js"></script>
-<script src="/resources/testharnessreport.js"></script>
-<script src="resources/test-helpers.sub.js"></script>
-<script>
-service_worker_test('resources/foreign-fetch-event-worker.js',
-                    'ForeignFetchEvent constructor');
-</script>
diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/foreign-fetch-workers.https-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/foreign-fetch-workers.https-expected.txt
deleted file mode 100644 (file)
index da831b8..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-  
-
-Harness Error (TIMEOUT), message = null
-
-TIMEOUT Foreign fetch can intercept fetches made from a service worker Test timed out
-NOTRUN Foreign fetch can intercept fetches made from a dedicated worker 
-NOTRUN Foreign fetch can intercept fetches made from a shared worker 
-NOTRUN Fetches from an insecure dedicated worker aren't intercepted. 
-NOTRUN Fetches from an insecure shared worker aren't intercepted. 
-
diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/foreign-fetch-workers.https.html b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/foreign-fetch-workers.https.html
deleted file mode 100644 (file)
index 6597290..0000000
+++ /dev/null
@@ -1,88 +0,0 @@
-<!DOCTYPE html>
-<script src="/resources/testharness.js"></script>
-<script src="/resources/testharnessreport.js"></script>
-<script src="/common/get-host-info.sub.js"></script>
-<script src="resources/test-helpers.sub.js"></script>
-<script src="resources/foreign-fetch-helpers.js"></script>
-<body>
-<script>
-var host_info = get_host_info();
-var ff_worker = 'foreign-fetch-worker.js?{}';
-var resource_path = new URL('resources/', location).pathname;
-
-promise_test(t => {
-    var ff_scope = 'simple.txt?basic_sw';
-    var worker = 'resources/foreign-fetch-helper-worker.js';
-    var scope = 'resources/simple.html?foreignfetch';
-    return install_cross_origin_worker(t, ff_worker, ff_scope)
-      .then(() => service_worker_unregister_and_register(t, worker, scope))
-      .then(r => {
-          add_completion_callback(() => r.unregister());
-          return wait_for_state(t, r.installing, 'activated');
-        })
-      .then(() => with_iframe(scope))
-      .then(frame => {
-          assert_equals(frame.contentDocument.body.innerText, 'Foreign Fetch');
-        });
-  }, 'Foreign fetch can intercept fetches made from a service worker');
-
-promise_test(t => {
-    let scope = 'simple.txt?basic_dedicated';
-    let remote_url = host_info.HTTPS_REMOTE_ORIGIN + resource_path + scope;
-    return install_cross_origin_worker(t, ff_worker, scope)
-      .then(() => new Promise(resolve => {
-          let worker = new Worker('resources/foreign-fetch-helper-script.js');
-          let channel = new MessageChannel();
-          worker.postMessage({url: remote_url,
-                              port: channel.port1},
-                             [channel.port1]);
-          channel.port2.onmessage = reply => resolve(reply.data);
-        }))
-      .then(response => assert_equals(response, 'Success: Foreign Fetch'));
-  }, 'Foreign fetch can intercept fetches made from a dedicated worker');
-
-promise_test(t => {
-    let scope = 'simple.txt?basic_shared';
-    let remote_url = host_info.HTTPS_REMOTE_ORIGIN + resource_path + scope;
-    return install_cross_origin_worker(t, ff_worker, scope)
-      .then(() => new Promise(resolve => {
-          let worker = new SharedWorker(
-              'resources/foreign-fetch-helper-script.js');
-          let channel = new MessageChannel();
-          worker.port.postMessage({url: remote_url,
-                              port: channel.port1},
-                             [channel.port1]);
-          channel.port2.onmessage = reply => resolve(reply.data);
-        }))
-      .then(response => assert_equals(response, 'Success: Foreign Fetch'));
-  }, 'Foreign fetch can intercept fetches made from a shared worker');
-
-promise_test(t => {
-    var scope = 'simple.txt?basic_dedicated_insecure';
-    var remote_url = host_info.AUTHENTICATED_ORIGIN + resource_path + scope;
-    return install_cross_origin_worker(t, ff_worker, scope,
-                                       host_info.AUTHENTICATED_ORIGIN)
-      .then(() => fetch_from_different_origin(
-          host_info.HTTPS_REMOTE_ORIGIN, remote_url, 'dedicated'))
-      .then(response => assert_equals(response, 'Success: Foreign Fetch'))
-      .then(() => fetch_from_different_origin(
-          host_info.UNAUTHENTICATED_ORIGIN, remote_url, 'dedicated'))
-      .then(response => assert_equals(response,
-                                      'Error: TypeError: Failed to fetch'));
-  }, 'Fetches from an insecure dedicated worker aren\'t intercepted.');
-
-promise_test(t => {
-    var scope = 'simple.txt?basic_shared_insecure';
-    var remote_url = host_info.AUTHENTICATED_ORIGIN + resource_path + scope;
-    return install_cross_origin_worker(t, ff_worker, scope,
-                                       host_info.AUTHENTICATED_ORIGIN)
-      .then(() => fetch_from_different_origin(
-          host_info.HTTPS_REMOTE_ORIGIN, remote_url, 'shared'))
-      .then(response => assert_equals(response, 'Success: Foreign Fetch'))
-      .then(() => fetch_from_different_origin(
-          host_info.UNAUTHENTICATED_ORIGIN, remote_url, 'shared'))
-      .then(response => assert_equals(response,
-                                      'Error: TypeError: Failed to fetch'));
-  }, 'Fetches from an insecure shared worker aren\'t intercepted.');
-</script>
-</body>
diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/iframe-sandbox-register-link-element.https-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/iframe-sandbox-register-link-element.https-expected.txt
deleted file mode 100644 (file)
index fd109ac..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-
-Harness Error (TIMEOUT), message = null
-
-TIMEOUT registration via <link> element `rel` rejected Test timed out
-NOTRUN registration via <link> element `rel` accepted in presence of `allow-same-origin` directive 
-
diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/iframe-sandbox-register-link-element.https.html b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/iframe-sandbox-register-link-element.https.html
deleted file mode 100644 (file)
index 1d1c54e..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-<!DOCTYPE html>
-<script src="/resources/testharness.js"></script>
-<script src="/resources/testharnessreport.js"></script>
-<script src="resources/test-helpers.sub.js"></script>
-<title>Service worker registration from within sandboxed iframe</title>
-<body>
-<script>
-'use strict';
-function waitForMsg(id) {
-    return new Promise(function(resolve) {
-        window.addEventListener('message', function onMessage(event) {
-            if (!event.data || event.data.id !== id) {
-              return;
-            }
-            window.removeEventListener('message', onMessage);
-            resolve(event.data.result);
-          });
-      });
-}
-
-promise_test(function(t) {
-    var iframe = document.createElement('iframe');
-    iframe.setAttribute('src', 'resources/iframe-register-link-element.html?subtest1');
-    iframe.setAttribute('sandbox', 'allow-scripts');
-
-    document.body.appendChild(iframe);
-    t.add_cleanup(function() {
-        iframe.remove();
-      });
-
-    return waitForMsg('?subtest1')
-      .then(function(data) {
-          assert_equals(data, 'error');
-        });
-  }, 'registration via <link> element `rel` rejected');
-
-promise_test(function(t) {
-    var iframe = document.createElement('iframe');
-    iframe.setAttribute('src', 'resources/iframe-register-link-element.html?subtest2');
-    iframe.setAttribute('sandbox', 'allow-scripts allow-same-origin');
-
-    document.body.appendChild(iframe);
-    t.add_cleanup(function() {
-        iframe.remove();
-      });
-
-    return waitForMsg('?subtest2')
-      .then(function(data) {
-          assert_equals(data, 'loaded');
-        });
-  }, 'registration via <link> element `rel` accepted in presence of `allow-same-origin` directive');
-</script>
-</body>
index 1d66dbf..3c5a096 100644 (file)
@@ -49,7 +49,7 @@ PASS ServiceWorkerRegistration interface: window.registrationInstance must inher
 PASS ServiceWorkerRegistration interface: window.registrationInstance must inherit property "active" with the proper type 
 FAIL ServiceWorkerRegistration interface: window.registrationInstance must inherit property "navigationPreload" with the proper type assert_inherits: property "navigationPreload" not found in prototype chain
 PASS ServiceWorkerRegistration interface: window.registrationInstance must inherit property "scope" with the proper type 
-FAIL ServiceWorkerRegistration interface: window.registrationInstance must inherit property "updateViaCache" with the proper type Unrecognized type ServiceWorkerUpdateViaCache
+PASS ServiceWorkerRegistration interface: window.registrationInstance must inherit property "updateViaCache" with the proper type 
 PASS ServiceWorkerRegistration interface: window.registrationInstance must inherit property "update()" with the proper type 
 PASS ServiceWorkerRegistration interface: window.registrationInstance must inherit property "unregister()" with the proper type 
 PASS ServiceWorkerRegistration interface: window.registrationInstance must inherit property "onupdatefound" with the proper type 
diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/link-element-register-basic.https-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/link-element-register-basic.https-expected.txt
deleted file mode 100644 (file)
index 8f62fba..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-
-Harness Error (TIMEOUT), message = null
-
-TIMEOUT Registering normal scope Test timed out
-NOTRUN Registering scope with fragment 
-NOTRUN Registering same scope as the script directory 
-
diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/link-element-register-basic.https.html b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/link-element-register-basic.https.html
deleted file mode 100644 (file)
index 83f3f48..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-<!DOCTYPE html>
-<title>Service Worker: Register via link element (basic)</title>
-<script src="/resources/testharness.js"></script>
-<script src="/resources/testharnessreport.js"></script>
-<script src="resources/test-helpers.sub.js"></script>
-<script src="resources/registration-tests-basic.js"></script>
-<body>
-<script>
-registration_tests_basic(register_using_link, false);
-</script>
-</body>
diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/link-element-register-mime-types.https-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/link-element-register-mime-types.https-expected.txt
deleted file mode 100644 (file)
index c3d894d..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-
-Harness Error (TIMEOUT), message = null
-
-TIMEOUT Registering script with no MIME type Test timed out
-NOTRUN Registering script with bad MIME type 
-NOTRUN Registering script that imports script with no MIME type 
-NOTRUN Registering script that imports script with bad MIME type 
-NOTRUN Registering script with good MIME type application/ecmascript 
-NOTRUN Registering script that imports script with good MIME type application/ecmascript 
-NOTRUN Registering script with good MIME type application/javascript 
-NOTRUN Registering script that imports script with good MIME type application/javascript 
-NOTRUN Registering script with good MIME type application/x-ecmascript 
-NOTRUN Registering script that imports script with good MIME type application/x-ecmascript 
-NOTRUN Registering script with good MIME type application/x-javascript 
-NOTRUN Registering script that imports script with good MIME type application/x-javascript 
-NOTRUN Registering script with good MIME type text/ecmascript 
-NOTRUN Registering script that imports script with good MIME type text/ecmascript 
-NOTRUN Registering script with good MIME type text/javascript 
-NOTRUN Registering script that imports script with good MIME type text/javascript 
-NOTRUN Registering script with good MIME type text/javascript1.0 
-NOTRUN Registering script that imports script with good MIME type text/javascript1.0 
-NOTRUN Registering script with good MIME type text/javascript1.1 
-NOTRUN Registering script that imports script with good MIME type text/javascript1.1 
-NOTRUN Registering script with good MIME type text/javascript1.2 
-NOTRUN Registering script that imports script with good MIME type text/javascript1.2 
-NOTRUN Registering script with good MIME type text/javascript1.3 
-NOTRUN Registering script that imports script with good MIME type text/javascript1.3 
-NOTRUN Registering script with good MIME type text/javascript1.4 
-NOTRUN Registering script that imports script with good MIME type text/javascript1.4 
-NOTRUN Registering script with good MIME type text/javascript1.5 
-NOTRUN Registering script that imports script with good MIME type text/javascript1.5 
-NOTRUN Registering script with good MIME type text/jscript 
-NOTRUN Registering script that imports script with good MIME type text/jscript 
-NOTRUN Registering script with good MIME type text/livescript 
-NOTRUN Registering script that imports script with good MIME type text/livescript 
-NOTRUN Registering script with good MIME type text/x-ecmascript 
-NOTRUN Registering script that imports script with good MIME type text/x-ecmascript 
-NOTRUN Registering script with good MIME type text/x-javascript 
-NOTRUN Registering script that imports script with good MIME type text/x-javascript 
-
diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/link-element-register-mime-types.https.html b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/link-element-register-mime-types.https.html
deleted file mode 100644 (file)
index beb7d58..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-<!DOCTYPE html>
-<title>Service Worker: Register via link element (MIME types)</title>
-<script src="/resources/testharness.js"></script>
-<script src="/resources/testharnessreport.js"></script>
-<script src="resources/test-helpers.sub.js"></script>
-<script src="resources/registration-tests-mime-types.js"></script>
-<body>
-<script>
-registration_tests_mime_types(register_using_link, false);
-</script>
-</body>
diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/link-element-register-scope.https-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/link-element-register-scope.https-expected.txt
deleted file mode 100644 (file)
index 7c05197..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-
-Harness Error (TIMEOUT), message = null
-
-TIMEOUT Scope including URL-encoded slash Test timed out
-NOTRUN Scope including URL-encoded backslash 
-NOTRUN Scope including URL-encoded multibyte characters 
-NOTRUN Scope including non-escaped multibyte characters 
-NOTRUN Scope including self-reference 
-NOTRUN Scope including parent-reference 
-NOTRUN Scope including consecutive slashes 
-NOTRUN Scope URL is same-origin filesystem: URL 
-
diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/link-element-register-scope.https.html b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/link-element-register-scope.https.html
deleted file mode 100644 (file)
index 1b75c38..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-<!DOCTYPE html>
-<title>Service Worker: Register via link element (scope)</title>
-<script src="/resources/testharness.js"></script>
-<script src="/resources/testharnessreport.js"></script>
-<script src="resources/test-helpers.sub.js"></script>
-<script src="resources/registration-tests-scope.js"></script>
-<body>
-<script>
-registration_tests_scope(register_using_link, false);
-</script>
-</body>
-
diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/link-element-register-script-url.https-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/link-element-register-script-url.https-expected.txt
deleted file mode 100644 (file)
index 6868f3b..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-
-Harness Error (TIMEOUT), message = null
-
-TIMEOUT Script URL including URL-encoded slash Test timed out
-NOTRUN Script URL including uppercase URL-encoded slash 
-NOTRUN Script URL including URL-encoded backslash 
-NOTRUN Script URL including uppercase URL-encoded backslash 
-NOTRUN Script URL including self-reference 
-NOTRUN Script URL including parent-reference 
-
diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/link-element-register-script-url.https.html b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/link-element-register-script-url.https.html
deleted file mode 100644 (file)
index 48cb935..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-<!DOCTYPE html>
-<title>Service Worker: Register via link element (scriptURL)</title>
-<script src="/resources/testharness.js"></script>
-<script src="/resources/testharnessreport.js"></script>
-<script src="resources/test-helpers.sub.js"></script>
-<script src="resources/registration-tests-script-url.js"></script>
-<body>
-<script>
-registration_tests_script_url(register_using_link, false);
-</script>
-</body>
diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/link-element-register-script.https-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/link-element-register-script.https-expected.txt
deleted file mode 100644 (file)
index f0d991b..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-
-Harness Error (TIMEOUT), message = null
-
-TIMEOUT Registering invalid chunked encoding script Test timed out
-NOTRUN Registering invalid chunked encoding script with flush 
-NOTRUN Registering script including parse error 
-NOTRUN Registering script including undefined error 
-NOTRUN Registering script including uncaught exception 
-NOTRUN Registering script importing malformed script 
-NOTRUN Registering non-existent script 
-NOTRUN Registering script importing non-existent script 
-NOTRUN Registering script including caught exception 
-
diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/link-element-register-script.https.html b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/link-element-register-script.https.html
deleted file mode 100644 (file)
index 4a2818d..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-<!DOCTYPE html>
-<title>Service Worker: Register via link element (script)</title>
-<script src="/resources/testharness.js"></script>
-<script src="/resources/testharnessreport.js"></script>
-<script src="resources/test-helpers.sub.js"></script>
-<script src="resources/registration-tests-script.js"></script>
-<body>
-<script>
-registration_tests_script(register_using_link, false);
-</script>
-</body>
diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/link-element-register-security-error.https-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/link-element-register-security-error.https-expected.txt
deleted file mode 100644 (file)
index 047f636..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-
-Harness Error (TIMEOUT), message = null
-
-TIMEOUT Registering same scope as the script directory without the last slash Test timed out
-NOTRUN Registration scope outside the script directory 
-NOTRUN Registering scope outside domain 
-NOTRUN Registering script outside domain 
-NOTRUN Registering redirected script 
-NOTRUN Scope including parent-reference and not under the script directory 
-NOTRUN Script URL including consecutive slashes 
-NOTRUN Script URL is same-origin filesystem: URL 
-
diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/link-element-register-security-error.https.html b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/link-element-register-security-error.https.html
deleted file mode 100644 (file)
index eae421d..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-<!DOCTYPE html>
-<title>Service Worker: Register via link element (SecurityError)</title>
-<script src="/resources/testharness.js"></script>
-<script src="/resources/testharnessreport.js"></script>
-<script src="resources/test-helpers.sub.js"></script>
-<script src="resources/registration-tests-security-error.js"></script>
-<body>
-<script>
-registration_tests_security_error(register_using_link, false);
-</script>
-</body>
diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/register-foreign-fetch-errors.https-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/register-foreign-fetch-errors.https-expected.txt
deleted file mode 100644 (file)
index 40c49f4..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-
-PASS foreign fetch registration 
-PASS Invalid options 
-PASS Scopes not an array 
-PASS Scopes not a string in array 
-PASS Relative url not under scope 
-PASS Absolute url not under scope 
-PASS Empty scope array 
-FAIL Call after event returned assert_throws: function "function () {
-                event.registerForeignFetch({scopes: [scope], origins: ['*']});
-              }" threw object "TypeError: event.registerForeignFetch is not a function. (In 'event.registerForeignFetch({scopes: [scope], origins: ['*']})', 'event.registerForeignFetch' is undefined)" that is not a DOMException InvalidStateError: property "code" is equal to undefined, expected 11
-FAIL Valid scopes with wildcard origin string event.registerForeignFetch is not a function. (In 'event.registerForeignFetch({scopes: [scope], origins: ['*']})', 'event.registerForeignFetch' is undefined)
-FAIL Absolute urls event.registerForeignFetch is not a function. (In 'event.registerForeignFetch({scopes: [scope, scope + '/foo'], origins: ['*']})', 'event.registerForeignFetch' is undefined)
-FAIL Relative urls undefined is not a function (near '...event.registerForeignFetch...')
-PASS No origins specified 
-PASS Origins not a string or array 
-PASS Origins contains something not a string 
-PASS Origin not an absolute URL 
-FAIL Wildcard origin string in array event.registerForeignFetch is not a function. (In 'event.registerForeignFetch({scopes: [scope], origins: ['*']})', 'event.registerForeignFetch' is undefined)
-PASS Origin string 
-FAIL Origin string in array event.registerForeignFetch is not a function. (In 'event.registerForeignFetch({scopes: [scope], origins: ['https://example.com/']})', 'event.registerForeignFetch' is undefined)
-FAIL Array with multiple origins event.registerForeignFetch is not a function. (In 'event.registerForeignFetch({
-            scopes: [scope], origins: ['https://example.com/', 'https://chromium.org']})', 'event.registerForeignFetch' is undefined)
-PASS Origins includes wildcard and other strings 
-PASS Origins includes other strings and wildcard 
-
diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/register-foreign-fetch-errors.https.html b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/register-foreign-fetch-errors.https.html
deleted file mode 100644 (file)
index 8eae074..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-<!DOCTYPE html>
-<script src="/resources/testharness.js"></script>
-<script src="/resources/testharnessreport.js"></script>
-<script src="resources/test-helpers.sub.js"></script>
-<script>
-service_worker_test('resources/register-foreign-fetch-errors-worker.js',
-                    'foreign fetch registration');
-</script>
diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/register-link-header.https-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/register-link-header.https-expected.txt
deleted file mode 100644 (file)
index b51f073..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-
-FAIL fetch can trigger service worker installation promise_test: Unhandled rejection with value: object "UnknownError: serviceWorker.ready() is not yet implemented"
-FAIL An iframe can trigger service worker installation promise_test: Unhandled rejection with value: object "UnknownError: serviceWorker.ready() is not yet implemented"
-FAIL A stylesheet can trigger service worker installation promise_test: Unhandled rejection with value: object "UnknownError: serviceWorker.ready() is not yet implemented"
-
diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/register-link-header.https.html b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/register-link-header.https.html
deleted file mode 100644 (file)
index dd71c9b..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-<!DOCTYPE html>
-<title>Service Worker: Registration using Link header</title>
-<script src="/resources/testharness.js"></script>
-<script src="/resources/testharnessreport.js"></script>
-<script src="resources/test-helpers.sub.js"></script>
-<body>
-<script>
-function get_newest_worker(registration) {
-  if (registration.installing)
-    return registration.installing;
-  if (registration.waiting)
-    return registration.waiting;
-  if (registration.active)
-    return registration.active;
-}
-
-promise_test(function(t) {
-    var scope = normalizeURL('resources/blank.html?fetch');
-    var header = '<empty-worker.js>; rel=serviceworker; scope="' + scope + '"';
-    var resource = 'resources/link-header.py?Link=' +
-        encodeURIComponent(header);
-    return with_iframe(scope)
-      .then(frame =>
-          Promise.all([frame.contentWindow.navigator.serviceWorker.ready,
-                      fetch(resource)]))
-      .then(([registration, response]) => {
-          assert_equals(registration.scope, scope);
-          assert_equals(get_newest_worker(registration).scriptURL,
-                        normalizeURL('resources/empty-worker.js'));
-          return registration.unregister();
-        });
-  }, 'fetch can trigger service worker installation');
-
-promise_test(function(t) {
-    var scope = normalizeURL('resources/blank.html?iframe');
-    var header = '<empty-worker.js>; rel=serviceworker; scope="' + scope + '"';
-    var resource = 'resources/link-header.py?Link=' +
-        encodeURIComponent(header);
-    return with_iframe(scope)
-      .then(frame =>
-          Promise.all([frame.contentWindow.navigator.serviceWorker.ready,
-                       with_iframe(resource)]))
-      .then(([registration, frame]) => {
-          assert_equals(registration.scope, scope);
-          assert_equals(get_newest_worker(registration).scriptURL,
-                        normalizeURL('resources/empty-worker.js'));
-          return registration.unregister();
-        });
-  }, 'An iframe can trigger service worker installation');
-
-promise_test(function(t) {
-    var scope = normalizeURL('resources/blank.html?css');
-    var header = '<empty-worker.js>; rel=serviceworker; scope="' + scope + '"';
-    var resource = 'resources/link-header.py?Link=' +
-        encodeURIComponent(header);
-    return with_iframe(scope)
-      .then(frame => {
-          var link = document.createElement('link');
-          link.setAttribute('rel', 'stylesheet');
-          link.setAttribute('type', 'text/css');
-          link.setAttribute('href', resource);
-          document.getElementsByTagName('head')[0].appendChild(link);
-          return frame.contentWindow.navigator.serviceWorker.ready;
-        })
-      .then(registration => {
-          assert_equals(registration.scope, scope);
-          assert_equals(get_newest_worker(registration).scriptURL,
-                        normalizeURL('resources/empty-worker.js'));
-          return registration.unregister();
-        });
-  }, 'A stylesheet can trigger service worker installation');
-
-</script>
index 4d98270..180c79c 100644 (file)
@@ -1,16 +1,8 @@
 
-FAIL register-via-api-updateViaCache-undefined assert_not_equals: Main script should have updated got disallowed value 1510380120.157005
-FAIL register-via-api-updateViaCache-imports assert_not_equals: Main script should have updated got disallowed value 1510380120.495792
-FAIL register-via-api-updateViaCache-all assert_equals: No new service worker expected null but got object "[object ServiceWorker]"
-FAIL register-via-api-updateViaCache-none assert_not_equals: Main script should have updated got disallowed value 1510380120.846384
-FAIL register-via-link-element-updateViaCache-undefined promise_test: Unhandled rejection with value: object "Error: link rel=serviceworker not supported"
-FAIL register-via-link-element-updateViaCache-imports promise_test: Unhandled rejection with value: object "Error: link rel=serviceworker not supported"
-FAIL register-via-link-element-updateViaCache-all promise_test: Unhandled rejection with value: object "Error: link rel=serviceworker not supported"
-FAIL register-via-link-element-updateViaCache-none promise_test: Unhandled rejection with value: object "Error: link rel=serviceworker not supported"
-FAIL register-via-link-header-updateViaCache-undefined promise_test: Unhandled rejection with value: object "Error: link rel=serviceworker not supported"
-FAIL register-via-link-header-updateViaCache-imports promise_test: Unhandled rejection with value: object "Error: link rel=serviceworker not supported"
-FAIL register-via-link-header-updateViaCache-all promise_test: Unhandled rejection with value: object "Error: link rel=serviceworker not supported"
-FAIL register-via-link-header-updateViaCache-none promise_test: Unhandled rejection with value: object "Error: link rel=serviceworker not supported"
+FAIL register-with-updateViaCache-undefined assert_not_equals: Main script should have updated got disallowed value 1512338030.075291
+FAIL register-with-updateViaCache-imports assert_not_equals: Main script should have updated got disallowed value 1512338030.414841
+FAIL register-with-updateViaCache-all assert_equals: No new service worker expected null but got object "[object ServiceWorker]"
+FAIL register-with-updateViaCache-none assert_not_equals: Main script should have updated got disallowed value 1512338030.773353
 PASS register-with-updateViaCache-undefined-then-undefined 
 PASS register-with-updateViaCache-undefined-then-imports 
 FAIL register-with-updateViaCache-undefined-then-all assert_equals: reg.updateViaCache updated expected "all" but got "imports"
index 0df401e..b1fd902 100644 (file)
     });
   }
 
-  function registerViaApi(scriptUrl, opts) {
-    return navigator.serviceWorker.register(scriptUrl, opts);
-  }
-
-  function registerViaLinkElement(scriptUrl, opts) {
-    return new Promise((resolve, reject) => {
-      const link = document.createElement('link');
-
-      if (link.relList.supports('serviceworker') == false) throw Error("link rel=serviceworker not supported");
-
-      link.rel = 'serviceworker';
-      link.href = scriptUrl;
-      link.scope = opts.scope;
-
-      if (opts.updateViaCache) {
-        link.updateViaCache = opts.updateViaCache;
-      }
-
-      link.onload = async () => {
-        const fullScope = new URL(opts.scope, window.location).href;
-
-        const regs = await navigator.serviceWorker.getRegistrations();
-        const reg = regs.find(r => r.scope == fullScope && (r.installing || r.waiting || r.active));
-
-        if (reg) {
-          document.head.removeChild(link);
-          resolve(reg);
-        }
-        else {
-          reject(Error('Service worker not registered'));
-        }
-      };
-
-      document.head.appendChild(link);
-    });
-  }
-
-  async function registerViaLinkHeader(scriptUrl, opts) {
-    const link = document.createElement('link');
-
-    const fullScope = new URL(opts.scope, window.location).href;
-    scriptUrl = new URL(scriptUrl, location).href;
-
-    // Assume that if the link element doesn't support serviceworker, the header doesn't either.
-    if (link.relList.supports('serviceworker') == false) throw Error("link rel=serviceworker not supported");
-
-    let linkHeader = `<${scriptUrl}>; rel=serviceworker; scope="${fullScope}"`;
-
-    if (opts.updateViaCache) {
-      linkHeader += `; updateviacache="${opts.updateViaCache}"`;
-    }
-
-    const linkHeaderSenderURL = new URL('resources/link-header.py', location);
-    linkHeaderSenderURL.searchParams.set('Link', linkHeader);
-
-    await fetch(linkHeaderSenderURL);
-    const frame = await with_iframe(fullScope);
-    await frame.contentWindow.navigator.serviceWorker.ready;
-
-    const regs = await navigator.serviceWorker.getRegistrations();
-    const reg = regs.find(r => r.scope == fullScope && (r.installing || r.waiting || r.active));
-
-    if (!reg) throw Error('Service worker not registered');
-
-    frame.parentNode.removeChild(frame);
-    return reg;
-  }
-
-  const registrationMethods = [
-    [registerViaApi, 'via-api'],
-    [registerViaLinkElement, 'via-link-element'],
-    [registerViaLinkHeader, 'via-link-header']
-  ];
-
   // Test creating registrations & triggering an update.
-  for (const [registrationMethod, registrationMethodName] of registrationMethods) {
-    for (const updateViaCache of UPDATE_VIA_CACHE_VALUES) {
-      const testName = `register-${registrationMethodName}-updateViaCache-${updateViaCache}`;
+  for (const updateViaCache of UPDATE_VIA_CACHE_VALUES) {
+    const testName = `register-with-updateViaCache-${updateViaCache}`;
 
-      promise_test(async t => {
-        await cleanup();
+    promise_test(async t => {
+      await cleanup();
 
-        const opts = {scope: SCOPE};
+      const opts = {scope: SCOPE};
 
-        if (updateViaCache) opts.updateViaCache = updateViaCache;
+      if (updateViaCache) opts.updateViaCache = updateViaCache;
 
-        const reg = await registrationMethod(
-          `${SCRIPT_URL}?test=${testName}`,
-          opts
-        );
+      const reg = await navigator.serviceWorker.register(
+        `${SCRIPT_URL}?test=${testName}`,
+        opts
+      );
 
-        assert_equals(reg.updateViaCache, updateViaCache || 'imports', "reg.updateViaCache");
+      assert_equals(reg.updateViaCache, updateViaCache || 'imports', "reg.updateViaCache");
 
-        const sw = reg.installing || reg.waiting || reg.active;
-        await wait_for_state(t, sw, 'activated');
-        const values = await getScriptTimes(sw, testName);
-        await reg.update();
+      const sw = reg.installing || reg.waiting || reg.active;
+      await wait_for_state(t, sw, 'activated');
+      const values = await getScriptTimes(sw, testName);
+      await reg.update();
 
-        if (updateViaCache == 'all') {
-          assert_equals(reg.installing, null, "No new service worker");
+      if (updateViaCache == 'all') {
+        assert_equals(reg.installing, null, "No new service worker");
+      }
+      else {
+        const newWorker = reg.installing;
+        assert_true(!!newWorker, "New worker installing");
+        const newValues = await getScriptTimes(newWorker, testName);
+
+        if (!updateViaCache || updateViaCache == 'imports') {
+          assert_not_equals(values.mainTime, newValues.mainTime, "Main script should have updated");
+          assert_equals(values.importTime, newValues.importTime, "Imported script should be the same");
+        }
+        else if (updateViaCache == 'none') {
+          assert_not_equals(values.mainTime, newValues.mainTime, "Main script should have updated");
+          assert_not_equals(values.importTime, newValues.importTime, "Imported script should have updated");
         }
         else {
-          const newWorker = reg.installing;
-          assert_true(!!newWorker, "New worker installing");
-          const newValues = await getScriptTimes(newWorker, testName);
-
-          if (!updateViaCache || updateViaCache == 'imports') {
-            assert_not_equals(values.mainTime, newValues.mainTime, "Main script should have updated");
-            assert_equals(values.importTime, newValues.importTime, "Imported script should be the same");
-          }
-          else if (updateViaCache == 'none') {
-            assert_not_equals(values.mainTime, newValues.mainTime, "Main script should have updated");
-            assert_not_equals(values.importTime, newValues.importTime, "Imported script should have updated");
-          }
-          else {
-            // We should have handled all of the possible values for updateViaCache.
-            // If this runs, something's gone very wrong.
-            throw Error(`Unexpected updateViaCache value: ${updateViaCache}`);
-          }
+          // We should have handled all of the possible values for updateViaCache.
+          // If this runs, something's gone very wrong.
+          throw Error(`Unexpected updateViaCache value: ${updateViaCache}`);
         }
+      }
 
-        await cleanup();
-      }, testName);
-    }
+      await cleanup();
+    }, testName);
   }
 
   // Test changing the updateViaCache value of an existing registration.
index 3b37827..ebbcea1 100644 (file)
@@ -1,3 +1,5 @@
+Blocked access to external URL https://www1.localhost:9443/service-workers/service-worker/resources/missing.jpg
+Blocked access to external URL https://www1.localhost:9443/service-workers/service-worker/resources/missing.jpg
 
 
 FAIL Controlled resource loads assert_unreached: unexpected rejection: assert_greater_than: Generated response expected a number greater than 0 but got 0 Reached unreachable code
index c38bfc9..da898e2 100644 (file)
@@ -8,13 +8,25 @@ function resourceUrl(path) {
     return get_host_info()['HTTPS_ORIGIN'] + base_path() + path;
 }
 
-function verify(performance, resource, description) {
-    var entry = performance.getEntriesByName(resourceUrl(resource))[0];
+function crossOriginUrl(path) {
+    return get_host_info()['HTTPS_REMOTE_ORIGIN'] + base_path() + path;
+}
+
+function verify(performance, resource, mode, description) {
+    var url = mode === 'cross-origin' ? crossOriginUrl(resource)
+                                      : resourceUrl(resource);
+    var entryList = performance.getEntries();
+    var entry = performance.getEntriesByName(url)[0];
     assert_greater_than(entry.workerStart, 0, description);
     assert_greater_than_equal(entry.workerStart, entry.startTime, description);
     assert_less_than_equal(entry.workerStart, entry.fetchStart, description);
-    assert_greater_than_equal(entry.responseStart, entry.fetchStart, description);
-    assert_greater_than_equal(entry.responseEnd, entry.responseStart, description);
+    if (mode === 'cross-origin') {
+      assert_equals(entry.responseStart, 0, description);
+      assert_greater_than_equal(entry.responseEnd, entry.fetchStart, description);
+    } else {
+      assert_greater_than_equal(entry.responseStart, entry.fetchStart, description);
+      assert_greater_than_equal(entry.responseEnd, entry.responseStart, description);
+    }
     assert_greater_than(entry.responseEnd, entry.fetchStart, description);
     assert_greater_than(entry.duration, 0, description);
     if (resource.indexOf('redirect.py') != -1) {
@@ -27,7 +39,7 @@ function verify(performance, resource, description) {
 
 async_test(function(t) {
     var worker_url = 'resources/resource-timing-worker.js';
-    var scope = 'resources/resource-timing-iframe.html';
+    var scope = 'resources/resource-timing-iframe.sub.html';
     var registration;
 
     service_worker_unregister_and_register(t, worker_url, scope)
@@ -40,10 +52,20 @@ async_test(function(t) {
         })
       .then(function(frame) {
           var performance = frame.contentWindow.performance;
-          verify(performance, 'resources/dummy.js', 'Generated response');
-          verify(performance, 'resources/empty.js', 'Network fallback');
+          verify(performance, 'resources/dummy.js', 'same-origin',
+                 'Generated response');
+          verify(performance, 'resources/empty.js', 'same-origin',
+                 'Network fallback');
           verify(performance, 'resources/redirect.py?Redirect=empty.js',
-                 'Redirect');
+                 'same-origin', 'Redirect');
+          verify(performance, 'resources/missing.jpg', 'same-origin',
+                 'Network fallback image');
+
+          // Test that worker start is available on cross-origin no-cors
+          // subresources.
+          verify(performance, 'resources/missing.jpg', 'cross-origin',
+                 'Network fallback cross-origin image');
+
           frame.remove();
           return registration.unregister();
         })
diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/about-blank-replacement-frame.py b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/about-blank-replacement-frame.py
new file mode 100644 (file)
index 0000000..643142d
--- /dev/null
@@ -0,0 +1,31 @@
+def main(request, response):
+  if 'nested' in request.GET:
+    return (
+      [('Content-Type', 'text/html')],
+      'failed: nested frame was not intercepted by the service worker'
+    )
+
+  return ([('Content-Type', 'text/html')], """
+<!doctype html>
+<html>
+<body>
+<script>
+function nestedLoaded() {
+  parent.postMessage({ type: 'NESTED_LOADED' }, '*');
+}
+</script>
+<iframe src="?nested=true" id="nested" onload="nestedLoaded()"></iframe>
+<script>
+// Helper routine to make it slightly easier for our parent to find
+// the nested frame.
+function nested() {
+  return document.getElementById('nested').contentWindow;
+}
+
+// NOTE: Make sure not to touch the iframe directly here.  We want to
+//       test the case where the initial about:blank document is not
+//       directly accessed before load.
+</script>
+</body>
+</html>
+""")
diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/about-blank-replacement-ping-frame.py b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/about-blank-replacement-ping-frame.py
new file mode 100644 (file)
index 0000000..58fb440
--- /dev/null
@@ -0,0 +1,48 @@
+def main(request, response):
+  if 'nested' in request.GET:
+    return (
+      [('Content-Type', 'text/html')],
+      'failed: nested frame was not intercepted by the service worker'
+    )
+
+  return ([('Content-Type', 'text/html')], """
+<!doctype html>
+<html>
+<body>
+<script>
+function nestedLoaded() {
+  parent.postMessage({ type: 'NESTED_LOADED' }, '*');
+}
+</script>
+<iframe src="?nested=true&amp;ping=true" id="nested" onload="nestedLoaded()"></iframe>
+<script>
+// Helper routine to make it slightly easier for our parent to find
+// the nested frame.
+function nested() {
+  return document.getElementById('nested').contentWindow;
+}
+
+// This modifies the nested iframe immediately and does not wait for it to
+// load.  This effectively modifies the global for the initial about:blank
+// document.  Any modifications made here should be preserved after the
+// frame loads because the global should be re-used.
+let win = nested();
+if (win.location.href !== 'about:blank') {
+  parent.postMessage({
+    type: 'NESTED_LOADED',
+    result: 'failed: nested iframe does not have an initial about:blank URL'
+  }, '*');
+} else {
+  win.navigator.serviceWorker.addEventListener('message', evt => {
+    if (evt.data.type === 'PING') {
+      evt.source.postMessage({
+        type: 'PONG',
+        location: win.location.toString()
+      });
+    }
+  });
+}
+</script>
+</body>
+</html>
+""")
diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/about-blank-replacement-popup-frame.py b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/about-blank-replacement-popup-frame.py
new file mode 100644 (file)
index 0000000..be52945
--- /dev/null
@@ -0,0 +1,29 @@
+def main(request, response):
+  if 'nested' in request.GET:
+    return (
+      [('Content-Type', 'text/html')],
+      'failed: nested frame was not intercepted by the service worker'
+    )
+
+  return ([('Content-Type', 'text/html')], """
+<!doctype html>
+<html>
+<body>
+<script>
+function nestedLoaded() {
+  parent.postMessage({ type: 'NESTED_LOADED' }, '*');
+  popup.close();
+}
+
+let popup = window.open('?nested=true');
+popup.onload = nestedLoaded;
+
+// Helper routine to make it slightly easier for our parent to find
+// the nested popup window.
+function nested() {
+  return popup;
+}
+</script>
+</body>
+</html>
+""")
diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/about-blank-replacement-uncontrolled-nested-frame.html b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/about-blank-replacement-uncontrolled-nested-frame.html
new file mode 100644 (file)
index 0000000..8950915
--- /dev/null
@@ -0,0 +1,22 @@
+<!doctype html>
+<html>
+<body>
+<script>
+function nestedLoaded() {
+  parent.postMessage({ type: 'NESTED_LOADED' }, '*');
+}
+</script>
+<iframe src="empty.html?nested=true" id="nested" onload="nestedLoaded()"></iframe>
+<script>
+// Helper routine to make it slightly easier for our parent to find
+// the nested frame.
+function nested() {
+  return document.getElementById('nested').contentWindow;
+}
+
+// NOTE: Make sure not to touch the iframe directly here.  We want to
+//       test the case where the initial about:blank document is not
+//       directly accessed before load.
+</script>
+</body>
+</html>
diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/about-blank-replacement-worker.js b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/about-blank-replacement-worker.js
new file mode 100644 (file)
index 0000000..f43598e
--- /dev/null
@@ -0,0 +1,95 @@
+// Helper routine to find a client that matches a particular URL.  Note, we
+// require that Client to be controlled to avoid false matches with other
+// about:blank windows the browser might have.  The initial about:blank should
+// inherit the controller from its parent.
+async function getClientByURL(url) {
+  let list = await clients.matchAll();
+  return list.find(client => client.url === url);
+}
+
+// Helper routine to perform a ping-pong with the given target client.  We
+// expect the Client to respond with its location URL.
+async function pingPong(target) {
+  function waitForPong() {
+    return new Promise(resolve => {
+      self.addEventListener('message', function onMessage(evt) {
+        if (evt.data.type === 'PONG') {
+          resolve(evt.data.location);
+        }
+      });
+    });
+  }
+
+  target.postMessage({ type: 'PING' })
+  return await waitForPong(target);
+}
+
+addEventListener('fetch', async evt => {
+  let url = new URL(evt.request.url);
+  if (!url.searchParams.get('nested')) {
+    return;
+  }
+
+  evt.respondWith(async function() {
+    // Find the initial about:blank document.
+    const client = await getClientByURL('about:blank');
+    if (!client) {
+      return new Response('failure: could not find about:blank client');
+    }
+
+    // If the nested frame is configured to support a ping-pong, then
+    // ping it now to verify its message listener exists.  We also
+    // verify the Client's idea of its own location URL while we are doing
+    // this.
+    if (url.searchParams.get('ping')) {
+      const loc = await pingPong(client);
+      if (loc !== 'about:blank') {
+        return new Response(`failure: got location {$loc}, expected about:blank`);
+      }
+    }
+
+    // Finally, allow the nested frame to complete loading.  We place the
+    // Client ID we found for the initial about:blank in the body.
+    return new Response(client.id);
+  }());
+});
+
+addEventListener('message', evt => {
+  if (evt.data.type !== 'GET_CLIENT_ID') {
+    return;
+  }
+
+  evt.waitUntil(async function() {
+    let url = new URL(evt.data.url);
+
+    // Find the given Client by its URL.
+    let client = await getClientByURL(evt.data.url);
+    if (!client) {
+      evt.source.postMessage({
+        type: 'GET_CLIENT_ID',
+        result: `failure: could not find ${evt.data.url} client`
+      });
+      return;
+    }
+
+    // If the Client supports a ping-pong, then do it now to verify
+    // the message listener exists and its location matches the
+    // Client object.
+    if (url.searchParams.get('ping')) {
+      let loc = await pingPong(client);
+      if (loc !== evt.data.url) {
+        evt.source.postMessage({
+          type: 'GET_CLIENT_ID',
+          result: `failure: got location ${loc}, expected ${evt.data.url}`
+        });
+        return;
+      }
+    }
+
+    // Finally, send the client ID back.
+    evt.source.postMessage({
+      type: 'GET_CLIENT_ID',
+      result: client.id
+    });
+  }());
+});
diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/fetch-event-respond-with-partial-stream-worker.js b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/fetch-event-respond-with-partial-stream-worker.js
new file mode 100644 (file)
index 0000000..b7307f2
--- /dev/null
@@ -0,0 +1,28 @@
+let waitUntilResolve;
+
+let bodyController;
+
+self.addEventListener('message', evt => {
+  if (evt.data === 'done') {
+    bodyController.close();
+    waitUntilResolve();
+  }
+});
+
+self.addEventListener('fetch', evt => {
+  if (!evt.request.url.includes('partial-stream.txt')) {
+    return;
+  }
+
+  evt.waitUntil(new Promise(resolve => waitUntilResolve = resolve));
+
+  let body = new ReadableStream({
+    start: controller => {
+      let encoder = new TextEncoder();
+      controller.enqueue(encoder.encode('partial-stream-content'));
+      bodyController = controller;
+    },
+  });
+
+  evt.respondWith(new Response(body));
+});
diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/foreign-fetch-cors-worker.js b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/foreign-fetch-cors-worker.js
deleted file mode 100644 (file)
index b19d074..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-importScripts('/common/get-host-info.sub.js');
-var host_info = get_host_info();
-
-self.addEventListener('install', function(event) {
-    event.registerForeignFetch({scopes: [registration.scope], origins: ['*']});
-  });
-
-self.addEventListener('foreignfetch', function(event) {
-    var response = JSON.parse(decodeURIComponent(location.search.substring(1)));
-    var url = new URL(event.request.url);
-    var params = JSON.parse(decodeURIComponent(url.search.substring(1)));
-    var url_to_fetch = 'fetch-access-control.py?';
-    if (params.cross_origin) {
-      url_to_fetch =
-          host_info.HTTPS_ORIGIN + new URL('./', location).pathname + url_to_fetch;
-    }
-    if (params.with_aceheaders)
-      url_to_fetch += 'ACEHeaders=X-ServiceWorker-ServerHeader&';
-    if (params.with_acaorigin)
-      url_to_fetch += 'ACAOrigin=*';
-    fetch_params = {};
-    if (params.cross_origin && !params.with_acaorigin)
-       fetch_params.mode = 'no-cors';
-    event.respondWith(fetch(url_to_fetch, fetch_params)
-      .then(r => {
-          response.response = r;
-          return response;
-        }));
-    return;
-  });
diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/foreign-fetch-event-worker.js b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/foreign-fetch-event-worker.js
deleted file mode 100644 (file)
index 63f996e..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-self.addEventListener('install', function(event) {
-    test(function() {
-        assert_throws(new TypeError(), function() {
-            new ForeignFetchEvent('type');
-          });
-      }, 'ForeignFetchEvent constructor with no init dict');
-
-    test(function() {
-        assert_throws(new TypeError(), function() {
-            new ForeignFetchEvent('type', {});
-          });
-      }, 'ForeignFetchEvent constructor with empty init dict');
-
-    test(function() {
-        assert_throws(new TypeError(), function() {
-            new ForeignFetchEvent('type', { request: null });
-          });
-      }, 'ForeignFetchEvent constructor with null request');
-
-    test(function() {
-        var request = new Request('https://www.example.com/');
-        var event = new ForeignFetchEvent('type', { request: request, origin: 'origin' });
-        assert_equals(event.type, 'type');
-        assert_equals(event.request, request);
-        assert_equals(event.origin, 'origin');
-      }, 'ForeignFetchEvent constructor with all init dict members');
-  });
-
-// Import testharness after install handler to make sure our install handler
-// runs first. Otherwise only one test will run.
-importScripts('/resources/testharness.js');
diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/foreign-fetch-helper-iframe.html b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/foreign-fetch-helper-iframe.html
deleted file mode 100644 (file)
index 722843a..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-<!DOCTYPE html>
-<meta charset=utf-8>
-<script src="foreign-fetch-helper-script.js"></script>
-<script>
-self.onmessage = e => {
-    if (e.data.worker == 'dedicated') {
-      let worker = new Worker('foreign-fetch-helper-script.js');
-      worker.postMessage(e.data, e.ports);
-    } else if (e.data.worker == 'shared') {
-      let worker = new SharedWorker('foreign-fetch-helper-script.js');
-      worker.port.postMessage(e.data, e.ports);
-    } else {
-      handle_message(e);
-    }
-  };
-if (self.opener) self.opener.postMessage('ready', '*');
-</script>
diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/foreign-fetch-helper-script.js b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/foreign-fetch-helper-script.js
deleted file mode 100644 (file)
index 5ecaa9e..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-function handle_message(e) {
-  fetch(e.data.url)
-    .then(response => response.text())
-    .then(text => e.ports[0].postMessage('Success: ' + text))
-    .catch(error => e.ports[0].postMessage('Error: ' + error));
-}
-
-self.onmessage = handle_message;
-self.onconnect = e => {
-  e.ports[0].onmessage = handle_message;
-};
diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/foreign-fetch-helper-worker.js b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/foreign-fetch-helper-worker.js
deleted file mode 100644 (file)
index ce59604..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-importScripts('/common/get-host-info.sub.js');
-const host_info = get_host_info();
-
-self.onfetch = e => {
-  const remote_url = host_info.HTTPS_REMOTE_ORIGIN +
-                     new URL('./', location).pathname + 'simple.txt?basic_sw';
-  e.respondWith(fetch(remote_url));
-};
diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/foreign-fetch-helpers.js b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/foreign-fetch-helpers.js
deleted file mode 100644 (file)
index e1831ed..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-// Common helper functions for foreign fetch tests.
-
-// Installs a service worker on a different origin. Both |worker| and |scope|
-// are resolved relative to the /service-workers/service-worker/resources/
-// directory on a remote origin.
-function install_cross_origin_worker(
-    t, worker, scope, origin = get_host_info().HTTPS_REMOTE_ORIGIN) {
-  return with_iframe(origin + new URL('resources/install-worker-helper.html', location).pathname)
-    .then(frame => new Promise((resolve, reject) => {
-        frame.contentWindow.postMessage({worker: worker,
-                                         options: {scope: scope}},
-                                        '*');
-        window.addEventListener('message', reply => {
-            if (reply.source != frame.contentWindow) return;
-            if (reply.data == 'success') resolve();
-            else reject(reply.data);
-          });
-      }));
-}
-
-// Performs a fetch from a different origin. By default this performs a fetch
-// from a window on that origin, but if |worker_type| is 'dedicated' or 'shared'
-// the fetch is made from a worker on that origin instead.
-// This uses a window rather than an iframe because an iframe might get blocked
-// by mixed content checks.
-function fetch_from_different_origin(origin, url, worker_type) {
-  const win = open(origin + new URL('resources/foreign-fetch-helper-iframe.html', location).pathname);
-  return new Promise(resolve => {
-        self.addEventListener('message', e => {
-            if (e.source != win) return;
-            resolve();
-          });
-      })
-    .then(() => new Promise((resolve) => {
-        const channel = new MessageChannel();
-        win.postMessage({url: url,
-                         worker: worker_type},
-                        '*', [channel.port1]);
-        channel.port2.onmessage = reply => {
-          win.close();
-          resolve(reply.data);
-        };
-      }));
-}
diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/foreign-fetch-worker.js b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/foreign-fetch-worker.js
deleted file mode 100644 (file)
index 55a7407..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-self.addEventListener('install', function(event) {
-    var params = JSON.parse(decodeURIComponent(location.search.substring(1)));
-    if (!('scopes' in params)) {
-      if ('relscopes' in params) {
-        params.scopes = params.relscopes.map(s => registration.scope + s);
-      } else {
-        params.scopes = [registration.scope];
-      }
-    }
-    if (!('origins' in params))
-      params.origins = ['*'];
-    event.registerForeignFetch(params);
-  });
-
-function handle_basic(event) {
-  event.respondWith({response: new Response('Foreign Fetch'), origin: event.origin});
-}
-
-function handle_null(event) {
-  event.respondWith({response: null });
-}
-
-function handle_onmessage(event) {
-  event.respondWith({origin: event.origin, response:
-    new Response('<script>window.onmessage = e => e.ports[0].postMessage("failed");</script>',
-                 {headers: {'Content-Type': 'text/html'}})});
-}
-
-function handle_fallback(event) {
-  // Do nothing.
-}
-
-function handle_fetch(event) {
-  event.respondWith(
-    fetch(event.request).then(response => ({response, origin: event.origin})));
-}
-
-function handle_meta(event) {
-  var data = {
-    origin: event.origin,
-    referrer: event.request.referrer
-  };
-  event.respondWith({response: new Response(JSON.stringify(data)),
-                     origin: event.origin});
-}
-
-function handle_script(event) {
-  event.respondWith({origin: event.origin, response:
-    new Response('self.DidLoad("Foreign Fetch");')});
-}
-
-self.addEventListener('foreignfetch', function(event) {
-    var url = event.request.url;
-    var handlers = [
-      { pattern: '?basic', fn: handle_basic },
-      { pattern: '?null', fn: handle_null },
-      { pattern: '?fallback', fn: handle_fallback },
-      { pattern: '?fetch', fn: handle_fetch },
-      { pattern: '?onmessage', fn: handle_onmessage },
-      { pattern: '?meta', fn: handle_meta },
-      { pattern: '?script', fn: handle_script }
-    ];
-
-    var handler = null;
-    for (var i = 0; i < handlers.length; ++i) {
-      if (url.indexOf(handlers[i].pattern) != -1) {
-        handler = handlers[i];
-        break;
-      }
-    }
-
-    if (handler) {
-      handler.fn(event);
-    } else {
-      event.respondWith({origin: event.origin,
-                         response: new Response('unexpected request')});
-    }
-  });
diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/iframe-register-link-element.html b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/iframe-register-link-element.html
deleted file mode 100644 (file)
index db5bf23..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-<script>
-'use strict';
-var link = document.createElement('link');
-link.setAttribute('rel', 'serviceworker');
-link.setAttribute('href', 'empty-worker.js');
-function report(result) {
-    top.postMessage({id: location.search, result: result}, '*');
-};
-link.onload = function() {
-    report('loaded');
-};
-link.onerror = function() {
-    report('error');
-};
-document.getElementsByTagName('head')[0].appendChild(link);
-</script>
diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/install-worker-helper.html b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/install-worker-helper.html
deleted file mode 100644 (file)
index fcb8f6d..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-<!DOCTYPE html>
-<script src="test-helpers.sub.js"></script>
-<script>
-window.addEventListener('message', event => {
-    navigator.serviceWorker.getRegistration(event.data.options.scope)
-      .then(r => {
-          if (r) return r.unregister();
-        })
-      .then(() => navigator.serviceWorker.register(event.data.worker,
-                                                   event.data.options))
-      .then(r => new Promise(resolve => {
-          window.addEventListener('unload', () => r.unregister());
-          var worker = r.installing;
-          worker.addEventListener('statechange', () => {
-              if (worker.state === 'activated') resolve();
-            });
-        }))
-      .then(() => event.source.postMessage('success', '*'))
-      .catch((e) => event.source.postMessage('failure:' + e, '*'));
-  });
-</script>
index f3e0760..9f5c5ed 100644 (file)
@@ -23,7 +23,6 @@ interface ServiceWorkerGlobalScope : WorkerGlobalScope {
   attribute EventHandler oninstall;
   attribute EventHandler onactivate;
   attribute EventHandler onfetch;
-  attribute EventHandler onforeignfetch;
 
   // event
   attribute EventHandler onmessage; // event.source of the message events is Client object
@@ -76,6 +75,12 @@ enum ServiceWorkerState {
   "redundant"
 };
 
+enum ServiceWorkerUpdateViaCache {
+    "imports",
+    "all",
+    "none"
+};
+
 [SecureContext, Exposed=(Window,Worker)]
 interface ServiceWorkerRegistration : EventTarget {
   readonly attribute ServiceWorker? installing;
diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/link-header.py b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/link-header.py
deleted file mode 100644 (file)
index 1ea37c3..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-def main(request, response):
-    if 'Link' in request.GET:
-        return [('Link', request.GET['Link'])], ""
-    return [], ""
diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/register-foreign-fetch-errors-worker.js b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/register-foreign-fetch-errors-worker.js
deleted file mode 100644 (file)
index d1facc8..0000000
+++ /dev/null
@@ -1,134 +0,0 @@
-self.addEventListener('install', function(event) {
-    var scope = registration.scope;
-    var scope_url = new URL(scope);
-
-    test(function() {
-        assert_throws(new TypeError(), function() {
-            event.registerForeignFetch({});
-          });
-      }, 'Invalid options');
-
-    test(function() {
-        assert_throws(new TypeError(), function() {
-            event.registerForeignFetch({scopes: scope, origins: ['*']});
-          });
-      }, 'Scopes not an array');
-
-    test(function() {
-        assert_throws(new TypeError(), function() {
-            event.registerForeignFetch({scopes: [{}], origins: ['*']});
-          });
-      }, 'Scopes not a string in array');
-
-    test(function() {
-        assert_throws(new TypeError(), function() {
-            event.registerForeignFetch({scopes: ['/foo'], origins: ['*']});
-          });
-      }, 'Relative url not under scope');
-
-    test(function() {
-        var url = new URL(scope_url);
-        url.host = 'example.com';
-        assert_throws(new TypeError(), function() {
-            event.registerForeignFetch({scopes: [url.href], origins: ['*']});
-          });
-      }, 'Absolute url not under scope');
-
-    test(function() {
-        assert_throws(new TypeError(), function() {
-            event.registerForeignFetch({scopes: [], origins: ['*']});
-          });
-      }, 'Empty scope array');
-
-    async_test(function(t) {
-        self.setTimeout(t.step_func(function() {
-            assert_throws('InvalidStateError', function() {
-                event.registerForeignFetch({scopes: [scope], origins: ['*']});
-              });
-            t.done();
-          }), 1);
-      }, 'Call after event returned');
-
-    test(function() {
-        event.registerForeignFetch({scopes: [scope], origins: ['*']});
-      }, 'Valid scopes with wildcard origin string');
-
-    test(function() {
-        event.registerForeignFetch({scopes: [scope, scope + '/foo'], origins: ['*']});
-      }, 'Absolute urls');
-
-    test(function() {
-        // Figure out scope relative to location of this script:
-        var local_dir = location.pathname;
-        local_dir = local_dir.substr(0, local_dir.lastIndexOf('/'));
-        assert_true(scope_url.pathname.startsWith(local_dir));
-        var relative_scope = scope_url.pathname.substr(local_dir.length + 1);
-
-        event.registerForeignFetch({scopes: [
-          scope_url.pathname,
-          relative_scope,
-          './' + relative_scope,
-          relative_scope + '/foo'], origins: ['*']});
-      }, 'Relative urls');
-
-    test(function() {
-        assert_throws(new TypeError(), function() {
-            event.registerForeignFetch({scopes: [scope]});
-          });
-      }, 'No origins specified');
-
-    test(function() {
-        assert_throws(new TypeError(), function() {
-            event.registerForeignFetch({scopes: [scope], origins: {}});
-          });
-      }, 'Origins not a string or array');
-
-    test(function() {
-        assert_throws(new TypeError(), function() {
-            event.registerForeignFetch({scopes: [scope], origins: [{}]});
-          });
-      }, 'Origins contains something not a string');
-
-    test(function() {
-        assert_throws(new TypeError(), function() {
-            event.registerForeignFetch({scopes: [scope], origins: ['/foo']});
-          });
-      }, 'Origin not an absolute URL');
-
-    test(function() {
-        event.registerForeignFetch({scopes: [scope], origins: ['*']});
-      }, 'Wildcard origin string in array');
-
-    test(function() {
-        assert_throws(new TypeError(), function() {
-            event.registerForeignFetch({scopes: [scope], origins: 'https://example.com/'});
-          });
-      }, 'Origin string');
-
-    test(function() {
-        event.registerForeignFetch({scopes: [scope], origins: ['https://example.com/']});
-      }, 'Origin string in array');
-
-    test(function() {
-        event.registerForeignFetch({
-            scopes: [scope], origins: ['https://example.com/', 'https://chromium.org']});
-      }, 'Array with multiple origins');
-
-    test(function() {
-        assert_throws(new TypeError(), function() {
-            event.registerForeignFetch({scopes: [scope],
-                                        origins: ['*', 'https://example.com/']});
-          });
-      }, 'Origins includes wildcard and other strings');
-
-    test(function() {
-        assert_throws(new TypeError(), function() {
-            event.registerForeignFetch({scopes: [scope],
-                                        origins: ['https://example.com/', '*']});
-          });
-      }, 'Origins includes other strings and wildcard');
-  });
-
-// Import testharness after install handler to make sure our install handler
-// runs first. Otherwise only one test will run.
-importScripts('/resources/testharness.js');
diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/sandboxed-iframe-fetch-event-iframe.html b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/sandboxed-iframe-fetch-event-iframe.html
new file mode 100644 (file)
index 0000000..155dbdd
--- /dev/null
@@ -0,0 +1,56 @@
+<script>
+function with_iframe(url) {
+  return new Promise(function(resolve) {
+      var frame = document.createElement('iframe');
+      frame.src = url;
+      frame.onload = function() { resolve(frame); };
+      document.body.appendChild(frame);
+    });
+}
+
+function with_sandboxed_iframe(url, sandbox) {
+  return new Promise(function(resolve) {
+      var frame = document.createElement('iframe');
+      frame.sandbox = sandbox;
+      frame.src = url;
+      frame.onload = function() { resolve(frame); };
+      document.body.appendChild(frame);
+    });
+}
+
+function fetch_in_worker() {
+  return new Promise((resolve) => {
+    var blob = new Blob([
+      "fetch('" + location.href + "_workerfetch', {mode: 'no-cors'})" +
+      "  .then(() => { self.postMessage('OK'); });"]);
+    var url = URL.createObjectURL(blob);
+    var worker = new Worker(url);
+    worker.onmessage = resolve;
+  });
+}
+
+window.onmessage = function (e) {
+  var id = e.data['id'];
+  fetch(location.href + "_fetch", {mode: 'no-cors'})
+    .then(function() {
+        return fetch_in_worker();
+      })
+    .then(function() {
+        return with_iframe(location.href + "_iframe");
+      })
+    .then(function() {
+        return with_sandboxed_iframe(location.href + "_script",
+                                     "allow-scripts");
+      })
+    .then(function() {
+        return with_sandboxed_iframe(location.href + "_script-origin",
+                                     "allow-scripts allow-same-origin");
+      })
+    .then(function() {
+        window.top.postMessage({id: id, result: 'done'}, '*');
+      })
+    .catch(function(e) {
+        window.top.postMessage({id: id, result: 'error: ' + e.toString()}, '*');
+      });
+};
+</script>
diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/sandboxed-iframe-fetch-event-worker.js b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/sandboxed-iframe-fetch-event-worker.js
new file mode 100644 (file)
index 0000000..ffa0aba
--- /dev/null
@@ -0,0 +1,19 @@
+var requests = [];
+
+self.addEventListener('message', function(event) {
+    event.waitUntil(self.clients.matchAll()
+      .then(function(clients) {
+          var client_urls = [];
+          for(var client of clients){
+            client_urls.push(client.url);
+          }
+          client_urls = client_urls.sort();
+          event.data.port.postMessage(
+              {clients: client_urls, requests: requests});
+        }));
+  });
+
+self.addEventListener('fetch', function(event) {
+    requests.push(event.request.url);
+    event.respondWith(fetch(event.request));
+  });
diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/sandboxed-iframe-navigator-serviceworker-iframe.html b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/sandboxed-iframe-navigator-serviceworker-iframe.html
new file mode 100644 (file)
index 0000000..1d682e4
--- /dev/null
@@ -0,0 +1,25 @@
+<script>
+window.onmessage = function(e) {
+  const id = e.data['id'];
+  try {
+    var sw = window.navigator.serviceWorker;
+  } catch (e) {
+    window.top.postMessage({
+        id: id,
+        result: 'navigator.serviceWorker failed: ' + e.name
+      }, '*');
+    return;
+  }
+
+  window.navigator.serviceWorker.getRegistration()
+    .then(function() {
+        window.top.postMessage({id: id, result:'ok'}, '*');
+      })
+    .catch(function(e) {
+        window.top.postMessage({
+            id: id,
+            result: 'getRegistration() failed: ' + e.name
+          }, '*');
+        });
+};
+</script>
index 08ce605..9c5942b 100644 (file)
@@ -257,3 +257,14 @@ function register_using_link(script, options) {
       })
     .then(() => navigator.serviceWorker.getRegistration(scope));
 }
+
+function with_sandboxed_iframe(url, sandbox) {
+  return new Promise(function(resolve) {
+      var frame = document.createElement('iframe');
+      frame.sandbox = sandbox;
+      frame.src = url;
+      frame.onload = function() { resolve(frame); };
+      document.body.appendChild(frame);
+    });
+}
+
index d44946b..375f93e 100644 (file)
@@ -15,6 +15,11 @@ None
 ------------------------------------------------------------------------
 List of files:
 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/404.py
+/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/about-blank-replacement-frame.py
+/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/about-blank-replacement-ping-frame.py
+/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/about-blank-replacement-popup-frame.py
+/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/about-blank-replacement-uncontrolled-nested-frame.html
+/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/about-blank-replacement-worker.js
 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/appcache-ordering.install.html
 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/appcache-ordering.is-appcached.html
 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/appcache-ordering.is-appcached.js
@@ -72,6 +77,7 @@ List of files:
 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/fetch-event-network-error-worker.js
 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/fetch-event-respond-with-argument-iframe.html
 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/fetch-event-respond-with-argument-worker.js
+/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/fetch-event-respond-with-partial-stream-worker.js
 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/fetch-event-respond-with-readable-stream-iframe.html
 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/fetch-event-respond-with-readable-stream-worker.js
 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/fetch-event-respond-with-response-body-with-invalid-chunk-iframe.html
@@ -112,16 +118,8 @@ List of files:
 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/fetch-rewrite-worker-referrer-policy.js.headers
 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/fetch-rewrite-worker.js
 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/fetch-waits-for-activate-worker.js
-/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/foreign-fetch-cors-worker.js
-/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/foreign-fetch-event-worker.js
-/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/foreign-fetch-helper-iframe.html
-/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/foreign-fetch-helper-script.js
-/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/foreign-fetch-helper-worker.js
-/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/foreign-fetch-helpers.js
-/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/foreign-fetch-worker.js
 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/frame-for-getregistrations.html
 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/http-to-https-redirect-and-register-iframe.html
-/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/iframe-register-link-element.html
 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/immutable-prototype-serviceworker.js
 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/import-mime-type-worker.py
 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/import-scripts-echo.py
@@ -132,7 +130,6 @@ List of files:
 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/import-scripts-version.py
 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/indexeddb-worker.js
 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/install-event-type-worker.js
-/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/install-worker-helper.html
 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/interfaces-idls.js
 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/interfaces-worker.sub.js
 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/invalid-blobtype-iframe.https.html
@@ -143,7 +140,6 @@ List of files:
 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/invalid-header-worker.js
 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/iso-latin1-header-iframe.html
 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/iso-latin1-header-worker.js
-/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/link-header.py
 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/load_worker.js
 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/loaded.html
 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/malformed-worker.py
@@ -187,7 +183,6 @@ List of files:
 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/referer-iframe.html
 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/referrer-policy-iframe.html
 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/register-closed-window-iframe.html
-/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/register-foreign-fetch-errors-worker.js
 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/register-iframe.html
 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/registration-tests-basic.js
 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/registration-tests-mime-types.js
@@ -200,12 +195,15 @@ List of files:
 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/reply-to-message.html
 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/request-end-to-end-worker.js
 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/request-headers.py
-/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/resource-timing-iframe.html
+/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/resource-timing-iframe.sub.html
 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/resource-timing-worker.js
 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/respond-then-throw-worker.js
 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/respond-with-body-accessed-response-iframe.html
 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/respond-with-body-accessed-response-worker.js
 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/respond-with-body-accessed-response.jsonp
+/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/sandboxed-iframe-fetch-event-iframe.html
+/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/sandboxed-iframe-fetch-event-worker.js
+/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/sandboxed-iframe-navigator-serviceworker-iframe.html
 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/service-worker-csp-worker.py
 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/shared-worker-controlled.js
 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resources/shared-worker-import.js
diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/sandboxed-iframe-fetch-event.https-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/sandboxed-iframe-fetch-event.https-expected.txt
new file mode 100644 (file)
index 0000000..91beca9
--- /dev/null
@@ -0,0 +1,8 @@
+CONSOLE MESSAGE: line 27: [blocked] The page at https://localhost:9443/service-workers/service-worker/sandboxed-iframe-fetch-event.https.html was not allowed to display insecure content from blob:null/1e18072d-e067-4b6a-8346-212ade1e573e.
+
+
+
+Harness Error (TIMEOUT), message = null
+
+TIMEOUT ServiceWorker FetchEvent for sandboxed iframe. Test timed out
+
diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/sandboxed-iframe-fetch-event.https.html b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/sandboxed-iframe-fetch-event.https.html
new file mode 100644 (file)
index 0000000..8b361bd
--- /dev/null
@@ -0,0 +1,216 @@
+<!DOCTYPE html>
+<title>ServiceWorker FetchEvent for sandboxed iframe.</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="resources/test-helpers.sub.js"></script>
+<body>
+<script>
+var lastCallbackId = 0;
+var callbacks = {};
+function postMessageAndWaitResult(frame) {
+  return new Promise(function(resolve) {
+    var id = ++lastCallbackId;
+    callbacks[id] = resolve;
+    frame.contentWindow.postMessage({id:id}, '*');
+  });
+}
+
+window.onmessage = function (e) {
+  message = e.data;
+  var id = message['id'];
+  var calback = callbacks[id];
+  delete callbacks[id];
+  calback(message['result']);
+};
+
+promise_test(function(t) {
+    var SCOPE = 'resources/sandboxed-iframe-fetch-event-iframe.html';
+    var SCRIPT = 'resources/sandboxed-iframe-fetch-event-worker.js';
+    var frames = [];
+    var worker;
+    return service_worker_unregister_and_register(t, SCRIPT, SCOPE)
+      .then(function(registration) {
+          worker = registration.installing;
+          return wait_for_state(t, registration.installing, 'activated');
+        })
+      .then(function() {
+          return with_iframe(SCOPE + '?iframe');
+        })
+      .then(function(frame) {
+          frames.push(frame);
+          return postMessageAndWaitResult(frame);
+        })
+      .then(function(result) {
+          assert_equals(result, 'done');
+          return with_sandboxed_iframe(SCOPE + '?script', 'allow-scripts');
+        })
+      .then(function(frame) {
+          frames.push(frame);
+          return postMessageAndWaitResult(frame);
+        })
+      .then(function(result) {
+          assert_equals(result, 'done');
+          return with_sandboxed_iframe(SCOPE + '?script-origin',
+                                       'allow-scripts allow-same-origin');
+        })
+      .then(function(frame) {
+          frames.push(frame);
+          return postMessageAndWaitResult(frame);
+        })
+      .then(function(result) {
+          assert_equals(result, 'done');
+          return new Promise(function(resolve) {
+              var channel = new MessageChannel();
+              channel.port1.onmessage = function(msg) {
+                  resolve(msg);
+                };
+              worker.postMessage({port: channel.port2}, [channel.port2]);
+            });
+        })
+      .then(function(msg) {
+          for (var frame of frames) {
+            frame.remove();
+          }
+          var expected_base_url = new URL(SCOPE, location.href).href;
+          var request_set = {};
+          for (var request of msg.data.requests) {
+            request_set[request] = true;
+          }
+          assert_true(
+              expected_base_url + '?iframe' in request_set,
+              'The request for normal iframe should be handled by SW.');
+          assert_true(
+              expected_base_url + '?iframe_fetch' in request_set,
+              'The fetch request from normal iframe should be handled by SW.');
+          assert_true(
+              expected_base_url + '?iframe_workerfetch' in request_set,
+              'The fetch request from worker in normal iframe should be ' +
+              'handled by SW.');
+          assert_true(
+              expected_base_url + '?iframe_iframe' in request_set,
+              'The request for normal iframe inside normal iframe should be ' +
+              'handled by SW.');
+          assert_false(
+              expected_base_url + '?iframe_script' in request_set,
+              'The request for sandboxed iframe with allow-scripts flag ' +
+              'inside normal iframe should not be handled by SW.');
+          assert_true(
+              expected_base_url + '?iframe_script-origin' in request_set,
+              'The request for sandboxed iframe with allow-scripts and ' +
+              'allow-same-origin flag inside normal iframe should be handled ' +
+              'by SW.');
+          assert_false(
+              expected_base_url + '?script' in request_set,
+              'The request for sandboxed iframe with allow-scripts flag ' +
+              'should not be handled by SW.');
+          assert_false(
+              expected_base_url + '?script_fetch' in request_set,
+              'The fetch request from sandboxed iframe with allow-scripts ' +
+              'flag should not be handled by SW.');
+          assert_false(
+              expected_base_url + '?script_workerfetch' in request_set,
+              'The fetch request from worker from sandboxed iframe with ' +
+              'allow-scripts flag should not be handled by SW.');
+          assert_false(
+              expected_base_url + '?script_iframe' in request_set,
+              'The request for normal iframe inside sandboxed iframe with ' +
+              'allow-scripts flag should not be handled by SW.');
+          assert_false(
+              expected_base_url + '?script_script' in request_set,
+              'The request for sandboxed iframe with allow-scripts flag ' +
+              'inside sandboxed iframe with allow-scripts flag should not be ' +
+              'handled by SW.');
+          assert_false(
+              expected_base_url + '?script_script-origin' in request_set,
+              'The request for sandboxed iframe with allow-scripts and ' +
+              'allow-same-origin flag inside sandboxed iframe with ' +
+              'allow-scripts flag should not be handled by SW.');
+          assert_true(
+              expected_base_url + '?script-origin' in request_set,
+              'The request for sandboxed iframe with allow-scripts and ' +
+              'allow-same-origin flag should be handled by SW.');
+          assert_true(
+              expected_base_url + '?script-origin_fetch' in request_set,
+              'The fetch request from sandboxed iframe with allow-scripts ' +
+              'and allow-same-origin flag should be handled by SW.');
+          assert_true(
+              expected_base_url + '?script-origin_workerfetch' in request_set,
+              'The fetch request from worker in sandboxed iframe with ' +
+              'allow-scripts and allow-same-origin flag should be handled ' +
+              'by SW.');
+          assert_true(
+              expected_base_url + '?script-origin_iframe' in request_set,
+              'The request for normal iframe inside sandboxed iframe with ' +
+              'allow-scripts and allow-same-origin flag should be handled by' +
+              'SW.');
+          assert_false(
+              expected_base_url + '?script-origin_script' in request_set,
+              'The request for sandboxed iframe with allow-scripts flag ' +
+              'inside sandboxed iframe with allow-scripts and ' +
+              'allow-same-origin flag should be handled by SW.');
+          assert_true(
+              expected_base_url + '?script-origin_script-origin' in request_set,
+              'The request for sandboxed iframe with allow-scripts and' +
+              'allow-same-origin flag inside sandboxed iframe with ' +
+              'allow-scripts and allow-same-origin flag should be handled by' +
+              'SW.');
+
+          var client_set = {};
+          for (var client of msg.data.clients) {
+            client_set[client] = true;
+          }
+          assert_true(
+              expected_base_url + '?iframe' in client_set,
+              'The normal iframe should be controlled by SW.');
+          assert_true(
+              expected_base_url + '?iframe_iframe' in client_set,
+              'The normal iframe inside normal iframe should be controlled ' +
+              'by SW.');
+          assert_false(
+              expected_base_url + '?iframe_script' in client_set,
+              'The sandboxed iframe with allow-scripts flag inside normal ' +
+              'iframe should not be controlled by SW.');
+          assert_true(
+              expected_base_url + '?iframe_script-origin' in client_set,
+              'The sandboxed iframe with allow-scripts and allow-same-origin' +
+              'flag inside normal iframe should be controlled by SW.');
+          assert_false(
+              expected_base_url + '?script' in client_set,
+              'The sandboxed iframe with allow-scripts flag should not be ' +
+              'controlled by SW.');
+          assert_false(
+              expected_base_url + '?script_iframe' in client_set,
+              'The normal iframe inside sandboxed iframe with allow-scripts' +
+              'flag should not be controlled by SW.');
+          assert_false(
+              expected_base_url + '?script_script' in client_set,
+              'The sandboxed iframe with allow-scripts flag inside sandboxed ' +
+              'iframe with allow-scripts flag should not be controlled by SW.');
+          assert_false(
+              expected_base_url + '?script_script-origin' in client_set,
+              'The sandboxed iframe with allow-scripts and allow-same-origin ' +
+              'flag inside sandboxed iframe with allow-scripts flag should ' +
+              'not be controlled by SW.');
+          assert_true(
+              expected_base_url + '?script-origin' in client_set,
+              'The sandboxed iframe with allow-scripts and allow-same-origin ' +
+              'flag should be controlled by SW.');
+          assert_true(
+              expected_base_url + '?script-origin_iframe' in client_set,
+              'The normal iframe inside sandboxed iframe with allow-scripts ' +
+              'and allow-same-origin flag should be controlled by SW.');
+          assert_false(
+              expected_base_url + '?script-origin_script' in client_set,
+              'The sandboxed iframe with allow-scripts flag inside sandboxed ' +
+              'iframe with allow-scripts and allow-same-origin flag should ' +
+              'be controlled by SW.');
+          assert_true(
+              expected_base_url + '?script-origin_script-origin' in client_set,
+              'The sandboxed iframe with allow-scripts and allow-same-origin ' +
+              'flag inside sandboxed iframe with allow-scripts and ' +
+              'allow-same-origin flag should be controlled by SW.');
+          return service_worker_unregister_and_done(t, SCOPE);
+        });
+  }, 'ServiceWorker FetchEvent for sandboxed iframe.');
+</script>
+</body>
diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/sandboxed-iframe-navigator-serviceworker.https-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/sandboxed-iframe-navigator-serviceworker.https-expected.txt
new file mode 100644 (file)
index 0000000..6e707df
--- /dev/null
@@ -0,0 +1,6 @@
+
+PASS Accessing navigator.serviceWorker in normal iframe should not throw. 
+FAIL Accessing navigator.serviceWorker in sandboxed iframe should throw. assert_equals: expected "navigator.serviceWorker failed: SecurityError" but got "ok"
+PASS Accessing navigator.serviceWorker in sandboxed iframe with allow-same-origin flag should not throw. 
+FAIL Switching iframe sandbox attribute while loading the iframe assert_equals: expected "navigator.serviceWorker failed: SecurityError" but got "ok"
+
diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/sandboxed-iframe-navigator-serviceworker.https.html b/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/sandboxed-iframe-navigator-serviceworker.https.html
new file mode 100644 (file)
index 0000000..a58525f
--- /dev/null
@@ -0,0 +1,115 @@
+<!DOCTYPE html>
+<title>Accessing navigator.serviceWorker in sandboxed iframe.</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="resources/test-helpers.sub.js"></script>
+<body>
+<script>
+var lastCallbackId = 0;
+var callbacks = {};
+function postMessageAndWaitResult(frame) {
+  return new Promise(function(resolve) {
+    var id = ++lastCallbackId;
+    callbacks[id] = resolve;
+    frame.contentWindow.postMessage({id:id}, '*');
+  });
+}
+
+window.onmessage = function(e) {
+  message = e.data;
+  var id = message['id'];
+  var callback = callbacks[id];
+  delete callbacks[id];
+  callback(message.result);
+};
+
+promise_test(function(t) {
+    var url = 'resources/sandboxed-iframe-navigator-serviceworker-iframe.html';
+    var frame;
+    return with_iframe(url)
+      .then(function(f) {
+          frame = f;
+          add_result_callback(() => { frame.remove(); });
+          return postMessageAndWaitResult(f);
+        })
+      .then(function(result) {
+          assert_equals(result, 'ok');
+        });
+  }, 'Accessing navigator.serviceWorker in normal iframe should not throw.');
+
+promise_test(function(t) {
+    var url = 'resources/sandboxed-iframe-navigator-serviceworker-iframe.html';
+    var frame;
+    return with_sandboxed_iframe(url, 'allow-scripts')
+      .then(function(f) {
+          frame = f;
+          add_result_callback(() => { frame.remove(); });
+          return postMessageAndWaitResult(f);
+        })
+      .then(function(result) {
+          assert_equals(
+              result,
+              'navigator.serviceWorker failed: SecurityError');
+        });
+  }, 'Accessing navigator.serviceWorker in sandboxed iframe should throw.');
+
+promise_test(function(t) {
+    var url = 'resources/sandboxed-iframe-navigator-serviceworker-iframe.html';
+    var frame;
+    return with_sandboxed_iframe(url, 'allow-scripts allow-same-origin')
+      .then(function(f) {
+          frame = f;
+          add_result_callback(() => { frame.remove(); });
+          return postMessageAndWaitResult(f);
+        })
+      .then(function(result) {
+          assert_equals(result, 'ok');
+        });
+  },
+  'Accessing navigator.serviceWorker in sandboxed iframe with ' +
+  'allow-same-origin flag should not throw.');
+
+promise_test(function(t) {
+    var url = 'resources/sandboxed-iframe-navigator-serviceworker-iframe.html';
+    var frame;
+    return new Promise(function(resolve) {
+          frame = document.createElement('iframe');
+          add_result_callback(() => { frame.remove(); });
+          frame.sandbox = '';
+          frame.src = url;
+          frame.onload = resolve;
+          document.body.appendChild(frame);
+          // Switch the sandbox attribute while loading the iframe.
+          frame.sandbox = 'allow-scripts allow-same-origin';
+        })
+      .then(function() {
+          return postMessageAndWaitResult(frame)
+        })
+      .then(function(result) {
+          // The HTML spec seems to say that changing the sandbox attribute
+          // after the iframe is inserted into its parent document does not
+          // affect the sandboxing. If that's true, the frame should still
+          // act as if it still doesn't have
+          // 'allow-scripts allow-same-origin' set and throw a SecurityError.
+          //
+          // 1) From Section 4.8.5 "The iframe element":
+          // "When an iframe element is inserted into a document that has a
+          // browsing context, the user agent must create a new browsing
+          // context..."
+          // 2) "Create a new browsing context" expands to Section 7.1
+          // "Browsing contexts", which includes creating a Document and
+          // "Implement the sandboxing for document."
+          // 3) "Implement the sandboxing" expands to Section 7.6 "Sandboxing",
+          // which includes "populate document's active sandboxing flag set".
+          //
+          // It's not clear whether navigation subsequently creates a new
+          // Document, but I'm assuming it wouldn't.
+          // https://html.spec.whatwg.org/multipage/embedded-content.html#attr-iframe-sandbox
+          assert_equals(
+              result,
+              'navigator.serviceWorker failed: SecurityError');
+        });
+  }, 'Switching iframe sandbox attribute while loading the iframe');
+
+</script>
+</body>
index 090ee8b..0ba364c 100644 (file)
@@ -1,6 +1,6 @@
 
 PASS CSP test for connect-src in ServiceWorkerGlobalScope 
-FAIL importScripts test for connect-src assert_false: Importing the other origins script should not fail. expected false got true
+PASS importScripts test for connect-src 
 FAIL Fetch test for connect-src assert_unreached: unexpected rejection: assert_unreached: fetch should fail. Reached unreachable code Reached unreachable code
 FAIL Redirected fetch test for connect-src assert_unreached: unexpected rejection: assert_unreached: Redirected fetch should fail. Reached unreachable code Reached unreachable code
 
index 18f5259..9a03306 100644 (file)
@@ -1,6 +1,6 @@
 
 PASS CSP test for default-src in ServiceWorkerGlobalScope 
-PASS importScripts test for default-src 
+FAIL importScripts test for default-src assert_true: Importing the other origins script should fail. expected true got false
 FAIL Fetch test for default-src assert_unreached: unexpected rejection: assert_unreached: fetch should fail. Reached unreachable code Reached unreachable code
 FAIL Redirected fetch test for default-src assert_unreached: unexpected rejection: assert_unreached: Redirected fetch should fail. Reached unreachable code Reached unreachable code
 
index d37a7b5..7161593 100644 (file)
@@ -1,6 +1,6 @@
 
 PASS CSP test for script-src in ServiceWorkerGlobalScope 
-PASS importScripts test for script-src 
+FAIL importScripts test for script-src assert_true: Importing the other origins script should fail. expected true got false
 PASS Fetch test for script-src 
 PASS Redirected fetch test for script-src 
 
index 8e8061b..2a8d014 100644 (file)
@@ -14,6 +14,7 @@ Property values requiring vendor prefixes:
 None
 ------------------------------------------------------------------------
 List of files:
+/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/about-blank-replacement.https.html
 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/activate-event-after-install-state-change.https.html
 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/activation-after-registration.https.html
 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/activation.https.html
@@ -53,6 +54,7 @@ List of files:
 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-event-redirect.https.html
 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-event-referrer-policy.https.html
 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-event-respond-with-argument.https.html
+/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-event-respond-with-partial-stream.https.html
 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-event-respond-with-readable-stream.https.html
 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-event-respond-with-response-body-with-invalid-chunk.https.html
 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-event-respond-with-stops-propagation.https.html
@@ -77,14 +79,9 @@ List of files:
 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-response-taint.https.html
 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-response-xhr.https.html
 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-waits-for-activate.https.html
-/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/foreign-fetch-basics.https.html
-/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/foreign-fetch-cors.https.html
-/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/foreign-fetch-event.https.html
-/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/foreign-fetch-workers.https.html
 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/getregistration.https.html
 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/getregistrations.https.html
 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/http-to-https-redirect-and-register.https.html
-/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/iframe-sandbox-register-link-element.https.html
 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/immutable-prototype-serviceworker.https.html
 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/import-scripts-redirect.https.html
 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/import-scripts-resource-map.https.html
@@ -97,12 +94,6 @@ List of files:
 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/invalid-blobtype.https.html
 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/invalid-header.https.html
 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/iso-latin1-header.https.html
-/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/link-element-register-basic.https.html
-/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/link-element-register-mime-types.https.html
-/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/link-element-register-scope.https.html
-/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/link-element-register-script-url.https.html
-/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/link-element-register-script.https.html
-/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/link-element-register-security-error.https.html
 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/mime-sniffing.https.html
 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/multiple-register.https.html
 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/multiple-update.https.html
@@ -125,8 +116,6 @@ List of files:
 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/referrer-policy-header.https.html
 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/register-closed-window.https.html
 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/register-default-scope.https.html
-/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/register-foreign-fetch-errors.https.html
-/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/register-link-header.https.html
 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/register-same-scope-different-script-url.https.html
 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/register-wait-forever-in-install-worker.https.html
 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/registration-basic.https.html
@@ -144,6 +133,8 @@ List of files:
 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/request-end-to-end.https.html
 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resource-timing.https.html
 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/respond-with-body-accessed-response.https.html
+/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/sandboxed-iframe-fetch-event.https.html
+/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/sandboxed-iframe-navigator-serviceworker.https.html
 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/service-worker-csp-connect.https.html
 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/service-worker-csp-default.https.html
 /LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/service-worker-csp-script.https.html
index 873179d..81024c6 100644 (file)
     "imported/w3c/web-platform-tests/service-workers/cache-storage/worker/cache-storage.https.html": [
         "slow"
     ],
+    "imported/w3c/web-platform-tests/service-workers/service-worker/about-blank-replacement.https.html": [
+        "slow"
+    ],
     "imported/w3c/web-platform-tests/service-workers/service-worker/fetch-event-redirect.https.html": [
         "slow"
     ],