Truly independent web browser
LibWeb: Implement the upgrade-insecure-requests directive
Andreas Kling26357109de4d
diff --git a/Libraries/LibWeb/CMakeLists.txt b/Libraries/LibWeb/CMakeLists.txtindex f41f0c2ee3d..9e06a068bf2 100644--- a/Libraries/LibWeb/CMakeLists.txt+++ b/Libraries/LibWeb/CMakeLists.txt@@ -955,6 +955,7 @@ set(SOURCESTrustedTypes/TrustedScriptURL.cppTrustedTypes/TrustedTypePolicy.cppTrustedTypes/TrustedTypePolicyFactory.cpp+ UpgradeInsecureRequests/AbstractOperations.cppUIEvents/CompositionEvent.cppUIEvents/EventNames.cppUIEvents/FocusEvent.cppdiff --git a/Libraries/LibWeb/ContentSecurityPolicy/Directives/Names.h b/Libraries/LibWeb/ContentSecurityPolicy/Directives/Names.hindex 4b77acb2a6a..4d1eac54282 100644--- a/Libraries/LibWeb/ContentSecurityPolicy/Directives/Names.h+++ b/Libraries/LibWeb/ContentSecurityPolicy/Directives/Names.h@@ -10,31 +10,32 @@namespace Web::ContentSecurityPolicy::Directives::Names {-#define ENUMERATE_DIRECTIVE_NAMES \- __ENUMERATE_DIRECTIVE_NAME(BaseUri, "base-uri") \- __ENUMERATE_DIRECTIVE_NAME(ChildSrc, "child-src") \- __ENUMERATE_DIRECTIVE_NAME(ConnectSrc, "connect-src") \- __ENUMERATE_DIRECTIVE_NAME(DefaultSrc, "default-src") \- __ENUMERATE_DIRECTIVE_NAME(FontSrc, "font-src") \- __ENUMERATE_DIRECTIVE_NAME(FormAction, "form-action") \- __ENUMERATE_DIRECTIVE_NAME(FrameAncestors, "frame-ancestors") \- __ENUMERATE_DIRECTIVE_NAME(FrameSrc, "frame-src") \- __ENUMERATE_DIRECTIVE_NAME(ImgSrc, "img-src") \- __ENUMERATE_DIRECTIVE_NAME(ManifestSrc, "manifest-src") \- __ENUMERATE_DIRECTIVE_NAME(MediaSrc, "media-src") \- __ENUMERATE_DIRECTIVE_NAME(ObjectSrc, "object-src") \- __ENUMERATE_DIRECTIVE_NAME(ReportTo, "report-to") \- __ENUMERATE_DIRECTIVE_NAME(ReportUri, "report-uri") \- __ENUMERATE_DIRECTIVE_NAME(RequireTrustedTypesFor, "require-trusted-types-for") \- __ENUMERATE_DIRECTIVE_NAME(Sandbox, "sandbox") \- __ENUMERATE_DIRECTIVE_NAME(ScriptSrc, "script-src") \- __ENUMERATE_DIRECTIVE_NAME(ScriptSrcElem, "script-src-elem") \- __ENUMERATE_DIRECTIVE_NAME(ScriptSrcAttr, "script-src-attr") \- __ENUMERATE_DIRECTIVE_NAME(StyleSrc, "style-src") \- __ENUMERATE_DIRECTIVE_NAME(StyleSrcElem, "style-src-elem") \- __ENUMERATE_DIRECTIVE_NAME(StyleSrcAttr, "style-src-attr") \- __ENUMERATE_DIRECTIVE_NAME(TrustedTypes, "trusted-types") \- __ENUMERATE_DIRECTIVE_NAME(WebRTC, "webrtc") \+#define ENUMERATE_DIRECTIVE_NAMES \+ __ENUMERATE_DIRECTIVE_NAME(BaseUri, "base-uri") \+ __ENUMERATE_DIRECTIVE_NAME(ChildSrc, "child-src") \+ __ENUMERATE_DIRECTIVE_NAME(ConnectSrc, "connect-src") \+ __ENUMERATE_DIRECTIVE_NAME(DefaultSrc, "default-src") \+ __ENUMERATE_DIRECTIVE_NAME(FontSrc, "font-src") \+ __ENUMERATE_DIRECTIVE_NAME(FormAction, "form-action") \+ __ENUMERATE_DIRECTIVE_NAME(FrameAncestors, "frame-ancestors") \+ __ENUMERATE_DIRECTIVE_NAME(FrameSrc, "frame-src") \+ __ENUMERATE_DIRECTIVE_NAME(ImgSrc, "img-src") \+ __ENUMERATE_DIRECTIVE_NAME(ManifestSrc, "manifest-src") \+ __ENUMERATE_DIRECTIVE_NAME(MediaSrc, "media-src") \+ __ENUMERATE_DIRECTIVE_NAME(ObjectSrc, "object-src") \+ __ENUMERATE_DIRECTIVE_NAME(ReportTo, "report-to") \+ __ENUMERATE_DIRECTIVE_NAME(ReportUri, "report-uri") \+ __ENUMERATE_DIRECTIVE_NAME(RequireTrustedTypesFor, "require-trusted-types-for") \+ __ENUMERATE_DIRECTIVE_NAME(Sandbox, "sandbox") \+ __ENUMERATE_DIRECTIVE_NAME(ScriptSrc, "script-src") \+ __ENUMERATE_DIRECTIVE_NAME(ScriptSrcElem, "script-src-elem") \+ __ENUMERATE_DIRECTIVE_NAME(ScriptSrcAttr, "script-src-attr") \+ __ENUMERATE_DIRECTIVE_NAME(StyleSrc, "style-src") \+ __ENUMERATE_DIRECTIVE_NAME(StyleSrcElem, "style-src-elem") \+ __ENUMERATE_DIRECTIVE_NAME(StyleSrcAttr, "style-src-attr") \+ __ENUMERATE_DIRECTIVE_NAME(TrustedTypes, "trusted-types") \+ __ENUMERATE_DIRECTIVE_NAME(UpgradeInsecureRequests, "upgrade-insecure-requests") \+ __ENUMERATE_DIRECTIVE_NAME(WebRTC, "webrtc") \__ENUMERATE_DIRECTIVE_NAME(WorkerSrc, "worker-src")#define __ENUMERATE_DIRECTIVE_NAME(name, value) extern Utf16FlyString const& name;diff --git a/Libraries/LibWeb/Fetch/Fetching/Fetching.cpp b/Libraries/LibWeb/Fetch/Fetching/Fetching.cppindex da9747e3930..58a6c02185f 100644--- a/Libraries/LibWeb/Fetch/Fetching/Fetching.cpp+++ b/Libraries/LibWeb/Fetch/Fetching/Fetching.cpp@@ -69,6 +69,7 @@#include <LibWeb/Streams/ReadableStream.h>#include <LibWeb/Streams/ReadableStreamDefaultReader.h>#include <LibWeb/Streams/TransformStream.h>+#include <LibWeb/UpgradeInsecureRequests/AbstractOperations.h>#include <LibWeb/WebIDL/DOMException.h>#include <LibWeb/WebIDL/ExceptionOrUtils.h>#include <LibWebCommon/Fetch/Infrastructure/DataURL.h>@@ -446,7 +447,8 @@ GC::Ptr<PendingResponse> main_fetch(JS::Realm& realm, Infrastructure::FetchParam// 4. Run report Content Security Policy violations for request.ContentSecurityPolicy::report_content_security_policy_violations_for_request(realm, request);- // FIXME: 5. Upgrade request to a potentially trustworthy URL, if appropriate.+ // 5. Upgrade request to a potentially trustworthy URL, if appropriate.+ UpgradeInsecureRequests::upgrade_request_to_a_potentially_trustworthy_url_if_appropriate(request);// 6. Upgrade a mixed content request to a potentially trustworthy URL, if appropriate.MixedContent::upgrade_a_mixed_content_request_to_a_potentially_trustworthy_url_if_appropriate(request);diff --git a/Libraries/LibWeb/Fetch/Infrastructure/HTTP/Requests.cpp b/Libraries/LibWeb/Fetch/Infrastructure/HTTP/Requests.cppindex 0f281e235bf..1422d1e7b09 100644--- a/Libraries/LibWeb/Fetch/Infrastructure/HTTP/Requests.cpp+++ b/Libraries/LibWeb/Fetch/Infrastructure/HTTP/Requests.cpp@@ -251,6 +251,7 @@ GC::Ref<Request> Request::clone(JS::Realm& realm) constnew_request->set_text_directive_user_activation(m_text_directive_user_activation);new_request->set_browsing_context_group_has_multiple_contexts(m_browsing_context_group_has_multiple_contexts);new_request->set_user_agent_initiated(m_user_agent_initiated);+ new_request->set_form_submission(m_form_submission);new_request->set_render_blocking(m_render_blocking);new_request->set_url_list(m_url_list);new_request->set_redirect_count(m_redirect_count);diff --git a/Libraries/LibWeb/Fetch/Infrastructure/HTTP/Requests.h b/Libraries/LibWeb/Fetch/Infrastructure/HTTP/Requests.hindex f3a5223fbe2..28e2a73c766 100644--- a/Libraries/LibWeb/Fetch/Infrastructure/HTTP/Requests.h+++ b/Libraries/LibWeb/Fetch/Infrastructure/HTTP/Requests.h@@ -269,6 +269,9 @@ public:[[nodiscard]] bool user_agent_initiated() const { return m_user_agent_initiated; }void set_user_agent_initiated(bool user_agent_initiated) { m_user_agent_initiated = user_agent_initiated; }+ [[nodiscard]] bool is_form_submission() const { return m_form_submission; }+ void set_form_submission(bool form_submission) { m_form_submission = form_submission; }+[[nodiscard]] bool render_blocking() const { return m_render_blocking; }void set_render_blocking(bool render_blocking) { m_render_blocking = render_blocking; }@@ -507,6 +510,10 @@ private:// the user agent itself supplied, and populating a history entry sets this from the entry's document state.bool m_user_agent_initiated { false };+ // NB: Not a Fetch concept. Upgrade Insecure Requests asks whether a navigation request is a form submission, and+ // creating navigation params by fetching sets this from the navigation's CSP navigation type.+ bool m_form_submission { false };+// https://fetch.spec.whatwg.org/#request-render-blocking// A request has an associated boolean render-blocking. Unless stated otherwise, it is false.bool m_render_blocking { false };diff --git a/Libraries/LibWeb/HTML/LocalNavigable.cpp b/Libraries/LibWeb/HTML/LocalNavigable.cppindex 1f2e0d64f93..4b0f470dedc 100644--- a/Libraries/LibWeb/HTML/LocalNavigable.cpp+++ b/Libraries/LibWeb/HTML/LocalNavigable.cpp@@ -2307,6 +2307,14 @@ static void perform_navigation_params_fetch(JS::Realm& realm, GC::Ref<Navigationreturn;}+ // AD-HOC: Main fetch can upgrade request's current URL to a potentially trustworthy URL without a redirect.+ // Treat that like a redirect, so currentURL and entry's URL name the URL that was actually fetched,+ // which is also response's URL and the document's URL.+ if (state_holder->request->current_url() != state_holder->current_url) {+ state_holder->current_url = state_holder->request->current_url();+ state_holder->redirected_url = state_holder->current_url;+ }+// 8. If request's body is null, then set entry's document state's resource to null.if (state_holder->request->body().has<Empty>()) {state_holder->resource_cleared = true;@@ -2611,6 +2619,12 @@ static void create_navigation_params_by_fetching(if (document_state.user_agent_initiated == UserAgentInitiated::Yes && navigable && navigable->is_top_level_traversable())request->set_user_agent_initiated(true);+ // NB: What step 2.1 of Upgrade Insecure Requests' "upgrade request to a potentially trustworthy URL, if+ // appropriate" asks about.+ // https://w3c.github.io/webappsec-upgrade-insecure-requests/#upgrade-request+ if (csp_navigation_type == ContentSecurityPolicy::Directives::Directive::NavigationType::FormSubmission)+ request->set_form_submission(true);+// 10. If navigable's container is non-null:// NB: The container's local name is read through the navigable, which replicates it for a container in another// process.diff --git a/Libraries/LibWeb/UpgradeInsecureRequests/AbstractOperations.cpp b/Libraries/LibWeb/UpgradeInsecureRequests/AbstractOperations.cppnew file mode 100644index 00000000000..e060c08dd30--- /dev/null+++ b/Libraries/LibWeb/UpgradeInsecureRequests/AbstractOperations.cpp@@ -0,0 +1,136 @@+/*+ * Copyright (c) 2026-present, the Ladybird developers.+ *+ * SPDX-License-Identifier: BSD-2-Clause+ */++#include <LibWeb/ContentSecurityPolicy/Directives/Names.h>+#include <LibWeb/ContentSecurityPolicy/PolicyList.h>+#include <LibWeb/Fetch/Infrastructure/HTTP/Requests.h>+#include <LibWeb/HTML/BrowsingContext.h>+#include <LibWeb/HTML/PolicyContainers.h>+#include <LibWeb/HTML/Scripting/Environments.h>+#include <LibWeb/UpgradeInsecureRequests/AbstractOperations.h>+#include <LibWebCommon/SecureContexts/AbstractOperations.h>++namespace Web::UpgradeInsecureRequests {++// https://w3c.github.io/webappsec-upgrade-insecure-requests/#delivery+// AD-HOC: Enforcing the upgrade-insecure-requests directive sets the protected resource's settings' insecure requests+// policy to "Upgrade", and inserts a tuple of the protected resource's URL's host and port into settings'+// upgrade insecure navigations set. The spec then copies both into nested browsing contexts, their documents+// and workers. We instead derive both from settings' policy container's CSP list, which HTML already+// inherits into documents and workers with local scheme URLs, and use each policy's self-origin as the+// protected resource's URL. Monitoring the directive has no effect, so only enforced policies count.+// FIXME: Nested browsing contexts whose documents do not inherit their embedding document's policy container, and+// workers that do not inherit their owner's, should also inherit its insecure requests policy and upgrade+// insecure navigations set.+template<typename Callback>+static void for_each_enforced_policy_with_upgrade_insecure_requests(HTML::EnvironmentSettingsObject const& settings, Callback callback)+{+ for (auto const& policy : settings.policy_container()->csp_list->policies()) {+ if (policy->disposition() != ContentSecurityPolicy::Policy::Disposition::Enforce)+ continue;+ if (!policy->contains_directive_with_name(ContentSecurityPolicy::Directives::Names::UpgradeInsecureRequests))+ continue;+ if (callback(*policy) == IterationDecision::Break)+ return;+ }+}++static InsecureRequestsPolicy insecure_requests_policy(HTML::EnvironmentSettingsObject const& settings)+{+ auto result = InsecureRequestsPolicy::DoNotUpgrade;+ for_each_enforced_policy_with_upgrade_insecure_requests(settings, [&](auto const&) {+ result = InsecureRequestsPolicy::Upgrade;+ return IterationDecision::Break;+ });+ return result;+}++static bool upgrade_insecure_navigations_set_contains(HTML::EnvironmentSettingsObject const& settings, URL::URL const& url)+{+ auto const& host = url.host();+ if (!host.has_value())+ return false;++ bool result = false;+ for_each_enforced_policy_with_upgrade_insecure_requests(settings, [&](ContentSecurityPolicy::Policy const& policy) {+ auto const& self_origin = policy.self_origin();+ if (!self_origin.is_opaque() && self_origin.host() == *host && self_origin.port() == url.port()) {+ result = true;+ return IterationDecision::Break;+ }+ return IterationDecision::Continue;+ });+ return result;+}++// https://w3c.github.io/webappsec-upgrade-insecure-requests/#upgrade-request+void upgrade_request_to_a_potentially_trustworthy_url_if_appropriate(Fetch::Infrastructure::Request& request)+{+ // AD-HOC: This algorithm predates request's URL list. It notes that it upgrades insecurely-redirected requests as+ // well as insecure initial requests, which needs it to operate on request's current URL.+ auto& url = request.current_url();++ // 1. If request is a navigation request, append a header named Upgrade-Insecure-Requests with a value of 1 to+ // request's header list if any of the following criteria are met:+ // 1. request's URL is not a potentially trustworthy URL+ // 2. request's URL's host is not a preloadable HSTS host+ // NB: We have no preloaded HSTS hosts, so the second criterion is always met.+ // AD-HOC: Main fetch runs this algorithm again for every redirect, so only append the header once.+ if (request.is_navigation_request() && !request.header_list()->contains("Upgrade-Insecure-Requests"sv))+ request.header_list()->append(HTTP::Header::isomorphic_encode("Upgrade-Insecure-Requests"sv, "1"sv));++ // 2. If request is a navigation request, then:+ if (request.is_navigation_request()) {+ // 1. If request is a form submission, skip the remaining substeps, and continue upgrading request.+ // 2. If request's client's target browsing context is a nested browsing context, skip the remaining substeps+ // and continue upgrading request.+ // NB: A navigation request's target browsing context is its reserved client's.+ auto target_browsing_context = request.target_browsing_context();+ if (!request.is_form_submission() && (!target_browsing_context || target_browsing_context->is_top_level())) {+ // 3. Let tuple be a tuple of request's URL's host and port.+ // 4. If tuple is contained in client's upgrade insecure navigations set, then skip the remaining+ // substeps, and continue upgrading request.+ if (!request.client() || !upgrade_insecure_navigations_set_contains(*request.client(), url)) {+ // 5. Return without further modifying request.+ return;+ }+ }+ }++ // 3. Let upgrade state be the result of executing § 4.2 Should insecure requests be upgraded for client? upon+ // request's client.+ auto upgrade_state = should_insecure_requests_be_upgraded_for_client(request.client());++ // 4. If upgrade state is Do Not Upgrade, return without modifying request.+ if (upgrade_state == InsecureRequestsPolicy::DoNotUpgrade)+ return;++ // 5. If request's URL's scheme is "http", set request's URL's scheme to "https", and return.+ if (url.scheme() == "http"sv) {+ url.set_scheme("https"sv);++ // NB: Unlike the URL parser, setting the scheme does not remove a port that is the new scheme's default port.+ if (url.port() == 443)+ url.set_port({});+ }+}++// https://w3c.github.io/webappsec-upgrade-insecure-requests/#should-upgrade-for-client+InsecureRequestsPolicy should_insecure_requests_be_upgraded_for_client(GC::Ptr<HTML::EnvironmentSettingsObject> client)+{+ // AD-HOC: Fetch requests initiated by the browser UI have no client. Their requests are never upgraded.+ if (!client)+ return InsecureRequestsPolicy::DoNotUpgrade;++ // 1. If client has a responsible document, return the value of its insecure requests policy.+ // 2. If client has a responsible browsing context, return the value of its insecure requests policy.+ // 3. Return Do Not Upgrade.+ // NB: See for_each_enforced_policy_with_upgrade_insecure_requests() for how we determine client's insecure+ // requests policy.+ return insecure_requests_policy(*client);+}++}diff --git a/Libraries/LibWeb/UpgradeInsecureRequests/AbstractOperations.h b/Libraries/LibWeb/UpgradeInsecureRequests/AbstractOperations.hnew file mode 100644index 00000000000..9d09741c8fd--- /dev/null+++ b/Libraries/LibWeb/UpgradeInsecureRequests/AbstractOperations.h@@ -0,0 +1,25 @@+/*+ * Copyright (c) 2026-present, the Ladybird developers.+ *+ * SPDX-License-Identifier: BSD-2-Clause+ */++#pragma once++#include <LibGC/Ptr.h>+#include <LibWeb/Export.h>+#include <LibWeb/Forward.h>++namespace Web::UpgradeInsecureRequests {++// https://w3c.github.io/webappsec-upgrade-insecure-requests/#insecure-requests-policy+enum class InsecureRequestsPolicy {+ DoNotUpgrade,+ Upgrade,+};++WEB_API void upgrade_request_to_a_potentially_trustworthy_url_if_appropriate(Fetch::Infrastructure::Request&);++InsecureRequestsPolicy should_insecure_requests_be_upgraded_for_client(GC::Ptr<HTML::EnvironmentSettingsObject>);++}diff --git a/Libraries/LibWeb/WebSockets/WebSocket.cpp b/Libraries/LibWeb/WebSockets/WebSocket.cppindex b7b8b240bfb..f0f63e12451 100644--- a/Libraries/LibWeb/WebSockets/WebSocket.cpp+++ b/Libraries/LibWeb/WebSockets/WebSocket.cpp@@ -37,6 +37,7 @@#include <LibWeb/Loader/ResourceLoader.h>#include <LibWeb/MixedContent/AbstractOperations.h>#include <LibWeb/Platform/EventLoopPlugin.h>+#include <LibWeb/UpgradeInsecureRequests/AbstractOperations.h>#include <LibWeb/WebIDL/AbstractOperations.h>#include <LibWeb/WebIDL/Buffers.h>#include <LibWeb/WebIDL/DOMException.h>@@ -197,6 +198,7 @@ ErrorOr<void> WebSocket::establish_web_socket_connection(URL::URL const& url_recrequest->set_policy_container(client.policy_container()->clone(client.heap()));auto& realm = client.realm();ContentSecurityPolicy::report_content_security_policy_violations_for_request(realm, request);+ UpgradeInsecureRequests::upgrade_request_to_a_potentially_trustworthy_url_if_appropriate(request);if (Fetch::Infrastructure::block_bad_port(request) == Fetch::Infrastructure::RequestOrResponseBlocking::Blocked|| MixedContent::should_fetching_request_be_blocked_as_mixed_content(request) == Fetch::Infrastructure::RequestOrResponseBlocking::Blocked|| ContentSecurityPolicy::should_request_be_blocked_by_content_security_policy(realm, request) == ContentSecurityPolicy::Directives::Directive::Result::Blocked) {@@ -206,6 +208,11 @@ ErrorOr<void> WebSocket::establish_web_socket_connection(URL::URL const& url_recif (m_ready_state != Requests::WebSocket::ReadyState::Connecting)return Error::from_string_literal("The WebSocket was closed before it connected");+ // AD-HOC: Connect to the URL that the request was upgraded to, if any, with its scheme mapped back to "ws" or+ // "wss".+ auto connection_url = request->current_url();+ connection_url.set_scheme(connection_url.scheme() == "http"sv ? "ws"sv : "wss"sv);+if (m_has_disappeared)return Error::from_string_literal("The document of the WebSocket was unloaded before it connected");@@ -219,7 +226,7 @@ ErrorOr<void> WebSocket::establish_web_socket_connection(URL::URL const& url_recauto additional_headers = HTTP::HeaderList::create();- additional_headers->append({ "User-Agent"sv, ResourceLoader::the().user_agent_for_websocket_url(url_record).to_byte_string() });+ additional_headers->append({ "User-Agent"sv, ResourceLoader::the().user_agent_for_websocket_url(connection_url).to_byte_string() });if (ResourceLoader::proxy_autoconfig_url().has_value()) {dbgln("FIXME: Evaluate the PAC file to find the proxy for {}; failing the WebSocket connection", url_record);@@ -232,7 +239,7 @@ ErrorOr<void> WebSocket::establish_web_socket_connection(URL::URL const& url_recif (!request_client)return Error::from_string_literal("RequestServer is currently unavailable");- m_websocket = request_client->websocket_connect(url_record, Fetch::Infrastructure::determine_the_network_partition_key(client), origin_string, protocol_byte_strings, {}, additional_headers);+ m_websocket = request_client->websocket_connect(connection_url, Fetch::Infrastructure::determine_the_network_partition_key(client), origin_string, protocol_byte_strings, {}, additional_headers);m_websocket->on_open = GC::weak_callback(*this, [](auto& self) {self.on_open();diff --git a/Tests/LibWeb/Text/expected/ContentSecurityPolicy/upgrade-insecure-requests.txt b/Tests/LibWeb/Text/expected/ContentSecurityPolicy/upgrade-insecure-requests.txtindex 893ecc504ec..f8caa1398ad 100644--- a/Tests/LibWeb/Text/expected/ContentSecurityPolicy/upgrade-insecure-requests.txt+++ b/Tests/LibWeb/Text/expected/ContentSecurityPolicy/upgrade-insecure-requests.txt@@ -1,7 +1,7 @@-Document fetch: failed-Document fetch through an insecure redirect: failed-about:blank iframe fetch: failed-srcdoc iframe fetch: failed-data: URL worker fetch: failed-Cross-host top-level form submission: failed-iframe navigation location, document and history entry URL schemes: failed+Document fetch: loaded+Document fetch through an insecure redirect: loaded+about:blank iframe fetch: loaded+srcdoc iframe fetch: loaded+data: URL worker fetch: loaded+Cross-host top-level form submission: loaded+iframe navigation location, document and history entry URL schemes: https: https: https:diff --git a/Tests/LibWeb/Text/input/ContentSecurityPolicy/upgrade-insecure-requests.html b/Tests/LibWeb/Text/input/ContentSecurityPolicy/upgrade-insecure-requests.htmlindex cf31956d93c..92c4fff7516 100644--- a/Tests/LibWeb/Text/input/ContentSecurityPolicy/upgrade-insecure-requests.html+++ b/Tests/LibWeb/Text/input/ContentSecurityPolicy/upgrade-insecure-requests.html@@ -59,11 +59,7 @@form.target = "form-target";document.body.appendChild(form);form.submit();- // NB: A navigation that is not upgraded fails without telling this document, so give up after a while.- println(`Cross-host top-level form submission: ${await Promise.race([- nextMessage(),- new Promise(resolve => setTimeout(() => resolve("failed"), 2000)),- ])}`);+ println(`Cross-host top-level form submission: ${await nextMessage()}`);popup.close();// A nested navigation is upgraded without a redirect, and the upgraded URL becomes its session history entry's.@@ -75,10 +71,7 @@const navigatedFrame = document.createElement("iframe");navigatedFrame.src = `${insecureOrigin}${new URL(frameTargetURL).pathname}`;document.body.appendChild(navigatedFrame);- println(`iframe navigation location, document and history entry URL schemes: ${await Promise.race([- nextMessage(),- new Promise(resolve => setTimeout(() => resolve("failed"), 2000)),- ])}`);+ println(`iframe navigation location, document and history entry URL schemes: ${await nextMessage()}`);done();});