mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
797c29b92e
--HG-- rename : browser/devtools/commandline/Commands.jsm => browser/devtools/commandline/GcliCommands.jsm rename : browser/devtools/commandline/CmdCookie.jsm => browser/devtools/commandline/GcliCookieCommands.jsm rename : browser/devtools/tilt/CmdTilt.jsm => browser/devtools/commandline/GcliTiltCommands.jsm rename : browser/devtools/commandline/commandline.css => browser/devtools/commandline/gcli.css rename : browser/devtools/commandline/commandlineoutput.xhtml => browser/devtools/commandline/gclioutput.xhtml rename : browser/devtools/commandline/commandlinetooltip.xhtml => browser/devtools/commandline/gclitooltip.xhtml rename : browser/devtools/commandline/test/browser_cmd_addon.js => browser/devtools/commandline/test/browser_gcli_addon.js rename : browser/devtools/commandline/test/browser_dbg_cmd_break.html => browser/devtools/commandline/test/browser_gcli_break.html rename : browser/devtools/commandline/test/browser_dbg_cmd_break.js => browser/devtools/commandline/test/browser_gcli_break.js rename : browser/devtools/commandline/test/browser_cmd_calllog.js => browser/devtools/commandline/test/browser_gcli_calllog.js rename : browser/devtools/commandline/test/browser_cmd_commands.js => browser/devtools/commandline/test/browser_gcli_commands.js rename : browser/devtools/commandline/test/browser_cmd_cookie.js => browser/devtools/commandline/test/browser_gcli_cookie.js rename : browser/devtools/commandline/test/browser_dbg_cmd.js => browser/devtools/commandline/test/browser_gcli_dbg.js rename : browser/devtools/styleeditor/test/browser_styleeditor_cmd_edit.js => browser/devtools/commandline/test/browser_gcli_edit.js rename : browser/devtools/commandline/test/browser_cmd_pagemod_export.html => browser/devtools/commandline/test/browser_gcli_inspect.html rename : browser/devtools/highlighter/test/browser_inspector_cmd_inspect.js => browser/devtools/commandline/test/browser_gcli_inspect.js rename : browser/devtools/commandline/test/browser_cmd_integrate.js => browser/devtools/commandline/test/browser_gcli_integrate.js rename : browser/devtools/commandline/test/browser_cmd_jsb.js => browser/devtools/commandline/test/browser_gcli_jsb.js rename : browser/devtools/commandline/test/browser_cmd_pagemod_export.js => browser/devtools/commandline/test/browser_gcli_pagemod_export.js rename : browser/devtools/commandline/test/browser_cmd_pref.js => browser/devtools/commandline/test/browser_gcli_pref.js rename : browser/devtools/responsivedesign/test/browser_responsive_cmd.js => browser/devtools/commandline/test/browser_gcli_responsivemode.js rename : browser/devtools/commandline/test/browser_cmd_restart.js => browser/devtools/commandline/test/browser_gcli_restart.js rename : browser/devtools/commandline/test/browser_cmd_settings.js => browser/devtools/commandline/test/browser_gcli_settings.js rename : browser/devtools/styleeditor/test/browser_styleeditor_cmd_edit.html => browser/devtools/commandline/test/resources.html rename : browser/devtools/commandline/test/browser_dbg_cmd.html => browser/devtools/commandline/test/resources_dbg.html rename : browser/devtools/styleeditor/test/resources_inpage.jsi => browser/devtools/commandline/test/resources_inpage.js rename : browser/devtools/styleeditor/test/resources_inpage1.css => browser/devtools/commandline/test/resources_inpage1.css rename : browser/devtools/styleeditor/test/resources_inpage2.css => browser/devtools/commandline/test/resources_inpage2.css rename : browser/devtools/commandline/test/browser_cmd_jsb_script.jsi => browser/devtools/commandline/test/resources_jsb_script.js rename : browser/themes/gnomestripe/devtools/commandline.css => browser/themes/gnomestripe/devtools/gcli.css rename : browser/themes/pinstripe/devtools/commandline.css => browser/themes/pinstripe/devtools/gcli.css rename : browser/themes/winstripe/devtools/commandline.css => browser/themes/winstripe/devtools/gcli.css
171 lines
4.4 KiB
JavaScript
171 lines
4.4 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/. */
|
|
|
|
const { classes: Cc, interfaces: Ci, utils: Cu } = Components;
|
|
|
|
let EXPORTED_SYMBOLS = [ ];
|
|
|
|
Cu.import("resource:///modules/devtools/gcli.jsm");
|
|
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
|
|
|
XPCOMUtils.defineLazyModuleGetter(this, "HUDService",
|
|
"resource:///modules/HUDService.jsm");
|
|
|
|
/**
|
|
* 'break' command
|
|
*/
|
|
gcli.addCommand({
|
|
name: "break",
|
|
description: gcli.lookup("breakDesc"),
|
|
manual: gcli.lookup("breakManual")
|
|
});
|
|
|
|
|
|
/**
|
|
* 'break list' command
|
|
*/
|
|
gcli.addCommand({
|
|
name: "break list",
|
|
description: gcli.lookup("breaklistDesc"),
|
|
returnType: "html",
|
|
exec: function(args, context) {
|
|
let win = HUDService.currentContext();
|
|
let dbg = win.DebuggerUI.getDebugger();
|
|
if (!dbg) {
|
|
return gcli.lookup("breakaddDebuggerStopped");
|
|
}
|
|
let breakpoints = dbg.breakpoints;
|
|
|
|
if (Object.keys(breakpoints).length === 0) {
|
|
return gcli.lookup("breaklistNone");
|
|
}
|
|
|
|
let reply = gcli.lookup("breaklistIntro");
|
|
reply += "<ol>";
|
|
for each (let breakpoint in breakpoints) {
|
|
let text = gcli.lookupFormat("breaklistLineEntry",
|
|
[breakpoint.location.url,
|
|
breakpoint.location.line]);
|
|
reply += "<li>" + text + "</li>";
|
|
};
|
|
reply += "</ol>";
|
|
return reply;
|
|
}
|
|
});
|
|
|
|
|
|
/**
|
|
* 'break add' command
|
|
*/
|
|
gcli.addCommand({
|
|
name: "break add",
|
|
description: gcli.lookup("breakaddDesc"),
|
|
manual: gcli.lookup("breakaddManual")
|
|
});
|
|
|
|
/**
|
|
* 'break add line' command
|
|
*/
|
|
gcli.addCommand({
|
|
name: "break add line",
|
|
description: gcli.lookup("breakaddlineDesc"),
|
|
params: [
|
|
{
|
|
name: "file",
|
|
type: {
|
|
name: "selection",
|
|
data: function() {
|
|
let win = HUDService.currentContext();
|
|
let dbg = win.DebuggerUI.getDebugger();
|
|
let files = [];
|
|
if (dbg) {
|
|
let scriptsView = dbg.contentWindow.DebuggerView.Scripts;
|
|
for each (let script in scriptsView.scriptLocations) {
|
|
files.push(script);
|
|
}
|
|
}
|
|
return files;
|
|
}
|
|
},
|
|
description: gcli.lookup("breakaddlineFileDesc")
|
|
},
|
|
{
|
|
name: "line",
|
|
type: { name: "number", min: 1, step: 10 },
|
|
description: gcli.lookup("breakaddlineLineDesc")
|
|
}
|
|
],
|
|
returnType: "html",
|
|
exec: function(args, context) {
|
|
args.type = "line";
|
|
let win = HUDService.currentContext();
|
|
let dbg = win.DebuggerUI.getDebugger();
|
|
if (!dbg) {
|
|
return gcli.lookup("breakaddDebuggerStopped");
|
|
}
|
|
var promise = context.createPromise();
|
|
let position = { url: args.file, line: args.line };
|
|
dbg.addBreakpoint(position, function(aBreakpoint, aError) {
|
|
if (aError) {
|
|
promise.resolve(gcli.lookupFormat("breakaddFailed", [aError]));
|
|
return;
|
|
}
|
|
promise.resolve(gcli.lookup("breakaddAdded"));
|
|
});
|
|
return promise;
|
|
}
|
|
});
|
|
|
|
|
|
/**
|
|
* 'break del' command
|
|
*/
|
|
gcli.addCommand({
|
|
name: "break del",
|
|
description: gcli.lookup("breakdelDesc"),
|
|
params: [
|
|
{
|
|
name: "breakid",
|
|
type: {
|
|
name: "number",
|
|
min: 0,
|
|
max: function() {
|
|
let win = HUDService.currentContext();
|
|
let dbg = win.DebuggerUI.getDebugger();
|
|
if (!dbg) {
|
|
return gcli.lookup("breakaddDebuggerStopped");
|
|
}
|
|
return Object.keys(dbg.breakpoints).length - 1;
|
|
},
|
|
},
|
|
description: gcli.lookup("breakdelBreakidDesc")
|
|
}
|
|
],
|
|
returnType: "html",
|
|
exec: function(args, context) {
|
|
let win = HUDService.currentContext();
|
|
let dbg = win.DebuggerUI.getDebugger();
|
|
if (!dbg) {
|
|
return gcli.lookup("breakaddDebuggerStopped");
|
|
}
|
|
|
|
let breakpoints = dbg.breakpoints;
|
|
let id = Object.keys(dbg.breakpoints)[args.breakid];
|
|
if (!id || !(id in breakpoints)) {
|
|
return gcli.lookup("breakNotFound");
|
|
}
|
|
|
|
let promise = context.createPromise();
|
|
try {
|
|
dbg.removeBreakpoint(breakpoints[id], function() {
|
|
promise.resolve(gcli.lookup("breakdelRemoved"));
|
|
});
|
|
} catch (ex) {
|
|
// If the debugger has been closed already, don't scare the user.
|
|
promise.resolve(gcli.lookup("breakdelRemoved"));
|
|
}
|
|
return promise;
|
|
}
|
|
});
|