Changeset 119680 in webkit


Ignore:
Timestamp:
Jun 6, 2012 9:34:40 PM (12 years ago)
Author:
kinuko@chromium.org
Message:

File::lastModifiedDate should use NaN or separate boolean flag for null Date value
https://bugs.webkit.org/show_bug.cgi?id=87826

Reviewed by Kent Tamura.

Test: http/tests/local/fileapi/file-last-modified-after-delete.html

  • fileapi/File.cpp:

(WebCore::File::File):
(WebCore::File::captureSnapshot):
(WebCore::File::lastModifiedDate):
(WebCore::File::lastModifiedDateForBinding): Removed.

  • fileapi/File.h:

(File):

  • fileapi/File.idl:
  • platform/FileMetadata.h:

(WebCore::FileMetadata::FileMetadata):

  • platform/FileSystem.h:
  • platform/chromium/support/WebHTTPBody.cpp:

(WebKit::WebHTTPBody::elementAt):

  • platform/network/BlobData.cpp:

(WebCore):

Location:
trunk/Source/WebCore
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r119677 r119680  
     12012-06-06  Kinuko Yasuda  <kinuko@chromium.org>
     2
     3        File::lastModifiedDate should use NaN or separate boolean flag for null Date value
     4        https://bugs.webkit.org/show_bug.cgi?id=87826
     5
     6        Reviewed by Kent Tamura.
     7
     8        Test: http/tests/local/fileapi/file-last-modified-after-delete.html
     9
     10        * fileapi/File.cpp:
     11        (WebCore::File::File):
     12        (WebCore::File::captureSnapshot):
     13        (WebCore::File::lastModifiedDate):
     14        (WebCore::File::lastModifiedDateForBinding): Removed.
     15        * fileapi/File.h:
     16        (File):
     17        * fileapi/File.idl:
     18        * platform/FileMetadata.h:
     19        (WebCore::FileMetadata::FileMetadata):
     20        * platform/FileSystem.h:
     21        * platform/chromium/support/WebHTTPBody.cpp:
     22        (WebKit::WebHTTPBody::elementAt):
     23        * platform/network/BlobData.cpp:
     24        (WebCore):
     25
    1262012-06-06  Sheriff Bot  <webkit.review.bot@gmail.com>
    227
  • trunk/Source/WebCore/fileapi/File.cpp

    r118920 r119680  
    3131#include "MIMETypeRegistry.h"
    3232#include <wtf/CurrentTime.h>
     33#include <wtf/MathExtras.h>
    3334#include <wtf/text/WTFString.h>
    3435
     
    8788#if ENABLE(FILE_SYSTEM)
    8889    , m_snapshotSize(-1)
    89     , m_snapshotModificationTime(0)
     90    , m_snapshotModificationTime(invalidTime)
    9091#endif
    9192{
     
    9798#if ENABLE(FILE_SYSTEM)
    9899    , m_snapshotSize(-1)
    99     , m_snapshotModificationTime(0)
     100    , m_snapshotModificationTime(invalidTime)
    100101#endif
    101102{
     
    112113#if ENABLE(FILE_SYSTEM)
    113114    , m_snapshotSize(-1)
    114     , m_snapshotModificationTime(0)
     115    , m_snapshotModificationTime(invalidTime)
    115116#endif
    116117{
     
    137138    time_t modificationTime;
    138139    if (!getFileModificationTime(m_path, modificationTime))
    139         return 0;
     140        return invalidTime;
    140141
    141142    // Needs to return epoch time in milliseconds for Date.
    142143    return modificationTime * 1000.0;
    143 }
    144 
    145 double File::lastModifiedDateForBinding() const
    146 {
    147     double value = lastModifiedDate();
    148     return (!value) ? std::numeric_limits<double>::quiet_NaN() : value;
    149144}
    150145
     
    179174    if (!getFileMetadata(m_path, metadata)) {
    180175        snapshotSize = 0;
    181         snapshotModificationTime = 0;
     176        snapshotModificationTime = invalidTime;
    182177        return;
    183178    }
  • trunk/Source/WebCore/fileapi/File.h

    r118920 r119680  
    7878    const String& name() const { return m_name; }
    7979
    80     // This may return zero if getFileModificationTime() platform call has failed or zero snapshot lastModifiedTime is given at construction time.
     80    // This may return NaN (which is converted to null Date in javascript layer) if getFileModificationTime() platform call has failed or the information is not available.
    8181    double lastModifiedDate() const;
    82 
    83     // For binding. We want to return null Date if we get the value 0 Date (which is used to indicate the information is unavailable).
    84     double lastModifiedDateForBinding() const;
    8582
    8683#if ENABLE(DIRECTORY_UPLOAD)
  • trunk/Source/WebCore/fileapi/File.idl

    r118920 r119680  
    3333        readonly attribute DOMString name;
    3434#if !defined(LANGUAGE_GOBJECT) || !LANGUAGE_GOBJECT
    35         readonly attribute [ImplementedAs=lastModifiedDateForBinding] Date lastModifiedDate;
     35        readonly attribute Date lastModifiedDate;
    3636#endif
    3737#if defined(ENABLE_DIRECTORY_UPLOAD) && ENABLE_DIRECTORY_UPLOAD
  • trunk/Source/WebCore/platform/FileMetadata.h

    r118481 r119680  
    3232#define FileMetadata_h
    3333
     34#include "FileSystem.h"
    3435#include <wtf/text/WTFString.h>
    3536
     
    5758#endif
    5859
    59     FileMetadata() : modificationTime(0.0), length(-1), type(TypeUnknown) { }
     60    FileMetadata() : modificationTime(invalidTime), length(-1), type(TypeUnknown) { }
    6061};
    6162
  • trunk/Source/WebCore/platform/FileSystem.h

    r118481 r119680  
    146146};
    147147
     148const double invalidTime = std::numeric_limits<double>::quiet_NaN();
     149
    148150#if OS(WINDOWS)
    149151static const char PlatformFilePathSeparator = '\\';
  • trunk/Source/WebCore/platform/chromium/support/WebHTTPBody.cpp

    r112754 r119680  
    3232#include <public/WebHTTPBody.h>
    3333
     34#include "FileSystem.h"
    3435#include "FormData.h"
    3536
     
    7879    result.fileStart = 0;
    7980    result.fileLength = 0;
    80     result.modificationTime = 0.0;
     81    result.modificationTime = invalidTime;
    8182    result.blobURL = KURL();
    8283
  • trunk/Source/WebCore/platform/network/BlobData.cpp

    r98316 r119680  
    3131#include "config.h"
    3232#include "BlobData.h"
     33#include "FileSystem.h"
    3334
    3435#include <wtf/OwnPtr.h>
     
    4142
    4243const long long BlobDataItem::toEndOfFile = -1;
    43 const double BlobDataItem::doNotCheckFileChange = 0;
     44const double BlobDataItem::doNotCheckFileChange = invalidTime;
    4445
    4546RawData::RawData()
Note: See TracChangeset for help on using the changeset viewer.