[JSC] CSSStyleDeclaration report incorrect descriptor
authorrego@igalia.com <rego@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 14 Apr 2014 11:21:49 +0000 (11:21 +0000)
committerrego@igalia.com <rego@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 14 Apr 2014 11:21:49 +0000 (11:21 +0000)
https://bugs.webkit.org/show_bug.cgi?id=89697

Reviewed by Benjamin Poulain.

Source/WebCore:

Change descriptor of CSSStyleDeclaration properties in order to have
writable and enumerable attributes set to true. Configurable is kept to
false since the property is not deleteable.

Test: fast/dom/CSSStyleDeclaration/cssstyledeclaration-properties-descriptor.html

* bindings/js/JSCSSStyleDeclarationCustom.cpp:
(WebCore::JSCSSStyleDeclaration::getOwnPropertySlotDelegate): Only set
DontDelete attribute when creating the descriptor for
CSSStyleDeclaration properties.

LayoutTests:

Add new test to check the descriptor of CSSStyleDeclaration properties.

* fast/dom/CSSStyleDeclaration/cssstyledeclaration-properties-descriptor-expected.txt: Added.
* fast/dom/CSSStyleDeclaration/cssstyledeclaration-properties-descriptor.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@167240 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/fast/dom/CSSStyleDeclaration/cssstyledeclaration-properties-descriptor-expected.txt [new file with mode: 0644]
LayoutTests/fast/dom/CSSStyleDeclaration/cssstyledeclaration-properties-descriptor.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/bindings/js/JSCSSStyleDeclarationCustom.cpp

index a7b3dbe..f521ec3 100644 (file)
@@ -1,3 +1,15 @@
+2014-04-14  Manuel Rego Casasnovas  <rego@igalia.com>
+
+        [JSC] CSSStyleDeclaration report incorrect descriptor
+        https://bugs.webkit.org/show_bug.cgi?id=89697
+
+        Reviewed by Benjamin Poulain.
+
+        Add new test to check the descriptor of CSSStyleDeclaration properties.
+
+        * fast/dom/CSSStyleDeclaration/cssstyledeclaration-properties-descriptor-expected.txt: Added.
+        * fast/dom/CSSStyleDeclaration/cssstyledeclaration-properties-descriptor.html: Added.
+
 2014-04-14  Benjamin Poulain  <benjamin@webkit.org>
 
         CSS JIT: compile the :nth-child() pseudo class
diff --git a/LayoutTests/fast/dom/CSSStyleDeclaration/cssstyledeclaration-properties-descriptor-expected.txt b/LayoutTests/fast/dom/CSSStyleDeclaration/cssstyledeclaration-properties-descriptor-expected.txt
new file mode 100644 (file)
index 0000000..4f15de4
--- /dev/null
@@ -0,0 +1,12 @@
+This tests the descriptor of CSSStyleDeclaration properties.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS descriptor['writable'] is true
+PASS descriptor['enumerable'] is true
+PASS descriptor['configurable'] is false
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/dom/CSSStyleDeclaration/cssstyledeclaration-properties-descriptor.html b/LayoutTests/fast/dom/CSSStyleDeclaration/cssstyledeclaration-properties-descriptor.html
new file mode 100644 (file)
index 0000000..46d04d5
--- /dev/null
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<html>
+<body>
+    <script src="../../../resources/js-test-pre.js"></script>
+    <script>
+        description("This tests the descriptor of CSSStyleDeclaration properties.");
+
+        var descriptor = Object.getOwnPropertyDescriptor(document.body.style, 'color');
+        shouldBeTrue("descriptor['writable']");
+        shouldBeTrue("descriptor['enumerable']");
+        shouldBeFalse("descriptor['configurable']");
+    </script>
+    <script src="../../../resources/js-test-post.js"></script>
+</body>
+</html>
index 1b471fe..7067cb5 100644 (file)
@@ -1,3 +1,21 @@
+2014-04-14  Manuel Rego Casasnovas  <rego@igalia.com>
+
+        [JSC] CSSStyleDeclaration report incorrect descriptor
+        https://bugs.webkit.org/show_bug.cgi?id=89697
+
+        Reviewed by Benjamin Poulain.
+
+        Change descriptor of CSSStyleDeclaration properties in order to have
+        writable and enumerable attributes set to true. Configurable is kept to
+        false since the property is not deleteable.
+
+        Test: fast/dom/CSSStyleDeclaration/cssstyledeclaration-properties-descriptor.html
+
+        * bindings/js/JSCSSStyleDeclarationCustom.cpp:
+        (WebCore::JSCSSStyleDeclaration::getOwnPropertySlotDelegate): Only set
+        DontDelete attribute when creating the descriptor for
+        CSSStyleDeclaration properties.
+
 2014-04-14  Benjamin Poulain  <benjamin@webkit.org>
 
         [JSC] Improve the call site of string comparison in some hot path
index 6c7d235..7bc69bf 100644 (file)
@@ -336,9 +336,9 @@ bool JSCSSStyleDeclaration::getOwnPropertySlotDelegate(ExecState*, PropertyName
         return false;
 
     if (propertyInfo.hadPixelOrPosPrefix)
-        slot.setCustomIndex(this, ReadOnly | DontDelete | DontEnum, static_cast<unsigned>(propertyInfo.propertyID), cssPropertyGetterPixelOrPosPrefixCallback);
+        slot.setCustomIndex(this, DontDelete, static_cast<unsigned>(propertyInfo.propertyID), cssPropertyGetterPixelOrPosPrefixCallback);
     else
-        slot.setCustomIndex(this, ReadOnly | DontDelete | DontEnum, static_cast<unsigned>(propertyInfo.propertyID), cssPropertyGetterCallback);
+        slot.setCustomIndex(this, DontDelete, static_cast<unsigned>(propertyInfo.propertyID), cssPropertyGetterCallback);
     return true;
 }