hi
Adding commands as described here
https://developer.mozilla.org/en-US/docs/Tools/GCLI/Scratchpad no longer work.
Firefox 42.0
Ubuntu 14.04
Code from the page:
Components.utils.import("resource:///modules/devtools/gcli.jsm");
gcli.addCommand({
name: 'hello',
description: 'Show a message',
params: [
{
name: 'name',
type: 'string',
description: 'Who to say hello to',
}
],
exec: function(args, context) {
return 'Good morning, ' +
args.name;
}
});
Error:
/*
Exception: [Exception... "Component returned failure code: 0x80520012 (NS_ERROR_FILE_NOT_FOUND) [nsIXPCComponents_Utils.import]" nsresult: "0x80520012 (NS_ERROR_FILE_NOT_FOUND)" location: "JS frame :: Scratchpad/2 :: <TOP_LEVEL> :: line 1" data: no]
*/
When I try with
Components.utils.import("resource://gre/modules/devtools/gcli.jsm");
I get the error:
/*
Exception: TypeError: gcli.addCommand is not a function
@Scratchpad/2:3:1
WCA_evalWithDebugger@resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/devtools/server/actors/webconsole.js:1195:16
WCA_onEvaluateJS@resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/devtools/server/actors/webconsole.js:811:20
WCA_onEvaluateJSAsync@resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/devtools/server/actors/webconsole.js:782:20
DSC_onPacket@resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/devtools/server/main.js:1586:15
LocalDebuggerTransport.prototype.send/<@resource://gre/modules/devtools/dbg-client.jsm -> resource://gre/modules/devtools/transport/transport.js:569:11
makeInfallible/<@resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/devtools/DevToolsUtils.js:83:14
makeInfallible/<@resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/devtools/DevToolsUtils.js:83:14
*/
The mozcmd stored on disk in the devtools path are working though.
Regards
Ben