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

Side by Side Diff: LayoutTests/fast/files/workers/resources/worker-read-file-constructor-async.js

Issue 100023005: Make cloning of File objects more useful. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Reupload Created 7 years 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 unified diff | Download patch
« no previous file with comments | « no previous file | LayoutTests/fast/files/workers/worker-read-file-constructor-async.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 importScripts("../../resources/read-common.js")
2
3 function log(message)
4 {
5 postMessage(message);
6 }
7
8 function readFiles(index, files)
9 {
10 if (index >= files.length) {
11 log("DONE");
12 return;
13 }
14
15 log("Reading: '" + files[index].name + "'");
16 log("Last modified: '" + (new Date(files[index].lastModified)).toUTCString() + "'");
17
18 var reader = new FileReader();
19 var isText = files[index].type.indexOf("text") > -1;
20 reader.onload = function (e) {
21 if (isText) {
22 log("Contents: '" + reader.result + "'");
23 log("Length: " + reader.result.length);
24 } else
25 log("Length: " + reader.result.byteLength);
26 readFiles(index + 1, files);
27 };
28 if (isText)
29 reader.readAsText(files[index]);
30 else
31 reader.readAsArrayBuffer(files[index])
32 }
33
34 onmessage = function (e) {
35 log('Received files in worker');
36 readFiles(0, e.data);
37 };
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/fast/files/workers/worker-read-file-constructor-async.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698