mirror of
https://github.com/HeyPuter/firefox.git
synced 2026-11-28 04:39:07 -10:00
Tags: #secure-revision Differential Revision: https://phabricator.services.mozilla.com/D3031
69 lines
2.0 KiB
JavaScript
69 lines
2.0 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";
|
|
|
|
const { BrowserLoader } =
|
|
ChromeUtils.import("resource://devtools/client/shared/browser-loader.js", {});
|
|
const { require } = BrowserLoader({
|
|
baseURI: "resource://devtools/client/aboutdebugging-new/",
|
|
window,
|
|
});
|
|
const Services = require("Services");
|
|
|
|
const { bindActionCreators } = require("devtools/client/shared/vendor/redux");
|
|
const { createFactory } =
|
|
require("devtools/client/shared/vendor/react");
|
|
const { render, unmountComponentAtNode } =
|
|
require("devtools/client/shared/vendor/react-dom");
|
|
const Provider =
|
|
createFactory(require("devtools/client/shared/vendor/react-redux").Provider);
|
|
|
|
const actions = require("./src/actions/index");
|
|
const { configureStore } = require("./src/create-store");
|
|
const {
|
|
addNetworkLocationsObserver,
|
|
getNetworkLocations,
|
|
} = require("./src/modules/network-locations");
|
|
|
|
const App = createFactory(require("./src/components/App"));
|
|
|
|
const { PAGES } = require("./src/constants");
|
|
|
|
const AboutDebugging = {
|
|
init() {
|
|
if (!Services.prefs.getBoolPref("devtools.enabled", true)) {
|
|
// If DevTools are disabled, navigate to about:devtools.
|
|
window.location = "about:devtools?reason=AboutDebugging";
|
|
return;
|
|
}
|
|
|
|
this.store = configureStore();
|
|
this.actions = bindActionCreators(actions, this.store.dispatch);
|
|
|
|
render(Provider({ store: this.store }, App()), this.mount);
|
|
|
|
this.actions.selectPage(PAGES.THIS_FIREFOX);
|
|
addNetworkLocationsObserver(() => {
|
|
this.actions.updateNetworkLocations(getNetworkLocations());
|
|
});
|
|
},
|
|
|
|
destroy() {
|
|
unmountComponentAtNode(this.mount);
|
|
},
|
|
|
|
get mount() {
|
|
return document.getElementById("mount");
|
|
},
|
|
};
|
|
|
|
window.addEventListener("DOMContentLoaded", () => {
|
|
AboutDebugging.init();
|
|
}, { once: true });
|
|
|
|
window.addEventListener("unload", () => {
|
|
AboutDebugging.destroy();
|
|
}, {once: true});
|