Changeset 204045 in webkit


Ignore:
Timestamp:
Aug 2, 2016 3:23:22 PM (8 years ago)
Author:
Chris Dumez
Message:

Named / Indexed properties should be configurable
https://bugs.webkit.org/show_bug.cgi?id=160457

Reviewed by Darin Adler.

LayoutTests/imported/w3c:

Rebaseline several W3C tests now that more checks are passing.

  • web-platform-tests/dom/nodes/Document-getElementsByTagName-expected.txt:
  • web-platform-tests/dom/nodes/Element-getElementsByTagName-expected.txt:

Source/WebCore:

Report Named / Indexed properties as being configurable to comply with
the Web IDL specification:

Firefox and Chrome also report them as being configurable.

No new tests, rebaselined existing tests.

  • bindings/scripts/CodeGeneratorJS.pm:

(GenerateGetOwnPropertySlotBody):

LayoutTests:

Update / rebaseline existing tests to reflect behavior change.

  • fast/dom/NodeList/nodelist-name-getter-properties-expected.txt:
  • fast/dom/NodeList/nodelist-name-getter-properties.html:
  • js/dom/getOwnPropertyDescriptor-expected.txt:
  • js/resources/getOwnPropertyDescriptor.js:
Location:
trunk
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r204044 r204045  
     12016-08-02  Chris Dumez  <cdumez@apple.com>
     2
     3        Named / Indexed properties should be configurable
     4        https://bugs.webkit.org/show_bug.cgi?id=160457
     5
     6        Reviewed by Darin Adler.
     7
     8        Update / rebaseline existing tests to reflect behavior change.
     9
     10        * fast/dom/NodeList/nodelist-name-getter-properties-expected.txt:
     11        * fast/dom/NodeList/nodelist-name-getter-properties.html:
     12        * js/dom/getOwnPropertyDescriptor-expected.txt:
     13        * js/resources/getOwnPropertyDescriptor.js:
     14
    1152016-08-02  Anders Carlsson  <andersca@apple.com>
    216
  • trunk/LayoutTests/fast/dom/NodeList/nodelist-name-getter-properties-expected.txt

    r162801 r204045  
    44
    55
    6 PASS Object.getOwnPropertyDescriptor(NodeList, 'aWildId').configurable is false
     6PASS Object.getOwnPropertyDescriptor(NodeList, 'aWildId').configurable is true
    77PASS Object.getOwnPropertyDescriptor(NodeList, 'aWildId').enumerable is false
    88PASS Object.getOwnPropertyDescriptor(NodeList, 'aWildId').writable is false
  • trunk/LayoutTests/fast/dom/NodeList/nodelist-name-getter-properties.html

    r162801 r204045  
    1111var NodeList = document.getElementsByTagName('div');
    1212
    13 shouldBe("Object.getOwnPropertyDescriptor(NodeList, 'aWildId').configurable", 'false');
    14 shouldBe("Object.getOwnPropertyDescriptor(NodeList, 'aWildId').enumerable", 'false');
    15 shouldBe("Object.getOwnPropertyDescriptor(NodeList, 'aWildId').writable", 'false');
     13shouldBeTrue("Object.getOwnPropertyDescriptor(NodeList, 'aWildId').configurable");
     14shouldBeFalse("Object.getOwnPropertyDescriptor(NodeList, 'aWildId').enumerable");
     15shouldBeFalse("Object.getOwnPropertyDescriptor(NodeList, 'aWildId').writable");
    1616</script>
    1717<script src="../../../resources/js-test-post.js"></script>
  • trunk/LayoutTests/imported/w3c/ChangeLog

    r204034 r204045  
     12016-08-02  Chris Dumez  <cdumez@apple.com>
     2
     3        Named / Indexed properties should be configurable
     4        https://bugs.webkit.org/show_bug.cgi?id=160457
     5
     6        Reviewed by Darin Adler.
     7
     8        Rebaseline several W3C tests now that more checks are passing.
     9
     10        * web-platform-tests/dom/nodes/Document-getElementsByTagName-expected.txt:
     11        * web-platform-tests/dom/nodes/Element-getElementsByTagName-expected.txt:
     12
    1132016-08-02  Chris Dumez  <cdumez@apple.com>
    214
  • trunk/LayoutTests/imported/w3c/web-platform-tests/dom/nodes/Document-getElementsByTagName-expected.txt

    r204034 r204045  
    99PASS Should be able to set expando shadowing a proto prop (item)
    1010PASS Should be able to set expando shadowing a proto prop (namedItem)
    11 FAIL hasOwnProperty, getOwnPropertyDescriptor, getOwnPropertyNames assert_true: desc.configurable expected true got false
     11PASS hasOwnProperty, getOwnPropertyDescriptor, getOwnPropertyNames
    1212PASS HTML element with uppercase tagName never matches in HTML Documents
    1313PASS Element in non-HTML namespace, no prefix, lowercase name
  • trunk/LayoutTests/imported/w3c/web-platform-tests/dom/nodes/Element-getElementsByTagName-expected.txt

    r200309 r204045  
    99PASS Should be able to set expando shadowing a proto prop (item)
    1010PASS Should be able to set expando shadowing a proto prop (namedItem)
    11 FAIL hasOwnProperty, getOwnPropertyDescriptor, getOwnPropertyNames assert_true: desc.configurable expected true got false
     11PASS hasOwnProperty, getOwnPropertyDescriptor, getOwnPropertyNames
    1212PASS HTML element with uppercase tagName never matches in HTML Documents
    1313PASS Element in non-HTML namespace, no prefix, lowercase name
  • trunk/LayoutTests/js/dom/getOwnPropertyDescriptor-expected.txt

    r201702 r204045  
    135135PASS Object.getOwnPropertyDescriptor(document.getElementsByTagName('div'), 0).hasOwnProperty('set') is false
    136136PASS Object.getOwnPropertyDescriptor(document.getElementsByTagName('div'), 0).enumerable is true
    137 PASS Object.getOwnPropertyDescriptor(document.getElementsByTagName('div'), 0).configurable is false
     137PASS Object.getOwnPropertyDescriptor(document.getElementsByTagName('div'), 0).configurable is true
    138138PASS Object.getOwnPropertyDescriptor(document.getElementsByClassName('pass'), 0).value is document.getElementsByClassName('pass')[0]
    139139PASS Object.getOwnPropertyDescriptor(document.getElementsByClassName('pass'), 0).hasOwnProperty('get') is false
    140140PASS Object.getOwnPropertyDescriptor(document.getElementsByClassName('pass'), 0).hasOwnProperty('set') is false
    141141PASS Object.getOwnPropertyDescriptor(document.getElementsByClassName('pass'), 0).enumerable is true
    142 PASS Object.getOwnPropertyDescriptor(document.getElementsByClassName('pass'), 0).configurable is false
     142PASS Object.getOwnPropertyDescriptor(document.getElementsByClassName('pass'), 0).configurable is true
    143143PASS Object.getOwnPropertyDescriptor(canvasPixelArray, 0).value is canvasPixelArray[0]
    144144PASS Object.getOwnPropertyDescriptor(canvasPixelArray, 0).hasOwnProperty('get') is false
     
    150150PASS Object.getOwnPropertyDescriptor(select, 0).hasOwnProperty('set') is false
    151151PASS Object.getOwnPropertyDescriptor(select, 0).enumerable is true
    152 PASS Object.getOwnPropertyDescriptor(select, 0).configurable is false
     152PASS Object.getOwnPropertyDescriptor(select, 0).configurable is true
    153153PASS Object.getOwnPropertyDescriptor(objectWithGetter, 'getter').get is getterFunc
    154154PASS Object.getOwnPropertyDescriptor(objectWithGetter, 'getter').set is undefined
  • trunk/LayoutTests/js/resources/getOwnPropertyDescriptor.js

    r201702 r204045  
    4646descriptorShouldBe("global", "'XMLHttpRequest'", {writable: true, enumerable: false, configurable: true, value:"XMLHttpRequest"});
    4747descriptorShouldBe("global", "0", {writable: true, enumerable: false, configurable: false, value:"global[0]"});
    48 descriptorShouldBe("document.getElementsByTagName('div')", "0", {writable: false, enumerable: true, configurable: false, value:"document.getElementsByTagName('div')[0]"});
    49 descriptorShouldBe("document.getElementsByClassName('pass')", "0", {writable: false, enumerable: true, configurable: false, value:"document.getElementsByClassName('pass')[0]"});
     48descriptorShouldBe("document.getElementsByTagName('div')", "0", {writable: false, enumerable: true, configurable: true, value:"document.getElementsByTagName('div')[0]"});
     49descriptorShouldBe("document.getElementsByClassName('pass')", "0", {writable: false, enumerable: true, configurable: true, value:"document.getElementsByClassName('pass')[0]"});
    5050var canvas = document.createElement("canvas");
    5151var canvasPixelArray = canvas.getContext("2d").createImageData(10,10).data;
     
    5353var select = document.createElement("select");
    5454select.innerHTML = "<option>foo</option>";
    55 descriptorShouldBe("select", "0", {writable: true, enumerable: true, configurable: false, value:"select[0]"});
     55descriptorShouldBe("select", "0", {writable: true, enumerable: true, configurable: true, value:"select[0]"});
    5656
    5757var objectWithGetter = {};
  • trunk/Source/WebCore/ChangeLog

    r204044 r204045  
     12016-08-02  Chris Dumez  <cdumez@apple.com>
     2
     3        Named / Indexed properties should be configurable
     4        https://bugs.webkit.org/show_bug.cgi?id=160457
     5
     6        Reviewed by Darin Adler.
     7
     8        Report Named / Indexed properties as being configurable to comply with
     9        the Web IDL specification:
     10        - http://heycam.github.io/webidl/#getownproperty-guts (step 1. and 2.)
     11
     12        Firefox and Chrome also report them as being configurable.
     13
     14        No new tests, rebaselined existing tests.
     15
     16        * bindings/scripts/CodeGeneratorJS.pm:
     17        (GenerateGetOwnPropertySlotBody):
     18
    1192016-08-02  Anders Carlsson  <andersca@apple.com>
    220
  • trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm

    r204043 r204045  
    318318        # Assume that if there's a setter, the index will be writable
    319319        if ($interface->extendedAttributes->{"CustomIndexedSetter"}) {
    320             push(@getOwnPropertySlotImpl, "        unsigned attributes = ${namespaceMaybe}DontDelete;\n");
     320            push(@getOwnPropertySlotImpl, "        unsigned attributes = 0;\n");
    321321        } else {
    322             push(@getOwnPropertySlotImpl, "        unsigned attributes = ${namespaceMaybe}DontDelete | ${namespaceMaybe}ReadOnly;\n");
     322            push(@getOwnPropertySlotImpl, "        unsigned attributes = ${namespaceMaybe}ReadOnly;\n");
    323323        }
    324324        push(@getOwnPropertySlotImpl, "        slot.setValue(thisObject, attributes, " . GetIndexedGetterExpression($indexedGetterFunction) . ");\n");
     
    345345        push(@getOwnPropertySlotImpl, "        JSValue value;\n");
    346346        push(@getOwnPropertySlotImpl, "        if (thisObject->nameGetter(state, propertyName, value)) {\n");
    347         push(@getOwnPropertySlotImpl, "            slot.setValue(thisObject, ReadOnly | DontDelete | DontEnum, value);\n");
     347        push(@getOwnPropertySlotImpl, "            slot.setValue(thisObject, ReadOnly | DontEnum, value);\n");
    348348        push(@getOwnPropertySlotImpl, "            return true;\n");
    349349        push(@getOwnPropertySlotImpl, "        }\n");
  • trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCustomNamedGetter.cpp

    r202281 r204045  
    137137        JSValue value;
    138138        if (thisObject->nameGetter(state, propertyName, value)) {
    139             slot.setValue(thisObject, ReadOnly | DontDelete | DontEnum, value);
     139            slot.setValue(thisObject, ReadOnly | DontEnum, value);
    140140            return true;
    141141        }
  • trunk/Source/WebCore/bindings/scripts/test/JS/JSTestEventTarget.cpp

    r202281 r204045  
    127127    if (optionalIndex && optionalIndex.value() < thisObject->wrapped().length()) {
    128128        unsigned index = optionalIndex.value();
    129         unsigned attributes = DontDelete | ReadOnly;
     129        unsigned attributes = ReadOnly;
    130130        slot.setValue(thisObject, attributes, toJS(state, thisObject->globalObject(), thisObject->wrapped().item(index)));
    131131        return true;
     
    140140        JSValue value;
    141141        if (thisObject->nameGetter(state, propertyName, value)) {
    142             slot.setValue(thisObject, ReadOnly | DontDelete | DontEnum, value);
     142            slot.setValue(thisObject, ReadOnly | DontEnum, value);
    143143            return true;
    144144        }
  • trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp

    r204028 r204045  
    13511351    if (optionalIndex) {
    13521352        unsigned index = optionalIndex.value();
    1353         unsigned attributes = DontDelete | ReadOnly;
     1353        unsigned attributes = ReadOnly;
    13541354        slot.setValue(thisObject, attributes, jsStringOrUndefined(state, thisObject->wrapped().item(index)));
    13551355        return true;
  • trunk/Source/WebCore/bindings/scripts/test/JS/JSTestOverrideBuiltins.cpp

    r203797 r204045  
    133133        JSValue value;
    134134        if (thisObject->nameGetter(state, propertyName, value)) {
    135             slot.setValue(thisObject, ReadOnly | DontDelete | DontEnum, value);
     135            slot.setValue(thisObject, ReadOnly | DontEnum, value);
    136136            return true;
    137137        }
Note: See TracChangeset for help on using the changeset viewer.