| OLD | NEW |
| 1 if (this.importScripts) { | 1 if (this.importScripts) { |
| 2 importScripts('fs-worker-common.js'); | 2 importScripts('fs-worker-common.js'); |
| 3 importScripts('../../js/resources/js-test-pre.js'); | 3 importScripts('../../js/resources/js-test-pre.js'); |
| 4 importScripts('file-writer-utils.js'); | 4 importScripts('file-writer-utils.js'); |
| 5 } | 5 } |
| 6 | 6 |
| 7 description("Test that FileWriter defends against infinite recursion via abort."
); | 7 description("Test that FileWriter defends against infinite recursion via abort."
); |
| 8 | 8 |
| 9 var sawWriteStart; | 9 var sawWriteStart; |
| 10 var sawAbort; | 10 var sawAbort; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 // We should always abort before completion. | 24 // We should always abort before completion. |
| 25 function onWrite(e) { | 25 function onWrite(e) { |
| 26 testFailed("In onWrite."); | 26 testFailed("In onWrite."); |
| 27 } | 27 } |
| 28 | 28 |
| 29 function onAbort(e) { | 29 function onAbort(e) { |
| 30 testPassed("Saw abort"); | 30 testPassed("Saw abort"); |
| 31 try { | 31 try { |
| 32 method(); | 32 method(); |
| 33 } catch (ex) { | 33 } catch (ex) { |
| 34 assert(ex.code == 2); // Security error | 34 assert(ex.name == 'SecurityError'); |
| 35 testPassed("Saw security error"); | 35 testPassed("Saw security error"); |
| 36 } | 36 } |
| 37 } | 37 } |
| 38 | 38 |
| 39 function onWriteEnd(e) { | 39 function onWriteEnd(e) { |
| 40 --recursionDepth; | 40 --recursionDepth; |
| 41 testPassed("Saw writeend."); | 41 testPassed("Saw writeend."); |
| 42 if (!recursionDepth) { | 42 if (!recursionDepth) { |
| 43 ++testsRun; | 43 ++testsRun; |
| 44 if (testsRun == 1) { | 44 if (testsRun == 1) { |
| (...skipping 17 matching lines...) Expand all Loading... |
| 62 fileWriter.onerror = onError; | 62 fileWriter.onerror = onError; |
| 63 fileWriter.onabort = onAbort; | 63 fileWriter.onabort = onAbort; |
| 64 fileWriter.onwritestart = onWriteStart; | 64 fileWriter.onwritestart = onWriteStart; |
| 65 fileWriter.onwrite = onWrite; | 65 fileWriter.onwrite = onWrite; |
| 66 fileWriter.onwriteend = onWriteEnd; | 66 fileWriter.onwriteend = onWriteEnd; |
| 67 method(); | 67 method(); |
| 68 } | 68 } |
| 69 | 69 |
| 70 var jsTestIsAsync = true; | 70 var jsTestIsAsync = true; |
| 71 setupAndRunTest(2*1024*1024, 'file-writer-abort-depth', runTest); | 71 setupAndRunTest(2*1024*1024, 'file-writer-abort-depth', runTest); |
| OLD | NEW |