OLD | NEW |
1 function removeAllInDirectorySync(directory) | 1 function removeAllInDirectorySync(directory) |
2 { | 2 { |
3 if (!directory) | 3 if (!directory) |
4 return; | 4 return; |
5 var reader = directory.createReader(); | 5 var reader = directory.createReader(); |
6 do { | 6 do { |
7 var entries = reader.readEntries(); | 7 var entries = reader.readEntries(); |
8 for (var i = 0; i < entries.length; ++i) { | 8 for (var i = 0; i < entries.length; ++i) { |
9 if (entries[i].isDirectory) | 9 if (entries[i].isDirectory) |
10 entries[i].removeRecursively(); | 10 entries[i].removeRecursively(); |
11 else | 11 else |
12 entries[i].remove(); | 12 entries[i].remove(); |
13 } | 13 } |
14 } while (entries.length); | 14 } while (entries.length); |
15 } | 15 } |
16 | 16 |
17 onmessage = function(evt) | 17 onmessage = function(evt) |
18 { | 18 { |
19 try { | 19 try { |
20 // Increase the change of getting caught doing a sync operation | 20 // Increase the change of getting caught doing a sync operation |
21 // by repeating the opration multiple times. | 21 // by repeating the opration multiple times. |
22 for (var i = 0; i < 10; ++i) { | 22 for (var i = 0; i < 10; ++i) { |
23 if (evt.data == 'openDatabaseSync') | 23 if (evt.data == 'requestFileSystemSync') { |
24 openDatabaseSync('', '', '', 1); | |
25 else if (evt.data == 'requestFileSystemSync') { | |
26 if (!this.webkitRequestFileSystemSync) | 24 if (!this.webkitRequestFileSystemSync) |
27 return; | 25 return; |
28 webkitRequestFileSystemSync(this.TEMPORARY, 100); | 26 webkitRequestFileSystemSync(this.TEMPORARY, 100); |
29 } else if (evt.data == 'fileSyncOperations') { | 27 } else if (evt.data == 'fileSyncOperations') { |
30 if (!this.webkitRequestFileSystemSync) | 28 if (!this.webkitRequestFileSystemSync) |
31 return; | 29 return; |
32 // Do many different sync filesystem operations. If this starts
crashing, | 30 // Do many different sync filesystem operations. If this starts
crashing, |
33 // then a simple investigation would be to isolate these command
s. | 31 // then a simple investigation would be to isolate these command
s. |
34 var fileSystem = webkitRequestFileSystemSync(this.TEMPORARY, 100
); | 32 var fileSystem = webkitRequestFileSystemSync(this.TEMPORARY, 100
); |
35 | 33 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 } | 65 } |
68 } catch (e) { | 66 } catch (e) { |
69 // Purposely ignore any exceptions. Since the whole purpose of this test
is to try | 67 // Purposely ignore any exceptions. Since the whole purpose of this test
is to try |
70 // to interrupt the synchronous operations, they will naturally throw ex
ceptions, | 68 // to interrupt the synchronous operations, they will naturally throw ex
ceptions, |
71 // but which ones throw exception isn't determinant and we don't want ra
ndom output | 69 // but which ones throw exception isn't determinant and we don't want ra
ndom output |
72 // showing up as a console message. | 70 // showing up as a console message. |
73 } | 71 } |
74 } | 72 } |
75 | 73 |
76 postMessage('started'); | 74 postMessage('started'); |
OLD | NEW |