File tree Expand file tree Collapse file tree 2 files changed +22
-0
lines changed Expand file tree Collapse file tree 2 files changed +22
-0
lines changed Original file line number Diff line number Diff line change
1
+ 2008-08-19 Timothy Hatcher <timothy@apple.com>
2
+
3
+ Surround the expression to be evaluated in parenthesis so the
4
+ result of the eval is the result of the whole expression not
5
+ the last potential sub-expression. So evaluating {x: 123}
6
+ will show the Object not 123.
7
+
8
+ https://bugs.webkit.org/show_bug.cgi?id=20428
9
+
10
+ Reviewed by Kevin McCullough.
11
+
12
+ * page/inspector/Console.js:
13
+ (Console.prototype._evalInInspectedWindow): Add parenthesis
14
+ around the expression. And add couple comments.
15
+
1
16
2008-08-19 Kevin McCullough <kmccullough@apple.com>
2
17
3
18
Reviewed by Geoff.
Original file line number Diff line number Diff line change @@ -329,6 +329,10 @@ WebInspector.Console.prototype = {
329
329
330
330
_evalInInspectedWindow : function ( expression )
331
331
{
332
+ // Surround the expression in parenthesis so the result of the eval is the result
333
+ // of the whole expression not the last potential sub-expression.
334
+ expression = "(" + expression + ")" ;
335
+
332
336
if ( WebInspector . panels . scripts . paused )
333
337
return WebInspector . panels . scripts . evaluateInSelectedCallFrame ( expression ) ;
334
338
@@ -357,7 +361,10 @@ WebInspector.Console.prototype = {
357
361
inspectedWindow . _inspectorCommandLineAPI . clear = InspectorController . wrapCallback ( this . clearMessages . bind ( this ) ) ;
358
362
}
359
363
364
+ // Surround the expression in with statemnets to inject our command line API so that
365
+ // the window object properties still take more precedent than our API functions.
360
366
expression = "with (window._inspectorCommandLineAPI) { with (window) { " + expression + " } }" ;
367
+
361
368
return inspectedWindow . eval ( expression ) ;
362
369
} ,
363
370
You can’t perform that action at this time.
0 commit comments