Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 importScripts("../../resources/read-common.js", "../../resources/read-file-test- cases.js", "worker-read-common.js"); | 1 importScripts("../../resources/read-common.js", "../../resources/read-file-test- cases.js", "worker-read-common.js"); |
| 2 | 2 |
| 3 onmessage = function(event) | |
| 4 { | |
|
jsbell
2014/07/01 16:37:18
Nit: place this on the same line as the function()
| |
| 5 var testFiles = event.data; | |
| 6 log("Received files in worker"); | |
| 7 if (event.data[0] instanceof FileList) { | |
| 8 log("Received a FileList"); | |
| 9 // The tests expects a name => File map; construct the | |
| 10 // mapping from the FileList and the test names that | |
| 11 // were posted (as a pair, using an Array.) | |
| 12 var files = event.data[0]; | |
| 13 var names = event.data[1]; | |
| 14 var tests = { }; | |
|
jsbell
2014/07/01 16:37:18
We seem to more consistently write {}
| |
| 15 for (var i = 0; i < files.length; i++) { | |
|
jsbell
2014/07/01 16:37:18
Note: Can optionally skip the brace for a single l
| |
| 16 tests[names[i]] = files[i]; | |
| 17 } | |
| 18 | |
| 19 testFiles = tests; | |
| 20 } | |
| 21 runNextTest(testFiles); | |
| 22 } | |
|
jsbell
2014/07/01 16:37:18
Nit: ; after assignment statement
| |
| 23 | |
| 3 function isReadAsAsync() | 24 function isReadAsAsync() |
| 4 { | 25 { |
| 5 return true; | 26 return true; |
| 6 } | 27 } |
| 7 | |
| OLD | NEW |