| OLD | NEW |
| 1 function stripURL(url) { | 1 function stripURL(url) { |
| 2 if (url.match(/^blob:/)) | 2 if (url.match(/^blob:/)) |
| 3 return "[blob: URL]"; | 3 return "[blob: URL]"; |
| 4 return url ? url.match( /[^\/]+\/?$/ )[0] : url; | 4 return url ? url.match( /[^\/]+\/?$/ )[0] : url; |
| 5 } | 5 } |
| 6 | 6 |
| 7 function checkErrorEvent(errorEvent, obj) { | 7 function checkErrorEvent(errorEvent, obj) { |
| 8 window.errorEvent = errorEvent; | 8 window.errorEvent = errorEvent; |
| 9 shouldBeEqualToString('errorEvent.message', obj.message); | 9 shouldBeEqualToString('errorEvent.message', obj.message); |
| 10 shouldBeEqualToString('stripURL(errorEvent.filename)', obj.filename); | 10 shouldBeEqualToString('stripURL(errorEvent.filename)', obj.filename); |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 }); | 62 }); |
| 63 } | 63 } |
| 64 | 64 |
| 65 function errorEventHandlerShouldNotFire() { | 65 function errorEventHandlerShouldNotFire() { |
| 66 var worker = buildInlineWorker(); | 66 var worker = buildInlineWorker(); |
| 67 worker.onerror = function (e) { | 67 worker.onerror = function (e) { |
| 68 testFailed("'worker.onerror' should not have been called."); | 68 testFailed("'worker.onerror' should not have been called."); |
| 69 }; | 69 }; |
| 70 } | 70 } |
| 71 | 71 |
| 72 function errorEventHandlerShouldFire() { |
| 73 var worker = buildInlineWorker(); |
| 74 worker.onerror = function (e) { |
| 75 testPassed("'worker.onerror' called."); |
| 76 }; |
| 77 } |
| 78 |
| 72 function buildInlineWorker() { | 79 function buildInlineWorker() { |
| 73 var script = document.getElementById('workerCode').innerText; | 80 var script = document.getElementById('workerCode').innerText; |
| 74 var blob = new Blob([script], {type: 'text/javascript'}); | 81 var blob = new Blob([script], {type: 'text/javascript'}); |
| 75 var worker = new Worker(URL.createObjectURL(blob)); | 82 var worker = new Worker(URL.createObjectURL(blob)); |
| 76 | 83 |
| 77 if (window.postMessageCallback) | 84 if (window.postMessageCallback) |
| 78 worker.addEventListener('message', postMessageCallback); | 85 worker.addEventListener('message', postMessageCallback); |
| 79 worker.addEventListener('message', function (e) { | 86 worker.addEventListener('message', function (e) { |
| 80 if (e.data.done) | 87 if (e.data.done) |
| 81 return finishJSTest(); | 88 return finishJSTest(); |
| 82 }); | 89 }); |
| 83 | 90 |
| 84 return worker; | 91 return worker; |
| 85 } | 92 } |
| 86 | 93 |
| 87 window.jsTestIsAsync = true; | 94 window.jsTestIsAsync = true; |
| OLD | NEW |