script: Propagate a pending JS exception on structured cloning (#37964)

During the object (de)serialization steps on structured cloning
https://html.spec.whatwg.org/multipage/#safe-passing-of-structured-data
it is possible to throw a JS exception.

`self.postMessage({ get whatever() { throw customError } }));`

Require to propagate a pending JS exception and not throw the default
"DataCloneError" DOM exception.

Testing: Improvements in the following tests
- html/infrastructure/safe-passing-of-structured-data/*
- html/webappapis/structured-clone/structured-clone.any.js*
- wasm/serialization/arraybuffer/transfer.window.js
- webmessaging/without-ports/026.html
- workers/semantics/structured-clone/dedicated.html

Signed-off-by: Andrei Volykhin <andrei.volykhin@gmail.com>
This commit is contained in:
Andrei Volykhin 2025-07-09 17:47:55 +03:00 committed by GitHub
parent 34c31ee418
commit 26f4da8249
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 15 additions and 44 deletions

View file

@ -5,9 +5,6 @@
[A subclass instance will deserialize as its closest serializable superclass]
expected: FAIL
[Object with a getter that throws]
expected: FAIL
[Growable SharedArrayBuffer]
expected: FAIL
@ -52,8 +49,5 @@
[A subclass instance will deserialize as its closest serializable superclass]
expected: FAIL
[Object with a getter that throws]
expected: FAIL
[Growable SharedArrayBuffer]
expected: FAIL

View file

@ -1,3 +0,0 @@
[structured-cloning-error-extra.html]
[Throwing name getter fails serialization]
expected: FAIL

View file

@ -1,12 +0,0 @@
[transfer-errors.window.html]
[Serialize should throw before a detached ArrayBuffer is found]
expected: FAIL
[Serialize should throw before a detached MessagePort is found]
expected: FAIL
[Serialize should throw before a detached ImageBitmap is found]
expected: FAIL
[Serialize should throw before a detached OffscreenCanvas is found]
expected: FAIL

View file

@ -32,8 +32,5 @@
[A subclass instance will deserialize as its closest serializable superclass]
expected: FAIL
[Object with a getter that throws]
expected: FAIL
[Growable SharedArrayBuffer]
expected: FAIL