| Index: third_party/WebKit/LayoutTests/custom-elements/spec/state-failed-upgrade.html
|
| diff --git a/third_party/WebKit/LayoutTests/custom-elements/spec/state-failed-upgrade.html b/third_party/WebKit/LayoutTests/custom-elements/spec/state-failed-upgrade.html
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..995ee272ea2a87d5ddfcf3a51a08282c01718bd2
|
| --- /dev/null
|
| +++ b/third_party/WebKit/LayoutTests/custom-elements/spec/state-failed-upgrade.html
|
| @@ -0,0 +1,41 @@
|
| +<!DOCTYPE html>
|
| +<title>Custom Elements: Custom Element State "Failed" in Upgrades</title>
|
| +<script src="../../resources/testharness.js"></script>
|
| +<script src="../../resources/testharnessreport.js"></script>
|
| +<script src="resources/custom-elements-helpers.js"></script>
|
| +<body>
|
| +<script>
|
| +'use strict';
|
| +
|
| +// Custom Element State
|
| +// https://dom.spec.whatwg.org/#concept-element-custom-element-state
|
| +
|
| +test_with_window(w => {
|
| + let document = w.document;
|
| + let element = document.createElement('a-a');
|
| +
|
| + let constructorCount = 0;
|
| + w.customElements.define('a-a', class extends w.HTMLElement {
|
| + constructor() {
|
| + constructorCount++;
|
| + throw new Error();
|
| + }
|
| + connectedCallback() {
|
| + assert_unreached('connectedCallback should not be invoked if constructor threw');
|
| + }
|
| + });
|
| +
|
| + // Upgrade calls the constructor.
|
| + // 9. If constructResult is an abrupt completion, then
|
| + // Set element's custom element state to "failed".
|
| + // https://html.spec.whatwg.org/multipage/scripting.html#upgrades
|
| + let container = document.body;
|
| + container.appendChild(element);
|
| + assert_equals(constructorCount, 1, 'constructor should be invoked once');
|
| +
|
| + // "failed" is not "defined"
|
| + // https://dom.spec.whatwg.org/#concept-element-defined
|
| + assert_false(element.matches(':defined'));
|
| +});
|
| +</script>
|
| +</body>
|
|
|