fx-compat: Update devtools server loading
This commit is contained in:
parent
1bb99a6bc8
commit
3454705825
1 changed files with 20 additions and 12 deletions
|
@ -487,7 +487,7 @@ function isLinux() {
|
|||
function ZoteroCommandLineHandler() {}
|
||||
ZoteroCommandLineHandler.prototype = {
|
||||
/* nsICommandLineHandler */
|
||||
handle : function(cmdLine) {
|
||||
handle: async function (cmdLine) {
|
||||
// Force debug output to window
|
||||
if (cmdLine.handleFlag("ZoteroDebug", false)) {
|
||||
zInitOptions.forceDebugLog = 2;
|
||||
|
@ -575,21 +575,29 @@ ZoteroCommandLineHandler.prototype = {
|
|||
try {
|
||||
let portOrPath = Services.prefs.getBranch('').getIntPref('devtools.debugger.remote-port');
|
||||
|
||||
const { devtools } = Components.utils.import("resource://devtools/shared/Loader.jsm", {});
|
||||
const { DebuggerServer } = devtools.require("devtools/server/main");
|
||||
const { DevToolsLoader } = ChromeUtils.import(
|
||||
"resource://devtools/shared/loader/Loader.jsm"
|
||||
);
|
||||
const loader = new DevToolsLoader();
|
||||
const { DevToolsServer } = loader.require("devtools/server/devtools-server");
|
||||
const { SocketListener } = loader.require("devtools/shared/security/socket");
|
||||
|
||||
if (!DebuggerServer.initialized) {
|
||||
dump("Initializing devtools server\n");
|
||||
DebuggerServer.init();
|
||||
DebuggerServer.registerAllActors();
|
||||
DebuggerServer.allowChromeProcess = true;
|
||||
if (DevToolsServer.initialized) {
|
||||
dump("Debugger server already initialized\n\n");
|
||||
return;
|
||||
}
|
||||
|
||||
let listener = DebuggerServer.createListener();
|
||||
listener.portOrPath = portOrPath;
|
||||
listener.open();
|
||||
DevToolsServer.init();
|
||||
DevToolsServer.registerAllActors();
|
||||
DevToolsServer.allowChromeProcess = true;
|
||||
const socketOptions = { portOrPath };
|
||||
const listener = new SocketListener(DevToolsServer, socketOptions);
|
||||
await listener.open();
|
||||
if (!DevToolsServer.listeningSockets) {
|
||||
throw new Error("No listening sockets");
|
||||
}
|
||||
|
||||
dump("Debugger server started on " + portOrPath + "\n\n");
|
||||
dump(`Debugger server started on ${portOrPath}\n\n`);
|
||||
}
|
||||
catch (e) {
|
||||
dump(e + "\n\n");
|
||||
|
|
Loading…
Reference in a new issue