|
1 <!DOCTYPE HTML> |
|
2 <html> |
|
3 <head> |
|
4 <!-- |
|
5 https://bugzilla.mozilla.org/show_bug.cgi?id=403852 |
|
6 --> |
|
7 <title>Test for Bug 403852</title> |
|
8 <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> |
|
9 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> |
|
10 </head> |
|
11 |
|
12 <body> |
|
13 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=403852">Mozilla Bug 403852</a> |
|
14 <p id="display"> |
|
15 <input id="fileList" type="file"></input> |
|
16 <canvas id="canvas"></canvas> |
|
17 </p> |
|
18 <div id="content" style="display: none"> |
|
19 </div> |
|
20 |
|
21 <pre id="test"> |
|
22 <script class="testbody" type="text/javascript"> |
|
23 |
|
24 var testFile = SpecialPowers.Services.dirsvc.get("ProfD", SpecialPowers.Ci.nsIFile); |
|
25 testFile.append("prefs.js"); |
|
26 |
|
27 var fileList = document.getElementById('fileList'); |
|
28 SpecialPowers.wrap(fileList).value = testFile.path; |
|
29 |
|
30 // Make sure the file is accessible with indexed notation |
|
31 var domFile = fileList.files[0]; |
|
32 |
|
33 is(domFile.name, "prefs.js", "fileName should be prefs.js"); |
|
34 |
|
35 ok("lastModifiedDate" in domFile, "lastModifiedDate must be present"); |
|
36 |
|
37 var d = new Date(testFile.lastModifiedTime); |
|
38 ok(d.getTime() == domFile.lastModifiedDate.getTime(), "lastModifiedDate should be the same."); |
|
39 |
|
40 var cf = document.getElementById("canvas").mozGetAsFile("canvFile"); |
|
41 |
|
42 var x = new Date(); |
|
43 var y = cf.lastModifiedDate; |
|
44 var z = new Date(); |
|
45 |
|
46 ok((x.getTime() <= y.getTime()) && (y.getTime() <= z.getTime()), "lastModifiedDate of file which does not have last modified date should be current time"); |
|
47 |
|
48 </script> |
|
49 </pre> |
|
50 </body> </html> |