mirror of
https://github.com/servo/servo.git
synced 2025-07-22 23:03:42 +01:00
MessagePort: implement disentanglement (#36654)
Implement [disentangle](https://html.spec.whatwg.org/multipage/#disentangle) Remove bespoke gc logic which now becomes unnecessary. Adds a wpt test that hits the "disentangle while in transfer" logic. Updates streams code, fixing an error where disentanglement is conditional on an error. Test coverage: there are existing tests in `/webmessaging/message-channels/close-event/explicitly-closed.tentative.window.js` for the no transfer case, and the simple completed transfer case, and this PR adds a test for the more complicated transfer in progress case. Fix https://github.com/servo/servo/issues/36465 --------- Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>
This commit is contained in:
parent
c46402e222
commit
af5d665efa
19 changed files with 356 additions and 191 deletions
|
@ -173,11 +173,11 @@ impl Callback for TransferBackPressurePromiseReaction {
|
|||
self.port
|
||||
.pack_and_post_message_handling_error("chunk", chunk.handle(), can_gc);
|
||||
|
||||
// Disentangle port.
|
||||
global.disentangle_port(&self.port);
|
||||
|
||||
// If result is an abrupt completion,
|
||||
if let Err(error) = result {
|
||||
// Disentangle port.
|
||||
global.disentangle_port(&self.port, can_gc);
|
||||
|
||||
// Return a promise rejected with result.[[Value]].
|
||||
self.result_promise.reject_error(error, can_gc);
|
||||
} else {
|
||||
|
@ -609,7 +609,7 @@ impl WritableStreamDefaultController {
|
|||
let result = port.pack_and_post_message_handling_error("error", reason, can_gc);
|
||||
|
||||
// Disentangle port.
|
||||
global.disentangle_port(port);
|
||||
global.disentangle_port(port, can_gc);
|
||||
|
||||
let promise = Promise::new(global, can_gc);
|
||||
|
||||
|
@ -752,7 +752,7 @@ impl WritableStreamDefaultController {
|
|||
.expect("Sending close should not fail.");
|
||||
|
||||
// Disentangle port.
|
||||
global.disentangle_port(port);
|
||||
global.disentangle_port(port, can_gc);
|
||||
|
||||
// Return a promise resolved with undefined.
|
||||
Promise::new_resolved(global, cx, (), can_gc)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue