Index: Source/modules/filesystem/DOMFileSystemBase.cpp |
diff --git a/Source/modules/filesystem/DOMFileSystemBase.cpp b/Source/modules/filesystem/DOMFileSystemBase.cpp |
index 77a47a5857103771a5ece6120ddfd991b26d0d97..ceb484b901252c5cf2e93dec1dec81772f578202 100644 |
--- a/Source/modules/filesystem/DOMFileSystemBase.cpp |
+++ b/Source/modules/filesystem/DOMFileSystemBase.cpp |
@@ -73,7 +73,10 @@ DOMFileSystemBase::~DOMFileSystemBase() |
blink::WebFileSystem* DOMFileSystemBase::fileSystem() const |
{ |
- return blink::Platform::current()->fileSystem(); |
+ blink::Platform* platform = blink::Platform::current(); |
+ if (!platform) |
+ return 0; |
nhiroki
2014/08/11 04:56:38
"return nullptr;"?
tzik
2014/08/11 05:12:08
Done.
|
+ return platform->fileSystem(); |
} |
SecurityOrigin* DOMFileSystemBase::securityOrigin() const |
@@ -189,6 +192,10 @@ void DOMFileSystemBase::getMetadata(const EntryBase* entry, PassOwnPtr<MetadataC |
{ |
OwnPtr<AsyncFileSystemCallbacks> callbacks(MetadataCallbacks::create(successCallback, errorCallback, m_context, this)); |
callbacks->setShouldBlockUntilCompletion(synchronousType == Synchronous); |
+ if (!fileSystem()) { |
+ reportError(errorCallback, FileError::create(FileError::ABORT_ERR)); |
+ return; |
+ } |
nhiroki
2014/08/11 04:56:38
How about moving this block before creating |callb
tzik
2014/08/11 05:12:08
Done.
|
fileSystem()->readMetadata(createFileSystemURL(entry), callbacks.release()); |
} |
@@ -229,6 +236,11 @@ void DOMFileSystemBase::move(const EntryBase* source, EntryBase* parent, const S |
return; |
} |
+ if (!fileSystem()) { |
+ reportError(errorCallback, FileError::create(FileError::ABORT_ERR)); |
+ return; |
+ } |
+ |
OwnPtr<AsyncFileSystemCallbacks> callbacks(EntryCallbacks::create(successCallback, errorCallback, m_context, parent->filesystem(), destinationPath, source->isDirectory())); |
callbacks->setShouldBlockUntilCompletion(synchronousType == Synchronous); |
@@ -243,6 +255,11 @@ void DOMFileSystemBase::copy(const EntryBase* source, EntryBase* parent, const S |
return; |
} |
+ if (!fileSystem()) { |
+ reportError(errorCallback, FileError::create(FileError::ABORT_ERR)); |
+ return; |
+ } |
+ |
OwnPtr<AsyncFileSystemCallbacks> callbacks(EntryCallbacks::create(successCallback, errorCallback, m_context, parent->filesystem(), destinationPath, source->isDirectory())); |
callbacks->setShouldBlockUntilCompletion(synchronousType == Synchronous); |
@@ -258,6 +275,11 @@ void DOMFileSystemBase::remove(const EntryBase* entry, PassOwnPtr<VoidCallback> |
return; |
} |
+ if (!fileSystem()) { |
+ reportError(errorCallback, FileError::create(FileError::ABORT_ERR)); |
+ return; |
+ } |
+ |
OwnPtr<AsyncFileSystemCallbacks> callbacks(VoidCallbacks::create(successCallback, errorCallback, m_context, this)); |
callbacks->setShouldBlockUntilCompletion(synchronousType == Synchronous); |
@@ -273,6 +295,11 @@ void DOMFileSystemBase::removeRecursively(const EntryBase* entry, PassOwnPtr<Voi |
return; |
} |
+ if (!fileSystem()) { |
+ reportError(errorCallback, FileError::create(FileError::ABORT_ERR)); |
+ return; |
+ } |
+ |
OwnPtr<AsyncFileSystemCallbacks> callbacks(VoidCallbacks::create(successCallback, errorCallback, m_context, this)); |
callbacks->setShouldBlockUntilCompletion(synchronousType == Synchronous); |
@@ -283,6 +310,12 @@ void DOMFileSystemBase::getParent(const EntryBase* entry, PassOwnPtr<EntryCallba |
{ |
ASSERT(entry); |
String path = DOMFilePath::getDirectory(entry->fullPath()); |
+ |
+ if (!fileSystem()) { |
+ reportError(errorCallback, FileError::create(FileError::ABORT_ERR)); |
+ return; |
+ } |
+ |
fileSystem()->directoryExists(createFileSystemURL(path), EntryCallbacks::create(successCallback, errorCallback, m_context, this, path, true)); |
} |
@@ -294,6 +327,11 @@ void DOMFileSystemBase::getFile(const EntryBase* entry, const String& path, cons |
return; |
} |
+ if (!fileSystem()) { |
+ reportError(errorCallback, FileError::create(FileError::ABORT_ERR)); |
+ return; |
+ } |
+ |
OwnPtr<AsyncFileSystemCallbacks> callbacks(EntryCallbacks::create(successCallback, errorCallback, m_context, this, absolutePath, false)); |
callbacks->setShouldBlockUntilCompletion(synchronousType == Synchronous); |
@@ -311,6 +349,11 @@ void DOMFileSystemBase::getDirectory(const EntryBase* entry, const String& path, |
return; |
} |
+ if (!fileSystem()) { |
+ reportError(errorCallback, FileError::create(FileError::ABORT_ERR)); |
+ return; |
+ } |
+ |
OwnPtr<AsyncFileSystemCallbacks> callbacks(EntryCallbacks::create(successCallback, errorCallback, m_context, this, absolutePath, true)); |
callbacks->setShouldBlockUntilCompletion(synchronousType == Synchronous); |
@@ -327,11 +370,18 @@ int DOMFileSystemBase::readDirectory(DirectoryReaderBase* reader, const String& |
OwnPtr<AsyncFileSystemCallbacks> callbacks(EntriesCallbacks::create(successCallback, errorCallback, m_context, reader, path)); |
callbacks->setShouldBlockUntilCompletion(synchronousType == Synchronous); |
+ if (!fileSystem()) { |
+ reportError(errorCallback, FileError::create(FileError::ABORT_ERR)); |
+ return 0; |
+ } |
nhiroki
2014/08/11 04:56:38
ditto.
tzik
2014/08/11 05:12:08
Done.
|
+ |
return fileSystem()->readDirectory(createFileSystemURL(path), callbacks.release()); |
} |
bool DOMFileSystemBase::waitForAdditionalResult(int callbacksId) |
{ |
+ if (!fileSystem()) |
+ return false; |
return fileSystem()->waitForAdditionalResult(callbacksId); |
} |