Title: [110521] trunk/LayoutTests
Revision
110521
Author
[email protected]
Date
2012-03-12 18:16:08 -0700 (Mon, 12 Mar 2012)

Log Message

Object.defineProperty doesn't respect attributes when applied to the Global Object
https://bugs.webkit.org/show_bug.cgi?id=38636
Object.defineProperty doesn't create property on Global Object in the presence of a setter in the prototype chain
https://bugs.webkit.org/show_bug.cgi?id=48911

Rubber stamped by Michael Saboff.

* fast/js/Object-defineProperty-expected.txt:
* fast/js/script-tests/Object-defineProperty.js:
    - Added test cases for bugs #38636 & #48911.

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (110520 => 110521)


--- trunk/LayoutTests/ChangeLog	2012-03-13 01:13:57 UTC (rev 110520)
+++ trunk/LayoutTests/ChangeLog	2012-03-13 01:16:08 UTC (rev 110521)
@@ -1,3 +1,16 @@
+2012-03-12  Gavin Barraclough  <[email protected]>
+
+        Object.defineProperty doesn't respect attributes when applied to the Global Object
+        https://bugs.webkit.org/show_bug.cgi?id=38636
+        Object.defineProperty doesn't create property on Global Object in the presence of a setter in the prototype chain
+        https://bugs.webkit.org/show_bug.cgi?id=48911
+
+        Rubber stamped by Michael Saboff.
+
+        * fast/js/Object-defineProperty-expected.txt:
+        * fast/js/script-tests/Object-defineProperty.js:
+            - Added test cases for bugs #38636 & #48911.
+
 2012-03-12  Dirk Pranke  <[email protected]>
 
         Remove obsolete chromium-gpu-* platform directories for LayoutTests baselines.

Modified: trunk/LayoutTests/fast/js/Object-defineProperty-expected.txt (110520 => 110521)


--- trunk/LayoutTests/fast/js/Object-defineProperty-expected.txt	2012-03-13 01:13:57 UTC (rev 110520)
+++ trunk/LayoutTests/fast/js/Object-defineProperty-expected.txt	2012-03-13 01:16:08 UTC (rev 110521)
@@ -125,6 +125,28 @@
 PASS 'use strict'; var a = Object.defineProperty([42], '0', {writable: false}); a[0] = false; a[0]; threw exception TypeError: Attempted to assign to readonly property..
 PASS var a = Object.defineProperty([], '0', {set: undefined}); a[0] = 42; a[0]; is undefined.
 PASS 'use strict'; var a = Object.defineProperty([], '0', {set: undefined}); a[0] = 42; a[0]; threw exception TypeError: Attempted to assign to readonly property..
+PASS anObj.slot1 is "foo"
+PASS anObj.slot2 is "bar"
+PASS anObj.propertyIsEnumerable('slot1') is true
+PASS anObj.propertyIsEnumerable('slot2') is false
+PASS anObj.slot4 is "goo"
+PASS anObj.slot5 is 123
+PASS anObj._Slot5 is 123
+PASS Object.getOwnPropertyDescriptor(anObj, 'slot5') is undefined.
+PASS anObj.slot5 is 456
+PASS anObj._Slot5 is 123
+PASS Object.getOwnPropertyDescriptor(anObj, 'slot5').value is 456
+PASS anObj.slot1 is "foo"
+PASS anObj.slot2 is "bar"
+PASS anObj.propertyIsEnumerable('slot1') is true
+PASS anObj.propertyIsEnumerable('slot2') is false
+PASS anObj.slot4 is "goo"
+PASS anObj.slot5 is 123
+PASS anObj._Slot5 is 123
+PASS Object.getOwnPropertyDescriptor(anObj, 'slot5') is undefined.
+PASS anObj.slot5 is 456
+PASS anObj._Slot5 is 123
+PASS Object.getOwnPropertyDescriptor(anObj, 'slot5').value is 456
 PASS successfullyParsed is true
 
 TEST COMPLETE

Modified: trunk/LayoutTests/fast/js/script-tests/Object-defineProperty.js (110520 => 110521)


--- trunk/LayoutTests/fast/js/script-tests/Object-defineProperty.js	2012-03-13 01:13:57 UTC (rev 110520)
+++ trunk/LayoutTests/fast/js/script-tests/Object-defineProperty.js	2012-03-13 01:16:08 UTC (rev 110521)
@@ -183,3 +183,34 @@
 // If array property is an undefined setter, [[Put]] should fail.
 shouldBeUndefined("var a = Object.defineProperty([], '0', {set: undefined}); a[0] = 42; a[0];");
 shouldThrow("'use strict'; var a = Object.defineProperty([], '0', {set: undefined}); a[0] = 42; a[0];");
+
+function testObject()
+{
+    // Test case from https://bugs.webkit.org/show_bug.cgi?id=38636
+    Object.defineProperty(anObj, 'slot1', {value: 'foo', enumerable: true});
+    Object.defineProperty(anObj, 'slot2', {value: 'bar', writable: true}); 
+    Object.defineProperty(anObj, 'slot3', {value: 'baz', enumerable: false}); 
+    Object.defineProperty(anObj, 'slot4', {value: 'goo', configurable: false}); 
+    shouldBe("anObj.slot1", '"foo"');
+    shouldBe("anObj.slot2", '"bar"');
+    anObj.slot2 = 'bad value';
+    shouldBeTrue("anObj.propertyIsEnumerable('slot1')");
+    shouldBeFalse("anObj.propertyIsEnumerable('slot2')");
+    delete anObj.slot4;
+    shouldBe("anObj.slot4", '"goo"');
+
+    // Test case from https://bugs.webkit.org/show_bug.cgi?id=48911
+    Object.defineProperty(Object.getPrototypeOf(anObj), 'slot5', {get: function() { return this._Slot5; }, set: function(v) { this._Slot5 = v; }, configurable: false}); 
+    anObj.slot5 = 123;
+    shouldBe("anObj.slot5", '123');
+    shouldBe("anObj._Slot5", '123');
+    shouldBeUndefined("Object.getOwnPropertyDescriptor(anObj, 'slot5')");
+    Object.defineProperty(anObj, 'slot5', { value: 456 });
+    shouldBe("anObj.slot5", '456');
+    shouldBe("anObj._Slot5", '123');
+    shouldBe("Object.getOwnPropertyDescriptor(anObj, 'slot5').value", '456');
+}
+var anObj = {};
+testObject();
+var anObj = this;
+testObject();
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to