Skip to content

Commit

Permalink
This CL adds functionality that correctly handles network error of (#…
Browse files Browse the repository at this point in the history
…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 <[email protected]>
Reviewed-by: Hayato Ito <[email protected]>
Reviewed-by: Kinuko Yasuda <[email protected]>
Commit-Queue: Miras Myrzakerey <[email protected]>
Cr-Commit-Position: refs/heads/master@{#875532}

Co-authored-by: Miras Myrzakerey <[email protected]>
  • Loading branch information
chromium-wpt-export-bot and myrzakereyms authored Apr 23, 2021
1 parent 1e0d3a6 commit 2f52688
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<!DOCTYPE html>
<title>Web Bundle fetching failed due to a network error</title>
<link rel="help" href="https://github.com/WICG/webpackage/blob/main/explainers/subresource-loading.md" />
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../resources/test-helpers.js"></script>

<body>
<!--
This test uses a non-existing WebBundle from a non-existent host, which makes
Web Bundle fetching fail due to a network error. The intent of is to chech if
failing to fetch a WebBundle also makes subresource fetch requests fail.
-->
<script>
promise_test(async () => {
const prefix =
"https://{{hosts[][nonexistent]}}/";
const resources = [
prefix + "resource.js",
];
const link = await addLinkAndWaitForError(
prefix + "non-existing.wbn",
resources,
undefined
);

// Can not fetch a subresource because Web Bundle fetch failed.
await fetchAndWaitForReject(prefix + "resource.js");
}, "Subresource fetch requests for non-existing Web Bundle should fail.");
</script>
</body>
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<!DOCTYPE html>
<title>Web Bundle fetching failed due to not found error</title>
<link rel="help" href="https://github.com/WICG/webpackage/blob/main/explainers/subresource-loading.md" />
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../resources/test-helpers.js"></script>

<body>
<!--
This test uses a non-existing WebBundle,
https://web-platform.test:8444/web-bundle/resources/wbn/cors/non-existing.wbn.
The intent of this test is to check if failing to fetch a WebBundle due to not
found error also makes subresource fetch requests fail.
-->
<script>
promise_test(async () => {
const prefix =
"https://web-platform.test:8444/web-bundle/resources/wbn/";
const resources = [
prefix + "resource.js",
];
const link = await addLinkAndWaitForError(
prefix + "non-existing.wbn",
resources,
undefined
);

// Can not fetch a subresource because Web Bundle fetch failed.
await fetchAndWaitForReject(prefix + "resource.js");
}, "Subresource fetch requests for non-existing Web Bundle should fail.");
</script>
</body>

0 comments on commit 2f52688

Please sign in to comment.