Title: [134695] trunk
Revision
134695
Author
fpi...@apple.com
Date
2012-11-14 16:50:41 -0800 (Wed, 14 Nov 2012)

Log Message

Read-only properties created with putDirect() should tell the structure that there are read-only properties
https://bugs.webkit.org/show_bug.cgi?id=102292

Reviewed by Gavin Barraclough.

Source/_javascript_Core: 

This mostly affects things like function.length.

* runtime/JSObject.h:
(JSC::JSObject::putDirectInternal):

LayoutTests: 

* fast/js/function-dot-length-read-only-expected.txt: Added.
* fast/js/function-dot-length-read-only.html: Added.
* fast/js/jsc-test-list:
* fast/js/script-tests/function-dot-length-read-only.js: Added.
(foo):
(Bar):

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (134694 => 134695)


--- trunk/LayoutTests/ChangeLog	2012-11-15 00:49:59 UTC (rev 134694)
+++ trunk/LayoutTests/ChangeLog	2012-11-15 00:50:41 UTC (rev 134695)
@@ -1,3 +1,17 @@
+2012-11-14  Filip Pizlo  <fpi...@apple.com>
+
+        Read-only properties created with putDirect() should tell the structure that there are read-only properties
+        https://bugs.webkit.org/show_bug.cgi?id=102292
+
+        Reviewed by Gavin Barraclough.
+
+        * fast/js/function-dot-length-read-only-expected.txt: Added.
+        * fast/js/function-dot-length-read-only.html: Added.
+        * fast/js/jsc-test-list:
+        * fast/js/script-tests/function-dot-length-read-only.js: Added.
+        (foo):
+        (Bar):
+
 2012-11-14  Alec Flett  <alecfl...@chromium.org>
 
         Add tests for explicit serialization values

Added: trunk/LayoutTests/fast/js/function-dot-length-read-only-expected.txt (0 => 134695)


--- trunk/LayoutTests/fast/js/function-dot-length-read-only-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/js/function-dot-length-read-only-expected.txt	2012-11-15 00:50:41 UTC (rev 134695)
@@ -0,0 +1,11 @@
+Tests that function.length correctly intercepts stores when a function is used as a prototype.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS o.length is 0
+PASS o.length is 0
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/fast/js/function-dot-length-read-only.html (0 => 134695)


--- trunk/LayoutTests/fast/js/function-dot-length-read-only.html	                        (rev 0)
+++ trunk/LayoutTests/fast/js/function-dot-length-read-only.html	2012-11-15 00:50:41 UTC (rev 134695)
@@ -0,0 +1,10 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src=""
+</head>
+<body>
+<script src=""
+<script src=""
+</body>
+</html>

Modified: trunk/LayoutTests/fast/js/jsc-test-list (134694 => 134695)


--- trunk/LayoutTests/fast/js/jsc-test-list	2012-11-15 00:49:59 UTC (rev 134694)
+++ trunk/LayoutTests/fast/js/jsc-test-list	2012-11-15 00:50:41 UTC (rev 134695)
@@ -203,6 +203,7 @@
 fast/js/function-declarations-in-switch-statement
 fast/js/function-dot-apply-replace-base
 fast/js/function-dot-arguments
+fast/js/function-dot-length-read-only
 fast/js/function-prototype-descriptor
 fast/js/function-toString-object-literals
 fast/js/function-toString-parentheses

Added: trunk/LayoutTests/fast/js/script-tests/function-dot-length-read-only.js (0 => 134695)


--- trunk/LayoutTests/fast/js/script-tests/function-dot-length-read-only.js	                        (rev 0)
+++ trunk/LayoutTests/fast/js/script-tests/function-dot-length-read-only.js	2012-11-15 00:50:41 UTC (rev 134695)
@@ -0,0 +1,13 @@
+description(
+"Tests that function.length correctly intercepts stores when a function is used as a prototype."
+);
+
+function foo() { }
+
+function Bar() { }
+Bar.prototype = foo;
+
+var o = new Bar();
+shouldBe("o.length", "0");
+o.length = 42;
+shouldBe("o.length", "0");

Modified: trunk/Source/_javascript_Core/ChangeLog (134694 => 134695)


--- trunk/Source/_javascript_Core/ChangeLog	2012-11-15 00:49:59 UTC (rev 134694)
+++ trunk/Source/_javascript_Core/ChangeLog	2012-11-15 00:50:41 UTC (rev 134695)
@@ -1,3 +1,15 @@
+2012-11-14  Filip Pizlo  <fpi...@apple.com>
+
+        Read-only properties created with putDirect() should tell the structure that there are read-only properties
+        https://bugs.webkit.org/show_bug.cgi?id=102292
+
+        Reviewed by Gavin Barraclough.
+
+        This mostly affects things like function.length.
+
+        * runtime/JSObject.h:
+        (JSC::JSObject::putDirectInternal):
+
 2012-11-13  Filip Pizlo  <fpi...@apple.com>
 
         Don't access Node& after adding nodes to the graph.

Modified: trunk/Source/_javascript_Core/runtime/JSObject.h (134694 => 134695)


--- trunk/Source/_javascript_Core/runtime/JSObject.h	2012-11-15 00:49:59 UTC (rev 134694)
+++ trunk/Source/_javascript_Core/runtime/JSObject.h	2012-11-15 00:50:41 UTC (rev 134695)
@@ -1312,6 +1312,8 @@
         // See comment on setNewProperty call below.
         if (!specificFunction)
             slot.setNewProperty(this, offset);
+        if (attributes & ReadOnly)
+            structure()->setContainsReadOnlyProperties();
         return true;
     }
 
@@ -1379,6 +1381,8 @@
     // so leave the slot in an uncachable state.
     if (!specificFunction)
         slot.setNewProperty(this, offset);
+    if (attributes & ReadOnly)
+        structure->setContainsReadOnlyProperties();
     return true;
 }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to