Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

This CL adds functionality that correctly handles network error of Subresource Web Bundles. #28617

Merged
merged 1 commit into from
Apr 23, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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>