зеркало из https://github.com/mozilla/pjs.git
Bug 618344 - Web Console pprint() command should display something useful for functions; f=rcampbell r=sdwilsh a=gavin.sharp
This commit is contained in:
Родитель
14b5e7b325
Коммит
887a299f18
|
@ -215,6 +215,9 @@ const MINIMUM_PAGE_HEIGHT = 50;
|
||||||
// The default console height, as a ratio from the content window inner height.
|
// The default console height, as a ratio from the content window inner height.
|
||||||
const DEFAULT_CONSOLE_HEIGHT = 0.33;
|
const DEFAULT_CONSOLE_HEIGHT = 0.33;
|
||||||
|
|
||||||
|
// Constant used when checking the typeof objects.
|
||||||
|
const TYPEOF_FUNCTION = "function";
|
||||||
|
|
||||||
const ERRORS = { LOG_MESSAGE_MISSING_ARGS:
|
const ERRORS = { LOG_MESSAGE_MISSING_ARGS:
|
||||||
"Missing arguments: aMessage, aConsoleNode and aMessageNode are required.",
|
"Missing arguments: aMessage, aConsoleNode and aMessageNode are required.",
|
||||||
CANNOT_GET_HUD: "Cannot getHeads Up Display with provided ID",
|
CANNOT_GET_HUD: "Cannot getHeads Up Display with provided ID",
|
||||||
|
@ -3682,6 +3685,11 @@ function JSTermHelper(aJSTerm)
|
||||||
aJSTerm.console.error(HUDService.getStr("helperFuncUnsupportedTypeError"));
|
aJSTerm.console.error(HUDService.getStr("helperFuncUnsupportedTypeError"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
else if (typeof aObject === TYPEOF_FUNCTION) {
|
||||||
|
aJSTerm.writeOutput(aObject + "\n", CATEGORY_OUTPUT, SEVERITY_LOG);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
let output = [];
|
let output = [];
|
||||||
let pairs = namesAndValuesOf(unwrap(aObject));
|
let pairs = namesAndValuesOf(unwrap(aObject));
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
* Julian Viereck <jviereck@mozilla.com>
|
* Julian Viereck <jviereck@mozilla.com>
|
||||||
* Patrick Walton <pcwalton@mozilla.com>
|
* Patrick Walton <pcwalton@mozilla.com>
|
||||||
* Rob Campbell <rcampbell@mozilla.com>
|
* Rob Campbell <rcampbell@mozilla.com>
|
||||||
|
* Mihai Șucan <mihai.sucan@gmail.com>
|
||||||
*
|
*
|
||||||
* Alternatively, the contents of this file may be used under the terms of
|
* Alternatively, the contents of this file may be used under the terms of
|
||||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||||
|
@ -145,5 +146,12 @@ function testJSTerm()
|
||||||
let label = jsterm.outputNode.querySelector(".webconsole-msg-output");
|
let label = jsterm.outputNode.querySelector(".webconsole-msg-output");
|
||||||
is(label.textContent.trim(), '0: "h"\n 1: "i"', 'pprint("hi") worked');
|
is(label.textContent.trim(), '0: "h"\n 1: "i"', 'pprint("hi") worked');
|
||||||
|
|
||||||
|
// check that pprint(function) shows function source, bug 618344
|
||||||
|
jsterm.clearOutput();
|
||||||
|
jsterm.execute("pprint(print)");
|
||||||
|
label = jsterm.outputNode.querySelector(".webconsole-msg-output");
|
||||||
|
isnot(label.textContent.indexOf("SEVERITY_LOG"), -1,
|
||||||
|
"pprint(function) shows function source");
|
||||||
|
|
||||||
finishTest();
|
finishTest();
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче