Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(217)

Unified Diff: third_party/WebKit/Source/modules/filesystem/FileWriter.cpp

Issue 2601543002: Fix crashes when FileWriter methods are called after context is destroyed. (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/modules/filesystem/FileWriter.cpp
diff --git a/third_party/WebKit/Source/modules/filesystem/FileWriter.cpp b/third_party/WebKit/Source/modules/filesystem/FileWriter.cpp
index e20faa9931b78cf8963485abd9602cbacd48ef14..ad60c056e635e7df14dafadceecea79629cf08f2 100644
--- a/third_party/WebKit/Source/modules/filesystem/FileWriter.cpp
+++ b/third_party/WebKit/Source/modules/filesystem/FileWriter.cpp
@@ -86,6 +86,8 @@ bool FileWriter::hasPendingActivity() const {
}
void FileWriter::write(Blob* data, ExceptionState& exceptionState) {
+ if (!getExecutionContext())
+ return;
ASSERT(data);
ASSERT(writer());
ASSERT(m_truncateLength == -1);
@@ -115,6 +117,8 @@ void FileWriter::write(Blob* data, ExceptionState& exceptionState) {
}
void FileWriter::seek(long long position, ExceptionState& exceptionState) {
+ if (!getExecutionContext())
+ return;
ASSERT(writer());
if (m_readyState == kWriting) {
setError(FileError::kInvalidStateErr, exceptionState);
@@ -127,6 +131,8 @@ void FileWriter::seek(long long position, ExceptionState& exceptionState) {
}
void FileWriter::truncate(long long position, ExceptionState& exceptionState) {
+ if (!getExecutionContext())
+ return;
ASSERT(writer());
ASSERT(m_truncateLength == -1);
if (m_readyState == kWriting || position < 0) {
@@ -154,6 +160,8 @@ void FileWriter::truncate(long long position, ExceptionState& exceptionState) {
}
void FileWriter::abort(ExceptionState& exceptionState) {
+ if (!getExecutionContext())
+ return;
ASSERT(writer());
if (m_readyState != kWriting)
return;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698