LoAF: slightly improve names for event listeners
Event targets with id/src expose that attribute as part of the name.
(early feedback is that event target names are not specific enough)
Bug: 1392685
Change-Id: Ie7dd908bc148411c592eea95248c806d54d7146c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4358015
Reviewed-by: Yoav Weiss <yoavweiss@chromium.org>
Commit-Queue: Noam Rosenthal <nrosenthal@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1119859}
diff --git a/long-animation-frame/tentative/loaf-event-listener.html b/long-animation-frame/tentative/loaf-event-listener.html
index 6349c28..f866a1d 100644
--- a/long-animation-frame/tentative/loaf-event-listener.html
+++ b/long-animation-frame/tentative/loaf-event-listener.html
@@ -17,9 +17,20 @@
img.addEventListener("load", () => {
busy_wait();
});
+ img.id = "image";
document.body.appendChild(img);
t.add_cleanup(() => img.remove());
-}, "IMG.onload");
+}, "IMG#image.onload");
+
+test_self_event_listener(t => {
+ const img = document.createElement("img");
+ img.src = "/images/green.png";
+ img.addEventListener("load", () => {
+ busy_wait();
+ });
+ document.body.appendChild(img);
+ t.add_cleanup(() => img.remove());
+}, "IMG[src=/images/green.png].onload");
test_self_event_listener(t => {
const xhr = new XMLHttpRequest();
diff --git a/long-animation-frame/tentative/loaf-first-ui-event.html b/long-animation-frame/tentative/loaf-first-ui-event.html
index f2d8dac..b30b645 100644
--- a/long-animation-frame/tentative/loaf-first-ui-event.html
+++ b/long-animation-frame/tentative/loaf-first-ui-event.html
@@ -91,7 +91,7 @@
document.body.appendChild(img);
t.add_cleanup(() => img.remove());
return promise;
- }, s => s.name === "IMG.onload", t);
+ }, s => s.name === "IMG[src=/images/green.png].onload", t);
const [entry] = await entryPromise;
assert_equals(entry.firstUIEventTimestamp, 0);