Changeset 146937 in webkit


Ignore:
Timestamp:
Mar 26, 2013 3:04:36 PM (11 years ago)
Author:
timothy@apple.com
Message:

Make the Web Inspector console work in strict mode with JavaScriptCore.

https://webkit.org/b/65829
rdar://problem/11271238

Reviewed by Joseph Pecoraro.

  • inspector/InjectedScriptSource.js:

(InjectedScript.prototype._evaluateOn): Don't use 'eval' parameter (it isn't
allowed in strict mode). Swap window.eval with our known eval instead.

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r146935 r146937  
     12013-03-26  Timothy Hatcher  <timothy@apple.com>
     2
     3        Make the Web Inspector console work in strict mode with JavaScriptCore.
     4
     5        https://webkit.org/b/65829
     6        rdar://problem/11271238
     7
     8        Reviewed by Joseph Pecoraro.
     9
     10        * inspector/InjectedScriptSource.js:
     11        (InjectedScript.prototype._evaluateOn): Don't use 'eval' parameter (it isn't
     12        allowed in strict mode). Swap window.eval with our known eval instead.
     13
    1142013-03-26  Ryosuke Niwa  <rniwa@webkit.org>
    215
  • trunk/Source/WebCore/inspector/InjectedScriptSource.js

    r146840 r146937  
    558558            var thisObject = isEvalOnCallFrame ? object : null;
    559559            var parameters = [InjectedScriptHost.evaluate, expression];
     560            var expressionFunctionBody = "var __originalEval = window.eval; window.eval = __eval; try { return eval(__currentExpression); } finally { window.eval = __originalEval; }";
    560561
    561562            if (injectCommandLineAPI) {
     
    572573                    parameters.push(commandLineAPI[parameterNames[i]]);
    573574
    574                 var expressionFunctionString = "(function(eval, __currentExpression, " + parameterNames.join(", ") + ") { return eval(__currentExpression); })";
     575                var expressionFunctionString = "(function(__eval, __currentExpression, " + parameterNames.join(", ") + ") { " + expressionFunctionBody + " })";
    575576            } else {
    576577                // Use a closure in this case too to keep the same behavior of 'var' being captured by the closure instead
    577578                // of leaking out into the calling scope.
    578 
    579                 var expressionFunctionString = "(function(eval, __currentExpression) { return eval(__currentExpression); })";
     579                var expressionFunctionString = "(function(__eval, __currentExpression) { " + expressionFunctionBody + " })";
    580580            }
    581581
Note: See TracChangeset for help on using the changeset viewer.