serenity icon indicating copy to clipboard operation
serenity copied to clipboard

LibWeb: Set up the Fetch response's body with the appropriate stream

Open trflynn89 opened this issue 2 years ago • 1 comments

Have been on-and-off looking into implementing the Bodies incremental read AO, the "set stream to a new ReadableStream object, and set up stream with byte reading support" branch in particular blocks it. Without this, we crash trying to reference a non-existing stream controller.

trflynn89 avatar Jul 06 '23 00:07 trflynn89

Draft for now - hitting the empty VM execution context stack crash in Streams::set_up_readable_stream_controller_with_byte_reading_support

trflynn89 avatar Jul 06 '23 01:07 trflynn89

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions!

stale[bot] avatar Jul 27 '23 05:07 stale[bot]

The empty execution context stack is no longer an issue, but we do now hit the following crash, so this remains a draft:

WebContent: Userland/Libraries/LibWeb/HTML/Scripting/Environments.cpp:350: Web::HTML::EnvironmentSettingsObject& Web::HTML::incumbent_settings_object(): Assertion `!event_loop.is_backup_incumbent_settings_object_stack_empty()' failed.
#7  0x00007ffff709c7d2 in Web::HTML::incumbent_settings_object () at Userland/Libraries/LibWeb/HTML/Scripting/Environments.cpp:350
#8  0x00007ffff6ce0fdd in operator() () at Userland/Libraries/LibWeb/Bindings/MainThreadVM.cpp:317
#9  call () at Meta/Lagom/../../AK/Function.h:157
#10 0x00007ffff56d12ff in AK::Function<JS::JobCallback (JS::FunctionObject&)>::operator()(JS::FunctionObject&) const () at Meta/Lagom/../../AK/Function.h:95
#11 0x00007ffff56cfbd4 in JS::Promise::perform_then () at Userland/Libraries/LibJS/Runtime/Promise.cpp:307
#12 0x00007ffff72afcb3 in Web::WebIDL::react_to_promise(JS::PromiseCapability const&, AK::Optional<JS::SafeFunction<Web::WebIDL::ExceptionOr<JS::Value> (JS::Value)> >, AK::Optional<JS::SafeFunction<Web::WebIDL::ExceptionOr<JS::Value> (JS::Value)> >) () at Userland/Libraries/LibWeb/WebIDL/Promise.cpp:143
#13 0x00007ffff72b034b in Web::WebIDL::upon_fulfillment(JS::PromiseCapability const&, JS::SafeFunction<Web::WebIDL::ExceptionOr<JS::Value> (JS::Value)>) () at Userland/Libraries/LibWeb/WebIDL/Promise.cpp:159
#14 0x00007ffff71fece7 in Web::Streams::set_up_readable_byte_stream_controller(Web::Streams::ReadableStream&, Web::Streams::ReadableByteStreamController&, JS::SafeFunction<Web::WebIDL::ExceptionOr<JS::Value> ()>&&, JS::SafeFunction<Web::WebIDL::ExceptionOr<JS::NonnullGCPtr<JS::PromiseCapability> > ()>&&, JS::SafeFunction<Web::WebIDL::ExceptionOr<JS::NonnullGCPtr<JS::PromiseCapability> > (JS::Value)>&&, double, JS::Value) () at Userland/Libraries/LibWeb/Streams/AbstractOperations.cpp:1410
#15 0x00007ffff72029cd in Web::Streams::set_up_readable_stream_controller_with_byte_reading_support(Web::Streams::ReadableStream&, AK::Optional<JS::SafeFunction<Web::WebIDL::ExceptionOr<JS::NonnullGCPtr<JS::PromiseCapability> > ()> >&&, AK::Optional<JS::SafeFunction<Web::WebIDL::ExceptionOr<JS::NonnullGCPtr<JS::PromiseCapability> > (JS::Value)> >&&, double)
    () at Userland/Libraries/LibWeb/Streams/AbstractOperations.cpp:1736
#16 0x00007ffff6ef5fcc in Web::Fetch::extract_body () at Userland/Libraries/LibWeb/Fetch/BodyInit.cpp:56
#17 0x00007ffff6efee69 in operator()<AK::Span<unsigned char const>, AK::HashMap<AK::DeprecatedString, AK::DeprecatedString, AK::CaseInsensitiveStringTraits> const, AK::Optional<unsigned int> > () at Userland/Libraries/LibWeb/Fetch/Fetching/Fetching.cpp:1683

trflynn89 avatar Aug 01 '23 23:08 trflynn89

This pull request has been closed because it has not had recent activity. Feel free to re-open if you wish to still contribute these changes. Thank you for your contributions!

stale[bot] avatar Aug 09 '23 19:08 stale[bot]