mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Implemented paint worklets invoking worklet scripts.
This commit is contained in:
parent
9a13cf6bda
commit
3db4761767
20 changed files with 575 additions and 19 deletions
|
@ -11271,6 +11271,41 @@
|
|||
{}
|
||||
]
|
||||
],
|
||||
"mozilla/worklets/test_paint_worklet_alpha_throws.js": [
|
||||
[
|
||||
{}
|
||||
]
|
||||
],
|
||||
"mozilla/worklets/test_paint_worklet_arguments_throws.js": [
|
||||
[
|
||||
{}
|
||||
]
|
||||
],
|
||||
"mozilla/worklets/test_paint_worklet_empty_name.js": [
|
||||
[
|
||||
{}
|
||||
]
|
||||
],
|
||||
"mozilla/worklets/test_paint_worklet_no_paint.js": [
|
||||
[
|
||||
{}
|
||||
]
|
||||
],
|
||||
"mozilla/worklets/test_paint_worklet_not_constructor.js": [
|
||||
[
|
||||
{}
|
||||
]
|
||||
],
|
||||
"mozilla/worklets/test_paint_worklet_paint_not_callable.js": [
|
||||
[
|
||||
{}
|
||||
]
|
||||
],
|
||||
"mozilla/worklets/test_paint_worklet_properties_throws.js": [
|
||||
[
|
||||
{}
|
||||
]
|
||||
],
|
||||
"mozilla/worklets/test_paint_worklet_ref.html": [
|
||||
[
|
||||
{}
|
||||
|
@ -20162,6 +20197,12 @@
|
|||
{}
|
||||
]
|
||||
],
|
||||
"mozilla/worklets/test_paint_worklet_loading.html": [
|
||||
[
|
||||
"/_mozilla/mozilla/worklets/test_paint_worklet_loading.html",
|
||||
{}
|
||||
]
|
||||
],
|
||||
"mozilla/worklets/test_worklet.html": [
|
||||
[
|
||||
"/_mozilla/mozilla/worklets/test_worklet.html",
|
||||
|
@ -31907,6 +31948,38 @@
|
|||
"e714db50da9e5cb18c652629fcc1b5ccc453564d",
|
||||
"support"
|
||||
],
|
||||
"mozilla/worklets/test_paint_worklet_alpha_throws.js": [
|
||||
"fe7df9db6799494f4d24f5ad00349f3aeebb2c23",
|
||||
"support"
|
||||
],
|
||||
"mozilla/worklets/test_paint_worklet_arguments_throws.js": [
|
||||
"64ef8ea909c96c23932f77dd9ef793f85cfbb38d",
|
||||
"support"
|
||||
],
|
||||
"mozilla/worklets/test_paint_worklet_empty_name.js": [
|
||||
"589e2a4061e51122750afe2d72f8f609ffb9b216",
|
||||
"support"
|
||||
],
|
||||
"mozilla/worklets/test_paint_worklet_loading.html": [
|
||||
"20fef90b09fdf8dfb5e7461a01c8bd0f7e5d31af",
|
||||
"testharness"
|
||||
],
|
||||
"mozilla/worklets/test_paint_worklet_no_paint.js": [
|
||||
"ad637c4f670a8be2814ff21dbc916157293892e5",
|
||||
"support"
|
||||
],
|
||||
"mozilla/worklets/test_paint_worklet_not_constructor.js": [
|
||||
"70e69524890892e855155fc762a46c8cebaa1fbe",
|
||||
"support"
|
||||
],
|
||||
"mozilla/worklets/test_paint_worklet_paint_not_callable.js": [
|
||||
"51f1b485d5c505c918edec8a146d54d9e0cf60d9",
|
||||
"support"
|
||||
],
|
||||
"mozilla/worklets/test_paint_worklet_properties_throws.js": [
|
||||
"50fd53b8f561edda7c6bc8a0e9ac7207bdf22d8b",
|
||||
"support"
|
||||
],
|
||||
"mozilla/worklets/test_paint_worklet_ref.html": [
|
||||
"e9cfa945824a8ecf07c41a269f82a2c2ca002406",
|
||||
"support"
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
registerPaint("alphaThrows", class {
|
||||
static get alpha() { throw new TypeError(); }
|
||||
paint(ctx, size) { }
|
||||
});
|
|
@ -0,0 +1,4 @@
|
|||
registerPaint("argumentsThrows", class {
|
||||
static get inputArguments() { throw new TypeError(); }
|
||||
paint(ctx, size) { }
|
||||
});
|
|
@ -0,0 +1,6 @@
|
|||
registerPaint("", class {
|
||||
paint(ctx, size) {
|
||||
ctx.fillStyle = 'green';
|
||||
ctx.fillRect(0, 0, size.width, size.height);
|
||||
}
|
||||
});
|
|
@ -0,0 +1,63 @@
|
|||
<!doctype html>
|
||||
<meta charset="utf-8">
|
||||
<title>Test paint worklet loading</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/common/get-host-info.sub.js"></script>
|
||||
<script>
|
||||
var host_info = get_host_info();
|
||||
|
||||
promise_test(function() {
|
||||
return paintWorklet.addModule("test_paint_worklet.js");
|
||||
}, "Loading a paint worklet.");
|
||||
|
||||
promise_test(function(t) {
|
||||
var path = new URL("test_paint_worklet.js", document.location).pathname;
|
||||
var url = new URL(path, host_info.HTTP_REMOTE_ORIGIN);
|
||||
return promise_rejects(t, "AbortError", paintWorklet.addModule(url));
|
||||
}, "Loading a cross-origin paint worklet.");
|
||||
|
||||
promise_test(function(t) {
|
||||
return promise_rejects(t, "AbortError", paintWorklet.addModule("nonexistent_worklet.js"));
|
||||
}, "Loading a nonexistent paint worklet.");
|
||||
|
||||
promise_test(function(t) {
|
||||
return promise_rejects(t, "AbortError", paintWorklet.addModule("syntax_error.js"));
|
||||
}, "Loading a syntactically incorrect paint worklet.");
|
||||
|
||||
promise_test(function(t) {
|
||||
return promise_rejects(t, "AbortError", paintWorklet.addModule("throw_exception.js"));
|
||||
}, "Loading an exception-throwing paint worklet.");
|
||||
|
||||
promise_test(function(t) {
|
||||
return promise_rejects(t, "AbortError", paintWorklet.addModule("test_paint_worklet.js"));
|
||||
}, "Loading a paint worklet again.");
|
||||
|
||||
promise_test(function(t) {
|
||||
return promise_rejects(t, "AbortError", paintWorklet.addModule("test_paint_worklet_empty_name.js"));
|
||||
}, "Loading a paint worklet with an empty name.");
|
||||
|
||||
promise_test(function(t) {
|
||||
return promise_rejects(t, "AbortError", paintWorklet.addModule("test_paint_worklet_properties_throws.js"));
|
||||
}, "Loading a paint worklet whose inputProperties throws an exception.");
|
||||
|
||||
promise_test(function(t) {
|
||||
return promise_rejects(t, "AbortError", paintWorklet.addModule("test_paint_worklet_arguments_throws.js"));
|
||||
}, "Loading a paint worklet whose inputArguments throws an exception.");
|
||||
|
||||
promise_test(function(t) {
|
||||
return promise_rejects(t, "AbortError", paintWorklet.addModule("test_paint_worklet_alpha_throws.js"));
|
||||
}, "Loading a paint worklet whose alpha throws an exception.");
|
||||
|
||||
promise_test(function(t) {
|
||||
return promise_rejects(t, "AbortError", paintWorklet.addModule("test_paint_worklet_not_constructor.js"));
|
||||
}, "Loading a paint worklet which isn't a constructor function.");
|
||||
|
||||
promise_test(function(t) {
|
||||
return promise_rejects(t, "AbortError", paintWorklet.addModule("test_paint_worklet_no_paint.js"));
|
||||
}, "Loading a paint worklet with no paint.");
|
||||
|
||||
promise_test(function(t) {
|
||||
return promise_rejects(t, "AbortError", paintWorklet.addModule("test_paint_worklet_paint_not_callable.js"));
|
||||
}, "Loading a paint worklet with a paint that is not callable.");
|
||||
</script>
|
|
@ -0,0 +1,2 @@
|
|||
registerPaint("noPaint", class {
|
||||
});
|
|
@ -0,0 +1,3 @@
|
|||
registerPaint("notAConstructr", function() { return {
|
||||
"prototype": { "paint": function() {} }
|
||||
}; });
|
|
@ -0,0 +1,3 @@
|
|||
registerPaint("paintNotCallable", class {
|
||||
get paint() { return 0; }
|
||||
});
|
|
@ -0,0 +1,4 @@
|
|||
registerPaint("propertiesThrows", class {
|
||||
static get inputProperties() { throw new TypeError(); }
|
||||
paint(ctx, size) { }
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue