mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 895471 - part 0: add a browser debugger flag, r=past
This commit is contained in:
parent
e525fd9441
commit
e10abe8dee
@ -3,17 +3,29 @@
|
|||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
const { classes: Cc, interfaces: Ci, utils: Cu } = Components;
|
const { classes: Cc, interfaces: Ci, utils: Cu } = Components;
|
||||||
|
const kDebuggerPrefs = [
|
||||||
|
"devtools.debugger.remote-enabled",
|
||||||
|
"devtools.debugger.chrome-enabled",
|
||||||
|
"devtools.chrome.enabled"
|
||||||
|
];
|
||||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||||
|
XPCOMUtils.defineLazyModuleGetter(this, "Services", "resource://gre/modules/Services.jsm");
|
||||||
|
|
||||||
function devtoolsCommandlineHandler() {
|
function devtoolsCommandlineHandler() {
|
||||||
}
|
}
|
||||||
devtoolsCommandlineHandler.prototype = {
|
devtoolsCommandlineHandler.prototype = {
|
||||||
handle: function(cmdLine) {
|
handle: function(cmdLine) {
|
||||||
if (!cmdLine.handleFlag("jsconsole", false)) {
|
let consoleFlag = cmdLine.handleFlag("jsconsole", false);
|
||||||
return;
|
let debuggerFlag = cmdLine.handleFlag("jsdebugger", false);
|
||||||
|
if (consoleFlag) {
|
||||||
|
this.handleConsoleFlag(cmdLine);
|
||||||
}
|
}
|
||||||
|
if (debuggerFlag) {
|
||||||
|
this.handleDebuggerFlag(cmdLine);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
Cu.import("resource://gre/modules/Services.jsm");
|
handleConsoleFlag: function(cmdLine) {
|
||||||
let window = Services.wm.getMostRecentWindow("devtools:webconsole");
|
let window = Services.wm.getMostRecentWindow("devtools:webconsole");
|
||||||
if (!window) {
|
if (!window) {
|
||||||
let devtools = Cu.import("resource://gre/modules/devtools/Loader.jsm", {}).devtools;
|
let devtools = Cu.import("resource://gre/modules/devtools/Loader.jsm", {}).devtools;
|
||||||
@ -31,7 +43,32 @@ devtoolsCommandlineHandler.prototype = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
helpInfo : " -jsconsole Open the Browser Console.\n",
|
handleDebuggerFlag: function(cmdLine) {
|
||||||
|
let remoteDebuggingEnabled = false;
|
||||||
|
try {
|
||||||
|
remoteDebuggingEnabled = kDebuggerPrefs.every((pref) => Services.prefs.getBoolPref(pref));
|
||||||
|
} catch (ex) {
|
||||||
|
Cu.reportError(ex);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (remoteDebuggingEnabled) {
|
||||||
|
Cu.import("resource:///modules/devtools/DebuggerProcess.jsm");
|
||||||
|
BrowserDebuggerProcess.init();
|
||||||
|
} else {
|
||||||
|
let errorMsg = "Could not run chrome debugger! You need the following prefs " +
|
||||||
|
"to be set to true: " + kDebuggerPrefs.join(", ");
|
||||||
|
Cu.reportError(errorMsg);
|
||||||
|
// Dump as well, as we're doing this from a commandline, make sure people don't miss it:
|
||||||
|
dump(errorMsg + "\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cmdLine.state == Ci.nsICommandLine.STATE_REMOTE_AUTO) {
|
||||||
|
cmdLine.preventDefault = true;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
helpInfo : " -jsconsole Open the Browser Console.\n" +
|
||||||
|
" -jsdebugger Open the Browser Debugger.\n",
|
||||||
|
|
||||||
classID: Components.ID("{9e9a9283-0ce9-4e4a-8f1c-ba129a032c32}"),
|
classID: Components.ID("{9e9a9283-0ce9-4e4a-8f1c-ba129a032c32}"),
|
||||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsICommandLineHandler]),
|
QueryInterface: XPCOMUtils.generateQI([Ci.nsICommandLineHandler]),
|
||||||
|
Loading…
Reference in New Issue
Block a user