diff options
Diffstat (limited to 'devtools/client/debugger/test/mochitest/addon-source')
22 files changed, 213 insertions, 0 deletions
diff --git a/devtools/client/debugger/test/mochitest/addon-source/browser_dbg_addon3/lib/main.js b/devtools/client/debugger/test/mochitest/addon-source/browser_dbg_addon3/lib/main.js new file mode 100644 index 000000000..fc00b60a1 --- /dev/null +++ b/devtools/client/debugger/test/mochitest/addon-source/browser_dbg_addon3/lib/main.js @@ -0,0 +1,13 @@ +var { Cc, Ci } = require("chrome"); +var { once } = require("sdk/system/events"); + +var observerService = Cc["@mozilla.org/observer-service;1"].getService(Ci.nsIObserverService); +var observer = { + observe: function () { + debugger; + } +}; + +once("sdk:loader:destroy", () => observerService.removeObserver(observer, "debuggerAttached")); + +observerService.addObserver(observer, "debuggerAttached", false); diff --git a/devtools/client/debugger/test/mochitest/addon-source/browser_dbg_addon3/package.json b/devtools/client/debugger/test/mochitest/addon-source/browser_dbg_addon3/package.json new file mode 100644 index 000000000..4bf1bed50 --- /dev/null +++ b/devtools/client/debugger/test/mochitest/addon-source/browser_dbg_addon3/package.json @@ -0,0 +1,9 @@ +{ + "name": "browser_dbg_addon3", + "title": "browser_dbg_addon3", + "id": "jid1-ami3akps3baaeg", + "description": "a basic add-on", + "author": "", + "license": "MPL 2.0", + "version": "0.1" +} diff --git a/devtools/client/debugger/test/mochitest/addon-source/browser_dbg_addon4/bootstrap.js b/devtools/client/debugger/test/mochitest/addon-source/browser_dbg_addon4/bootstrap.js new file mode 100644 index 000000000..e8bb9fcce --- /dev/null +++ b/devtools/client/debugger/test/mochitest/addon-source/browser_dbg_addon4/bootstrap.js @@ -0,0 +1,36 @@ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +var { interfaces: Ci, utils: Cu } = Components; + +function notify() { + // Log objects so makeDebuggeeValue can get the global to use + console.log({ msg: "Hello again" }); +} + +function startup(aParams, aReason) { + const { Services } = Cu.import("resource://gre/modules/Services.jsm", {}); + let res = Services.io.getProtocolHandler("resource") + .QueryInterface(Ci.nsIResProtocolHandler); + res.setSubstitution("browser_dbg_addon4", aParams.resourceURI); + + // Load a JS module + Cu.import("resource://browser_dbg_addon4/test.jsm"); // eslint-disable-line mozilla/no-single-arg-cu-import + // Log objects so makeDebuggeeValue can get the global to use + console.log({ msg: "Hello from the test add-on" }); + + Services.obs.addObserver(notify, "addon-test-ping", false); +} + +function shutdown(aParams, aReason) { + Services.obs.removeObserver(notify, "addon-test-ping"); + + // Unload the JS module + Cu.unload("resource://browser_dbg_addon4/test.jsm"); + + let res = Services.io.getProtocolHandler("resource") + .QueryInterface(Ci.nsIResProtocolHandler); + res.setSubstitution("browser_dbg_addon4", null); +} diff --git a/devtools/client/debugger/test/mochitest/addon-source/browser_dbg_addon4/chrome.manifest b/devtools/client/debugger/test/mochitest/addon-source/browser_dbg_addon4/chrome.manifest new file mode 100644 index 000000000..ccb88ddf1 --- /dev/null +++ b/devtools/client/debugger/test/mochitest/addon-source/browser_dbg_addon4/chrome.manifest @@ -0,0 +1 @@ +content browser_dbg_addon4 . diff --git a/devtools/client/debugger/test/mochitest/addon-source/browser_dbg_addon4/install.rdf b/devtools/client/debugger/test/mochitest/addon-source/browser_dbg_addon4/install.rdf new file mode 100644 index 000000000..45679ffc9 --- /dev/null +++ b/devtools/client/debugger/test/mochitest/addon-source/browser_dbg_addon4/install.rdf @@ -0,0 +1,19 @@ +<?xml version="1.0"?> + +<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:em="http://www.mozilla.org/2004/em-rdf#"> + + <Description about="urn:mozilla:install-manifest"> + <em:id>browser_dbg_addon4@tests.mozilla.org</em:id> + <em:version>1.0</em:version> + <em:name>Test add-on with JS Modules</em:name> + <em:bootstrap>true</em:bootstrap> + <em:targetApplication> + <Description> + <em:id>toolkit@mozilla.org</em:id> + <em:minVersion>0</em:minVersion> + <em:maxVersion>*</em:maxVersion> + </Description> + </em:targetApplication> + </Description> +</RDF> diff --git a/devtools/client/debugger/test/mochitest/addon-source/browser_dbg_addon4/test.jsm b/devtools/client/debugger/test/mochitest/addon-source/browser_dbg_addon4/test.jsm new file mode 100644 index 000000000..17bebfd8e --- /dev/null +++ b/devtools/client/debugger/test/mochitest/addon-source/browser_dbg_addon4/test.jsm @@ -0,0 +1,6 @@ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ + +const EXPORTED_SYMBOLS = ["Foo"]; + +const Foo = {}; diff --git a/devtools/client/debugger/test/mochitest/addon-source/browser_dbg_addon4/test.xul b/devtools/client/debugger/test/mochitest/addon-source/browser_dbg_addon4/test.xul new file mode 100644 index 000000000..733817ad8 --- /dev/null +++ b/devtools/client/debugger/test/mochitest/addon-source/browser_dbg_addon4/test.xul @@ -0,0 +1,8 @@ +<?xml version="1.0"?> + +<?xml-stylesheet href="chrome://global/skin/" type="text/css"?> + +<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> + <script type="text/javascript" src="testxul.js"/> + <label value="test.xul"/> +</window> diff --git a/devtools/client/debugger/test/mochitest/addon-source/browser_dbg_addon4/test2.jsm b/devtools/client/debugger/test/mochitest/addon-source/browser_dbg_addon4/test2.jsm new file mode 100644 index 000000000..703869f43 --- /dev/null +++ b/devtools/client/debugger/test/mochitest/addon-source/browser_dbg_addon4/test2.jsm @@ -0,0 +1,6 @@ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ + +const EXPORTED_SYMBOLS = ["Bar"]; + +const Bar = {}; diff --git a/devtools/client/debugger/test/mochitest/addon-source/browser_dbg_addon4/test2.xul b/devtools/client/debugger/test/mochitest/addon-source/browser_dbg_addon4/test2.xul new file mode 100644 index 000000000..372d05587 --- /dev/null +++ b/devtools/client/debugger/test/mochitest/addon-source/browser_dbg_addon4/test2.xul @@ -0,0 +1,8 @@ +<?xml version="1.0"?> + +<?xml-stylesheet href="chrome://global/skin/" type="text/css"?> + +<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> + <script type="text/javascript" src="testxul2.js"/> + <label value="test2.xul"/> +</window> diff --git a/devtools/client/debugger/test/mochitest/addon-source/browser_dbg_addon4/testxul.js b/devtools/client/debugger/test/mochitest/addon-source/browser_dbg_addon4/testxul.js new file mode 100644 index 000000000..30ad9d2f8 --- /dev/null +++ b/devtools/client/debugger/test/mochitest/addon-source/browser_dbg_addon4/testxul.js @@ -0,0 +1,4 @@ +// Define something in here or the script may get collected +window.addEventListener("unload", function () { + window.foo = "bar"; +}); diff --git a/devtools/client/debugger/test/mochitest/addon-source/browser_dbg_addon4/testxul2.js b/devtools/client/debugger/test/mochitest/addon-source/browser_dbg_addon4/testxul2.js new file mode 100644 index 000000000..30ad9d2f8 --- /dev/null +++ b/devtools/client/debugger/test/mochitest/addon-source/browser_dbg_addon4/testxul2.js @@ -0,0 +1,4 @@ +// Define something in here or the script may get collected +window.addEventListener("unload", function () { + window.foo = "bar"; +}); diff --git a/devtools/client/debugger/test/mochitest/addon-source/browser_dbg_addon5/bootstrap.js b/devtools/client/debugger/test/mochitest/addon-source/browser_dbg_addon5/bootstrap.js new file mode 100644 index 000000000..8edc53756 --- /dev/null +++ b/devtools/client/debugger/test/mochitest/addon-source/browser_dbg_addon5/bootstrap.js @@ -0,0 +1,23 @@ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ + +var { interfaces: Ci, classes: Cc } = Components; + +function startup(aParams, aReason) { + Components.utils.import("resource://gre/modules/Services.jsm"); + let res = Services.io.getProtocolHandler("resource") + .QueryInterface(Ci.nsIResProtocolHandler); + res.setSubstitution("browser_dbg_addon5", aParams.resourceURI); + + // Load a JS module + Components.utils.import("resource://browser_dbg_addon5/test.jsm"); +} + +function shutdown(aParams, aReason) { + // Unload the JS module + Components.utils.unload("resource://browser_dbg_addon5/test.jsm"); + + let res = Services.io.getProtocolHandler("resource") + .QueryInterface(Ci.nsIResProtocolHandler); + res.setSubstitution("browser_dbg_addon5", null); +} diff --git a/devtools/client/debugger/test/mochitest/addon-source/browser_dbg_addon5/chrome.manifest b/devtools/client/debugger/test/mochitest/addon-source/browser_dbg_addon5/chrome.manifest new file mode 100644 index 000000000..ceef8d06d --- /dev/null +++ b/devtools/client/debugger/test/mochitest/addon-source/browser_dbg_addon5/chrome.manifest @@ -0,0 +1 @@ +content browser_dbg_addon5 . diff --git a/devtools/client/debugger/test/mochitest/addon-source/browser_dbg_addon5/install.rdf b/devtools/client/debugger/test/mochitest/addon-source/browser_dbg_addon5/install.rdf new file mode 100644 index 000000000..af2cbbb5d --- /dev/null +++ b/devtools/client/debugger/test/mochitest/addon-source/browser_dbg_addon5/install.rdf @@ -0,0 +1,20 @@ +<?xml version="1.0"?> + +<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:em="http://www.mozilla.org/2004/em-rdf#"> + + <Description about="urn:mozilla:install-manifest"> + <em:id>browser_dbg_addon5@tests.mozilla.org</em:id> + <em:version>1.0</em:version> + <em:name>Test unpacked add-on with JS Modules</em:name> + <em:bootstrap>true</em:bootstrap> + <em:unpack>true</em:unpack> + <em:targetApplication> + <Description> + <em:id>toolkit@mozilla.org</em:id> + <em:minVersion>0</em:minVersion> + <em:maxVersion>*</em:maxVersion> + </Description> + </em:targetApplication> + </Description> +</RDF> diff --git a/devtools/client/debugger/test/mochitest/addon-source/browser_dbg_addon5/test.jsm b/devtools/client/debugger/test/mochitest/addon-source/browser_dbg_addon5/test.jsm new file mode 100644 index 000000000..17bebfd8e --- /dev/null +++ b/devtools/client/debugger/test/mochitest/addon-source/browser_dbg_addon5/test.jsm @@ -0,0 +1,6 @@ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ + +const EXPORTED_SYMBOLS = ["Foo"]; + +const Foo = {}; diff --git a/devtools/client/debugger/test/mochitest/addon-source/browser_dbg_addon5/test.xul b/devtools/client/debugger/test/mochitest/addon-source/browser_dbg_addon5/test.xul new file mode 100644 index 000000000..733817ad8 --- /dev/null +++ b/devtools/client/debugger/test/mochitest/addon-source/browser_dbg_addon5/test.xul @@ -0,0 +1,8 @@ +<?xml version="1.0"?> + +<?xml-stylesheet href="chrome://global/skin/" type="text/css"?> + +<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> + <script type="text/javascript" src="testxul.js"/> + <label value="test.xul"/> +</window> diff --git a/devtools/client/debugger/test/mochitest/addon-source/browser_dbg_addon5/test2.jsm b/devtools/client/debugger/test/mochitest/addon-source/browser_dbg_addon5/test2.jsm new file mode 100644 index 000000000..703869f43 --- /dev/null +++ b/devtools/client/debugger/test/mochitest/addon-source/browser_dbg_addon5/test2.jsm @@ -0,0 +1,6 @@ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ + +const EXPORTED_SYMBOLS = ["Bar"]; + +const Bar = {}; diff --git a/devtools/client/debugger/test/mochitest/addon-source/browser_dbg_addon5/test2.xul b/devtools/client/debugger/test/mochitest/addon-source/browser_dbg_addon5/test2.xul new file mode 100644 index 000000000..372d05587 --- /dev/null +++ b/devtools/client/debugger/test/mochitest/addon-source/browser_dbg_addon5/test2.xul @@ -0,0 +1,8 @@ +<?xml version="1.0"?> + +<?xml-stylesheet href="chrome://global/skin/" type="text/css"?> + +<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> + <script type="text/javascript" src="testxul2.js"/> + <label value="test2.xul"/> +</window> diff --git a/devtools/client/debugger/test/mochitest/addon-source/browser_dbg_addon5/testxul.js b/devtools/client/debugger/test/mochitest/addon-source/browser_dbg_addon5/testxul.js new file mode 100644 index 000000000..30ad9d2f8 --- /dev/null +++ b/devtools/client/debugger/test/mochitest/addon-source/browser_dbg_addon5/testxul.js @@ -0,0 +1,4 @@ +// Define something in here or the script may get collected +window.addEventListener("unload", function () { + window.foo = "bar"; +}); diff --git a/devtools/client/debugger/test/mochitest/addon-source/browser_dbg_addon5/testxul2.js b/devtools/client/debugger/test/mochitest/addon-source/browser_dbg_addon5/testxul2.js new file mode 100644 index 000000000..30ad9d2f8 --- /dev/null +++ b/devtools/client/debugger/test/mochitest/addon-source/browser_dbg_addon5/testxul2.js @@ -0,0 +1,4 @@ +// Define something in here or the script may get collected +window.addEventListener("unload", function () { + window.foo = "bar"; +}); diff --git a/devtools/client/debugger/test/mochitest/addon-source/browser_dbg_addon_webext_contentscript/manifest.json b/devtools/client/debugger/test/mochitest/addon-source/browser_dbg_addon_webext_contentscript/manifest.json new file mode 100644 index 000000000..ebc834bf7 --- /dev/null +++ b/devtools/client/debugger/test/mochitest/addon-source/browser_dbg_addon_webext_contentscript/manifest.json @@ -0,0 +1,18 @@ +{ + "manifest_version": 2, + "name": "test content script sources", + "description": "test content script sources", + "version": "0.1.0", + "applications": { + "gecko": { + "id": "test-contentscript-sources@mozilla.com" + } + }, + "content_scripts": [ + { + "matches": ["<all_urls>"], + "js": ["webext-content-script.js"], + "run_at": "document_start" + } + ] +} diff --git a/devtools/client/debugger/test/mochitest/addon-source/browser_dbg_addon_webext_contentscript/webext-content-script.js b/devtools/client/debugger/test/mochitest/addon-source/browser_dbg_addon_webext_contentscript/webext-content-script.js new file mode 100644 index 000000000..591c78840 --- /dev/null +++ b/devtools/client/debugger/test/mochitest/addon-source/browser_dbg_addon_webext_contentscript/webext-content-script.js @@ -0,0 +1 @@ +console.log("CONTENT SCRIPT LOADED"); |