Index: third_party/WebKit/LayoutTests/imported/wpt/custom-elements/custom-elements-registry/define.html |
diff --git a/third_party/WebKit/LayoutTests/imported/wpt/custom-elements/custom-elements-registry/define.html b/third_party/WebKit/LayoutTests/imported/wpt/custom-elements/custom-elements-registry/define.html |
index 76ab2adfd7454080ea059fdebef9f457d7585818..e04df1fea6749da61e188216407a484b530b177b 100644 |
--- a/third_party/WebKit/LayoutTests/imported/wpt/custom-elements/custom-elements-registry/define.html |
+++ b/third_party/WebKit/LayoutTests/imported/wpt/custom-elements/custom-elements-registry/define.html |
@@ -56,26 +56,7 @@ |
}, `If constructor is ${t[0]}, should throw a TypeError`); |
}); |
- // 2. If constructor is an interface object or named constructor whose corresponding |
- // interface either is HTMLElement or has HTMLElement in its set of inherited interfaces, |
- // throw a TypeError and abort these steps. |
- [ |
- [ 'HTMLElement', HTMLElement ], |
- [ 'HTMLButtonElement', HTMLButtonElement ], |
- [ 'HTMLImageElement', HTMLImageElement ], |
- [ 'HTMLMediaElement', HTMLMediaElement ], |
- [ 'Image' , Image ], |
- [ 'Audio' , Audio ], |
- [ 'Option', Option ], |
- ].forEach(t => { |
- test(() => { |
- assert_throws(expectTypeError, () => { |
- customElements.define(`test-define-constructor-${t[0]}`, t[1]); |
- }); |
- }, `If constructor is ${t[0]}, should throw a TypeError`); |
- }); |
- |
- // 3. If name is not a valid custom element name, |
+ // 2. If name is not a valid custom element name, |
// then throw a SyntaxError and abort these steps. |
let validCustomElementNames = [ |
// [a-z] (PCENChar)* '-' (PCENChar)* |
@@ -129,7 +110,7 @@ |
}, `Element names: defining an element named ${name} should throw a SyntaxError`); |
}); |
- // 4. If this CustomElementsRegistry contains an entry with name name, |
+ // 3. If this CustomElementsRegistry contains an entry with name name, |
// then throw a NotSupportedError and abort these steps. |
test(() => { |
customElements.define('test-define-dup-name', class {}); |
@@ -138,7 +119,7 @@ |
}); |
}, 'If the name is already defined, should throw a NotSupportedError'); |
- // 6. If this CustomElementsRegistry contains an entry with constructor constructor, |
+ // 5. If this CustomElementsRegistry contains an entry with constructor constructor, |
// then throw a NotSupportedError and abort these steps. |
test(() => { |
class TestDupConstructor {}; |
@@ -148,7 +129,7 @@ |
}); |
}, 'If the constructor is already defined, should throw a NotSupportedError'); |
- // 10.1. If extends is a valid custom element name, |
+ // 9.1. If extends is a valid custom element name, |
// then throw a NotSupportedError. |
validCustomElementNames.forEach(name => { |
test(() => { |
@@ -158,7 +139,7 @@ |
}, `If extends is ${name}, should throw a NotSupportedError`); |
}); |
- // 10.2. If the element interface for extends and the HTML namespace is HTMLUnknownElement |
+ // 9.2. If the element interface for extends and the HTML namespace is HTMLUnknownElement |
// (e.g., if extends does not indicate an element definition in this specification), |
// then throw a NotSupportedError. |
[ |
@@ -178,7 +159,7 @@ |
}, `If extends is ${name}, should throw a NotSupportedError`); |
}); |
- // 13.1. Let prototype be Get(constructor, "prototype"). Rethrow any exceptions. |
+ // 12.1. Let prototype be Get(constructor, "prototype"). Rethrow any exceptions. |
function assert_rethrown(func, description) { |
assert_throws({ name: 'rethrown' }, func, description); |
} |
@@ -198,7 +179,7 @@ |
}); |
}, 'If constructor.prototype throws, should rethrow'); |
- // 13.2. If Type(prototype) is not Object, |
+ // 12.2. If Type(prototype) is not Object, |
// then throw a TypeError exception. |
test(() => { |
const c = (function () { }).bind({}); // prototype is undefined. |
@@ -214,24 +195,18 @@ |
}); |
}, 'If Type(constructor.prototype) is string, should throw a TypeError'); |
- // 13.4. Let connectedCallbackValue be Get(prototype, "connectedCallback"). |
- // Rethrow any exceptions. |
- // 13.5. If connectedCallbackValue is not undefined, then set connectedCallback |
- // to the result of converting connectedCallbackValue to the Web IDL Function callback type. |
- // Rethrow any exceptions. |
- // 13.6. Let disconnectedCallbackValue be Get(prototype, "disconnectedCallback"). |
- // Rethrow any exceptions. |
- // 13.7. If disconnectedCallbackValue is not undefined, then set disconnectedCallback |
- // to the result of converting disconnectedCallbackValue to the Web IDL Function callback type. |
- // Rethrow any exceptions. |
- // 13.8. Let attributeChangedCallbackValue be Get(prototype, "attributeChangedCallback"). |
- // Rethrow any exceptions. |
- // 13.9. If attributeChangedCallbackValue is not undefined, then set attributeChangedCallback |
- // to the result of converting attributeChangedCallbackValue to the Web IDL Function callback type. |
- // Rethrow any exceptions. |
+ // 12.3. Let lifecycleCallbacks be a map with the four keys "connectedCallback", |
+ // "disconnectedCallback", "adoptedCallback", and "attributeChangedCallback", |
+ // each of which belongs to an entry whose value is null. |
+ // 12.4. For each of the four keys callbackName in lifecycleCallbacks: |
+ // 12.4.1. Let callbackValue be Get(prototype, callbackName). Rethrow any exceptions. |
+ // 12.4.2. If callbackValue is not undefined, then set the value of the entry in |
+ // lifecycleCallbacks with key callbackName to the result of converting callbackValue |
+ // to the Web IDL Function callback type. Rethrow any exceptions from the conversion. |
[ |
'connectedCallback', |
'disconnectedCallback', |
+ 'adoptedCallback', |
'attributeChangedCallback', |
].forEach(name => { |
test(() => { |