diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:22:09 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:22:09 +0000 |
commit | 43a97878ce14b72f0981164f87f2e35e14151312 (patch) | |
tree | 620249daf56c0258faa40cbdcf9cfba06de2a846 /testing/web-platform/tests/appmanifest/icons-member | |
parent | Initial commit. (diff) | |
download | firefox-upstream.tar.xz firefox-upstream.zip |
Adding upstream version 110.0.1.upstream/110.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
26 files changed, 241 insertions, 0 deletions
diff --git a/testing/web-platform/tests/appmanifest/icons-member/icons-member-cors-fail-manual.sub.html b/testing/web-platform/tests/appmanifest/icons-member/icons-member-cors-fail-manual.sub.html new file mode 100644 index 0000000000..f49dac6057 --- /dev/null +++ b/testing/web-platform/tests/appmanifest/icons-member/icons-member-cors-fail-manual.sub.html @@ -0,0 +1,16 @@ +<!DOCTYPE html> +<title>Test that icons member is supported (CORS violation)</title> +<link rel="help" href="https://w3c.github.io/manifest#icons-member" /> +<link rel="manifest" href="resources/icons-member-cors-fail.sub.webmanifest" /> +<script src="resources/icons-member-manual.js"></script> +<h1>Testing support for icons member (CORS violation)</h1> +<script> + // Force the port of the origin to be ports[https][0] (likely :8443) + // we treat the port ports[https][1] (likely :8444) to be another origin that we fail against + if (window.location.origin !== "https://{{host}}:{{ports[https][0]}}") { + window.location = new URL(window.location.pathname, "https://{{host}}:{{ports[https][0]}}") + } +</script> +<p> + To pass, the icon <strong>must not</strong> show a white cross on a red background. +</p> diff --git a/testing/web-platform/tests/appmanifest/icons-member/icons-member-cors-manual.sub.html b/testing/web-platform/tests/appmanifest/icons-member/icons-member-cors-manual.sub.html new file mode 100644 index 0000000000..aa0fe89db6 --- /dev/null +++ b/testing/web-platform/tests/appmanifest/icons-member/icons-member-cors-manual.sub.html @@ -0,0 +1,16 @@ +<!DOCTYPE html> +<title>Test that icons member is supported (via CORS)</title> +<link rel="help" href="https://w3c.github.io/manifest#icons-member" /> +<link rel="manifest" href="resources/icons-member-cors.sub.webmanifest" /> +<script src="resources/icons-member-manual.js"></script> +<h1>Testing support for icons member (via CORS)</h1> +<script> + // Force the port of the origin to be ports[https][0] (likely :8443) + // we treat the port ports[https][1] (likely :8444) to be another origin that we fail against + if (window.location.origin !== "https://{{host}}:{{ports[https][0]}}") { + window.location = new URL(window.location.pathname, "https://{{host}}:{{ports[https][0]}}") + } +</script> +<p> + To pass, the icon must show a white check mark on a green background. +</p> diff --git a/testing/web-platform/tests/appmanifest/icons-member/icons-member-csp-fail-manual.sub.html b/testing/web-platform/tests/appmanifest/icons-member/icons-member-csp-fail-manual.sub.html new file mode 100644 index 0000000000..e4706011f8 --- /dev/null +++ b/testing/web-platform/tests/appmanifest/icons-member/icons-member-csp-fail-manual.sub.html @@ -0,0 +1,17 @@ +<!DOCTYPE html> +<meta http-equiv="Content-Security-Policy" content="img-src {{host}}:{{ports[https][1]}}"> +<title>Test that icons member is supported (CSP violation)</title> +<link rel="help" href="https://w3c.github.io/manifest#icons-member" /> +<link rel="manifest" href="resources/icons-member-csp-fail.webmanifest" /> +<script src="resources/icons-member-manual.js"></script> +<h1>Testing support for icons member (CSP violation)</h1> +<script> + // Force the port of the origin to be ports[https][0] (likely :8443) + // we treat the port ports[https][1] (likely :8444) to be another origin that we fail against + if (window.location.origin !== "https://{{host}}:{{ports[https][0]}}") { + window.location = new URL(window.location.pathname, "https://{{host}}:{{ports[https][0]}}") + } +</script> +<p> + To pass, the icon <strong>must not</strong> show a white cross on a red background. +</p> diff --git a/testing/web-platform/tests/appmanifest/icons-member/icons-member-csp-manual.sub.html b/testing/web-platform/tests/appmanifest/icons-member/icons-member-csp-manual.sub.html new file mode 100644 index 0000000000..c76364b83f --- /dev/null +++ b/testing/web-platform/tests/appmanifest/icons-member/icons-member-csp-manual.sub.html @@ -0,0 +1,17 @@ +<!DOCTYPE html> +<meta http-equiv="Content-Security-Policy" content="img-src {{host}}:{{ports[https][1]}}"> +<title>Test that icons member is supported (CSP check)</title> +<link rel="help" href="https://w3c.github.io/manifest#icons-member" /> +<link rel="manifest" href="resources/icons-member-csp.sub.webmanifest" /> +<script src="resources/icons-member-manual.js"></script> +<h1>Testing support for icons member (CSP check)</h1> +<script> + // Force the port of the origin to be ports[https][0] (likely :8443) + // we treat the port ports[https][1] (likely :8444) to be another origin that we fail against + if (window.location.origin !== "https://{{host}}:{{ports[https][0]}}") { + window.location = new URL(window.location.pathname, "https://{{host}}:{{ports[https][0]}}") + } +</script> +<p> + To pass, the icon must show a white check mark on a green background. +</p> diff --git a/testing/web-platform/tests/appmanifest/icons-member/icons-member-last-matching-manual.html b/testing/web-platform/tests/appmanifest/icons-member/icons-member-last-matching-manual.html new file mode 100644 index 0000000000..a02ddc3a50 --- /dev/null +++ b/testing/web-platform/tests/appmanifest/icons-member/icons-member-last-matching-manual.html @@ -0,0 +1,9 @@ +<!DOCTYPE html> +<title>Test that icons member is supported</title> +<link rel="help" href="https://w3c.github.io/manifest#icons-member" /> +<link rel="manifest" href="resources/icons-member-last-matching.webmanifest" /> +<script src="resources/icons-member-manual.js"></script> +<h1>Testing support for icons member</h1> +<p> + To pass, the icon must show a white check mark on a green background. +</p> diff --git a/testing/web-platform/tests/appmanifest/icons-member/icons-member-manual.html b/testing/web-platform/tests/appmanifest/icons-member/icons-member-manual.html new file mode 100644 index 0000000000..6a9b7620ed --- /dev/null +++ b/testing/web-platform/tests/appmanifest/icons-member/icons-member-manual.html @@ -0,0 +1,9 @@ +<!DOCTYPE html> +<title>Test that icons member is supported</title> +<link rel="help" href="https://w3c.github.io/manifest#icons-member" /> +<link rel="manifest" href="resources/icons-member.webmanifest" /> +<script src="resources/icons-member-manual.js"></script> +<h1>Testing support for icons member</h1> +<p> + To pass, the icon should must a white check mark on a green background. +</p> diff --git a/testing/web-platform/tests/appmanifest/icons-member/icons-member-next-appropriate-manual.html b/testing/web-platform/tests/appmanifest/icons-member/icons-member-next-appropriate-manual.html new file mode 100644 index 0000000000..8e87fc1062 --- /dev/null +++ b/testing/web-platform/tests/appmanifest/icons-member/icons-member-next-appropriate-manual.html @@ -0,0 +1,9 @@ +<!DOCTYPE html> +<title>Test that icons member is supported</title> +<link rel="help" href="https://w3c.github.io/manifest#icons-member" /> +<link rel="manifest" href="resources/icons-member-next-appropriate.webmanifest" /> +<script src="resources/icons-member-manual.js"></script> +<h1>Testing support for icons member</h1> +<p> + To pass, the icon must show a white check mark on a green background. +</p> diff --git a/testing/web-platform/tests/appmanifest/icons-member/icons-member-service-worker.js b/testing/web-platform/tests/appmanifest/icons-member/icons-member-service-worker.js new file mode 100644 index 0000000000..21b07f8515 --- /dev/null +++ b/testing/web-platform/tests/appmanifest/icons-member/icons-member-service-worker.js @@ -0,0 +1,59 @@ +// Some user agents only offer app installation if there is a SW and it handles +// offline requests. + +const cacheVersion = "1.2"; +const CACHE_NAME = `cache-v${cacheVersion}`; + +// The resources cached by this service worker. +const resources = [ + "icons-member-cors-fail-manual.sub.html", + "icons-member-cors-manual.sub.html", + "icons-member-csp-fail-manual.sub.html", + "icons-member-csp-manual.sub.html", + "icons-member-last-matching-manual.html", + "icons-member-manual.html", + "icons-member-next-appropriate-manual.html", + "icons-member-service-worker.js", + "resources/icons-member-manual.js", + "resources/fail.png", + "resources/pass.png" +]; + +// Load all resources for this service worker. +const precache = async () => { + const cache = await caches.open(CACHE_NAME); + await cache.addAll(resources); +}; + +// Get a resource from the cache. +const fromCache = async request => { + const cache = await caches.open(CACHE_NAME); + return await cache.match(request.url); +}; + +// Attempt to get resources from the network first, fallback to the cache if we're +// offline. +const networkFallbackToCache = async request => { + try { + const response = await fetch(request); + if (response.ok) return response; + } catch (err) {} + return await fromCache(request); +}; + +// When we have a new service worker, update the caches and swap immediately. +self.addEventListener("install", e => { + e.waitUntil(precache().then(() => self.skipWaiting())); +}); + +// Claim existing clients. +self.addEventListener("activate", e => { + e.waitUntil(self.clients.claim()); +}); + +// When a resource need to be fetched, check whether it is +// contained in the cache and return the cached version, otherwise +// get it from the network. +self.addEventListener("fetch", e => { + e.respondWith(networkFallbackToCache(e.request)); +}); diff --git a/testing/web-platform/tests/appmanifest/icons-member/resources/fail.png b/testing/web-platform/tests/appmanifest/icons-member/resources/fail.png Binary files differnew file mode 100644 index 0000000000..1d596c6ba6 --- /dev/null +++ b/testing/web-platform/tests/appmanifest/icons-member/resources/fail.png diff --git a/testing/web-platform/tests/appmanifest/icons-member/resources/icons-member-cors-fail.sub.webmanifest b/testing/web-platform/tests/appmanifest/icons-member/resources/icons-member-cors-fail.sub.webmanifest new file mode 100644 index 0000000000..24e2214365 --- /dev/null +++ b/testing/web-platform/tests/appmanifest/icons-member/resources/icons-member-cors-fail.sub.webmanifest @@ -0,0 +1,10 @@ +{ + "name": "Icons member (CORS violation) WPT", + "icons": [{ + "src": "https://{{host}}:{{ports[https][1]}}/appmanifest/icons-member/resources/fail.png", + "sizes": "256x256", + "type": "image/png" + }], + "start_url": "../icons-member-cors-fail-manual.sub.html", + "display": "fullscreen" +} diff --git a/testing/web-platform/tests/appmanifest/icons-member/resources/icons-member-cors-fail.webmanifest.headers b/testing/web-platform/tests/appmanifest/icons-member/resources/icons-member-cors-fail.webmanifest.headers new file mode 100644 index 0000000000..2bab061d43 --- /dev/null +++ b/testing/web-platform/tests/appmanifest/icons-member/resources/icons-member-cors-fail.webmanifest.headers @@ -0,0 +1 @@ +Content-Type: application/manifest+json; charset=utf-8 diff --git a/testing/web-platform/tests/appmanifest/icons-member/resources/icons-member-cors.sub.webmanifest b/testing/web-platform/tests/appmanifest/icons-member/resources/icons-member-cors.sub.webmanifest new file mode 100644 index 0000000000..33cb12654b --- /dev/null +++ b/testing/web-platform/tests/appmanifest/icons-member/resources/icons-member-cors.sub.webmanifest @@ -0,0 +1,10 @@ +{ + "name": "Icons member (via CORS) WPT", + "icons": [{ + "src": "https://{{host}}:{{ports[https][1]}}/appmanifest/icons-member/resources/pass.png", + "sizes": "256x256", + "type": "image/png" + }], + "start_url": "../icons-member-cors-manual.sub.html", + "display": "fullscreen" +} diff --git a/testing/web-platform/tests/appmanifest/icons-member/resources/icons-member-cors.webmanifest.headers b/testing/web-platform/tests/appmanifest/icons-member/resources/icons-member-cors.webmanifest.headers new file mode 100644 index 0000000000..2bab061d43 --- /dev/null +++ b/testing/web-platform/tests/appmanifest/icons-member/resources/icons-member-cors.webmanifest.headers @@ -0,0 +1 @@ +Content-Type: application/manifest+json; charset=utf-8 diff --git a/testing/web-platform/tests/appmanifest/icons-member/resources/icons-member-csp-fail.webmanifest b/testing/web-platform/tests/appmanifest/icons-member/resources/icons-member-csp-fail.webmanifest new file mode 100644 index 0000000000..2b614ebb01 --- /dev/null +++ b/testing/web-platform/tests/appmanifest/icons-member/resources/icons-member-csp-fail.webmanifest @@ -0,0 +1,10 @@ +{ + "name": "Icons member (CSP violation) WPT", + "icons": [{ + "src": "fail.png", + "sizes": "256x256", + "type": "image/png" + }], + "start_url": "../icons-member-csp-fail-manual.sub.html", + "display": "fullscreen" +} diff --git a/testing/web-platform/tests/appmanifest/icons-member/resources/icons-member-csp-fail.webmanifest.headers b/testing/web-platform/tests/appmanifest/icons-member/resources/icons-member-csp-fail.webmanifest.headers new file mode 100644 index 0000000000..2bab061d43 --- /dev/null +++ b/testing/web-platform/tests/appmanifest/icons-member/resources/icons-member-csp-fail.webmanifest.headers @@ -0,0 +1 @@ +Content-Type: application/manifest+json; charset=utf-8 diff --git a/testing/web-platform/tests/appmanifest/icons-member/resources/icons-member-csp.sub.webmanifest b/testing/web-platform/tests/appmanifest/icons-member/resources/icons-member-csp.sub.webmanifest new file mode 100644 index 0000000000..f1089bba3c --- /dev/null +++ b/testing/web-platform/tests/appmanifest/icons-member/resources/icons-member-csp.sub.webmanifest @@ -0,0 +1,10 @@ +{ + "name": "Icons member (CSP check) WPT", + "icons": [{ + "src": "https://{{host}}:{{ports[https][1]}}/appmanifest/icons-member/resources/pass.png", + "sizes": "256x256", + "type": "image/png" + }], + "start_url": "../icons-member-csp-manual.sub.html", + "display": "fullscreen" +} diff --git a/testing/web-platform/tests/appmanifest/icons-member/resources/icons-member-csp.webmanifest.headers b/testing/web-platform/tests/appmanifest/icons-member/resources/icons-member-csp.webmanifest.headers new file mode 100644 index 0000000000..2bab061d43 --- /dev/null +++ b/testing/web-platform/tests/appmanifest/icons-member/resources/icons-member-csp.webmanifest.headers @@ -0,0 +1 @@ +Content-Type: application/manifest+json; charset=utf-8 diff --git a/testing/web-platform/tests/appmanifest/icons-member/resources/icons-member-last-matching.webmanifest b/testing/web-platform/tests/appmanifest/icons-member/resources/icons-member-last-matching.webmanifest new file mode 100644 index 0000000000..04ac33112d --- /dev/null +++ b/testing/web-platform/tests/appmanifest/icons-member/resources/icons-member-last-matching.webmanifest @@ -0,0 +1,14 @@ +{ + "name": "Icons member WPT", + "icons": [{ + "src": "fail.png", + "sizes": "256x256", + "type": "image/png" + }, { + "src": "pass.png", + "sizes": "256x256", + "type": "image/png" + }], + "start_url": "../icons-member-last-matching-manual.html", + "display": "fullscreen" +} diff --git a/testing/web-platform/tests/appmanifest/icons-member/resources/icons-member-last-matching.webmanifest.headers b/testing/web-platform/tests/appmanifest/icons-member/resources/icons-member-last-matching.webmanifest.headers new file mode 100644 index 0000000000..2bab061d43 --- /dev/null +++ b/testing/web-platform/tests/appmanifest/icons-member/resources/icons-member-last-matching.webmanifest.headers @@ -0,0 +1 @@ +Content-Type: application/manifest+json; charset=utf-8 diff --git a/testing/web-platform/tests/appmanifest/icons-member/resources/icons-member-manual.js b/testing/web-platform/tests/appmanifest/icons-member/resources/icons-member-manual.js new file mode 100644 index 0000000000..cf149792a3 --- /dev/null +++ b/testing/web-platform/tests/appmanifest/icons-member/resources/icons-member-manual.js @@ -0,0 +1,4 @@ +if ('serviceWorker' in navigator) { + navigator.serviceWorker.register( + 'icons-member-service-worker.js'); +} diff --git a/testing/web-platform/tests/appmanifest/icons-member/resources/icons-member-next-appropriate.webmanifest b/testing/web-platform/tests/appmanifest/icons-member/resources/icons-member-next-appropriate.webmanifest new file mode 100644 index 0000000000..e65169b06a --- /dev/null +++ b/testing/web-platform/tests/appmanifest/icons-member/resources/icons-member-next-appropriate.webmanifest @@ -0,0 +1,13 @@ +{ + "name": "Icons member WPT", + "icons": [{ + "src": "pass.png", + "sizes": "256x256", + "type": "image/png" + }, { + "src": "../icons-member-manual.html", + "sizes": "256x256" + }], + "start_url": "../icons-member-next-appropriate-manual.html", + "display": "fullscreen" +} diff --git a/testing/web-platform/tests/appmanifest/icons-member/resources/icons-member-next-appropriate.webmanifest.headers b/testing/web-platform/tests/appmanifest/icons-member/resources/icons-member-next-appropriate.webmanifest.headers new file mode 100644 index 0000000000..2bab061d43 --- /dev/null +++ b/testing/web-platform/tests/appmanifest/icons-member/resources/icons-member-next-appropriate.webmanifest.headers @@ -0,0 +1 @@ +Content-Type: application/manifest+json; charset=utf-8 diff --git a/testing/web-platform/tests/appmanifest/icons-member/resources/icons-member.webmanifest b/testing/web-platform/tests/appmanifest/icons-member/resources/icons-member.webmanifest new file mode 100644 index 0000000000..8e7a2c3426 --- /dev/null +++ b/testing/web-platform/tests/appmanifest/icons-member/resources/icons-member.webmanifest @@ -0,0 +1,10 @@ +{ + "name": "Icons member WPT", + "icons": [{ + "src": "pass.png", + "sizes": "256x256", + "type": "image/png" + }], + "start_url": "../icons-member-manual.html", + "display": "fullscreen" +} diff --git a/testing/web-platform/tests/appmanifest/icons-member/resources/icons-member.webmanifest.headers b/testing/web-platform/tests/appmanifest/icons-member/resources/icons-member.webmanifest.headers new file mode 100644 index 0000000000..2bab061d43 --- /dev/null +++ b/testing/web-platform/tests/appmanifest/icons-member/resources/icons-member.webmanifest.headers @@ -0,0 +1 @@ +Content-Type: application/manifest+json; charset=utf-8 diff --git a/testing/web-platform/tests/appmanifest/icons-member/resources/pass.png b/testing/web-platform/tests/appmanifest/icons-member/resources/pass.png Binary files differnew file mode 100644 index 0000000000..be7433a3e2 --- /dev/null +++ b/testing/web-platform/tests/appmanifest/icons-member/resources/pass.png diff --git a/testing/web-platform/tests/appmanifest/icons-member/resources/pass.png.sub.headers b/testing/web-platform/tests/appmanifest/icons-member/resources/pass.png.sub.headers new file mode 100644 index 0000000000..adf190aa8e --- /dev/null +++ b/testing/web-platform/tests/appmanifest/icons-member/resources/pass.png.sub.headers @@ -0,0 +1 @@ +Access-Control-Allow-Origin: https://{{host}}:{{ports[https][0]}} |