mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-22 01:35:35 +00:00
92392b47b7
This changeset adds basic remote connection functionality to about:debugging. About:debugging can target a remote firefox instance if the host and port parameters are passed as URL search params. The feature is not explicitly exposed at the moment and there is no UI to connect an instance, and no UI feedback when connected to a remote instance. When connected, about:debugging should correctly list tabs, workers and addons for the target instance of Firefox. Debugging features work for all supported targets. Known limitations: - preferences are read from the local Firefox instance (multiprocess, addon debugging etc...). At the moment the remote instance must be manually correctly configured MozReview-Commit-ID: DOekSCb96XC --HG-- extra : rebase_source : 89b73e885e50bfba4e1888f8791f637a5ba05ca7 extra : intermediate-source : 840e23f2a496e2cec280643fef127095bd67d518 extra : source : 6cc5cc4494e67ae9dd7371420710c3f8afe5b256
67 lines
1.9 KiB
JavaScript
67 lines
1.9 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/. */
|
|
|
|
/* eslint-env browser */
|
|
/* globals Telemetry */
|
|
|
|
"use strict";
|
|
|
|
const { loader } = Components.utils.import(
|
|
"resource://devtools/shared/Loader.jsm", {});
|
|
const { BrowserLoader } = Components.utils.import(
|
|
"resource://devtools/client/shared/browser-loader.js", {});
|
|
const { Services } = Components.utils.import(
|
|
"resource://gre/modules/Services.jsm", {});
|
|
|
|
loader.lazyRequireGetter(this, "Telemetry",
|
|
"devtools/client/shared/telemetry");
|
|
|
|
const { require } = BrowserLoader({
|
|
baseURI: "resource://devtools/client/aboutdebugging/",
|
|
window
|
|
});
|
|
|
|
const { createFactory } = require("devtools/client/shared/vendor/react");
|
|
const { render, unmountComponentAtNode } = require("devtools/client/shared/vendor/react-dom");
|
|
|
|
const AboutDebuggingApp = createFactory(require("./components/Aboutdebugging"));
|
|
const { createClient } = require("./modules/connect");
|
|
|
|
var AboutDebugging = {
|
|
async init() {
|
|
if (!Services.prefs.getBoolPref("devtools.enabled", true)) {
|
|
// If DevTools are disabled, navigate to about:devtools.
|
|
window.location = "about:devtools?reason=AboutDebugging";
|
|
return;
|
|
}
|
|
|
|
let {connect, client} = await createClient();
|
|
|
|
this.client = client;
|
|
await this.client.connect();
|
|
|
|
let telemetry = new Telemetry();
|
|
|
|
render(AboutDebuggingApp({ client, connect, telemetry }),
|
|
document.querySelector("#body"));
|
|
},
|
|
|
|
destroy() {
|
|
unmountComponentAtNode(document.querySelector("#body"));
|
|
|
|
if (this.client) {
|
|
this.client.close();
|
|
this.client = null;
|
|
}
|
|
},
|
|
};
|
|
|
|
window.addEventListener("DOMContentLoaded", function () {
|
|
AboutDebugging.init();
|
|
}, {once: true});
|
|
|
|
window.addEventListener("unload", function () {
|
|
AboutDebugging.destroy();
|
|
}, {once: true});
|