Bug 1363327 - register about:debugging via manifest
MozReview-Commit-ID: Ec7yRRyTITo
--- a/devtools/moz.build
+++ b/devtools/moz.build
@@ -13,16 +13,21 @@ if CONFIG['MOZ_DEVTOOLS'] == 'all':
]
DIRS += [
'server',
'shared',
'shim',
]
+EXTRA_COMPONENTS += [
+ 'shim/aboutdebugging-registration.js',
+ 'shim/aboutdebugging.manifest',
+]
+
# /browser uses DIST_SUBDIR. We opt-in to this treatment when building
# DevTools for the browser to keep the root omni.ja slim for use by external XUL
# apps. Mulet also uses this since it includes /browser.
if CONFIG['MOZ_BUILD_APP'] == 'browser':
DIST_SUBDIR = 'browser'
export('DIST_SUBDIR')
with Files('**'):
new file mode 100644
--- /dev/null
+++ b/devtools/shim/aboutdebugging-registration.js
@@ -0,0 +1,43 @@
+/* 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";
+
+// Register about:devtools-toolbox which allows to open a devtools toolbox
+// in a Firefox tab or a custom html iframe in browser.html
+const Ci = Components.interfaces;
+const Cu = Components.utils;
+
+const { XPCOMUtils } = Cu.import("resource://gre/modules/XPCOMUtils.jsm", {});
+const { Services } = Cu.import("resource://gre/modules/Services.jsm", {});
+
+const { nsIAboutModule } = Ci;
+
+function AboutDebugging() {}
+
+AboutDebugging.prototype = {
+ uri: Services.io.newURI("chrome://devtools/content/aboutdebugging/aboutdebugging.xhtml"),
+ classDescription: "about:debugging",
+ classID: Components.ID("1060afaf-dc9e-43da-8646-23a2faf48493"),
+ contractID: "@mozilla.org/network/protocol/about;1?what=debugging",
+
+ QueryInterface: XPCOMUtils.generateQI([nsIAboutModule]),
+
+ newChannel: function (uri, loadInfo) {
+ let chan = Services.io.newChannelFromURIWithLoadInfo(
+ this.uri,
+ loadInfo
+ );
+ chan.owner = Services.scriptSecurityManager.getSystemPrincipal();
+ return chan;
+ },
+
+ getURIFlags: function (uri) {
+ return nsIAboutModule.ALLOW_SCRIPT || nsIAboutModule.ENABLE_INDEXED_DB;
+ }
+};
+
+this.NSGetFactory = XPCOMUtils.generateNSGetFactory([
+ AboutDebugging
+]);
new file mode 100644
--- /dev/null
+++ b/devtools/shim/aboutdebugging.manifest
@@ -0,0 +1,2 @@
+component {1060afaf-dc9e-43da-8646-23a2faf48493} aboutdebugging-registration.js
+contract @mozilla.org/network/protocol/about;1?what=debugging {1060afaf-dc9e-43da-8646-23a2faf48493}
\ No newline at end of file