mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 793459: File.lastModifiedDate should return the current date if no lastModifiedDate is available. r=khuey
This commit is contained in:
parent
7e060cde28
commit
2b3be6c1ca
@ -130,7 +130,8 @@ nsDOMFileBase::GetName(nsAString &aFileName)
|
||||
NS_IMETHODIMP
|
||||
nsDOMFileBase::GetLastModifiedDate(JSContext* cx, JS::Value *aLastModifiedDate)
|
||||
{
|
||||
aLastModifiedDate->setNull();
|
||||
JSObject* date = JS_NewDateObjectMsec(cx, JS_Now() / PR_USEC_PER_MSEC);
|
||||
aLastModifiedDate->setObject(*date);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -506,7 +507,8 @@ nsDOMFileFile::GetLastModifiedDate(JSContext* cx, JS::Value *aLastModifiedDate)
|
||||
aLastModifiedDate->setObject(*date);
|
||||
}
|
||||
else {
|
||||
aLastModifiedDate->setNull();
|
||||
date = JS_NewDateObjectMsec(cx, JS_Now() / PR_USEC_PER_MSEC);
|
||||
aLastModifiedDate->setObject(*date);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
@ -13,6 +13,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=403852
|
||||
<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>
|
||||
<canvas id="canvas"></canvas>
|
||||
</p>
|
||||
<div id="content" style="display: none">
|
||||
</div>
|
||||
@ -39,6 +40,14 @@ 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.");
|
||||
|
||||
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");
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
</body> </html>
|
||||
|
Loading…
Reference in New Issue
Block a user