Use undefined as this in trusted type callbacks (#37594)

As discussed in w3c/trusted-types#468 the spec will be aligned to the
other browsers, which call the callback with undefined as this.

That also allows us to cleanup the JSContext arguments across a couple
of methods.

Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
This commit is contained in:
Tim van der Lippe 2025-06-21 20:29:09 +02:00 committed by GitHub
parent 5579b11cf6
commit d2a688d798
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 14 additions and 40 deletions

View file

@ -824957,7 +824957,7 @@
]
],
"TrustedTypePolicy-createXXX.html": [
"f51f51d98455ebccdee31a5b0d844a926b27fc0e",
"957a691bcd909d71b2b34a4256fe7168cd14930b",
[
null,
{}

View file

@ -61,7 +61,7 @@
[ s => null, "" ],
[ s => "well, " + s, "well, whatever" ],
[ s => { throw new Error() }, Error ],
[ new WrappingClass().callback_to_capture_this, "null"],
[ new WrappingClass().callback_to_capture_this, "undefined"],
[ s => { aGlobalVarForSideEffectTesting = s; return s }, "whatever" ],
[ s => aGlobalVarForSideEffectTesting + s, "whateverwhatever" ],
[ aGlobalFunction.bind(aGlobalObject), "well, whatever" ],
@ -73,7 +73,7 @@
[ s => null, "" ],
[ s => s + "#duck", INPUTS.SCRIPTURL + "#duck" ],
[ s => { throw new Error() }, Error ],
[ new WrappingClass().callback_to_capture_this, "null"],
[ new WrappingClass().callback_to_capture_this, "undefined"],
[ s => s + "#" + aGlobalVarForSideEffectTesting,
INPUTS.SCRIPTURL + "#global" ],
[ anotherGlobalFunction.bind(aGlobalObject), INPUTS.SCRIPTURL + "#well," ],