diff options
author | Matthew Olsson <matthewcolsson@gmail.com> | 2023-02-25 10:44:31 -0700 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2023-03-06 13:05:43 +0000 |
commit | 70a2ca7fc0939dd0d61691c17e108c6169ef6d30 (patch) | |
tree | f798d956bba744bc7c607508be52532e5055096b /Userland/Libraries/LibWeb/Fetch | |
parent | 74e93a46eaf9be3c3835682ab2c190c75371ac86 (diff) | |
download | serenity-70a2ca7fc0939dd0d61691c17e108c6169ef6d30.zip |
LibJS: Handle both const and non-const Ts in Handle<T>::create()
Again, the const-ness only really involves Heap-internal metadata, so
the callers shouldn't care about mutations here.
Diffstat (limited to 'Userland/Libraries/LibWeb/Fetch')
3 files changed, 4 insertions, 4 deletions
diff --git a/Userland/Libraries/LibWeb/Fetch/Fetching/Fetching.cpp b/Userland/Libraries/LibWeb/Fetch/Fetching/Fetching.cpp index b30960cf30..ac6a064a73 100644 --- a/Userland/Libraries/LibWeb/Fetch/Fetching/Fetching.cpp +++ b/Userland/Libraries/LibWeb/Fetch/Fetching/Fetching.cpp @@ -838,7 +838,7 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<PendingResponse>> http_fetch(JS::Realm& rea // NOTE: Step 2 is performed in pending_preflight_response's load callback below. } - auto fetch_main_content = [request = JS::make_handle(request), realm = JS::make_handle(realm), fetch_params = JS::make_handle(const_cast<Infrastructure::FetchParams&>(fetch_params))]() -> WebIDL::ExceptionOr<JS::NonnullGCPtr<PendingResponse>> { + auto fetch_main_content = [request = JS::make_handle(request), realm = JS::make_handle(realm), fetch_params = JS::make_handle(fetch_params)]() -> WebIDL::ExceptionOr<JS::NonnullGCPtr<PendingResponse>> { // 2. If request’s redirect mode is "follow", then set request’s service-workers mode to "none". // NOTE: Redirects coming from the network (as opposed to from a service worker) are not to be exposed to a // service worker. diff --git a/Userland/Libraries/LibWeb/Fetch/Fetching/PendingResponse.cpp b/Userland/Libraries/LibWeb/Fetch/Fetching/PendingResponse.cpp index 74f4411b85..97eb40bc23 100644 --- a/Userland/Libraries/LibWeb/Fetch/Fetching/PendingResponse.cpp +++ b/Userland/Libraries/LibWeb/Fetch/Fetching/PendingResponse.cpp @@ -52,11 +52,11 @@ void PendingResponse::resolve(JS::NonnullGCPtr<Infrastructure::Response> respons run_callback(); } -void PendingResponse::run_callback() const +void PendingResponse::run_callback() { VERIFY(m_callback); VERIFY(m_response); - Platform::EventLoopPlugin::the().deferred_invoke([strong_this = JS::make_handle(const_cast<PendingResponse&>(*this))] { + Platform::EventLoopPlugin::the().deferred_invoke([strong_this = JS::make_handle(*this)] { strong_this->m_callback(*strong_this->m_response); strong_this->m_request->remove_pending_response({}, *strong_this.ptr()); }); diff --git a/Userland/Libraries/LibWeb/Fetch/Fetching/PendingResponse.h b/Userland/Libraries/LibWeb/Fetch/Fetching/PendingResponse.h index f60d0eeacd..3d07e02e05 100644 --- a/Userland/Libraries/LibWeb/Fetch/Fetching/PendingResponse.h +++ b/Userland/Libraries/LibWeb/Fetch/Fetching/PendingResponse.h @@ -35,7 +35,7 @@ private: virtual void visit_edges(JS::Cell::Visitor&) override; - void run_callback() const; + void run_callback(); Callback m_callback; JS::NonnullGCPtr<Infrastructure::Request> m_request; |