Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a feature flag and about_flags entry to disable Mutation Events
Mutation events are being deprecated, and this feature allows testing with the events completely disabled. Bug: 1446498 Change-Id: Ia5584320f82b7eb1c7643b36a5edd47d4419b56e Cq-Do-Not-Cancel-Tryjobs: true Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4547496 Reviewed-by: David Baron <dbaron@chromium.org> Auto-Submit: Mason Freed <masonf@chromium.org> Commit-Queue: Mason Freed <masonf@chromium.org> Commit-Queue: David Baron <dbaron@chromium.org> Cr-Commit-Position: refs/heads/main@{#1147523}
- Loading branch information
Mason Freed
authored and
Chromium LUCI CQ
committed
May 22, 2023
1 parent
62e4362
commit e8de880
Showing
17 changed files
with
238 additions
and
49 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
53 changes: 53 additions & 0 deletions
53
third_party/blink/web_tests/fast/dom/mutation-events-usecounter.html
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
<!DOCTYPE html> | ||
<script src="../../resources/testharness.js"></script> | ||
<script src="../../resources/testharnessreport.js"></script> | ||
|
||
<div id=target>foo</div> | ||
|
||
<script> | ||
test(() => { | ||
const target = document.getElementById('target'); | ||
|
||
// From web_feature.mojom | ||
const kDOMSubtreeModifiedEvent = 143; | ||
const kDOMNodeInsertedEvent = 144; | ||
const kDOMNodeRemovedEvent = 145; | ||
const kDOMNodeRemovedFromDocumentEvent = 146; | ||
const kDOMNodeInsertedIntoDocumentEvent = 147; | ||
const kDOMCharacterDataModifiedEvent = 148; | ||
|
||
const events = [ | ||
{counter: kDOMSubtreeModifiedEvent, event: 'DOMSubtreeModified'}, | ||
{counter: kDOMNodeInsertedEvent, event: 'DOMNodeInserted'}, | ||
{counter: kDOMNodeRemovedEvent, event: 'DOMNodeRemoved'}, | ||
{counter: kDOMNodeRemovedFromDocumentEvent, event: 'DOMNodeRemovedFromDocument'}, | ||
{counter: kDOMNodeInsertedIntoDocumentEvent, event: 'DOMNodeInsertedIntoDocument'}, | ||
{counter: kDOMCharacterDataModifiedEvent, event: 'DOMCharacterDataModified'}, | ||
]; | ||
|
||
const expectedCounters = new Set(); | ||
function assertUseCounted(msg) { | ||
events.forEach(evt => { | ||
assert_equals(internals.isUseCounted(document, evt.counter), expectedCounters.has(evt.counter), evt.event + ', ' + msg); | ||
}); | ||
} | ||
function triggerThemAll() { | ||
target.remove(); | ||
document.body.appendChild(target); | ||
target.setAttribute('foo','bar'); | ||
target.removeAttribute('foo'); | ||
target.firstChild.textContent = "bar"; | ||
} | ||
|
||
assertUseCounted('initial'); | ||
triggerThemAll(); | ||
assertUseCounted('before event listeners attached'); | ||
events.forEach(evt => { | ||
target.addEventListener(evt.event,() => {}); | ||
expectedCounters.add(evt.counter); | ||
assertUseCounted('after adding ' + evt.event + ' listener, before firing'); | ||
triggerThemAll(); | ||
assertUseCounted('after adding ' + evt.event + ' listener, after firing (no difference)'); | ||
}); | ||
}, 'Use of Mutation Events is use counted.'); | ||
</script> |
4 changes: 4 additions & 0 deletions
4
third_party/blink/web_tests/virtual/mutation-events-disabled/README.md
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Overview | ||
|
||
This suite tests the case where Mutation Events are disabled via | ||
`--disable-blink-features=MutationEvents`. |
Oops, something went wrong.