Title: [146937] trunk/Source/WebCore
Revision
146937
Author
timo...@apple.com
Date
2013-03-26 15:04:36 -0700 (Tue, 26 Mar 2013)

Log Message

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

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.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (146936 => 146937)


--- trunk/Source/WebCore/ChangeLog	2013-03-26 22:03:57 UTC (rev 146936)
+++ trunk/Source/WebCore/ChangeLog	2013-03-26 22:04:36 UTC (rev 146937)
@@ -1,3 +1,16 @@
+2013-03-26  Timothy Hatcher  <timo...@apple.com>
+
+        Make the Web Inspector console work in strict mode with _javascript_Core.
+
+        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  <rn...@webkit.org>
 
         Heap-use-after-free regression

Modified: trunk/Source/WebCore/inspector/InjectedScriptSource.js (146936 => 146937)


--- trunk/Source/WebCore/inspector/InjectedScriptSource.js	2013-03-26 22:03:57 UTC (rev 146936)
+++ trunk/Source/WebCore/inspector/InjectedScriptSource.js	2013-03-26 22:04:36 UTC (rev 146937)
@@ -557,6 +557,7 @@
 
             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 @@
                 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);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to