summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Olsson <matthewcolsson@gmail.com>2023-04-24 18:48:35 -0700
committerAndreas Kling <kling@serenityos.org>2023-05-27 13:55:14 +0200
commit4c8015c1f6805c27847fb3a21a31a5f359190ab7 (patch)
tree7c52750c5e86851ef0d2a081cbe7a70d2c05dd6b
parentdd65d6006998b8f0bbed1a616b5fdd617fda58fb (diff)
downloadserenity-4c8015c1f6805c27847fb3a21a31a5f359190ab7.zip
LibWeb: Do not clear stream algorithms (and add corresponding FIXMEs)
-rw-r--r--Userland/Libraries/LibWeb/Streams/AbstractOperations.cpp33
1 files changed, 24 insertions, 9 deletions
diff --git a/Userland/Libraries/LibWeb/Streams/AbstractOperations.cpp b/Userland/Libraries/LibWeb/Streams/AbstractOperations.cpp
index 80b4ace809..a2576eadfc 100644
--- a/Userland/Libraries/LibWeb/Streams/AbstractOperations.cpp
+++ b/Userland/Libraries/LibWeb/Streams/AbstractOperations.cpp
@@ -612,14 +612,19 @@ bool readable_stream_default_controller_should_call_pull(ReadableStreamDefaultCo
// https://streams.spec.whatwg.org/#readable-stream-default-controller-clear-algorithms
void readable_stream_default_controller_clear_algorithms(ReadableStreamDefaultController& controller)
{
+ // FIXME: This AO can be invoked from within one of the algorithms below. If we clear them, it invokes SafeFunction's
+ // destructor, which asserts we are not currently invoking the function (as it clears the storage). We need to
+ // figure out how to delay this, as these algorithms may keep objects alive that can otherwise be GC'd.
+ (void)controller;
+
// 1. Set controller.[[pullAlgorithm]] to undefined.
- controller.set_pull_algorithm({});
+ // controller.set_pull_algorithm({});
// 2. Set controller.[[cancelAlgorithm]] to undefined.
- controller.set_cancel_algorithm({});
+ // controller.set_cancel_algorithm({});
// 3. Set controller.[[strategySizeAlgorithm]] to undefined.
- controller.set_strategy_size_algorithm({});
+ // controller.set_strategy_size_algorithm({});
}
// https://streams.spec.whatwg.org/#readable-stream-default-controller-error
@@ -847,11 +852,16 @@ WebIDL::ExceptionOr<void> readable_byte_stream_controller_call_pull_if_needed(Re
// https://streams.spec.whatwg.org/#readable-byte-stream-controller-clear-algorithms
void readable_byte_stream_controller_clear_algorithms(ReadableByteStreamController& controller)
{
+ // FIXME: This AO can be invoked from within one of the algorithms below. If we clear them, it invokes SafeFunction's
+ // destructor, which asserts we are not currently invoking the function (as it clears the storage). We need to
+ // figure out how to delay this, as these algorithms may keep objects alive that can otherwise be GC'd.
+ (void)controller;
+
// 1. Set controller.[[pullAlgorithm]] to undefined.
- controller.set_pull_algorithm({});
+ // controller.set_pull_algorithm({});
// 2. Set controller.[[cancelAlgorithm]] to undefined.
- controller.set_cancel_algorithm({});
+ // controller.set_cancel_algorithm({});
}
// https://streams.spec.whatwg.org/#readable-byte-stream-controller-clear-pending-pull-intos
@@ -2023,17 +2033,22 @@ WebIDL::ExceptionOr<void> writable_stream_default_controller_advance_queue_if_ne
// https://streams.spec.whatwg.org/#writable-stream-default-controller-clear-algorithms
void writable_stream_default_controller_clear_algorithms(WritableStreamDefaultController& controller)
{
+ // FIXME: This AO can be invoked from within one of the algorithms below. If we clear them, it invokes SafeFunction's
+ // destructor, which asserts we are not currently invoking the function (as it clears the storage). We need to
+ // figure out how to delay this, as these algorithms may keep objects alive that can otherwise be GC'd.
+ (void)controller;
+
// 1. Set controller.[[writeAlgorithm]] to undefined.
- controller.set_write_algorithm({});
+ // controller.set_write_algorithm({});
// 2. Set controller.[[closeAlgorithm]] to undefined.
- controller.set_close_algorithm({});
+ // controller.set_close_algorithm({});
// 3. Set controller.[[abortAlgorithm]] to undefined.
- controller.set_abort_algorithm({});
+ // controller.set_abort_algorithm({});
// 4. Set controller.[[strategySizeAlgorithm]] to undefined.
- controller.set_strategy_size_algorithm({});
+ // controller.set_strategy_size_algorithm({});
}
// https://streams.spec.whatwg.org/#writable-stream-default-controller-close