mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-30 20:59:16 +00: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: 5a0f7c5f63
Pull-request: https://github.com/SerenityOS/serenity/pull/24220
Reviewed-by: https://github.com/kennethmyhra
2 changed files with 22 additions and 0 deletions
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…
Add table
Add a link
Reference in a new issue