| OLD | NEW |
| 1 <html> | 1 <html> |
| 2 <head> | 2 <head> |
| 3 <script src="../../http/tests/inspector/inspector-test.js"></script> | 3 <script src="../../http/tests/inspector/inspector-test.js"></script> |
| 4 <script src="../../http/tests/inspector/console-test.js"></script> | 4 <script src="../../http/tests/inspector/console-test.js"></script> |
| 5 <script> | 5 <script> |
| 6 var worker1; | 6 var worker1; |
| 7 var worker2; | 7 var worker2; |
| 8 | 8 |
| 9 function startWorker1() | 9 function startWorker1() |
| 10 { | 10 { |
| 11 worker1 = new Worker("resources/worker-with-throw.js"); | 11 worker1 = new Worker("resources/worker-with-throw.js"); |
| 12 } | 12 } |
| 13 | 13 |
| 14 function startWorker2() | 14 function startWorker2() |
| 15 { | 15 { |
| 16 worker2 = new Worker("resources/worker-with-throw.js"); | 16 worker2 = new Worker("resources/worker-with-throw.js"); |
| 17 worker2.onerror = function(e) { | 17 worker2.onerror = function(e) { |
| 18 console.log(e.message); | 18 console.log(e.message); |
| 19 e.preventDefault(); | 19 e.preventDefault(); |
| 20 } | 20 } |
| 21 } | 21 } |
| 22 | 22 |
| 23 function postMessageToWorker(worker) | 23 function postMessageToWorker(worker) |
| 24 { | 24 { |
| 25 worker.postMessage("ping"); | 25 worker.postMessage("ping"); |
| 26 } | 26 } |
| 27 | 27 |
| 28 function test() | 28 function test() |
| 29 { | 29 { |
| 30 var isContextCreated = false; | |
| 31 var isAgentEnabled = false; | |
| 32 | |
| 33 startWorkerAndPostMessage(step2, "worker1", "startWorker1"); | 30 startWorkerAndPostMessage(step2, "worker1", "startWorker1"); |
| 34 | 31 |
| 35 function step2() | 32 function step2() |
| 36 { | 33 { |
| 37 InspectorTest.waitUntilMessageReceived(step3); | 34 InspectorTest.waitUntilMessageReceived(step3); |
| 38 startWorkerAndPostMessage(undefined, "worker2", "startWorker2"); | 35 startWorkerAndPostMessage(undefined, "worker2", "startWorker2"); |
| 39 } | 36 } |
| 40 | 37 |
| 41 function step3() | 38 function step3() |
| 42 { | 39 { |
| 43 InspectorTest.expandConsoleMessages(step4); | 40 InspectorTest.expandConsoleMessages(step4); |
| 44 } | 41 } |
| 45 | 42 |
| 46 function step4() | 43 function step4() |
| 47 { | 44 { |
| 48 InspectorTest.dumpConsoleMessages(); | 45 InspectorTest.dumpConsoleMessages(); |
| 49 InspectorTest.completeTest(); | 46 InspectorTest.completeTest(); |
| 50 } | 47 } |
| 51 | 48 |
| 52 function contextCreated(next, workerName) | 49 function contextCreated(next, workerName) |
| 53 { | 50 { |
| 54 InspectorTest.evaluateInPage("postMessageToWorker(" + workerName + ")",
next); | 51 InspectorTest.evaluateInPage("postMessageToWorker(" + workerName + ")",
next); |
| 55 } | 52 } |
| 56 | 53 |
| 57 function startWorkerAndPostMessage(next, workerName, workerStartFunction) | 54 function startWorkerAndPostMessage(next, workerName, workerStartFunction) |
| 58 { | 55 { |
| 59 isContextCreated = false; | |
| 60 InspectorTest.addSniffer(WebInspector.RuntimeModel.prototype, "_executio
nContextCreated", contextCreated.bind(this, next, workerName)); | 56 InspectorTest.addSniffer(WebInspector.RuntimeModel.prototype, "_executio
nContextCreated", contextCreated.bind(this, next, workerName)); |
| 61 InspectorTest.evaluateInPage(workerStartFunction + "()"); | 57 InspectorTest.evaluateInPage(workerStartFunction + "()"); |
| 62 } | 58 } |
| 63 }; | 59 }; |
| 64 </script> | 60 </script> |
| 65 </head> | 61 </head> |
| 66 <body onload="runTest()"> | 62 <body onload="runTest()"> |
| 67 <p>Tests exception message from worker contains stack trace.</p> | 63 <p>Tests exception message from worker contains stack trace.</p> |
| 68 </body> | 64 </body> |
| 69 </html> | 65 </html> |
| OLD | NEW |