mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 605419 - [Web Console] Provide a help command to list the available helper functions; r=gavin.sharp approval2.0=gavin.sharp
This commit is contained in:
parent
c8bb8de65f
commit
0369dc2d88
@ -3910,6 +3910,16 @@ function JSTermHelper(aJSTerm)
|
||||
return arrValues;
|
||||
};
|
||||
|
||||
/**
|
||||
* Opens a help window in MDC
|
||||
*/
|
||||
aJSTerm.sandbox.help = function JSTH_help()
|
||||
{
|
||||
aJSTerm._window.open(
|
||||
"https://developer.mozilla.org/AppLinks/WebConsoleHelp?locale=" +
|
||||
aJSTerm._window.navigator.language, "help", "");
|
||||
};
|
||||
|
||||
/**
|
||||
* Inspects the passed aObject. This is done by opening the PropertyPanel.
|
||||
*
|
||||
@ -4052,6 +4062,10 @@ JSTerm.prototype = {
|
||||
*/
|
||||
evalInSandbox: function JST_evalInSandbox(aString)
|
||||
{
|
||||
// The help function needs to be easy to guess, so we make the () optional
|
||||
if (aString.trim() === "help" || aString.trim() === "?") {
|
||||
aString = "help()";
|
||||
}
|
||||
return Cu.evalInSandbox(aString, this.sandbox, "1.8", "Web Console", 1);
|
||||
},
|
||||
|
||||
|
@ -92,6 +92,18 @@ function testJSTerm()
|
||||
jsterm.execute("'valuesResult=' + (values({b:1})[0] == 1)");
|
||||
checkResult("valuesResult=true", "values() worked", 1);
|
||||
|
||||
jsterm.clearOutput();
|
||||
jsterm.execute("help()");
|
||||
checkResult("undefined", "help() worked", 1);
|
||||
|
||||
jsterm.clearOutput();
|
||||
jsterm.execute("help");
|
||||
checkResult("undefined", "help() worked", 1);
|
||||
|
||||
jsterm.clearOutput();
|
||||
jsterm.execute("?");
|
||||
checkResult("undefined", "help() worked", 1);
|
||||
|
||||
jsterm.clearOutput();
|
||||
jsterm.execute("pprint({b:2, a:1})");
|
||||
// Doesn't conform to checkResult format
|
||||
|
Loading…
Reference in New Issue
Block a user