2012-11-30 08:07:59 +00:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
|
|
|
"use strict";
|
|
|
|
|
2015-04-23 09:24:49 +00:00
|
|
|
const { Cu } = require("chrome");
|
2013-04-11 20:59:08 +00:00
|
|
|
Cu.import("resource://gre/modules/Services.jsm");
|
2015-10-13 23:18:43 +00:00
|
|
|
const { gDevTools } = require("resource://devtools/client/framework/gDevTools.jsm");
|
2015-04-23 09:24:49 +00:00
|
|
|
|
2015-09-21 17:04:18 +00:00
|
|
|
const { defaultTools, defaultThemes } = require("devtools/client/definitions");
|
2015-04-23 09:24:49 +00:00
|
|
|
|
|
|
|
defaultTools.forEach(definition => gDevTools.registerTool(definition));
|
|
|
|
defaultThemes.forEach(definition => gDevTools.registerTheme(definition));
|
|
|
|
|
|
|
|
// Re-export for backwards compatibility, but we should probably the
|
2015-09-21 17:04:18 +00:00
|
|
|
// definitions from require("devtools/client/definitions") in the future
|
|
|
|
exports.defaultTools = require("devtools/client/definitions").defaultTools;
|
|
|
|
exports.defaultThemes = require("devtools/client/definitions").defaultThemes;
|
|
|
|
exports.Tools = require("devtools/client/definitions").Tools;
|
2012-11-30 08:07:59 +00:00
|
|
|
|
2013-04-11 20:59:08 +00:00
|
|
|
Object.defineProperty(exports, "Toolbox", {
|
2015-09-21 17:04:18 +00:00
|
|
|
get: () => require("devtools/client/framework/toolbox").Toolbox
|
2013-04-11 20:59:08 +00:00
|
|
|
});
|
|
|
|
Object.defineProperty(exports, "TargetFactory", {
|
2015-09-21 17:04:18 +00:00
|
|
|
get: () => require("devtools/client/framework/target").TargetFactory
|
2013-04-11 20:59:08 +00:00
|
|
|
});
|
2012-12-13 22:17:00 +00:00
|
|
|
|
2015-04-23 09:24:49 +00:00
|
|
|
const unloadObserver = {
|
2013-04-11 20:59:08 +00:00
|
|
|
observe: function(subject, topic, data) {
|
|
|
|
if (subject.wrappedJSObject === require("@loader/unload")) {
|
|
|
|
Services.obs.removeObserver(unloadObserver, "sdk:loader:destroy");
|
2013-05-04 06:31:07 +00:00
|
|
|
for (let definition of gDevTools.getToolDefinitionArray()) {
|
2013-04-11 20:59:08 +00:00
|
|
|
gDevTools.unregisterTool(definition.id);
|
|
|
|
}
|
2014-08-18 12:25:14 +00:00
|
|
|
for (let definition of gDevTools.getThemeDefinitionArray()) {
|
|
|
|
gDevTools.unregisterTheme(definition.id);
|
|
|
|
}
|
2013-04-11 20:59:08 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
Services.obs.addObserver(unloadObserver, "sdk:loader:destroy", false);
|
|
|
|
|
2015-04-23 09:24:49 +00:00
|
|
|
const events = require("sdk/system/events");
|
2013-08-03 10:29:48 +00:00
|
|
|
events.emit("devtools-loaded", {});
|