mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Auto merge of #16814 - asajeffrey:script-worklets, r=jdm
Implement Houdini worklets <!-- Please describe your changes on the following line: --> This PR implements the current draft Houdini Worklets specification (https://drafts.css-houdini.org/worklets/). The implementation is intended to provide a responsive environment for worklet execution, and in particular to ensure that the primary worklet executor does not garbage collect, and does not block loading module code. The implementation does this by providing a thread pool, and performing GC and module loading in a backup thread, not in the primary thread. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] These changes fix #16206 - [x] There are tests for these changes <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/16814) <!-- Reviewable:end -->
This commit is contained in:
commit
ac99a48aea
34 changed files with 1209 additions and 17 deletions
|
@ -11185,6 +11185,21 @@
|
|||
[
|
||||
{}
|
||||
]
|
||||
],
|
||||
"mozilla/worklets/syntax_error.js": [
|
||||
[
|
||||
{}
|
||||
]
|
||||
],
|
||||
"mozilla/worklets/test_worklet.js": [
|
||||
[
|
||||
{}
|
||||
]
|
||||
],
|
||||
"mozilla/worklets/throw_exception.js": [
|
||||
[
|
||||
{}
|
||||
]
|
||||
]
|
||||
},
|
||||
"testharness": {
|
||||
|
@ -20027,6 +20042,12 @@
|
|||
"/_mozilla/mozilla/windowproxy.html",
|
||||
{}
|
||||
]
|
||||
],
|
||||
"mozilla/worklets/test_worklet.html": [
|
||||
[
|
||||
"/_mozilla/mozilla/worklets/test_worklet.html",
|
||||
{}
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
|
@ -25796,7 +25817,7 @@
|
|||
"testharness"
|
||||
],
|
||||
"mozilla/interfaces.html": [
|
||||
"21e18bafdbfe5f3aa0ee71766bdc3b6a7e334226",
|
||||
"49dd9f6ef449813f2ce943d4c9fac351357e5c74",
|
||||
"testharness"
|
||||
],
|
||||
"mozilla/interfaces.js": [
|
||||
|
@ -31714,6 +31735,22 @@
|
|||
"mozilla/windowproxy.html": [
|
||||
"128cd0aa5cf80f60078979039036d32b470b0616",
|
||||
"testharness"
|
||||
],
|
||||
"mozilla/worklets/syntax_error.js": [
|
||||
"f3a9b8c78346507bc0b3190c8000ccf80cc133f6",
|
||||
"support"
|
||||
],
|
||||
"mozilla/worklets/test_worklet.html": [
|
||||
"fe9c93a5307c616f878b6623155e1b04c86dd994",
|
||||
"testharness"
|
||||
],
|
||||
"mozilla/worklets/test_worklet.js": [
|
||||
"9d5f8a07cd62a10f4f5ff93744672e5a6fdbc2b0",
|
||||
"support"
|
||||
],
|
||||
"mozilla/worklets/throw_exception.js": [
|
||||
"ebfdae19db68fed8e69142ef73842ac9921e4463",
|
||||
"support"
|
||||
]
|
||||
},
|
||||
"url_base": "/_mozilla/",
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
[test_worklet.html]
|
||||
type: testharness
|
||||
prefs: [dom.worklet.testing.enabled:true]
|
|
@ -200,6 +200,7 @@ test_interfaces([
|
|||
"WebSocket",
|
||||
"Window",
|
||||
"Worker",
|
||||
"Worklet",
|
||||
"XMLDocument",
|
||||
"XMLHttpRequest",
|
||||
"XMLHttpRequestEventTarget",
|
||||
|
|
1
tests/wpt/mozilla/tests/mozilla/worklets/syntax_error.js
Normal file
1
tests/wpt/mozilla/tests/mozilla/worklets/syntax_error.js
Normal file
|
@ -0,0 +1 @@
|
|||
{];
|
35
tests/wpt/mozilla/tests/mozilla/worklets/test_worklet.html
Normal file
35
tests/wpt/mozilla/tests/mozilla/worklets/test_worklet.html
Normal file
|
@ -0,0 +1,35 @@
|
|||
<!doctype html>
|
||||
<meta charset="utf-8">
|
||||
<title>Test 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 testWorklet = new TestWorklet();
|
||||
var host_info = get_host_info();
|
||||
|
||||
promise_test(function() {
|
||||
return testWorklet.addModule("test_worklet.js")
|
||||
.then(function () {
|
||||
assert_equals(testWorklet.lookup("hello"), "world");
|
||||
});
|
||||
}, "Loading a test worklet.");
|
||||
|
||||
promise_test(function(t) {
|
||||
var path = new URL("test_worklet.js", document.location).pathname;
|
||||
var url = new URL(path, host_info.HTTP_REMOTE_ORIGIN);
|
||||
return promise_rejects(t, "AbortError", testWorklet.addModule(url));
|
||||
}, "Loading a cross-origin test worklet.");
|
||||
|
||||
promise_test(function(t) {
|
||||
return promise_rejects(t, "AbortError", testWorklet.addModule("nonexistent_worklet.js"));
|
||||
}, "Loading a nonexistent test worklet.");
|
||||
|
||||
promise_test(function(t) {
|
||||
return promise_rejects(t, "AbortError", testWorklet.addModule("syntax_error.js"));
|
||||
}, "Loading a syntactically incorrect test worklet.");
|
||||
|
||||
promise_test(function(t) {
|
||||
return promise_rejects(t, "AbortError", testWorklet.addModule("throw_exception.js"));
|
||||
}, "Loading an exception-throwing test worklet.");
|
||||
</script>
|
1
tests/wpt/mozilla/tests/mozilla/worklets/test_worklet.js
Normal file
1
tests/wpt/mozilla/tests/mozilla/worklets/test_worklet.js
Normal file
|
@ -0,0 +1 @@
|
|||
registerKeyValue("hello", "world");
|
|
@ -0,0 +1 @@
|
|||
throw new TypeError();
|
Loading…
Add table
Add a link
Reference in a new issue