Implements the WHATWG DOM specification for passive event listeners, ensuring that calls to `preventDefault()` are correctly ignored within a passive listener context. An internal `kInPassiveListener` state is added to the Event object to track when a passive listener is executing. The `preventDefault()` method and the `returnValue` setter are modified to check this state, as well as the event's `cancelable` property. This state is reliably cleaned up within a `finally` block to prevent state pollution in case a listener throws an error. This resolves previously failing Web Platform Tests (WPT) in `AddEventListenerOptions-passive.any.js`. Refs: https://dom.spec.whatwg.org/#dom-event-preventdefault PR-URL: https://github.com/nodejs/node/pull/59995 Reviewed-By: Daeyeon Jeong <daeyeon.dev@gmail.com> Reviewed-By: Mattias Buelens <mattias@buelens.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Jason Zhang <xzha4350@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
33 lines
834 B
JSON
33 lines
834 B
JSON
{
|
|
"Event-dispatch-listener-order.window.js": {
|
|
"skip": "document is not defined"
|
|
},
|
|
"Event-isTrusted.any.js": {
|
|
"fail": {
|
|
"expected": [
|
|
"Event-isTrusted"
|
|
]
|
|
}
|
|
},
|
|
"EventListener-addEventListener.sub.window.js": {
|
|
"skip": "document is not defined"
|
|
},
|
|
"EventTarget-removeEventListener.any.js": {
|
|
"skip": "globalThis.removeEventListener is not a function"
|
|
},
|
|
"event-global-extra.window.js": {
|
|
"skip": "document is not defined"
|
|
},
|
|
"event-global-set-before-handleEvent-lookup.window.js": {
|
|
"skip": "window is not defined"
|
|
},
|
|
"event-global.worker.js": {
|
|
"skip": "importScripts is not defined"
|
|
},
|
|
"legacy-pre-activation-behavior.window.js": {
|
|
"skip": "document is not defined"
|
|
},
|
|
"relatedTarget.window.js": {
|
|
"skip": "document is not defined"
|
|
}
|
|
}
|