Skip to content

Truly independent web browser

Tests: Correct what fetch and navigation tests claim

Luke Wilde508659c5d176
diff --git a/Tests/LibWeb/TestFetchAlgorithms.cpp b/Tests/LibWeb/TestFetchAlgorithms.cpp
index 858fa4eb749..785f90784a6 100644
--- a/Tests/LibWeb/TestFetchAlgorithms.cpp
+++ b/Tests/LibWeb/TestFetchAlgorithms.cpp
@@ -149,7 +149,7 @@ TEST_CASE(each_algorithm_gets_the_same_response_with_a_body_in_order)
EXPECT_EQ(*consumed_bytes, MUST(ByteBuffer::copy("hello"sv.bytes())));
}
-TEST_CASE(a_stopped_fetch_runs_no_algorithm_but_its_request_is_done)
+TEST_CASE(a_fetch_stopped_before_its_response_runs_no_algorithm_but_its_request_is_done)
{
Core::EventLoop event_loop;
install_font_plugin();
diff --git a/Tests/LibWeb/TestFetchByteChannel.cpp b/Tests/LibWeb/TestFetchByteChannel.cpp
index eb03238aa93..f28b23be1fc 100644
--- a/Tests/LibWeb/TestFetchByteChannel.cpp
+++ b/Tests/LibWeb/TestFetchByteChannel.cpp
@@ -271,7 +271,7 @@ TEST_CASE(credit_accounting_with_batched_replenishment)
EXPECT_EQ(events[0].kind, SinkEvent::Kind::CreditGrant);
EXPECT_EQ(events[0].value, 30u); // 64 high - 10 buffered - 24 outstanding
- // No further grant until the buffer crosses the low watermark again.
+ // A further take below the low watermark replenishes again, by the one byte it took.
result = harness.channel->take_up_to(1);
EXPECT_EQ(result.buffered_byte_count, 9u);
events = harness.take_events();
diff --git a/Tests/LibWeb/Text/input/Cache/http-memory-cache-discarded-response.html b/Tests/LibWeb/Text/input/Cache/http-memory-cache-discarded-response.html
index 2b1832ea487..c5d8382616c 100644
--- a/Tests/LibWeb/Text/input/Cache/http-memory-cache-discarded-response.html
+++ b/Tests/LibWeb/Text/input/Cache/http-memory-cache-discarded-response.html
@@ -1,8 +1,8 @@
<!DOCTYPE html>
<script src="../include.js"></script>
<script>
- // A response the fetch discards leaves no memory-cache entry behind, pending or complete. A later response for the
- // same request is the one the cache stores.
+ // With no other response for the request pending, a response the fetch discards mid-body leaves no pending
+ // memory-cache entry behind, so a later response for the same request is the one the cache stores.
//
// The Accept marker rides each fetch (CORS-safelisted, and the response has no Vary). The server records the last
// marker it saw, which tells a hit from a miss.
diff --git a/Tests/LibWeb/Text/input/ContentSecurityPolicy/upgrade-insecure-requests-navigations-set-growth.html b/Tests/LibWeb/Text/input/ContentSecurityPolicy/upgrade-insecure-requests-navigations-set-growth.html
index 30707b72406..4ab806cb698 100644
--- a/Tests/LibWeb/Text/input/ContentSecurityPolicy/upgrade-insecure-requests-navigations-set-growth.html
+++ b/Tests/LibWeb/Text/input/ContentSecurityPolicy/upgrade-insecure-requests-navigations-set-growth.html
@@ -4,10 +4,10 @@
<meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests">
<script>
// This port serves HTTPS, so a navigation to an http: URL with it only succeeds if the request was upgraded to
- // https:. A top-level navigation is upgraded only if its URL's host and port are in its source's upgrade insecure
- // navigations set. The frame inherits our policy, then enforces one of its own, which adds its host and port to
- // its set but leaves its policy as it was. Its child is cross-site with it, so another process hosts the child,
- // whose next document inherits the frame's set as that process last learned it.
+ // https:. A top-level navigation other than a form submission is upgraded only if its URL's host and port are in
+ // its source's upgrade insecure navigations set. The frame inherits our policy, then enforces one of its own,
+ // which adds its host and port to its set but leaves its policy as it was. Its child is cross-site with it, so
+ // another process hosts the child, whose next document inherits the frame's set as that process last learned it.
const httpsPort = internals.getHttpsEchoServerPort();
const secureServer = new HTTPTestServer(`https://127.0.0.1:${httpsPort}`);
diff --git a/Tests/LibWeb/Text/input/Fetch/fetch-body-delivery-order.html b/Tests/LibWeb/Text/input/Fetch/fetch-body-delivery-order.html
index dcce8c3b17f..a13d0fef14c 100644
--- a/Tests/LibWeb/Text/input/Fetch/fetch-body-delivery-order.html
+++ b/Tests/LibWeb/Text/input/Fetch/fetch-body-delivery-order.html
@@ -1,11 +1,10 @@
<!DOCTYPE html>
<script src="../include.js"></script>
<script>
- // Body bytes and the close reach the stream from queued tasks, one per delivery. A read's
- // reaction and anything it queues run before the next chunk's delivery task, and the close
- // follows the last bytes through the same queue. The chunks arrive 300 ms apart, and a timer a
- // reaction queues fires before the next delivery; a run slow enough to let a chunk in first is
- // retried with the chunks a second apart.
+ // With a read always pending and the chunks 300 ms apart, each chunk reaches the stream in a pull task of its
+ // own, and the close follows the last bytes through the same queue. So a read's reaction and a timer it queues
+ // run before the next chunk's pull task; a run slow enough to let a chunk in first is retried with the chunks a
+ // second apart.
asyncTest(async done => {
const httpServer = httpTestServer();
const body = "A".repeat(16) + "B".repeat(16) + "C".repeat(16);
diff --git a/Tests/LibWeb/Text/input/include.js b/Tests/LibWeb/Text/input/include.js
index 6c3a5d9c275..79d95756819 100644
--- a/Tests/LibWeb/Text/input/include.js
+++ b/Tests/LibWeb/Text/input/include.js
@@ -318,7 +318,7 @@ function uniqueLocalhostHostname(prefix) {
return `${prefix}-${uniqueID()}.localhost`;
}
-// Per-call unique loopback host whose origin is not potentially trustworthy.
+// Per-call unique loopback host whose http: origin is not potentially trustworthy.
function uniqueTestHostname(prefix) {
return `${prefix}-${uniqueID()}.test`;
}
diff --git a/Tests/LibWeb/Text/input/navigation/transferred-body-released-when-unread.html b/Tests/LibWeb/Text/input/navigation/transferred-body-released-when-unread.html
index 473073fe147..0813a4699a0 100644
--- a/Tests/LibWeb/Text/input/navigation/transferred-body-released-when-unread.html
+++ b/Tests/LibWeb/Text/input/navigation/transferred-body-released-when-unread.html
@@ -82,8 +82,8 @@
const server = httpTestServer();
const size = 2 * 1024 * 1024;
- // Each body outgrows its channel and the request's pipe together, and its request ends only when the body is
- // read or the request is stopped.
+ // Each body is larger than the process loading it takes before it is read, and its request ends only when the
+ // body is read or the request is stopped.
const refused = new URL(await server.createEcho("GET", `/unread-body-refused-${crypto.randomUUID()}`, {
status: 200,
headers: { "Cache-Control": "no-store", "Content-Type": "text/html", "X-Frame-Options": "DENY" },
diff --git a/Tests/LibWebView/test-webdriver-bidi.py b/Tests/LibWebView/test-webdriver-bidi.py
index 385e73c18bc..08073f27861 100755
--- a/Tests/LibWebView/test-webdriver-bidi.py
+++ b/Tests/LibWebView/test-webdriver-bidi.py
@@ -1684,7 +1684,7 @@ def check_network_adopted_navigation_events(bidi, context, server):
else:
assert isinstance(params["errorText"], str) and params["errorText"], params
- # Only the document's process reports the end of its body, and only once.
+ # No second report of the body's end arrives before a round trip to the document's process.
bidi.evaluate(context, "0")
assert not any(event["method"] in terminal_methods and is_our_event(event) for event in bidi.events), (
bidi.events