Title: [124974] trunk
Revision
124974
Author
[email protected]
Date
2012-08-07 20:06:22 -0700 (Tue, 07 Aug 2012)

Log Message

Layout Test storage/indexeddb/intversion-omit-parameter.html is flaky
https://bugs.webkit.org/show_bug.cgi?id=92952

Reviewed by Tony Chang.

Source/WebCore:

Account for events being propagated from the back-end to front-end after
front-end context is stopped (i.e. document is being destroyed). The IDBRequest
lifecycle was tightened up in http://trac.webkit.org/changeset/123275 with more
asserts but the stopped state wasn't accounted for.

Test: [chromium] webkit_unit_tests --gtest_filter='IDBRequestTest.EventsAfterStopping'

* Modules/indexeddb/IDBRequest.cpp:
(WebCore::IDBRequest::abort):
(WebCore::IDBRequest::onError):
(WebCore::IDBRequest::onSuccess):
(WebCore::IDBRequest::onSuccessWithContinuation):

Source/WebKit/chromium:

Added test to exercise WebCore::IDBRequest event callbacks after
the script context has stopped and ensure no asserts are hit.

* WebKit.gypi:
* tests/IDBRequestTest.cpp: Added.
(WebCore):
(WebCore::TEST):

LayoutTests:

Remove expectation now that flakiness should be resolved.

* platform/chromium/TestExpectations:

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (124973 => 124974)


--- trunk/LayoutTests/ChangeLog	2012-08-08 02:52:53 UTC (rev 124973)
+++ trunk/LayoutTests/ChangeLog	2012-08-08 03:06:22 UTC (rev 124974)
@@ -1,3 +1,14 @@
+2012-08-07  Joshua Bell  <[email protected]>
+
+        Layout Test storage/indexeddb/intversion-omit-parameter.html is flaky
+        https://bugs.webkit.org/show_bug.cgi?id=92952
+
+        Reviewed by Tony Chang.
+
+        Remove expectation now that flakiness should be resolved.
+
+        * platform/chromium/TestExpectations:
+
 2012-08-07  Yoshifumi Inoue  <[email protected]>
 
         translateZ(0) shifts file name in file input

Modified: trunk/LayoutTests/platform/chromium/TestExpectations (124973 => 124974)


--- trunk/LayoutTests/platform/chromium/TestExpectations	2012-08-08 02:52:53 UTC (rev 124973)
+++ trunk/LayoutTests/platform/chromium/TestExpectations	2012-08-08 03:06:22 UTC (rev 124974)
@@ -3461,9 +3461,6 @@
 
 BUGWK92941 WIN MAC : accessibility/loading-iframe-updates-axtree.html = CRASH PASS
 
-// Flakily crashing after http://trac.webkit.org/changeset/124402
-BUGWK92952 DEBUG : storage/indexeddb/intversion-omit-parameter.html = CRASH PASS
-
 // Tests added by bug 76270. According to bug 92968, they should be skipped in Chromium.
 BUGWK92968 SKIP : http/tests/appcache/abort-cache-onchecking-manifest-404.html = PASS
 BUGWK92968 SKIP : http/tests/appcache/abort-cache-onchecking-resource-404.html = PASS

Modified: trunk/Source/WebCore/ChangeLog (124973 => 124974)


--- trunk/Source/WebCore/ChangeLog	2012-08-08 02:52:53 UTC (rev 124973)
+++ trunk/Source/WebCore/ChangeLog	2012-08-08 03:06:22 UTC (rev 124974)
@@ -1,3 +1,23 @@
+2012-08-07  Joshua Bell  <[email protected]>
+
+        Layout Test storage/indexeddb/intversion-omit-parameter.html is flaky
+        https://bugs.webkit.org/show_bug.cgi?id=92952
+
+        Reviewed by Tony Chang.
+
+        Account for events being propagated from the back-end to front-end after
+        front-end context is stopped (i.e. document is being destroyed). The IDBRequest
+        lifecycle was tightened up in http://trac.webkit.org/changeset/123275 with more
+        asserts but the stopped state wasn't accounted for.
+
+        Test: [chromium] webkit_unit_tests --gtest_filter='IDBRequestTest.EventsAfterStopping'
+
+        * Modules/indexeddb/IDBRequest.cpp:
+        (WebCore::IDBRequest::abort):
+        (WebCore::IDBRequest::onError):
+        (WebCore::IDBRequest::onSuccess):
+        (WebCore::IDBRequest::onSuccessWithContinuation):
+
 2012-08-07  Kentaro Hara  <[email protected]>
 
         Optimize Element::getAttributeNode() by replacing String with AtomicString

Modified: trunk/Source/WebCore/Modules/indexeddb/IDBRequest.cpp (124973 => 124974)


--- trunk/Source/WebCore/Modules/indexeddb/IDBRequest.cpp	2012-08-08 02:52:53 UTC (rev 124973)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBRequest.cpp	2012-08-08 03:06:22 UTC (rev 124974)
@@ -141,10 +141,10 @@
 
 void IDBRequest::abort()
 {
-    ASSERT(m_readyState == PENDING || m_readyState == DONE);
     ASSERT(!m_requestAborted);
     if (m_contextStopped || !scriptExecutionContext())
         return;
+    ASSERT(m_readyState == PENDING || m_readyState == DONE);
     if (m_readyState == DONE)
         return;
 
@@ -210,13 +210,24 @@
     m_result = IDBAny::create(IDBCursorWithValue::fromCursor(prpCursor));
 }
 
-void IDBRequest::onError(PassRefPtr<IDBDatabaseError> error)
+bool IDBRequest::shouldEnqueueEvent() const
 {
+    if (m_contextStopped || !scriptExecutionContext())
+        return false;
     ASSERT(m_readyState == PENDING || m_readyState == DONE);
     if (m_requestAborted)
-        return;
+        return false;
     ASSERT(m_readyState == PENDING);
     ASSERT(!m_errorCode && m_errorMessage.isNull() && !m_error && !m_result);
+    return true;
+}
+
+void IDBRequest::onError(PassRefPtr<IDBDatabaseError> error)
+{
+    IDB_TRACE("IDBRequest::onError()");
+    if (!shouldEnqueueEvent())
+        return;
+
     m_errorCode = error->code();
     m_errorMessage = error->message();
     m_error = DOMError::create(IDBDatabaseException::getErrorName(error->idbCode()));
@@ -232,11 +243,9 @@
 void IDBRequest::onSuccess(PassRefPtr<DOMStringList> domStringList)
 {
     IDB_TRACE("IDBRequest::onSuccess(DOMStringList)");
-    ASSERT(m_readyState == PENDING || m_readyState == DONE);
-    if (m_requestAborted)
+    if (!shouldEnqueueEvent())
         return;
-    ASSERT(m_readyState == PENDING);
-    ASSERT(!m_errorCode && m_errorMessage.isNull() && !m_error && !m_result);
+
     m_result = IDBAny::create(domStringList);
     enqueueEvent(createSuccessEvent());
 }
@@ -244,11 +253,9 @@
 void IDBRequest::onSuccess(PassRefPtr<IDBCursorBackendInterface> backend)
 {
     IDB_TRACE("IDBRequest::onSuccess(IDBCursor)");
-    ASSERT(m_readyState == PENDING || m_readyState == DONE);
-    if (m_requestAborted)
+    if (!shouldEnqueueEvent())
         return;
-    ASSERT(m_readyState == PENDING);
-    ASSERT(!m_errorCode && m_errorMessage.isNull() && !m_error && !m_result);
+
     ASSERT(m_cursorType != IDBCursorBackendInterface::InvalidCursorType);
     RefPtr<IDBCursor> cursor;
     if (m_cursorType == IDBCursorBackendInterface::IndexKeyCursor)
@@ -263,13 +270,8 @@
 void IDBRequest::onSuccess(PassRefPtr<IDBDatabaseBackendInterface> backend)
 {
     IDB_TRACE("IDBRequest::onSuccess(IDBDatabase)");
-    ASSERT(m_readyState == PENDING || m_readyState == DONE);
-    if (m_requestAborted)
+    if (!shouldEnqueueEvent())
         return;
-    ASSERT(m_readyState == PENDING);
-    ASSERT(!m_errorCode && m_errorMessage.isNull() && !m_error && !m_result);
-    if (m_contextStopped || !scriptExecutionContext())
-        return;
 
     RefPtr<IDBDatabase> idbDatabase = IDBDatabase::create(scriptExecutionContext(), backend);
     idbDatabase->registerFrontendCallbacks();
@@ -281,11 +283,9 @@
 void IDBRequest::onSuccess(PassRefPtr<IDBKey> idbKey)
 {
     IDB_TRACE("IDBRequest::onSuccess(IDBKey)");
-    ASSERT(m_readyState == PENDING || m_readyState == DONE);
-    if (m_requestAborted)
+    if (!shouldEnqueueEvent())
         return;
-    ASSERT(m_readyState == PENDING);
-    ASSERT(!m_errorCode && m_errorMessage.isNull() && !m_error && !m_result);
+
     if (idbKey && idbKey->isValid())
         m_result = IDBAny::create(idbKey);
     else
@@ -296,17 +296,16 @@
 void IDBRequest::onSuccess(PassRefPtr<IDBTransactionBackendInterface> prpBackend)
 {
     IDB_TRACE("IDBRequest::onSuccess(IDBTransaction)");
-    ASSERT(m_readyState == PENDING || m_readyState == DONE);
-    if (m_requestAborted)
-        return;
-    ASSERT(m_readyState == PENDING);
-    ASSERT(!m_errorCode && m_errorMessage.isNull() && !m_error && !m_result);
     RefPtr<IDBTransactionBackendInterface> backend = prpBackend;
 
     if (m_contextStopped || !scriptExecutionContext()) {
-        backend->abort();
+        // Should only be null in tests.
+        if (backend.get())
+            backend->abort();
         return;
     }
+    if (!shouldEnqueueEvent())
+        return;
 
     RefPtr<IDBTransaction> frontend = IDBTransaction::create(scriptExecutionContext(), backend, IDBTransaction::VERSION_CHANGE, m_source->idbDatabase().get());
     backend->setCallbacks(frontend.get());
@@ -322,11 +321,9 @@
 void IDBRequest::onSuccess(PassRefPtr<SerializedScriptValue> serializedScriptValue)
 {
     IDB_TRACE("IDBRequest::onSuccess(SerializedScriptValue)");
-    ASSERT(m_readyState == PENDING || m_readyState == DONE);
-    if (m_requestAborted)
+    if (!shouldEnqueueEvent())
         return;
-    ASSERT(m_readyState == PENDING);
-    ASSERT(!m_errorCode && m_errorMessage.isNull() && !m_error && !m_result);
+
     m_result = IDBAny::create(serializedScriptValue);
     m_pendingCursor.clear();
     enqueueEvent(createSuccessEvent());
@@ -347,8 +344,10 @@
 
 void IDBRequest::onSuccess(PassRefPtr<SerializedScriptValue> prpSerializedScriptValue, PassRefPtr<IDBKey> prpPrimaryKey, const IDBKeyPath& keyPath)
 {
-    if (m_requestAborted)
+    IDB_TRACE("IDBRequest::onSuccess(SerializedScriptValue, IDBKey, IDBKeyPath)");
+    if (!shouldEnqueueEvent())
         return;
+
 #ifndef NDEBUG
     ASSERT(keyPath == effectiveObjectStore(m_source)->keyPath());
 #endif
@@ -373,10 +372,9 @@
 void IDBRequest::onSuccessWithContinuation()
 {
     IDB_TRACE("IDBRequest::onSuccessWithContinuation");
-    ASSERT(m_readyState == PENDING || m_readyState == DONE);
-    if (m_requestAborted)
+    if (!shouldEnqueueEvent())
         return;
-    ASSERT(!m_errorCode && m_errorMessage.isNull() && !m_error && !m_result);
+
     ASSERT(m_pendingCursor);
     setResultCursor(m_pendingCursor.release());
     enqueueEvent(createSuccessEvent());

Modified: trunk/Source/WebCore/Modules/indexeddb/IDBRequest.h (124973 => 124974)


--- trunk/Source/WebCore/Modules/indexeddb/IDBRequest.h	2012-08-08 02:52:53 UTC (rev 124973)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBRequest.h	2012-08-08 03:06:22 UTC (rev 124974)
@@ -114,6 +114,8 @@
     RefPtr<DOMError> m_error;
 
 private:
+    bool shouldEnqueueEvent() const;
+
     // EventTarget
     virtual void refEventTarget() { ref(); }
     virtual void derefEventTarget() { deref(); }

Modified: trunk/Source/WebKit/chromium/ChangeLog (124973 => 124974)


--- trunk/Source/WebKit/chromium/ChangeLog	2012-08-08 02:52:53 UTC (rev 124973)
+++ trunk/Source/WebKit/chromium/ChangeLog	2012-08-08 03:06:22 UTC (rev 124974)
@@ -1,3 +1,18 @@
+2012-08-07  Joshua Bell  <[email protected]>
+
+        Layout Test storage/indexeddb/intversion-omit-parameter.html is flaky
+        https://bugs.webkit.org/show_bug.cgi?id=92952
+
+        Reviewed by Tony Chang.
+
+        Added test to exercise WebCore::IDBRequest event callbacks after
+        the script context has stopped and ensure no asserts are hit.
+
+        * WebKit.gypi:
+        * tests/IDBRequestTest.cpp: Added.
+        (WebCore):
+        (WebCore::TEST):
+
 2012-08-07  Fady Samuel  <[email protected]>
 
         Allow plugins to decide whether they are keyboard focusable

Modified: trunk/Source/WebKit/chromium/WebKit.gypi (124973 => 124974)


--- trunk/Source/WebKit/chromium/WebKit.gypi	2012-08-08 02:52:53 UTC (rev 124973)
+++ trunk/Source/WebKit/chromium/WebKit.gypi	2012-08-08 03:06:22 UTC (rev 124974)
@@ -118,6 +118,7 @@
             'tests/IDBFakeBackingStore.h',
             'tests/IDBKeyPathTest.cpp',
             'tests/IDBLevelDBCodingTest.cpp',
+            'tests/IDBRequestTest.cpp',
             'tests/ImageLayerChromiumTest.cpp',
             'tests/KeyboardTest.cpp',
             'tests/KURLTest.cpp',

Added: trunk/Source/WebKit/chromium/tests/IDBRequestTest.cpp (0 => 124974)


--- trunk/Source/WebKit/chromium/tests/IDBRequestTest.cpp	                        (rev 0)
+++ trunk/Source/WebKit/chromium/tests/IDBRequestTest.cpp	2012-08-08 03:06:22 UTC (rev 124974)
@@ -0,0 +1,64 @@
+/*
+ * Copyright (C) 2012 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+
+#include "IDBRequest.h"
+
+#include "IDBCursorBackendInterface.h"
+#include "IDBDatabaseBackendImpl.h"
+#include "IDBTransactionCoordinator.h"
+
+#include <gtest/gtest.h>
+
+#if ENABLE(INDEXED_DATABASE)
+
+using namespace WebCore;
+
+namespace {
+
+TEST(IDBRequestTest, EventsAfterStopping)
+{
+    ScriptExecutionContext* context = 0;
+    IDBTransaction* transaction = 0;
+    RefPtr<IDBRequest> request = IDBRequest::create(context, IDBAny::createInvalid(), transaction);
+    EXPECT_EQ(request->readyState(), "pending");
+    request->stop();
+
+    // Ensure none of the following raise assertions in stopped state:
+    request->onError(IDBDatabaseError::create(IDBDatabaseException::IDB_ABORT_ERR, "Description goes here."));
+    request->onSuccess(DOMStringList::create());
+    request->onSuccess(PassRefPtr<IDBDatabaseBackendInterface>());
+    request->onSuccess(PassRefPtr<IDBCursorBackendInterface>());
+    request->onSuccess(IDBKey::createInvalid());
+    request->onSuccess(PassRefPtr<IDBTransactionBackendInterface>());
+    request->onSuccess(SerializedScriptValue::nullValue());
+    request->onSuccess(SerializedScriptValue::nullValue(), IDBKey::createInvalid(), IDBKeyPath());
+    request->onSuccessWithContinuation();
+}
+
+} // namespace
+
+#endif // ENABLE(INDEXED_DATABASE)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to