2011-01-25 Pavel Podivilov <podivilov@chromium.org>

        Reviewed by Pavel Feldman.

        Web Inspector: evaluate in console may not work when window.console is substituted or deleted.
        https://bugs.webkit.org/show_bug.cgi?id=53072

        * inspector/console-substituted-expected.txt: Added.
        * inspector/console-substituted.html: Added.
2011-01-25  Pavel Podivilov  <podivilov@chromium.org>

        Reviewed by Pavel Feldman.

        Web Inspector: evaluate in console may not work when window.console is substituted or deleted.
        https://bugs.webkit.org/show_bug.cgi?id=53072

        Test: inspector/console-substituted.html

        * inspector/InjectedScriptSource.js:
        (.):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@76699 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 1a70d38a
2011-01-25 Pavel Podivilov <podivilov@chromium.org>
Reviewed by Pavel Feldman.
Web Inspector: evaluate in console may not work when window.console is substituted or deleted.
https://bugs.webkit.org/show_bug.cgi?id=53072
* inspector/console-substituted-expected.txt: Added.
* inspector/console-substituted.html: Added.
2011-01-26 Ryosuke Niwa <rniwa@webkit.org>
Layout test missing expectation after 58524
......
Tests that evaluate in console works even if window.console is substituted or deleted. Bug 53072
1
2
<html>
<head>
<script src="../http/tests/inspector/inspector-test2.js"></script>
<script>
function deleteConsole()
{
window.console = undefined;
}
function substituteConsole()
{
window.console = {
get _commandLineAPI() { return undefined; },
set _commandLineAPI() {}
};
}
var test = function()
{
InspectorTest.evaluateInConsole("deleteConsole()", step1);
function step1()
{
InspectorTest.evaluateInConsole("1", step2);
}
function step2(result)
{
InspectorTest.addResult(result);
InspectorTest.evaluateInConsole("substituteConsole()", step3);
}
function step3(result)
{
InspectorTest.evaluateInConsole("2", step4);
}
function step4(result)
{
InspectorTest.addResult(result);
InspectorTest.completeTest();
}
}
</script>
</head>
<body onload="runTest()">
<p>
Tests that evaluate in console works even if window.console is substituted or deleted.
<a href="https://bugs.webkit.org/show_bug.cgi?id=53072">Bug 53072</a>
</p>
</body>
</html>
2011-01-25 Pavel Podivilov <podivilov@chromium.org>
Reviewed by Pavel Feldman.
Web Inspector: evaluate in console may not work when window.console is substituted or deleted.
https://bugs.webkit.org/show_bug.cgi?id=53072
Test: inspector/console-substituted.html
* inspector/InjectedScriptSource.js:
(.):
2011-01-26 Carlos Garcia Campos <cgarcia@igalia.com>
Reviewed by Martin Robinson.
......@@ -253,16 +253,18 @@ InjectedScript.prototype = {
// Only install command line api object for the time of evaluation.
// Surround the expression in with statements to inject our command line API so that
// the window object properties still take more precedent than our API functions.
inspectedWindow.console._commandLineAPI = this._commandLineAPI;
if (inspectedWindow.console)
inspectedWindow.console._commandLineAPI = this._commandLineAPI;
// We don't want local variables to be shadowed by global ones when evaluating on CallFrame.
if (!isEvalOnCallFrame)
expression = "with (window) {\n" + expression + "\n} ";
if (injectCommandLineAPI)
expression = "with (window ? window.console._commandLineAPI : {}) {\n" + expression + "\n}";
expression = "with ((window && window.console && window.console._commandLineAPI) || {}) {\n" + expression + "\n}";
var value = evalFunction.call(object, expression);
delete inspectedWindow.console._commandLineAPI;
if (inspectedWindow.console)
delete inspectedWindow.console._commandLineAPI;
// When evaluating on call frame error is not thrown, but returned as a value.
if (this._type(value) === "error")
......
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