diff options
Diffstat (limited to 'devtools/client/aboutdebugging/test/browser/resources')
20 files changed, 312 insertions, 0 deletions
diff --git a/devtools/client/aboutdebugging/test/browser/resources/bad-extensions/invalid-json/manifest.json b/devtools/client/aboutdebugging/test/browser/resources/bad-extensions/invalid-json/manifest.json new file mode 100644 index 0000000000..4ab10b4de7 --- /dev/null +++ b/devtools/client/aboutdebugging/test/browser/resources/bad-extensions/invalid-json/manifest.json @@ -0,0 +1 @@ +this is not valid json diff --git a/devtools/client/aboutdebugging/test/browser/resources/bad-extensions/invalid-property/manifest.json b/devtools/client/aboutdebugging/test/browser/resources/bad-extensions/invalid-property/manifest.json new file mode 100644 index 0000000000..992818bd77 --- /dev/null +++ b/devtools/client/aboutdebugging/test/browser/resources/bad-extensions/invalid-property/manifest.json @@ -0,0 +1,23 @@ +{ + "manifest_version": 2, + "name": "test-invalid-extension", + "version": "1", + "description": "the name says it all", + "permissions": ["*://*.foo.com/*", "alarms", "notifications", "tabs"], + "background": { + "scripts": ["background.js"] + }, + "content_scripts": [ + { + "matches": "*://*.foo.com/*", + "js": ["content.js"] + } + ], + "browser_action": { + "default_icon": { + "32": "home.svg" + }, + "default_title": "foobarbaz (v1)", + "browser_style": true + } +} diff --git a/devtools/client/aboutdebugging/test/browser/resources/doc_aboutdebugging_devtoolstoolbox_breakpoint.html b/devtools/client/aboutdebugging/test/browser/resources/doc_aboutdebugging_devtoolstoolbox_breakpoint.html new file mode 100644 index 0000000000..bb28556775 --- /dev/null +++ b/devtools/client/aboutdebugging/test/browser/resources/doc_aboutdebugging_devtoolstoolbox_breakpoint.html @@ -0,0 +1,9 @@ +<!DOCTYPE html> +<html> +<head> + <title>BREAKPOINT TEST PAGE</title> +</head> +<body> + <script type="text/javascript" src="script_aboutdebugging_devtoolstoolbox_breakpoint.js"></script> +</body> +</html> diff --git a/devtools/client/aboutdebugging/test/browser/resources/packaged-extension/packaged-extension.xpi b/devtools/client/aboutdebugging/test/browser/resources/packaged-extension/packaged-extension.xpi Binary files differnew file mode 100644 index 0000000000..c1c7af9600 --- /dev/null +++ b/devtools/client/aboutdebugging/test/browser/resources/packaged-extension/packaged-extension.xpi diff --git a/devtools/client/aboutdebugging/test/browser/resources/real/usb-runtimes-sample.json b/devtools/client/aboutdebugging/test/browser/resources/real/usb-runtimes-sample.json new file mode 100644 index 0000000000..bce334e95a --- /dev/null +++ b/devtools/client/aboutdebugging/test/browser/resources/real/usb-runtimes-sample.json @@ -0,0 +1,14 @@ +[ + { + "sidebarInfo": { + "deviceName": "Pixel 2", + "shortName": "Firefox Nightly" + }, + "runtimeDetails": { + "info": { + "name": "Mozilla Nightly", + "version": "64.0a1" + } + } + } +] diff --git a/devtools/client/aboutdebugging/test/browser/resources/script_aboutdebugging_devtoolstoolbox_breakpoint.js b/devtools/client/aboutdebugging/test/browser/resources/script_aboutdebugging_devtoolstoolbox_breakpoint.js new file mode 100644 index 0000000000..99401016e4 --- /dev/null +++ b/devtools/client/aboutdebugging/test/browser/resources/script_aboutdebugging_devtoolstoolbox_breakpoint.js @@ -0,0 +1,12 @@ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +// Random method on which a breakpoint will be set from the DevTools UI in the +// test. +window.testMethod = function () { + const a = 1; + const b = 2; + return a + b; +}; diff --git a/devtools/client/aboutdebugging/test/browser/resources/service-workers/controlled-sw.html b/devtools/client/aboutdebugging/test/browser/resources/service-workers/controlled-sw.html new file mode 100644 index 0000000000..98d3bffd95 --- /dev/null +++ b/devtools/client/aboutdebugging/test/browser/resources/service-workers/controlled-sw.html @@ -0,0 +1,38 @@ +<!DOCTYPE HTML> +<html> +<head> + <meta charset="UTF-8"> + <title>Service worker controlled</title> +</head> +<body> +<script type="text/javascript"> + +"use strict"; + +let registration; + +const registerServiceWorker = async function() { + try { + registration = await navigator.serviceWorker.register("controlled-sw.js"); + dump("Controlled service worker registered\n"); + } catch (e) { + dump("Controlled service worker not registered: " + e + "\n"); + } +}; + +// Helper called from helper-serviceworker.js to unregister the service worker. +window.getRegistration = function() { + return registration; +}; + +// Called from browser_aboutdebugging_serviceworker_status.js +window.installServiceWorker = function() { + registration.installing.postMessage("install-service-worker"); +}; + +// Register the service worker. +registerServiceWorker(); + +</script> +</body> +</html> diff --git a/devtools/client/aboutdebugging/test/browser/resources/service-workers/controlled-sw.js b/devtools/client/aboutdebugging/test/browser/resources/service-workers/controlled-sw.js new file mode 100644 index 0000000000..0a6d9cfdc6 --- /dev/null +++ b/devtools/client/aboutdebugging/test/browser/resources/service-workers/controlled-sw.js @@ -0,0 +1,31 @@ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ + +/* eslint-env worker */ + +"use strict"; + +// Copied from shared-head.js +function waitUntil(predicate, interval = 10) { + if (predicate()) { + return Promise.resolve(true); + } + return new Promise(resolve => { + setTimeout(function () { + waitUntil(predicate, interval).then(() => resolve(true)); + }, interval); + }); +} + +// This flag will be flipped from controlled-sw.html::installServiceWorker() +let canInstall = false; +self.addEventListener("message", function (event) { + if (event.data === "install-service-worker") { + canInstall = true; + } +}); + +// Wait for the canInstall flag to be flipped before completing the install. +self.addEventListener("install", function (event) { + event.waitUntil(waitUntil(() => canInstall)); +}); diff --git a/devtools/client/aboutdebugging/test/browser/resources/service-workers/empty-sw.html b/devtools/client/aboutdebugging/test/browser/resources/service-workers/empty-sw.html new file mode 100644 index 0000000000..ab862743a7 --- /dev/null +++ b/devtools/client/aboutdebugging/test/browser/resources/service-workers/empty-sw.html @@ -0,0 +1,30 @@ +<!DOCTYPE HTML> +<html> +<head> + <meta charset="UTF-8"> + <title>Service worker test</title> +</head> +<body> +<script type="text/javascript"> +"use strict"; + +let registration; + +const registerServiceWorker = async function() { + try { + registration = await navigator.serviceWorker.register("empty-sw.js"); + dump("Empty service worker registered\n"); + } catch (e) { + dump("Empty service worker not registered: " + e + "\n"); + } +}; + +// Helper called from helper-serviceworker.js to unregister the service worker. +window.getRegistration = function() { + return registration; +}; +// Register the service worker. +registerServiceWorker(); +</script> +</body> +</html> diff --git a/devtools/client/aboutdebugging/test/browser/resources/service-workers/empty-sw.js b/devtools/client/aboutdebugging/test/browser/resources/service-workers/empty-sw.js new file mode 100644 index 0000000000..1e7226402c --- /dev/null +++ b/devtools/client/aboutdebugging/test/browser/resources/service-workers/empty-sw.js @@ -0,0 +1 @@ +// Empty, just test registering. diff --git a/devtools/client/aboutdebugging/test/browser/resources/service-workers/fetch-sw.html b/devtools/client/aboutdebugging/test/browser/resources/service-workers/fetch-sw.html new file mode 100644 index 0000000000..a1bb218341 --- /dev/null +++ b/devtools/client/aboutdebugging/test/browser/resources/service-workers/fetch-sw.html @@ -0,0 +1,30 @@ +<!DOCTYPE HTML> +<html> +<head> + <meta charset="UTF-8"> + <title>Service worker test</title> +</head> +<body> +<script type="text/javascript"> +"use strict"; + +let registration; + +const registerServiceWorker = async function() { + try { + registration = await navigator.serviceWorker.register("fetch-sw.js"); + dump("Empty service worker registered\n"); + } catch (e) { + dump("Empty service worker not registered: " + e + "\n"); + } +}; + +// Helper called from helper-serviceworker.js to unregister the service worker. +window.getRegistration = function() { + return registration; +}; +// Register the service worker. +registerServiceWorker(); +</script> +</body> +</html> diff --git a/devtools/client/aboutdebugging/test/browser/resources/service-workers/fetch-sw.js b/devtools/client/aboutdebugging/test/browser/resources/service-workers/fetch-sw.js new file mode 100644 index 0000000000..de6ee1fb32 --- /dev/null +++ b/devtools/client/aboutdebugging/test/browser/resources/service-workers/fetch-sw.js @@ -0,0 +1,6 @@ +"use strict"; + +// Bug 1328293 +self.onfetch = function (event) { + // do nothing. +}; diff --git a/devtools/client/aboutdebugging/test/browser/resources/service-workers/push-sw.html b/devtools/client/aboutdebugging/test/browser/resources/service-workers/push-sw.html new file mode 100644 index 0000000000..bf5b0b0b0a --- /dev/null +++ b/devtools/client/aboutdebugging/test/browser/resources/service-workers/push-sw.html @@ -0,0 +1,61 @@ +<!DOCTYPE HTML> +<html> +<head> + <meta charset="UTF-8"> + <title>Service worker push test</title> +</head> +<body> +<script type="text/javascript"> + +"use strict"; + +let registration; +let subscription; + +const registerServiceWorker = async function() { + const perm = { type: "desktop-notification", allow: true, context: document }; + await SpecialPowers.pushPermissions([perm]); + + try { + registration = await navigator.serviceWorker.register("push-sw.js"); + dump("Push service worker registered\n"); + } catch (e) { + dump("Push service worker not registered: " + e + "\n"); + } +}; + +// Helper called from helper-serviceworker.js to unregister the service worker. +window.getRegistration = function() { + return registration; +}; + +// Helper called from browser_aboutdebugging_serviceworker_pushservice_url.js +window.subscribeToPush = async function() { + try { + subscription = await registration.pushManager.subscribe(); + dump("SW subscribed to push: " + subscription.endpoint + "\n"); + } catch (e) { + dump("SW not subscribed to push: " + e + "\n"); + } +}; + +// Helper called from browser_aboutdebugging_serviceworker_pushservice_url.js +window.unsubscribeToPush = async function() { + subscription.unsubscribe(); +}; + +// Expose a promise to wait until the service worker is claimed. +window.onSwClaimed = new Promise(resolve => { + navigator.serviceWorker.addEventListener("message", function(event) { + if (event.data == "sw-claimed") { + resolve(); + } + }); +}); + +// Register the service worker. +registerServiceWorker(); + +</script> +</body> +</html> diff --git a/devtools/client/aboutdebugging/test/browser/resources/service-workers/push-sw.js b/devtools/client/aboutdebugging/test/browser/resources/service-workers/push-sw.js new file mode 100644 index 0000000000..1231697ddd --- /dev/null +++ b/devtools/client/aboutdebugging/test/browser/resources/service-workers/push-sw.js @@ -0,0 +1,35 @@ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ + +/* eslint-env worker */ +/* global clients */ + +"use strict"; + +// Send a message to all controlled windows. +function postMessage(message) { + return clients.matchAll().then(function (clientlist) { + clientlist.forEach(function (client) { + client.postMessage(message); + }); + }); +} + +// Don't wait for the next page load to become the active service worker. +self.addEventListener("install", function (event) { + event.waitUntil(self.skipWaiting()); +}); + +// Claim control over the currently open test page when activating. +self.addEventListener("activate", function (event) { + event.waitUntil( + self.clients.claim().then(function () { + return postMessage("sw-claimed"); + }) + ); +}); + +// Forward all "push" events to the controlled window. +self.addEventListener("push", function (event) { + event.waitUntil(postMessage("sw-pushed")); +}); diff --git a/devtools/client/aboutdebugging/test/browser/resources/test-adb-extension/adb-extension-linux.xpi b/devtools/client/aboutdebugging/test/browser/resources/test-adb-extension/adb-extension-linux.xpi Binary files differnew file mode 100644 index 0000000000..56054c341c --- /dev/null +++ b/devtools/client/aboutdebugging/test/browser/resources/test-adb-extension/adb-extension-linux.xpi diff --git a/devtools/client/aboutdebugging/test/browser/resources/test-adb-extension/adb-extension-linux64.xpi b/devtools/client/aboutdebugging/test/browser/resources/test-adb-extension/adb-extension-linux64.xpi Binary files differnew file mode 100644 index 0000000000..9cd737b017 --- /dev/null +++ b/devtools/client/aboutdebugging/test/browser/resources/test-adb-extension/adb-extension-linux64.xpi diff --git a/devtools/client/aboutdebugging/test/browser/resources/test-adb-extension/adb-extension-mac64.xpi b/devtools/client/aboutdebugging/test/browser/resources/test-adb-extension/adb-extension-mac64.xpi Binary files differnew file mode 100644 index 0000000000..5af9bc963d --- /dev/null +++ b/devtools/client/aboutdebugging/test/browser/resources/test-adb-extension/adb-extension-mac64.xpi diff --git a/devtools/client/aboutdebugging/test/browser/resources/test-adb-extension/adb-extension-win32.xpi b/devtools/client/aboutdebugging/test/browser/resources/test-adb-extension/adb-extension-win32.xpi Binary files differnew file mode 100644 index 0000000000..0c10c8502c --- /dev/null +++ b/devtools/client/aboutdebugging/test/browser/resources/test-adb-extension/adb-extension-win32.xpi diff --git a/devtools/client/aboutdebugging/test/browser/resources/test-temporary-extension/manifest.json b/devtools/client/aboutdebugging/test/browser/resources/test-temporary-extension/manifest.json new file mode 100644 index 0000000000..c62b2ddbd6 --- /dev/null +++ b/devtools/client/aboutdebugging/test/browser/resources/test-temporary-extension/manifest.json @@ -0,0 +1,13 @@ +{ + "manifest_version": 2, + "name": "test-temporary-extension", + "version": "1.0", + "browser_specific_settings": { + "gecko": { + "id": "test-temporary-extension@mozilla.org" + } + }, + "background": { + "scripts": ["script.js"] + } +} diff --git a/devtools/client/aboutdebugging/test/browser/resources/test-temporary-extension/script.js b/devtools/client/aboutdebugging/test/browser/resources/test-temporary-extension/script.js new file mode 100644 index 0000000000..02d5604c3a --- /dev/null +++ b/devtools/client/aboutdebugging/test/browser/resources/test-temporary-extension/script.js @@ -0,0 +1,8 @@ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ + +/* eslint-env browser */ + +"use strict"; + +document.body.innerText = "Background Page Body Test Content"; |