Commit b5319893 authored by aandrey@chromium.org's avatar aandrey@chromium.org

DevTools: Remove console last result $_ on console clear.

BUG=398336
R=loislo, yurys

Review URL: https://codereview.chromium.org/430503002

git-svn-id: svn://svn.chromium.org/blink/trunk@179179 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 3a497e63
Tests that evaluating an expression with a syntax error in the console won't crash the browser. Bug 61194.
foo().
Uncaught SyntaxError: Unexpected token } VM:734
Uncaught SyntaxError: Unexpected token } VM:736
Tests that console exposes last evaluation result as $_.
Running: testLastResult
1+1
2
$_
2
Running: testLastResultAfterConsoleClear
$_
undefined
......@@ -6,17 +6,44 @@
function test()
{
InspectorTest.evaluateInConsole("1+1", step1);
InspectorTest.runTestSuite([
function testLastResult(next)
{
InspectorTest.evaluateInConsole("1+1", step1);
function step1()
{
InspectorTest.evaluateInConsole("$_", callback);
}
function step1()
{
evaluateLastResultAndDump(next);
}
},
function testLastResultAfterConsoleClear(next)
{
InspectorTest.evaluateInConsole("1+1", step1);
function callback()
function step1()
{
WebInspector.consoleModel.requestClearMessages();
InspectorTest.runAfterPendingDispatches(step2);
}
function step2()
{
evaluateLastResultAndDump(next);
}
}
]);
function evaluateLastResultAndDump(callback)
{
InspectorTest.dumpConsoleMessages();
InspectorTest.completeTest();
InspectorTest.evaluateInConsole("$_", didEvaluate);
function didEvaluate()
{
InspectorTest.dumpConsoleMessages();
if (callback)
callback();
}
}
}
......
......@@ -359,6 +359,8 @@ InjectedScript.prototype = {
*/
releaseObjectGroup: function(objectGroupName)
{
if (objectGroupName === "console")
delete this._lastResult;
var group = this._objectGroups[objectGroupName];
if (!group)
return;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment