Title: [118253] trunk/Source/WebCore
Revision
118253
Author
[email protected]
Date
2012-05-23 14:59:44 -0700 (Wed, 23 May 2012)

Log Message

Crash in fast/files/read tests during Garbage Collection
https://bugs.webkit.org/show_bug.cgi?id=87165

Reviewed by Alexey Proskuryakov.

Changed hasPendingActivity() processing to use ActiveDOMObject::hasPendingActivity()
and associated setPendingActivity() / unsetPendingActivity().

Fixed two existing tests with change.

* Modules/filesystem/FileWriter.cpp:
(WebCore::FileWriter::stop):
(WebCore::FileWriter::write):
(WebCore::FileWriter::truncate):
(WebCore::FileWriter::signalCompletion):
* Modules/filesystem/FileWriter.h:
* fileapi/FileReader.cpp:
(WebCore::FileReader::readInternal):
(WebCore::FileReader::doAbort):
(WebCore::FileReader::didFinishLoading):
(WebCore::FileReader::didFail):
* fileapi/FileReader.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (118252 => 118253)


--- trunk/Source/WebCore/ChangeLog	2012-05-23 21:59:29 UTC (rev 118252)
+++ trunk/Source/WebCore/ChangeLog	2012-05-23 21:59:44 UTC (rev 118253)
@@ -1,3 +1,28 @@
+2012-05-23  Michael Saboff  <[email protected]>
+
+        Crash in fast/files/read tests during Garbage Collection
+        https://bugs.webkit.org/show_bug.cgi?id=87165
+
+        Reviewed by Alexey Proskuryakov.
+
+        Changed hasPendingActivity() processing to use ActiveDOMObject::hasPendingActivity()
+        and associated setPendingActivity() / unsetPendingActivity().
+
+        Fixed two existing tests with change.
+
+        * Modules/filesystem/FileWriter.cpp:
+        (WebCore::FileWriter::stop):
+        (WebCore::FileWriter::write):
+        (WebCore::FileWriter::truncate):
+        (WebCore::FileWriter::signalCompletion):
+        * Modules/filesystem/FileWriter.h:
+        * fileapi/FileReader.cpp:
+        (WebCore::FileReader::readInternal):
+        (WebCore::FileReader::doAbort):
+        (WebCore::FileReader::didFinishLoading):
+        (WebCore::FileReader::didFail):
+        * fileapi/FileReader.h:
+
 2012-05-23  Abhishek Arya  <[email protected]>
 
         Crash in run-ins with continuations while moving back to original position.

Modified: trunk/Source/WebCore/Modules/filesystem/FileWriter.cpp (118252 => 118253)


--- trunk/Source/WebCore/Modules/filesystem/FileWriter.cpp	2012-05-23 21:59:29 UTC (rev 118252)
+++ trunk/Source/WebCore/Modules/filesystem/FileWriter.cpp	2012-05-23 21:59:44 UTC (rev 118253)
@@ -77,11 +77,6 @@
     return eventNames().interfaceForFileWriter;
 }
 
-bool FileWriter::hasPendingActivity() const
-{
-    return m_readyState == WRITING || ActiveDOMObject::hasPendingActivity();
-}
-
 bool FileWriter::canSuspend() const
 {
     // FIXME: It is not currently possible to suspend a FileWriter, so pages with FileWriter can not go into page cache.
@@ -95,6 +90,8 @@
         return;
     doOperation(OperationAbort);
     m_readyState = DONE;
+
+    setPendingActivity(this);
 }
 
 void FileWriter::write(Blob* data, ExceptionCode& ec)
@@ -114,6 +111,9 @@
         setError(FileError::SECURITY_ERR, ec);
         return;
     }
+
+    setPendingActivity(this);
+
     m_blobBeingWritten = data;
     m_readyState = WRITING;
     m_bytesWritten = 0;
@@ -154,6 +154,9 @@
         setError(FileError::SECURITY_ERR, ec);
         return;
     }
+
+    setPendingActivity(this);
+
     m_readyState = WRITING;
     m_bytesWritten = 0;
     m_bytesToWrite = 0;
@@ -294,6 +297,9 @@
     } else
         fireEvent(eventNames().writeEvent);
     fireEvent(eventNames().writeendEvent);
+    
+    // All possible events have fired and we're done, no more pending activity.
+    unsetPendingActivity(this);
 }
 
 void FileWriter::fireEvent(const AtomicString& type)

Modified: trunk/Source/WebCore/Modules/filesystem/FileWriter.h (118252 => 118253)


--- trunk/Source/WebCore/Modules/filesystem/FileWriter.h	2012-05-23 21:59:29 UTC (rev 118252)
+++ trunk/Source/WebCore/Modules/filesystem/FileWriter.h	2012-05-23 21:59:44 UTC (rev 118253)
@@ -70,7 +70,6 @@
 
     // ActiveDOMObject
     virtual bool canSuspend() const;
-    virtual bool hasPendingActivity() const;
     virtual void stop();
 
     // EventTarget

Modified: trunk/Source/WebCore/fileapi/FileReader.cpp (118252 => 118253)


--- trunk/Source/WebCore/fileapi/FileReader.cpp	2012-05-23 21:59:29 UTC (rev 118252)
+++ trunk/Source/WebCore/fileapi/FileReader.cpp	2012-05-23 21:59:44 UTC (rev 118253)
@@ -74,11 +74,6 @@
     return eventNames().interfaceForFileReader;
 }
 
-bool FileReader::hasPendingActivity() const
-{
-    return m_state == LOADING || ActiveDOMObject::hasPendingActivity();
-}
-
 bool FileReader::canSuspend() const
 {
     // FIXME: It is not currently possible to suspend a FileReader, so pages with FileReader can not go into page cache.
@@ -144,6 +139,8 @@
         return;
     }
 
+    setPendingActivity(this);
+
     m_blob = blob;
     m_readType = type;
     m_state = LOADING;
@@ -175,6 +172,8 @@
 
 void FileReader::doAbort()
 {
+    ASSERT(m_state != DONE);
+
     terminate();
     m_aborting = false;
 
@@ -183,6 +182,9 @@
     fireEvent(eventNames().errorEvent);
     fireEvent(eventNames().abortEvent);
     fireEvent(eventNames().loadendEvent);
+
+    // All possible events have fired and we're done, no more pending activity.
+    unsetPendingActivity(this);
 }
 
 void FileReader::terminate()
@@ -213,10 +215,14 @@
 
 void FileReader::didFinishLoading()
 {
+    ASSERT(m_state != DONE);
     m_state = DONE;
 
     fireEvent(eventNames().loadEvent);
     fireEvent(eventNames().loadendEvent);
+    
+    // All possible events have fired and we're done, no more pending activity.
+    unsetPendingActivity(this);
 }
 
 void FileReader::didFail(int errorCode)
@@ -225,11 +231,15 @@
     if (m_aborting)
         return;
 
+    ASSERT(m_state != DONE);
     m_state = DONE;
 
     m_error = FileError::create(static_cast<FileError::ErrorCode>(errorCode));
     fireEvent(eventNames().errorEvent);
     fireEvent(eventNames().loadendEvent);
+    
+    // All possible events have fired and we're done, no more pending activity.
+    unsetPendingActivity(this);
 }
 
 void FileReader::fireEvent(const AtomicString& type)

Modified: trunk/Source/WebCore/fileapi/FileReader.h (118252 => 118253)


--- trunk/Source/WebCore/fileapi/FileReader.h	2012-05-23 21:59:29 UTC (rev 118252)
+++ trunk/Source/WebCore/fileapi/FileReader.h	2012-05-23 21:59:44 UTC (rev 118253)
@@ -79,7 +79,6 @@
     // ActiveDOMObject
     virtual bool canSuspend() const;
     virtual void stop();
-    virtual bool hasPendingActivity() const;
 
     // EventTarget
     virtual const AtomicString& interfaceName() const;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to