Skip to content

Commit 2f52688

Browse files
This CL adds functionality that correctly handles network error of (web-platform-tests#28617)
Subresource Web Bundles. The problem is: when Web Bundle fetching fails due to a network error, Subresource fetch doesn't fail forever. One such case (subresource-loading-cors-error test) was timing out previously but passes successfully with this change. This CL also adds 2 WPT tests: 1. subresource-loading-network-error.https.tentative.sub.html 2. subresource-loading-web-bundle-fetch-failed.https.tentative.html Test #1 is a scenario with a different network error than the CORS one, but with the same issue of subresource fetching timing out without the change. It passes successfully after the change. Test #2 is a scenario with a Web bundle not found error, which is not directly influenced by the code added in this CL, but it expands the test coverage which was found to be lacking the error cases before. Bug: 1168449 Change-Id: Ia3abb967e36274becc86e317bc51b1272d3ae679 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2826001 Reviewed-by: Tsuyoshi Horo <horo@chromium.org> Reviewed-by: Hayato Ito <hayato@chromium.org> Reviewed-by: Kinuko Yasuda <kinuko@chromium.org> Commit-Queue: Miras Myrzakerey <myrzakereyms@google.com> Cr-Commit-Position: refs/heads/master@{#875532} Co-authored-by: Miras Myrzakerey <myrzakereyms@google.com>
1 parent 1e0d3a6 commit 2f52688

2 files changed

+64
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<!DOCTYPE html>
2+
<title>Web Bundle fetching failed due to a network error</title>
3+
<link rel="help" href="https://github.com/WICG/webpackage/blob/main/explainers/subresource-loading.md" />
4+
<script src="/resources/testharness.js"></script>
5+
<script src="/resources/testharnessreport.js"></script>
6+
<script src="../resources/test-helpers.js"></script>
7+
8+
<body>
9+
<!--
10+
This test uses a non-existing WebBundle from a non-existent host, which makes
11+
Web Bundle fetching fail due to a network error. The intent of is to chech if
12+
failing to fetch a WebBundle also makes subresource fetch requests fail.
13+
-->
14+
<script>
15+
promise_test(async () => {
16+
const prefix =
17+
"https://{{hosts[][nonexistent]}}/";
18+
const resources = [
19+
prefix + "resource.js",
20+
];
21+
const link = await addLinkAndWaitForError(
22+
prefix + "non-existing.wbn",
23+
resources,
24+
undefined
25+
);
26+
27+
// Can not fetch a subresource because Web Bundle fetch failed.
28+
await fetchAndWaitForReject(prefix + "resource.js");
29+
}, "Subresource fetch requests for non-existing Web Bundle should fail.");
30+
</script>
31+
</body>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<!DOCTYPE html>
2+
<title>Web Bundle fetching failed due to not found error</title>
3+
<link rel="help" href="https://github.com/WICG/webpackage/blob/main/explainers/subresource-loading.md" />
4+
<script src="/resources/testharness.js"></script>
5+
<script src="/resources/testharnessreport.js"></script>
6+
<script src="../resources/test-helpers.js"></script>
7+
8+
<body>
9+
<!--
10+
This test uses a non-existing WebBundle,
11+
https://web-platform.test:8444/web-bundle/resources/wbn/cors/non-existing.wbn.
12+
13+
The intent of this test is to check if failing to fetch a WebBundle due to not
14+
found error also makes subresource fetch requests fail.
15+
-->
16+
<script>
17+
promise_test(async () => {
18+
const prefix =
19+
"https://web-platform.test:8444/web-bundle/resources/wbn/";
20+
const resources = [
21+
prefix + "resource.js",
22+
];
23+
const link = await addLinkAndWaitForError(
24+
prefix + "non-existing.wbn",
25+
resources,
26+
undefined
27+
);
28+
29+
// Can not fetch a subresource because Web Bundle fetch failed.
30+
await fetchAndWaitForReject(prefix + "resource.js");
31+
}, "Subresource fetch requests for non-existing Web Bundle should fail.");
32+
</script>
33+
</body>

0 commit comments

Comments
 (0)