mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-11 05:25:32 +03:00
LibWeb/Tests: Add a basic test for a blob URL given to a Worker
This commit is contained in:
parent
53eb9af42f
commit
5a0f7c5f63
Notes:
sideshowbarker
2024-07-17 02:28:18 +09:00
Author: https://github.com/shannonbooth Commit: https://github.com/SerenityOS/serenity/commit/5a0f7c5f63 Pull-request: https://github.com/SerenityOS/serenity/pull/24220 Reviewed-by: https://github.com/kennethmyhra
1
Tests/LibWeb/Text/expected/Worker/Worker-blob.txt
Normal file
1
Tests/LibWeb/Text/expected/Worker/Worker-blob.txt
Normal file
@ -0,0 +1 @@
|
||||
Message received from worker: "WHF! :^)"
|
21
Tests/LibWeb/Text/input/Worker/Worker-blob.html
Normal file
21
Tests/LibWeb/Text/input/Worker/Worker-blob.html
Normal file
@ -0,0 +1,21 @@
|
||||
<script src="../include.js"></script>
|
||||
<script>
|
||||
asyncTest((done) => {
|
||||
const workerScript = `
|
||||
self.onmessage = function(evt) {
|
||||
self.postMessage('WHF! :^)');
|
||||
};
|
||||
`;
|
||||
const blob = new Blob([workerScript], { type: 'application/javascript' });
|
||||
const workerScriptURL = URL.createObjectURL(blob);
|
||||
const worker = new Worker(workerScriptURL);
|
||||
|
||||
worker.onmessage = function(evt) {
|
||||
println('Message received from worker: ' + JSON.stringify(evt.data));
|
||||
done();
|
||||
};
|
||||
|
||||
// Send a message to the worker
|
||||
worker.postMessage('Hello from main script');
|
||||
});
|
||||
</script>
|
Loading…
Reference in New Issue
Block a user