Bug 214847

Summary: thisValue is not always set correctly when calling JS callbacks
Product: WebKit Reporter: Chris Dumez <cdumez>
Component: BindingsAssignee: Chris Dumez <cdumez>
Status: RESOLVED FIXED    
Severity: Normal CC: cdumez, clopez, darin, ews-watchlist, ggaren, sam, shvaikalesh, webkit-bug-importer, youennf
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
URL: https://heycam.github.io/webidl/#call-a-user-objects-operation
Attachments:
Description Flags
Patch none

Description Chris Dumez 2020-07-27 14:04:22 PDT
thisValue is not always set correctly when calling JS callbacks.

This is causing us to fail the last subtest on:
http://w3c-test.org/dom/traversal/TreeWalker-acceptNode-filter.html

The specification for TreeWalker is here:
- https://dom.spec.whatwg.org/#concept-node-filter

Step 6 refers to [call a user object’s operation] in the WebIDL specification:
- https://heycam.github.io/webidl/#call-a-user-objects-operation

Step 10.5 says:
"Set thisArg to O (overriding the provided value)."

We're missing this step in our implementation so thisValue ends up being undefined (per earlier step 2).
Comment 1 Chris Dumez 2020-07-27 14:07:08 PDT
Created attachment 405310 [details]
Patch
Comment 2 EWS Watchlist 2020-07-27 14:07:51 PDT
This patch modifies the imported WPT tests. Please ensure that any changes on the tests (not coming from a WPT import) are exported to WPT. Please see https://trac.webkit.org/wiki/WPTExportProcess
Comment 3 EWS 2020-07-27 15:06:36 PDT
Committed r264948: <https://trac.webkit.org/changeset/264948>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 405310 [details].
Comment 4 Radar WebKit Bug Importer 2020-07-27 15:07:19 PDT
<rdar://problem/66184276>
Comment 5 Alexey Shvayka 2020-08-02 03:45:04 PDT
*** Bug 213716 has been marked as a duplicate of this bug. ***