fune/devtools/startup/aboutdebugging-registration.js
Daisuke Akatsuka 6db8153aa8 Bug 1471795 - Part 1: Implement basis of 'This Firefox' page. r=jdescottes,ladybenko
In this patch, implement following basic things of 'ThisFirefox' page for new
about:debugging.

* Add a pref devtools.aboutdebbugging.enabled-new to enable new about:debbugging.
* Add a function which switches new/old about:debugging page by the pref.
* Add devtools/client/aboutdebugging-new directory for new about:debugging.
* Add basic html, css, JavaScript and React component.

MozReview-Commit-ID: 5DtV7rRcS0S

--HG--
extra : rebase_source : 26496ef8273c03b78a7b8d00f44beac5f18d09ef
2018-07-26 17:52:10 +09:00

45 lines
1.6 KiB
JavaScript

/* 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 the about:debugging URL, that allows to debug various targets such as addons,
// workers and tabs by launching a dedicated DevTools toolbox for the selected target.
// If DevTools are not installed, this about page will display a shim landing page
// encouraging the user to download and install DevTools.
const { XPCOMUtils } = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm", {});
const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm", {});
const { nsIAboutModule } = Ci;
function AboutDebugging() {}
AboutDebugging.prototype = {
classDescription: "about:debugging",
classID: Components.ID("1060afaf-dc9e-43da-8646-23a2faf48493"),
contractID: "@mozilla.org/network/protocol/about;1?what=debugging",
QueryInterface: ChromeUtils.generateQI([nsIAboutModule]),
newChannel: function(_, loadInfo) {
const uri = Services.prefs.getBoolPref("devtools.aboutdebugging.new-enabled")
? "chrome://devtools/content/aboutdebugging-new/index.html"
: "chrome://devtools/content/aboutdebugging/aboutdebugging.xhtml";
const chan = Services.io.newChannelFromURIWithLoadInfo(
Services.io.newURI(uri),
loadInfo
);
chan.owner = Services.scriptSecurityManager.getSystemPrincipal();
return chan;
},
getURIFlags: function(uri) {
return nsIAboutModule.ALLOW_SCRIPT;
}
};
this.NSGetFactory = XPCOMUtils.generateNSGetFactory([
AboutDebugging
]);