Skip to content

Commit

Permalink
ASSERTION FAILED: !m_invoking in CustomElementQueue::add() on tv.yout…
Browse files Browse the repository at this point in the history
…ube.com

https://bugs.webkit.org/show_bug.cgi?id=237977

Reviewed by Wenson Hsieh.

The assertion failure was caused by ARIA reflection attributes not having CEReactions.
Fixed the bug and filed a spec bug: w3c/aria#1767

* LayoutTests/fast/custom-elements/reactions-for-aria-attributes-expected.txt: Added.
* LayoutTests/fast/custom-elements/reactions-for-aria-attributes.html: Added.
* LayoutTests/fast/custom-elements/reactions-for-aria-element-attributes-expected.txt: Added.
* LayoutTests/fast/custom-elements/reactions-for-aria-element-attributes.html: Added.
* Source/WebCore/accessibility/AriaAttributes.idl:

Canonical link: https://commits.webkit.org/252552@main
  • Loading branch information
rniwa committed Jul 17, 2022
1 parent b108181 commit a0165ae
Show file tree
Hide file tree
Showing 5 changed files with 274 additions and 47 deletions.
@@ -0,0 +1,78 @@

PASS ariaAtomic on Element must enqueue an attributeChanged reaction when adding aria-atomic content attribute
PASS ariaAtomic on Element must enqueue an attributeChanged reaction when replacing an existing attribute
PASS ariaAutoComplete on Element must enqueue an attributeChanged reaction when adding aria-autocomplete content attribute
PASS ariaAutoComplete on Element must enqueue an attributeChanged reaction when replacing an existing attribute
PASS ariaBusy on Element must enqueue an attributeChanged reaction when adding aria-busy content attribute
PASS ariaBusy on Element must enqueue an attributeChanged reaction when replacing an existing attribute
PASS ariaChecked on Element must enqueue an attributeChanged reaction when adding aria-checked content attribute
PASS ariaChecked on Element must enqueue an attributeChanged reaction when replacing an existing attribute
PASS ariaColCount on Element must enqueue an attributeChanged reaction when adding aria-colcount content attribute
PASS ariaColCount on Element must enqueue an attributeChanged reaction when replacing an existing attribute
PASS ariaColIndex on Element must enqueue an attributeChanged reaction when adding aria-colindex content attribute
PASS ariaColIndex on Element must enqueue an attributeChanged reaction when replacing an existing attribute
PASS ariaColSpan on Element must enqueue an attributeChanged reaction when adding aria-colspan content attribute
PASS ariaColSpan on Element must enqueue an attributeChanged reaction when replacing an existing attribute
PASS ariaCurrent on Element must enqueue an attributeChanged reaction when adding aria-current content attribute
PASS ariaCurrent on Element must enqueue an attributeChanged reaction when replacing an existing attribute
PASS ariaDisabled on Element must enqueue an attributeChanged reaction when adding aria-disabled content attribute
PASS ariaDisabled on Element must enqueue an attributeChanged reaction when replacing an existing attribute
PASS ariaExpanded on Element must enqueue an attributeChanged reaction when adding aria-expanded content attribute
PASS ariaExpanded on Element must enqueue an attributeChanged reaction when replacing an existing attribute
PASS ariaHasPopup on Element must enqueue an attributeChanged reaction when adding aria-haspopup content attribute
PASS ariaHasPopup on Element must enqueue an attributeChanged reaction when replacing an existing attribute
PASS ariaHidden on Element must enqueue an attributeChanged reaction when adding aria-hidden content attribute
PASS ariaHidden on Element must enqueue an attributeChanged reaction when replacing an existing attribute
PASS ariaInvalid on Element must enqueue an attributeChanged reaction when adding aria-invalid content attribute
PASS ariaInvalid on Element must enqueue an attributeChanged reaction when replacing an existing attribute
PASS ariaKeyShortcuts on Element must enqueue an attributeChanged reaction when adding aria-keyshortcuts content attribute
PASS ariaKeyShortcuts on Element must enqueue an attributeChanged reaction when replacing an existing attribute
PASS ariaLabel on Element must enqueue an attributeChanged reaction when adding aria-label content attribute
PASS ariaLabel on Element must enqueue an attributeChanged reaction when replacing an existing attribute
PASS ariaLevel on Element must enqueue an attributeChanged reaction when adding aria-level content attribute
PASS ariaLevel on Element must enqueue an attributeChanged reaction when replacing an existing attribute
PASS ariaLive on Element must enqueue an attributeChanged reaction when adding aria-live content attribute
PASS ariaLive on Element must enqueue an attributeChanged reaction when replacing an existing attribute
PASS ariaModal on Element must enqueue an attributeChanged reaction when adding aria-modal content attribute
PASS ariaModal on Element must enqueue an attributeChanged reaction when replacing an existing attribute
PASS ariaMultiLine on Element must enqueue an attributeChanged reaction when adding aria-multiline content attribute
PASS ariaMultiLine on Element must enqueue an attributeChanged reaction when replacing an existing attribute
PASS ariaMultiSelectable on Element must enqueue an attributeChanged reaction when adding aria-multiselectable content attribute
PASS ariaMultiSelectable on Element must enqueue an attributeChanged reaction when replacing an existing attribute
PASS ariaOrientation on Element must enqueue an attributeChanged reaction when adding aria-orientation content attribute
PASS ariaOrientation on Element must enqueue an attributeChanged reaction when replacing an existing attribute
PASS ariaPlaceholder on Element must enqueue an attributeChanged reaction when adding aria-placeholder content attribute
PASS ariaPlaceholder on Element must enqueue an attributeChanged reaction when replacing an existing attribute
PASS ariaPosInSet on Element must enqueue an attributeChanged reaction when adding aria-posinset content attribute
PASS ariaPosInSet on Element must enqueue an attributeChanged reaction when replacing an existing attribute
PASS ariaPressed on Element must enqueue an attributeChanged reaction when adding aria-pressed content attribute
PASS ariaPressed on Element must enqueue an attributeChanged reaction when replacing an existing attribute
PASS ariaReadOnly on Element must enqueue an attributeChanged reaction when adding aria-readonly content attribute
PASS ariaReadOnly on Element must enqueue an attributeChanged reaction when replacing an existing attribute
PASS ariaRelevant on Element must enqueue an attributeChanged reaction when adding aria-relevant content attribute
PASS ariaRelevant on Element must enqueue an attributeChanged reaction when replacing an existing attribute
PASS ariaRequired on Element must enqueue an attributeChanged reaction when adding aria-required content attribute
PASS ariaRequired on Element must enqueue an attributeChanged reaction when replacing an existing attribute
PASS ariaRoleDescription on Element must enqueue an attributeChanged reaction when adding aria-roledescription content attribute
PASS ariaRoleDescription on Element must enqueue an attributeChanged reaction when replacing an existing attribute
PASS ariaRowCount on Element must enqueue an attributeChanged reaction when adding aria-rowcount content attribute
PASS ariaRowCount on Element must enqueue an attributeChanged reaction when replacing an existing attribute
PASS ariaRowIndex on Element must enqueue an attributeChanged reaction when adding aria-rowindex content attribute
PASS ariaRowIndex on Element must enqueue an attributeChanged reaction when replacing an existing attribute
PASS ariaRowSpan on Element must enqueue an attributeChanged reaction when adding aria-rowspan content attribute
PASS ariaRowSpan on Element must enqueue an attributeChanged reaction when replacing an existing attribute
PASS ariaSelected on Element must enqueue an attributeChanged reaction when adding aria-selected content attribute
PASS ariaSelected on Element must enqueue an attributeChanged reaction when replacing an existing attribute
PASS ariaSetSize on Element must enqueue an attributeChanged reaction when adding aria-setsize content attribute
PASS ariaSetSize on Element must enqueue an attributeChanged reaction when replacing an existing attribute
PASS ariaSort on Element must enqueue an attributeChanged reaction when adding aria-sort content attribute
PASS ariaSort on Element must enqueue an attributeChanged reaction when replacing an existing attribute
PASS ariaValueMax on Element must enqueue an attributeChanged reaction when adding aria-valuemax content attribute
PASS ariaValueMax on Element must enqueue an attributeChanged reaction when replacing an existing attribute
PASS ariaValueMin on Element must enqueue an attributeChanged reaction when adding aria-valuemin content attribute
PASS ariaValueMin on Element must enqueue an attributeChanged reaction when replacing an existing attribute
PASS ariaValueNow on Element must enqueue an attributeChanged reaction when adding aria-valuenow content attribute
PASS ariaValueNow on Element must enqueue an attributeChanged reaction when replacing an existing attribute
PASS ariaValueText on Element must enqueue an attributeChanged reaction when adding aria-valuetext content attribute
PASS ariaValueText on Element must enqueue an attributeChanged reaction when replacing an existing attribute

@@ -0,0 +1,66 @@
<!DOCTYPE html>
<html>
<head>
<title>Custom Elements: CEReactions on Element interface</title>
<meta name="author" title="Ryosuke Niwa" href="mailto:rniwa@webkit.org">
<meta name="assert" content="String attributes of AriaAttributes interface must have CEReactions">
<meta name="help" content="https://dom.spec.whatwg.org/#element">
<meta name="help" content="https://w3c.github.io/DOM-Parsing/">
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="../../imported/w3c/web-platform-tests/custom-elements/resources/custom-elements-helpers.js"></script>
<script src="../../imported/w3c/web-platform-tests/custom-elements/reactions/resources/reactions.js"></script>
</head>
<body>
<div id="log"></div>
<div id="container"></div>
<script>

testReflectAttribute('ariaAtomic', 'aria-atomic', 'foo', 'bar', 'ariaAtomic on Element');
testReflectAttribute('ariaAutoComplete', 'aria-autocomplete', 'foo', 'bar', 'ariaAutoComplete on Element');
testReflectAttribute('ariaBusy', 'aria-busy', 'foo', 'bar', 'ariaBusy on Element');
testReflectAttribute('ariaChecked', 'aria-checked', 'foo', 'bar', 'ariaChecked on Element');
testReflectAttribute('ariaColCount', 'aria-colcount', 'foo', 'bar', 'ariaColCount on Element');
testReflectAttribute('ariaColIndex', 'aria-colindex', 'foo', 'bar', 'ariaColIndex on Element');
testReflectAttribute('ariaColSpan', 'aria-colspan', 'foo', 'bar', 'ariaColSpan on Element');

testReflectAttribute('ariaCurrent', 'aria-current', 'foo', 'bar', 'ariaCurrent on Element');

testReflectAttribute('ariaDisabled', 'aria-disabled', 'foo', 'bar', 'ariaDisabled on Element');

testReflectAttribute('ariaExpanded', 'aria-expanded', 'foo', 'bar', 'ariaExpanded on Element');

testReflectAttribute('ariaHasPopup', 'aria-haspopup', 'foo', 'bar', 'ariaHasPopup on Element');
testReflectAttribute('ariaHidden', 'aria-hidden', 'foo', 'bar', 'ariaHidden on Element');
testReflectAttribute('ariaInvalid', 'aria-invalid', 'foo', 'bar', 'ariaInvalid on Element');
testReflectAttribute('ariaKeyShortcuts', 'aria-keyshortcuts', 'foo', 'bar', 'ariaKeyShortcuts on Element');
testReflectAttribute('ariaLabel', 'aria-label', 'foo', 'bar', 'ariaLabel on Element');

testReflectAttribute('ariaLevel', 'aria-level', 'foo', 'bar', 'ariaLevel on Element');
testReflectAttribute('ariaLive', 'aria-live', 'foo', 'bar', 'ariaLive on Element');
testReflectAttribute('ariaModal', 'aria-modal', 'foo', 'bar', 'ariaModal on Element');
testReflectAttribute('ariaMultiLine', 'aria-multiline', 'foo', 'bar', 'ariaMultiLine on Element');
testReflectAttribute('ariaMultiSelectable', 'aria-multiselectable', 'foo', 'bar', 'ariaMultiSelectable on Element');
testReflectAttribute('ariaOrientation', 'aria-orientation', 'foo', 'bar', 'ariaOrientation on Element');

testReflectAttribute('ariaPlaceholder', 'aria-placeholder', 'foo', 'bar', 'ariaPlaceholder on Element');
testReflectAttribute('ariaPosInSet', 'aria-posinset', 'foo', 'bar', 'ariaPosInSet on Element');
testReflectAttribute('ariaPressed', 'aria-pressed', 'foo', 'bar', 'ariaPressed on Element');
testReflectAttribute('ariaReadOnly', 'aria-readonly', 'foo', 'bar', 'ariaReadOnly on Element');
testReflectAttribute('ariaRelevant', 'aria-relevant', 'foo', 'bar', 'ariaRelevant on Element');
testReflectAttribute('ariaRequired', 'aria-required', 'foo', 'bar', 'ariaRequired on Element');
testReflectAttribute('ariaRoleDescription', 'aria-roledescription', 'foo', 'bar', 'ariaRoleDescription on Element');
testReflectAttribute('ariaRowCount', 'aria-rowcount', 'foo', 'bar', 'ariaRowCount on Element');
testReflectAttribute('ariaRowIndex', 'aria-rowindex', 'foo', 'bar', 'ariaRowIndex on Element');
testReflectAttribute('ariaRowSpan', 'aria-rowspan', 'foo', 'bar', 'ariaRowSpan on Element');
testReflectAttribute('ariaSelected', 'aria-selected', 'foo', 'bar', 'ariaSelected on Element');
testReflectAttribute('ariaSetSize', 'aria-setsize', 'foo', 'bar', 'ariaSetSize on Element');
testReflectAttribute('ariaSort', 'aria-sort', 'foo', 'bar', 'ariaSort on Element');
testReflectAttribute('ariaValueMax', 'aria-valuemax', 'foo', 'bar', 'ariaValueMax on Element');
testReflectAttribute('ariaValueMin', 'aria-valuemin', 'foo', 'bar', 'ariaValueMin on Element');
testReflectAttribute('ariaValueNow', 'aria-valuenow', 'foo', 'bar', 'ariaValueNow on Element');
testReflectAttribute('ariaValueText', 'aria-valuetext', 'foo', 'bar', 'ariaValueText on Element');

</script>
</body>
</html>
@@ -0,0 +1,18 @@

PASS ariaActiveDescendantElement in Element must enqueue an attributeChanged reaction when adding aria-activedescendant content attribute
PASS ariaActiveDescendantElement in Element must enqueue an attributeChanged reaction when replacing an existing attribute
PASS ariaControlsElements in Element must enqueue an attributeChanged reaction when adding aria-controls content attribute
PASS ariaControlsElements in Element must enqueue an attributeChanged reaction when replacing an existing attribute
PASS ariaDescribedByElements in Element must enqueue an attributeChanged reaction when adding aria-describedby content attribute
PASS ariaDescribedByElements in Element must enqueue an attributeChanged reaction when replacing an existing attribute
PASS ariaDetailsElements in Element must enqueue an attributeChanged reaction when adding aria-details content attribute
PASS ariaDetailsElements in Element must enqueue an attributeChanged reaction when replacing an existing attribute
PASS ariaErrorMessageElement in Element must enqueue an attributeChanged reaction when adding aria-errormessage content attribute
PASS ariaErrorMessageElement in Element must enqueue an attributeChanged reaction when replacing an existing attribute
PASS ariaFlowToElements in Element must enqueue an attributeChanged reaction when adding aria-flowto content attribute
PASS ariaFlowToElements in Element must enqueue an attributeChanged reaction when replacing an existing attribute
PASS ariaLabelledByElements in Element must enqueue an attributeChanged reaction when adding aria-labelledby content attribute
PASS ariaLabelledByElements in Element must enqueue an attributeChanged reaction when replacing an existing attribute
PASS ariaOwnsElements in Element must enqueue an attributeChanged reaction when adding aria-owns content attribute
PASS ariaOwnsElements in Element must enqueue an attributeChanged reaction when replacing an existing attribute

@@ -0,0 +1,65 @@
<!DOCTYPE html><!-- webkit-test-runner [ AriaReflectionForElementReferencesEnabled=true ] -->
<html>
<head>
<title>Custom Elements: CEReactions on Element interface</title>
<meta name="author" title="Ryosuke Niwa" href="mailto:rniwa@webkit.org">
<meta name="assert" content="Element attributes of AriaAttributes interface must have CEReactions">
<meta name="help" content="https://dom.spec.whatwg.org/#element">
<meta name="help" content="https://w3c.github.io/DOM-Parsing/">
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="../../imported/w3c/web-platform-tests/custom-elements/resources/custom-elements-helpers.js"></script>
<script src="../../imported/w3c/web-platform-tests/custom-elements/reactions/resources/reactions.js"></script>
</head>
<body>
<div id="log"></div>
<div id="parentElement"></div>
<script>

function testElementReflectAttribute(jsAttributeName, contentAttributeName, validValue1, contentValue1, validValue2, contentValue2, name, getParentElement) {
test(function () {
let element = define_new_custom_element([contentAttributeName]);
let instance = document.createElement(element.name);
assert_array_equals(element.takeLog().types(), ['constructed']);
parentElement.appendChild(instance);
assert_array_equals(element.takeLog().types(), ['connected']);
instance[jsAttributeName] = validValue1;
let logEntries = element.takeLog();
assert_array_equals(logEntries.types(), ['attributeChanged']);

assert_attribute_log_entry(logEntries.last(), {name: contentAttributeName, oldValue: null, newValue: contentValue1, namespace: null});
}, name + ' must enqueue an attributeChanged reaction when adding ' + contentAttributeName + ' content attribute');

test(function () {
let element = define_new_custom_element([contentAttributeName]);
let instance = document.createElement(element.name);
parentElement.appendChild(instance);
instance[jsAttributeName] = validValue1;
assert_array_equals(element.takeLog().types(), ['constructed', 'connected', 'attributeChanged']);
instance[jsAttributeName] = validValue2;
var logEntries = element.takeLog();
assert_array_equals(logEntries.types(), ['attributeChanged']);
assert_attribute_log_entry(logEntries.last(), {name: contentAttributeName, oldValue: contentValue1, newValue: contentValue2, namespace: null});
}, name + ' must enqueue an attributeChanged reaction when replacing an existing attribute');
}

const dummy1 = document.createElement('div');
dummy1.id = 'dummy1';
document.body.appendChild(dummy1);

const dummy2 = document.createElement('div');
dummy2.id = 'dummy2';
document.body.appendChild(dummy2);

testElementReflectAttribute('ariaActiveDescendantElement', 'aria-activedescendant', dummy1, 'dummy1', dummy2, 'dummy2', 'ariaActiveDescendantElement in Element');
testElementReflectAttribute('ariaControlsElements', 'aria-controls', [dummy1], 'dummy1', [dummy2], 'dummy2', 'ariaControlsElements in Element');
testElementReflectAttribute('ariaDescribedByElements', 'aria-describedby', [dummy1], 'dummy1', [dummy2], 'dummy2', 'ariaDescribedByElements in Element');
testElementReflectAttribute('ariaDetailsElements', 'aria-details', [dummy1], 'dummy1', [dummy2], 'dummy2', 'ariaDetailsElements in Element');
testElementReflectAttribute('ariaErrorMessageElement', 'aria-errormessage', dummy1, 'dummy1', dummy2, 'dummy2', 'ariaErrorMessageElement in Element');
testElementReflectAttribute('ariaFlowToElements', 'aria-flowto', [dummy1], 'dummy1', [dummy2], 'dummy2', 'ariaFlowToElements in Element');
testElementReflectAttribute('ariaLabelledByElements', 'aria-labelledby', [dummy1], 'dummy1', [dummy2], 'dummy2', 'ariaLabelledByElements in Element')
testElementReflectAttribute('ariaOwnsElements', 'aria-owns', [dummy1], 'dummy1', [dummy2], 'dummy2', 'ariaOwnsElements in Element')

</script>
</body>
</html>

0 comments on commit a0165ae

Please sign in to comment.