Bug 1458883 - Remove File.lastModifiedDate, r=qdot

This commit is contained in:
Andrea Marchesini 2018-05-04 14:39:53 +02:00
parent c9c8df1225
commit b4b5d38767
19 changed files with 34 additions and 69 deletions

View File

@ -36,7 +36,6 @@ https://trac.torproject.org/projects/tor/ticket/1517
"new Date().getTime()",
"new Event(\"\").timeStamp",
"new File([], \"\").lastModified",
"new File([], \"\").lastModifiedDate.getTime()",
];
// These are measured in seconds, so we need to scale them up
var timeStampCodesDOM = timeStampCodes.concat([

View File

@ -1879,11 +1879,6 @@ module.exports = {
"!url": "https://developer.mozilla.org/en/docs/DOM/File.fileSize",
"!doc": "Returns the size of a file in bytes."
},
"lastModifiedDate": {
"!type": "?",
"!url": "https://developer.mozilla.org/en/docs/DOM/File.lastModifiedDate",
"!doc": "Returns the last modified date of the file. Files without a known last modified date use the current date instead."
},
"name": {
"!type": "string",
"!url": "https://developer.mozilla.org/en/docs/DOM/File.name",

View File

@ -40,26 +40,22 @@ function onOpened(message) {
is(domFile.name, "prefs.js", "fileName should be prefs.js");
ok("lastModifiedDate" in domFile, "lastModifiedDate must be present");
ok("lastModified" in domFile, "lastModified must be present");
var d = new Date(message.mtime);
is(d.getTime(), domFile.lastModifiedDate.getTime(), "lastModifiedDate should be the same");
is(d.getTime(), (new Date(domFile.lastModified)).getTime(), "lastModified should be the same");
var x = new Date();
// In our implementation of File object, lastModifiedDate is unknown only for new objects.
// Using canvas or input[type=file] elements, we 'often' have a valid lastModifiedDate values.
// For canvas we use memory files and the lastModifiedDate is now().
// In our implementation of File object, lastModified is unknown only for new objects.
// Using canvas or input[type=file] elements, we 'often' have a valid lastModified values.
// For canvas we use memory files and the lastModified is now().
var f = new File([new Blob(['test'], {type: 'text/plain'})], "test-name");
var y = f.lastModifiedDate;
var y = new Date(f.lastModified);
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");
var d = new Date(message.fileDate);
is(d.getTime(), message.fileWithDate.lastModifiedDate.getTime(), "lastModifiedDate should be the same when lastModified is set: " + message.fileWithDate.lastModified);
ok((x.getTime() <= y.getTime()) && (y.getTime() <= z.getTime()), "lastModified of file which does not have last modified date should be current time");
script.destroy();
SimpleTest.finish();

View File

@ -103,17 +103,6 @@ File::GetRelativePath(nsAString& aPath) const
}
}
Date
File::GetLastModifiedDate(ErrorResult& aRv)
{
int64_t value = GetLastModified(aRv);
if (aRv.Failed()) {
return Date();
}
return Date(JS::TimeClip(value));
}
int64_t
File::GetLastModified(ErrorResult& aRv)
{

View File

@ -88,8 +88,6 @@ public:
int64_t GetLastModified(ErrorResult& aRv);
Date GetLastModifiedDate(ErrorResult& aRv);
void GetRelativePath(nsAString& aPath) const;
void GetMozFullPath(nsAString& aFilename, SystemCallerGuarantee aGuarantee,

View File

@ -21,11 +21,8 @@ var f2 = new File([blob], 'f2.txt', { lastModified: -1 });
var f3 = new File([blob], 'f3.txt', { lastModified: -1000 });
is(f1.lastModified, 0, "lastModified == 0 is supported");
ok(f1.lastModifiedDate.toString(), (new Date(0)).toString(), "Correct f1.lastModifiedDate value");
is(f2.lastModified, -1, "lastModified == -1 is supported");
ok(f2.lastModifiedDate.toString(), (new Date(-1)).toString(), "Correct f2.lastModifiedDate value");
is(f3.lastModified, -1000, "lastModified == -1000 is supported");
ok(f3.lastModifiedDate.toString(), (new Date(-1000)).toString(), "Correct f3.lastModifiedDate value");
</script>
</body>

View File

@ -294,7 +294,6 @@ PushMessageBadPaddingError=The ServiceWorker for scope %1$S failed to decr
PushMessageBadCryptoError=The ServiceWorker for scope %1$S failed to decrypt a push message. For help with encryption, please see https://developer.mozilla.org/docs/Web/API/Push_API/Using_the_Push_API#Encryption
# LOCALIZATION NOTE: %1$S is the type of a DOM event. 'passive' is a literal parameter from the DOM spec.
PreventDefaultFromPassiveListenerWarning=Ignoring preventDefault() call on event of type %1$S from a listener registered as passive.
FileLastModifiedDateWarning=File.lastModifiedDate is deprecated. Use File.lastModified instead.
# LOCALIZATION NOTE: 'ImageBitmapRenderingContext.transferImageBitmap' and 'ImageBitmapRenderingContext.transferFromImageBitmap' should not be translated
ImageBitmapRenderingContext_TransferImageBitmap=ImageBitmapRenderingContext.transferImageBitmap is deprecated and will be removed soon. Use ImageBitmapRenderingContext.transferFromImageBitmap instead.
IIRFilterChannelCountChangeWarning=IIRFilterNode channel count changes may produce audio glitches.

View File

@ -31,9 +31,6 @@ dictionary ChromeFilePropertyBag : FilePropertyBag {
// Mozilla extensions
partial interface File {
[GetterThrows, Deprecated="FileLastModifiedDate"]
readonly attribute Date lastModifiedDate;
[BinaryName="relativePath", Func="mozilla::dom::DOMPrefs::WebkitBlinkDirectoryPickerEnabled"]
readonly attribute USVString webkitRelativePath;

View File

@ -10,7 +10,7 @@ onmessage = function(event) {
rtnObj.type = file.type;
rtnObj.name = file.name;
rtnObj.path = file.path;
rtnObj.lastModifiedDate = file.lastModifiedDate;
rtnObj.lastModified = file.lastModified;
postMessage(rtnObj);
};

View File

@ -69,7 +69,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=123456
is(event.data.size, expectedSize, "size proproperty accessed from worker is not the same as on main thread.");
is(event.data.type, expectedType, "type proproperty accessed from worker is incorrect.");
is(event.data.name, file.name, "name proproperty accessed from worker is incorrect.");
is(event.data.lastModifiedDate.toString(), file.lastModifiedDate.toString(), "lastModifiedDate proproperty accessed from worker is incorrect.");
is(event.data.lastModified, file.lastModified, "lastModified proproperty accessed from worker is incorrect.");
finish();
};

View File

@ -402754,11 +402754,11 @@
"testharness"
],
"IndexedDB/keypath-special-identifiers.htm": [
"588026e7e95192b98b594e77fafe67495d5cd481",
"0392d5dc6be8c17d435f2e0382e378521551c4fb",
"testharness"
],
"IndexedDB/keypath.htm": [
"a21b6eecc56a924bdf017d9053be2f0eecd25eeb",
"169a6f8e0f70ecf9089e2a6aa9232f632fe24e9a",
"testharness"
],
"IndexedDB/keypath_invalid.htm": [
@ -558186,7 +558186,7 @@
"testharness"
],
"fetch/api/abort/serviceworker-intercepted.https.html": [
"ee3512098bed44d034d9a0e6f2ccdbd5a07c7e42",
"b5169e88b2146712ee98cd2c6f7575ce3f2999a3",
"testharness"
],
"fetch/api/basic/accept-header.any.js": [
@ -565922,15 +565922,15 @@
"manual"
],
"html/editing/dnd/file/001.html": [
"28e4e1d0e06a8c300c116aeb2d07e4808bdf56fe",
"9a004cc780577f28242feeedce7a15deb7849c8c",
"support"
],
"html/editing/dnd/file/002.html": [
"62f40d477019e663e377f314947c28ea6b556864",
"fdb4d92324f81cd4412fa8334aeb75fa79044804",
"support"
],
"html/editing/dnd/file/003.html": [
"df5bb0614ea6c7135caead8c5a1258bf981aeb13",
"578bc2823d303d41577abc9c0a855af338baf8be",
"support"
],
"html/editing/dnd/file/004.html": [
@ -565946,11 +565946,11 @@
"support"
],
"html/editing/dnd/file/007.html": [
"21851c97db234d854576e3ea6e1029ffed38a761",
"bb927ac9126c217f7cb0bcf07e58f6e8f756fc06",
"support"
],
"html/editing/dnd/file/008.html": [
"081def5342c9b8bb426812bef312e6cdee3dd66e",
"b632d267d0c66c631670957566e763d8511efbe4",
"support"
],
"html/editing/dnd/file/009.html": [
@ -565962,7 +565962,7 @@
"support"
],
"html/editing/dnd/file/011.html": [
"6c5de23f6a63e817d60d1357020ee90f71193372",
"4e78bcbbdd8b8f220e1b431f964c299636d2a064",
"support"
],
"html/editing/dnd/file/fail.txt": [
@ -610954,7 +610954,7 @@
"wdspec"
],
"webdriver/tests/navigation/get_title.py": [
"2ee18932a8ae3c4190b37e2b28141a6af49cc507",
"23adf150ec59de0748c12ad1025b0be251619bff",
"wdspec"
],
"webdriver/tests/sessions/get_timeouts.py": [

View File

@ -38,11 +38,6 @@
property: 'lastModified',
instance: new File([''], '', {lastModified: 123}),
},
{
type: 'File',
property: 'lastModifiedDate',
instance: new File([''], '', {lastModified: 123}),
},
].forEach(function(testcase) {
indexeddb_test(
(t, db) => {

View File

@ -125,7 +125,7 @@
"[Blob.length, Blob.type]");
}
// File.name and File.lastModifiedDate is not testable automatically
// File.name and File.lastModified is not testable automatically
keypath(['name', 'type'],
[ { name: "orange", type: "fruit" }, { name: "orange", type: ["telecom", "french"] } ],

View File

@ -55,8 +55,8 @@ window.onload = function() {
fails[fails.length] = 'dataTransfer.files[0].size '+e.dataTransfer.files[0].size+' instead of '+filesize;
}
/*
if( !e.dataTransfer.files[0].lastModifiedDate ) {
fails[fails.length] = 'no dataTransfer.files[0].lastModifiedDate';
if( !e.dataTransfer.files[0].lastModified ) {
fails[fails.length] = 'no dataTransfer.files[0].lastModified';
}
*/
if( e.dataTransfer.files[0].name != filename ) {

View File

@ -66,8 +66,8 @@ window.onload = function() {
fails[fails.length] = 'dataTransfer.files['+i0+'].size '+e.dataTransfer.files[i0].size+' instead of '+filesize1;
}
/*
if( !e.dataTransfer.files[i0].lastModifiedDate ) {
fails[fails.length] = 'no dataTransfer.files['+i0+'].lastModifiedDate';
if( !e.dataTransfer.files[i0].lastModified ) {
fails[fails.length] = 'no dataTransfer.files['+i0+'].lastModified';
}
*/
if( e.dataTransfer.files[i0].name != filename1 ) {
@ -80,8 +80,8 @@ window.onload = function() {
fails[fails.length] = 'dataTransfer.files['+i1+'].size '+e.dataTransfer.files[i1].size+' instead of '+filesize2;
}
/*
if( !e.dataTransfer.files[i1].lastModifiedDate ) {
fails[fails.length] = 'no dataTransfer.files['+i1+'].lastModifiedDate';
if( !e.dataTransfer.files[i1].lastModified ) {
fails[fails.length] = 'no dataTransfer.files['+i1+'].lastModified';
}
*/
if( e.dataTransfer.files[i1].name != filename2 ) {

View File

@ -42,8 +42,8 @@ window.onload = function() {
fails[fails.length] = 'dataTransfer.files[0].size '+e.dataTransfer.files[0].size+' instead of '+filesize;
}
/*
if( !e.dataTransfer.files[0].lastModifiedDate ) {
fails[fails.length] = 'no dataTransfer.files[0].lastModifiedDate';
if( !e.dataTransfer.files[0].lastModified ) {
fails[fails.length] = 'no dataTransfer.files[0].lastModified';
}
*/
if( e.dataTransfer.files[0].name != filename ) {

View File

@ -57,8 +57,8 @@ window.onload = function() {
fails[fails.length] = 'dataTransfer.files[0].size '+e.dataTransfer.files[0].size+' instead of '+filesize1+' or '+filesize2;
}
/*
if( !e.dataTransfer.files[0].lastModifiedDate ) {
fails[fails.length] = 'no dataTransfer.files[0].lastModifiedDate';
if( !e.dataTransfer.files[0].lastModified ) {
fails[fails.length] = 'no dataTransfer.files[0].lastModified';
}
*/
if( !window.FileReader ) {

View File

@ -60,8 +60,8 @@ window.onload = function() {
}
*/
/*
if( !e.dataTransfer.files[0].lastModifiedDate ) {
fails[fails.length] = 'no dataTransfer.files[0].lastModifiedDate';
if( !e.dataTransfer.files[0].lastModified ) {
fails[fails.length] = 'no dataTransfer.files[0].lastModified';
}
*/
if( !window.FileReader ) {

View File

@ -45,8 +45,8 @@ window.onload = function() {
fails[fails.length] = 'dataTransfer.files[0].size '+e.dataTransfer.files[0].size+' instead of '+filesize;
}
/*
if( !e.dataTransfer.files[0].lastModifiedDate ) {
fails[fails.length] = 'no dataTransfer.files[0].lastModifiedDate';
if( !e.dataTransfer.files[0].lastModified ) {
fails[fails.length] = 'no dataTransfer.files[0].lastModified';
}
*/
if( e.dataTransfer.files[0].name != filename ) {