This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
name: 'hello', | |
description: 'Show a message', | |
params: [ | |
{ | |
name: 'name', | |
type: 'string', | |
description: 'Who to say hello to', | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Components.utils.import("resource:///modules/devtools/gcli.jsm"); | |
gcli.addCommand({ | |
name: 'foo', | |
params: [ | |
{ | |
name: 'letters', | |
type: { | |
name: 'selection', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Basic use of createView | |
gcli.addCommand({ | |
name: 'foo', | |
exec: function(args, context) { | |
return context.createView({ | |
html: '<div>${name}</div>', | |
data: { name: 'joe' } | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Components.utils.import("resource:///modules/devtools/gcli.jsm"); | |
gcli.addCommand({ | |
name: 'foo', | |
params: [ | |
{ | |
name: 'letters', | |
type: { | |
name: 'selection', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Components.utils.import("resource:///modules/devtools/gcli.jsm"); | |
gcli.addCommand({ | |
name: 'xulcommand', | |
description: 'Run a XUL Command', | |
params: [ | |
{ | |
name: 'command', | |
type: { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let console = (Cu.import("resource://gre/modules/devtools/Console.jsm", {})).console; | |
// ... | |
/** | |
* Internal utility: Decorates given `f` function, so that on exception promise | |
* rejected with thrown error is returned. | |
*/ | |
function attempt(f) { | |
return function effort(input) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* An example of the new way to write GCLI tests | |
*/ | |
var promise = helpers.audit([ // Tests can be async. They're done when the promise resolves | |
{ | |
name: 'a test', // Optional test name, we'll use the 'setup' string if there is no name | |
setup: 'help search', // A string to type (which can include control chars like <TAB>), | |
// or a function to do custom setup. return a promise to be async | |
skipIf: function() { ... }, // If you need to skip tests in some cases e.g. private browsing | |
check: { // Some stuff to check ... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
XPCOMUtils.defineLazyGetter(this, "require", function() { | |
let { require } = Cu.import("resource://gre/modules/devtools/Require.jsm", {}); | |
Cu.import("resource://gre/modules/devtools/gcli.jsm", {}); | |
return require; | |
}); | |
XPCOMUtils.defineLazyGetter(this, "Requisition", () => require("gcli/cli").Requisition); | |
function execGcliCommand(command) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let foo = new Set; | |
foo.add("jsonable"); | |
console.log(JSON.stringify(foo)); // "{}" |