Truly independent web browser
LibWeb: Keep the event target when propagating to non-node parents
Andreas Kling4146a280dbb3
diff --git a/Libraries/LibWeb/DOM/EventDispatcher.cpp b/Libraries/LibWeb/DOM/EventDispatcher.cppindex 29965db25a3..9dddd593f06 100644--- a/Libraries/LibWeb/DOM/EventDispatcher.cpp+++ b/Libraries/LibWeb/DOM/EventDispatcher.cpp@@ -347,7 +347,11 @@ bool EventDispatcher::dispatch(GC::Ref<EventTarget> target, Event& event, bool l}// 6. If parent is a Window object, or parent is a node and target’s root is a shadow-including inclusive ancestor of parent, then:+ // INTEROP: A parent that is neither a Window object nor a node, such as the transaction and the connection+ // an IndexedDB request propagates its events to, is handled like a Window object too. This keeps+ // the event's target as it propagates, as other browsers do.if (is<HTML::Window>(parent)+ || !is<Node>(parent)|| (is<Node>(parent) && as<Node>(*target).root().is_shadow_including_inclusive_ancestor_of(as<Node>(*parent)))) {// 1. If isActivationEvent is true, event’s bubbles attribute is true, activationTarget is null, and parent has activation behavior, then set activationTarget to parent.if (is_activation_event && event.bubbles() && !activation_target && parent->has_activation_behavior())diff --git a/Tests/LibWeb/Text/expected/wpt-import/IndexedDB/idbobjectstore_createIndex.any.txt b/Tests/LibWeb/Text/expected/wpt-import/IndexedDB/idbobjectstore_createIndex.any.txtindex a707ef583af..ab700fa0955 100644--- a/Tests/LibWeb/Text/expected/wpt-import/IndexedDB/idbobjectstore_createIndex.any.txt+++ b/Tests/LibWeb/Text/expected/wpt-import/IndexedDB/idbobjectstore_createIndex.any.txt@@ -2,15 +2,15 @@ Harness status: OKFound 21 tests-18 Pass-3 Fail+20 Pass+1 FailPass Returns an IDBIndex and the properties are set correctlyPass Attempt to create an index that requires unique values on an object store already contains duplicatesPass The index is usable right after being madeFail Event ordering for a later deleted indexPass Empty keyPath-Fail Event order when unique constraint is triggered-Fail Event ordering for ConstraintError on request+Pass Event order when unique constraint is triggered+Pass Event ordering for ConstraintError on requestPass Index can be valid keysPass IDBObjectStore.createIndex() - empty namePass If an index with the name name already exists in this object store, the implementation must throw a DOMException of type ConstraintErrordiff --git a/Tests/LibWeb/Text/expected/wpt-import/IndexedDB/idbobjectstore_createIndex.any.worker.txt b/Tests/LibWeb/Text/expected/wpt-import/IndexedDB/idbobjectstore_createIndex.any.worker.txtindex a707ef583af..ab700fa0955 100644--- a/Tests/LibWeb/Text/expected/wpt-import/IndexedDB/idbobjectstore_createIndex.any.worker.txt+++ b/Tests/LibWeb/Text/expected/wpt-import/IndexedDB/idbobjectstore_createIndex.any.worker.txt@@ -2,15 +2,15 @@ Harness status: OKFound 21 tests-18 Pass-3 Fail+20 Pass+1 FailPass Returns an IDBIndex and the properties are set correctlyPass Attempt to create an index that requires unique values on an object store already contains duplicatesPass The index is usable right after being madeFail Event ordering for a later deleted indexPass Empty keyPath-Fail Event order when unique constraint is triggered-Fail Event ordering for ConstraintError on request+Pass Event order when unique constraint is triggered+Pass Event ordering for ConstraintError on requestPass Index can be valid keysPass IDBObjectStore.createIndex() - empty namePass If an index with the name name already exists in this object store, the implementation must throw a DOMException of type ConstraintErrordiff --git a/Tests/LibWeb/Text/expected/wpt-import/IndexedDB/request_bubble-and-capture.any.sharedworker.txt b/Tests/LibWeb/Text/expected/wpt-import/IndexedDB/request_bubble-and-capture.any.sharedworker.txtindex f82ff137842..fda124c14f9 100644--- a/Tests/LibWeb/Text/expected/wpt-import/IndexedDB/request_bubble-and-capture.any.sharedworker.txt+++ b/Tests/LibWeb/Text/expected/wpt-import/IndexedDB/request_bubble-and-capture.any.sharedworker.txt@@ -2,5 +2,5 @@ Harness status: OKFound 1 tests-1 Fail-Fail IndexedDB Request Event Propagation: Bubbling and Capturing\ No newline at end of file+1 Pass+Pass IndexedDB Request Event Propagation: Bubbling and Capturing\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/IndexedDB/request_bubble-and-capture.any.txt b/Tests/LibWeb/Text/expected/wpt-import/IndexedDB/request_bubble-and-capture.any.txtindex f82ff137842..fda124c14f9 100644--- a/Tests/LibWeb/Text/expected/wpt-import/IndexedDB/request_bubble-and-capture.any.txt+++ b/Tests/LibWeb/Text/expected/wpt-import/IndexedDB/request_bubble-and-capture.any.txt@@ -2,5 +2,5 @@ Harness status: OKFound 1 tests-1 Fail-Fail IndexedDB Request Event Propagation: Bubbling and Capturing\ No newline at end of file+1 Pass+Pass IndexedDB Request Event Propagation: Bubbling and Capturing\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/IndexedDB/request_bubble-and-capture.any.worker.txt b/Tests/LibWeb/Text/expected/wpt-import/IndexedDB/request_bubble-and-capture.any.worker.txtindex f82ff137842..fda124c14f9 100644--- a/Tests/LibWeb/Text/expected/wpt-import/IndexedDB/request_bubble-and-capture.any.worker.txt+++ b/Tests/LibWeb/Text/expected/wpt-import/IndexedDB/request_bubble-and-capture.any.worker.txt@@ -2,5 +2,5 @@ Harness status: OKFound 1 tests-1 Fail-Fail IndexedDB Request Event Propagation: Bubbling and Capturing\ No newline at end of file+1 Pass+Pass IndexedDB Request Event Propagation: Bubbling and Capturing\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/IndexedDB/transaction-abort-request-error.any.sharedworker.txt b/Tests/LibWeb/Text/expected/wpt-import/IndexedDB/transaction-abort-request-error.any.sharedworker.txtindex f4e6f747ca6..1376d7962a2 100644--- a/Tests/LibWeb/Text/expected/wpt-import/IndexedDB/transaction-abort-request-error.any.sharedworker.txt+++ b/Tests/LibWeb/Text/expected/wpt-import/IndexedDB/transaction-abort-request-error.any.sharedworker.txt@@ -2,5 +2,5 @@ Harness status: OKFound 1 tests-1 Fail-Fail Properties of error events fired at requests when aborting a transaction\ No newline at end of file+1 Pass+Pass Properties of error events fired at requests when aborting a transaction\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/IndexedDB/transaction-abort-request-error.any.txt b/Tests/LibWeb/Text/expected/wpt-import/IndexedDB/transaction-abort-request-error.any.txtindex f4e6f747ca6..1376d7962a2 100644--- a/Tests/LibWeb/Text/expected/wpt-import/IndexedDB/transaction-abort-request-error.any.txt+++ b/Tests/LibWeb/Text/expected/wpt-import/IndexedDB/transaction-abort-request-error.any.txt@@ -2,5 +2,5 @@ Harness status: OKFound 1 tests-1 Fail-Fail Properties of error events fired at requests when aborting a transaction\ No newline at end of file+1 Pass+Pass Properties of error events fired at requests when aborting a transaction\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/IndexedDB/transaction-abort-request-error.any.worker.txt b/Tests/LibWeb/Text/expected/wpt-import/IndexedDB/transaction-abort-request-error.any.worker.txtindex f4e6f747ca6..1376d7962a2 100644--- a/Tests/LibWeb/Text/expected/wpt-import/IndexedDB/transaction-abort-request-error.any.worker.txt+++ b/Tests/LibWeb/Text/expected/wpt-import/IndexedDB/transaction-abort-request-error.any.worker.txt@@ -2,5 +2,5 @@ Harness status: OKFound 1 tests-1 Fail-Fail Properties of error events fired at requests when aborting a transaction\ No newline at end of file+1 Pass+Pass Properties of error events fired at requests when aborting a transaction\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/IndexedDB/transaction_bubble-and-capture.any.sharedworker.txt b/Tests/LibWeb/Text/expected/wpt-import/IndexedDB/transaction_bubble-and-capture.any.sharedworker.txtindex d4505b2ffd9..539172f5918 100644--- a/Tests/LibWeb/Text/expected/wpt-import/IndexedDB/transaction_bubble-and-capture.any.sharedworker.txt+++ b/Tests/LibWeb/Text/expected/wpt-import/IndexedDB/transaction_bubble-and-capture.any.sharedworker.txt@@ -2,5 +2,5 @@ Harness status: OKFound 1 tests-1 Fail-Fail Capture and bubble\ No newline at end of file+1 Pass+Pass Capture and bubble\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/IndexedDB/transaction_bubble-and-capture.any.txt b/Tests/LibWeb/Text/expected/wpt-import/IndexedDB/transaction_bubble-and-capture.any.txtindex d4505b2ffd9..539172f5918 100644--- a/Tests/LibWeb/Text/expected/wpt-import/IndexedDB/transaction_bubble-and-capture.any.txt+++ b/Tests/LibWeb/Text/expected/wpt-import/IndexedDB/transaction_bubble-and-capture.any.txt@@ -2,5 +2,5 @@ Harness status: OKFound 1 tests-1 Fail-Fail Capture and bubble\ No newline at end of file+1 Pass+Pass Capture and bubble\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/IndexedDB/transaction_bubble-and-capture.any.worker.txt b/Tests/LibWeb/Text/expected/wpt-import/IndexedDB/transaction_bubble-and-capture.any.worker.txtindex d4505b2ffd9..539172f5918 100644--- a/Tests/LibWeb/Text/expected/wpt-import/IndexedDB/transaction_bubble-and-capture.any.worker.txt+++ b/Tests/LibWeb/Text/expected/wpt-import/IndexedDB/transaction_bubble-and-capture.any.worker.txt@@ -2,5 +2,5 @@ Harness status: OKFound 1 tests-1 Fail-Fail Capture and bubble\ No newline at end of file+1 Pass+Pass Capture and bubble\ No newline at end of file