mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-04 08:36:12 +00:00
LibWeb: Implement WorkerGlobalScope.importScripts()
This method allows workers to synchronously import one or more scripts.
This commit is contained in:
parent
975a067f58
commit
bb923983fc
Notes:
sideshowbarker
2024-07-17 03:19:14 +09:00
Author: https://github.com/tcl3
Commit: bb923983fc
Pull-request: https://github.com/SerenityOS/serenity/pull/24423
Reviewed-by: https://github.com/alimpfard
8 changed files with 134 additions and 12 deletions
10
Tests/LibWeb/Text/input/Worker/Worker-importScripts.html
Normal file
10
Tests/LibWeb/Text/input/Worker/Worker-importScripts.html
Normal file
|
@ -0,0 +1,10 @@
|
|||
<script src="../include.js"></script>
|
||||
<script>
|
||||
asyncTest((done) => {
|
||||
const work = new Worker("worker-importScripts.js");
|
||||
work.onmessage = (evt) => {
|
||||
println(`importScripts() works as expected: ${evt.data}`);
|
||||
done();
|
||||
};
|
||||
});
|
||||
</script>
|
|
@ -0,0 +1,3 @@
|
|||
function importedFunction() {
|
||||
return "YES";
|
||||
}
|
3
Tests/LibWeb/Text/input/Worker/worker-importScripts.js
Normal file
3
Tests/LibWeb/Text/input/Worker/worker-importScripts.js
Normal file
|
@ -0,0 +1,3 @@
|
|||
importScripts("worker-importScripts-scriptToImport.js");
|
||||
const fromImportedScript = importedFunction();
|
||||
self.postMessage(fromImportedScript);
|
Loading…
Add table
Add a link
Reference in a new issue