mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-21 20:15:17 +00:00
LibWeb: Use the correct realm when initializing streams
There is an open issue to clarify exactly what realm is to be used when creating promises. There are surely many more places we will need to update to use the correct realm (which will be the realm of `this`'s relevant global object).
This commit is contained in:
parent
1abf5ce843
commit
df1e51b80b
Notes:
github-actions[bot]
2025-04-16 00:34:06 +00:00
Author: https://github.com/trflynn89 Commit: https://github.com/LadybirdBrowser/ladybird/commit/df1e51b80b1 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4374
2 changed files with 8 additions and 5 deletions
|
@ -2017,7 +2017,9 @@ GC::Ref<WebIDL::Promise> readable_stream_reader_generic_cancel(ReadableStreamGen
|
|||
// https://streams.spec.whatwg.org/#readable-stream-reader-generic-initialize
|
||||
void readable_stream_reader_generic_initialize(ReadableStreamReader reader, ReadableStream& stream)
|
||||
{
|
||||
auto& realm = stream.realm();
|
||||
// FIXME: Exactly when we should effectively be using the relevant realm of `this` is to be clarified by the spec.
|
||||
// For now, we do so as needed by WPT tests. See: https://github.com/whatwg/streams/issues/1213
|
||||
auto& realm = HTML::relevant_realm(reader.visit([](auto& reader) -> JS::Object& { return reader; }));
|
||||
|
||||
// 1. Set reader.[[stream]] to stream.
|
||||
reader.visit([&](auto& reader) { reader->set_stream(stream); });
|
||||
|
@ -3574,7 +3576,9 @@ bool is_writable_stream_locked(WritableStream const& stream)
|
|||
// https://streams.spec.whatwg.org/#set-up-writable-stream-default-writer
|
||||
WebIDL::ExceptionOr<void> set_up_writable_stream_default_writer(WritableStreamDefaultWriter& writer, WritableStream& stream)
|
||||
{
|
||||
auto& realm = writer.realm();
|
||||
// FIXME: Exactly when we should effectively be using the relevant realm of `this` is to be clarified by the spec.
|
||||
// For now, we do so as needed by WPT tests. See: https://github.com/whatwg/streams/issues/1213
|
||||
auto& realm = HTML::relevant_realm(writer);
|
||||
|
||||
// 1. If ! IsWritableStreamLocked(stream) is true, throw a TypeError exception.
|
||||
if (is_writable_stream_locked(stream))
|
||||
|
|
|
@ -2,11 +2,10 @@ Harness status: OK
|
|||
|
||||
Found 9 tests
|
||||
|
||||
8 Pass
|
||||
1 Fail
|
||||
9 Pass
|
||||
Pass Stream objects created in expected globals
|
||||
Pass Cancel promise is created in same global as stream
|
||||
Fail Closed Promise in correct global
|
||||
Pass Closed Promise in correct global
|
||||
Pass Reader objects in correct global
|
||||
Pass Desired size can be grafted from one prototype to another
|
||||
Pass Closing errored stream throws object in appropriate global
|
||||
|
|
Loading…
Add table
Reference in a new issue