MutationObserver.observe() incorrectly throws when attributeOldValue or characterDataOldValue is present with value false#66529
Merged
webkit-commit-queue merged 1 commit intoJun 5, 2026
Conversation
Collaborator
|
EWS run on current version of this PR (hash 787d63f) Details |
rniwa
approved these changes
Jun 5, 2026
Contributor
Author
|
Test upstreaming: web-platform-tests/wpt#60421 |
…or characterDataOldValue is present with value false https://bugs.webkit.org/show_bug.cgi?id=316382 Reviewed by Ryosuke Niwa. Per https://dom.spec.whatwg.org/#dom-mutationobserver-observe, if either attributeOldValue or attributeFilter is *present* in the init dictionary and attributes is omitted, attributes is set to true. The same applies to characterDataOldValue and characterData. "Present" here means the dictionary key was provided, regardless of its value. WebKit was conflating presence with truthiness: AttributeOldValue / CharacterDataOldValue option flags were only added when the value was true, and the auto-set step keyed off those flags rather than off presence. As a result, observe(node, { attributeOldValue: false }) — and likewise for characterDataOldValue: false — incorrectly threw a TypeError instead of registering an attribute observer with no old-value delivery. Use std::optional::has_value() to test presence in the auto-set step, matching Blink & Gecko's behavior and the spec. Test: imported/w3c/web-platform-tests/dom/nodes/MutationObserver-sanity.html * LayoutTests/imported/w3c/web-platform-tests/dom/nodes/MutationObserver-sanity-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/dom/nodes/MutationObserver-sanity.html: * Source/WebCore/dom/MutationObserver.cpp: (WebCore::MutationObserver::observe): Canonical link: https://commits.webkit.org/314623@main
787d63f to
a811f8d
Compare
Collaborator
|
Committed 314623@main (a811f8d): https://commits.webkit.org/314623@main Reviewed commits have been landed. Closing PR #66529 and removing active labels. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
a811f8d
787d63f
🧪 win-tests🧪 api-ios