From d7ee43813a84dfb8b5a5e3bb72a833c1eb7bd8db Mon Sep 17 00:00:00 2001 From: Ben Kelly Date: Thu, 21 Apr 2016 16:10:40 -0700 Subject: [PATCH] Bug 1265795 P2 Add a web-platform-test for the window navigation case. r=bz --- testing/web-platform/meta/MANIFEST.json | 6 ++ .../service-worker/navigate-window.https.html | 97 +++++++++++++++++++ .../service-worker/resources/loaded.html | 9 ++ .../resources/navigate-window-worker.js | 21 ++++ 4 files changed, 133 insertions(+) create mode 100644 testing/web-platform/tests/service-workers/service-worker/navigate-window.https.html create mode 100644 testing/web-platform/tests/service-workers/service-worker/resources/loaded.html create mode 100644 testing/web-platform/tests/service-workers/service-worker/resources/navigate-window-worker.js diff --git a/testing/web-platform/meta/MANIFEST.json b/testing/web-platform/meta/MANIFEST.json index 655cb8c6ad61..dc9c415bbf70 100644 --- a/testing/web-platform/meta/MANIFEST.json +++ b/testing/web-platform/meta/MANIFEST.json @@ -35276,6 +35276,12 @@ "url": "/html/webappapis/scripting/processing-model-2/window-onerror-with-cross-frame-event-listeners-4.html" } ], + "service-workers/service-worker/navigate-window.https.html": [ + { + "path": "service-workers/service-worker/navigate-window.https.html", + "url": "/service-workers/service-worker/navigate-window.https.html" + } + ], "web-animations/timing-model/active-time.html": [ { "path": "web-animations/timing-model/active-time.html", diff --git a/testing/web-platform/tests/service-workers/service-worker/navigate-window.https.html b/testing/web-platform/tests/service-workers/service-worker/navigate-window.https.html new file mode 100644 index 000000000000..4a0e51d3d84b --- /dev/null +++ b/testing/web-platform/tests/service-workers/service-worker/navigate-window.https.html @@ -0,0 +1,97 @@ + +Service Worker: Navigate a Window + + + + + + + diff --git a/testing/web-platform/tests/service-workers/service-worker/resources/loaded.html b/testing/web-platform/tests/service-workers/service-worker/resources/loaded.html new file mode 100644 index 000000000000..0cabce69f8e8 --- /dev/null +++ b/testing/web-platform/tests/service-workers/service-worker/resources/loaded.html @@ -0,0 +1,9 @@ + diff --git a/testing/web-platform/tests/service-workers/service-worker/resources/navigate-window-worker.js b/testing/web-platform/tests/service-workers/service-worker/resources/navigate-window-worker.js new file mode 100644 index 000000000000..f9617439fc60 --- /dev/null +++ b/testing/web-platform/tests/service-workers/service-worker/resources/navigate-window-worker.js @@ -0,0 +1,21 @@ +addEventListener('message', function(evt) { + if (evt.data.type === 'GET_CLIENTS') { + clients.matchAll(evt.data.opts).then(function(clientList) { + var resultList = clientList.map(function(c) { + return { url: c.url, frameType: c.frameType, id: c.id }; + }); + evt.source.postMessage({ type: 'success', detail: resultList }); + }).catch(function(err) { + evt.source.postMessage({ + type: 'failure', + detail: 'matchAll() rejected with "' + err + '"' + }); + }); + return; + } + + evt.source.postMessage({ + type: 'failure', + detail: 'Unexpected message type "' + evt.data.type + '"' + }); +});