Title: [200406] trunk
Revision
200406
Author
[email protected]
Date
2016-05-03 22:01:08 -0700 (Tue, 03 May 2016)

Log Message

REGRESSION(r200383): Setting lazily initialized properties across frame boundaries crashes
https://bugs.webkit.org/show_bug.cgi?id=157333

Reviewed by Benjamin Poulain.

Source/_javascript_Core:

I forgot to add logic for lazy properties in putEntry(). It turns out that it's easy to
add.

* runtime/Lookup.h:
(JSC::putEntry):
* runtime/PropertySlot.h:

LayoutTests:

This is JoePeck's original test case. It used to crash and now it doesn't crash anymore.

* js/dom/cross-window-put-math-expected.txt: Added.
* js/dom/cross-window-put-math.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (200405 => 200406)


--- trunk/LayoutTests/ChangeLog	2016-05-04 02:23:28 UTC (rev 200405)
+++ trunk/LayoutTests/ChangeLog	2016-05-04 05:01:08 UTC (rev 200406)
@@ -1,3 +1,15 @@
+2016-05-03  Filip Pizlo  <[email protected]>
+
+        REGRESSION(r200383): Setting lazily initialized properties across frame boundaries crashes
+        https://bugs.webkit.org/show_bug.cgi?id=157333
+
+        Reviewed by Benjamin Poulain.
+        
+        This is JoePeck's original test case. It used to crash and now it doesn't crash anymore.
+
+        * js/dom/cross-window-put-math-expected.txt: Added.
+        * js/dom/cross-window-put-math.html: Added.
+
 2016-05-03  Yusuke Suzuki  <[email protected]>
 
         Improve Symbol() to string coercion error message

Added: trunk/LayoutTests/js/dom/cross-window-put-math-expected.txt (0 => 200406)


--- trunk/LayoutTests/js/dom/cross-window-put-math-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/js/dom/cross-window-put-math-expected.txt	2016-05-04 05:01:08 UTC (rev 200406)
@@ -0,0 +1,9 @@
+
+Test storing to a lazy global property.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/js/dom/cross-window-put-math.html (0 => 200406)


--- trunk/LayoutTests/js/dom/cross-window-put-math.html	                        (rev 0)
+++ trunk/LayoutTests/js/dom/cross-window-put-math.html	2016-05-04 05:01:08 UTC (rev 200406)
@@ -0,0 +1,16 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=""
+</head>
+<body>
+<iframe id="x" src=""
+<div id="description"></div>
+<div id="console"></div>
+<script>
+description('Test storing to a lazy global property.');
+window.frames[0].Math = window.Math;
+</script>
+<script src=""
+</body>
+</html>

Modified: trunk/Source/_javascript_Core/ChangeLog (200405 => 200406)


--- trunk/Source/_javascript_Core/ChangeLog	2016-05-04 02:23:28 UTC (rev 200405)
+++ trunk/Source/_javascript_Core/ChangeLog	2016-05-04 05:01:08 UTC (rev 200406)
@@ -1,5 +1,19 @@
 2016-05-03  Filip Pizlo  <[email protected]>
 
+        REGRESSION(r200383): Setting lazily initialized properties across frame boundaries crashes
+        https://bugs.webkit.org/show_bug.cgi?id=157333
+
+        Reviewed by Benjamin Poulain.
+        
+        I forgot to add logic for lazy properties in putEntry(). It turns out that it's easy to
+        add.
+
+        * runtime/Lookup.h:
+        (JSC::putEntry):
+        * runtime/PropertySlot.h:
+
+2016-05-03  Filip Pizlo  <[email protected]>
+
         References from code to Structures should be stronger than weak
         https://bugs.webkit.org/show_bug.cgi?id=157324
 

Modified: trunk/Source/_javascript_Core/runtime/Lookup.h (200405 => 200406)


--- trunk/Source/_javascript_Core/runtime/Lookup.h	2016-05-04 02:23:28 UTC (rev 200405)
+++ trunk/Source/_javascript_Core/runtime/Lookup.h	2016-05-04 05:01:08 UTC (rev 200406)
@@ -293,9 +293,10 @@
 // 'slot.thisValue()' is the object the put was originally performed on (in the case of a proxy, the proxy itself).
 inline bool putEntry(ExecState* exec, const HashTableValue* entry, JSObject* base, JSObject* thisValue, PropertyName propertyName, JSValue value, PutPropertySlot& slot)
 {
-    if (entry->attributes() & BuiltinOrFunction) {
+    if (entry->attributes() & BuiltinOrFunctionOrLazyProperty) {
         if (!(entry->attributes() & ReadOnly)) {
-            // If this is a function put it as an override property.
+            // If this is a function or lazy property put then we just do the put because
+            // logically the object already had the property, so this is just a replace.
             if (JSObject* thisObject = jsDynamicCast<JSObject*>(thisValue))
                 thisObject->putDirect(exec->vm(), propertyName, value);
             return true;

Modified: trunk/Source/_javascript_Core/runtime/PropertySlot.h (200405 => 200406)


--- trunk/Source/_javascript_Core/runtime/PropertySlot.h	2016-05-04 02:23:28 UTC (rev 200405)
+++ trunk/Source/_javascript_Core/runtime/PropertySlot.h	2016-05-04 05:01:08 UTC (rev 200406)
@@ -50,6 +50,7 @@
     ClassStructure    = 1 << 12, // property is a lazy class structure - only used by static hashtables
     PropertyCallback  = 1 << 13, // property that is a lazy property callback - only used by static hashtables
     BuiltinOrFunction = Builtin | Function, // helper only used by static hashtables
+    BuiltinOrFunctionOrLazyProperty = Builtin | Function | CellProperty | ClassStructure | PropertyCallback, // helper only used by static hashtables
     BuiltinOrFunctionOrAccessorOrLazyProperty = Builtin | Function | Accessor | CellProperty | ClassStructure | PropertyCallback, // helper only used by static hashtables
     BuiltinOrFunctionOrAccessorOrLazyPropertyOrConstant = Builtin | Function | Accessor | CellProperty | ClassStructure | PropertyCallback | ConstantInteger // helper only used by static hashtables
 };
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to