Title: [192956] trunk
Revision
192956
Author
[email protected]
Date
2015-12-02 12:32:38 -0800 (Wed, 02 Dec 2015)

Log Message

Modern IDB: IDBTransaction::error is not exposed.
https://bugs.webkit.org/show_bug.cgi?id=151752

Reviewed by Alex Christensen.

Source/WebCore:

No new tests (At least 3 failing tests now pass, plus changes to other faulty tests).

* Modules/indexeddb/client/IDBRequestImpl.cpp:
(WebCore::IDBClient::IDBRequest::dispatchEvent):
(WebCore::IDBClient::IDBRequest::uncaughtExceptionInEventHandler):
* Modules/indexeddb/client/IDBRequestImpl.h:

* Modules/indexeddb/client/IDBTransactionImpl.cpp:
(WebCore::IDBClient::IDBTransaction::error):
(WebCore::IDBClient::IDBTransaction::abortDueToFailedRequest):
(WebCore::IDBClient::IDBTransaction::abort):
(WebCore::IDBClient::IDBTransaction::didCreateIndexOnServer):
* Modules/indexeddb/client/IDBTransactionImpl.h:

LayoutTests:

* platform/mac-wk1/TestExpectations:
* storage/indexeddb/modern/basic-add.html:
* storage/indexeddb/modern/double-abort-expected.txt:
* storage/indexeddb/modern/index-3.html:
* storage/indexeddb/resources/transaction-error.js:
* storage/indexeddb/transaction-error-expected.txt:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (192955 => 192956)


--- trunk/LayoutTests/ChangeLog	2015-12-02 20:25:55 UTC (rev 192955)
+++ trunk/LayoutTests/ChangeLog	2015-12-02 20:32:38 UTC (rev 192956)
@@ -1,3 +1,17 @@
+2015-12-02  Brady Eidson  <[email protected]>
+
+        Modern IDB: IDBTransaction::error is not exposed.
+        https://bugs.webkit.org/show_bug.cgi?id=151752
+
+        Reviewed by Alex Christensen.
+
+        * platform/mac-wk1/TestExpectations:
+        * storage/indexeddb/modern/basic-add.html:
+        * storage/indexeddb/modern/double-abort-expected.txt:
+        * storage/indexeddb/modern/index-3.html:
+        * storage/indexeddb/resources/transaction-error.js:
+        * storage/indexeddb/transaction-error-expected.txt:
+
 2015-12-02  Adenilson Cavalcanti  <[email protected]>
 
         [css border] border-image doesn't honor border-style

Modified: trunk/LayoutTests/platform/mac-wk1/TestExpectations (192955 => 192956)


--- trunk/LayoutTests/platform/mac-wk1/TestExpectations	2015-12-02 20:25:55 UTC (rev 192955)
+++ trunk/LayoutTests/platform/mac-wk1/TestExpectations	2015-12-02 20:32:38 UTC (rev 192956)
@@ -78,6 +78,9 @@
 storage/indexeddb/cursor-finished.html [ Pass ]
 storage/indexeddb/modern [ Pass ]
 storage/indexeddb/mozilla [ Pass ]
+storage/indexeddb/transaction-abort.html [ Pass ]
+storage/indexeddb/transaction-error.html [ Pass ]
+storage/indexeddb/transaction-event-propagation.html [ Pass ]
 
 # No workers support in Modern IDB yet
 storage/indexeddb/basics-workers.html

Modified: trunk/LayoutTests/storage/indexeddb/modern/basic-add.html (192955 => 192956)


--- trunk/LayoutTests/storage/indexeddb/modern/basic-add.html	2015-12-02 20:25:55 UTC (rev 192955)
+++ trunk/LayoutTests/storage/indexeddb/modern/basic-add.html	2015-12-02 20:32:38 UTC (rev 192956)
@@ -57,6 +57,7 @@
         }
         
         event.stopPropagation();
+        event.preventDefault();
     }
         
     tx._onabort_ = function(event) {

Modified: trunk/LayoutTests/storage/indexeddb/modern/double-abort-expected.txt (192955 => 192956)


--- trunk/LayoutTests/storage/indexeddb/modern/double-abort-expected.txt	2015-12-02 20:25:55 UTC (rev 192955)
+++ trunk/LayoutTests/storage/indexeddb/modern/double-abort-expected.txt	2015-12-02 20:32:38 UTC (rev 192956)
@@ -1,5 +1,5 @@
 ALERT: Initial upgrade needed: Old version - 0 New version - 1
-ALERT: Second abort failed: Error: InvalidStateError: DOM Exception 11
+ALERT: Second abort failed: Error: InvalidStateError: DOM IDBDatabase Exception 11
 ALERT: Initial upgrade versionchange transaction aborted
 ALERT: Done
 This test aborts the same transaction twice, making the appropriate exception is thrown.

Modified: trunk/LayoutTests/storage/indexeddb/modern/index-3.html (192955 => 192956)


--- trunk/LayoutTests/storage/indexeddb/modern/index-3.html	2015-12-02 20:25:55 UTC (rev 192955)
+++ trunk/LayoutTests/storage/indexeddb/modern/index-3.html	2015-12-02 20:32:38 UTC (rev 192956)
@@ -76,6 +76,7 @@
     request2._onerror_ = function(e) {
         log("Second put failure");
         e.stopPropagation();
+        e.preventDefault();
     }
     
     checkObjectStore();
@@ -90,6 +91,7 @@
     request3._onerror_ = function(e) {
         log("Third put failure");
         e.stopPropagation();
+        e.preventDefault();
     }
     
     checkObjectStore();

Modified: trunk/LayoutTests/storage/indexeddb/resources/transaction-error.js (192955 => 192956)


--- trunk/LayoutTests/storage/indexeddb/resources/transaction-error.js	2015-12-02 20:25:55 UTC (rev 192955)
+++ trunk/LayoutTests/storage/indexeddb/resources/transaction-error.js	2015-12-02 20:32:38 UTC (rev 192956)
@@ -53,8 +53,6 @@
     trans._onabort_ = function() {
         debug("Transaction received abort event.");
         shouldBeNonNull("trans.error");
-        debug("trans.error.message = " + trans.error.message);
-        shouldBeNonNull("trans.error.message");
         shouldBe("trans.error", "request_error");
         testErrorFromException();
     };
@@ -85,8 +83,6 @@
         self._onerror_ = self.originalWindowOnError;
 
         shouldBeNonNull("trans.error");
-        debug("trans.error.message = " + trans.error.message);
-        shouldBeNonNull("trans.error.message");
         shouldBe("trans.error.name", "'AbortError'");
         testErrorFromCommit();
     };
@@ -117,10 +113,7 @@
                 debug("Transaction received abort event.");
                 shouldBeNonNull("trans.error");
                 shouldBe("trans.error.name", "'ConstraintError'");
-                debug("trans.error.message = " + trans.error.message);
-                shouldBeNonNull("trans.error.message");
                 debug("Note: This fails because of http://wkb.ug/37327");
-                shouldNotBe("trans.error.message.indexOf(indexName)", "-1");
                 debug("");
                 finishJSTest();
             };

Modified: trunk/LayoutTests/storage/indexeddb/transaction-error-expected.txt (192955 => 192956)


--- trunk/LayoutTests/storage/indexeddb/transaction-error-expected.txt	2015-12-02 20:25:55 UTC (rev 192955)
+++ trunk/LayoutTests/storage/indexeddb/transaction-error-expected.txt	2015-12-02 20:32:38 UTC (rev 192956)
@@ -1,4 +1,4 @@
-CONSOLE ERROR: line 78: Uncaught Error: This should *NOT* be caught!
+CONSOLE MESSAGE: line 76: Error: This should *NOT* be caught!
 Test IDBTransaction.error cases.
 
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
@@ -31,8 +31,6 @@
 request_error = request.error
 Transaction received abort event.
 PASS trans.error is non-null.
-trans.error.message = Key already exists in the object store.
-PASS trans.error.message is non-null.
 PASS trans.error is request_error
 
 If the transaction is aborted due to an exception thrown from event callback, IDBTransaction.error should be AbortError:
@@ -42,8 +40,6 @@
 Throwing exception...
 Transaction received abort event.
 PASS trans.error is non-null.
-trans.error.message = Uncaught exception in event handler.
-PASS trans.error.message is non-null.
 PASS trans.error.name is 'AbortError'
 
 If the transaction is aborted due to an error during commit, IDBTransaction.error should reflect that error:
@@ -58,10 +54,7 @@
 Transaction received abort event.
 PASS trans.error is non-null.
 PASS trans.error.name is 'ConstraintError'
-trans.error.message = Unable to add key to index 'Also test utf8: 漢': at least one key does not satisfy the uniqueness requirements.
-PASS trans.error.message is non-null.
 Note: This fails because of http://wkb.ug/37327
-PASS trans.error.message.indexOf(indexName) is not -1
 
 PASS successfullyParsed is true
 

Modified: trunk/Source/WebCore/ChangeLog (192955 => 192956)


--- trunk/Source/WebCore/ChangeLog	2015-12-02 20:25:55 UTC (rev 192955)
+++ trunk/Source/WebCore/ChangeLog	2015-12-02 20:32:38 UTC (rev 192956)
@@ -1,3 +1,24 @@
+2015-12-02  Brady Eidson  <[email protected]>
+
+        Modern IDB: IDBTransaction::error is not exposed.
+        https://bugs.webkit.org/show_bug.cgi?id=151752
+
+        Reviewed by Alex Christensen.
+
+        No new tests (At least 3 failing tests now pass, plus changes to other faulty tests).
+
+        * Modules/indexeddb/client/IDBRequestImpl.cpp:
+        (WebCore::IDBClient::IDBRequest::dispatchEvent):
+        (WebCore::IDBClient::IDBRequest::uncaughtExceptionInEventHandler):
+        * Modules/indexeddb/client/IDBRequestImpl.h:
+        
+        * Modules/indexeddb/client/IDBTransactionImpl.cpp:
+        (WebCore::IDBClient::IDBTransaction::error):
+        (WebCore::IDBClient::IDBTransaction::abortDueToFailedRequest):
+        (WebCore::IDBClient::IDBTransaction::abort):
+        (WebCore::IDBClient::IDBTransaction::didCreateIndexOnServer):
+        * Modules/indexeddb/client/IDBTransactionImpl.h:
+
 2015-12-02  Adenilson Cavalcanti  <[email protected]>
 
         [css border] border-image doesn't honor border-style

Modified: trunk/Source/WebCore/Modules/indexeddb/client/IDBRequestImpl.cpp (192955 => 192956)


--- trunk/Source/WebCore/Modules/indexeddb/client/IDBRequestImpl.cpp	2015-12-02 20:25:55 UTC (rev 192955)
+++ trunk/Source/WebCore/Modules/indexeddb/client/IDBRequestImpl.cpp	2015-12-02 20:32:38 UTC (rev 192956)
@@ -278,9 +278,22 @@
     if (m_transaction && !m_pendingCursor)
         m_transaction->removeRequest(*this);
 
+    if (dontPreventDefault && event.type() == eventNames().errorEvent && m_transaction && !m_transaction->isFinishedOrFinishing()) {
+        ASSERT(m_domError);
+        m_transaction->abortDueToFailedRequest(*m_domError);
+    }
+
     return dontPreventDefault;
 }
 
+void IDBRequest::uncaughtExceptionInEventHandler()
+{
+    LOG(IndexedDB, "IDBRequest::uncaughtExceptionInEventHandler");
+
+    if (m_transaction && m_idbError.code() != IDBDatabaseException::AbortError)
+        m_transaction->abortDueToFailedRequest(DOMError::create(IDBDatabaseException::getErrorName(IDBDatabaseException::AbortError)));
+}
+
 void IDBRequest::setResult(const IDBKeyData* keyData)
 {
     if (!keyData) {

Modified: trunk/Source/WebCore/Modules/indexeddb/client/IDBRequestImpl.h (192955 => 192956)


--- trunk/Source/WebCore/Modules/indexeddb/client/IDBRequestImpl.h	2015-12-02 20:25:55 UTC (rev 192955)
+++ trunk/Source/WebCore/Modules/indexeddb/client/IDBRequestImpl.h	2015-12-02 20:32:38 UTC (rev 192956)
@@ -114,6 +114,7 @@
     // EventTarget.
     virtual void refEventTarget() override final { RefCounted<IDBRequest>::ref(); }
     virtual void derefEventTarget() override final { RefCounted<IDBRequest>::deref(); }
+    virtual void uncaughtExceptionInEventHandler() override final;
 
     virtual bool isOpenDBRequest() const { return false; }
 

Modified: trunk/Source/WebCore/Modules/indexeddb/client/IDBTransactionImpl.cpp (192955 => 192956)


--- trunk/Source/WebCore/Modules/indexeddb/client/IDBTransactionImpl.cpp	2015-12-02 20:25:55 UTC (rev 192955)
+++ trunk/Source/WebCore/Modules/indexeddb/client/IDBTransactionImpl.cpp	2015-12-02 20:32:38 UTC (rev 192956)
@@ -31,6 +31,7 @@
 #include "DOMError.h"
 #include "EventQueue.h"
 #include "IDBCursorWithValueImpl.h"
+#include "IDBDatabaseException.h"
 #include "IDBDatabaseImpl.h"
 #include "IDBError.h"
 #include "IDBEventDispatcher.h"
@@ -117,8 +118,7 @@
 
 RefPtr<DOMError> IDBTransaction::error() const
 {
-    ASSERT_NOT_REACHED();
-    return nullptr;
+    return m_domError;
 }
 
 RefPtr<WebCore::IDBObjectStore> IDBTransaction::objectStore(const String& objectStoreName, ExceptionCode& ec)
@@ -165,12 +165,23 @@
     return adoptRef(&objectStore.leakRef());
 }
 
+
+void IDBTransaction::abortDueToFailedRequest(DOMError& error)
+{
+    LOG(IndexedDB, "IDBTransaction::abortDueToFailedRequest");
+    ASSERT(!isFinishedOrFinishing());
+
+    m_domError = &error;
+    ExceptionCode ec;
+    abort(ec);
+}
+
 void IDBTransaction::abort(ExceptionCode& ec)
 {
     LOG(IndexedDB, "IDBTransaction::abort");
 
     if (isFinishedOrFinishing()) {
-        ec = INVALID_STATE_ERR;
+        ec = IDBDatabaseException::InvalidStateError;
         return;
     }
 
@@ -481,8 +492,7 @@
         return;
 
     // Otherwise, failure to create an index forced abortion of the transaction.
-    ExceptionCode ec;
-    abort(ec);
+    abortDueToFailedRequest(DOMError::create(IDBDatabaseException::getErrorName(resultData.error().code())));
 }
 
 Ref<IDBRequest> IDBTransaction::requestOpenCursor(ScriptExecutionContext& context, IDBObjectStore& objectStore, const IDBCursorInfo& info)

Modified: trunk/Source/WebCore/Modules/indexeddb/client/IDBTransactionImpl.h (192955 => 192956)


--- trunk/Source/WebCore/Modules/indexeddb/client/IDBTransactionImpl.h	2015-12-02 20:25:55 UTC (rev 192955)
+++ trunk/Source/WebCore/Modules/indexeddb/client/IDBTransactionImpl.h	2015-12-02 20:32:38 UTC (rev 192956)
@@ -116,6 +116,8 @@
     void addRequest(IDBRequest&);
     void removeRequest(IDBRequest&);
 
+    void abortDueToFailedRequest(DOMError&);
+
     IDBConnectionToServer& serverConnection();
 
     void activate();
@@ -191,6 +193,7 @@
     bool m_startedOnServer { false };
 
     IDBError m_idbError;
+    RefPtr<DOMError> m_domError;
 
     Timer m_operationTimer;
     std::unique_ptr<Timer> m_activationTimer;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to