1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
<!DOCTYPE html>
<script>
if (window.testRunner) {
testRunner.dumpAsText();
testRunner.waitUntilDone();
}
webkitRequestFileSystem(TEMPORARY, 0, gotFS, onError.bind(null, 'requestFileSystem'));
function gotFS(fs) {
fs.root.getFile('foo', {create: true}, gotEntry, onError.bind(null, 'getFile'));
}
function gotEntry(entry) {
entry.file(gotFile.bind(null, entry), onError.bind(null, 'file'));
if (window.gc)
gc();
}
var firstGotFile = true;
function gotFile(entry, file) {
if (firstGotFile) {
firstGotFile = false;
setTimeout(gotEntry.bind(null, entry), 0);
return;
}
var reader = new FileReader();
reader.onerror = onError.bind(null, 'FileReader');
reader.onloadend = function() {
if (window.testRunner) {
document.body.innerText = 'PASS';
testRunner.notifyDone();
}
};
reader.readAsText(file);
}
function onError(msg, e) {
document.body.innerText = 'FAIL: ' + msg;
if (window.testRunner)
testRunner.notifyDone();
}
</script>
|