mirror of
https://github.com/servo/servo.git
synced 2025-08-04 13:10:20 +01:00
Update web-platform-tests to revision b'7af9d6ec48ab04043a2bea85a3599904a1a19efa'
This commit is contained in:
parent
8050c95e31
commit
87be1008de
2742 changed files with 142451 additions and 40667 deletions
|
@ -54,5 +54,18 @@
|
|||
});
|
||||
document.body.appendChild(iframe);
|
||||
}, "Malformed CSS should not load");
|
||||
|
||||
async_test(function (test) {
|
||||
const iframe = document.createElement("iframe");
|
||||
iframe.src = "resources/css-module-without-assertion-iframe.html";
|
||||
iframe.onload = test.step_func_done(function () {
|
||||
assert_equals(iframe.contentDocument.window_onerror, undefined);
|
||||
assert_equals(iframe.contentDocument.script_onerror.type, "error");
|
||||
assert_not_equals(getComputedStyle(iframe.contentDocument.querySelector('#test'))
|
||||
.backgroundColor, "rgb(255, 0, 0)",
|
||||
"CSS module without type assertion should result in a fetch error");
|
||||
});
|
||||
document.body.appendChild(iframe);
|
||||
}, "CSS module without type assertion should result in a fetch error");
|
||||
</script>
|
||||
</body>
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
<!doctype html>
|
||||
|
||||
<head>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<script>
|
||||
promise_test(async function (test) {
|
||||
const css_module = await import("./resources/basic.css", { assert: { type: "css" }});
|
||||
assert_true(css_module.default instanceof CSSStyleSheet);
|
||||
assert_equals(css_module.default.cssRules[0].cssText, "#test { background-color: red; }");
|
||||
}, "Load a CSS module with dynamic import()");
|
||||
|
||||
promise_test(function (test) {
|
||||
return promise_rejects_js(test, TypeError,
|
||||
import("./resources/basic.css"),
|
||||
"Attempting to import() a CSS module without a type assertion should fail");
|
||||
}, "Ensure that loading a CSS module with dymnamic import() fails without a type assertion");
|
||||
</script>
|
||||
</body>
|
|
@ -8,7 +8,7 @@
|
|||
};
|
||||
</script>
|
||||
<script type="module">
|
||||
import v from "./bad-import.css";
|
||||
import v from "./bad-import.css" assert { type: "css" };
|
||||
document.adoptedStyleSheets = [v];
|
||||
</script>
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
};
|
||||
</script>
|
||||
<script type="module">
|
||||
import v from "./basic.css";
|
||||
import v from "./basic.css" assert { type: "css" };
|
||||
document.adoptedStyleSheets = [v];
|
||||
</script>
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
};
|
||||
</script>
|
||||
<script type="module">
|
||||
import v from "./basic-large.css";
|
||||
import v from "./basic-large.css" assert { type: "css" };
|
||||
document.adoptedStyleSheets = [v];
|
||||
</script>
|
||||
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
<!DOCTYPE html>
|
||||
<body>
|
||||
<script>
|
||||
window.onerror = function (errorMsg, url, lineNumber, column, errorObj)
|
||||
{
|
||||
document.window_onerror = errorObj.name;
|
||||
return true;
|
||||
};
|
||||
|
||||
function scriptErrorHandler(e) {
|
||||
document.script_onerror = e;
|
||||
}
|
||||
</script>
|
||||
<script type="module" onerror="scriptErrorHandler(event)">
|
||||
import v from "./basic.css";
|
||||
document.adoptedStyleSheets = [v];
|
||||
</script>
|
||||
|
||||
<div id="test">
|
||||
I am a test div.
|
||||
</div>
|
||||
</body>
|
|
@ -1,7 +1,7 @@
|
|||
<!DOCTYPE html>
|
||||
<body>
|
||||
<script type="module">
|
||||
import v from "./malformed.css";
|
||||
import v from "./malformed.css" assert { type: "css" };
|
||||
document.adoptedStyleSheets = [v];
|
||||
</script>
|
||||
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
import("./basic.css")
|
||||
import("./basic.css", { assert: { type: "css" } })
|
||||
.then(() => postMessage("LOADED"))
|
||||
.catch(e => postMessage("NOT LOADED"));
|
|
@ -1,2 +1,2 @@
|
|||
import "./basic.css";
|
||||
import "./basic.css" assert { type: "css" };
|
||||
postMessage("Unexpectedly loaded");
|
|
@ -17,18 +17,18 @@ const t3 = async_test("windows-1252");
|
|||
const t4 = async_test("utf-7");
|
||||
</script>
|
||||
<script type="module" onerror="t1.step(() => assert_unreached(event))">
|
||||
import v from "../serve-with-content-type.py?fn=css-module/resources/utf8.css&ct=text/css%3Bcharset=utf-8";
|
||||
import v from "../serve-with-content-type.py?fn=css-module/resources/utf8.css&ct=text/css%3Bcharset=utf-8" assert { type: "css" };
|
||||
check(t1, v);
|
||||
</script>
|
||||
<script type="module" onerror="t2.step(() => assert_unreached(event))">
|
||||
import v from "../serve-with-content-type.py?fn=css-module/resources/utf8.css&ct=text/css%3Bcharset=shift-jis";
|
||||
import v from "../serve-with-content-type.py?fn=css-module/resources/utf8.css&ct=text/css%3Bcharset=shift-jis" assert { type: "css" };
|
||||
check(t2, v);
|
||||
</script>
|
||||
<script type="module" onerror="t3.step(() => assert_unreached(event))">
|
||||
import v from "../serve-with-content-type.py?fn=css-module/resources/utf8.css&ct=text/css%3Bcharset=windows-1252";
|
||||
import v from "../serve-with-content-type.py?fn=css-module/resources/utf8.css&ct=text/css%3Bcharset=windows-1252" assert { type: "css" };
|
||||
check(t3, v);
|
||||
</script>
|
||||
<script type="module" onerror="t4.step(() => assert_unreached(event))">
|
||||
import v from "../serve-with-content-type.py?fn=css-module/resources/utf8.css&ct=text/css%3Bcharset=utf-7";
|
||||
import v from "../serve-with-content-type.py?fn=css-module/resources/utf8.css&ct=text/css%3Bcharset=utf-7" assert { type: "css" };
|
||||
check(t4, v);
|
||||
</script>
|
||||
|
|
|
@ -10,11 +10,11 @@
|
|||
assert_not_equals(reg.installing, undefined);
|
||||
}, "Javascript importing JSON Module should load within the context of a service worker");
|
||||
|
||||
promise_test(async (test) => {
|
||||
const reg = await navigator.serviceWorker.register('./module.json', { type: 'module' });
|
||||
test.add_cleanup(() => reg.unregister());
|
||||
assert_not_equals(reg.installing, undefined);
|
||||
}, "JSON Modules should load within the context of a service worker");
|
||||
promise_test(test => {
|
||||
return promise_rejects_dom(test, "SecurityError",
|
||||
navigator.serviceWorker.register('./module.json', { type: 'module' }),
|
||||
"Attempting to load JSON as a service worker should fail");
|
||||
}, "Trying to register a service worker with a top-level JSON Module should fail");
|
||||
|
||||
promise_test(async (test) => {
|
||||
const reg = await navigator.serviceWorker.register('./serviceworker-dynamic-import.js', { type: 'module' });
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
const t = async_test();
|
||||
</script>
|
||||
<script type="module" onerror="t.step(() => assert_unreached(event))">
|
||||
import v from "./module.json";
|
||||
import v from "./module.json" assert { type: "json" };
|
||||
t.step(() => {
|
||||
assert_equals(typeof v, "object");
|
||||
assert_array_equals(Object.keys(v), ["test"]);
|
||||
|
|
|
@ -2,13 +2,13 @@
|
|||
|
||||
for (const value of [null, true, false, "string"]) {
|
||||
promise_test(async t => {
|
||||
const result = await import(`./${value}.json`);
|
||||
const result = await import(`./${value}.json`, { assert: { type: "json" } });
|
||||
assert_equals(result.default, value);
|
||||
}, `Non-object: ${value}`);
|
||||
}
|
||||
|
||||
promise_test(async t => {
|
||||
const result = await import("./array.json");
|
||||
const result = await import("./array.json", { assert: { type: "json" } });
|
||||
assert_array_equals(result.default, ["en", "try"]);
|
||||
}, "Non-object: array");
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
onmessage = e => {
|
||||
e.waitUntil(import("./module.json")
|
||||
e.waitUntil(import("./module.json", { assert: { type: "json" } })
|
||||
.then(module => e.source.postMessage("LOADED"))
|
||||
.catch(error => e.source.postMessage("FAILED")));
|
||||
};
|
|
@ -1 +1 @@
|
|||
import './module.json';
|
||||
import './module.json' assert { type: "json" };
|
|
@ -19,18 +19,18 @@ const t3 = async_test("windows-1252");
|
|||
const t4 = async_test("utf-7");
|
||||
</script>
|
||||
<script type="module" onerror="t1.step(() => assert_unreached(event))">
|
||||
import v from "../serve-with-content-type.py?fn=json-module/utf8.json&ct=text/json%3Bcharset=utf-8";
|
||||
import v from "../serve-with-content-type.py?fn=json-module/utf8.json&ct=text/json%3Bcharset=utf-8" assert { type: "json"};
|
||||
check(t1, v);
|
||||
</script>
|
||||
<script type="module" onerror="t2.step(() => assert_unreached(event))">
|
||||
import v from "../serve-with-content-type.py?fn=json-module/utf8.json&ct=text/json%3Bcharset=shift-jis";
|
||||
import v from "../serve-with-content-type.py?fn=json-module/utf8.json&ct=text/json%3Bcharset=shift-jis" assert { type: "json"};
|
||||
check(t2, v);
|
||||
</script>
|
||||
<script type="module" onerror="t3.step(() => assert_unreached(event))">
|
||||
import v from "../serve-with-content-type.py?fn=json-module/utf8.json&ct=text/json%3Bcharset=windows-1252";
|
||||
import v from "../serve-with-content-type.py?fn=json-module/utf8.json&ct=text/json%3Bcharset=windows-1252" assert { type: "json"};
|
||||
check(t3, v);
|
||||
</script>
|
||||
<script type="module" onerror="t4.step(() => assert_unreached(event))">
|
||||
import v from "../serve-with-content-type.py?fn=json-module/utf8.json&ct=text/json%3Bcharset=utf-7";
|
||||
import v from "../serve-with-content-type.py?fn=json-module/utf8.json&ct=text/json%3Bcharset=utf-7" assert { type: "json"};;
|
||||
check(t4, v);
|
||||
</script>
|
||||
|
|
|
@ -19,18 +19,18 @@ const t3 = async_test("text/html+json");
|
|||
const t4 = async_test("image/svg+json");
|
||||
</script>
|
||||
<script type="module" onerror="t1.step(() => assert_unreached(event))">
|
||||
import v from "../serve-with-content-type.py?fn=json-module/module.json&ct=text/json";
|
||||
import v from "../serve-with-content-type.py?fn=json-module/module.json&ct=text/json" assert { type: "json"};
|
||||
check(t1, v);
|
||||
</script>
|
||||
<script type="module" onerror="t2.step(() => assert_unreached(event))">
|
||||
import v from "../serve-with-content-type.py?fn=json-module/module.json&ct=application/json";
|
||||
import v from "../serve-with-content-type.py?fn=json-module/module.json&ct=application/json" assert { type: "json"};
|
||||
check(t2, v);
|
||||
</script>
|
||||
<script type="module" onerror="t3.step(() => assert_unreached(event))">
|
||||
import v from "../serve-with-content-type.py?fn=json-module/module.json&ct=text/html+json";
|
||||
import v from "../serve-with-content-type.py?fn=json-module/module.json&ct=text/html+json" assert { type: "json"};
|
||||
check(t3, v);
|
||||
</script>
|
||||
<script type="module" onerror="t4.step(() => assert_unreached(event))">
|
||||
import v from "../serve-with-content-type.py?fn=json-module/module.json&ct=image/svg+json";
|
||||
import v from "../serve-with-content-type.py?fn=json-module/module.json&ct=image/svg+json" assert { type: "json"};
|
||||
check(t4, v);
|
||||
</script>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue