Changeset 260670 in webkit


Ignore:
Timestamp:
Apr 24, 2020 2:41:32 PM (4 years ago)
Author:
Alexey Shvayka
Message:

Re-sync wpt/WebIDL/ecmascript-binding and wpt/custom-elements/htmlconstructor from upstream
https://bugs.webkit.org/show_bug.cgi?id=210984

Reviewed by Darin Adler.

web-platform-tests revision: 39e9c51041a1

  • web-platform-tests/WebIDL/ecmascript-binding/*: Updated.
  • web-platform-tests/custom-elements/htmlconstructor/*: Updated.
Location:
trunk/LayoutTests/imported/w3c
Files:
24 added
1 deleted
15 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/imported/w3c/ChangeLog

    r260662 r260670  
     12020-04-24  Alexey Shvayka  <shvaikalesh@gmail.com>
     2
     3        Re-sync wpt/WebIDL/ecmascript-binding and wpt/custom-elements/htmlconstructor from upstream
     4        https://bugs.webkit.org/show_bug.cgi?id=210984
     5
     6        Reviewed by Darin Adler.
     7
     8        web-platform-tests revision: 39e9c51041a1
     9
     10        * web-platform-tests/WebIDL/ecmascript-binding/*: Updated.
     11        * web-platform-tests/custom-elements/htmlconstructor/*: Updated.
     12
    1132020-04-24  Antoine Quint  <graouts@apple.com>
    214
  • trunk/LayoutTests/imported/w3c/web-platform-tests/WebIDL/ecmascript-binding/es-exceptions/DOMException-custom-bindings.any.js

    r219598 r260670  
    22
    33test(() => {
    4   assert_throws(new TypeError(), () => DOMException());
     4  assert_throws_js(TypeError, () => DOMException());
    55}, "Cannot construct without new");
    66
     
    2727  const getter = Object.getOwnPropertyDescriptor(DOMException.prototype, "message").get;
    2828
    29   assert_throws(new TypeError(), () => getter.apply({}));
     29  assert_throws_js(TypeError, () => getter.apply({}));
    3030}, "message getter performs brand checks (i.e. is not [LenientThis]");
    3131
     
    4444  const getter = Object.getOwnPropertyDescriptor(DOMException.prototype, "name").get;
    4545
    46   assert_throws(new TypeError(), () => getter.apply({}));
     46  assert_throws_js(TypeError, () => getter.apply({}));
    4747}, "name getter performs brand checks (i.e. is not [LenientThis]");
    4848
     
    6161  const getter = Object.getOwnPropertyDescriptor(DOMException.prototype, "code").get;
    6262
    63   assert_throws(new TypeError(), () => getter.apply({}));
     63  assert_throws_js(TypeError, () => getter.apply({}));
    6464}, "code getter performs brand checks (i.e. is not [LenientThis]");
    6565
     
    9999
    100100test(() => {
    101   assert_throws(new TypeError(), () => DOMException.prototype.toString());
     101  assert_throws_js(TypeError, () => DOMException.prototype.toString());
    102102}, "DOMException.prototype.toString() applied to DOMException.prototype throws because of name/message brand checks");
    103103
  • trunk/LayoutTests/imported/w3c/web-platform-tests/WebIDL/ecmascript-binding/es-exceptions/exceptions.html

    r219598 r260670  
    1010 * This file just picks one case where browsers are supposed to throw an
    1111 * exception, and tests the heck out of whether it meets the spec.  In the
    12  * future, all these checks should be in assert_throws(), but we don't want
    13  * every browser failing every assert_throws() check until they fix every
     12 * future, all these checks should be in assert_throws_dom(), but we don't want
     13 * every browser failing every assert_throws_dom() check until they fix every
    1414 * single bug in their exception-throwing.
    1515 *
  • trunk/LayoutTests/imported/w3c/web-platform-tests/WebIDL/ecmascript-binding/global-immutable-prototype.any.js

    r253783 r260670  
    1111test(() => {
    1212  for (const object of objects) {
    13     assert_throws(new TypeError(), () => {
     13    assert_throws_js(TypeError, () => {
    1414      Object.setPrototypeOf(object, {});
    1515    });
  • trunk/LayoutTests/imported/w3c/web-platform-tests/WebIDL/ecmascript-binding/interface-prototype-object-expected.txt

    r253783 r260670  
    11
    2 FAIL The class string of an interface prototype object is the concatenation of the interface's identifier and the string 'Prototype'. assert_true: An interface prototype object should have toStringTag property. expected true got false
    32PASS [Unscopable] extended attribute makes @@unscopables object on the prototype object, whose prototype is null.
    43
  • trunk/LayoutTests/imported/w3c/web-platform-tests/WebIDL/ecmascript-binding/interface-prototype-object.html

    r253783 r260670  
    66<script src="/resources/testharnessreport.js"></script>
    77<script>
    8 // A specification issue was raised for this behavior.
    9 // https://www.w3.org/Bugs/Public/show_bug.cgi?id=28244
    10 test(function() {
    11   // Checks toString() behavior.
    12   assert_class_string(Document.prototype, "DocumentPrototype");
    13 
    14   assert_true(Document.prototype.hasOwnProperty(Symbol.toStringTag),
    15               "An interface prototype object should have toStringTag property.");
    16   assert_equals(Document.prototype[Symbol.toStringTag], "DocumentPrototype");
    17 }, "The class string of an interface prototype object is the concatenation of " +
    18    "the interface's identifier and the string 'Prototype'.");
    19 
    208test(function() {
    219  // https://heycam.github.io/webidl/#create-an-interface-prototype-object
  • trunk/LayoutTests/imported/w3c/web-platform-tests/WebIDL/ecmascript-binding/iterator-prototype-object-expected.txt

    r253855 r260670  
    33PASS next() exists and is writable, enumerable, and configurable
    44PASS next() throws TypeError when called on ineligible receiver
    5 PASS Object.prototype.toString returns correct value
    6 PASS @@toStringTag has correct value
    75PASS Is specific to an interface
    86
  • trunk/LayoutTests/imported/w3c/web-platform-tests/WebIDL/ecmascript-binding/iterator-prototype-object.html

    r232641 r260670  
    2424  const iteratorProto = Object.getPrototypeOf(usp.entries());
    2525
    26   assert_throws(new TypeError(), () => {
     26  assert_throws_js(TypeError, () => {
    2727    iteratorProto.next();
    2828  });
    29   assert_throws(new TypeError(), () => {
     29  assert_throws_js(TypeError, () => {
    3030    iteratorProto.next.call(undefined);
    3131  });
    32   assert_throws(new TypeError(), () => {
     32  assert_throws_js(TypeError, () => {
    3333    iteratorProto.next.call(42);
    3434  });
    35   assert_throws(new TypeError(), () => {
     35  assert_throws_js(TypeError, () => {
    3636    iteratorProto.next.call(new Headers().entries());
    3737  });
    3838}, "next() throws TypeError when called on ineligible receiver");
    3939
    40 test(() => {
    41   const iteratorProto = Object.getPrototypeOf(new URLSearchParams().entries());
    42   assert_equals(Object.prototype.toString.call(iteratorProto), "[object URLSearchParams Iterator]");
    43 }, "Object.prototype.toString returns correct value");
    44 
    45 test(() => {
    46   const iteratorProto = Object.getPrototypeOf(new URLSearchParams().entries());
    47   assert_equals(Object.getOwnPropertyDescriptor(iteratorProto, Symbol.toStringTag).value, "URLSearchParams Iterator");
    48   // Property attributes have not yet been fully spec'd.
    49 }, "@@toStringTag has correct value");
     40// class string behavior tested in a dedicated file
    5041
    5142test(() => {
  • trunk/LayoutTests/imported/w3c/web-platform-tests/WebIDL/ecmascript-binding/legacy-callback-interface-object.html

    r217225 r260670  
    2424
    2525test(() => {
    26   assert_throws(new TypeError(), () => NodeFilter(), "call");
    27   assert_throws(new TypeError(), () => new NodeFilter(), "construct");
     26  assert_throws_js(TypeError, () => NodeFilter(), "call");
     27  assert_throws_js(TypeError, () => new NodeFilter(), "construct");
    2828}, "Must throw a TypeError when called or constructed")
    2929
     
    6060  // OrdinaryHasInstance throws a TypeError if the right-hand-side doesn't have a .prototype object,
    6161  // which is the case for callback interfaces.
    62   assert_throws(new TypeError(), () => {
     62  assert_throws_js(TypeError, () => {
    6363    (function () { }) instanceof NodeFilter;
    6464  });
    65   assert_throws(new TypeError(), () => {
     65  assert_throws_js(TypeError, () => {
    6666    ({ }) instanceof NodeFilter;
    6767  });
  • trunk/LayoutTests/imported/w3c/web-platform-tests/WebIDL/ecmascript-binding/put-forwards-expected.txt

    r217895 r260670  
    66PASS Exception propagation from setter of [PutForwards] target attribute
    77PASS TypeError when getter of [PutForwards] attribute returns non-object
     8PASS Does not throw when setter of [PutForwards] attribute returns false
     9PASS Setting a.relList to noreferrer is reflected in rel
     10PASS Setting area.relList to noreferrer is reflected in rel
     11FAIL Setting form.relList to noreferrer is reflected in rel assert_true: The attribute is a DOMTokenList expected true got false
     12PASS Setting link.relList to stylesheet is reflected in rel
    813
  • trunk/LayoutTests/imported/w3c/web-platform-tests/WebIDL/ecmascript-binding/put-forwards.html

    r217225 r260670  
    7878  });
    7979
    80   assert_throws(new SyntaxError(), () => {
     80  assert_throws_js(SyntaxError, () => {
    8181    element.style = "color: green";
    8282  });
     
    9595  });
    9696
    97   assert_throws(new SyntaxError(), () => {
     97  assert_throws_js(SyntaxError, () => {
    9898    element.style = "color: green";
    9999  });
     
    111111  });
    112112
    113   assert_throws(new TypeError(), () => {
     113  assert_throws_js(TypeError, () => {
    114114    element.style = "color: green";
    115115  });
    116116}, "TypeError when getter of [PutForwards] attribute returns non-object");
     117
     118
     119test(() => {
     120  var element = document.createElement("div");
     121
     122  var element_style = element.style;
     123  Object.defineProperty(element.style, "cssText", {
     124    value: null,
     125    writable: false,
     126  });
     127
     128  element.style = "color: green";
     129  assert_equals(element.style, element_style);
     130  assert_equals(element.style.cssText, null);
     131}, "Does not throw when setter of [PutForwards] attribute returns false");
     132
     133function test_token_list(elementName, attribute, target, value) {
     134  test(() => {
     135    var element=document.createElement(elementName);
     136    assert_true(element[attribute] instanceof DOMTokenList,"The attribute is a DOMTokenList");
     137    element[attribute]=value;
     138    assert_equals(element.getAttribute(target),value,"Setting the attribute is reflected in the target");
     139    element[attribute]="";
     140    assert_equals(element.getAttribute(target),"","Clearing the attribute is reflected in the target");
     141  },"Setting "+elementName+"."+attribute+" to "+value+" is reflected in "+target)
     142}
     143
     144test_token_list("a","relList","rel","noreferrer");
     145test_token_list("area","relList","rel","noreferrer");
     146test_token_list("form","relList","rel","noreferrer");
     147test_token_list("link","relList","rel","stylesheet");
    117148</script>
  • trunk/LayoutTests/imported/w3c/web-platform-tests/WebIDL/ecmascript-binding/sequence-conversion.html

    r253783 r260670  
    152152test(t => {
    153153  // Should fail rather than falling back to record
    154   assert_throws(new TypeError(), function() { new URLSearchParams(["key", "value"]); });
     154  assert_throws_js(TypeError, function() { new URLSearchParams(["key", "value"]); });
    155155}, "A string array in sequence<sequence> or record");
    156156
  • trunk/LayoutTests/imported/w3c/web-platform-tests/WebIDL/ecmascript-binding/w3c-import.log

    r253783 r260670  
    1515------------------------------------------------------------------------
    1616List of files:
     17/LayoutTests/imported/w3c/web-platform-tests/WebIDL/ecmascript-binding/class-string-interface.any.js
     18/LayoutTests/imported/w3c/web-platform-tests/WebIDL/ecmascript-binding/class-string-iterator-prototype-object.any.js
     19/LayoutTests/imported/w3c/web-platform-tests/WebIDL/ecmascript-binding/class-string-named-properties-object.window.js
    1720/LayoutTests/imported/w3c/web-platform-tests/WebIDL/ecmascript-binding/constructors.html
    1821/LayoutTests/imported/w3c/web-platform-tests/WebIDL/ecmascript-binding/default-iterator-object.html
     
    2427/LayoutTests/imported/w3c/web-platform-tests/WebIDL/ecmascript-binding/iterator-prototype-object.html
    2528/LayoutTests/imported/w3c/web-platform-tests/WebIDL/ecmascript-binding/legacy-callback-interface-object.html
    26 /LayoutTests/imported/w3c/web-platform-tests/WebIDL/ecmascript-binding/legacy-platform-object.html
    2729/LayoutTests/imported/w3c/web-platform-tests/WebIDL/ecmascript-binding/no-regexp-special-casing.any.js
    2830/LayoutTests/imported/w3c/web-platform-tests/WebIDL/ecmascript-binding/put-forwards.html
  • trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/htmlconstructor/newtarget-expected.txt

    r234957 r260670  
    33PASS Rethrow any exceptions thrown while getting the prototype
    44PASS If prototype is not object (null), derives the fallback from NewTarget's realm (autonomous custom elements)
     5FAIL If prototype is not object (null), derives the fallback from NewTarget's GetFunctionRealm (autonomous custom elements) assert_equals: Must use the HTMLElement from the realm of NewTarget expected object "[object HTMLElementPrototype]" but got object "[object HTMLElementPrototype]"
    56PASS If prototype is not object (undefined), derives the fallback from NewTarget's realm (autonomous custom elements)
     7FAIL If prototype is not object (undefined), derives the fallback from NewTarget's GetFunctionRealm (autonomous custom elements) assert_equals: Must use the HTMLElement from the realm of NewTarget expected object "[object HTMLElementPrototype]" but got object "[object HTMLElementPrototype]"
    68PASS If prototype is not object (5), derives the fallback from NewTarget's realm (autonomous custom elements)
     9FAIL If prototype is not object (5), derives the fallback from NewTarget's GetFunctionRealm (autonomous custom elements) assert_equals: Must use the HTMLElement from the realm of NewTarget expected object "[object HTMLElementPrototype]" but got object "[object HTMLElementPrototype]"
    710PASS If prototype is not object (string), derives the fallback from NewTarget's realm (autonomous custom elements)
     11FAIL If prototype is not object (string), derives the fallback from NewTarget's GetFunctionRealm (autonomous custom elements) assert_equals: Must use the HTMLElement from the realm of NewTarget expected object "[object HTMLElementPrototype]" but got object "[object HTMLElementPrototype]"
    812FAIL If prototype is not object (null), derives the fallback from NewTarget's realm (customized built-in elements) promise_test: Unhandled rejection with value: object "TypeError: Reflect.construct requires the first argument be a constructor"
     13FAIL If prototype is not object (null), derives the fallback from NewTarget's GetFunctionRealm (customized built-in elements) promise_test: Unhandled rejection with value: object "TypeError: Reflect.construct requires the first argument be a constructor"
    914FAIL If prototype is not object (undefined), derives the fallback from NewTarget's realm (customized built-in elements) promise_test: Unhandled rejection with value: object "TypeError: Reflect.construct requires the first argument be a constructor"
     15FAIL If prototype is not object (undefined), derives the fallback from NewTarget's GetFunctionRealm (customized built-in elements) promise_test: Unhandled rejection with value: object "TypeError: Reflect.construct requires the first argument be a constructor"
    1016FAIL If prototype is not object (5), derives the fallback from NewTarget's realm (customized built-in elements) promise_test: Unhandled rejection with value: object "TypeError: Reflect.construct requires the first argument be a constructor"
     17FAIL If prototype is not object (5), derives the fallback from NewTarget's GetFunctionRealm (customized built-in elements) promise_test: Unhandled rejection with value: object "TypeError: Reflect.construct requires the first argument be a constructor"
    1118FAIL If prototype is not object (string), derives the fallback from NewTarget's realm (customized built-in elements) promise_test: Unhandled rejection with value: object "TypeError: Reflect.construct requires the first argument be a constructor"
     19FAIL If prototype is not object (string), derives the fallback from NewTarget's GetFunctionRealm (customized built-in elements) promise_test: Unhandled rejection with value: object "TypeError: Reflect.construct requires the first argument be a constructor"
    1220PASS HTMLParagraphElement constructor must not get .prototype until it finishes its extends sanity checks, calling proxy constructor directly
    1321PASS HTMLParagraphElement constructor must not get .prototype until it finishes its extends sanity checks, calling via Reflect
  • trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/htmlconstructor/newtarget.html

    r234039 r260670  
    4141  let throws = false;
    4242
     43  let err = { name: "prototype throws" };
    4344  function TestElement() {
    4445    throws = true;
    45     assert_throws({ name: "prototype throws" }, () => {
     46    assert_throws_exactly(err, () => {
    4647      Reflect.construct(w.HTMLElement, [], new.target);
    4748    });
     
    5152    get: function (target, name) {
    5253      if (throws && name == "prototype")
    53         throw { name: "prototype throws" };
     54        throw err;
    5455      return target[name];
    5556    }
     
    9293    new ElementWithDynamicPrototype();
    9394  }, "If prototype is not object (" + notAnObject + "), derives the fallback from NewTarget's realm (autonomous custom elements)");
     95
     96  test_with_window(w => {
     97    // We have to return an object during define(), but not during super()
     98    let returnNotAnObject = false;
     99
     100    function TestElement() {
     101      const o = Reflect.construct(w.HTMLElement, [], new.target);
     102
     103      assert_equals(Object.getPrototypeOf(new.target), window.Function.prototype);
     104      assert_equals(Object.getPrototypeOf(o), window.HTMLElement.prototype,
     105        "Must use the HTMLElement from the realm of NewTarget");
     106      assert_not_equals(Object.getPrototypeOf(o), w.HTMLElement.prototype,
     107        "Must not use the HTMLElement from the realm of the active function object (w.HTMLElement)");
     108
     109      return o;
     110    }
     111
     112    // Create the proxy in the subframe, which should not affect what our
     113    // prototype ends up as.
     114    const ElementWithDynamicPrototype = new w.Proxy(TestElement, {
     115      get: function (target, name) {
     116        if (name == "prototype")
     117          return returnNotAnObject ? notAnObject : {};
     118        return target[name];
     119      }
     120    });
     121
     122    w.customElements.define("test-element", ElementWithDynamicPrototype);
     123
     124    returnNotAnObject = true;
     125    new ElementWithDynamicPrototype();
     126  }, "If prototype is not object (" + notAnObject + "), derives the fallback from NewTarget's GetFunctionRealm (autonomous custom elements)");
    94127});
    95128
     
    123156    new ElementWithDynamicPrototype();
    124157  }, "If prototype is not object (" + notAnObject + "), derives the fallback from NewTarget's realm (customized built-in elements)");
     158
     159  test_with_window(w => {
     160    // We have to return an object during define(), but not during super()
     161    let returnNotAnObject = false;
     162
     163    function TestElement() {
     164      const o = Reflect.construct(w.HTMLParagraphElement, [], new.target);
     165
     166      assert_equals(Object.getPrototypeOf(o), window.HTMLParagraphElement.prototype,
     167        "Must use the HTMLParagraphElement from the realm of NewTarget");
     168      assert_not_equals(Object.getPrototypeOf(o), w.HTMLParagraphElement.prototype,
     169        "Must not use the HTMLParagraphElement from the realm of the active function object (w.HTMLParagraphElement)");
     170
     171      return o;
     172    }
     173
     174    // Create the proxy in the subframe, which should not affect what our
     175    // prototype ends up as.
     176    const ElementWithDynamicPrototype = new w.Proxy(TestElement, {
     177      get: function (target, name) {
     178        if (name == "prototype")
     179          return returnNotAnObject ? notAnObject : {};
     180        return target[name];
     181      }
     182    });
     183
     184    w.customElements.define("test-element", ElementWithDynamicPrototype, { extends: "p" });
     185
     186    returnNotAnObject = true;
     187    new ElementWithDynamicPrototype();
     188  }, "If prototype is not object (" + notAnObject + "), derives the fallback from NewTarget's GetFunctionRealm (customized built-in elements)");
    125189});
    126190
     
    140204    // reset the counter.
    141205    getCount = 0;
    142     assert_throws({'name': 'TypeError'},
    143                   function () { new countingProxy() },
    144                   "Should not be able to construct an HTMLParagraphElement not named 'p'");
     206    assert_throws_js(TypeError,
     207                     function () { new countingProxy() },
     208                     "Should not be able to construct an HTMLParagraphElement not named 'p'");
    145209    assert_equals(getCount, 0, "Should never have gotten .prototype");
    146210}, 'HTMLParagraphElement constructor must not get .prototype until it finishes its extends sanity checks, calling proxy constructor directly');
     
    161225    // reset the counter.
    162226    getCount = 0;
    163     assert_throws({'name': 'TypeError'},
    164                   function () { Reflect.construct(HTMLParagraphElement, [], countingProxy) },
    165                   "Should not be able to construct an HTMLParagraphElement not named 'p'");
     227    assert_throws_js(TypeError,
     228                     function () { Reflect.construct(HTMLParagraphElement, [], countingProxy) },
     229                     "Should not be able to construct an HTMLParagraphElement not named 'p'");
    166230    assert_equals(getCount, 0, "Should never have gotten .prototype");
    167231}, 'HTMLParagraphElement constructor must not get .prototype until it finishes its extends sanity checks, calling via Reflect');
Note: See TracChangeset for help on using the changeset viewer.