mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
19bbe0f58e
--HG-- rename : browser/devtools/commandline/GcliCookieCommands.jsm => browser/devtools/commandline/CmdCookie.jsm rename : browser/devtools/commandline/GcliCommands.jsm => browser/devtools/commandline/Commands.jsm rename : browser/devtools/commandline/gcli.css => browser/devtools/commandline/commandline.css rename : browser/devtools/commandline/gclioutput.xhtml => browser/devtools/commandline/commandlineoutput.xhtml rename : browser/devtools/commandline/gclitooltip.xhtml => browser/devtools/commandline/commandlinetooltip.xhtml rename : browser/devtools/commandline/test/browser_gcli_addon.js => browser/devtools/commandline/test/browser_cmd_addon.js rename : browser/devtools/commandline/test/browser_gcli_calllog.js => browser/devtools/commandline/test/browser_cmd_calllog.js rename : browser/devtools/commandline/test/browser_gcli_commands.js => browser/devtools/commandline/test/browser_cmd_commands.js rename : browser/devtools/commandline/test/browser_gcli_cookie.js => browser/devtools/commandline/test/browser_cmd_cookie.js rename : browser/devtools/commandline/test/browser_gcli_integrate.js => browser/devtools/commandline/test/browser_cmd_integrate.js rename : browser/devtools/commandline/test/browser_gcli_jsb.js => browser/devtools/commandline/test/browser_cmd_jsb.js rename : browser/devtools/commandline/test/resources_jsb_script.js => browser/devtools/commandline/test/browser_cmd_jsb_script.jsi rename : browser/devtools/commandline/test/browser_gcli_inspect.html => browser/devtools/commandline/test/browser_cmd_pagemod_export.html rename : browser/devtools/commandline/test/browser_gcli_pagemod_export.js => browser/devtools/commandline/test/browser_cmd_pagemod_export.js rename : browser/devtools/commandline/test/browser_gcli_pref.js => browser/devtools/commandline/test/browser_cmd_pref.js rename : browser/devtools/commandline/test/browser_gcli_restart.js => browser/devtools/commandline/test/browser_cmd_restart.js rename : browser/devtools/commandline/test/browser_gcli_settings.js => browser/devtools/commandline/test/browser_cmd_settings.js rename : browser/devtools/commandline/test/resources_dbg.html => browser/devtools/commandline/test/browser_dbg_cmd.html rename : browser/devtools/commandline/test/browser_gcli_dbg.js => browser/devtools/commandline/test/browser_dbg_cmd.js rename : browser/devtools/commandline/test/browser_gcli_break.html => browser/devtools/commandline/test/browser_dbg_cmd_break.html rename : browser/devtools/commandline/test/browser_gcli_break.js => browser/devtools/commandline/test/browser_dbg_cmd_break.js rename : browser/devtools/commandline/test/browser_gcli_inspect.html => browser/devtools/highlighter/test/browser_inspector_cmd_inspect.html rename : browser/devtools/commandline/test/browser_gcli_inspect.js => browser/devtools/highlighter/test/browser_inspector_cmd_inspect.js rename : browser/devtools/commandline/test/browser_gcli_responsivemode.js => browser/devtools/responsivedesign/test/browser_responsive_cmd.js rename : browser/devtools/commandline/test/resources.html => browser/devtools/styleeditor/test/browser_styleeditor_cmd_edit.html rename : browser/devtools/commandline/test/browser_gcli_edit.js => browser/devtools/styleeditor/test/browser_styleeditor_cmd_edit.js rename : browser/devtools/commandline/test/resources_inpage.js => browser/devtools/styleeditor/test/resources_inpage.jsi rename : browser/devtools/commandline/test/resources_inpage1.css => browser/devtools/styleeditor/test/resources_inpage1.css rename : browser/devtools/commandline/test/resources_inpage2.css => browser/devtools/styleeditor/test/resources_inpage2.css rename : browser/devtools/commandline/GcliTiltCommands.jsm => browser/devtools/tilt/CmdTilt.jsm rename : browser/themes/gnomestripe/devtools/gcli.css => browser/themes/gnomestripe/devtools/commandline.css rename : browser/themes/pinstripe/devtools/gcli.css => browser/themes/pinstripe/devtools/commandline.css rename : browser/themes/winstripe/devtools/gcli.css => browser/themes/winstripe/devtools/commandline.css
104 lines
2.7 KiB
JavaScript
104 lines
2.7 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");
|
|
|
|
XPCOMUtils.defineLazyGetter(this, "Debugger", function() {
|
|
let JsDebugger = {};
|
|
Components.utils.import("resource://gre/modules/jsdebugger.jsm", JsDebugger);
|
|
|
|
let global = Components.utils.getGlobalForObject({});
|
|
JsDebugger.addDebuggerToGlobal(global);
|
|
|
|
return global.Debugger;
|
|
});
|
|
|
|
let debuggers = [];
|
|
|
|
/**
|
|
* 'calllog' command
|
|
*/
|
|
gcli.addCommand({
|
|
name: "calllog",
|
|
description: gcli.lookup("calllogDesc")
|
|
})
|
|
|
|
/**
|
|
* 'calllog start' command
|
|
*/
|
|
gcli.addCommand({
|
|
name: "calllog start",
|
|
description: gcli.lookup("calllogStartDesc"),
|
|
|
|
exec: function(args, context) {
|
|
let contentWindow = context.environment.contentDocument.defaultView;
|
|
|
|
let dbg = new Debugger(contentWindow);
|
|
dbg.onEnterFrame = function(frame) {
|
|
// BUG 773652 - Make the output from the GCLI calllog command nicer
|
|
contentWindow.console.log("Method call: " + this.callDescription(frame));
|
|
}.bind(this);
|
|
|
|
debuggers.push(dbg);
|
|
|
|
let tab = context.environment.chromeDocument.defaultView.gBrowser.selectedTab;
|
|
HUDService.activateHUDForContext(tab);
|
|
|
|
return gcli.lookup("calllogStartReply");
|
|
},
|
|
|
|
callDescription: function(frame) {
|
|
let name = "<anonymous>";
|
|
if (frame.callee.name) {
|
|
name = frame.callee.name;
|
|
}
|
|
else {
|
|
let desc = frame.callee.getOwnPropertyDescriptor("displayName");
|
|
if (desc && desc.value && typeof desc.value == "string") {
|
|
name = desc.value;
|
|
}
|
|
}
|
|
|
|
let args = frame.arguments.map(this.valueToString).join(", ");
|
|
return name + "(" + args + ")";
|
|
},
|
|
|
|
valueToString: function(value) {
|
|
if (typeof value !== "object" || value === null) {
|
|
return uneval(value);
|
|
}
|
|
return "[object " + value.class + "]";
|
|
}
|
|
});
|
|
|
|
/**
|
|
* 'calllog stop' command
|
|
*/
|
|
gcli.addCommand({
|
|
name: "calllog stop",
|
|
description: gcli.lookup("calllogStopDesc"),
|
|
|
|
exec: function(args, context) {
|
|
let numDebuggers = debuggers.length;
|
|
if (numDebuggers == 0) {
|
|
return gcli.lookup("calllogStopNoLogging");
|
|
}
|
|
|
|
for (let dbg of debuggers) {
|
|
dbg.onEnterFrame = undefined;
|
|
}
|
|
debuggers = [];
|
|
|
|
return gcli.lookupFormat("calllogStopReply", [ numDebuggers ]);
|
|
}
|
|
});
|