Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Unified Diff: third_party/WebKit/LayoutTests/svg/custom/use-instanceRoot-event-listener-liveness.xhtml

Issue 2186823002: Do not call an event listener on a cloned node in svg <use>'s UA shadow tree (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: skip timeout test Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/svg/custom/use-instanceRoot-event-listener-liveness.xhtml
diff --git a/third_party/WebKit/LayoutTests/svg/custom/use-instanceRoot-event-listener-liveness.xhtml b/third_party/WebKit/LayoutTests/svg/custom/use-instanceRoot-event-listener-liveness.xhtml
index 62775aa49228b528c2dd61817f3c44c1a67b065b..695afaeff24819b39ace3e84ee9b83430e5c188e 100644
--- a/third_party/WebKit/LayoutTests/svg/custom/use-instanceRoot-event-listener-liveness.xhtml
+++ b/third_party/WebKit/LayoutTests/svg/custom/use-instanceRoot-event-listener-liveness.xhtml
@@ -19,10 +19,11 @@ if (window.testRunner) {
testRunner.waitUntilDone();
}
-function eventHandler()
+function eventHandler(event)
{
var divElement = document.getElementById("console");
- divElement.textContent = "Test passed";
+ if (event.target == document.getElementById("test"))
+ divElement.textContent = "Test passed";
if (window.testRunner)
testRunner.notifyDone();
@@ -30,8 +31,7 @@ function eventHandler()
function fireSimulatedMouseClickEvent(eventTarget)
{
- var event = document.createEvent("MouseEvents");
- event.initMouseEvent("click", true, true, document.defaultView, 1, 0, 0, 0, 0, false, false, false, false, 0, null);
+ var event = new MouseEvent("click", { composed: true, bubbles: true });
eventTarget.dispatchEvent(event);
}
@@ -43,8 +43,9 @@ function startTest() {
// No-op, as no listener is not yet registered
fireSimulatedMouseClickEvent(shadowRoot.firstChild);
- // Add listener
+ // Add listeners
shadowRoot.firstChild.addEventListener("click", eventHandler, false);
+ useElement.addEventListener("click", eventHandler, false);
// Should fire immediately and finish the test
fireSimulatedMouseClickEvent(shadowRoot.firstChild);

Powered by Google App Engine
This is Rietveld 408576698