2007-12-17 13:20:40 -08:00
<!DOCTYPE HTML>
< html >
< head >
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=403852
-->
< title > Test for Bug 403852< / title >
< script type = "text/javascript" src = "/tests/SimpleTest/SimpleTest.js" > < / script >
< link rel = "stylesheet" type = "text/css" href = "/tests/SimpleTest/test.css" / >
< / head >
< body >
< a target = "_blank" href = "https://bugzilla.mozilla.org/show_bug.cgi?id=403852" > Mozilla Bug 403852< / a >
< p id = "display" >
< input id = "fileList" type = "file" > < / input >
2012-10-04 07:38:18 -07:00
< canvas id = "canvas" > < / canvas >
2007-12-17 13:20:40 -08:00
< / p >
< div id = "content" style = "display: none" >
< / div >
< pre id = "test" >
< script class = "testbody" type = "text/javascript" >
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var dirSvc = Components.classes["@mozilla.org/file/directory_service;1"].getService(Components.interfaces.nsIProperties);
var testFile = dirSvc.get("ProfD", Components.interfaces.nsIFile);
testFile.append("prefs.js");
var fileList = document.getElementById('fileList');
fileList.value = testFile.path;
// Make sure the file is accessible with indexed notation
var domFile = fileList.files[0];
2009-10-07 01:30:26 -07:00
is(domFile.name, "prefs.js", "fileName should be prefs.js");
2007-12-17 13:20:40 -08:00
2012-05-21 15:11:56 -07:00
ok("lastModifiedDate" in domFile, "lastModifiedDate must be present");
var d = new Date(testFile.lastModifiedTime);
ok(d.getTime() == domFile.lastModifiedDate.getTime(), "lastModifiedDate should be the same.");
2012-10-04 07:38:18 -07:00
var cf = document.getElementById("canvas").mozGetAsFile("canvFile");
var x = new Date();
var y = cf.lastModifiedDate;
var z = new Date();
ok((x.getTime() < = y.getTime()) & & (y.getTime() < = z.getTime()), "lastModifiedDate of file which does not have last modified date should be current time");
2007-12-17 13:20:40 -08:00
< / script >
< / pre >
< / body > < / html >