Bug 1736760 [wpt PR 31325] - Make WebBundle WPTs run against b2 bundles by default., a=testonly

Automatic update from web-platform-tests
Make WebBundle WPTs run against b2 bundles by default.

WPTs for WebBundle are currently using b1 bundles by default + some
tests use b2 bundles for limited coverage. This CL basically swaps the
two, making all WPTs to run against b2 bundles + basic test coverage for
b1 bundles.

Bug: 1249349
Change-Id: I9b5add2ffc35feb69da03395bd751436e681b879
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3233858
Reviewed-by: Kunihiko Sakamoto <ksakamoto@chromium.org>
Reviewed-by: Hayato Ito <hayato@chromium.org>
Commit-Queue: Miras Myrzakerey <myrzakereyms@google.com>
Cr-Commit-Position: refs/heads/main@{#933789}

--

wpt-commits: 00f570328f8bb9185aeb2045d11c2305bec61236
wpt-pr: 31325
This commit is contained in:
Miras Myrzakerey 2021-10-28 10:22:28 +00:00 committed by moz-wptsync-bot
parent 4573e91ef5
commit cebf0f60e0
31 changed files with 43 additions and 50 deletions

View File

@ -19,17 +19,10 @@ gen-bundle \
-baseURL $wpt_test_origin/web-bundle/resources/wbn/ \
-primaryURL $wpt_test_origin/web-bundle/resources/wbn/location.html \
-dir location/ \
-o wbn/location.wbn
-o wbn/location-b1.wbn
gen-bundle \
-version b1 \
-baseURL $wpt_test_origin/web-bundle/resources/wbn/ \
-primaryURL $wpt_test_origin/web-bundle/resources/wbn/root.js \
-dir subresource/ \
-o wbn/subresource.wbn
gen-bundle \
-version b1 \
-version b2 \
-baseURL $wpt_test_origin/web-bundle/resources/wbn/static-element/ \
-primaryURL $wpt_test_origin/web-bundle/resources/wbn/static-element/resources/style.css \
-dir static-element/ \
@ -40,33 +33,33 @@ gen-bundle \
-baseURL $wpt_test_origin/web-bundle/resources/wbn/dynamic/ \
-primaryURL $wpt_test_origin/web-bundle/resources/wbn/dynamic/resource1.js \
-dir dynamic1/ \
-o wbn/dynamic1.wbn
-o wbn/dynamic1-b1.wbn
gen-bundle \
-version b1 \
-baseURL $wpt_test_origin/web-bundle/resources/wbn/dynamic/ \
-primaryURL $wpt_test_origin/web-bundle/resources/wbn/dynamic/resource1.js \
-dir dynamic2/ \
-o wbn/dynamic2.wbn
-o wbn/dynamic2-b1.wbn
gen-bundle \
-version b1 \
-baseURL $wpt_test_remote_origin/web-bundle/resources/wbn/dynamic/ \
-primaryURL $wpt_test_remote_origin/web-bundle/resources/wbn/dynamic/resource1.js \
-dir dynamic1/ \
-o wbn/dynamic1-crossorigin.wbn
-o wbn/dynamic1-crossorigin-b1.wbn
gen-bundle \
-version b1 \
-baseURL $wpt_test_origin/web-bundle/resources/ \
-primaryURL $wpt_test_origin/web-bundle/resources/wbn/resource.js \
-dir path-restriction/ \
-o wbn/path-restriction.wbn
-o wbn/path-restriction-b1.wbn
# Create a bundle, nested-main.wbn, which includes nested-sub.wbn.
cp -a wbn/subresource.wbn nested/nested-sub.wbn
gen-bundle \
-version b1 \
-version b2 \
-baseURL $wpt_test_origin/web-bundle/resources/wbn/ \
-primaryURL $wpt_test_origin/web-bundle/resources/wbn/resource.js \
-dir nested/ \
@ -76,28 +69,28 @@ gen-bundle \
-version b1 \
-har urn-uuid.har \
-primaryURL urn:uuid:020111b3-437a-4c5c-ae07-adb6bbffb720 \
-o wbn/urn-uuid.wbn
-o wbn/urn-uuid-b1.wbn
gen-bundle \
-version b1 \
-har cross-origin.har \
-primaryURL $wpt_test_remote_origin/web-bundle/resources/wbn/cors/resource.cors.js \
-o wbn/cors/cross-origin.wbn
-o wbn/cors/cross-origin-b1.wbn
gen-bundle \
-version b1 \
-har cross-origin-no-cors.har \
-primaryURL $wpt_test_remote_origin/web-bundle/resources/wbn/no-cors/resource.cors.js \
-o wbn/no-cors/cross-origin.wbn
-o wbn/no-cors/cross-origin-b1.wbn
gen-bundle \
-version b1 \
-version b2 \
-har non-utf8-query-encoding.har \
-primaryURL $wpt_test_origin/web-bundle/resources/wbn/static-element/resources/script.js?x=%A4%A2 \
-o wbn/non-utf8-query-encoding.wbn
gen-bundle \
-version b1 \
-version b2 \
-har corp.har \
-primaryURL $wpt_test_remote_origin/web-bundle/resources/wbn/cors/no-corp.js \
-o wbn/cors/corp.wbn
@ -107,7 +100,7 @@ gen-bundle \
-baseURL $wpt_test_origin/web-bundle/resources/wbn/ \
-primaryURL $wpt_test_origin/web-bundle/resources/wbn/location.html \
-dir location/ \
-o wbn/location-b2.wbn
-o wbn/location.wbn
gen-bundle \
-version b2 \
@ -118,46 +111,46 @@ gen-bundle \
-version b2 \
-baseURL $wpt_test_origin/web-bundle/resources/wbn/ \
-dir subresource/ \
-o wbn/subresource-b2.wbn
-o wbn/subresource.wbn
gen-bundle \
-version b2 \
-baseURL $wpt_test_origin/web-bundle/resources/wbn/dynamic/ \
-dir dynamic1/ \
-o wbn/dynamic1-b2.wbn
-o wbn/dynamic1.wbn
gen-bundle \
-version b2 \
-baseURL $wpt_test_origin/web-bundle/resources/wbn/dynamic/ \
-dir dynamic2/ \
-o wbn/dynamic2-b2.wbn
-o wbn/dynamic2.wbn
gen-bundle \
-version b2 \
-baseURL $wpt_test_remote_origin/web-bundle/resources/wbn/dynamic/ \
-dir dynamic1/ \
-o wbn/dynamic1-crossorigin-b2.wbn
-o wbn/dynamic1-crossorigin.wbn
gen-bundle \
-version b2 \
-baseURL $wpt_test_origin/web-bundle/resources/ \
-dir path-restriction/ \
-o wbn/path-restriction-b2.wbn
-o wbn/path-restriction.wbn
gen-bundle \
-version b2 \
-har urn-uuid.har \
-o wbn/urn-uuid-b2.wbn
-o wbn/urn-uuid.wbn
gen-bundle \
-version b2 \
-har cross-origin.har \
-o wbn/cors/cross-origin-b2.wbn
-o wbn/cors/cross-origin.wbn
gen-bundle \
-version b2 \
-har cross-origin-no-cors.har \
-o wbn/no-cors/cross-origin-b2.wbn
-o wbn/no-cors/cross-origin.wbn
gen-bundle \
-version b2 \

View File

@ -38,8 +38,8 @@
"use-credentials",
]) {
for (const version_suffix of [
"", // b1
"-b2", // for b2
"-b1", // b1
"", // for b2
]) {
const link = await addLinkAndWaitForError(
prefix + "cross-origin" + version_suffix + ".wbn",

View File

@ -33,8 +33,8 @@
"use-credentials",
]) {
for (const version_suffix of [
"", // b1
"-b2", // for b2
"-b1", // b1
"", // for b2
]) {
const link = await addLinkAndWaitForLoad(
prefix + "cross-origin" + version_suffix + ".wbn",

View File

@ -1,5 +1,5 @@
<!DOCTYPE html>
<title>Path restriction on subresource loading with WebBundles</title>
<title>Path restriction on subresource loading with WebBundles (b1 version)</title>
<link
rel="help"
href="https://github.com/WICG/webpackage/blob/main/explainers/subresource-loading.md"
@ -10,7 +10,7 @@
<body>
<link
rel="webbundle"
href="../resources/wbn/path-restriction-b2.wbn"
href="../resources/wbn/path-restriction-b1.wbn"
resources="/web-bundle/resources/wbn/resource.js
/web-bundle/resources/wbn/sub/resource.js
/web-bundle/resources/wbn-resource.js

View File

@ -18,7 +18,7 @@ promise_test(t => {
promise_test(async () => {
const element = createWebBundleElement(
'../resources/wbn/dynamic1-b2.wbn',
'../resources/wbn/dynamic1-b1.wbn',
[
'https://{{domains[]}}:{{ports[https][0]}}/web-bundle/resources/wbn/dynamic/resource1.js',
'https://{{domains[]}}:{{ports[https][0]}}/web-bundle/resources/wbn/dynamic/resource2.js',
@ -29,20 +29,20 @@ promise_test(async () => {
const module = await import('https://{{domains[]}}:{{ports[https][0]}}/web-bundle/resources/wbn/dynamic/resource1.js');
assert_equals(module.result, 'resource1 from dynamic1.wbn');
document.body.removeChild(element);
}, 'Subresource loading from a b2 bundle');
}, 'Subresource loading from a b1 bundle');
promise_test(async () => {
const classic_script_url = 'https://{{domains[]}}:{{ports[https][0]}}/web-bundle/resources/wbn/dynamic/classic_script.js';
const element = createWebBundleElement(
'../resources/wbn/dynamic1-b2.wbn',
'../resources/wbn/dynamic1-b1.wbn',
[classic_script_url]);
document.body.appendChild(element);
assert_equals(
await loadScriptAndWaitReport(classic_script_url),
'classic script from dynamic1.wbn');
changeWebBundleUrl(element, '../resources/wbn/dynamic2-b2.wbn');
changeWebBundleUrl(element, '../resources/wbn/dynamic2-b1.wbn');
// Loading the classic script should not reuse the previously loaded
// script. So in this case, the script must be loaded from dynamic2-b2.wbn.
// script. So in this case, the script must be loaded from dynamic2-b1.wbn.
assert_equals(
await loadScriptAndWaitReport(classic_script_url),
'classic script from dynamic2.wbn');
@ -51,7 +51,7 @@ promise_test(async () => {
assert_equals(
await loadScriptAndWaitReport(classic_script_url),
'classic script from network');
}, 'Dynamically loading classic script from a \'b2\' web bundle with resources attribute');
}, 'Dynamically loading classic script from a \'b1\' web bundle with resources attribute');
promise_test(async () => {
const element = createWebBundleElement(
@ -66,7 +66,7 @@ promise_test(async () => {
const module = await import('https://{{domains[]}}:{{ports[https][0]}}/web-bundle/resources/wbn/dynamic/resource1.js');
assert_equals(module.result, 'resource1 from dynamic1.wbn');
changeWebBundleUrl(element, '../resources/wbn/dynamic2-b2.wbn');
changeWebBundleUrl(element, '../resources/wbn/dynamic2-b1.wbn');
const module2 = await import('https://{{domains[]}}:{{ports[https][0]}}/web-bundle/resources/wbn/dynamic/resource2.js');
assert_equals(module2.result, 'resource2 from dynamic2.wbn');
@ -94,7 +94,7 @@ promise_test(async () => {
assert_equals(
await loadScriptAndWaitReport(classic_script_url),
'classic script from dynamic1.wbn');
changeWebBundleUrl(element, '../resources/wbn/dynamic2-b2.wbn');
changeWebBundleUrl(element, '../resources/wbn/dynamic2-b1.wbn');
// Loading the classic script should not reuse the previously loaded
// script. So in this case, the script must be loaded from dynamic2.wbn.
assert_equals(
@ -217,12 +217,12 @@ promise_test(async () => {
promise_test(async () => {
const module_script_url = 'https://www1.{{domains[]}}:{{ports[https][0]}}/web-bundle/resources/wbn/dynamic/resource1.js';
const element = createWebBundleElement(
'../resources/wbn/dynamic1-crossorigin-b2.wbn',
'../resources/wbn/dynamic1-crossorigin-b1.wbn',
[module_script_url]);
document.body.appendChild(element);
const module = await import(module_script_url);
assert_equals(module.result, 'resource1 from network');
}, 'Subresource URL must be same-origin with bundle URL (for \'b2\' bundles too)');
}, 'Subresource URL must be same-origin with bundle URL (for \'b1\' bundles too)');
promise_test(async () => {
const url = 'urn:uuid:020111b3-437a-4c5c-ae07-adb6bbffb720';
@ -248,23 +248,23 @@ promise_test(async () => {
promise_test(async () => {
const url = 'urn:uuid:020111b3-437a-4c5c-ae07-adb6bbffb720';
const element = createWebBundleElement(
'../resources/wbn/urn-uuid-b2.wbn',
'../resources/wbn/urn-uuid-b1.wbn',
[url]);
document.body.appendChild(element);
assert_equals(await loadScriptAndWaitReport(url), 'OK');
document.body.removeChild(element);
}, 'Subresource loading with urn:uuid: URL of a \'b2\' bundle with resources attribute');
}, 'Subresource loading with urn:uuid: URL of a \'b1\' bundle with resources attribute');
promise_test(async () => {
const url = 'urn:uuid:020111b3-437a-4c5c-ae07-adb6bbffb720';
const element = createWebBundleElement(
'../resources/wbn/urn-uuid-b2.wbn',
'../resources/wbn/urn-uuid-b1.wbn',
[],
{scopes: ['urn:uuid:']});
document.body.appendChild(element);
assert_equals(await loadScriptAndWaitReport(url), 'OK');
document.body.removeChild(element);
}, 'Subresource loading with urn:uuid: URL of a \'b2\' bundle with scopes attribute');
}, 'Subresource loading with urn:uuid: URL of a \'b1\' bundle with scopes attribute');
promise_test(async () => {
const url = 'uuid-in-package:020111b3-437a-4c5c-ae07-adb6bbffb720';

View File

@ -8,11 +8,11 @@
promise_test(async (t) => {
// 'b1' version
assert_equals(
await getLocationPromise(""),
await getLocationPromise("-b1"),
get_host_info().HTTPS_ORIGIN + '/web-bundle/resources/wbn/location.html');
// 'b2' version
assert_equals(
await getLocationPromise("-b2"),
await getLocationPromise(""),
get_host_info().HTTPS_ORIGIN + '/web-bundle/resources/wbn/location.html');
}, 'Location of a page in a Web Bundle');