зеркало из https://github.com/mozilla/gecko-dev.git
Bug 869981 - Bring back inspect() jsterm helper function; r=me a=robcee
This commit is contained in:
Родитель
6428dfb7b0
Коммит
9a1335ca6b
|
@ -125,6 +125,7 @@ MOCHITEST_BROWSER_FILES = \
|
|||
browser_webconsole_bug_837351_securityerrors.js \
|
||||
browser_bug_865871_variables_view_close_on_esc_key.js \
|
||||
browser_bug_865288_repeat_different_objects.js \
|
||||
browser_jsterm_inspect.js \
|
||||
head.js \
|
||||
$(NULL)
|
||||
|
||||
|
|
|
@ -0,0 +1,35 @@
|
|||
/*
|
||||
* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/
|
||||
*/
|
||||
|
||||
// Check that the inspect() jsterm helper function works.
|
||||
|
||||
function test()
|
||||
{
|
||||
const TEST_URI = "data:text/html;charset=utf8,<p>hello bug 869981";
|
||||
|
||||
addTab(TEST_URI);
|
||||
browser.addEventListener("load", function onLoad() {
|
||||
browser.removeEventListener("load", onLoad, true);
|
||||
openConsole(null, consoleOpened);
|
||||
}, true);
|
||||
|
||||
function consoleOpened(hud)
|
||||
{
|
||||
content.wrappedJSObject.testProp = "testValue";
|
||||
|
||||
hud.jsterm.once("variablesview-fetched", onObjFetch);
|
||||
hud.jsterm.execute("inspect(window)");
|
||||
}
|
||||
|
||||
function onObjFetch(aEvent, aVar)
|
||||
{
|
||||
ok(aVar._variablesView, "variables view object");
|
||||
|
||||
findVariableViewProperties(aVar, [
|
||||
{ name: "testProp", value: "testValue" },
|
||||
{ name: "document", value: "[object HTMLDocument]" },
|
||||
], { webconsole: hud }).then(finishTest);
|
||||
}
|
||||
}
|
|
@ -1268,6 +1268,23 @@ this.JSTermHelpers = function JSTermHelpers(aOwner)
|
|||
aOwner.helperResult = { type: "help" };
|
||||
};
|
||||
|
||||
/**
|
||||
* Inspects the passed aObject. This is done by opening the PropertyPanel.
|
||||
*
|
||||
* @param object aObject
|
||||
* Object to inspect.
|
||||
*/
|
||||
aOwner.sandbox.inspect = function JSTH_inspect(aObject)
|
||||
{
|
||||
let dbgObj = aOwner.makeDebuggeeValue(aObject);
|
||||
let grip = aOwner.createValueGrip(dbgObj);
|
||||
aOwner.helperResult = {
|
||||
type: "inspectObject",
|
||||
input: aOwner.evalInput,
|
||||
object: grip,
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* Prints aObject to the output.
|
||||
*
|
||||
|
|
Загрузка…
Ссылка в новой задаче