Truly independent web browser
LibWebView: Hold a navigation's progress as one state
Shannon Booth06bbeba24e52
diff --git a/Libraries/LibWebView/CanonicalNavigable.cpp b/Libraries/LibWebView/CanonicalNavigable.cppindex 6e0bc58304a..4f5fba19035 100644--- a/Libraries/LibWebView/CanonicalNavigable.cpp+++ b/Libraries/LibWebView/CanonicalNavigable.cpp@@ -55,17 +55,36 @@ static Utf16String generate_a_random_uuid()return Utf16String::from_ascii_without_validation(uuid.bytes());}-// A navigation made again from the same source — one the user stopped, or a crash cut short — as a GET: A retry-// shouldn't resubmit a form behind the user's back, so the document resource isn't sent again.-// The page conducting the navigation: the one evaluating a javascript: URL, otherwise the one hosting the document it-// populated.-bool CanonicalNavigation::is_conducted_by(WebContentPage const& page) const+WebContentPage* CanonicalNavigation::worker() const+{+ return state.visit(+ [](Admitted const&) -> WebContentPage* { return nullptr; },+ [](EvaluatingJavaScriptURL const&) -> WebContentPage* { return nullptr; },+ [](Populating const&) -> WebContentPage* { return nullptr; },+ [](auto const& state) -> WebContentPage* { return state.worker.ptr(); });+}++WebContentPage* CanonicalNavigation::host() const+{+ if (auto const* evaluating = state.get_pointer<EvaluatingJavaScriptURL>())+ return evaluating->host.ptr();+ if (auto const* populating = state.get_pointer<Populating>())+ return populating->host.ptr();+ return nullptr;+}++NavigationLoader* CanonicalNavigation::loader() const{- if (url.has_value() && url->scheme() == "javascript"sv)- return population_worker == &page;- return phase == Phase::Populating && host == &page;+ return state.visit(+ [](CreatingNavigationParams const& state) -> NavigationLoader* { return state.loader.ptr(); },+ [](AcquiringResponseBody const& state) -> NavigationLoader* { return state.loader.ptr(); },+ [](ChoosingHost const& state) -> NavigationLoader* { return state.loader.ptr(); },+ [](Populating const& state) -> NavigationLoader* { return state.loader.ptr(); },+ [](auto const&) -> NavigationLoader* { return nullptr; });}+// A navigation made again from the same source — one the user stopped, or a crash cut short — as a GET: A retry+// shouldn't resubmit a form behind the user's back, so the document resource isn't sent again.Web::HTML::PreparedNavigationDescriptor prepare_navigation_to_retry(Web::HTML::PreparedNavigationDescriptor navigation){navigation.document_resource = {};@@ -255,7 +274,7 @@ void CanonicalNavigable::begin_navigation(Web::HTML::PreparedNavigationDescripto// 20. If url's scheme is "javascript", then:if (is_javascript_url) {- set_navigation_population_worker(*host);+ ongoing_navigation()->state = CanonicalNavigation::EvaluatingJavaScriptURL { *host };if (is_top_level_traversable() && host->displays_tab())host->begin_top_level_load(navigation_id, url);@@ -284,8 +303,7 @@ void CanonicalNavigable::begin_navigation(Web::HTML::PreparedNavigationDescriptoclear_ongoing_navigation();return;}- auto& ongoing = *ongoing_navigation();- ongoing.start_request = Web::HTML::NavigationStartRequest {+ auto start_request = Web::HTML::NavigationStartRequest {.navigable_id = id(),.url = url,.document_resource = move(navigation.document_resource),@@ -305,9 +323,9 @@ void CanonicalNavigable::begin_navigation(Web::HTML::PreparedNavigationDescripto.navigation_api_key = generate_a_random_uuid(),.navigation_api_id = generate_a_random_uuid(),};- ongoing.retry = prepare_navigation_to_retry(*ongoing.start_request);- ongoing.phase = CanonicalNavigation::Phase::AwaitingUnloadCheck;- set_navigation_population_worker(*worker);+ auto& ongoing = *ongoing_navigation();+ ongoing.retry = prepare_navigation_to_retry(start_request);+ ongoing.state = CanonicalNavigation::CheckingIfUnloadingIsCanceled { *worker, move(start_request) };worker->async_set_ongoing_navigation(id(), navigation_id);worker->begin_navigation_unload_check(*this, navigation_id);}@@ -906,7 +924,7 @@ void CanonicalNavigable::did_create_populated_document_with_an_origin_of_its_ownOptional<CanonicalNavigation> CanonicalNavigable::take_navigation_to_finalize(Utf16String const& navigation_id, WebContentPage const& page){auto* navigation = ongoing_navigation();- if (!navigation || navigation->navigation_id != navigation_id || !navigation->is_conducted_by(page))+ if (!navigation || navigation->navigation_id != navigation_id || navigation->host() != &page)return {};if (navigation->populated_document.has_value()) {abandon_populated_document(m_document_populated_by_history_job);@@ -1327,56 +1345,22 @@ void CanonicalNavigable::retain_blob_url_token(URL::BlobURLEntry::Token token)m_pending_navigation_blob_url = BlobURLHandle { *store, token };}-void CanonicalNavigable::set_navigation_population_worker(WebContentPage& page)-{- VERIFY(ongoing_navigation());- auto& navigation = *ongoing_navigation();- VERIFY(!navigation.population_worker);- navigation.population_worker = page;-}--bool CanonicalNavigable::navigation_population_matches(WebContentPage const& page, Utf16String const& navigation_id) const-{- return ongoing_navigation()- && ongoing_navigation()->navigation_id == navigation_id- && ongoing_navigation()->phase == CanonicalNavigation::Phase::Populating- && navigation_population_worker_matches(page);-}--bool CanonicalNavigable::navigation_population_worker_matches(WebContentPage const& page) const-{- return ongoing_navigation() && ongoing_navigation()->population_worker.ptr() == &page;-}-void CanonicalNavigable::set_navigation_host(WebContentPage& page){- VERIFY(ongoing_navigation());auto& navigation = *ongoing_navigation();- navigation.host = page;-- // The population worker conducts the navigation until the hosting process takes over.- navigation.population_worker = nullptr;-}--bool CanonicalNavigable::navigation_host_matches(WebContentPage const& page) const-{- return ongoing_navigation() && ongoing_navigation()->host.ptr() == &page;-}--bool CanonicalNavigable::navigation_owner_matches(WebContentPage const& page) const-{- return navigation_population_worker_matches(page) || navigation_host_matches(page);+ auto loader = move(navigation.state.get<CanonicalNavigation::ChoosingHost>().loader);+ navigation.state = CanonicalNavigation::Populating { page, move(loader) };}-bool CanonicalNavigable::cancel_navigation_transaction_for_client(WebContentClient& client)+bool CanonicalNavigable::cancel_navigation_for_client(WebContentClient& client){if (!ongoing_navigation())return false;- auto is_page_of_client = [&](RefPtr<WebContentPage> const& page) {+ auto is_page_of_client = [&](WebContentPage const* page) {return page && &page->client() == &client;};- if (!is_page_of_client(ongoing_navigation()->population_worker) && !is_page_of_client(ongoing_navigation()->host))+ if (!is_page_of_client(ongoing_navigation()->worker()) && !is_page_of_client(ongoing_navigation()->host()))return false;clear_ongoing_navigation();diff --git a/Libraries/LibWebView/CanonicalNavigable.h b/Libraries/LibWebView/CanonicalNavigable.hindex d1d2c70d85f..769fa5a72b9 100644--- a/Libraries/LibWebView/CanonicalNavigable.h+++ b/Libraries/LibWebView/CanonicalNavigable.h@@ -230,13 +230,8 @@ public:void clear_ongoing_navigation_traversal(Web::HTML::CrossProcessId operation_id);virtual void clear_ongoing_navigation();void clear_ongoing_navigation_state();- void set_navigation_population_worker(WebContentPage&);- bool navigation_population_matches(WebContentPage const&, Utf16String const& navigation_id) const;- bool navigation_population_worker_matches(WebContentPage const&) const;void set_navigation_host(WebContentPage&);- bool navigation_host_matches(WebContentPage const&) const;- bool navigation_owner_matches(WebContentPage const&) const;- bool cancel_navigation_transaction_for_client(WebContentClient&);+ bool cancel_navigation_for_client(WebContentClient&);void did_finish_finalizing_navigation(Utf16String const& navigation_id, Web::HTML::CrossProcessId document_state_id, Web::HTML::HistoryStepResult);bool has_uncommitted_navigation() const { return ongoing_navigation(); }bool matches_ongoing_navigation(Optional<Utf16String> const& navigation_id) const;diff --git a/Libraries/LibWebView/CanonicalNavigation.h b/Libraries/LibWebView/CanonicalNavigation.hindex 0453a7c5a0b..99472f5ed89 100644--- a/Libraries/LibWebView/CanonicalNavigation.h+++ b/Libraries/LibWebView/CanonicalNavigation.h@@ -6,12 +6,14 @@#pragma once+#include <AK/NonnullOwnPtr.h>#include <AK/NonnullRefPtr.h>#include <AK/Optional.h>#include <AK/OwnPtr.h>#include <AK/RefPtr.h>#include <AK/Types.h>#include <AK/Utf16String.h>+#include <AK/Variant.h>#include <LibURL/URL.h>#include <LibWebCommon/HTML/NavigationPopulationRequest.h>#include <LibWebView/CanonicalDocument.h>@@ -33,27 +35,51 @@ struct PopulatedDocument {// what it acquires on the way.class CanonicalNavigation {public:- enum class Phase : u8 {- Started,- AwaitingUnloadCheck,- Populating,- AwaitingResponseBody,+ // Admitted, before navigate runs its steps in parallel.+ struct Admitted { };+ // Navigating to a javascript: URL, in the page with the document it is evaluated against.+ struct EvaluatingJavaScriptURL {+ NonnullRefPtr<WebContentPage> host;};+ // Navigate, step 23.1: checking if unloading is canceled, in the page with the source document.+ struct CheckingIfUnloadingIsCanceled {+ NonnullRefPtr<WebContentPage> worker;+ Web::HTML::NavigationStartRequest start_request;+ };+ // Attempting to populate the history entry's document, steps 1 to 4, in the page with the source document.+ struct CreatingNavigationParams {+ NonnullRefPtr<WebContentPage> worker;+ NonnullOwnPtr<NavigationLoader> loader;+ };+ // Acquiring the response body, in the page with the source document.+ struct AcquiringResponseBody {+ NonnullRefPtr<WebContentPage> worker;+ NonnullOwnPtr<NavigationLoader> loader;+ };+ // Choosing the page to host the document the response creates.+ struct ChoosingHost {+ NonnullRefPtr<WebContentPage> worker;+ NonnullOwnPtr<NavigationLoader> loader;+ };+ // Attempting to populate the history entry's document, step 5 on, in the page to host it.+ struct Populating {+ NonnullRefPtr<WebContentPage> host;+ NonnullOwnPtr<NavigationLoader> loader;+ };+ using State = Variant<Admitted, EvaluatingJavaScriptURL, CheckingIfUnloadingIsCanceled, CreatingNavigationParams, AcquiringResponseBody, ChoosingHost, Populating>;Optional<URL::URL> url {};Optional<Utf16String> navigation_id {};- Optional<Web::HTML::NavigationStartRequest> start_request {};// The navigation to make again if the user stops this one and reloads, or a crash cuts it short. Kept from the start// request, which population uses up. A javascript: URL has none.Optional<Web::HTML::PreparedNavigationDescriptor> retry {};u64 sequence_number { 0 };- Phase phase { Phase::Started };- OwnPtr<NavigationLoader> loader {};- RefPtr<WebContentPage> population_worker {};- RefPtr<WebContentPage> host {};+ State state { Admitted {} };Optional<PopulatedDocument> populated_document {};- bool is_conducted_by(WebContentPage const&) const;+ WebContentPage* worker() const;+ WebContentPage* host() const;+ NavigationLoader* loader() const;};WEBVIEW_API Web::HTML::PreparedNavigationDescriptor prepare_navigation_to_retry(Web::HTML::PreparedNavigationDescriptor);diff --git a/Libraries/LibWebView/CanonicalTraversable.cpp b/Libraries/LibWebView/CanonicalTraversable.cppindex 44a7b908fbf..f8dafc375ba 100644--- a/Libraries/LibWebView/CanonicalTraversable.cpp+++ b/Libraries/LibWebView/CanonicalTraversable.cpp@@ -1340,11 +1340,7 @@ bool CanonicalTraversable::navigation_transaction_matches(HistoryOperation constauto const& parameters = operation.parameters.get<Web::FinalizeCrossDocumentNavigationHistoryOperationParameters>();if (reply_navigable_id.has_value() && *reply_navigable_id != parameters.navigable_id)return true;- auto navigable = find(parameters.navigable_id);- if (!navigable.has_value())- return false;-- return operation.finalized_navigation.has_value() && operation.finalized_navigation->is_conducted_by(page);+ return operation.finalized_navigation.has_value() && operation.finalized_navigation->host() == &page;}void CanonicalTraversable::add_history_operation_completion_endpoint(HistoryOperation& operation, NonnullRefPtr<WebContentPage> endpoint)@@ -2564,7 +2560,7 @@ void CanonicalTraversable::finalize_a_cross_document_navigation(HistoryOperation// NB: The process running a javascript: URL navigation evaluates it, creates newDocument in navigable's active// browsing context, and reports historyEntry with these steps. The UI process runs the steps that decide// newDocument's origin, and populates the document it holds for historyEntry's document state.- if (auto const& url = operation.finalized_navigation->url; url.has_value() && url->scheme() == "javascript"sv) {+ if (operation.finalized_navigation->state.has<CanonicalNavigation::EvaluatingJavaScriptURL>()) {auto const& initiator_origin = history_entry->document_state->initiator_origin;// 4. If initiatorOrigin is not same origin-domain with targetNavigable's active document's origin, then return.diff --git a/Libraries/LibWebView/WebContentClient.cpp b/Libraries/LibWebView/WebContentClient.cppindex 8d12d4a2a93..06a62975e29 100644--- a/Libraries/LibWebView/WebContentClient.cpp+++ b/Libraries/LibWebView/WebContentClient.cpp@@ -573,7 +573,7 @@ void WebContentClient::cancel_navigation_transactions(){ViewImplementation::for_each_view([this](ViewImplementation& view) {view.traversable().for_each_in_inclusive_subtree([this](CanonicalNavigable& navigable) {- navigable.cancel_navigation_transaction_for_client(*this);+ navigable.cancel_navigation_for_client(*this);return IterationDecision::Continue;});return IterationDecision::Continue;diff --git a/Libraries/LibWebView/WebContentPage.cpp b/Libraries/LibWebView/WebContentPage.cppindex fe41b2dbf06..6ef2a75ce0d 100644--- a/Libraries/LibWebView/WebContentPage.cpp+++ b/Libraries/LibWebView/WebContentPage.cpp@@ -300,31 +300,34 @@ bool WebContentPage::continue_navigation_population_in_selected_process(Web::HTMif (!navigable.has_value())return false;- auto navigation_awaits_population = [&](CanonicalNavigation::Phase phase) {+ auto* ongoing_navigation = navigable->ongoing_navigation();+ auto* acquiring = ongoing_navigation && ongoing_navigation->navigation_id == navigation_id+ ? ongoing_navigation->state.get_pointer<CanonicalNavigation::AcquiringResponseBody>()+ : nullptr;+ if (!acquiring)+ return false;+ ongoing_navigation->state = CanonicalNavigation::ChoosingHost { acquiring->worker, move(acquiring->loader) };+ auto is_still_choosing_host = [&] {auto const* ongoing_navigation = navigable->ongoing_navigation();return ongoing_navigation&& ongoing_navigation->navigation_id == navigation_id- && ongoing_navigation->phase == phase- && ongoing_navigation->loader;+ && ongoing_navigation->state.has<CanonicalNavigation::ChoosingHost>();};- if (!navigation_awaits_population(CanonicalNavigation::Phase::AwaitingResponseBody))- return false;- navigable->ongoing_navigation()->phase = CanonicalNavigation::Phase::Populating;// The task queued by step 5 of attempting to populate the history entry's document runs in the process hosting// the browsing context that the document it creates belongs to. A response that creates no document is finished// by the process that fetched it.RefPtr<WebContentPage> host = this;- auto response_document = navigable->ongoing_navigation()->loader->response_document();+ auto response_document = navigable->ongoing_navigation()->loader()->response_document();if (response_document.has_value()) {response_document->document_id = Application::the().allocate_ui_process_cross_process_id();- auto const& request = navigable->ongoing_navigation()->loader->request();+ auto const& request = navigable->ongoing_navigation()->loader()->request();auto document = navigable->create_and_initialize_a_document(*response_document);- navigable->ongoing_navigation()->loader->set_document(*document, *navigable);+ navigable->ongoing_navigation()->loader()->set_document(*document, *navigable);auto document_state = CanonicalDocumentState::create(request.history_entry.document_state.id);document_state->initiator_origin = request.history_entry.document_state.initiator_origin;document_state->origin = request.history_entry.document_state.origin;- navigable->populate_document_for_ongoing_navigation(move(document_state), *document, navigable->ongoing_navigation()->loader->result().inline_content_origin);+ navigable->populate_document_for_ongoing_navigation(move(document_state), *document, navigable->ongoing_navigation()->loader()->result().inline_content_origin);// A document created for inline content stands in for the resource the process that fetched it could not// load; that process hosts it.@@ -336,13 +339,13 @@ bool WebContentPage::continue_navigation_population_in_selected_process(Web::HTM}host = host_or_error.release_value();// Obtaining the page can replace the tab's process, whose change callbacks can reenter navigation.- if (!navigation_awaits_population(CanonicalNavigation::Phase::Populating))+ if (!is_still_choosing_host())return false;}// The host takes the navigable over when the document is activated, after the displayed document is unloaded.navigable->place_pending_document(*host);}- auto& loader = *navigable->ongoing_navigation()->loader;+ auto& loader = *navigable->ongoing_navigation()->loader();navigable->set_navigation_host(*host);auto finish_handoff = [page = NonnullRefPtr<WebContentPage>(*this), host, navigable_id, navigation_id](bool succeeded) {if (!page->is_open())@@ -381,7 +384,7 @@ Optional<CanonicalNavigable&> WebContentPage::population_worker_navigable(Web::Hreturn navigable;auto navigable = traversable().top_level_traversable().find(navigable_id);- if (!navigable.has_value() || !navigable->navigation_population_worker_matches(*this))+ if (!navigable.has_value() || !navigable->ongoing_navigation() || navigable->ongoing_navigation()->worker() != this)return {};return *navigable;}@@ -1453,7 +1456,7 @@ bool WebContentPage::populates_a_navigation_to_local_file(ByteString const& pathtraversable().for_each_in_inclusive_subtree([&](CanonicalNavigable const& navigable) {auto const* ongoing_navigation = navigable.ongoing_navigation();result = ongoing_navigation- && ongoing_navigation->population_worker.ptr() == this+ && ongoing_navigation->worker() == this&& ongoing_navigation->url.has_value()&& ongoing_navigation->url->scheme() == "file"sv&& ongoing_navigation->url->file_path() == path;@@ -1983,8 +1986,8 @@ void WebContentPage::did_request_navigation_start(Web::HTML::CrossProcessId navi.url = url,.navigation_id = navigation_id,.sequence_number = sequence_number,+ .state = CanonicalNavigation::EvaluatingJavaScriptURL { *this },});- target_navigable->set_navigation_population_worker(*this);if (target_navigable->is_top_level_traversable()) {if (displays_tab())begin_top_level_load(move(navigation_id), url);@@ -1996,12 +1999,10 @@ void WebContentPage::did_request_navigation_start(Web::HTML::CrossProcessId navitarget_navigable->set_ongoing_navigation(CanonicalNavigation {.url = move(url),.navigation_id = navigation_id,- .start_request = move(start_request),.retry = move(retry),.sequence_number = sequence_number,- .phase = CanonicalNavigation::Phase::AwaitingUnloadCheck,+ .state = CanonicalNavigation::CheckingIfUnloadingIsCanceled { *this, start_request.release_value() },});- target_navigable->set_navigation_population_worker(*this);begin_navigation_unload_check(*target_navigable, navigation_id);}@@ -2035,27 +2036,22 @@ void WebContentPage::did_complete_navigation_unload_check(Web::HTML::CrossProcesreturn;auto* ongoing_navigation = navigable->ongoing_navigation();- if (!ongoing_navigation- || ongoing_navigation->navigation_id != navigation_id- || ongoing_navigation->phase != CanonicalNavigation::Phase::AwaitingUnloadCheck- || ongoing_navigation->population_worker != *this- || !ongoing_navigation->start_request.has_value()) {+ auto* checking = ongoing_navigation ? ongoing_navigation->state.get_pointer<CanonicalNavigation::CheckingIfUnloadingIsCanceled>() : nullptr;+ if (!checking || ongoing_navigation->navigation_id != navigation_id || checking->worker.ptr() != this)return;- }auto population_request = Web::HTML::create_navigation_population_request(- ongoing_navigation->start_request.release_value(),+ move(checking->start_request),Application::the().allocate_ui_process_cross_process_id());population_request.target_snapshot_params.sandboxing_flags |= navigable->snapshot_target_snapshot_params().sandboxing_flags;- ongoing_navigation->loader = NavigationLoader::create(client().is_private(), move(population_request));- ongoing_navigation->phase = CanonicalNavigation::Phase::Populating;- async_create_navigation_params(ongoing_navigation->loader->request());+ ongoing_navigation->state = CanonicalNavigation::CreatingNavigationParams { *this, NavigationLoader::create(client().is_private(), move(population_request)) };+ async_create_navigation_params(ongoing_navigation->loader()->request());// Requesting navigation params starts the fetch, so a view's top-level population begins its recorded// load here.if (navigable->is_top_level_traversable()) {if (displays_tab())- begin_top_level_load(move(navigation_id), ongoing_navigation->loader->request().history_entry.url);+ begin_top_level_load(move(navigation_id), ongoing_navigation->loader()->request().history_entry.url);}}@@ -2068,7 +2064,11 @@ void WebContentPage::did_finish_navigation_params_creation(Web::HTML::CrossProcereturn;}- if (!navigable->navigation_population_matches(*this, navigation_id)) {+ auto* ongoing_navigation = navigable->ongoing_navigation();+ auto* creating = ongoing_navigation && ongoing_navigation->navigation_id == navigation_id+ ? ongoing_navigation->state.get_pointer<CanonicalNavigation::CreatingNavigationParams>()+ : nullptr;+ if (!creating || creating->worker.ptr() != this) {if (result.has_value())NavigationLoader::discard(client().is_private(), *result);return;@@ -2087,21 +2087,15 @@ void WebContentPage::did_finish_navigation_params_creation(Web::HTML::CrossProcereturn;}- auto* ongoing_navigation = navigable->ongoing_navigation();- if (!ongoing_navigation || !ongoing_navigation->loader) {- NavigationLoader::discard(client().is_private(), *result);- end_recorded_load_for_canceled_navigation();- navigable->clear_ongoing_navigation();- return;- }-// Steps 1-4 have produced final navigation params. Keep the pending entry in// sync with redirects before choosing the process that will run step 5.- ongoing_navigation->phase = CanonicalNavigation::Phase::AwaitingResponseBody;- ongoing_navigation->loader->did_finish_navigation_params_creation(result.release_value());- ongoing_navigation->url = ongoing_navigation->loader->request().history_entry.url;+ auto loader = move(creating->loader);+ ongoing_navigation->state = CanonicalNavigation::AcquiringResponseBody { *this, move(loader) };+ auto& acquiring_loader = *ongoing_navigation->loader();+ acquiring_loader.did_finish_navigation_params_creation(result.release_value());+ ongoing_navigation->url = acquiring_loader.request().history_entry.url;- ongoing_navigation->loader->acquire_response_body([page = NonnullRefPtr<WebContentPage>(*this), navigable_id, navigation_id = move(navigation_id)](bool succeeded) {+ acquiring_loader.acquire_response_body([page = NonnullRefPtr<WebContentPage>(*this), navigable_id, navigation_id = move(navigation_id)](bool succeeded) {// The page may have closed while the body was fetched; its navigation then has nothing left to finish.if (!page->is_open())return;@@ -2143,13 +2137,13 @@ void WebContentPage::did_fail_navigation_population(Web::HTML::CrossProcessId naauto* ongoing_navigation = navigable->ongoing_navigation();if (!ongoing_navigation|| ongoing_navigation->navigation_id != navigation_id- || !navigable->navigation_owner_matches(*this)) {+ || (ongoing_navigation->worker() != this && ongoing_navigation->host() != this)) {return;}// Only a failed population handoff owns the loader's response body.- if (ongoing_navigation->loader && navigable->navigation_host_matches(*this))- ongoing_navigation->loader->reclaim_response_body_after_failed_handoff();+ if (auto* populating = ongoing_navigation->state.get_pointer<CanonicalNavigation::Populating>(); populating && populating->host.ptr() == this)+ populating->loader->reclaim_response_body_after_failed_handoff();m_history_recorded_url_for_current_load.clear();if (navigable->is_top_level_traversable()) {@@ -2256,9 +2250,9 @@ Messages::WebContentClient::DidStartDownloadResponse WebContentPage::did_start_dauto const* ongoing_navigation = navigable->ongoing_navigation();if (ongoing_navigation&& ongoing_navigation->navigation_id == navigation_id- && ongoing_navigation->phase == CanonicalNavigation::Phase::Populating- && ongoing_navigation->loader- && ongoing_navigation->loader->response_body_matches(request_server_client_id, request_server_request_id)) {+ && !ongoing_navigation->state.has<CanonicalNavigation::AcquiringResponseBody>()+ && ongoing_navigation->loader()+ && ongoing_navigation->loader()->response_body_matches(request_server_client_id, request_server_request_id)) {if (navigable->is_top_level_traversable()) {if (displays_tab())view().did_cancel_loading(ongoing_navigation->navigation_id);