Commit da73879a authored by timothy@apple.com's avatar timothy@apple.com
Browse files

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.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@146937 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 9d65243a
2013-03-26 Timothy Hatcher <timothy@apple.com>
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.
2013-03-26 Ryosuke Niwa <rniwa@webkit.org>
 
Heap-use-after-free regression
......@@ -557,6 +557,7 @@ InjectedScript.prototype = {
var thisObject = isEvalOnCallFrame ? object : null;
var parameters = [InjectedScriptHost.evaluate, expression];
var expressionFunctionBody = "var __originalEval = window.eval; window.eval = __eval; try { return eval(__currentExpression); } finally { window.eval = __originalEval; }";
if (injectCommandLineAPI) {
// To avoid using a 'with' statement (which fails in strict mode and requires injecting the API object)
......@@ -571,12 +572,11 @@ InjectedScript.prototype = {
for (var i = 0; i < parameterNames.length; ++i)
parameters.push(commandLineAPI[parameterNames[i]]);
var expressionFunctionString = "(function(eval, __currentExpression, " + parameterNames.join(", ") + ") { return eval(__currentExpression); })";
var expressionFunctionString = "(function(__eval, __currentExpression, " + parameterNames.join(", ") + ") { " + expressionFunctionBody + " })";
} else {
// Use a closure in this case too to keep the same behavior of 'var' being captured by the closure instead
// of leaking out into the calling scope.
var expressionFunctionString = "(function(eval, __currentExpression) { return eval(__currentExpression); })";
var expressionFunctionString = "(function(__eval, __currentExpression) { " + expressionFunctionBody + " })";
}
var expressionFunction = evalFunction.call(thisObject, expressionFunctionString);
......
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