Title: [133727] trunk
Revision
133727
Author
[email protected]
Date
2012-11-07 00:32:34 -0800 (Wed, 07 Nov 2012)

Log Message

Console not displaying all properties of an Object once native Constructor overwritten
https://bugs.webkit.org/show_bug.cgi?id=101320

Reviewed by Pavel Feldman.

Source/WebCore:

Use Object instance from {}.constructor when formatting inspector messages in the
injected script. Otherwise inspected page may overwrite Object value and break inspector.

Test: inspector/console/console-Object-overwritten.html

* inspector/InjectedScriptSource.js:

LayoutTests:

Check that Web Inspector's console works fine if Object is overwritten in the inspected
page.

* inspector/console/console-Object-overwritten-expected.txt: Added.
* inspector/console/console-Object-overwritten.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (133726 => 133727)


--- trunk/LayoutTests/ChangeLog	2012-11-07 07:13:20 UTC (rev 133726)
+++ trunk/LayoutTests/ChangeLog	2012-11-07 08:32:34 UTC (rev 133727)
@@ -1,3 +1,16 @@
+2012-11-06  Yury Semikhatsky  <[email protected]>
+
+        Console not displaying all properties of an Object once native Constructor overwritten
+        https://bugs.webkit.org/show_bug.cgi?id=101320
+
+        Reviewed by Pavel Feldman.
+
+        Check that Web Inspector's console works fine if Object is overwritten in the inspected
+        page.
+
+        * inspector/console/console-Object-overwritten-expected.txt: Added.
+        * inspector/console/console-Object-overwritten.html: Added.
+
 2012-11-06  Kangil Han  <[email protected]>
 
         [EFL][WK2] media/media-continues-playing-after-replace-source.html fails

Modified: trunk/LayoutTests/inspector/console/command-line-api-expected.txt (133726 => 133727)


--- trunk/LayoutTests/inspector/console/command-line-api-expected.txt	2012-11-07 07:13:20 UTC (rev 133726)
+++ trunk/LayoutTests/inspector/console/command-line-api-expected.txt	2012-11-07 08:32:34 UTC (rev 133727)
@@ -1,4 +1,4 @@
-CONSOLE MESSAGE: line 1028: The console function $() has changed from $=getElementById(id) to $=querySelector(selector). You might try $("#%s")
+CONSOLE MESSAGE: line 1031: The console function $() has changed from $=getElementById(id) to $=querySelector(selector). You might try $("#%s")
 Tests that command line api works.
 
 

Added: trunk/LayoutTests/inspector/console/console-Object-overwritten-expected.txt (0 => 133727)


--- trunk/LayoutTests/inspector/console/console-Object-overwritten-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/inspector/console/console-Object-overwritten-expected.txt	2012-11-07 08:32:34 UTC (rev 133727)
@@ -0,0 +1,5 @@
+Tests that Web Inspector's console is not broken if Object is overwritten in the inspected page. Test passes if the _expression_ is evaluated in the console and no errors printed. Bug 101320.
+
+var foo = {bar:2012}; foo
+Object {bar: 2012}
+
Property changes on: trunk/LayoutTests/inspector/console/console-Object-overwritten-expected.txt
___________________________________________________________________

Added: svn:eol-style

Added: trunk/LayoutTests/inspector/console/console-Object-overwritten.html (0 => 133727)


--- trunk/LayoutTests/inspector/console/console-Object-overwritten.html	                        (rev 0)
+++ trunk/LayoutTests/inspector/console/console-Object-overwritten.html	2012-11-07 08:32:34 UTC (rev 133727)
@@ -0,0 +1,29 @@
+<html>
+<head>
+<script src=""
+<script src=""
+<script>
+
+Object = function() {};
+
+function test()
+{
+    InspectorTest.evaluateInConsole("var foo = {bar:2012}; foo", step1);
+
+    function step1()
+    {
+        InspectorTest.dumpConsoleMessages();
+        InspectorTest.completeTest();
+    }
+}
+
+</script>
+</head>
+<body _onload_="runTest()">
+<p>
+Tests that Web Inspector's console is not broken if Object is overwritten in the inspected page.
+Test passes if the _expression_ is evaluated in the console and no errors printed.
+<a href="" 101320.</a>
+</p>
+</body>
+</html>
Property changes on: trunk/LayoutTests/inspector/console/console-Object-overwritten.html
___________________________________________________________________

Added: svn:eol-style

Modified: trunk/Source/WebCore/ChangeLog (133726 => 133727)


--- trunk/Source/WebCore/ChangeLog	2012-11-07 07:13:20 UTC (rev 133726)
+++ trunk/Source/WebCore/ChangeLog	2012-11-07 08:32:34 UTC (rev 133727)
@@ -1,3 +1,17 @@
+2012-11-06  Yury Semikhatsky  <[email protected]>
+
+        Console not displaying all properties of an Object once native Constructor overwritten
+        https://bugs.webkit.org/show_bug.cgi?id=101320
+
+        Reviewed by Pavel Feldman.
+
+        Use Object instance from {}.constructor when formatting inspector messages in the
+        injected script. Otherwise inspected page may overwrite Object value and break inspector.
+
+        Test: inspector/console/console-Object-overwritten.html
+
+        * inspector/InjectedScriptSource.js:
+
 2012-11-06  Keishi Hattori  <[email protected]>
 
         Implement month picking to calendar picker

Modified: trunk/Source/WebCore/inspector/InjectedScriptSource.js (133726 => 133727)


--- trunk/Source/WebCore/inspector/InjectedScriptSource.js	2012-11-07 07:13:20 UTC (rev 133726)
+++ trunk/Source/WebCore/inspector/InjectedScriptSource.js	2012-11-07 08:32:34 UTC (rev 133727)
@@ -33,6 +33,9 @@
  */
 (function (InjectedScriptHost, inspectedWindow, injectedScriptId) {
 
+// Protect against Object overwritten by the user code.
+var Object = {}.constructor;
+
 /**
  * @param {Arguments} array
  * @param {number=} index
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to