-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
LibWeb/Tests: Add a basic test for a blob URL given to a Worker
- Loading branch information
1 parent
b90c51a
commit e5433bc
Showing
2 changed files
with
22 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Message received from worker: "WHF! :^)" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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> |