зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1652637 [wpt PR 24584] - Implement subresource loading with Web Bundles, a=testonly
Automatic update from web-platform-tests Implement subresource loading with Web Bundles - Adds WebBundleLoader class which loads a WebBundle resource using ThreadableLoader, and creates a WebBundleSubresourceLoaderFactory. - LinkWebBundle is registered in ResourceFetcher, and used to forward subresource requests that match the corresponding <link>'s resources= attribute to the WebBundleSubresourceLoaderFactory. This is done via the SubresourceWebBundle interface. Bug: 1082020 Change-Id: I3f26bd6b1fbd5855caa5175cdcb3db0fe103a093 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2291809 Reviewed-by: Kinuko Yasuda <kinuko@chromium.org> Reviewed-by: Tsuyoshi Horo <horo@chromium.org> Reviewed-by: Hayato Ito <hayato@chromium.org> Commit-Queue: Kunihiko Sakamoto <ksakamoto@chromium.org> Cr-Commit-Position: refs/heads/master@{#788842} -- wpt-commits: 7693fed05a080fcfc4da00907efda3885f20e5e9 wpt-pr: 24584
This commit is contained in:
Родитель
a5a13b5a9e
Коммит
69865eeac0
|
@ -45,6 +45,7 @@ TRAILING WHITESPACE, INDENT TABS, CR AT EOL: *.ico
|
|||
TRAILING WHITESPACE, INDENT TABS, CR AT EOL: *.wasm
|
||||
TRAILING WHITESPACE, INDENT TABS, CR AT EOL: *.bmp
|
||||
TRAILING WHITESPACE, INDENT TABS, CR AT EOL: *.sxg
|
||||
TRAILING WHITESPACE, INDENT TABS, CR AT EOL: *.wbn
|
||||
|
||||
## .gitignore
|
||||
W3C-TEST.ORG: .gitignore
|
||||
|
@ -707,6 +708,7 @@ WEB-PLATFORM.TEST:signed-exchange/resources/generate-test-sxgs.sh
|
|||
# Web Bundle files have hard-coded URLs
|
||||
WEB-PLATFORM.TEST:web-bundle/resources/generate-test-wbns.sh
|
||||
WEB-PLATFORM.TEST:web-bundle/resources/wbn/*.wbn
|
||||
WEB-PLATFORM.TEST:web-bundle/subresource-loading/subresource-loading-from-web-bundle.tentative.html
|
||||
|
||||
# Tests that depend on resources in /gen/ in Chromium:
|
||||
# https://github.com/web-platform-tests/wpt/issues/16455
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
export const result = 'resource1 from network';
|
|
@ -0,0 +1 @@
|
|||
export const result = 'resource2 from network';
|
|
@ -0,0 +1 @@
|
|||
export const result = 'resource3 from network';
|
|
@ -0,0 +1 @@
|
|||
export const result = 'resource4 from network';
|
|
@ -0,0 +1 @@
|
|||
export const result = 'resource1 from dynamic1.wbn';
|
|
@ -0,0 +1 @@
|
|||
export const result = 'resource2 from dynamic1.wbn';
|
|
@ -0,0 +1 @@
|
|||
export const result = 'resource3 from dynamic1.wbn';
|
|
@ -0,0 +1 @@
|
|||
export const result = 'resource4 from dynamic1.wbn';
|
|
@ -0,0 +1 @@
|
|||
export const result = 'resource1 from dynamic2.wbn';
|
|
@ -0,0 +1 @@
|
|||
export const result = 'resource2 from dynamic2.wbn';
|
|
@ -0,0 +1 @@
|
|||
export const result = 'resource3 from dynamic2.wbn';
|
|
@ -0,0 +1 @@
|
|||
export const result = 'resource4 from dynamic2.wbn';
|
|
@ -10,11 +10,33 @@ fi
|
|||
|
||||
# TODO: Stop hard-coding "web-platform.test" when generating Web Bundles on the
|
||||
# fly.
|
||||
wpt_test_origin=https://web-platform.test:8444
|
||||
wpt_test_https_origin=https://web-platform.test:8444
|
||||
wpt_test_http_origin=http://web-platform.test:8001
|
||||
|
||||
gen-bundle \
|
||||
-version b1 \
|
||||
-baseURL $wpt_test_origin/web-bundle/resources/wbn/ \
|
||||
-primaryURL $wpt_test_origin/web-bundle/resources/wbn/location.html \
|
||||
-baseURL $wpt_test_https_origin/web-bundle/resources/wbn/ \
|
||||
-primaryURL $wpt_test_https_origin/web-bundle/resources/wbn/location.html \
|
||||
-dir location/ \
|
||||
-o wbn/location.wbn
|
||||
|
||||
gen-bundle \
|
||||
-version b1 \
|
||||
-baseURL https://subresource-wbn.example/ \
|
||||
-primaryURL https://subresource-wbn.example/root.js \
|
||||
-dir subresource/ \
|
||||
-o wbn/subresource.wbn
|
||||
|
||||
gen-bundle \
|
||||
-version b1 \
|
||||
-baseURL $wpt_test_http_origin/web-bundle/resources/dynamic/ \
|
||||
-primaryURL $wpt_test_http_origin/web-bundle/resources/dynamic/resource1.js \
|
||||
-dir dynamic1/ \
|
||||
-o wbn/dynamic1.wbn
|
||||
|
||||
gen-bundle \
|
||||
-version b1 \
|
||||
-baseURL $wpt_test_http_origin/web-bundle/resources/dynamic/ \
|
||||
-primaryURL $wpt_test_http_origin/web-bundle/resources/dynamic/resource1.js \
|
||||
-dir dynamic2/ \
|
||||
-o wbn/dynamic2.wbn
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
export * from './submodule.js';
|
|
@ -0,0 +1 @@
|
|||
export const result = 'OK';
|
Двоичный файл не отображается.
Двоичный файл не отображается.
Двоичный файл не отображается.
|
@ -0,0 +1,65 @@
|
|||
<!DOCTYPE html>
|
||||
<title>Subresource loading with link rel="webbundle"</title>
|
||||
<link
|
||||
rel="help"
|
||||
href="https://github.com/WICG/webpackage/blob/master/explainers/subresource-loading.md"
|
||||
/>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<body>
|
||||
<link rel="webbundle" href="../resources/wbn/subresource.wbn"
|
||||
resources="https://subresource-wbn.example/root.js https://subresource-wbn.example/submodule.js" />
|
||||
<script>
|
||||
promise_test(async () => {
|
||||
const module = await import('https://subresource-wbn.example/root.js');
|
||||
assert_equals(module.result, 'OK');
|
||||
}, "Subresource loading with WebBundle");
|
||||
|
||||
promise_test(async () => {
|
||||
const link = document.createElement("link");
|
||||
link.rel = "webbundle";
|
||||
link.href = "../resources/wbn/dynamic1.wbn";
|
||||
link.resources.add('http://web-platform.test:8001/web-bundle/resources/dynamic/resource1.js',
|
||||
'http://web-platform.test:8001/web-bundle/resources/dynamic/resource2.js',
|
||||
'http://web-platform.test:8001/web-bundle/resources/dynamic/resource4.js');
|
||||
document.body.appendChild(link);
|
||||
|
||||
const module = await import('http://web-platform.test:8001/web-bundle/resources/dynamic/resource1.js');
|
||||
assert_equals(module.result, 'resource1 from dynamic1.wbn');
|
||||
|
||||
link.href = "../resources/wbn/dynamic2.wbn";
|
||||
const module2 = await import('http://web-platform.test:8001/web-bundle/resources/dynamic/resource2.js');
|
||||
assert_equals(module2.result, 'resource2 from dynamic2.wbn');
|
||||
|
||||
// A resource not specified in the resources attribute, but in the bundle.
|
||||
const module3 = await import('http://web-platform.test:8001/web-bundle/resources/dynamic/resource3.js');
|
||||
assert_equals(module3.result, 'resource3 from network');
|
||||
|
||||
document.body.removeChild(link);
|
||||
const module4 = await import('http://web-platform.test:8001/web-bundle/resources/dynamic/resource4.js');
|
||||
assert_equals(module4.result, 'resource4 from network');
|
||||
}, 'Dynamically adding / updating / removing "<link rel=webbundle>"');
|
||||
|
||||
promise_test(() => {
|
||||
return new Promise((resolve, reject) => {
|
||||
const link = document.createElement("link");
|
||||
link.rel = "webbundle";
|
||||
link.href = "../resources/wbn/dynamic1.wbn?test-event";
|
||||
link.onload = resolve;
|
||||
link.onerror = reject;
|
||||
document.body.appendChild(link);
|
||||
});
|
||||
}, '<link rel="webbundle"> fires a load event on load success');
|
||||
|
||||
promise_test(() => {
|
||||
return new Promise((resolve, reject) => {
|
||||
const link = document.createElement("link");
|
||||
link.rel = "webbundle";
|
||||
link.href = "../resources/wbn/nonexistent.wbn";
|
||||
link.onload = reject;
|
||||
link.onerror = resolve;
|
||||
document.body.appendChild(link);
|
||||
});
|
||||
}, '<link rel="webbundle"> fires an error event on load failure');
|
||||
</script>
|
||||
</body>
|
Загрузка…
Ссылка в новой задаче