Index: test/mjsunit/d8-worker-spawn-worker.js |
diff --git a/test/mjsunit/d8-worker-spawn-worker.js b/test/mjsunit/d8-worker-spawn-worker.js |
index b9d7f9ade4fd116837c275a73867eeda26076e5a..a114d8587e0ebc7095565cfebb3634e7fdefbbe7 100644 |
--- a/test/mjsunit/d8-worker-spawn-worker.js |
+++ b/test/mjsunit/d8-worker-spawn-worker.js |
@@ -26,21 +26,15 @@ |
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
if (this.Worker) { |
- function f() { |
- var g = function () { |
- postMessage(42); |
- }; |
+ var workerScript = |
+ `var w = new Worker('postMessage(42)'); |
+ onmessage = function(parentMsg) { |
+ w.postMessage(parentMsg); |
+ var childMsg = w.getMessage(); |
+ postMessage(childMsg); |
+ };`; |
- var w = new Worker(g); |
- |
- onmessage = function(parentMsg) { |
- w.postMessage(parentMsg); |
- var childMsg = w.getMessage(); |
- postMessage(childMsg); |
- }; |
- } |
- |
- var w = new Worker(f); |
+ var w = new Worker(workerScript); |
w.postMessage(9); |
assertEquals(42, w.getMessage()); |
} |