Bug 1531256 [wpt PR 15516] - custom-elements: Update CustomElementRegistry.html for 'disabledFeatures'., a=testonly
☠☠ backed out by 66b1aba3fb43 ☠ ☠
authorKent Tamura <tkent@chromium.org>
Wed, 06 Mar 2019 16:52:51 +0000
changeset 464352 91b75e0e8324befa1731b448285c8bcc9411d410
parent 464351 7b01e9d570dbbe04f891e4ddf22e866123dbc570
child 464353 bdbfea4121229e6a2f68711e0d3ccbfe1edd9f47
push id35713
push usercbrindusan@mozilla.com
push dateFri, 15 Mar 2019 21:55:43 +0000
treeherdermozilla-central@66b1aba3fb43 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstestonly
bugs1531256, 15516, 15123, 905922, 1482361, 635380
milestone67.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1531256 [wpt PR 15516] - custom-elements: Update CustomElementRegistry.html for 'disabledFeatures'., a=testonly Automatic update from web-platform-tests custom-elements: Update CustomElementRegistry.html for 'disabledFeatures'. This change is for https://github.com/whatwg/html/pull/4324, and a follow-up of https://github.com/web-platform-tests/wpt/pull/15123 Bug: crbug.com/905922 Change-Id: I3eceb5d21ab555c23ed877ded17d359fe004e2aa Reviewed-on: https://chromium-review.googlesource.com/c/1482361 Auto-Submit: Kent Tamura <tkent@chromium.org> Reviewed-by: Hayato Ito <hayato@chromium.org> Commit-Queue: Kent Tamura <tkent@chromium.org> Cr-Commit-Position: refs/heads/master@{#635380} -- wpt-commits: 1aa5413b0c0a03d3c93e07d18bf8cc78e19ca611 wpt-pr: 15516
testing/web-platform/tests/custom-elements/CustomElementRegistry.html
--- a/testing/web-platform/tests/custom-elements/CustomElementRegistry.html
+++ b/testing/web-platform/tests/custom-elements/CustomElementRegistry.html
@@ -323,17 +323,19 @@ test(function () {
         get: function (target, name) {
             constructorCalls.push(callOrder++);    
             constructorCalls.push(name);
             return target[name];
         }
     });
     customElements.define('element-with-attribute-changed-callback', proxy);
     assert_array_equals(prototypeCalls, [1, 'connectedCallback', 2, 'disconnectedCallback', 3, 'adoptedCallback', 4, 'attributeChangedCallback']);
-    assert_array_equals(constructorCalls, [0, 'prototype', 5, 'observedAttributes']);
+    assert_array_equals(constructorCalls, [0, 'prototype',
+                                           5, 'observedAttributes',
+                                           6, 'disabledFeatures']);
 }, 'customElements.define must get "observedAttributes" property on the constructor prototype when "attributeChangedCallback" is present');
 
 test(function () {
     var constructor = function () {}
     constructor.prototype.attributeChangedCallback = function () { };
     var calls = [];
     var proxy = new Proxy(constructor, {
         get: function (target, name) {
@@ -384,16 +386,63 @@ test(function () {
 
 test(function () {
     var constructor = function () {}
     constructor.observedAttributes = 1;
     customElements.define('element-without-callback-with-invalid-observed-attributes', constructor);
 }, 'customElements.define must not throw even if "observedAttributes" fails to convert if "attributeChangedCallback" is not defined');
 
 test(function () {
+    var constructor = function () {}
+    var calls = [];
+    var proxy = new Proxy(constructor, {
+        get: function (target, name) {
+            calls.push(name);
+            if (name == 'disabledFeatures')
+                throw {name: 'expectedError'};
+            return target[name];
+        }
+    });
+    assert_throws({'name': 'expectedError'}, () => customElements.define('element-with-throwing-disabled-features', proxy));
+    assert_array_equals(calls, ['prototype', 'disabledFeatures'],
+        'customElements.define must get "prototype" and "disabledFeatures" on the constructor');
+}, 'customElements.define must rethrow an exception thrown while getting disabledFeatures on the constructor prototype');
+
+test(function () {
+    var constructor = function () {}
+    var calls = [];
+    var proxy = new Proxy(constructor, {
+        get: function (target, name) {
+            calls.push(name);
+            if (name == 'disabledFeatures')
+                return 1;
+            return target[name];
+        }
+    });
+    assert_throws({'name': 'TypeError'}, () => customElements.define('element-with-invalid-disabled-features', proxy));
+    assert_array_equals(calls, ['prototype', 'disabledFeatures'],
+        'customElements.define must get "prototype" and "disabledFeatures" on the constructor');
+}, 'customElements.define must rethrow an exception thrown while converting the value of disabledFeatures to sequence<DOMString>');
+
+test(function () {
+    var constructor = function () {}
+    constructor.disabledFeatures = {[Symbol.iterator]: function *() {
+        yield 'foo';
+        throw {name: 'SomeError'};
+    }};
+    assert_throws({'name': 'SomeError'}, () => customElements.define('element-with-generator-disabled-features', constructor));
+}, 'customElements.define must rethrow an exception thrown while iterating over disabledFeatures to sequence<DOMString>');
+
+test(function () {
+    var constructor = function () {}
+    constructor.disabledFeatures = {[Symbol.iterator]: 1};
+    assert_throws({'name': 'TypeError'}, () => customElements.define('element-with-disabled-features-with-uncallable-iterator', constructor));
+}, 'customElements.define must rethrow an exception thrown while retrieving Symbol.iterator on disabledFeatures');
+
+test(function () {
     class MyCustomElement extends HTMLElement {};
     customElements.define('my-custom-element', MyCustomElement);
 
     var instance = new MyCustomElement;
     assert_true(instance instanceof MyCustomElement,
         'An instance of a custom HTML element be an instance of the associated interface');
 
     assert_true(instance instanceof HTMLElement,