Changeset 200032 in webkit
- Timestamp:
- Apr 25, 2016 10:31:29 AM (8 years ago)
- Location:
- trunk
- Files:
-
- 3 added
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r200030 r200032 1 2016-04-25 Brady Eidson <beidson@apple.com> 2 3 Implement latest File object spec (including its constructor). 4 https://bugs.webkit.org/show_bug.cgi?id=156511 5 6 Reviewed by Darin Adler. 7 8 * fast/files/file-constructor-expected.txt: Added. 9 * fast/files/file-constructor.html: Added. 10 11 * http/tests/local/fileapi/file-last-modified-after-delete-expected.txt: 12 * http/tests/local/fileapi/script-tests/file-last-modified-after-delete.js: 13 14 * http/tests/local/fileapi/file-last-modified-expected.txt: 15 * http/tests/local/fileapi/script-tests/file-last-modified.js: 16 17 * imported/blink/storage/indexeddb/blob-basics-metadata-expected.txt: 18 1 19 2016-04-25 Daniel Bates <dabates@apple.com> 2 20 -
trunk/LayoutTests/http/tests/local/fileapi/file-last-modified-after-delete-expected.txt
r145035 r200032 5 5 6 6 PASS event.dataTransfer contains a File object on drop. 7 PASS lastModified Dateis not null8 PASS lastModified Date is >= testStartTime9 PASS (new Date()).getTime() is >= lastModified Date7 PASS lastModified is not null 8 PASS lastModified is >= testStartTime.getTime() 9 PASS (new Date()).getTime() is >= lastModified 10 10 PASS successfullyParsed is true 11 11 -
trunk/LayoutTests/http/tests/local/fileapi/file-last-modified-expected.txt
r74380 r200032 5 5 6 6 PASS event.dataTransfer contains a File object on drop. 7 PASS file.lastModified Dateverified7 PASS file.lastModified verified 8 8 PASS successfullyParsed is true 9 9 -
trunk/LayoutTests/http/tests/local/fileapi/script-tests/file-last-modified-after-delete.js
r145035 r200032 11 11 removeTempFile(tempFileName); 12 12 13 // This synchronosly queries the file's lastModified Date(which should fail) until/unless we start capturing the file metadata at File construction time.14 lastModified Date = file.lastModifiedDate;13 // This synchronosly queries the file's lastModified (which should fail) until/unless we start capturing the file metadata at File construction time. 14 lastModified = file.lastModified; 15 15 16 16 // The returned value should be equal to the current date/time since the file's modified date/time is not available. 17 shouldNotBe('lastModified Date', 'null');18 shouldBeGreaterThanOrEqual('lastModified Date', 'testStartTime');19 shouldBeGreaterThanOrEqual('(new Date()).getTime()', 'lastModified Date');17 shouldNotBe('lastModified', 'null'); 18 shouldBeGreaterThanOrEqual('lastModified', 'testStartTime.getTime()'); 19 shouldBeGreaterThanOrEqual('(new Date()).getTime()', 'lastModified'); 20 20 } 21 21 -
trunk/LayoutTests/http/tests/local/fileapi/script-tests/file-last-modified.js
r74380 r200032 7 7 xhr.send(); 8 8 var expectedDate = new Date(parseInt(xhr.responseText) * 1000); 9 var actualDate = file.lastModified Date;10 if (expectedDate. toString() == actualDate.toString())11 testPassed("file.lastModified Dateverified");9 var actualDate = file.lastModified; 10 if (expectedDate.getTime() == actualDate) 11 testPassed("file.lastModified verified"); 12 12 else 13 testFailed("file.lastModified Dateincorrect");13 testFailed("file.lastModified incorrect"); 14 14 } 15 15 -
trunk/LayoutTests/imported/blink/storage/indexeddb/blob-basics-metadata-expected.txt
r199730 r200032 40 40 testNewFile(): 41 41 newFile = new File([test_content], 'filename', {type:'text/plain'}) 42 FAIL newFile = new File([test_content], 'filename', {type:'text/plain'}) threw exception TypeError: function is not a constructor (evaluating 'new File([test_content], 'filename', {type:'text/plain'})')43 42 44 43 validateResult(newFile): 45 FAIL newFile.name == newFile.name should be true. Threw exception ReferenceError: Can't find variable: newFile44 PASS newFile.name == newFile.name is true 46 45 transaction = db.transaction('storeName', 'readwrite') 47 46 store = transaction.objectStore('storeName') 48 47 store.put(newFile, 'newFilekey') 49 FAIL store.put(newFile, 'newFilekey') threw exception ReferenceError: Can't find variable: newFile50 48 transaction = db.transaction('storeName', 'readwrite') 51 49 store = transaction.objectStore('storeName') 52 50 request = store.get('newFilekey') 53 FAIL event.target.result.name == newFile.name should be true. Threw exception TypeError: undefined is not an object (evaluating 'event.target.result.name') 51 PASS event.target.result.name == newFile.name is true 54 52 55 53 testFileList(): … … 78 76 PASS cursor.value == 'value' is true 79 77 cursor.continue(); 80 FAIL cursor.value.name == newFile.name should be true. Threw exception TypeError: null is not an object (evaluating 'cursor.value') 78 PASS cursor.value.name == newFile.name is true 81 79 cursor.continue(); 82 FAIL Unexpected error: TypeError: null is not an object (evaluating 'cursor.continue') 83 FAIL successfullyParsed should be true. Was false. 80 PASS cursor is null 81 PASS successfullyParsed is true 84 82 85 83 TEST COMPLETE -
trunk/Source/WebCore/CMakeLists.txt
r199976 r200032 1144 1144 bindings/js/JSExceptionBase.cpp 1145 1145 bindings/js/JSFetchResponseCustom.cpp 1146 bindings/js/JSFileCustom.cpp 1146 1147 bindings/js/JSFileReaderCustom.cpp 1147 1148 bindings/js/JSGeolocationCustom.cpp -
trunk/Source/WebCore/ChangeLog
r200031 r200032 1 2016-04-25 Brady Eidson <beidson@apple.com> 2 3 Implement latest File object spec (including its constructor). 4 https://bugs.webkit.org/show_bug.cgi?id=156511 5 6 Reviewed by Darin Adler. 7 8 Test: fast/files/file-constructor.html 9 10 * CMakeLists.txt: 11 * WebCore.xcodeproj/project.pbxproj: 12 13 * bindings/js/JSDictionary.cpp: 14 (WebCore::JSDictionary::convertValue): 15 * bindings/js/JSDictionary.h: 16 17 * bindings/js/JSFileCustom.cpp: Added. 18 (WebCore::constructJSFile): 19 20 * fileapi/File.cpp: 21 (WebCore::File::File): 22 (WebCore::File::lastModified): 23 (WebCore::File::lastModifiedDate): Deleted. 24 * fileapi/File.h: 25 * fileapi/File.idl: 26 1 27 2016-04-25 Antti Koivisto <antti@apple.com> 2 28 -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r199976 r200032 2059 2059 516D7D711BB5F0BD00AF7C77 /* IDBConnectionToClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 516D7D6D1BB5F06500AF7C77 /* IDBConnectionToClient.cpp */; }; 2060 2060 516D7D721BB5F0BD00AF7C77 /* IDBConnectionToClientDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 516D7D6E1BB5F06500AF7C77 /* IDBConnectionToClientDelegate.h */; settings = {ATTRIBUTES = (Private, ); }; }; 2061 516E54FA1CCB2EA80040D954 /* JSFileCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 516E54F91CCB27FF0040D954 /* JSFileCustom.cpp */; }; 2061 2062 516F7F6D1C31E39A00F111DC /* ServerOpenDBRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = 516F7F6C1C31C79D00F111DC /* ServerOpenDBRequest.h */; settings = {ATTRIBUTES = (Private, ); }; }; 2062 2063 516F7F6E1C31E39C00F111DC /* ServerOpenDBRequest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 516F7F6B1C31C79D00F111DC /* ServerOpenDBRequest.cpp */; }; … … 9645 9646 516D7D6D1BB5F06500AF7C77 /* IDBConnectionToClient.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IDBConnectionToClient.cpp; sourceTree = "<group>"; }; 9646 9647 516D7D6E1BB5F06500AF7C77 /* IDBConnectionToClientDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDBConnectionToClientDelegate.h; sourceTree = "<group>"; }; 9648 516E54F91CCB27FF0040D954 /* JSFileCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSFileCustom.cpp; sourceTree = "<group>"; }; 9647 9649 516F7F6B1C31C79D00F111DC /* ServerOpenDBRequest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ServerOpenDBRequest.cpp; sourceTree = "<group>"; }; 9648 9650 516F7F6C1C31C79D00F111DC /* ServerOpenDBRequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ServerOpenDBRequest.h; sourceTree = "<group>"; }; … … 22448 22450 ADEC78F718EE5308001315C2 /* JSElementCustom.h */, 22449 22451 BCEFAF4D0C317E6900FA81F6 /* JSEventCustom.cpp */, 22452 516E54F91CCB27FF0040D954 /* JSFileCustom.cpp */, 22450 22453 2E7582ED12764F260062628B /* JSFileReaderCustom.cpp */, 22451 22454 C28083411C6DC96A001451B6 /* JSFontFaceCustom.cpp */, … … 30244 30247 E1C36CBD0EB08062007410BC /* JSDOMGlobalObject.cpp in Sources */, 30245 30248 7C2BDD3D17C7F98C0038FF15 /* JSDOMGlobalObjectTask.cpp in Sources */, 30249 516E54FA1CCB2EA80040D954 /* JSFileCustom.cpp in Sources */, 30246 30250 65DF31F709D1CC60000BE325 /* JSDOMImplementation.cpp in Sources */, 30247 30251 A9D248060D757E7D00FDF959 /* JSDOMMimeType.cpp in Sources */, -
trunk/Source/WebCore/bindings/js/JSDictionary.cpp
r198492 r200032 99 99 } 100 100 101 void JSDictionary::convertValue(ExecState* exec, JSValue value, long int& result) 102 { 103 result = value.toInt32(exec); 104 } 105 101 106 void JSDictionary::convertValue(ExecState* exec, JSValue value, unsigned& result) 102 107 { … … 118 123 double d = value.toNumber(exec); 119 124 doubleToInteger(d, result); 125 } 126 127 void JSDictionary::convertValue(ExecState* exec, JSValue value, long long& result) 128 { 129 double d = value.toNumber(exec); 130 result = llrint(d); 120 131 } 121 132 -
trunk/Source/WebCore/bindings/js/JSDictionary.h
r199750 r200032 118 118 static void convertValue(JSC::ExecState*, JSC::JSValue, bool& result); 119 119 static void convertValue(JSC::ExecState*, JSC::JSValue, int& result); 120 static void convertValue(JSC::ExecState*, JSC::JSValue, long int& result); 120 121 static void convertValue(JSC::ExecState*, JSC::JSValue, unsigned& result); 121 122 static void convertValue(JSC::ExecState*, JSC::JSValue, unsigned short& result); 122 123 static void convertValue(JSC::ExecState*, JSC::JSValue, unsigned long& result); 123 124 static void convertValue(JSC::ExecState*, JSC::JSValue, unsigned long long& result); 125 static void convertValue(JSC::ExecState*, JSC::JSValue, long long& result); 124 126 static void convertValue(JSC::ExecState*, JSC::JSValue, double& result); 125 127 static void convertValue(JSC::ExecState*, JSC::JSValue, Dictionary& result); -
trunk/Source/WebCore/fileapi/File.cpp
r199524 r200032 65 65 } 66 66 67 double File::lastModifiedDate() const 67 File::File(Vector<BlobPart>&& blobParts, const String& filename, const String& contentType, int64_t lastModified) 68 : Blob(WTFMove(blobParts), contentType) 69 , m_name(filename) 70 , m_overrideLastModifiedDate(lastModified) 68 71 { 72 } 73 74 double File::lastModified() const 75 { 76 if (m_overrideLastModifiedDate) 77 return m_overrideLastModifiedDate.value(); 78 79 // FIXME: This does sync-i/o on the main thread and also recalculates every time the method is called. 80 // The i/o should be performed on a background thread, 81 // and the result should be cached along with an asynchronous monitor for changes to the file. 69 82 time_t modificationTime; 70 83 if (getFileModificationTime(m_path, modificationTime) && isValidFileTime(modificationTime)) -
trunk/Source/WebCore/fileapi/File.h
r197563 r200032 28 28 29 29 #include "Blob.h" 30 #include <wtf/Optional.h> 30 31 #include <wtf/Ref.h> 31 32 #include <wtf/TypeCasts.h> … … 41 42 { 42 43 return adoptRef(*new File(path)); 44 } 45 46 // Create a File using the 'new File' constructor. 47 static Ref<File> create(Vector<BlobPart> blobParts, const String& filename, const String& contentType, int64_t lastModified) 48 { 49 return adoptRef(*new File(WTFMove(blobParts), filename, contentType, lastModified)); 43 50 } 44 51 … … 60 67 const String& path() const { return m_path; } 61 68 const String& name() const { return m_name; } 62 63 // This returns the current date and time if the file's last modification date is not known (per spec: http://www.w3.org/TR/FileAPI/#dfn-lastModifiedDate). 64 double lastModifiedDate() const; 69 double lastModified() const; 65 70 66 71 static String contentTypeForFile(const String& path); … … 73 78 WEBCORE_EXPORT explicit File(const String& path); 74 79 File(const String& path, const String& nameOverride); 80 File(Vector<BlobPart>&& blobParts, const String& filename, const String& contentType, int64_t lastModified); 75 81 76 82 File(DeserializationContructor, const String& path, const URL& srcURL, const String& type, const String& name); … … 83 89 String m_path; 84 90 String m_name; 91 92 Optional<String> m_overrideFilename; 93 Optional<int64_t> m_overrideLastModifiedDate; 85 94 }; 86 95 -
trunk/Source/WebCore/fileapi/File.idl
r199264 r200032 25 25 26 26 [ 27 Exposed=(Window), 27 28 JSGenerateToNativeObject, 28 29 JSGenerateToJSObject, 29 30 ExportMacro=WEBCORE_EXPORT, 31 CustomConstructor(sequence<any> fileBits, DOMString fileName, optional FilePropertyBag options), 30 32 ] interface File : Blob { 31 33 readonly attribute DOMString name; 32 #if !defined(LANGUAGE_GOBJECT) || !LANGUAGE_GOBJECT 33 readonly attribute Date lastModifiedDate; 34 #endif 34 readonly attribute long long lastModified; 35 35 }; 36 36
Note: See TracChangeset
for help on using the changeset viewer.