www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | Submodules | README | LICENSE

commit eaf8d3696359dcea0edaa2fd9bc1e4cf5d985014
parent dd921f340c9c02fc8428da3660d9ea635d1fd0b1
Author: Dan Stillman <dstillman@zotero.org>
Date:   Fri, 17 Mar 2017 17:08:03 -0400

Adds a -debugger command-line flag to start the devtools server

Follow-up to https://github.com/zotero/zotero-standalone-build/commit/22cfe2404

The devtools must be included in the build by passing the -t flag to
build.sh in zotero-standalone-build.

After starting Zotero with the flag, connect from a Firefox instance
with remote debugging enabled by choosing "Connect…" from the Web
Developer menu and connecting to port 6100.

Diffstat:
Mcomponents/zotero-service.js | 27+++++++++++++++++++++++++++
1 file changed, 27 insertions(+), 0 deletions(-)

diff --git a/components/zotero-service.js b/components/zotero-service.js @@ -559,6 +559,33 @@ ZoteroCommandLineHandler.prototype = { } } + param = cmdLine.handleFlag("debugger", false); + if (param) { + 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"); + + if (!DebuggerServer.initialized) { + dump("Initializing devtools server\n"); + DebuggerServer.init(); + DebuggerServer.allowChromeProcess = true; + DebuggerServer.addBrowserActors(); + } + + let listener = DebuggerServer.createListener(); + listener.portOrPath = portOrPath; + listener.open(); + + dump("Debugger server started on " + portOrPath + "\n\n"); + } + catch (e) { + dump(e + "\n\n"); + Components.utils.reportError(e); + } + } + // In Fx49-based Mac Standalone, if Zotero is closed, an associated file is launched, and // Zotero hasn't been opened before, a -file parameter is passed and two main windows open. // Subsequent file openings when closed result in -url with file:// URLs (converted above)