blob: e8bb9fcce3cddce7d9ccd0d78fd12de4f4c18da2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
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);
}
|