Changeset 76699 in webkit


Ignore:
Timestamp:
Jan 26, 2011 10:24:19 AM (13 years ago)
Author:
podivilov@chromium.org
Message:

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: (.):
Location:
trunk
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r76698 r76699  
     12011-01-25  Pavel Podivilov  <podivilov@chromium.org>
     2
     3        Reviewed by Pavel Feldman.
     4
     5        Web Inspector: evaluate in console may not work when window.console is substituted or deleted.
     6        https://bugs.webkit.org/show_bug.cgi?id=53072
     7
     8        * inspector/console-substituted-expected.txt: Added.
     9        * inspector/console-substituted.html: Added.
     10
    1112011-01-26  Ryosuke Niwa  <rniwa@webkit.org>
    212
  • trunk/Source/WebCore/ChangeLog

    r76697 r76699  
     12011-01-25  Pavel Podivilov  <podivilov@chromium.org>
     2
     3        Reviewed by Pavel Feldman.
     4
     5        Web Inspector: evaluate in console may not work when window.console is substituted or deleted.
     6        https://bugs.webkit.org/show_bug.cgi?id=53072
     7
     8        Test: inspector/console-substituted.html
     9
     10        * inspector/InjectedScriptSource.js:
     11        (.):
     12
    1132011-01-26  Carlos Garcia Campos  <cgarcia@igalia.com>
    214
  • trunk/Source/WebCore/inspector/InjectedScriptSource.js

    r76680 r76699  
    254254        // Surround the expression in with statements to inject our command line API so that
    255255        // the window object properties still take more precedent than our API functions.
    256         inspectedWindow.console._commandLineAPI = this._commandLineAPI;
     256        if (inspectedWindow.console)
     257            inspectedWindow.console._commandLineAPI = this._commandLineAPI;
    257258   
    258259        // We don't want local variables to be shadowed by global ones when evaluating on CallFrame.
     
    260261            expression = "with (window) {\n" + expression + "\n} ";
    261262        if (injectCommandLineAPI)
    262             expression = "with (window ? window.console._commandLineAPI : {}) {\n" + expression + "\n}";
     263            expression = "with ((window && window.console && window.console._commandLineAPI) || {}) {\n" + expression + "\n}";
    263264        var value = evalFunction.call(object, expression);
    264265   
    265         delete inspectedWindow.console._commandLineAPI;
     266        if (inspectedWindow.console)
     267            delete inspectedWindow.console._commandLineAPI;
    266268   
    267269        // When evaluating on call frame error is not thrown, but returned as a value.
Note: See TracChangeset for help on using the changeset viewer.