| Index: Source/bindings/v8/custom/V8BlobCustomHelpers.cpp
|
| diff --git a/Source/bindings/v8/custom/V8BlobCustomHelpers.cpp b/Source/bindings/v8/custom/V8BlobCustomHelpers.cpp
|
| index ee359371b85b659787f80360eee7cc35104bd2fd..4671b8521dd7118dbd8001c11b6912ca3994d230 100644
|
| --- a/Source/bindings/v8/custom/V8BlobCustomHelpers.cpp
|
| +++ b/Source/bindings/v8/custom/V8BlobCustomHelpers.cpp
|
| @@ -38,12 +38,44 @@
|
| #include "bindings/v8/custom/V8ArrayBufferCustom.h"
|
| #include "bindings/v8/custom/V8ArrayBufferViewCustom.h"
|
| #include "core/fileapi/BlobBuilder.h"
|
| +#include "wtf/DateMath.h"
|
|
|
| namespace WebCore {
|
|
|
| namespace V8BlobCustomHelpers {
|
|
|
| -bool processBlobPropertyBag(v8::Local<v8::Value> propertyBag, const char* blobClassName, String& contentType, String& endings, v8::Isolate* isolate)
|
| +ParsedProperties::ParsedProperties(bool hasFileProperties)
|
| + : endings("transparent")
|
| + , hasFileProperties(hasFileProperties)
|
| +#ifndef NDEBUG
|
| + , m_hasLastModified(false)
|
| +#endif // NDEBUG
|
| +{
|
| +}
|
| +
|
| +double ParsedProperties::lastModified()
|
| +{
|
| + ASSERT(this->hasFileProperties);
|
| + ASSERT(this->m_hasLastModified);
|
| + return m_lastModified;
|
| +}
|
| +
|
| +void ParsedProperties::setLastModified(double lastModified)
|
| +{
|
| + ASSERT(this->hasFileProperties);
|
| + ASSERT(!this->m_hasLastModified);
|
| + m_lastModified = lastModified;
|
| +#ifndef NDEBUG
|
| + m_hasLastModified = true;
|
| +#endif // NDEBUG
|
| +}
|
| +
|
| +void ParsedProperties::setDefaultLastModified()
|
| +{
|
| + setLastModified(currentTime());
|
| +}
|
| +
|
| +bool ParsedProperties::parseBlobPropertyBag(v8::Local<v8::Value> propertyBag, const char* blobClassName, v8::Isolate* isolate)
|
| {
|
| ASSERT(endings == "transparent");
|
|
|
| @@ -65,6 +97,19 @@ bool processBlobPropertyBag(v8::Local<v8::Value> propertyBag, const char* blobCl
|
| }
|
| contentType = contentType.lower();
|
| }
|
| +
|
| + if (!hasFileProperties)
|
| + return true;
|
| +
|
| + v8::Local<v8::Value> lastModified;
|
| + V8TRYCATCH_RETURN(bool, containsLastModified, dictionary.get("lastModified", lastModified), false);
|
| + if (containsLastModified) {
|
| + V8TRYCATCH_RETURN(long long, lastModifiedInt, toInt64(lastModified), false);
|
| + setLastModified(static_cast<double>(lastModifiedInt) / msPerSecond);
|
| + } else {
|
| + setDefaultLastModified();
|
| + }
|
| +
|
| return true;
|
| }
|
|
|
|
|