1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/content/base/test/test_bug403852.html Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,50 @@ 1.4 +<!DOCTYPE HTML> 1.5 +<html> 1.6 +<head> 1.7 +<!-- 1.8 +https://bugzilla.mozilla.org/show_bug.cgi?id=403852 1.9 +--> 1.10 + <title>Test for Bug 403852</title> 1.11 + <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> 1.12 + <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> 1.13 +</head> 1.14 + 1.15 +<body> 1.16 +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=403852">Mozilla Bug 403852</a> 1.17 +<p id="display"> 1.18 + <input id="fileList" type="file"></input> 1.19 + <canvas id="canvas"></canvas> 1.20 +</p> 1.21 +<div id="content" style="display: none"> 1.22 +</div> 1.23 + 1.24 +<pre id="test"> 1.25 +<script class="testbody" type="text/javascript"> 1.26 + 1.27 +var testFile = SpecialPowers.Services.dirsvc.get("ProfD", SpecialPowers.Ci.nsIFile); 1.28 +testFile.append("prefs.js"); 1.29 + 1.30 +var fileList = document.getElementById('fileList'); 1.31 +SpecialPowers.wrap(fileList).value = testFile.path; 1.32 + 1.33 +// Make sure the file is accessible with indexed notation 1.34 +var domFile = fileList.files[0]; 1.35 + 1.36 +is(domFile.name, "prefs.js", "fileName should be prefs.js"); 1.37 + 1.38 +ok("lastModifiedDate" in domFile, "lastModifiedDate must be present"); 1.39 + 1.40 +var d = new Date(testFile.lastModifiedTime); 1.41 +ok(d.getTime() == domFile.lastModifiedDate.getTime(), "lastModifiedDate should be the same."); 1.42 + 1.43 +var cf = document.getElementById("canvas").mozGetAsFile("canvFile"); 1.44 + 1.45 +var x = new Date(); 1.46 +var y = cf.lastModifiedDate; 1.47 +var z = new Date(); 1.48 + 1.49 +ok((x.getTime() <= y.getTime()) && (y.getTime() <= z.getTime()), "lastModifiedDate of file which does not have last modified date should be current time"); 1.50 + 1.51 +</script> 1.52 +</pre> 1.53 +</body> </html>