Changeset 125033 in webkit


Ignore:
Timestamp:
Aug 8, 2012 6:21:41 AM (12 years ago)
Author:
pfeldman@chromium.org
Message:

Web Inspector: store last evaluation result in $_
https://bugs.webkit.org/show_bug.cgi?id=93377

Reviewed by Vsevolod Vlasov.

Source/WebCore:

All "console" evaluations end up in that variable on command line API.

Test: inspector/console/console-last-result.html

  • inspector/InjectedScriptSource.js:

(.):

LayoutTests:

  • inspector/console/console-last-result-expected.txt: Added.
  • inspector/console/console-last-result.html: Added.
Location:
trunk
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r125026 r125033  
     12012-08-08  Pavel Feldman  <pfeldman@chromium.org>
     2
     3        Web Inspector: store last evaluation result in $_
     4        https://bugs.webkit.org/show_bug.cgi?id=93377
     5
     6        Reviewed by Vsevolod Vlasov.
     7
     8        * inspector/console/console-last-result-expected.txt: Added.
     9        * inspector/console/console-last-result.html: Added.
     10
    1112012-08-08  KwangYong Choi  <ky0.choi@samsung.com>
    212
  • trunk/Source/WebCore/ChangeLog

    r125032 r125033  
     12012-08-08  Pavel Feldman  <pfeldman@chromium.org>
     2
     3        Web Inspector: store last evaluation result in $_
     4        https://bugs.webkit.org/show_bug.cgi?id=93377
     5
     6        Reviewed by Vsevolod Vlasov.
     7
     8        All "console" evaluations end up in that variable on command line API.
     9
     10        Test: inspector/console/console-last-result.html
     11
     12        * inspector/InjectedScriptSource.js:
     13        (.):
     14
    1152012-08-08  Simon Hausmann  <simon.hausmann@nokia.com>
    216
  • trunk/Source/WebCore/inspector/InjectedScriptSource.js

    r123651 r125033  
    405405        try {
    406406            return { wasThrown: false,
    407                      result: this._wrapObject(this._evaluateOn(evalFunction, object, expression, isEvalOnCallFrame, injectCommandLineAPI), objectGroup, returnByValue) };
     407                     result: this._wrapObject(this._evaluateOn(evalFunction, object, objectGroup, expression, isEvalOnCallFrame, injectCommandLineAPI), objectGroup, returnByValue) };
    408408        } catch (e) {
    409409            return this._createThrownValue(e, objectGroup);
     
    429429     * @param {Function} evalFunction
    430430     * @param {Object} object
     431     * @param {string} objectGroup
    431432     * @param {string} expression
    432433     * @param {boolean} isEvalOnCallFrame
     
    434435     * @return {*}
    435436     */
    436     _evaluateOn: function(evalFunction, object, expression, isEvalOnCallFrame, injectCommandLineAPI)
     437    _evaluateOn: function(evalFunction, object, objectGroup, expression, isEvalOnCallFrame, injectCommandLineAPI)
    437438    {
    438439        // Only install command line api object for the time of evaluation.
     
    445446                expression = "with ((window && window.console && window.console._commandLineAPI) || {}) {\n" + expression + "\n}";
    446447            }
    447             return evalFunction.call(object, expression);
     448            var result = evalFunction.call(object, expression);
     449            if (objectGroup === "console")
     450                this._lastResult = result;
     451            return result;
    448452        } finally {
    449453            if (injectCommandLineAPI && inspectedWindow.console)
     
    798802        this.__defineGetter__("$" + i, commandLineAPIImpl._inspectedObject.bind(commandLineAPIImpl, i));
    799803    }
     804
     805    this.$_ = injectedScript._lastResult;
    800806}
    801807
Note: See TracChangeset for help on using the changeset viewer.