mirror of
https://github.com/servo/servo.git
synced 2025-08-11 00:15:32 +01:00
Update web-platform-tests to revision a184aa4fd5cd8f92eb87ce0035f257f2a4c7c0b2
This commit is contained in:
parent
e1065fa22a
commit
c7e8937c37
84 changed files with 2653 additions and 218 deletions
|
@ -10,6 +10,7 @@
|
|||
<link id="link_empty" />
|
||||
<link id="link_web_bundle_1" rel="webbundle" />
|
||||
<link id="link_web_bundle_2" rel="webbundle" resources="foo" />
|
||||
<link id="link_web_bundle_3" rel="webbundle" scopes="bar" />
|
||||
<script>
|
||||
test(() => {
|
||||
assert_false(
|
||||
|
@ -22,6 +23,17 @@
|
|||
);
|
||||
}, "resources must be defined on HTMLLinkElement prototype");
|
||||
|
||||
test(() => {
|
||||
assert_false(
|
||||
"scopes" in Element.prototype,
|
||||
"scopes must not be defined on Element prototype"
|
||||
);
|
||||
assert_true(
|
||||
"scopes" in HTMLLinkElement.prototype,
|
||||
"scopes must be defined on HTMLLinkElement prototype"
|
||||
);
|
||||
}, "scopes must be defined on HTMLLinkElement prototype");
|
||||
|
||||
test(() => {
|
||||
const link = document.createElement("link");
|
||||
assert_true(link.relList.supports("webbundle"));
|
||||
|
@ -55,6 +67,16 @@
|
|||
"foo",
|
||||
"resources attribute must return the specified value"
|
||||
);
|
||||
assert_equals(
|
||||
document.querySelector("#link_web_bundle_2").getAttribute("scopes"),
|
||||
null,
|
||||
"scopes attribute must return null when the attribute is not given"
|
||||
);
|
||||
assert_equals(
|
||||
document.querySelector("#link_web_bundle_3").getAttribute("scopes"),
|
||||
"bar",
|
||||
"scopes attribute must return the specified value"
|
||||
);
|
||||
// TODO: Test more variant of resoruces attribute values.
|
||||
}, "resoruces attribute must return null or specified value");
|
||||
|
||||
|
@ -75,5 +97,23 @@
|
|||
"https://test2.example.com"
|
||||
]);
|
||||
}, "resources must be DOMTokenList");
|
||||
|
||||
test(() => {
|
||||
const link = document.createElement("link");
|
||||
assert_class_string(link.scopes, "DOMTokenList");
|
||||
assert_equals(
|
||||
String(link.scopes.value),
|
||||
"",
|
||||
"scopes.value should return the empty list for an undefined scopes attribute"
|
||||
);
|
||||
link.setAttribute(
|
||||
"scopes",
|
||||
"https://test1.example.com https://test2.example.com "
|
||||
);
|
||||
assert_array_equals(link.scopes, [
|
||||
"https://test1.example.com",
|
||||
"https://test2.example.com"
|
||||
]);
|
||||
}, "scopes must be DOMTokenList");
|
||||
</script>
|
||||
</body>
|
||||
|
|
|
@ -80,7 +80,42 @@
|
|||
assert_equals(
|
||||
await loadScriptAndWaitReport(classic_script_url),
|
||||
'classic script from network');
|
||||
}, 'Dynamically loading classic script from web bundle');
|
||||
}, 'Dynamically loading classic script from web bundle with link.resources');
|
||||
|
||||
promise_test(async () => {
|
||||
const classic_script_url = 'http://web-platform.test:8001/web-bundle/resources/wbn/dynamic/classic_script.js';
|
||||
const scope = 'http://web-platform.test:8001/web-bundle/resources/wbn/dynamic/';
|
||||
const link = document.createElement("link");
|
||||
link.rel = "webbundle";
|
||||
link.href = "../resources/wbn/dynamic1.wbn";
|
||||
link.scopes.add(scope);
|
||||
document.body.appendChild(link);
|
||||
assert_equals(
|
||||
await loadScriptAndWaitReport(classic_script_url),
|
||||
'classic script from dynamic1.wbn');
|
||||
link.href = "../resources/wbn/dynamic2.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(
|
||||
await loadScriptAndWaitReport(classic_script_url),
|
||||
'classic script from dynamic2.wbn');
|
||||
// Changes the scope not to hit the classic_script.js.
|
||||
link.scopes = scope + 'dummy';
|
||||
// And in this case, the script must be loaded from network.
|
||||
assert_equals(
|
||||
await loadScriptAndWaitReport(classic_script_url),
|
||||
'classic script from network');
|
||||
// Adds the scope to hit the classic_script.js.
|
||||
link.scopes.add(scope + 'classic_');
|
||||
assert_equals(
|
||||
await loadScriptAndWaitReport(classic_script_url),
|
||||
'classic script from dynamic2.wbn');
|
||||
document.body.removeChild(link);
|
||||
// And in this case, the script must be loaded from network.
|
||||
assert_equals(
|
||||
await loadScriptAndWaitReport(classic_script_url),
|
||||
'classic script from network');
|
||||
}, 'Dynamically loading classic script from web bundle with link.scopes');
|
||||
|
||||
promise_test(() => {
|
||||
return addLinkAndWaitForLoad("../resources/wbn/dynamic1.wbn?test-event");
|
||||
|
@ -108,7 +143,19 @@
|
|||
link.resources = url;
|
||||
document.body.appendChild(link);
|
||||
assert_equals(await loadScriptAndWaitReport(url), 'OK');
|
||||
}, 'Subresource loading with urn:uuid: URL');
|
||||
document.body.removeChild(link);
|
||||
}, 'Subresource loading with urn:uuid: URL with link.resources');
|
||||
|
||||
promise_test(async () => {
|
||||
const url = 'urn:uuid:020111b3-437a-4c5c-ae07-adb6bbffb720';
|
||||
const link = document.createElement('link');
|
||||
link.rel = 'webbundle';
|
||||
link.href = '../resources/wbn/urn-uuid.wbn';
|
||||
link.scopes = 'urn:uuid:';
|
||||
document.body.appendChild(link);
|
||||
assert_equals(await loadScriptAndWaitReport(url), 'OK');
|
||||
document.body.removeChild(link);
|
||||
}, 'Subresource loading with urn:uuid: URL with link.scopes');
|
||||
|
||||
promise_test(async () => {
|
||||
const wbn_url = 'http://web-platform.test:8001/web-bundle/resources/wbn/subresource.wbn?test-resources-update';
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue