Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(211)

Unified Diff: LayoutTests/fast/files/workers/resources/worker-read-file-async.js

Issue 349633005: Expose FileList in Worker contexts. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: LayoutTests/fast/files/workers/resources/worker-read-file-async.js
diff --git a/LayoutTests/fast/files/workers/resources/worker-read-file-async.js b/LayoutTests/fast/files/workers/resources/worker-read-file-async.js
index 3271e08cc4f2980398e42626464da94f1eba5646..4d3d87b25b78517ca704d37b793fab7327cce463 100644
--- a/LayoutTests/fast/files/workers/resources/worker-read-file-async.js
+++ b/LayoutTests/fast/files/workers/resources/worker-read-file-async.js
@@ -1,7 +1,27 @@
importScripts("../../resources/read-common.js", "../../resources/read-file-test-cases.js", "worker-read-common.js");
+onmessage = function(event)
+{
jsbell 2014/07/01 16:37:18 Nit: place this on the same line as the function()
+ var testFiles = event.data;
+ log("Received files in worker");
+ if (event.data[0] instanceof FileList) {
+ log("Received a FileList");
+ // The tests expects a name => File map; construct the
+ // mapping from the FileList and the test names that
+ // were posted (as a pair, using an Array.)
+ var files = event.data[0];
+ var names = event.data[1];
+ var tests = { };
jsbell 2014/07/01 16:37:18 We seem to more consistently write {}
+ 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
+ tests[names[i]] = files[i];
+ }
+
+ testFiles = tests;
+ }
+ runNextTest(testFiles);
+}
jsbell 2014/07/01 16:37:18 Nit: ; after assignment statement
+
function isReadAsAsync()
{
return true;
}
-

Powered by Google App Engine
This is Rietveld 408576698