From 43a97878ce14b72f0981164f87f2e35e14151312 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 11:22:09 +0200 Subject: Adding upstream version 110.0.1. Signed-off-by: Daniel Baumann --- testing/web-platform/tests/appmanifest/META.yml | 6 ++ ...isplay-member-media-feature-browser-manual.html | 36 ++++++++++ ...lay-member-media-feature-fullscreen-manual.html | 36 ++++++++++ ...lay-member-media-feature-minimal-ui-manual.html | 36 ++++++++++ .../display-member-media-feature-service-worker.js | 55 ++++++++++++++++ ...lay-member-media-feature-standalone-manual.html | 36 ++++++++++ ...isplay-member-media-feature-browser.webmanifest | 11 ++++ ...ember-media-feature-browser.webmanifest.headers | 1 + ...lay-member-media-feature-fullscreen.webmanifest | 11 ++++ ...er-media-feature-fullscreen.webmanifest.headers | 1 + .../display-member-media-feature-manual.js | 4 ++ ...lay-member-media-feature-minimal-ui.webmanifest | 11 ++++ ...er-media-feature-minimal-ui.webmanifest.headers | 1 + ...lay-member-media-feature-standalone.webmanifest | 11 ++++ ...er-media-feature-standalone.webmanifest.headers | 1 + .../appmanifest/display-member/resources/icon.png | Bin 0 -> 9612 bytes ...n-window-controls-overlay-manual.tentative.html | 73 +++++++++++++++++++++ ...s-window-controls-overlay-manual.tentative.html | 67 +++++++++++++++++++ ...ber-media-feature-browser-manual.tentative.html | 35 ++++++++++ ...-media-feature-fullscreen-manual.tentative.html | 35 ++++++++++ ...-media-feature-minimal-ui-manual.tentative.html | 35 ++++++++++ ...override-member-media-feature-service-worker.js | 59 +++++++++++++++++ ...-media-feature-standalone-manual.tentative.html | 35 ++++++++++ ...ndalone-overrides-browser-manual.tentative.html | 37 +++++++++++ ...overlay-overrides-browser-manual.tentative.html | 43 ++++++++++++ ...-app-region-window-controls-overlay.webmanifest | 12 ++++ ...ion-window-controls-overlay.webmanifest.headers | 1 + ...t-variables-window-controls-overlay.webmanifest | 12 ++++ ...les-window-controls-overlay.webmanifest.headers | 1 + ...erride-member-media-feature-browser.webmanifest | 11 ++++ ...ember-media-feature-browser.webmanifest.headers | 1 + ...ide-member-media-feature-fullscreen.webmanifest | 11 ++++ ...er-media-feature-fullscreen.webmanifest.headers | 1 + ...display-override-member-media-feature-manual.js | 4 ++ ...ide-member-media-feature-minimal-ui.webmanifest | 11 ++++ ...er-media-feature-minimal-ui.webmanifest.headers | 1 + ...eature-standalone-overrides-browser.webmanifest | 12 ++++ ...tandalone-overrides-browser.webmanifest.headers | 1 + ...ide-member-media-feature-standalone.webmanifest | 11 ++++ ...er-media-feature-standalone.webmanifest.headers | 1 + ...-controls-overlay-overrides-browser.webmanifest | 12 ++++ ...s-overlay-overrides-browser.webmanifest.headers | 1 + .../display-override-member/resources/icon.png | Bin 0 -> 8565 bytes .../file_handlers-member-manual.tentative.html | 42 ++++++++++++ .../file_handlers-member-service-worker.js | 52 +++++++++++++++ .../resources/file_handlers-member.js | 39 +++++++++++ .../resources/file_handlers-member.webmanifest | 21 ++++++ .../resources/file_handlers-sample-file.txt | 1 + .../file_handlers-member/resources/icon.png | Bin 0 -> 3799 bytes .../icons-member-cors-fail-manual.sub.html | 16 +++++ .../icons-member/icons-member-cors-manual.sub.html | 16 +++++ .../icons-member-csp-fail-manual.sub.html | 17 +++++ .../icons-member/icons-member-csp-manual.sub.html | 17 +++++ .../icons-member-last-matching-manual.html | 9 +++ .../icons-member/icons-member-manual.html | 9 +++ .../icons-member-next-appropriate-manual.html | 9 +++ .../icons-member/icons-member-service-worker.js | 59 +++++++++++++++++ .../appmanifest/icons-member/resources/fail.png | Bin 0 -> 5957 bytes .../icons-member-cors-fail.sub.webmanifest | 10 +++ .../icons-member-cors-fail.webmanifest.headers | 1 + .../resources/icons-member-cors.sub.webmanifest | 10 +++ .../icons-member-cors.webmanifest.headers | 1 + .../resources/icons-member-csp-fail.webmanifest | 10 +++ .../icons-member-csp-fail.webmanifest.headers | 1 + .../resources/icons-member-csp.sub.webmanifest | 10 +++ .../resources/icons-member-csp.webmanifest.headers | 1 + .../icons-member-last-matching.webmanifest | 14 ++++ .../icons-member-last-matching.webmanifest.headers | 1 + .../icons-member/resources/icons-member-manual.js | 4 ++ .../icons-member-next-appropriate.webmanifest | 13 ++++ ...ons-member-next-appropriate.webmanifest.headers | 1 + .../resources/icons-member.webmanifest | 10 +++ .../resources/icons-member.webmanifest.headers | 1 + .../appmanifest/icons-member/resources/pass.png | Bin 0 -> 5684 bytes .../icons-member/resources/pass.png.sub.headers | 1 + .../tests/appmanifest/id-member/icon.png | Bin 0 -> 14565 bytes .../id-member-manifest-update-manual-v1.html | 29 ++++++++ .../id-member-manifest-update-manual-v2.html | 25 +++++++ ...id-member-manifest-update-manual.tentative.html | 22 +++++++ .../id-member-manifest-update-v1.webmanifest | 13 ++++ ...d-member-manifest-update-v1.webmanifest.headers | 1 + .../id-member-manifest-update-v2.webmanifest | 13 ++++ ...d-member-manifest-update-v2.webmanifest.headers | 1 + .../id-member/id-member-manifest-update.js | 34 ++++++++++ .../id-member/id-member-service-worker.js | 8 +++ .../name-member/name-member-manual.html | 9 +++ .../name-member/name-member-service-worker.js | 52 +++++++++++++++ .../appmanifest/name-member/resources/icon.png | Bin 0 -> 9836 bytes .../resources/name-member-fail.webmanifest | 11 ++++ .../resources/name-member-fail.webmanifest.headers | 1 + .../name-member/resources/name-member-manual.js | 4 ++ .../name-member/resources/name-member.webmanifest | 11 ++++ .../resources/name-member.webmanifest.headers | 1 + .../orientation-member-landscape-manual.html | 25 +++++++ .../orientation-member-portrait-manual.html | 25 +++++++ .../orientation-member-service-worker.js | 53 +++++++++++++++ .../orientation-member/resources/icon.png | Bin 0 -> 9871 bytes .../orientation-member-landscape.webmanifest | 12 ++++ ...rientation-member-landscape.webmanifest.headers | 1 + .../resources/orientation-member-manual.js | 4 ++ .../orientation-member-portrait.webmanifest | 12 ++++ ...orientation-member-portrait.webmanifest.headers | 1 + .../protocol_handlers-member-manual.tentative.html | 34 ++++++++++ .../protocol_handlers-member-service-worker.js | 52 +++++++++++++++ .../protocol_handlers-member/resources/icon.png | Bin 0 -> 1520 bytes .../resources/protocol_handlers-member.webmanifest | 18 +++++ .../protocol_handlers-member.webmanifest.headers | 1 + .../resources/protocol_handlers_entry.html | 19 ++++++ .../short_name-member/resources/icon.png | Bin 0 -> 8321 bytes .../resources/short_name-member-manual.js | 4 ++ .../resources/short_name-member.webmanifest | 11 ++++ .../short_name-member.webmanifest.headers | 1 + .../short_name-member-manual.html | 9 +++ .../short_name-member-service-worker.js | 52 +++++++++++++++ .../shortcuts-member/resources/pass.png | Bin 0 -> 5684 bytes .../resources/pass.png.sub.headers | 1 + .../shortcuts-member-cors-fail.sub.webmanifest | 22 +++++++ .../shortcuts-member-cors-fail.webmanifest.headers | 1 + .../shortcuts-member-cors.sub.webmanifest | 22 +++++++ .../shortcuts-member-cors.webmanifest.headers | 1 + .../shortcuts-member-csp-fail.webmanifest | 22 +++++++ .../shortcuts-member-csp-fail.webmanifest.headers | 1 + .../resources/shortcuts-member-csp.sub.webmanifest | 22 +++++++ .../shortcuts-member-csp.webmanifest.headers | 1 + .../resources/shortcuts-member-manual.js | 4 ++ ...hortcuts-member-skip-for-empty-name.webmanifest | 27 ++++++++ ...-member-skip-for-empty-name.webmanifest.headers | 1 + ...ortcuts-member-skip-for-invalid-url.webmanifest | 27 ++++++++ ...member-skip-for-invalid-url.webmanifest.headers | 1 + ...ts-member-skip-for-out-of-scope-url.webmanifest | 27 ++++++++ ...r-skip-for-out-of-scope-url.webmanifest.headers | 1 + ...cuts-member-skip-for-undefined-name.webmanifest | 26 ++++++++ ...ber-skip-for-undefined-name.webmanifest.headers | 1 + ...tcuts-member-skip-for-undefined-url.webmanifest | 26 ++++++++ ...mber-skip-for-undefined-url.webmanifest.headers | 1 + .../resources/shortcuts-member.webmanifest | 22 +++++++ .../resources/shortcuts-member.webmanifest.headers | 1 + .../shortcuts-member/shortcut_fail.html | 4 ++ .../shortcuts-member/shortcut_pass.html | 4 ++ .../shortcuts-member-cors-fail-manual.sub.html | 17 +++++ .../shortcuts-member-cors-manual.sub.html | 17 +++++ .../shortcuts-member-csp-fail-manual.sub.html | 18 +++++ .../shortcuts-member-csp-manual.sub.html | 18 +++++ .../shortcuts-member/shortcuts-member-manual.html | 10 +++ .../shortcuts-member-service-worker.js | 61 +++++++++++++++++ ...hortcuts-member-skip-for-empty-name-manual.html | 9 +++ ...ortcuts-member-skip-for-invalid-url-manual.html | 9 +++ ...ts-member-skip-for-out-of-scope-url-manual.html | 9 +++ ...cuts-member-skip-for-undefined-name-manual.html | 9 +++ ...tcuts-member-skip-for-undefined-url-manual.html | 9 +++ .../tests/appmanifest/start_url-member/fail.html | 4 ++ .../tests/appmanifest/start_url-member/pass.html | 5 ++ .../start_url-member/resources/icon.png | Bin 0 -> 8364 bytes .../start_url-member-fail.sub.webmanifest | 11 ++++ .../start_url-member-fail.sub.webmanifest.headers | 1 + .../resources/start_url-member-manual.js | 4 ++ .../resources/start_url-member.webmanifest | 11 ++++ .../resources/start_url-member.webmanifest.headers | 1 + .../start_url-member-fail-manual.sub.html | 16 +++++ .../start_url-member-pass-manual.html | 9 +++ .../start_url-member-service-worker.js | 55 ++++++++++++++++ .../theme_color-member/resources/icon.png | Bin 0 -> 6591 bytes .../resources/theme_color-member-hsl.webmanifest | 12 ++++ .../theme_color-member-hsl.webmanifest.headers | 1 + .../resources/theme_color-member-manual.js | 4 ++ .../resources/theme_color-member-named.webmanifest | 12 ++++ .../theme_color-member-named.webmanifest.headers | 1 + .../resources/theme_color-member-rgb.webmanifest | 12 ++++ .../theme_color-member-rgb.webmanifest.headers | 1 + .../theme_color-member-rgbhex3.webmanifest | 12 ++++ .../theme_color-member-rgbhex3.webmanifest.headers | 1 + .../theme_color-member-rgbhex6.webmanifest | 12 ++++ .../theme_color-member-rgbhex6.webmanifest.headers | 1 + .../theme_color-member-rgblegacy.webmanifest | 12 ++++ ...heme_color-member-rgblegacy.webmanifest.headers | 1 + .../theme_color-member-hsl-manual.html | 9 +++ .../theme_color-member-named-manual.html | 9 +++ .../theme_color-member-rgb-manual.html | 9 +++ .../theme_color-member-rgbhex3-manual.html | 9 +++ .../theme_color-member-rgbhex6-manual.html | 9 +++ .../theme_color-member-rgblegacy-manual.html | 9 +++ .../theme_color-member-service-worker.js | 57 ++++++++++++++++ .../unrecognized-member/resources/icon.png | Bin 0 -> 9836 bytes .../resources/unrecognized-member-manual.js | 4 ++ .../resources/unrecognized-member.webmanifest | 15 +++++ .../unrecognized-member.webmanifest.headers | 1 + .../unrecognized-member-manual.html | 10 +++ .../unrecognized-member-service-worker.js | 52 +++++++++++++++ .../user_preferences-member/resources/icon.png | Bin 0 -> 104 bytes .../resources/user_preferences-member-manual.js | 4 ++ .../resources/user_preferences-member.webmanifest | 22 +++++++ .../user_preferences-member.webmanifest.headers | 1 + .../user_preferences-member-manual.html | 13 ++++ .../user_preferences-member-service-worker.js | 52 +++++++++++++++ 194 files changed, 2681 insertions(+) create mode 100644 testing/web-platform/tests/appmanifest/META.yml create mode 100644 testing/web-platform/tests/appmanifest/display-member/display-member-media-feature-browser-manual.html create mode 100644 testing/web-platform/tests/appmanifest/display-member/display-member-media-feature-fullscreen-manual.html create mode 100644 testing/web-platform/tests/appmanifest/display-member/display-member-media-feature-minimal-ui-manual.html create mode 100644 testing/web-platform/tests/appmanifest/display-member/display-member-media-feature-service-worker.js create mode 100644 testing/web-platform/tests/appmanifest/display-member/display-member-media-feature-standalone-manual.html create mode 100644 testing/web-platform/tests/appmanifest/display-member/resources/display-member-media-feature-browser.webmanifest create mode 100644 testing/web-platform/tests/appmanifest/display-member/resources/display-member-media-feature-browser.webmanifest.headers create mode 100644 testing/web-platform/tests/appmanifest/display-member/resources/display-member-media-feature-fullscreen.webmanifest create mode 100644 testing/web-platform/tests/appmanifest/display-member/resources/display-member-media-feature-fullscreen.webmanifest.headers create mode 100644 testing/web-platform/tests/appmanifest/display-member/resources/display-member-media-feature-manual.js create mode 100644 testing/web-platform/tests/appmanifest/display-member/resources/display-member-media-feature-minimal-ui.webmanifest create mode 100644 testing/web-platform/tests/appmanifest/display-member/resources/display-member-media-feature-minimal-ui.webmanifest.headers create mode 100644 testing/web-platform/tests/appmanifest/display-member/resources/display-member-media-feature-standalone.webmanifest create mode 100644 testing/web-platform/tests/appmanifest/display-member/resources/display-member-media-feature-standalone.webmanifest.headers create mode 100644 testing/web-platform/tests/appmanifest/display-member/resources/icon.png create mode 100644 testing/web-platform/tests/appmanifest/display-override-member/display-override-member-app-region-window-controls-overlay-manual.tentative.html create mode 100644 testing/web-platform/tests/appmanifest/display-override-member/display-override-member-css-environment-variables-window-controls-overlay-manual.tentative.html create mode 100644 testing/web-platform/tests/appmanifest/display-override-member/display-override-member-media-feature-browser-manual.tentative.html create mode 100644 testing/web-platform/tests/appmanifest/display-override-member/display-override-member-media-feature-fullscreen-manual.tentative.html create mode 100644 testing/web-platform/tests/appmanifest/display-override-member/display-override-member-media-feature-minimal-ui-manual.tentative.html create mode 100644 testing/web-platform/tests/appmanifest/display-override-member/display-override-member-media-feature-service-worker.js create mode 100644 testing/web-platform/tests/appmanifest/display-override-member/display-override-member-media-feature-standalone-manual.tentative.html create mode 100644 testing/web-platform/tests/appmanifest/display-override-member/display-override-member-media-feature-standalone-overrides-browser-manual.tentative.html create mode 100644 testing/web-platform/tests/appmanifest/display-override-member/display-override-member-media-feature-window-controls-overlay-overrides-browser-manual.tentative.html create mode 100644 testing/web-platform/tests/appmanifest/display-override-member/resources/display-override-member-app-region-window-controls-overlay.webmanifest create mode 100644 testing/web-platform/tests/appmanifest/display-override-member/resources/display-override-member-app-region-window-controls-overlay.webmanifest.headers create mode 100644 testing/web-platform/tests/appmanifest/display-override-member/resources/display-override-member-css-environment-variables-window-controls-overlay.webmanifest create mode 100644 testing/web-platform/tests/appmanifest/display-override-member/resources/display-override-member-css-environment-variables-window-controls-overlay.webmanifest.headers create mode 100644 testing/web-platform/tests/appmanifest/display-override-member/resources/display-override-member-media-feature-browser.webmanifest create mode 100644 testing/web-platform/tests/appmanifest/display-override-member/resources/display-override-member-media-feature-browser.webmanifest.headers create mode 100644 testing/web-platform/tests/appmanifest/display-override-member/resources/display-override-member-media-feature-fullscreen.webmanifest create mode 100644 testing/web-platform/tests/appmanifest/display-override-member/resources/display-override-member-media-feature-fullscreen.webmanifest.headers create mode 100644 testing/web-platform/tests/appmanifest/display-override-member/resources/display-override-member-media-feature-manual.js create mode 100644 testing/web-platform/tests/appmanifest/display-override-member/resources/display-override-member-media-feature-minimal-ui.webmanifest create mode 100644 testing/web-platform/tests/appmanifest/display-override-member/resources/display-override-member-media-feature-minimal-ui.webmanifest.headers create mode 100644 testing/web-platform/tests/appmanifest/display-override-member/resources/display-override-member-media-feature-standalone-overrides-browser.webmanifest create mode 100644 testing/web-platform/tests/appmanifest/display-override-member/resources/display-override-member-media-feature-standalone-overrides-browser.webmanifest.headers create mode 100644 testing/web-platform/tests/appmanifest/display-override-member/resources/display-override-member-media-feature-standalone.webmanifest create mode 100644 testing/web-platform/tests/appmanifest/display-override-member/resources/display-override-member-media-feature-standalone.webmanifest.headers create mode 100644 testing/web-platform/tests/appmanifest/display-override-member/resources/display-override-member-media-feature-window-controls-overlay-overrides-browser.webmanifest create mode 100644 testing/web-platform/tests/appmanifest/display-override-member/resources/display-override-member-media-feature-window-controls-overlay-overrides-browser.webmanifest.headers create mode 100644 testing/web-platform/tests/appmanifest/display-override-member/resources/icon.png create mode 100644 testing/web-platform/tests/appmanifest/file_handlers-member/file_handlers-member-manual.tentative.html create mode 100644 testing/web-platform/tests/appmanifest/file_handlers-member/file_handlers-member-service-worker.js create mode 100644 testing/web-platform/tests/appmanifest/file_handlers-member/resources/file_handlers-member.js create mode 100644 testing/web-platform/tests/appmanifest/file_handlers-member/resources/file_handlers-member.webmanifest create mode 100644 testing/web-platform/tests/appmanifest/file_handlers-member/resources/file_handlers-sample-file.txt create mode 100644 testing/web-platform/tests/appmanifest/file_handlers-member/resources/icon.png create mode 100644 testing/web-platform/tests/appmanifest/icons-member/icons-member-cors-fail-manual.sub.html create mode 100644 testing/web-platform/tests/appmanifest/icons-member/icons-member-cors-manual.sub.html create mode 100644 testing/web-platform/tests/appmanifest/icons-member/icons-member-csp-fail-manual.sub.html create mode 100644 testing/web-platform/tests/appmanifest/icons-member/icons-member-csp-manual.sub.html create mode 100644 testing/web-platform/tests/appmanifest/icons-member/icons-member-last-matching-manual.html create mode 100644 testing/web-platform/tests/appmanifest/icons-member/icons-member-manual.html create mode 100644 testing/web-platform/tests/appmanifest/icons-member/icons-member-next-appropriate-manual.html create mode 100644 testing/web-platform/tests/appmanifest/icons-member/icons-member-service-worker.js create mode 100644 testing/web-platform/tests/appmanifest/icons-member/resources/fail.png create mode 100644 testing/web-platform/tests/appmanifest/icons-member/resources/icons-member-cors-fail.sub.webmanifest create mode 100644 testing/web-platform/tests/appmanifest/icons-member/resources/icons-member-cors-fail.webmanifest.headers create mode 100644 testing/web-platform/tests/appmanifest/icons-member/resources/icons-member-cors.sub.webmanifest create mode 100644 testing/web-platform/tests/appmanifest/icons-member/resources/icons-member-cors.webmanifest.headers create mode 100644 testing/web-platform/tests/appmanifest/icons-member/resources/icons-member-csp-fail.webmanifest create mode 100644 testing/web-platform/tests/appmanifest/icons-member/resources/icons-member-csp-fail.webmanifest.headers create mode 100644 testing/web-platform/tests/appmanifest/icons-member/resources/icons-member-csp.sub.webmanifest create mode 100644 testing/web-platform/tests/appmanifest/icons-member/resources/icons-member-csp.webmanifest.headers create mode 100644 testing/web-platform/tests/appmanifest/icons-member/resources/icons-member-last-matching.webmanifest create mode 100644 testing/web-platform/tests/appmanifest/icons-member/resources/icons-member-last-matching.webmanifest.headers create mode 100644 testing/web-platform/tests/appmanifest/icons-member/resources/icons-member-manual.js create mode 100644 testing/web-platform/tests/appmanifest/icons-member/resources/icons-member-next-appropriate.webmanifest create mode 100644 testing/web-platform/tests/appmanifest/icons-member/resources/icons-member-next-appropriate.webmanifest.headers create mode 100644 testing/web-platform/tests/appmanifest/icons-member/resources/icons-member.webmanifest create mode 100644 testing/web-platform/tests/appmanifest/icons-member/resources/icons-member.webmanifest.headers create mode 100644 testing/web-platform/tests/appmanifest/icons-member/resources/pass.png create mode 100644 testing/web-platform/tests/appmanifest/icons-member/resources/pass.png.sub.headers create mode 100644 testing/web-platform/tests/appmanifest/id-member/icon.png create mode 100644 testing/web-platform/tests/appmanifest/id-member/id-member-manifest-update-manual-v1.html create mode 100644 testing/web-platform/tests/appmanifest/id-member/id-member-manifest-update-manual-v2.html create mode 100644 testing/web-platform/tests/appmanifest/id-member/id-member-manifest-update-manual.tentative.html create mode 100644 testing/web-platform/tests/appmanifest/id-member/id-member-manifest-update-v1.webmanifest create mode 100644 testing/web-platform/tests/appmanifest/id-member/id-member-manifest-update-v1.webmanifest.headers create mode 100644 testing/web-platform/tests/appmanifest/id-member/id-member-manifest-update-v2.webmanifest create mode 100644 testing/web-platform/tests/appmanifest/id-member/id-member-manifest-update-v2.webmanifest.headers create mode 100644 testing/web-platform/tests/appmanifest/id-member/id-member-manifest-update.js create mode 100644 testing/web-platform/tests/appmanifest/id-member/id-member-service-worker.js create mode 100644 testing/web-platform/tests/appmanifest/name-member/name-member-manual.html create mode 100644 testing/web-platform/tests/appmanifest/name-member/name-member-service-worker.js create mode 100644 testing/web-platform/tests/appmanifest/name-member/resources/icon.png create mode 100644 testing/web-platform/tests/appmanifest/name-member/resources/name-member-fail.webmanifest create mode 100644 testing/web-platform/tests/appmanifest/name-member/resources/name-member-fail.webmanifest.headers create mode 100644 testing/web-platform/tests/appmanifest/name-member/resources/name-member-manual.js create mode 100644 testing/web-platform/tests/appmanifest/name-member/resources/name-member.webmanifest create mode 100644 testing/web-platform/tests/appmanifest/name-member/resources/name-member.webmanifest.headers create mode 100644 testing/web-platform/tests/appmanifest/orientation-member/orientation-member-landscape-manual.html create mode 100644 testing/web-platform/tests/appmanifest/orientation-member/orientation-member-portrait-manual.html create mode 100644 testing/web-platform/tests/appmanifest/orientation-member/orientation-member-service-worker.js create mode 100644 testing/web-platform/tests/appmanifest/orientation-member/resources/icon.png create mode 100644 testing/web-platform/tests/appmanifest/orientation-member/resources/orientation-member-landscape.webmanifest create mode 100644 testing/web-platform/tests/appmanifest/orientation-member/resources/orientation-member-landscape.webmanifest.headers create mode 100644 testing/web-platform/tests/appmanifest/orientation-member/resources/orientation-member-manual.js create mode 100644 testing/web-platform/tests/appmanifest/orientation-member/resources/orientation-member-portrait.webmanifest create mode 100644 testing/web-platform/tests/appmanifest/orientation-member/resources/orientation-member-portrait.webmanifest.headers create mode 100644 testing/web-platform/tests/appmanifest/protocol_handlers-member/protocol_handlers-member-manual.tentative.html create mode 100644 testing/web-platform/tests/appmanifest/protocol_handlers-member/protocol_handlers-member-service-worker.js create mode 100644 testing/web-platform/tests/appmanifest/protocol_handlers-member/resources/icon.png create mode 100644 testing/web-platform/tests/appmanifest/protocol_handlers-member/resources/protocol_handlers-member.webmanifest create mode 100644 testing/web-platform/tests/appmanifest/protocol_handlers-member/resources/protocol_handlers-member.webmanifest.headers create mode 100644 testing/web-platform/tests/appmanifest/protocol_handlers-member/resources/protocol_handlers_entry.html create mode 100644 testing/web-platform/tests/appmanifest/short_name-member/resources/icon.png create mode 100644 testing/web-platform/tests/appmanifest/short_name-member/resources/short_name-member-manual.js create mode 100644 testing/web-platform/tests/appmanifest/short_name-member/resources/short_name-member.webmanifest create mode 100644 testing/web-platform/tests/appmanifest/short_name-member/resources/short_name-member.webmanifest.headers create mode 100644 testing/web-platform/tests/appmanifest/short_name-member/short_name-member-manual.html create mode 100644 testing/web-platform/tests/appmanifest/short_name-member/short_name-member-service-worker.js create mode 100644 testing/web-platform/tests/appmanifest/shortcuts-member/resources/pass.png create mode 100644 testing/web-platform/tests/appmanifest/shortcuts-member/resources/pass.png.sub.headers create mode 100644 testing/web-platform/tests/appmanifest/shortcuts-member/resources/shortcuts-member-cors-fail.sub.webmanifest create mode 100644 testing/web-platform/tests/appmanifest/shortcuts-member/resources/shortcuts-member-cors-fail.webmanifest.headers create mode 100644 testing/web-platform/tests/appmanifest/shortcuts-member/resources/shortcuts-member-cors.sub.webmanifest create mode 100644 testing/web-platform/tests/appmanifest/shortcuts-member/resources/shortcuts-member-cors.webmanifest.headers create mode 100644 testing/web-platform/tests/appmanifest/shortcuts-member/resources/shortcuts-member-csp-fail.webmanifest create mode 100644 testing/web-platform/tests/appmanifest/shortcuts-member/resources/shortcuts-member-csp-fail.webmanifest.headers create mode 100644 testing/web-platform/tests/appmanifest/shortcuts-member/resources/shortcuts-member-csp.sub.webmanifest create mode 100644 testing/web-platform/tests/appmanifest/shortcuts-member/resources/shortcuts-member-csp.webmanifest.headers create mode 100644 testing/web-platform/tests/appmanifest/shortcuts-member/resources/shortcuts-member-manual.js create mode 100644 testing/web-platform/tests/appmanifest/shortcuts-member/resources/shortcuts-member-skip-for-empty-name.webmanifest create mode 100644 testing/web-platform/tests/appmanifest/shortcuts-member/resources/shortcuts-member-skip-for-empty-name.webmanifest.headers create mode 100644 testing/web-platform/tests/appmanifest/shortcuts-member/resources/shortcuts-member-skip-for-invalid-url.webmanifest create mode 100644 testing/web-platform/tests/appmanifest/shortcuts-member/resources/shortcuts-member-skip-for-invalid-url.webmanifest.headers create mode 100644 testing/web-platform/tests/appmanifest/shortcuts-member/resources/shortcuts-member-skip-for-out-of-scope-url.webmanifest create mode 100644 testing/web-platform/tests/appmanifest/shortcuts-member/resources/shortcuts-member-skip-for-out-of-scope-url.webmanifest.headers create mode 100644 testing/web-platform/tests/appmanifest/shortcuts-member/resources/shortcuts-member-skip-for-undefined-name.webmanifest create mode 100644 testing/web-platform/tests/appmanifest/shortcuts-member/resources/shortcuts-member-skip-for-undefined-name.webmanifest.headers create mode 100644 testing/web-platform/tests/appmanifest/shortcuts-member/resources/shortcuts-member-skip-for-undefined-url.webmanifest create mode 100644 testing/web-platform/tests/appmanifest/shortcuts-member/resources/shortcuts-member-skip-for-undefined-url.webmanifest.headers create mode 100644 testing/web-platform/tests/appmanifest/shortcuts-member/resources/shortcuts-member.webmanifest create mode 100644 testing/web-platform/tests/appmanifest/shortcuts-member/resources/shortcuts-member.webmanifest.headers create mode 100644 testing/web-platform/tests/appmanifest/shortcuts-member/shortcut_fail.html create mode 100644 testing/web-platform/tests/appmanifest/shortcuts-member/shortcut_pass.html create mode 100644 testing/web-platform/tests/appmanifest/shortcuts-member/shortcuts-member-cors-fail-manual.sub.html create mode 100644 testing/web-platform/tests/appmanifest/shortcuts-member/shortcuts-member-cors-manual.sub.html create mode 100644 testing/web-platform/tests/appmanifest/shortcuts-member/shortcuts-member-csp-fail-manual.sub.html create mode 100644 testing/web-platform/tests/appmanifest/shortcuts-member/shortcuts-member-csp-manual.sub.html create mode 100644 testing/web-platform/tests/appmanifest/shortcuts-member/shortcuts-member-manual.html create mode 100644 testing/web-platform/tests/appmanifest/shortcuts-member/shortcuts-member-service-worker.js create mode 100644 testing/web-platform/tests/appmanifest/shortcuts-member/shortcuts-member-skip-for-empty-name-manual.html create mode 100644 testing/web-platform/tests/appmanifest/shortcuts-member/shortcuts-member-skip-for-invalid-url-manual.html create mode 100644 testing/web-platform/tests/appmanifest/shortcuts-member/shortcuts-member-skip-for-out-of-scope-url-manual.html create mode 100644 testing/web-platform/tests/appmanifest/shortcuts-member/shortcuts-member-skip-for-undefined-name-manual.html create mode 100644 testing/web-platform/tests/appmanifest/shortcuts-member/shortcuts-member-skip-for-undefined-url-manual.html create mode 100644 testing/web-platform/tests/appmanifest/start_url-member/fail.html create mode 100644 testing/web-platform/tests/appmanifest/start_url-member/pass.html create mode 100644 testing/web-platform/tests/appmanifest/start_url-member/resources/icon.png create mode 100644 testing/web-platform/tests/appmanifest/start_url-member/resources/start_url-member-fail.sub.webmanifest create mode 100644 testing/web-platform/tests/appmanifest/start_url-member/resources/start_url-member-fail.sub.webmanifest.headers create mode 100644 testing/web-platform/tests/appmanifest/start_url-member/resources/start_url-member-manual.js create mode 100644 testing/web-platform/tests/appmanifest/start_url-member/resources/start_url-member.webmanifest create mode 100644 testing/web-platform/tests/appmanifest/start_url-member/resources/start_url-member.webmanifest.headers create mode 100644 testing/web-platform/tests/appmanifest/start_url-member/start_url-member-fail-manual.sub.html create mode 100644 testing/web-platform/tests/appmanifest/start_url-member/start_url-member-pass-manual.html create mode 100644 testing/web-platform/tests/appmanifest/start_url-member/start_url-member-service-worker.js create mode 100644 testing/web-platform/tests/appmanifest/theme_color-member/resources/icon.png create mode 100644 testing/web-platform/tests/appmanifest/theme_color-member/resources/theme_color-member-hsl.webmanifest create mode 100644 testing/web-platform/tests/appmanifest/theme_color-member/resources/theme_color-member-hsl.webmanifest.headers create mode 100644 testing/web-platform/tests/appmanifest/theme_color-member/resources/theme_color-member-manual.js create mode 100644 testing/web-platform/tests/appmanifest/theme_color-member/resources/theme_color-member-named.webmanifest create mode 100644 testing/web-platform/tests/appmanifest/theme_color-member/resources/theme_color-member-named.webmanifest.headers create mode 100644 testing/web-platform/tests/appmanifest/theme_color-member/resources/theme_color-member-rgb.webmanifest create mode 100644 testing/web-platform/tests/appmanifest/theme_color-member/resources/theme_color-member-rgb.webmanifest.headers create mode 100644 testing/web-platform/tests/appmanifest/theme_color-member/resources/theme_color-member-rgbhex3.webmanifest create mode 100644 testing/web-platform/tests/appmanifest/theme_color-member/resources/theme_color-member-rgbhex3.webmanifest.headers create mode 100644 testing/web-platform/tests/appmanifest/theme_color-member/resources/theme_color-member-rgbhex6.webmanifest create mode 100644 testing/web-platform/tests/appmanifest/theme_color-member/resources/theme_color-member-rgbhex6.webmanifest.headers create mode 100644 testing/web-platform/tests/appmanifest/theme_color-member/resources/theme_color-member-rgblegacy.webmanifest create mode 100644 testing/web-platform/tests/appmanifest/theme_color-member/resources/theme_color-member-rgblegacy.webmanifest.headers create mode 100644 testing/web-platform/tests/appmanifest/theme_color-member/theme_color-member-hsl-manual.html create mode 100644 testing/web-platform/tests/appmanifest/theme_color-member/theme_color-member-named-manual.html create mode 100644 testing/web-platform/tests/appmanifest/theme_color-member/theme_color-member-rgb-manual.html create mode 100644 testing/web-platform/tests/appmanifest/theme_color-member/theme_color-member-rgbhex3-manual.html create mode 100644 testing/web-platform/tests/appmanifest/theme_color-member/theme_color-member-rgbhex6-manual.html create mode 100644 testing/web-platform/tests/appmanifest/theme_color-member/theme_color-member-rgblegacy-manual.html create mode 100644 testing/web-platform/tests/appmanifest/theme_color-member/theme_color-member-service-worker.js create mode 100644 testing/web-platform/tests/appmanifest/unrecognized-member/resources/icon.png create mode 100644 testing/web-platform/tests/appmanifest/unrecognized-member/resources/unrecognized-member-manual.js create mode 100644 testing/web-platform/tests/appmanifest/unrecognized-member/resources/unrecognized-member.webmanifest create mode 100644 testing/web-platform/tests/appmanifest/unrecognized-member/resources/unrecognized-member.webmanifest.headers create mode 100644 testing/web-platform/tests/appmanifest/unrecognized-member/unrecognized-member-manual.html create mode 100644 testing/web-platform/tests/appmanifest/unrecognized-member/unrecognized-member-service-worker.js create mode 100644 testing/web-platform/tests/appmanifest/user_preferences-member/resources/icon.png create mode 100644 testing/web-platform/tests/appmanifest/user_preferences-member/resources/user_preferences-member-manual.js create mode 100644 testing/web-platform/tests/appmanifest/user_preferences-member/resources/user_preferences-member.webmanifest create mode 100644 testing/web-platform/tests/appmanifest/user_preferences-member/resources/user_preferences-member.webmanifest.headers create mode 100644 testing/web-platform/tests/appmanifest/user_preferences-member/user_preferences-member-manual.html create mode 100644 testing/web-platform/tests/appmanifest/user_preferences-member/user_preferences-member-service-worker.js (limited to 'testing/web-platform/tests/appmanifest') diff --git a/testing/web-platform/tests/appmanifest/META.yml b/testing/web-platform/tests/appmanifest/META.yml new file mode 100644 index 0000000000..bef14c3c79 --- /dev/null +++ b/testing/web-platform/tests/appmanifest/META.yml @@ -0,0 +1,6 @@ +spec: https://w3c.github.io/manifest/ +suggested_reviewers: + - kenchris + - marcoscaceres + - mgiuca + - christianliebel diff --git a/testing/web-platform/tests/appmanifest/display-member/display-member-media-feature-browser-manual.html b/testing/web-platform/tests/appmanifest/display-member/display-member-media-feature-browser-manual.html new file mode 100644 index 0000000000..690b4ba521 --- /dev/null +++ b/testing/web-platform/tests/appmanifest/display-member/display-member-media-feature-browser-manual.html @@ -0,0 +1,36 @@ + +Test "browser" value of display member + media feature + + + + + + +

Testing support for "browser" value of display member + media feature

+ + +

+ To pass, the background color must be green after installing. +

diff --git a/testing/web-platform/tests/appmanifest/display-member/display-member-media-feature-fullscreen-manual.html b/testing/web-platform/tests/appmanifest/display-member/display-member-media-feature-fullscreen-manual.html new file mode 100644 index 0000000000..a6db66679c --- /dev/null +++ b/testing/web-platform/tests/appmanifest/display-member/display-member-media-feature-fullscreen-manual.html @@ -0,0 +1,36 @@ + +Test "fullscreen" value of display member + media feature + + + + + + +

Testing support for "fullscreen" value of display member + media feature

+ + +

+ To pass, the background color must be green after installing. +

diff --git a/testing/web-platform/tests/appmanifest/display-member/display-member-media-feature-minimal-ui-manual.html b/testing/web-platform/tests/appmanifest/display-member/display-member-media-feature-minimal-ui-manual.html new file mode 100644 index 0000000000..b645d6cd7f --- /dev/null +++ b/testing/web-platform/tests/appmanifest/display-member/display-member-media-feature-minimal-ui-manual.html @@ -0,0 +1,36 @@ + +Test "minimal-ui" value of display member + media feature + + + + + + +

Testing support for "minimal-ui" value of display member + media feature

+ + +

+ To pass, the background color must be green after installing. +

diff --git a/testing/web-platform/tests/appmanifest/display-member/display-member-media-feature-service-worker.js b/testing/web-platform/tests/appmanifest/display-member/display-member-media-feature-service-worker.js new file mode 100644 index 0000000000..5720e3cbc3 --- /dev/null +++ b/testing/web-platform/tests/appmanifest/display-member/display-member-media-feature-service-worker.js @@ -0,0 +1,55 @@ +// 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 = [ + "display-member-media-feature-browser-manual.html", + "display-member-media-feature-fullscreen-manual.html", + "display-member-media-feature-minimal-ui-manual.html", + "display-member-media-feature-standalone-manual.html", + "display-member-media-feature-service-worker.js", + "resources/display-member-media-feature-manual.js", + "resources/icon.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/display-member/display-member-media-feature-standalone-manual.html b/testing/web-platform/tests/appmanifest/display-member/display-member-media-feature-standalone-manual.html new file mode 100644 index 0000000000..c820091f0f --- /dev/null +++ b/testing/web-platform/tests/appmanifest/display-member/display-member-media-feature-standalone-manual.html @@ -0,0 +1,36 @@ + +Test "standalone" value of display member + media feature + + + + + + +

Testing support for "standalone" value of display member + media feature

+ + +

+ To pass, the background color must be green after installing. +

diff --git a/testing/web-platform/tests/appmanifest/display-member/resources/display-member-media-feature-browser.webmanifest b/testing/web-platform/tests/appmanifest/display-member/resources/display-member-media-feature-browser.webmanifest new file mode 100644 index 0000000000..9e1f6a3350 --- /dev/null +++ b/testing/web-platform/tests/appmanifest/display-member/resources/display-member-media-feature-browser.webmanifest @@ -0,0 +1,11 @@ +{ + "name": "Display member media feature WPT", + "icons": [ + { + "src": "icon.png", + "sizes": "192x192" + } + ], + "start_url": "../display-member-media-feature-browser-manual.html", + "display": "browser" +} diff --git a/testing/web-platform/tests/appmanifest/display-member/resources/display-member-media-feature-browser.webmanifest.headers b/testing/web-platform/tests/appmanifest/display-member/resources/display-member-media-feature-browser.webmanifest.headers new file mode 100644 index 0000000000..2bab061d43 --- /dev/null +++ b/testing/web-platform/tests/appmanifest/display-member/resources/display-member-media-feature-browser.webmanifest.headers @@ -0,0 +1 @@ +Content-Type: application/manifest+json; charset=utf-8 diff --git a/testing/web-platform/tests/appmanifest/display-member/resources/display-member-media-feature-fullscreen.webmanifest b/testing/web-platform/tests/appmanifest/display-member/resources/display-member-media-feature-fullscreen.webmanifest new file mode 100644 index 0000000000..3954538e50 --- /dev/null +++ b/testing/web-platform/tests/appmanifest/display-member/resources/display-member-media-feature-fullscreen.webmanifest @@ -0,0 +1,11 @@ +{ + "name": "Display member media feature WPT", + "icons": [ + { + "src": "icon.png", + "sizes": "192x192" + } + ], + "start_url": "../display-member-media-feature-fullscreen-manual.html", + "display": "fullscreen" +} \ No newline at end of file diff --git a/testing/web-platform/tests/appmanifest/display-member/resources/display-member-media-feature-fullscreen.webmanifest.headers b/testing/web-platform/tests/appmanifest/display-member/resources/display-member-media-feature-fullscreen.webmanifest.headers new file mode 100644 index 0000000000..2bab061d43 --- /dev/null +++ b/testing/web-platform/tests/appmanifest/display-member/resources/display-member-media-feature-fullscreen.webmanifest.headers @@ -0,0 +1 @@ +Content-Type: application/manifest+json; charset=utf-8 diff --git a/testing/web-platform/tests/appmanifest/display-member/resources/display-member-media-feature-manual.js b/testing/web-platform/tests/appmanifest/display-member/resources/display-member-media-feature-manual.js new file mode 100644 index 0000000000..60723d5afe --- /dev/null +++ b/testing/web-platform/tests/appmanifest/display-member/resources/display-member-media-feature-manual.js @@ -0,0 +1,4 @@ +if ('serviceWorker' in navigator) { + navigator.serviceWorker.register( + 'display-member-media-feature-service-worker.js'); +} diff --git a/testing/web-platform/tests/appmanifest/display-member/resources/display-member-media-feature-minimal-ui.webmanifest b/testing/web-platform/tests/appmanifest/display-member/resources/display-member-media-feature-minimal-ui.webmanifest new file mode 100644 index 0000000000..9463941aa4 --- /dev/null +++ b/testing/web-platform/tests/appmanifest/display-member/resources/display-member-media-feature-minimal-ui.webmanifest @@ -0,0 +1,11 @@ +{ + "name": "Display member media feature WPT", + "icons": [ + { + "src": "icon.png", + "sizes": "192x192" + } + ], + "start_url": "../display-member-media-feature-minimal-ui-manual.html", + "display": "minimal-ui" +} \ No newline at end of file diff --git a/testing/web-platform/tests/appmanifest/display-member/resources/display-member-media-feature-minimal-ui.webmanifest.headers b/testing/web-platform/tests/appmanifest/display-member/resources/display-member-media-feature-minimal-ui.webmanifest.headers new file mode 100644 index 0000000000..2bab061d43 --- /dev/null +++ b/testing/web-platform/tests/appmanifest/display-member/resources/display-member-media-feature-minimal-ui.webmanifest.headers @@ -0,0 +1 @@ +Content-Type: application/manifest+json; charset=utf-8 diff --git a/testing/web-platform/tests/appmanifest/display-member/resources/display-member-media-feature-standalone.webmanifest b/testing/web-platform/tests/appmanifest/display-member/resources/display-member-media-feature-standalone.webmanifest new file mode 100644 index 0000000000..a8269e977c --- /dev/null +++ b/testing/web-platform/tests/appmanifest/display-member/resources/display-member-media-feature-standalone.webmanifest @@ -0,0 +1,11 @@ +{ + "name": "Display member media feature WPT", + "icons": [ + { + "src": "icon.png", + "sizes": "192x192" + } + ], + "start_url": "../display-member-media-feature-standalone-manual.html", + "display": "standalone" +} \ No newline at end of file diff --git a/testing/web-platform/tests/appmanifest/display-member/resources/display-member-media-feature-standalone.webmanifest.headers b/testing/web-platform/tests/appmanifest/display-member/resources/display-member-media-feature-standalone.webmanifest.headers new file mode 100644 index 0000000000..2bab061d43 --- /dev/null +++ b/testing/web-platform/tests/appmanifest/display-member/resources/display-member-media-feature-standalone.webmanifest.headers @@ -0,0 +1 @@ +Content-Type: application/manifest+json; charset=utf-8 diff --git a/testing/web-platform/tests/appmanifest/display-member/resources/icon.png b/testing/web-platform/tests/appmanifest/display-member/resources/icon.png new file mode 100644 index 0000000000..267cba8d1e Binary files /dev/null and b/testing/web-platform/tests/appmanifest/display-member/resources/icon.png differ diff --git a/testing/web-platform/tests/appmanifest/display-override-member/display-override-member-app-region-window-controls-overlay-manual.tentative.html b/testing/web-platform/tests/appmanifest/display-override-member/display-override-member-app-region-window-controls-overlay-manual.tentative.html new file mode 100644 index 0000000000..c802ba67fa --- /dev/null +++ b/testing/web-platform/tests/appmanifest/display-override-member/display-override-member-app-region-window-controls-overlay-manual.tentative.html @@ -0,0 +1,73 @@ + + + + + Test app-region CSS property when "window-controls-overlay" in display-override member + + +

Test app-region CSS property when "window-controls-overlay" in display-override member

+ + + + + + + + + + +

Description

+

This test validates that an element will drag the window around when running in "window-controls-overlay" mode.

+

Manual Test Steps:

+

+

    +
  1. Install this app, and toggle into "window-controls-overlay" mode.
  2. +
  3. Click and drag the blue rectangle containing the text "Drag Me". This element has the app-region:drag CSS property set.
  4. +
  5. If the app window moves around as you drag the blue rectangle, .
  6. +
+

+
+
+ Drag Me +
Not Draggable
+
+
+ + \ No newline at end of file diff --git a/testing/web-platform/tests/appmanifest/display-override-member/display-override-member-css-environment-variables-window-controls-overlay-manual.tentative.html b/testing/web-platform/tests/appmanifest/display-override-member/display-override-member-css-environment-variables-window-controls-overlay-manual.tentative.html new file mode 100644 index 0000000000..a49b4f6f98 --- /dev/null +++ b/testing/web-platform/tests/appmanifest/display-override-member/display-override-member-css-environment-variables-window-controls-overlay-manual.tentative.html @@ -0,0 +1,67 @@ + + + + + Test CSS environment variables when "window-controls-overlay" in display-override member + + +

Test CSS environment variables when "window-controls-overlay" in display-override member

+ + + + + + + + + + +

Description

+

This test validates that when in "window-controls-overlay" mode, the 'titlebar-area-*' CSS environment variables + match the values returned by navigator.windowControlsOverlay.getTitlebarAreaRect().

+

Manual Test Steps:

+

+

    +
  1. Install this app, and toggle into "window-controls-overlay" mode.
  2. +
  3. Upon toggling into "window-controls-overlay" mode, the test will validate that the CSS enviroment variable + values match the JavaScript API.
  4. +
+ Note: This test will automatically timeout and fail if not completed within 60 seconds. +

+
+ + + \ No newline at end of file diff --git a/testing/web-platform/tests/appmanifest/display-override-member/display-override-member-media-feature-browser-manual.tentative.html b/testing/web-platform/tests/appmanifest/display-override-member/display-override-member-media-feature-browser-manual.tentative.html new file mode 100644 index 0000000000..d13d0986ad --- /dev/null +++ b/testing/web-platform/tests/appmanifest/display-override-member/display-override-member-media-feature-browser-manual.tentative.html @@ -0,0 +1,35 @@ + +Test "browser" in display-override member + media feature + + + + + +

Test "browser" in display-override member + media feature

+ + +

+ To pass, the background color must be green after installing. +

diff --git a/testing/web-platform/tests/appmanifest/display-override-member/display-override-member-media-feature-fullscreen-manual.tentative.html b/testing/web-platform/tests/appmanifest/display-override-member/display-override-member-media-feature-fullscreen-manual.tentative.html new file mode 100644 index 0000000000..0b9923f8bd --- /dev/null +++ b/testing/web-platform/tests/appmanifest/display-override-member/display-override-member-media-feature-fullscreen-manual.tentative.html @@ -0,0 +1,35 @@ + +Test "fullscreen" in display-override member + media feature + + + + + +

Test "fullscreen" in display-override member + media feature

+ + +

+ To pass, the background color must be green after installing. +

diff --git a/testing/web-platform/tests/appmanifest/display-override-member/display-override-member-media-feature-minimal-ui-manual.tentative.html b/testing/web-platform/tests/appmanifest/display-override-member/display-override-member-media-feature-minimal-ui-manual.tentative.html new file mode 100644 index 0000000000..5b9d63977d --- /dev/null +++ b/testing/web-platform/tests/appmanifest/display-override-member/display-override-member-media-feature-minimal-ui-manual.tentative.html @@ -0,0 +1,35 @@ + +Test "minimal-ui" in display-override member + media feature + + + + + +

Test "minimal-ui" in display-override member + media feature

+ + +

+ To pass, the background color must be green after installing. +

diff --git a/testing/web-platform/tests/appmanifest/display-override-member/display-override-member-media-feature-service-worker.js b/testing/web-platform/tests/appmanifest/display-override-member/display-override-member-media-feature-service-worker.js new file mode 100644 index 0000000000..02818dc665 --- /dev/null +++ b/testing/web-platform/tests/appmanifest/display-override-member/display-override-member-media-feature-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 = [ + "display-override-member-app-region-window-controls-overlay-manual.tentative.html", + "display-override-member-css-environment-variables-window-controls-overlay-manual.tentative.html", + "display-override-member-media-feature-browser-manual.tentative.html", + "display-override-member-media-feature-fullscreen-manual.tentative.html", + "display-override-member-media-feature-minimal-ui-manual.tentative.html", + "display-override-member-media-feature-standalone-manual.tentative.html", + "display-override-member-media-feature-standalone-overrides-browser-manual.tentative.html", + "display-override-member-media-feature-window-controls-overlay-overrides-browser-manual.tentative.html", + "display-override-member-media-feature-service-worker.js", + "resources/display-override-member-media-feature-manual.js", + "resources/icon.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/display-override-member/display-override-member-media-feature-standalone-manual.tentative.html b/testing/web-platform/tests/appmanifest/display-override-member/display-override-member-media-feature-standalone-manual.tentative.html new file mode 100644 index 0000000000..db1ed38929 --- /dev/null +++ b/testing/web-platform/tests/appmanifest/display-override-member/display-override-member-media-feature-standalone-manual.tentative.html @@ -0,0 +1,35 @@ + +Test "standalone" in display-override member + media feature + + + + + +

Test "standalone" in display-override member + media feature

+ + +

+ To pass, the background color must be green after installing. +

diff --git a/testing/web-platform/tests/appmanifest/display-override-member/display-override-member-media-feature-standalone-overrides-browser-manual.tentative.html b/testing/web-platform/tests/appmanifest/display-override-member/display-override-member-media-feature-standalone-overrides-browser-manual.tentative.html new file mode 100644 index 0000000000..d42feb3fe2 --- /dev/null +++ b/testing/web-platform/tests/appmanifest/display-override-member/display-override-member-media-feature-standalone-overrides-browser-manual.tentative.html @@ -0,0 +1,37 @@ + +Test "standalone" in display-override member + "browser" in display member + media feature + + + + + + + +

Test "standalone" in display-override member + "browser" in display member + media feature

+ + +

+ To pass, the background color must be green after installing. +

diff --git a/testing/web-platform/tests/appmanifest/display-override-member/display-override-member-media-feature-window-controls-overlay-overrides-browser-manual.tentative.html b/testing/web-platform/tests/appmanifest/display-override-member/display-override-member-media-feature-window-controls-overlay-overrides-browser-manual.tentative.html new file mode 100644 index 0000000000..0929b43dec --- /dev/null +++ b/testing/web-platform/tests/appmanifest/display-override-member/display-override-member-media-feature-window-controls-overlay-overrides-browser-manual.tentative.html @@ -0,0 +1,43 @@ + +Test "window-controls-overlay" in display-override member + "browser" in display member + media feature + + + + + + +

Test "window-controls-overlay" in display-override member + "browser" in display member + media feature

+ + + +

This test validates that the display-mode property is 'standalone' when the + installed app is running in "window-controls-overlay" mode.

+

Manual Test Steps:

+

+

    +
  1. Install this app, and toggle into "window-controls-overlay" mode.
  2. +
  3. The background will be green if the test pases, otherwise red.
  4. +
+

diff --git a/testing/web-platform/tests/appmanifest/display-override-member/resources/display-override-member-app-region-window-controls-overlay.webmanifest b/testing/web-platform/tests/appmanifest/display-override-member/resources/display-override-member-app-region-window-controls-overlay.webmanifest new file mode 100644 index 0000000000..a5f3af06b7 --- /dev/null +++ b/testing/web-platform/tests/appmanifest/display-override-member/resources/display-override-member-app-region-window-controls-overlay.webmanifest @@ -0,0 +1,12 @@ +{ + "name": "Window Controls Overlay - app-region", + "icons": [ + { + "src": "icon.png", + "sizes": "192x192" + } + ], + "start_url": "../display-override-member-app-region-window-controls-overlay-manual.tentative.html", + "display": "browser", + "display_override": [ "window-controls-overlay" ] +} diff --git a/testing/web-platform/tests/appmanifest/display-override-member/resources/display-override-member-app-region-window-controls-overlay.webmanifest.headers b/testing/web-platform/tests/appmanifest/display-override-member/resources/display-override-member-app-region-window-controls-overlay.webmanifest.headers new file mode 100644 index 0000000000..2bab061d43 --- /dev/null +++ b/testing/web-platform/tests/appmanifest/display-override-member/resources/display-override-member-app-region-window-controls-overlay.webmanifest.headers @@ -0,0 +1 @@ +Content-Type: application/manifest+json; charset=utf-8 diff --git a/testing/web-platform/tests/appmanifest/display-override-member/resources/display-override-member-css-environment-variables-window-controls-overlay.webmanifest b/testing/web-platform/tests/appmanifest/display-override-member/resources/display-override-member-css-environment-variables-window-controls-overlay.webmanifest new file mode 100644 index 0000000000..ebfc0a0bd9 --- /dev/null +++ b/testing/web-platform/tests/appmanifest/display-override-member/resources/display-override-member-css-environment-variables-window-controls-overlay.webmanifest @@ -0,0 +1,12 @@ +{ + "name": "Window Controls Overlay - CSS environment variables", + "icons": [ + { + "src": "icon.png", + "sizes": "192x192" + } + ], + "start_url": "../display-override-member-css-environment-variables-window-controls-overlay-manual.tentative.html", + "display": "browser", + "display_override": [ "window-controls-overlay" ] +} diff --git a/testing/web-platform/tests/appmanifest/display-override-member/resources/display-override-member-css-environment-variables-window-controls-overlay.webmanifest.headers b/testing/web-platform/tests/appmanifest/display-override-member/resources/display-override-member-css-environment-variables-window-controls-overlay.webmanifest.headers new file mode 100644 index 0000000000..2bab061d43 --- /dev/null +++ b/testing/web-platform/tests/appmanifest/display-override-member/resources/display-override-member-css-environment-variables-window-controls-overlay.webmanifest.headers @@ -0,0 +1 @@ +Content-Type: application/manifest+json; charset=utf-8 diff --git a/testing/web-platform/tests/appmanifest/display-override-member/resources/display-override-member-media-feature-browser.webmanifest b/testing/web-platform/tests/appmanifest/display-override-member/resources/display-override-member-media-feature-browser.webmanifest new file mode 100644 index 0000000000..a384f6f2c8 --- /dev/null +++ b/testing/web-platform/tests/appmanifest/display-override-member/resources/display-override-member-media-feature-browser.webmanifest @@ -0,0 +1,11 @@ +{ + "name": "Display override member media feature WPT", + "icons": [ + { + "src": "icon.png", + "sizes": "192x192" + } + ], + "start_url": "../display-override-member-media-feature-browser-manual.tentative.html", + "display_override": [ "browser" ] +} diff --git a/testing/web-platform/tests/appmanifest/display-override-member/resources/display-override-member-media-feature-browser.webmanifest.headers b/testing/web-platform/tests/appmanifest/display-override-member/resources/display-override-member-media-feature-browser.webmanifest.headers new file mode 100644 index 0000000000..2bab061d43 --- /dev/null +++ b/testing/web-platform/tests/appmanifest/display-override-member/resources/display-override-member-media-feature-browser.webmanifest.headers @@ -0,0 +1 @@ +Content-Type: application/manifest+json; charset=utf-8 diff --git a/testing/web-platform/tests/appmanifest/display-override-member/resources/display-override-member-media-feature-fullscreen.webmanifest b/testing/web-platform/tests/appmanifest/display-override-member/resources/display-override-member-media-feature-fullscreen.webmanifest new file mode 100644 index 0000000000..70cad0a0ca --- /dev/null +++ b/testing/web-platform/tests/appmanifest/display-override-member/resources/display-override-member-media-feature-fullscreen.webmanifest @@ -0,0 +1,11 @@ +{ + "name": "Display override member media feature WPT", + "icons": [ + { + "src": "icon.png", + "sizes": "192x192" + } + ], + "start_url": "../display-override-member-media-feature-fullscreen-manual.tentative.html", + "display_override": [ "fullscreen" ] +} diff --git a/testing/web-platform/tests/appmanifest/display-override-member/resources/display-override-member-media-feature-fullscreen.webmanifest.headers b/testing/web-platform/tests/appmanifest/display-override-member/resources/display-override-member-media-feature-fullscreen.webmanifest.headers new file mode 100644 index 0000000000..2bab061d43 --- /dev/null +++ b/testing/web-platform/tests/appmanifest/display-override-member/resources/display-override-member-media-feature-fullscreen.webmanifest.headers @@ -0,0 +1 @@ +Content-Type: application/manifest+json; charset=utf-8 diff --git a/testing/web-platform/tests/appmanifest/display-override-member/resources/display-override-member-media-feature-manual.js b/testing/web-platform/tests/appmanifest/display-override-member/resources/display-override-member-media-feature-manual.js new file mode 100644 index 0000000000..eca350245f --- /dev/null +++ b/testing/web-platform/tests/appmanifest/display-override-member/resources/display-override-member-media-feature-manual.js @@ -0,0 +1,4 @@ +if ('serviceWorker' in navigator) { + navigator.serviceWorker.register( + 'display-override-member-media-feature-service-worker.js'); +} diff --git a/testing/web-platform/tests/appmanifest/display-override-member/resources/display-override-member-media-feature-minimal-ui.webmanifest b/testing/web-platform/tests/appmanifest/display-override-member/resources/display-override-member-media-feature-minimal-ui.webmanifest new file mode 100644 index 0000000000..474f58526b --- /dev/null +++ b/testing/web-platform/tests/appmanifest/display-override-member/resources/display-override-member-media-feature-minimal-ui.webmanifest @@ -0,0 +1,11 @@ +{ + "name": "Display override member media feature WPT", + "icons": [ + { + "src": "icon.png", + "sizes": "192x192" + } + ], + "start_url": "../display-override-member-media-feature-browser-manual.tentative.html", + "display_override": [ "minimal-ui" ] +} diff --git a/testing/web-platform/tests/appmanifest/display-override-member/resources/display-override-member-media-feature-minimal-ui.webmanifest.headers b/testing/web-platform/tests/appmanifest/display-override-member/resources/display-override-member-media-feature-minimal-ui.webmanifest.headers new file mode 100644 index 0000000000..2bab061d43 --- /dev/null +++ b/testing/web-platform/tests/appmanifest/display-override-member/resources/display-override-member-media-feature-minimal-ui.webmanifest.headers @@ -0,0 +1 @@ +Content-Type: application/manifest+json; charset=utf-8 diff --git a/testing/web-platform/tests/appmanifest/display-override-member/resources/display-override-member-media-feature-standalone-overrides-browser.webmanifest b/testing/web-platform/tests/appmanifest/display-override-member/resources/display-override-member-media-feature-standalone-overrides-browser.webmanifest new file mode 100644 index 0000000000..dcdd293ab7 --- /dev/null +++ b/testing/web-platform/tests/appmanifest/display-override-member/resources/display-override-member-media-feature-standalone-overrides-browser.webmanifest @@ -0,0 +1,12 @@ +{ + "name": "Display override member media feature WPT", + "icons": [ + { + "src": "icon.png", + "sizes": "192x192" + } + ], + "start_url": "../display-override-member-media-feature-browser-manual.tentative.html", + "display": "browser", + "display_override": [ "standalone" ] +} diff --git a/testing/web-platform/tests/appmanifest/display-override-member/resources/display-override-member-media-feature-standalone-overrides-browser.webmanifest.headers b/testing/web-platform/tests/appmanifest/display-override-member/resources/display-override-member-media-feature-standalone-overrides-browser.webmanifest.headers new file mode 100644 index 0000000000..2bab061d43 --- /dev/null +++ b/testing/web-platform/tests/appmanifest/display-override-member/resources/display-override-member-media-feature-standalone-overrides-browser.webmanifest.headers @@ -0,0 +1 @@ +Content-Type: application/manifest+json; charset=utf-8 diff --git a/testing/web-platform/tests/appmanifest/display-override-member/resources/display-override-member-media-feature-standalone.webmanifest b/testing/web-platform/tests/appmanifest/display-override-member/resources/display-override-member-media-feature-standalone.webmanifest new file mode 100644 index 0000000000..dfd6b77a25 --- /dev/null +++ b/testing/web-platform/tests/appmanifest/display-override-member/resources/display-override-member-media-feature-standalone.webmanifest @@ -0,0 +1,11 @@ +{ + "name": "Display override member media feature WPT", + "icons": [ + { + "src": "icon.png", + "sizes": "192x192" + } + ], + "start_url": "../display-override-member-media-feature-browser-manual.tentative.html", + "display_override": [ "standalone" ] +} diff --git a/testing/web-platform/tests/appmanifest/display-override-member/resources/display-override-member-media-feature-standalone.webmanifest.headers b/testing/web-platform/tests/appmanifest/display-override-member/resources/display-override-member-media-feature-standalone.webmanifest.headers new file mode 100644 index 0000000000..2bab061d43 --- /dev/null +++ b/testing/web-platform/tests/appmanifest/display-override-member/resources/display-override-member-media-feature-standalone.webmanifest.headers @@ -0,0 +1 @@ +Content-Type: application/manifest+json; charset=utf-8 diff --git a/testing/web-platform/tests/appmanifest/display-override-member/resources/display-override-member-media-feature-window-controls-overlay-overrides-browser.webmanifest b/testing/web-platform/tests/appmanifest/display-override-member/resources/display-override-member-media-feature-window-controls-overlay-overrides-browser.webmanifest new file mode 100644 index 0000000000..75e91eaf87 --- /dev/null +++ b/testing/web-platform/tests/appmanifest/display-override-member/resources/display-override-member-media-feature-window-controls-overlay-overrides-browser.webmanifest @@ -0,0 +1,12 @@ +{ + "name": "Window Controls Overlay - CSS environment variables", + "icons": [ + { + "src": "icon.png", + "sizes": "192x192" + } + ], + "start_url": "../display-override-member-media-feature-window-controls-overlay-overrides-browser-manual.tentative.html", + "display": "browser", + "display_override": [ "window-controls-overlay" ] +} diff --git a/testing/web-platform/tests/appmanifest/display-override-member/resources/display-override-member-media-feature-window-controls-overlay-overrides-browser.webmanifest.headers b/testing/web-platform/tests/appmanifest/display-override-member/resources/display-override-member-media-feature-window-controls-overlay-overrides-browser.webmanifest.headers new file mode 100644 index 0000000000..2bab061d43 --- /dev/null +++ b/testing/web-platform/tests/appmanifest/display-override-member/resources/display-override-member-media-feature-window-controls-overlay-overrides-browser.webmanifest.headers @@ -0,0 +1 @@ +Content-Type: application/manifest+json; charset=utf-8 diff --git a/testing/web-platform/tests/appmanifest/display-override-member/resources/icon.png b/testing/web-platform/tests/appmanifest/display-override-member/resources/icon.png new file mode 100644 index 0000000000..637cc8daf4 Binary files /dev/null and b/testing/web-platform/tests/appmanifest/display-override-member/resources/icon.png differ diff --git a/testing/web-platform/tests/appmanifest/file_handlers-member/file_handlers-member-manual.tentative.html b/testing/web-platform/tests/appmanifest/file_handlers-member/file_handlers-member-manual.tentative.html new file mode 100644 index 0000000000..f6384b6dda --- /dev/null +++ b/testing/web-platform/tests/appmanifest/file_handlers-member/file_handlers-member-manual.tentative.html @@ -0,0 +1,42 @@ + + + + + File Handling Web Platform Test + + + + + + +

+ File Handling Test +

+
+

+ Instructions (details may be OS-dependent) +

+
    +
  1. Install this site as a PWA
  2. +
  3. Download this file
  4. +
  5. + In your file browser, right click the downloaded file (file_handlers-sample-file.txt) +
  6. +
  7. Select "Open with" > "File Handling WPT"
  8. +
  9. + If your browser prompts you to allow File Handling WPT to open + the file, choose allow +
  10. +
  11. The app window that opens should indicate success of this test.
  12. +
+
+ + diff --git a/testing/web-platform/tests/appmanifest/file_handlers-member/file_handlers-member-service-worker.js b/testing/web-platform/tests/appmanifest/file_handlers-member/file_handlers-member-service-worker.js new file mode 100644 index 0000000000..972b65304b --- /dev/null +++ b/testing/web-platform/tests/appmanifest/file_handlers-member/file_handlers-member-service-worker.js @@ -0,0 +1,52 @@ +// Some user agents only offer app installation if there is a SW and it handles +// offline requests. + +const cacheVersion = "1.1"; +const CACHE_NAME = `cache-v${cacheVersion}`; + +// The resources cached by this service worker. +const resources = [ + "file_handlers-member-service-worker.js", + "file_handlers-member-manual.tentative.html", + "resources/file_handlers-member.js", + "resources/icon.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/file_handlers-member/resources/file_handlers-member.js b/testing/web-platform/tests/appmanifest/file_handlers-member/resources/file_handlers-member.js new file mode 100644 index 0000000000..87ec82ef9a --- /dev/null +++ b/testing/web-platform/tests/appmanifest/file_handlers-member/resources/file_handlers-member.js @@ -0,0 +1,39 @@ +// Since this is a manual test, disable the automatic timeout. +setup({explicit_timeout: true}); + +// Redirect to https if using http, because File System Access API (previously +// Native FileSystem API) isn't supported in http. +if (location.protocol !== 'https:') { + location.replace( + `https:${location.href.substring(location.protocol.length)}` + ); +} + +test(function() { + assert_true('serviceWorker' in navigator); +}, 'serviceWorker exists') + +navigator.serviceWorker.register( + 'file_handlers-member-service-worker.js'); + +test(function() { + assert_true('launchQueue' in window); +}, 'File Handling API enabled'); + +test(function() { + assert_true('showOpenFilePicker' in window); +}, 'File System Access API enabled'); + +promise_test(async t => { + const launchParams = await new Promise(resolve => { + window.launchQueue.setConsumer(resolve); + }); + + assert_equals(launchParams.files.length, 1, 'Wrong number of files found'); + + const readHandle = await launchParams.files[0].getFile(); + assert_equals(readHandle.name, 'file_handlers-sample-file.txt'); + + const fileContents = await readHandle.text(); + assert_equals(fileContents, 'File handling WPT - Hello world!\n'); +}, 'launchQueue works as expected'); diff --git a/testing/web-platform/tests/appmanifest/file_handlers-member/resources/file_handlers-member.webmanifest b/testing/web-platform/tests/appmanifest/file_handlers-member/resources/file_handlers-member.webmanifest new file mode 100644 index 0000000000..1cc5bf4aa9 --- /dev/null +++ b/testing/web-platform/tests/appmanifest/file_handlers-member/resources/file_handlers-member.webmanifest @@ -0,0 +1,21 @@ +{ + "name": "File Handling WPT", + "icons": [ + { + "src": "icon.png", + "sizes": "144x144" + } + ], + "start_url": "../file_handlers-member-manual.tentative.html", + "display": "standalone", + "scope": "../../file_handlers-member/", + "file_handlers": [ + { + "action": "../file_handlers-member-manual.tentative.html", + "name": "Plain Text", + "accept": { + "text/plain": [".txt"] + } + } + ] +} diff --git a/testing/web-platform/tests/appmanifest/file_handlers-member/resources/file_handlers-sample-file.txt b/testing/web-platform/tests/appmanifest/file_handlers-member/resources/file_handlers-sample-file.txt new file mode 100644 index 0000000000..5c8a71969c --- /dev/null +++ b/testing/web-platform/tests/appmanifest/file_handlers-member/resources/file_handlers-sample-file.txt @@ -0,0 +1 @@ +File handling WPT - Hello world! diff --git a/testing/web-platform/tests/appmanifest/file_handlers-member/resources/icon.png b/testing/web-platform/tests/appmanifest/file_handlers-member/resources/icon.png new file mode 100644 index 0000000000..c177ad8dbd Binary files /dev/null and b/testing/web-platform/tests/appmanifest/file_handlers-member/resources/icon.png differ 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 @@ + +Test that icons member is supported (CORS violation) + + + +

Testing support for icons member (CORS violation)

+ +

+ To pass, the icon must not show a white cross on a red background. +

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 @@ + +Test that icons member is supported (via CORS) + + + +

Testing support for icons member (via CORS)

+ +

+ To pass, the icon must show a white check mark on a green background. +

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 @@ + + +Test that icons member is supported (CSP violation) + + + +

Testing support for icons member (CSP violation)

+ +

+ To pass, the icon must not show a white cross on a red background. +

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 @@ + + +Test that icons member is supported (CSP check) + + + +

Testing support for icons member (CSP check)

+ +

+ To pass, the icon must show a white check mark on a green background. +

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 @@ + +Test that icons member is supported + + + +

Testing support for icons member

+

+ To pass, the icon must show a white check mark on a green background. +

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 @@ + +Test that icons member is supported + + + +

Testing support for icons member

+

+ To pass, the icon should must a white check mark on a green background. +

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 @@ + +Test that icons member is supported + + + +

Testing support for icons member

+

+ To pass, the icon must show a white check mark on a green background. +

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 new file mode 100644 index 0000000000..1d596c6ba6 Binary files /dev/null and b/testing/web-platform/tests/appmanifest/icons-member/resources/fail.png differ 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 new file mode 100644 index 0000000000..be7433a3e2 Binary files /dev/null and b/testing/web-platform/tests/appmanifest/icons-member/resources/pass.png differ 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]}} diff --git a/testing/web-platform/tests/appmanifest/id-member/icon.png b/testing/web-platform/tests/appmanifest/id-member/icon.png new file mode 100644 index 0000000000..4b9c7c8f32 Binary files /dev/null and b/testing/web-platform/tests/appmanifest/id-member/icon.png differ diff --git a/testing/web-platform/tests/appmanifest/id-member/id-member-manifest-update-manual-v1.html b/testing/web-platform/tests/appmanifest/id-member/id-member-manifest-update-manual-v1.html new file mode 100644 index 0000000000..3f4a331e0b --- /dev/null +++ b/testing/web-platform/tests/appmanifest/id-member/id-member-manifest-update-manual-v1.html @@ -0,0 +1,29 @@ + + + + + Manifest Id Web Platform Test + + + + + + + +

+ Manifest Id Test +

+

+ start_url v1 +

+ + diff --git a/testing/web-platform/tests/appmanifest/id-member/id-member-manifest-update-manual-v2.html b/testing/web-platform/tests/appmanifest/id-member/id-member-manifest-update-manual-v2.html new file mode 100644 index 0000000000..4454017eaf --- /dev/null +++ b/testing/web-platform/tests/appmanifest/id-member/id-member-manifest-update-manual-v2.html @@ -0,0 +1,25 @@ + + + + Manifest Id Web Platform Test + + + + + +

+ Manifest Id Test +

+

+ start_url v2 +

+ + diff --git a/testing/web-platform/tests/appmanifest/id-member/id-member-manifest-update-manual.tentative.html b/testing/web-platform/tests/appmanifest/id-member/id-member-manifest-update-manual.tentative.html new file mode 100644 index 0000000000..c534d7404a --- /dev/null +++ b/testing/web-platform/tests/appmanifest/id-member/id-member-manifest-update-manual.tentative.html @@ -0,0 +1,22 @@ + + + + Manifest Id Web Platform Test + + + + + +

+ Manifest Id Test +

+ + \ No newline at end of file diff --git a/testing/web-platform/tests/appmanifest/id-member/id-member-manifest-update-v1.webmanifest b/testing/web-platform/tests/appmanifest/id-member/id-member-manifest-update-v1.webmanifest new file mode 100644 index 0000000000..5d02d2b10a --- /dev/null +++ b/testing/web-platform/tests/appmanifest/id-member/id-member-manifest-update-v1.webmanifest @@ -0,0 +1,13 @@ +{ + "name": "id member test", + "id": "/testId", + "start_url": "id-member-manifest-update-manual-v1.html", + "icons": [ + { + "src": "icon.png", + "sizes": "256x256", + "type": "image/png" + } + ], + "display": "standalone" +} diff --git a/testing/web-platform/tests/appmanifest/id-member/id-member-manifest-update-v1.webmanifest.headers b/testing/web-platform/tests/appmanifest/id-member/id-member-manifest-update-v1.webmanifest.headers new file mode 100644 index 0000000000..23f36ea27c --- /dev/null +++ b/testing/web-platform/tests/appmanifest/id-member/id-member-manifest-update-v1.webmanifest.headers @@ -0,0 +1 @@ +Content-Type: application/manifest+json; charset=utf-8 \ No newline at end of file diff --git a/testing/web-platform/tests/appmanifest/id-member/id-member-manifest-update-v2.webmanifest b/testing/web-platform/tests/appmanifest/id-member/id-member-manifest-update-v2.webmanifest new file mode 100644 index 0000000000..582620186e --- /dev/null +++ b/testing/web-platform/tests/appmanifest/id-member/id-member-manifest-update-v2.webmanifest @@ -0,0 +1,13 @@ +{ + "name": "id member test", + "id": "testId", + "start_url": "id-member-manifest-update-manual-v2.html", + "icons": [ + { + "src": "icon.png", + "sizes": "256x256", + "type": "image/png" + } + ], + "display": "standalone" +} diff --git a/testing/web-platform/tests/appmanifest/id-member/id-member-manifest-update-v2.webmanifest.headers b/testing/web-platform/tests/appmanifest/id-member/id-member-manifest-update-v2.webmanifest.headers new file mode 100644 index 0000000000..23f36ea27c --- /dev/null +++ b/testing/web-platform/tests/appmanifest/id-member/id-member-manifest-update-v2.webmanifest.headers @@ -0,0 +1 @@ +Content-Type: application/manifest+json; charset=utf-8 \ No newline at end of file diff --git a/testing/web-platform/tests/appmanifest/id-member/id-member-manifest-update.js b/testing/web-platform/tests/appmanifest/id-member/id-member-manifest-update.js new file mode 100644 index 0000000000..7d6e344ed9 --- /dev/null +++ b/testing/web-platform/tests/appmanifest/id-member/id-member-manifest-update.js @@ -0,0 +1,34 @@ +window.onload = () => { + const instruction = document.createElement("div"); + instruction.innerHTML = ` +

+ Instructions +

+
    +
  1. Install id-member-manifest-update-manual.html as a PWA
  2. +
  3. + Launch the app from OS. The page should be launched to start_url v1. +
  4. +
  5. + Close the app window. +
  6. +
  7. + Trigger a manifest update event. +

    + This step is specific to each browser implementation. + On Chrome, trigger the update by restarting the browser through chrome://restart. +

    +
  8. +
  9. + Launch the app from OS again, start_url should be updated to v2. +
  10. +
+`; + + document.body.appendChild(instruction); +}; +async function main() { + await navigator.serviceWorker.register("id-member-service-worker.js"); + await navigator.serviceWorker.ready; +} +main(); \ No newline at end of file diff --git a/testing/web-platform/tests/appmanifest/id-member/id-member-service-worker.js b/testing/web-platform/tests/appmanifest/id-member/id-member-service-worker.js new file mode 100644 index 0000000000..c0a16c4a46 --- /dev/null +++ b/testing/web-platform/tests/appmanifest/id-member/id-member-service-worker.js @@ -0,0 +1,8 @@ +// Some user agents only offer app installation if there is a SW and it handles +// offline requests. + +self.addEventListener("fetch", e => { + e.respondWith(fetch(e.request).catch(_ => { + return new Response('Offline test.'); + })); +}); diff --git a/testing/web-platform/tests/appmanifest/name-member/name-member-manual.html b/testing/web-platform/tests/appmanifest/name-member/name-member-manual.html new file mode 100644 index 0000000000..577c821c3b --- /dev/null +++ b/testing/web-platform/tests/appmanifest/name-member/name-member-manual.html @@ -0,0 +1,9 @@ + +Test that name member is supported + + + +

Testing support for name member

+

+ To pass, the application name must be "pass". +

diff --git a/testing/web-platform/tests/appmanifest/name-member/name-member-service-worker.js b/testing/web-platform/tests/appmanifest/name-member/name-member-service-worker.js new file mode 100644 index 0000000000..5733f35636 --- /dev/null +++ b/testing/web-platform/tests/appmanifest/name-member/name-member-service-worker.js @@ -0,0 +1,52 @@ +// 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 = [ + "name-member-manual.html", + "name-member-service-worker.js", + "resources/name-member-manual.js", + "resources/icon.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/name-member/resources/icon.png b/testing/web-platform/tests/appmanifest/name-member/resources/icon.png new file mode 100644 index 0000000000..6a06550023 Binary files /dev/null and b/testing/web-platform/tests/appmanifest/name-member/resources/icon.png differ diff --git a/testing/web-platform/tests/appmanifest/name-member/resources/name-member-fail.webmanifest b/testing/web-platform/tests/appmanifest/name-member/resources/name-member-fail.webmanifest new file mode 100644 index 0000000000..e1b2979207 --- /dev/null +++ b/testing/web-platform/tests/appmanifest/name-member/resources/name-member-fail.webmanifest @@ -0,0 +1,11 @@ +{ + "name": "fail", + "icons": [ + { + "src": "icon.png", + "sizes": "192x192" + } + ], + "start_url": "../name-member-manual.html", + "display": "fullscreen" +} \ No newline at end of file diff --git a/testing/web-platform/tests/appmanifest/name-member/resources/name-member-fail.webmanifest.headers b/testing/web-platform/tests/appmanifest/name-member/resources/name-member-fail.webmanifest.headers new file mode 100644 index 0000000000..23f36ea27c --- /dev/null +++ b/testing/web-platform/tests/appmanifest/name-member/resources/name-member-fail.webmanifest.headers @@ -0,0 +1 @@ +Content-Type: application/manifest+json; charset=utf-8 \ No newline at end of file diff --git a/testing/web-platform/tests/appmanifest/name-member/resources/name-member-manual.js b/testing/web-platform/tests/appmanifest/name-member/resources/name-member-manual.js new file mode 100644 index 0000000000..042b94f85b --- /dev/null +++ b/testing/web-platform/tests/appmanifest/name-member/resources/name-member-manual.js @@ -0,0 +1,4 @@ +if ('serviceWorker' in navigator) { + navigator.serviceWorker.register( + 'name-member-service-worker.js'); +} diff --git a/testing/web-platform/tests/appmanifest/name-member/resources/name-member.webmanifest b/testing/web-platform/tests/appmanifest/name-member/resources/name-member.webmanifest new file mode 100644 index 0000000000..366044f09e --- /dev/null +++ b/testing/web-platform/tests/appmanifest/name-member/resources/name-member.webmanifest @@ -0,0 +1,11 @@ +{ + "name": "pass", + "icons": [ + { + "src": "icon.png", + "sizes": "192x192" + } + ], + "start_url": "../name-member-manual.html", + "display": "fullscreen" +} \ No newline at end of file diff --git a/testing/web-platform/tests/appmanifest/name-member/resources/name-member.webmanifest.headers b/testing/web-platform/tests/appmanifest/name-member/resources/name-member.webmanifest.headers new file mode 100644 index 0000000000..23f36ea27c --- /dev/null +++ b/testing/web-platform/tests/appmanifest/name-member/resources/name-member.webmanifest.headers @@ -0,0 +1 @@ +Content-Type: application/manifest+json; charset=utf-8 \ No newline at end of file diff --git a/testing/web-platform/tests/appmanifest/orientation-member/orientation-member-landscape-manual.html b/testing/web-platform/tests/appmanifest/orientation-member/orientation-member-landscape-manual.html new file mode 100644 index 0000000000..8df1117964 --- /dev/null +++ b/testing/web-platform/tests/appmanifest/orientation-member/orientation-member-landscape-manual.html @@ -0,0 +1,25 @@ + +Test that orientation member with landscape value is supported + + + + +

Testing support for orientation member with "landscape" value

+ +

+ Please set the phone orientation to portrait. +

+

+ To pass, after installing the display orientation must be landscape and the background must be green. +

diff --git a/testing/web-platform/tests/appmanifest/orientation-member/orientation-member-portrait-manual.html b/testing/web-platform/tests/appmanifest/orientation-member/orientation-member-portrait-manual.html new file mode 100644 index 0000000000..ed866f3561 --- /dev/null +++ b/testing/web-platform/tests/appmanifest/orientation-member/orientation-member-portrait-manual.html @@ -0,0 +1,25 @@ + +Test that orientation member with portrait value is supported + + + + +

Testing support for orientation member with "portrait" value

+ +

+ Please set the phone orientation to landscape. +

+

+ To pass, after installing the display orientation must be portrait and the background must be green. +

diff --git a/testing/web-platform/tests/appmanifest/orientation-member/orientation-member-service-worker.js b/testing/web-platform/tests/appmanifest/orientation-member/orientation-member-service-worker.js new file mode 100644 index 0000000000..26f53c9816 --- /dev/null +++ b/testing/web-platform/tests/appmanifest/orientation-member/orientation-member-service-worker.js @@ -0,0 +1,53 @@ +// 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 = [ + "orientation-member-landscape-manual.html", + "orientation-member-portrait-manual.html", + "orientation-member-service-worker.js", + "resources/orientation-member-manual.js", + "resources/icon.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/orientation-member/resources/icon.png b/testing/web-platform/tests/appmanifest/orientation-member/resources/icon.png new file mode 100644 index 0000000000..fecb1d2da4 Binary files /dev/null and b/testing/web-platform/tests/appmanifest/orientation-member/resources/icon.png differ diff --git a/testing/web-platform/tests/appmanifest/orientation-member/resources/orientation-member-landscape.webmanifest b/testing/web-platform/tests/appmanifest/orientation-member/resources/orientation-member-landscape.webmanifest new file mode 100644 index 0000000000..c930d292e5 --- /dev/null +++ b/testing/web-platform/tests/appmanifest/orientation-member/resources/orientation-member-landscape.webmanifest @@ -0,0 +1,12 @@ +{ + "name": "Orientation member with landscape value WPT", + "icons": [ + { + "src": "icon.png", + "sizes": "192x192" + } + ], + "start_url": "../orientation-member-landscape-manual.html", + "display": "standalone", + "orientation": "landscape" +} diff --git a/testing/web-platform/tests/appmanifest/orientation-member/resources/orientation-member-landscape.webmanifest.headers b/testing/web-platform/tests/appmanifest/orientation-member/resources/orientation-member-landscape.webmanifest.headers new file mode 100644 index 0000000000..2bab061d43 --- /dev/null +++ b/testing/web-platform/tests/appmanifest/orientation-member/resources/orientation-member-landscape.webmanifest.headers @@ -0,0 +1 @@ +Content-Type: application/manifest+json; charset=utf-8 diff --git a/testing/web-platform/tests/appmanifest/orientation-member/resources/orientation-member-manual.js b/testing/web-platform/tests/appmanifest/orientation-member/resources/orientation-member-manual.js new file mode 100644 index 0000000000..6929c997a4 --- /dev/null +++ b/testing/web-platform/tests/appmanifest/orientation-member/resources/orientation-member-manual.js @@ -0,0 +1,4 @@ +if ('serviceWorker' in navigator) { + navigator.serviceWorker.register( + 'orientation-member-service-worker.js'); +} diff --git a/testing/web-platform/tests/appmanifest/orientation-member/resources/orientation-member-portrait.webmanifest b/testing/web-platform/tests/appmanifest/orientation-member/resources/orientation-member-portrait.webmanifest new file mode 100644 index 0000000000..7ddf0851ac --- /dev/null +++ b/testing/web-platform/tests/appmanifest/orientation-member/resources/orientation-member-portrait.webmanifest @@ -0,0 +1,12 @@ +{ + "name": "Orientation member with portrait value WPT", + "icons": [ + { + "src": "icon.png", + "sizes": "192x192" + } + ], + "start_url": "../orientation-member-portrait-manual.html", + "display": "standalone", + "orientation": "portrait" +} diff --git a/testing/web-platform/tests/appmanifest/orientation-member/resources/orientation-member-portrait.webmanifest.headers b/testing/web-platform/tests/appmanifest/orientation-member/resources/orientation-member-portrait.webmanifest.headers new file mode 100644 index 0000000000..2bab061d43 --- /dev/null +++ b/testing/web-platform/tests/appmanifest/orientation-member/resources/orientation-member-portrait.webmanifest.headers @@ -0,0 +1 @@ +Content-Type: application/manifest+json; charset=utf-8 diff --git a/testing/web-platform/tests/appmanifest/protocol_handlers-member/protocol_handlers-member-manual.tentative.html b/testing/web-platform/tests/appmanifest/protocol_handlers-member/protocol_handlers-member-manual.tentative.html new file mode 100644 index 0000000000..fa9c958e0e --- /dev/null +++ b/testing/web-platform/tests/appmanifest/protocol_handlers-member/protocol_handlers-member-manual.tentative.html @@ -0,0 +1,34 @@ + + + + + + Protocol Handling Web Platform Test + + + +

Protocol Handling Web Platform Test

+

This test validates that an install application can register URL protocol + handlers via a property in the web app manifest. The app should open + directly when the 'web+testing' custom-scheme URL is visited. +

+

Manual Test Steps:

+

+

    +
  1. Install this app.
  2. +
  3. Launch 'web+testing://test-url/'. Instructions will vary by OS. +
      +
    • On Windows - open a command prompt, and run "start web+testing://test-url/".
    • +
    • On MacOS - open a terminal, and "open web+testing://test-url/".
    • +
    • On Linux - open a terminal, and "xgd-open web+testing://test-url/".
    • +
    +
  4. +
  5. If your browser prompts you, allow the app to open.
  6. +
  7. The app window that opens should indicate success of this test.
  8. +
+

+ + \ No newline at end of file diff --git a/testing/web-platform/tests/appmanifest/protocol_handlers-member/protocol_handlers-member-service-worker.js b/testing/web-platform/tests/appmanifest/protocol_handlers-member/protocol_handlers-member-service-worker.js new file mode 100644 index 0000000000..e502e2a985 --- /dev/null +++ b/testing/web-platform/tests/appmanifest/protocol_handlers-member/protocol_handlers-member-service-worker.js @@ -0,0 +1,52 @@ +// Some user agents only offer app installation if there is a SW and it handles +// offline requests. + +const cacheVersion = "1.1"; +const CACHE_NAME = `cache-v${cacheVersion}`; + +// The resources cached by this service worker. +const resources = [ + "protocol_handlers-member-service-worker.js", + "protocol_handlers-member-manual.tentative.html", + "resources/icon.png", + "resources/protocol_handlers_entry.html", +]; + +// 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/protocol_handlers-member/resources/icon.png b/testing/web-platform/tests/appmanifest/protocol_handlers-member/resources/icon.png new file mode 100644 index 0000000000..9255547fae Binary files /dev/null and b/testing/web-platform/tests/appmanifest/protocol_handlers-member/resources/icon.png differ diff --git a/testing/web-platform/tests/appmanifest/protocol_handlers-member/resources/protocol_handlers-member.webmanifest b/testing/web-platform/tests/appmanifest/protocol_handlers-member/resources/protocol_handlers-member.webmanifest new file mode 100644 index 0000000000..cce6ae1e22 --- /dev/null +++ b/testing/web-platform/tests/appmanifest/protocol_handlers-member/resources/protocol_handlers-member.webmanifest @@ -0,0 +1,18 @@ +{ + "name": "Protocol_handlers test", + "icons": [ + { + "src": "icon.png", + "sizes": "144x144" + } + ], + "start_url": "../protocol_handlers-member-manual.tentative.html", + "display": "standalone", + "scope": "../../protocol_handlers-member/", + "protocol_handlers": [ + { + "protocol": "web+testing", + "url": "protocol_handlers_entry.html?value=%s" + } + ] +} \ No newline at end of file diff --git a/testing/web-platform/tests/appmanifest/protocol_handlers-member/resources/protocol_handlers-member.webmanifest.headers b/testing/web-platform/tests/appmanifest/protocol_handlers-member/resources/protocol_handlers-member.webmanifest.headers new file mode 100644 index 0000000000..2bab061d43 --- /dev/null +++ b/testing/web-platform/tests/appmanifest/protocol_handlers-member/resources/protocol_handlers-member.webmanifest.headers @@ -0,0 +1 @@ +Content-Type: application/manifest+json; charset=utf-8 diff --git a/testing/web-platform/tests/appmanifest/protocol_handlers-member/resources/protocol_handlers_entry.html b/testing/web-platform/tests/appmanifest/protocol_handlers-member/resources/protocol_handlers_entry.html new file mode 100644 index 0000000000..c5fa629f22 --- /dev/null +++ b/testing/web-platform/tests/appmanifest/protocol_handlers-member/resources/protocol_handlers_entry.html @@ -0,0 +1,19 @@ + + + + + Protocol Handling Web Platform Test - Pass + + + + + +

Protocol Handling Page

+

This test validates that the app was launched with the web+testing://test-url/ URL.

+ + \ No newline at end of file diff --git a/testing/web-platform/tests/appmanifest/short_name-member/resources/icon.png b/testing/web-platform/tests/appmanifest/short_name-member/resources/icon.png new file mode 100644 index 0000000000..1798a17481 Binary files /dev/null and b/testing/web-platform/tests/appmanifest/short_name-member/resources/icon.png differ diff --git a/testing/web-platform/tests/appmanifest/short_name-member/resources/short_name-member-manual.js b/testing/web-platform/tests/appmanifest/short_name-member/resources/short_name-member-manual.js new file mode 100644 index 0000000000..7420e66c31 --- /dev/null +++ b/testing/web-platform/tests/appmanifest/short_name-member/resources/short_name-member-manual.js @@ -0,0 +1,4 @@ +if ('serviceWorker' in navigator) { + navigator.serviceWorker.register( + 'short_name-member-service-worker.js'); +} diff --git a/testing/web-platform/tests/appmanifest/short_name-member/resources/short_name-member.webmanifest b/testing/web-platform/tests/appmanifest/short_name-member/resources/short_name-member.webmanifest new file mode 100644 index 0000000000..e456f55d60 --- /dev/null +++ b/testing/web-platform/tests/appmanifest/short_name-member/resources/short_name-member.webmanifest @@ -0,0 +1,11 @@ +{ + "short_name": "pass", + "icons": [ + { + "src": "icon.png", + "sizes": "192x192" + } + ], + "start_url": "../short_name-member-manual.html", + "display": "fullscreen" +} \ No newline at end of file diff --git a/testing/web-platform/tests/appmanifest/short_name-member/resources/short_name-member.webmanifest.headers b/testing/web-platform/tests/appmanifest/short_name-member/resources/short_name-member.webmanifest.headers new file mode 100644 index 0000000000..23f36ea27c --- /dev/null +++ b/testing/web-platform/tests/appmanifest/short_name-member/resources/short_name-member.webmanifest.headers @@ -0,0 +1 @@ +Content-Type: application/manifest+json; charset=utf-8 \ No newline at end of file diff --git a/testing/web-platform/tests/appmanifest/short_name-member/short_name-member-manual.html b/testing/web-platform/tests/appmanifest/short_name-member/short_name-member-manual.html new file mode 100644 index 0000000000..ce5f8029fe --- /dev/null +++ b/testing/web-platform/tests/appmanifest/short_name-member/short_name-member-manual.html @@ -0,0 +1,9 @@ + +Test that short_name member is supported + + + +

Testing support for short_name member

+

+ To pass, the application name must be "pass". +

diff --git a/testing/web-platform/tests/appmanifest/short_name-member/short_name-member-service-worker.js b/testing/web-platform/tests/appmanifest/short_name-member/short_name-member-service-worker.js new file mode 100644 index 0000000000..ed8cadb9af --- /dev/null +++ b/testing/web-platform/tests/appmanifest/short_name-member/short_name-member-service-worker.js @@ -0,0 +1,52 @@ +// 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 = [ + "short_name-member-manual.html", + "short_name-member-service-worker.js", + "resources/short_name-member-manual.js", + "resources/icon.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/shortcuts-member/resources/pass.png b/testing/web-platform/tests/appmanifest/shortcuts-member/resources/pass.png new file mode 100644 index 0000000000..be7433a3e2 Binary files /dev/null and b/testing/web-platform/tests/appmanifest/shortcuts-member/resources/pass.png differ diff --git a/testing/web-platform/tests/appmanifest/shortcuts-member/resources/pass.png.sub.headers b/testing/web-platform/tests/appmanifest/shortcuts-member/resources/pass.png.sub.headers new file mode 100644 index 0000000000..adf190aa8e --- /dev/null +++ b/testing/web-platform/tests/appmanifest/shortcuts-member/resources/pass.png.sub.headers @@ -0,0 +1 @@ +Access-Control-Allow-Origin: https://{{host}}:{{ports[https][0]}} diff --git a/testing/web-platform/tests/appmanifest/shortcuts-member/resources/shortcuts-member-cors-fail.sub.webmanifest b/testing/web-platform/tests/appmanifest/shortcuts-member/resources/shortcuts-member-cors-fail.sub.webmanifest new file mode 100644 index 0000000000..a4975b03df --- /dev/null +++ b/testing/web-platform/tests/appmanifest/shortcuts-member/resources/shortcuts-member-cors-fail.sub.webmanifest @@ -0,0 +1,22 @@ +{ + "name": "Shortcut test", + "icons": [ + { + "src": "https://{{host}}:{{ports[https][1]}}/appmanifest/icons-member/resources/fail.png", + "sizes": "256x256" + } + ], + "start_url": "../shortcuts-member-cors-fail-manual.sub.html", + "display": "fullscreen", + "scope": "../", + "shortcuts": [{ + "name": "pass", + "short_name": "", + "description": "", + "url": "../shortcut_pass.html", + "icons": [{ + "src": "https://{{host}}:{{ports[https][1]}}/appmanifest/icons-member/resources/fail.png", + "sizes": "256x256" + }] + }] +} diff --git a/testing/web-platform/tests/appmanifest/shortcuts-member/resources/shortcuts-member-cors-fail.webmanifest.headers b/testing/web-platform/tests/appmanifest/shortcuts-member/resources/shortcuts-member-cors-fail.webmanifest.headers new file mode 100644 index 0000000000..2bab061d43 --- /dev/null +++ b/testing/web-platform/tests/appmanifest/shortcuts-member/resources/shortcuts-member-cors-fail.webmanifest.headers @@ -0,0 +1 @@ +Content-Type: application/manifest+json; charset=utf-8 diff --git a/testing/web-platform/tests/appmanifest/shortcuts-member/resources/shortcuts-member-cors.sub.webmanifest b/testing/web-platform/tests/appmanifest/shortcuts-member/resources/shortcuts-member-cors.sub.webmanifest new file mode 100644 index 0000000000..94f0e0388c --- /dev/null +++ b/testing/web-platform/tests/appmanifest/shortcuts-member/resources/shortcuts-member-cors.sub.webmanifest @@ -0,0 +1,22 @@ +{ + "name": "Shortcut test", + "icons": [ + { + "src": "https://{{host}}:{{ports[https][0]}}/appmanifest/shortcuts-member/resources/pass.png", + "sizes": "256x256" + } + ], + "start_url": "../shortcuts-member-cors-manual.sub.html", + "display": "fullscreen", + "scope": "../", + "shortcuts": [{ + "name": "pass", + "short_name": "", + "description": "", + "url": "../shortcut_pass.html", + "icons": [{ + "src": "https://{{host}}:{{ports[https][1]}}/appmanifest/icons-member/resources/pass.png", + "sizes": "256x256" + }] + }] +} diff --git a/testing/web-platform/tests/appmanifest/shortcuts-member/resources/shortcuts-member-cors.webmanifest.headers b/testing/web-platform/tests/appmanifest/shortcuts-member/resources/shortcuts-member-cors.webmanifest.headers new file mode 100644 index 0000000000..2bab061d43 --- /dev/null +++ b/testing/web-platform/tests/appmanifest/shortcuts-member/resources/shortcuts-member-cors.webmanifest.headers @@ -0,0 +1 @@ +Content-Type: application/manifest+json; charset=utf-8 diff --git a/testing/web-platform/tests/appmanifest/shortcuts-member/resources/shortcuts-member-csp-fail.webmanifest b/testing/web-platform/tests/appmanifest/shortcuts-member/resources/shortcuts-member-csp-fail.webmanifest new file mode 100644 index 0000000000..7efe564c9d --- /dev/null +++ b/testing/web-platform/tests/appmanifest/shortcuts-member/resources/shortcuts-member-csp-fail.webmanifest @@ -0,0 +1,22 @@ +{ + "name": "Shortcut test", + "icons": [ + { + "src": "pass.png", + "sizes": "256x256" + } + ], + "start_url": "../shortcuts-member-csp-fail-manual.sub.html", + "display": "fullscreen", + "scope": "../", + "shortcuts": [{ + "name": "pass", + "short_name": "", + "description": "", + "url": "../shortcut_pass.html", + "icons": [{ + "src": "fail.png", + "sizes": "256x256" + }] + }] +} diff --git a/testing/web-platform/tests/appmanifest/shortcuts-member/resources/shortcuts-member-csp-fail.webmanifest.headers b/testing/web-platform/tests/appmanifest/shortcuts-member/resources/shortcuts-member-csp-fail.webmanifest.headers new file mode 100644 index 0000000000..2bab061d43 --- /dev/null +++ b/testing/web-platform/tests/appmanifest/shortcuts-member/resources/shortcuts-member-csp-fail.webmanifest.headers @@ -0,0 +1 @@ +Content-Type: application/manifest+json; charset=utf-8 diff --git a/testing/web-platform/tests/appmanifest/shortcuts-member/resources/shortcuts-member-csp.sub.webmanifest b/testing/web-platform/tests/appmanifest/shortcuts-member/resources/shortcuts-member-csp.sub.webmanifest new file mode 100644 index 0000000000..55b0afb3ed --- /dev/null +++ b/testing/web-platform/tests/appmanifest/shortcuts-member/resources/shortcuts-member-csp.sub.webmanifest @@ -0,0 +1,22 @@ +{ + "name": "Shortcut test", + "icons": [ + { + "src": "https://{{host}}:{{ports[https][0]}}/appmanifest/shortcuts-member/resources/pass.png", + "sizes": "256x256" + } + ], + "start_url": "../shortcuts-member-csp-manual.sub.html", + "display": "fullscreen", + "scope": "../", + "shortcuts": [{ + "name": "pass", + "short_name": "", + "description": "", + "url": "../shortcut_pass.html", + "icons": [{ + "src": "https://{{host}}:{{ports[https][1]}}/appmanifest/icons-member/resources/pass.png", + "sizes": "256x256" + }] + }] +} diff --git a/testing/web-platform/tests/appmanifest/shortcuts-member/resources/shortcuts-member-csp.webmanifest.headers b/testing/web-platform/tests/appmanifest/shortcuts-member/resources/shortcuts-member-csp.webmanifest.headers new file mode 100644 index 0000000000..2bab061d43 --- /dev/null +++ b/testing/web-platform/tests/appmanifest/shortcuts-member/resources/shortcuts-member-csp.webmanifest.headers @@ -0,0 +1 @@ +Content-Type: application/manifest+json; charset=utf-8 diff --git a/testing/web-platform/tests/appmanifest/shortcuts-member/resources/shortcuts-member-manual.js b/testing/web-platform/tests/appmanifest/shortcuts-member/resources/shortcuts-member-manual.js new file mode 100644 index 0000000000..5fdfde1bd6 --- /dev/null +++ b/testing/web-platform/tests/appmanifest/shortcuts-member/resources/shortcuts-member-manual.js @@ -0,0 +1,4 @@ +if ('serviceWorker' in navigator) { + navigator.serviceWorker.register( + 'shortcuts-member-service-worker.js'); +} diff --git a/testing/web-platform/tests/appmanifest/shortcuts-member/resources/shortcuts-member-skip-for-empty-name.webmanifest b/testing/web-platform/tests/appmanifest/shortcuts-member/resources/shortcuts-member-skip-for-empty-name.webmanifest new file mode 100644 index 0000000000..6e17899c65 --- /dev/null +++ b/testing/web-platform/tests/appmanifest/shortcuts-member/resources/shortcuts-member-skip-for-empty-name.webmanifest @@ -0,0 +1,27 @@ +{ + "name": "Shortcut test", + "icons": [ + { + "src": "pass.png", + "sizes": "256x256" + } + ], + "start_url": "../shortcuts-member-skip-for-empty-name-manual.html", + "display": "fullscreen", + "scope": "../", + "shortcuts": [{ + "name": "", + "short_name": "", + "description": "", + "url": "../shortcut_fail.html", + "icons": [] + }, { + "name": "pass", + "short_name": "", + "description": "", + "url": "../shortcut_pass.html", + "icons": [{ + "src": "pass.png" + }] + }] +} diff --git a/testing/web-platform/tests/appmanifest/shortcuts-member/resources/shortcuts-member-skip-for-empty-name.webmanifest.headers b/testing/web-platform/tests/appmanifest/shortcuts-member/resources/shortcuts-member-skip-for-empty-name.webmanifest.headers new file mode 100644 index 0000000000..2bab061d43 --- /dev/null +++ b/testing/web-platform/tests/appmanifest/shortcuts-member/resources/shortcuts-member-skip-for-empty-name.webmanifest.headers @@ -0,0 +1 @@ +Content-Type: application/manifest+json; charset=utf-8 diff --git a/testing/web-platform/tests/appmanifest/shortcuts-member/resources/shortcuts-member-skip-for-invalid-url.webmanifest b/testing/web-platform/tests/appmanifest/shortcuts-member/resources/shortcuts-member-skip-for-invalid-url.webmanifest new file mode 100644 index 0000000000..573bbdc8c0 --- /dev/null +++ b/testing/web-platform/tests/appmanifest/shortcuts-member/resources/shortcuts-member-skip-for-invalid-url.webmanifest @@ -0,0 +1,27 @@ +{ + "name": "Shortcut test", + "icons": [ + { + "src": "pass.png", + "sizes": "256x256" + } + ], + "start_url": "../shortcuts-member-skip-for-invalid-url-manual.html", + "display": "fullscreen", + "scope": "../", + "shortcuts": [{ + "name": "fail", + "short_name": "", + "description": "", + "url": "http://foo:660000", + "icons": [] + }, { + "name": "pass", + "short_name": "", + "description": "", + "url": "../shortcut_pass.html", + "icons": [{ + "src": "pass.png" + }] + }] +} diff --git a/testing/web-platform/tests/appmanifest/shortcuts-member/resources/shortcuts-member-skip-for-invalid-url.webmanifest.headers b/testing/web-platform/tests/appmanifest/shortcuts-member/resources/shortcuts-member-skip-for-invalid-url.webmanifest.headers new file mode 100644 index 0000000000..2bab061d43 --- /dev/null +++ b/testing/web-platform/tests/appmanifest/shortcuts-member/resources/shortcuts-member-skip-for-invalid-url.webmanifest.headers @@ -0,0 +1 @@ +Content-Type: application/manifest+json; charset=utf-8 diff --git a/testing/web-platform/tests/appmanifest/shortcuts-member/resources/shortcuts-member-skip-for-out-of-scope-url.webmanifest b/testing/web-platform/tests/appmanifest/shortcuts-member/resources/shortcuts-member-skip-for-out-of-scope-url.webmanifest new file mode 100644 index 0000000000..79ac5130fb --- /dev/null +++ b/testing/web-platform/tests/appmanifest/shortcuts-member/resources/shortcuts-member-skip-for-out-of-scope-url.webmanifest @@ -0,0 +1,27 @@ +{ + "name": "Shortcut test", + "icons": [ + { + "src": "pass.png", + "sizes": "256x256" + } + ], + "start_url": "../shortcuts-member-skip-for-out-of-scope-url-manual.html", + "display": "fullscreen", + "scope": "../", + "shortcuts": [{ + "name": "fail", + "short_name": "", + "description": "", + "url": "https://example.com", + "icons": [] + }, { + "name": "pass", + "short_name": "", + "description": "", + "url": "../shortcut_pass.html", + "icons": [{ + "src": "pass.png" + }] + }] +} diff --git a/testing/web-platform/tests/appmanifest/shortcuts-member/resources/shortcuts-member-skip-for-out-of-scope-url.webmanifest.headers b/testing/web-platform/tests/appmanifest/shortcuts-member/resources/shortcuts-member-skip-for-out-of-scope-url.webmanifest.headers new file mode 100644 index 0000000000..2bab061d43 --- /dev/null +++ b/testing/web-platform/tests/appmanifest/shortcuts-member/resources/shortcuts-member-skip-for-out-of-scope-url.webmanifest.headers @@ -0,0 +1 @@ +Content-Type: application/manifest+json; charset=utf-8 diff --git a/testing/web-platform/tests/appmanifest/shortcuts-member/resources/shortcuts-member-skip-for-undefined-name.webmanifest b/testing/web-platform/tests/appmanifest/shortcuts-member/resources/shortcuts-member-skip-for-undefined-name.webmanifest new file mode 100644 index 0000000000..14521109c2 --- /dev/null +++ b/testing/web-platform/tests/appmanifest/shortcuts-member/resources/shortcuts-member-skip-for-undefined-name.webmanifest @@ -0,0 +1,26 @@ +{ + "name": "Shortcut test", + "icons": [ + { + "src": "pass.png", + "sizes": "256x256" + } + ], + "start_url": "../shortcuts-member-skip-for-undefined-name-manual.html", + "display": "fullscreen", + "scope": "../", + "shortcuts": [{ + "short_name": "fail", + "description": "", + "url": "../shortcut_fail.html", + "icons": [] + }, { + "name": "pass", + "short_name": "", + "description": "", + "url": "../shortcut_pass.html", + "icons": [{ + "src": "pass.png" + }] + }] +} diff --git a/testing/web-platform/tests/appmanifest/shortcuts-member/resources/shortcuts-member-skip-for-undefined-name.webmanifest.headers b/testing/web-platform/tests/appmanifest/shortcuts-member/resources/shortcuts-member-skip-for-undefined-name.webmanifest.headers new file mode 100644 index 0000000000..2bab061d43 --- /dev/null +++ b/testing/web-platform/tests/appmanifest/shortcuts-member/resources/shortcuts-member-skip-for-undefined-name.webmanifest.headers @@ -0,0 +1 @@ +Content-Type: application/manifest+json; charset=utf-8 diff --git a/testing/web-platform/tests/appmanifest/shortcuts-member/resources/shortcuts-member-skip-for-undefined-url.webmanifest b/testing/web-platform/tests/appmanifest/shortcuts-member/resources/shortcuts-member-skip-for-undefined-url.webmanifest new file mode 100644 index 0000000000..e272c4cae5 --- /dev/null +++ b/testing/web-platform/tests/appmanifest/shortcuts-member/resources/shortcuts-member-skip-for-undefined-url.webmanifest @@ -0,0 +1,26 @@ +{ + "name": "Shortcut test", + "icons": [ + { + "src": "pass.png", + "sizes": "256x256" + } + ], + "start_url": "../shortcuts-member-skip-for-undefined-url-manual.html", + "display": "fullscreen", + "scope": "../", + "shortcuts": [{ + "name": "fail", + "short_name": "", + "description": "", + "icons": [] + }, { + "name": "pass", + "short_name": "", + "description": "", + "url": "../shortcut_pass.html", + "icons": [{ + "src": "pass.png" + }] + }] +} diff --git a/testing/web-platform/tests/appmanifest/shortcuts-member/resources/shortcuts-member-skip-for-undefined-url.webmanifest.headers b/testing/web-platform/tests/appmanifest/shortcuts-member/resources/shortcuts-member-skip-for-undefined-url.webmanifest.headers new file mode 100644 index 0000000000..2bab061d43 --- /dev/null +++ b/testing/web-platform/tests/appmanifest/shortcuts-member/resources/shortcuts-member-skip-for-undefined-url.webmanifest.headers @@ -0,0 +1 @@ +Content-Type: application/manifest+json; charset=utf-8 diff --git a/testing/web-platform/tests/appmanifest/shortcuts-member/resources/shortcuts-member.webmanifest b/testing/web-platform/tests/appmanifest/shortcuts-member/resources/shortcuts-member.webmanifest new file mode 100644 index 0000000000..68c3e99d70 --- /dev/null +++ b/testing/web-platform/tests/appmanifest/shortcuts-member/resources/shortcuts-member.webmanifest @@ -0,0 +1,22 @@ +{ + "name": "Shortcut test", + "icons": [ + { + "src": "pass.png", + "sizes": "256x256" + } + ], + "start_url": "../shortcuts-member-manual.html", + "display": "fullscreen", + "scope": "../", + "shortcuts": [{ + "name": "pass", + "short_name": "", + "description": "", + "url": "../shortcut_pass.html", + "icons": [{ + "src": "pass.png", + "sizes": "256x256" + }] + }] +} diff --git a/testing/web-platform/tests/appmanifest/shortcuts-member/resources/shortcuts-member.webmanifest.headers b/testing/web-platform/tests/appmanifest/shortcuts-member/resources/shortcuts-member.webmanifest.headers new file mode 100644 index 0000000000..2bab061d43 --- /dev/null +++ b/testing/web-platform/tests/appmanifest/shortcuts-member/resources/shortcuts-member.webmanifest.headers @@ -0,0 +1 @@ +Content-Type: application/manifest+json; charset=utf-8 diff --git a/testing/web-platform/tests/appmanifest/shortcuts-member/shortcut_fail.html b/testing/web-platform/tests/appmanifest/shortcuts-member/shortcut_fail.html new file mode 100644 index 0000000000..d3259744d3 --- /dev/null +++ b/testing/web-platform/tests/appmanifest/shortcuts-member/shortcut_fail.html @@ -0,0 +1,4 @@ + + + +

Fail

diff --git a/testing/web-platform/tests/appmanifest/shortcuts-member/shortcut_pass.html b/testing/web-platform/tests/appmanifest/shortcuts-member/shortcut_pass.html new file mode 100644 index 0000000000..f15bfe1141 --- /dev/null +++ b/testing/web-platform/tests/appmanifest/shortcuts-member/shortcut_pass.html @@ -0,0 +1,4 @@ + + + +

Pass

diff --git a/testing/web-platform/tests/appmanifest/shortcuts-member/shortcuts-member-cors-fail-manual.sub.html b/testing/web-platform/tests/appmanifest/shortcuts-member/shortcuts-member-cors-fail-manual.sub.html new file mode 100644 index 0000000000..5b1bd84dca --- /dev/null +++ b/testing/web-platform/tests/appmanifest/shortcuts-member/shortcuts-member-cors-fail-manual.sub.html @@ -0,0 +1,17 @@ + +Test that shortcuts member is supported (icon violates CORS) + + + +

Testing support for shortcuts member (icon violates CORS)

+ +

+ To pass, the application must not show a shortcut with + a white cross on red background. +

diff --git a/testing/web-platform/tests/appmanifest/shortcuts-member/shortcuts-member-cors-manual.sub.html b/testing/web-platform/tests/appmanifest/shortcuts-member/shortcuts-member-cors-manual.sub.html new file mode 100644 index 0000000000..73b47c4336 --- /dev/null +++ b/testing/web-platform/tests/appmanifest/shortcuts-member/shortcuts-member-cors-manual.sub.html @@ -0,0 +1,17 @@ + +Test that shortcuts member is supported (icon via CORS) + + + +

Testing support for shortcuts member (icon via CORS)

+ +

+ To pass, the application must show a shortcut named "pass" with a check + mark icon. Clicking it must open this document again. +

diff --git a/testing/web-platform/tests/appmanifest/shortcuts-member/shortcuts-member-csp-fail-manual.sub.html b/testing/web-platform/tests/appmanifest/shortcuts-member/shortcuts-member-csp-fail-manual.sub.html new file mode 100644 index 0000000000..228c9782c0 --- /dev/null +++ b/testing/web-platform/tests/appmanifest/shortcuts-member/shortcuts-member-csp-fail-manual.sub.html @@ -0,0 +1,18 @@ + + +Test that shortcuts member is supported (icon CSP violation) + + + +

Testing support for shortcuts member (icon CSP violation)

+ +

+ To pass, the application must not show a shortcut with + a white cross on red background. +

diff --git a/testing/web-platform/tests/appmanifest/shortcuts-member/shortcuts-member-csp-manual.sub.html b/testing/web-platform/tests/appmanifest/shortcuts-member/shortcuts-member-csp-manual.sub.html new file mode 100644 index 0000000000..68c5f0107d --- /dev/null +++ b/testing/web-platform/tests/appmanifest/shortcuts-member/shortcuts-member-csp-manual.sub.html @@ -0,0 +1,18 @@ + + +Test that shortcuts member is supported (icon CSP check) + + + +

Testing support for shortcuts member (icon CSP check)

+ +

+ To pass, the application must show a shortcut named "pass" with a check + mark icon. Clicking it must open this document again. +

diff --git a/testing/web-platform/tests/appmanifest/shortcuts-member/shortcuts-member-manual.html b/testing/web-platform/tests/appmanifest/shortcuts-member/shortcuts-member-manual.html new file mode 100644 index 0000000000..f2a7d6742d --- /dev/null +++ b/testing/web-platform/tests/appmanifest/shortcuts-member/shortcuts-member-manual.html @@ -0,0 +1,10 @@ + +Test that shortcuts member is supported + + + +

Testing support for shortcuts member

+

+ To pass, the application must show a shortcut named "pass" with a check + mark icon. Clicking it must open this document again. +

diff --git a/testing/web-platform/tests/appmanifest/shortcuts-member/shortcuts-member-service-worker.js b/testing/web-platform/tests/appmanifest/shortcuts-member/shortcuts-member-service-worker.js new file mode 100644 index 0000000000..bd9995202e --- /dev/null +++ b/testing/web-platform/tests/appmanifest/shortcuts-member/shortcuts-member-service-worker.js @@ -0,0 +1,61 @@ +// 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 = [ + "shortcuts-member-cors-fail-manual.sub.html", + "shortcuts-member-cors-manual.sub.html", + "shortcuts-member-csp-fail-manual.sub.html", + "shortcuts-member-csp-manual.sub.html", + "shortcuts-member-manual.html", + "shortcuts-member-skip-for-empty-name-manual.html", + "shortcuts-member-skip-for-invalid-url-manual.html", + "shortcuts-member-skip-for-out-of-scope-url-manual.html", + "shortcuts-member-skip-for-undefined-name-manual.html", + "shortcuts-member-skip-for-undefined-url-manual.html", + "shortcuts-member-service-worker.js", + "resources/shortcuts-member-manual.js", + "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/shortcuts-member/shortcuts-member-skip-for-empty-name-manual.html b/testing/web-platform/tests/appmanifest/shortcuts-member/shortcuts-member-skip-for-empty-name-manual.html new file mode 100644 index 0000000000..48f4af7ba5 --- /dev/null +++ b/testing/web-platform/tests/appmanifest/shortcuts-member/shortcuts-member-skip-for-empty-name-manual.html @@ -0,0 +1,9 @@ + +Test that shortcut items with an empty name are skipped + + + +

Testing if shortcut items with an empty name are skipped

+

+ To pass, the application must provide a single shortcut named "pass". +

diff --git a/testing/web-platform/tests/appmanifest/shortcuts-member/shortcuts-member-skip-for-invalid-url-manual.html b/testing/web-platform/tests/appmanifest/shortcuts-member/shortcuts-member-skip-for-invalid-url-manual.html new file mode 100644 index 0000000000..6967f8dca2 --- /dev/null +++ b/testing/web-platform/tests/appmanifest/shortcuts-member/shortcuts-member-skip-for-invalid-url-manual.html @@ -0,0 +1,9 @@ + +Test that shortcut items with an invalid URL are skipped + + + +

Testing if shortcut items with an invalid URL are skipped

+

+ To pass, the application must provide a single shortcut named "pass". +

diff --git a/testing/web-platform/tests/appmanifest/shortcuts-member/shortcuts-member-skip-for-out-of-scope-url-manual.html b/testing/web-platform/tests/appmanifest/shortcuts-member/shortcuts-member-skip-for-out-of-scope-url-manual.html new file mode 100644 index 0000000000..64f3d0fe15 --- /dev/null +++ b/testing/web-platform/tests/appmanifest/shortcuts-member/shortcuts-member-skip-for-out-of-scope-url-manual.html @@ -0,0 +1,9 @@ + +Test that shortcut items with an out-of-scope URL are skipped + + + +

Testing if shortcut items with an out-of-scope URL are skipped

+

+ To pass, the application must provide a single shortcut named "pass". +

diff --git a/testing/web-platform/tests/appmanifest/shortcuts-member/shortcuts-member-skip-for-undefined-name-manual.html b/testing/web-platform/tests/appmanifest/shortcuts-member/shortcuts-member-skip-for-undefined-name-manual.html new file mode 100644 index 0000000000..c0a7768eee --- /dev/null +++ b/testing/web-platform/tests/appmanifest/shortcuts-member/shortcuts-member-skip-for-undefined-name-manual.html @@ -0,0 +1,9 @@ + +Test that shortcut items with an undefined name are skipped + + + +

Testing if shortcut items with an undefined name are skipped

+

+ To pass, the application must provide a single shortcut named "pass". +

diff --git a/testing/web-platform/tests/appmanifest/shortcuts-member/shortcuts-member-skip-for-undefined-url-manual.html b/testing/web-platform/tests/appmanifest/shortcuts-member/shortcuts-member-skip-for-undefined-url-manual.html new file mode 100644 index 0000000000..ffeb6af9a0 --- /dev/null +++ b/testing/web-platform/tests/appmanifest/shortcuts-member/shortcuts-member-skip-for-undefined-url-manual.html @@ -0,0 +1,9 @@ + +Test that shortcut items with an undefined URL are skipped + + + +

Testing if shortcut items with an undefined URL are skipped

+

+ To pass, the application must provide a single shortcut named "pass". +

diff --git a/testing/web-platform/tests/appmanifest/start_url-member/fail.html b/testing/web-platform/tests/appmanifest/start_url-member/fail.html new file mode 100644 index 0000000000..4c6c599b5a --- /dev/null +++ b/testing/web-platform/tests/appmanifest/start_url-member/fail.html @@ -0,0 +1,4 @@ + + + +

FAIL

diff --git a/testing/web-platform/tests/appmanifest/start_url-member/pass.html b/testing/web-platform/tests/appmanifest/start_url-member/pass.html new file mode 100644 index 0000000000..caecc70f6d --- /dev/null +++ b/testing/web-platform/tests/appmanifest/start_url-member/pass.html @@ -0,0 +1,5 @@ + +PASS + + +

PASS

diff --git a/testing/web-platform/tests/appmanifest/start_url-member/resources/icon.png b/testing/web-platform/tests/appmanifest/start_url-member/resources/icon.png new file mode 100644 index 0000000000..b8845ac098 Binary files /dev/null and b/testing/web-platform/tests/appmanifest/start_url-member/resources/icon.png differ diff --git a/testing/web-platform/tests/appmanifest/start_url-member/resources/start_url-member-fail.sub.webmanifest b/testing/web-platform/tests/appmanifest/start_url-member/resources/start_url-member-fail.sub.webmanifest new file mode 100644 index 0000000000..9cfb0b815b --- /dev/null +++ b/testing/web-platform/tests/appmanifest/start_url-member/resources/start_url-member-fail.sub.webmanifest @@ -0,0 +1,11 @@ +{ + "name": "start_url member WPT", + "icons": [ + { + "src": "icon.png", + "sizes": "192x192" + } + ], + "start_url": "https://{{host}}:{{ports[https][1]}}/appmanifest/start_url-member/fail.html", + "display": "fullscreen" +} diff --git a/testing/web-platform/tests/appmanifest/start_url-member/resources/start_url-member-fail.sub.webmanifest.headers b/testing/web-platform/tests/appmanifest/start_url-member/resources/start_url-member-fail.sub.webmanifest.headers new file mode 100644 index 0000000000..23f36ea27c --- /dev/null +++ b/testing/web-platform/tests/appmanifest/start_url-member/resources/start_url-member-fail.sub.webmanifest.headers @@ -0,0 +1 @@ +Content-Type: application/manifest+json; charset=utf-8 \ No newline at end of file diff --git a/testing/web-platform/tests/appmanifest/start_url-member/resources/start_url-member-manual.js b/testing/web-platform/tests/appmanifest/start_url-member/resources/start_url-member-manual.js new file mode 100644 index 0000000000..302ce45aeb --- /dev/null +++ b/testing/web-platform/tests/appmanifest/start_url-member/resources/start_url-member-manual.js @@ -0,0 +1,4 @@ +if ('serviceWorker' in navigator) { + navigator.serviceWorker.register( + 'start_url-member-service-worker.js'); +} diff --git a/testing/web-platform/tests/appmanifest/start_url-member/resources/start_url-member.webmanifest b/testing/web-platform/tests/appmanifest/start_url-member/resources/start_url-member.webmanifest new file mode 100644 index 0000000000..2afae97566 --- /dev/null +++ b/testing/web-platform/tests/appmanifest/start_url-member/resources/start_url-member.webmanifest @@ -0,0 +1,11 @@ +{ + "name": "start_url member WPT", + "icons": [ + { + "src": "icon.png", + "sizes": "192x192" + } + ], + "start_url": "../pass.html", + "display": "fullscreen" +} diff --git a/testing/web-platform/tests/appmanifest/start_url-member/resources/start_url-member.webmanifest.headers b/testing/web-platform/tests/appmanifest/start_url-member/resources/start_url-member.webmanifest.headers new file mode 100644 index 0000000000..23f36ea27c --- /dev/null +++ b/testing/web-platform/tests/appmanifest/start_url-member/resources/start_url-member.webmanifest.headers @@ -0,0 +1 @@ +Content-Type: application/manifest+json; charset=utf-8 \ No newline at end of file diff --git a/testing/web-platform/tests/appmanifest/start_url-member/start_url-member-fail-manual.sub.html b/testing/web-platform/tests/appmanifest/start_url-member/start_url-member-fail-manual.sub.html new file mode 100644 index 0000000000..079f048b55 --- /dev/null +++ b/testing/web-platform/tests/appmanifest/start_url-member/start_url-member-fail-manual.sub.html @@ -0,0 +1,16 @@ + +Test that start_url member is supported + + + +

Cross-origin start URLs are invalid

+ +

+ To pass, the start URL must not be fail.html because it's not same origin. +

diff --git a/testing/web-platform/tests/appmanifest/start_url-member/start_url-member-pass-manual.html b/testing/web-platform/tests/appmanifest/start_url-member/start_url-member-pass-manual.html new file mode 100644 index 0000000000..34be2d6263 --- /dev/null +++ b/testing/web-platform/tests/appmanifest/start_url-member/start_url-member-pass-manual.html @@ -0,0 +1,9 @@ + +Test that start_url member is supported + + + +

Testing support for start_url member

+

+ To pass, the start URL must be pass.html after installing. +

diff --git a/testing/web-platform/tests/appmanifest/start_url-member/start_url-member-service-worker.js b/testing/web-platform/tests/appmanifest/start_url-member/start_url-member-service-worker.js new file mode 100644 index 0000000000..6ffe893e13 --- /dev/null +++ b/testing/web-platform/tests/appmanifest/start_url-member/start_url-member-service-worker.js @@ -0,0 +1,55 @@ +// 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 = [ + "fail.html", + "pass.html", + "start_url-member-fail-manual.sub.html", + "start_url-member-pass-manual.html", + "start_url-member-service-worker.js", + "resources/start_url-member-manual.js", + "resources/icon.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/theme_color-member/resources/icon.png b/testing/web-platform/tests/appmanifest/theme_color-member/resources/icon.png new file mode 100644 index 0000000000..341f824d9b Binary files /dev/null and b/testing/web-platform/tests/appmanifest/theme_color-member/resources/icon.png differ diff --git a/testing/web-platform/tests/appmanifest/theme_color-member/resources/theme_color-member-hsl.webmanifest b/testing/web-platform/tests/appmanifest/theme_color-member/resources/theme_color-member-hsl.webmanifest new file mode 100644 index 0000000000..d3ddbf1c16 --- /dev/null +++ b/testing/web-platform/tests/appmanifest/theme_color-member/resources/theme_color-member-hsl.webmanifest @@ -0,0 +1,12 @@ +{ + "name": "theme_color member WPT", + "icons": [ + { + "src": "icon.png", + "sizes": "192x192" + } + ], + "start_url": "../theme_color-member-hsl-manual.html", + "display": "fullscreen", + "theme_color": "hsl(120 100% 50%)" +} diff --git a/testing/web-platform/tests/appmanifest/theme_color-member/resources/theme_color-member-hsl.webmanifest.headers b/testing/web-platform/tests/appmanifest/theme_color-member/resources/theme_color-member-hsl.webmanifest.headers new file mode 100644 index 0000000000..2bab061d43 --- /dev/null +++ b/testing/web-platform/tests/appmanifest/theme_color-member/resources/theme_color-member-hsl.webmanifest.headers @@ -0,0 +1 @@ +Content-Type: application/manifest+json; charset=utf-8 diff --git a/testing/web-platform/tests/appmanifest/theme_color-member/resources/theme_color-member-manual.js b/testing/web-platform/tests/appmanifest/theme_color-member/resources/theme_color-member-manual.js new file mode 100644 index 0000000000..0cef8baa4c --- /dev/null +++ b/testing/web-platform/tests/appmanifest/theme_color-member/resources/theme_color-member-manual.js @@ -0,0 +1,4 @@ +if ('serviceWorker' in navigator) { + navigator.serviceWorker.register( + 'theme_color-member-service-worker.js'); +} diff --git a/testing/web-platform/tests/appmanifest/theme_color-member/resources/theme_color-member-named.webmanifest b/testing/web-platform/tests/appmanifest/theme_color-member/resources/theme_color-member-named.webmanifest new file mode 100644 index 0000000000..efa621b57c --- /dev/null +++ b/testing/web-platform/tests/appmanifest/theme_color-member/resources/theme_color-member-named.webmanifest @@ -0,0 +1,12 @@ +{ + "name": "theme_color member WPT", + "icons": [ + { + "src": "icon.png", + "sizes": "192x192" + } + ], + "start_url": "../theme_color-member-named-manual.html", + "display": "fullscreen", + "theme_color": "green" +} diff --git a/testing/web-platform/tests/appmanifest/theme_color-member/resources/theme_color-member-named.webmanifest.headers b/testing/web-platform/tests/appmanifest/theme_color-member/resources/theme_color-member-named.webmanifest.headers new file mode 100644 index 0000000000..2bab061d43 --- /dev/null +++ b/testing/web-platform/tests/appmanifest/theme_color-member/resources/theme_color-member-named.webmanifest.headers @@ -0,0 +1 @@ +Content-Type: application/manifest+json; charset=utf-8 diff --git a/testing/web-platform/tests/appmanifest/theme_color-member/resources/theme_color-member-rgb.webmanifest b/testing/web-platform/tests/appmanifest/theme_color-member/resources/theme_color-member-rgb.webmanifest new file mode 100644 index 0000000000..1a0a51debe --- /dev/null +++ b/testing/web-platform/tests/appmanifest/theme_color-member/resources/theme_color-member-rgb.webmanifest @@ -0,0 +1,12 @@ +{ + "name": "theme_color member WPT", + "icons": [ + { + "src": "icon.png", + "sizes": "192x192" + } + ], + "start_url": "../theme_color-member-rgb-manual.html", + "display": "fullscreen", + "theme_color": "rgb(0 255 0)" +} diff --git a/testing/web-platform/tests/appmanifest/theme_color-member/resources/theme_color-member-rgb.webmanifest.headers b/testing/web-platform/tests/appmanifest/theme_color-member/resources/theme_color-member-rgb.webmanifest.headers new file mode 100644 index 0000000000..2bab061d43 --- /dev/null +++ b/testing/web-platform/tests/appmanifest/theme_color-member/resources/theme_color-member-rgb.webmanifest.headers @@ -0,0 +1 @@ +Content-Type: application/manifest+json; charset=utf-8 diff --git a/testing/web-platform/tests/appmanifest/theme_color-member/resources/theme_color-member-rgbhex3.webmanifest b/testing/web-platform/tests/appmanifest/theme_color-member/resources/theme_color-member-rgbhex3.webmanifest new file mode 100644 index 0000000000..0d01d1d5fe --- /dev/null +++ b/testing/web-platform/tests/appmanifest/theme_color-member/resources/theme_color-member-rgbhex3.webmanifest @@ -0,0 +1,12 @@ +{ + "name": "theme_color member WPT", + "icons": [ + { + "src": "icon.png", + "sizes": "192x192" + } + ], + "start_url": "../theme_color-member-rgbhex3-manual.html", + "display": "fullscreen", + "theme_color": "#0F0" +} diff --git a/testing/web-platform/tests/appmanifest/theme_color-member/resources/theme_color-member-rgbhex3.webmanifest.headers b/testing/web-platform/tests/appmanifest/theme_color-member/resources/theme_color-member-rgbhex3.webmanifest.headers new file mode 100644 index 0000000000..2bab061d43 --- /dev/null +++ b/testing/web-platform/tests/appmanifest/theme_color-member/resources/theme_color-member-rgbhex3.webmanifest.headers @@ -0,0 +1 @@ +Content-Type: application/manifest+json; charset=utf-8 diff --git a/testing/web-platform/tests/appmanifest/theme_color-member/resources/theme_color-member-rgbhex6.webmanifest b/testing/web-platform/tests/appmanifest/theme_color-member/resources/theme_color-member-rgbhex6.webmanifest new file mode 100644 index 0000000000..74e71bb9b4 --- /dev/null +++ b/testing/web-platform/tests/appmanifest/theme_color-member/resources/theme_color-member-rgbhex6.webmanifest @@ -0,0 +1,12 @@ +{ + "name": "theme_color member WPT", + "icons": [ + { + "src": "icon.png", + "sizes": "192x192" + } + ], + "start_url": "../theme_color-member-rgbhex6-manual.html", + "display": "fullscreen", + "theme_color": "#00FF00" +} diff --git a/testing/web-platform/tests/appmanifest/theme_color-member/resources/theme_color-member-rgbhex6.webmanifest.headers b/testing/web-platform/tests/appmanifest/theme_color-member/resources/theme_color-member-rgbhex6.webmanifest.headers new file mode 100644 index 0000000000..2bab061d43 --- /dev/null +++ b/testing/web-platform/tests/appmanifest/theme_color-member/resources/theme_color-member-rgbhex6.webmanifest.headers @@ -0,0 +1 @@ +Content-Type: application/manifest+json; charset=utf-8 diff --git a/testing/web-platform/tests/appmanifest/theme_color-member/resources/theme_color-member-rgblegacy.webmanifest b/testing/web-platform/tests/appmanifest/theme_color-member/resources/theme_color-member-rgblegacy.webmanifest new file mode 100644 index 0000000000..5679b302be --- /dev/null +++ b/testing/web-platform/tests/appmanifest/theme_color-member/resources/theme_color-member-rgblegacy.webmanifest @@ -0,0 +1,12 @@ +{ + "name": "theme_color member WPT", + "icons": [ + { + "src": "icon.png", + "sizes": "192x192" + } + ], + "start_url": "../theme_color-member-rgblegacy-manual.html", + "display": "fullscreen", + "theme_color": "rgb(0, 255, 0)" +} diff --git a/testing/web-platform/tests/appmanifest/theme_color-member/resources/theme_color-member-rgblegacy.webmanifest.headers b/testing/web-platform/tests/appmanifest/theme_color-member/resources/theme_color-member-rgblegacy.webmanifest.headers new file mode 100644 index 0000000000..2bab061d43 --- /dev/null +++ b/testing/web-platform/tests/appmanifest/theme_color-member/resources/theme_color-member-rgblegacy.webmanifest.headers @@ -0,0 +1 @@ +Content-Type: application/manifest+json; charset=utf-8 diff --git a/testing/web-platform/tests/appmanifest/theme_color-member/theme_color-member-hsl-manual.html b/testing/web-platform/tests/appmanifest/theme_color-member/theme_color-member-hsl-manual.html new file mode 100644 index 0000000000..b5327e8a4b --- /dev/null +++ b/testing/web-platform/tests/appmanifest/theme_color-member/theme_color-member-hsl-manual.html @@ -0,0 +1,9 @@ + +Test that theme_color member is supported + + + +

Testing support for theme_color member

+

+ To pass, the theme_color must be green. +

diff --git a/testing/web-platform/tests/appmanifest/theme_color-member/theme_color-member-named-manual.html b/testing/web-platform/tests/appmanifest/theme_color-member/theme_color-member-named-manual.html new file mode 100644 index 0000000000..28156f5a7b --- /dev/null +++ b/testing/web-platform/tests/appmanifest/theme_color-member/theme_color-member-named-manual.html @@ -0,0 +1,9 @@ + +Test that theme_color member is supported + + + +

Testing support for theme_color member

+

+ To pass, the theme_color must be green. +

diff --git a/testing/web-platform/tests/appmanifest/theme_color-member/theme_color-member-rgb-manual.html b/testing/web-platform/tests/appmanifest/theme_color-member/theme_color-member-rgb-manual.html new file mode 100644 index 0000000000..c1a23d15d4 --- /dev/null +++ b/testing/web-platform/tests/appmanifest/theme_color-member/theme_color-member-rgb-manual.html @@ -0,0 +1,9 @@ + +Test that theme_color member is supported + + + +

Testing support for theme_color member

+

+ To pass, the theme_color must be green. +

diff --git a/testing/web-platform/tests/appmanifest/theme_color-member/theme_color-member-rgbhex3-manual.html b/testing/web-platform/tests/appmanifest/theme_color-member/theme_color-member-rgbhex3-manual.html new file mode 100644 index 0000000000..bd2d6bc28e --- /dev/null +++ b/testing/web-platform/tests/appmanifest/theme_color-member/theme_color-member-rgbhex3-manual.html @@ -0,0 +1,9 @@ + +Test that theme_color member is supported + + + +

Testing support for theme_color member

+

+ To pass, the theme_color must be green. +

diff --git a/testing/web-platform/tests/appmanifest/theme_color-member/theme_color-member-rgbhex6-manual.html b/testing/web-platform/tests/appmanifest/theme_color-member/theme_color-member-rgbhex6-manual.html new file mode 100644 index 0000000000..65a2d369ae --- /dev/null +++ b/testing/web-platform/tests/appmanifest/theme_color-member/theme_color-member-rgbhex6-manual.html @@ -0,0 +1,9 @@ + +Test that theme_color member is supported + + + +

Testing support for theme_color member

+

+ To pass, the theme_color must be green. +

diff --git a/testing/web-platform/tests/appmanifest/theme_color-member/theme_color-member-rgblegacy-manual.html b/testing/web-platform/tests/appmanifest/theme_color-member/theme_color-member-rgblegacy-manual.html new file mode 100644 index 0000000000..4df73b0d67 --- /dev/null +++ b/testing/web-platform/tests/appmanifest/theme_color-member/theme_color-member-rgblegacy-manual.html @@ -0,0 +1,9 @@ + +Test that theme_color member is supported + + + +

Testing support for theme_color member

+

+ To pass, the theme_color must be green. +

diff --git a/testing/web-platform/tests/appmanifest/theme_color-member/theme_color-member-service-worker.js b/testing/web-platform/tests/appmanifest/theme_color-member/theme_color-member-service-worker.js new file mode 100644 index 0000000000..f087117e10 --- /dev/null +++ b/testing/web-platform/tests/appmanifest/theme_color-member/theme_color-member-service-worker.js @@ -0,0 +1,57 @@ +// 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 = [ + "theme_color-member-hsl-manual.html", + "theme_color-member-named-manual.html", + "theme_color-member-rgb-manual.html", + "theme_color-member-rgbhex3-manual.html", + "theme_color-member-rgbhex6-manual.html", + "theme_color-member-rgblegacy-manual.html", + "theme_color-member-service-worker.js", + "resources/theme_color-member-manual.js", + "resources/icon.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/unrecognized-member/resources/icon.png b/testing/web-platform/tests/appmanifest/unrecognized-member/resources/icon.png new file mode 100644 index 0000000000..deea71918a Binary files /dev/null and b/testing/web-platform/tests/appmanifest/unrecognized-member/resources/icon.png differ diff --git a/testing/web-platform/tests/appmanifest/unrecognized-member/resources/unrecognized-member-manual.js b/testing/web-platform/tests/appmanifest/unrecognized-member/resources/unrecognized-member-manual.js new file mode 100644 index 0000000000..9be8fb602e --- /dev/null +++ b/testing/web-platform/tests/appmanifest/unrecognized-member/resources/unrecognized-member-manual.js @@ -0,0 +1,4 @@ +if ('serviceWorker' in navigator) { + navigator.serviceWorker.register( + 'unrecognized-member-service-worker.js'); +} diff --git a/testing/web-platform/tests/appmanifest/unrecognized-member/resources/unrecognized-member.webmanifest b/testing/web-platform/tests/appmanifest/unrecognized-member/resources/unrecognized-member.webmanifest new file mode 100644 index 0000000000..1eb7b6285a --- /dev/null +++ b/testing/web-platform/tests/appmanifest/unrecognized-member/resources/unrecognized-member.webmanifest @@ -0,0 +1,15 @@ +{ + "this member name is not expected to be recognized": "ok", + "this object is not expected to be recognized": { + "this sub-field is not expected to be recognized": [] + }, + "short_name": "pass", + "icons": [ + { + "src": "icon.png", + "sizes": "192x192" + } + ], + "start_url": "../unrecognized-member-manual.html", + "display": "fullscreen" +} diff --git a/testing/web-platform/tests/appmanifest/unrecognized-member/resources/unrecognized-member.webmanifest.headers b/testing/web-platform/tests/appmanifest/unrecognized-member/resources/unrecognized-member.webmanifest.headers new file mode 100644 index 0000000000..23f36ea27c --- /dev/null +++ b/testing/web-platform/tests/appmanifest/unrecognized-member/resources/unrecognized-member.webmanifest.headers @@ -0,0 +1 @@ +Content-Type: application/manifest+json; charset=utf-8 \ No newline at end of file diff --git a/testing/web-platform/tests/appmanifest/unrecognized-member/unrecognized-member-manual.html b/testing/web-platform/tests/appmanifest/unrecognized-member/unrecognized-member-manual.html new file mode 100644 index 0000000000..d22b5bacd7 --- /dev/null +++ b/testing/web-platform/tests/appmanifest/unrecognized-member/unrecognized-member-manual.html @@ -0,0 +1,10 @@ + +Test that an unrecognized member is ignored + + + +

Testing support for ignoring an unrecognized member

+

+ To pass, the application name must be "pass". Parsing must not fail due to the + presence of the unrecognized members in the manifest. +

diff --git a/testing/web-platform/tests/appmanifest/unrecognized-member/unrecognized-member-service-worker.js b/testing/web-platform/tests/appmanifest/unrecognized-member/unrecognized-member-service-worker.js new file mode 100644 index 0000000000..5364b09ffd --- /dev/null +++ b/testing/web-platform/tests/appmanifest/unrecognized-member/unrecognized-member-service-worker.js @@ -0,0 +1,52 @@ +// 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 = [ + "unrecognized-member-manual.html", + "unrecognized-member-service-worker.js", + "resources/unrecognized-member-manual.js", + "resources/icon.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/user_preferences-member/resources/icon.png b/testing/web-platform/tests/appmanifest/user_preferences-member/resources/icon.png new file mode 100644 index 0000000000..d6dd4860ae Binary files /dev/null and b/testing/web-platform/tests/appmanifest/user_preferences-member/resources/icon.png differ diff --git a/testing/web-platform/tests/appmanifest/user_preferences-member/resources/user_preferences-member-manual.js b/testing/web-platform/tests/appmanifest/user_preferences-member/resources/user_preferences-member-manual.js new file mode 100644 index 0000000000..bf1bc8d24c --- /dev/null +++ b/testing/web-platform/tests/appmanifest/user_preferences-member/resources/user_preferences-member-manual.js @@ -0,0 +1,4 @@ +if ('serviceWorker' in navigator) { + navigator.serviceWorker.register( + 'user_preferences-member-service-worker.js'); +} diff --git a/testing/web-platform/tests/appmanifest/user_preferences-member/resources/user_preferences-member.webmanifest b/testing/web-platform/tests/appmanifest/user_preferences-member/resources/user_preferences-member.webmanifest new file mode 100644 index 0000000000..3d92202bf7 --- /dev/null +++ b/testing/web-platform/tests/appmanifest/user_preferences-member/resources/user_preferences-member.webmanifest @@ -0,0 +1,22 @@ +{ + "name": "user_preferences member WPT", + "icons": [ + { + "src": "icon.png", + "sizes": "144x144" + } + ], + "start_url": "../user_preferences-member-manual.html", + "display": "fullscreen", + "user_preferences": { + "color_scheme": { + "dark": { + "theme_color": "green" + }, + "light": { + "theme_color": "green" + } + } + }, + "theme_color": "red" +} \ No newline at end of file diff --git a/testing/web-platform/tests/appmanifest/user_preferences-member/resources/user_preferences-member.webmanifest.headers b/testing/web-platform/tests/appmanifest/user_preferences-member/resources/user_preferences-member.webmanifest.headers new file mode 100644 index 0000000000..23f36ea27c --- /dev/null +++ b/testing/web-platform/tests/appmanifest/user_preferences-member/resources/user_preferences-member.webmanifest.headers @@ -0,0 +1 @@ +Content-Type: application/manifest+json; charset=utf-8 \ No newline at end of file diff --git a/testing/web-platform/tests/appmanifest/user_preferences-member/user_preferences-member-manual.html b/testing/web-platform/tests/appmanifest/user_preferences-member/user_preferences-member-manual.html new file mode 100644 index 0000000000..c864d3dfd5 --- /dev/null +++ b/testing/web-platform/tests/appmanifest/user_preferences-member/user_preferences-member-manual.html @@ -0,0 +1,13 @@ + +Test that user_preferences member is supported + + +

Testing support for user_preferences member

+
    +
  1. Install this site as a PWA
  2. +
  3. Enable the OS dark mode setting
  4. +
  5. To pass, the theme_color must be green. This can be observed by looking + at the top of the window. On failure, this will be red. +
  6. +
+ diff --git a/testing/web-platform/tests/appmanifest/user_preferences-member/user_preferences-member-service-worker.js b/testing/web-platform/tests/appmanifest/user_preferences-member/user_preferences-member-service-worker.js new file mode 100644 index 0000000000..24d575a917 --- /dev/null +++ b/testing/web-platform/tests/appmanifest/user_preferences-member/user_preferences-member-service-worker.js @@ -0,0 +1,52 @@ +// 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 = [ + "user_preferences-member-manual.html", + "user_preferences-member-service-worker.js", + "resources/user_preferences-member-manual.js", + "resources/icon.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)); +}); -- cgit v1.2.3