Title: [242818] trunk
Revision
242818
Author
sihui_...@apple.com
Date
2019-03-12 12:36:47 -0700 (Tue, 12 Mar 2019)

Log Message

Layout Test imported/w3c/web-platform-tests/IndexedDB/fire-*-event-exception.html are failing
https://bugs.webkit.org/show_bug.cgi?id=195581

LayoutTests/imported/w3c:

Updated test expectations to PASS.

Reviewed by Brady Eidson.

* web-platform-tests/IndexedDB/fire-error-event-exception-expected.txt:
* web-platform-tests/IndexedDB/fire-success-event-exception-expected.txt:
* web-platform-tests/IndexedDB/fire-upgradeneeded-event-exception-expected.txt:

Source/WebCore:

Reviewed by Brady Eidson.

Uncaught exceptions should be handled after IDBRequest dispatches events so that IDBTransaction would stay
active during event dispatch.

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

Modified Paths

Diff

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (242817 => 242818)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2019-03-12 19:34:56 UTC (rev 242817)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2019-03-12 19:36:47 UTC (rev 242818)
@@ -1,5 +1,18 @@
 2019-03-12  Sihui Liu  <sihui_...@apple.com>
 
+        Layout Test imported/w3c/web-platform-tests/IndexedDB/fire-*-event-exception.html are failing
+        https://bugs.webkit.org/show_bug.cgi?id=195581
+
+        Updated test expectations to PASS.
+
+        Reviewed by Brady Eidson.
+
+        * web-platform-tests/IndexedDB/fire-error-event-exception-expected.txt:
+        * web-platform-tests/IndexedDB/fire-success-event-exception-expected.txt:
+        * web-platform-tests/IndexedDB/fire-upgradeneeded-event-exception-expected.txt:
+
+2019-03-12  Sihui Liu  <sihui_...@apple.com>
+
         Layout Test imported/w3c/web-platform-tests/IndexedDB/transaction-abort-request-error.html is failing
         https://bugs.webkit.org/show_bug.cgi?id=195570
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/IndexedDB/fire-error-event-exception-expected.txt (242817 => 242818)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/IndexedDB/fire-error-event-exception-expected.txt	2019-03-12 19:34:56 UTC (rev 242817)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/IndexedDB/fire-error-event-exception-expected.txt	2019-03-12 19:36:47 UTC (rev 242818)
@@ -18,15 +18,15 @@
 PASS Exception in error event handler on request, with preventDefault 
 PASS Exception in error event listener on request 
 PASS Exception in second error event listener on request 
-FAIL Exception in first error event listener on request, transaction active in second assert_equals: Active check should either not throw anything, or throw TransactionInactiveError expected "TransactionInactiveError" but got "InvalidStateError"
+PASS Exception in first error event listener on request, transaction active in second 
 PASS Exception in error event handler on transaction 
 PASS Exception in error event handler on transaction, with preventDefault 
 PASS Exception in error event listener on transaction 
 PASS Exception in second error event listener on transaction 
-FAIL Exception in first error event listener on transaction, transaction active in second assert_equals: Active check should either not throw anything, or throw TransactionInactiveError expected "TransactionInactiveError" but got "InvalidStateError"
+PASS Exception in first error event listener on transaction, transaction active in second 
 PASS Exception in error event handler on connection 
 PASS Exception in error event handler on connection, with preventDefault 
 PASS Exception in error event listener on connection 
 PASS Exception in second error event listener on connection 
-FAIL Exception in first error event listener on connection, transaction active in second assert_equals: Active check should either not throw anything, or throw TransactionInactiveError expected "TransactionInactiveError" but got "InvalidStateError"
+PASS Exception in first error event listener on connection, transaction active in second 
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/IndexedDB/fire-success-event-exception-expected.txt (242817 => 242818)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/IndexedDB/fire-success-event-exception-expected.txt	2019-03-12 19:34:56 UTC (rev 242817)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/IndexedDB/fire-success-event-exception-expected.txt	2019-03-12 19:36:47 UTC (rev 242818)
@@ -6,5 +6,5 @@
 PASS Exception in success event handler on request 
 PASS Exception in success event listener on request 
 PASS Exception in second success event listener on request 
-FAIL Exception in first success event listener, tx active in second assert_equals: Active check should either not throw anything, or throw TransactionInactiveError expected "TransactionInactiveError" but got "InvalidStateError"
+PASS Exception in first success event listener, tx active in second 
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/IndexedDB/fire-upgradeneeded-event-exception-expected.txt (242817 => 242818)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/IndexedDB/fire-upgradeneeded-event-exception-expected.txt	2019-03-12 19:34:56 UTC (rev 242817)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/IndexedDB/fire-upgradeneeded-event-exception-expected.txt	2019-03-12 19:36:47 UTC (rev 242818)
@@ -6,5 +6,5 @@
 PASS Exception in upgradeneeded handler 
 PASS Exception in upgradeneeded listener 
 PASS Exception in second upgradeneeded listener 
-FAIL Exception in first upgradeneeded listener, tx active in second assert_equals: Active check should either not throw anything, or throw TransactionInactiveError expected "TransactionInactiveError" but got "InvalidStateError"
+PASS Exception in first upgradeneeded listener, tx active in second 
 

Modified: trunk/Source/WebCore/ChangeLog (242817 => 242818)


--- trunk/Source/WebCore/ChangeLog	2019-03-12 19:34:56 UTC (rev 242817)
+++ trunk/Source/WebCore/ChangeLog	2019-03-12 19:36:47 UTC (rev 242818)
@@ -1,5 +1,20 @@
 2019-03-12  Sihui Liu  <sihui_...@apple.com>
 
+        Layout Test imported/w3c/web-platform-tests/IndexedDB/fire-*-event-exception.html are failing
+        https://bugs.webkit.org/show_bug.cgi?id=195581
+
+        Reviewed by Brady Eidson.
+
+        Uncaught exceptions should be handled after IDBRequest dispatches events so that IDBTransaction would stay 
+        active during event dispatch.
+
+        * Modules/indexeddb/IDBRequest.cpp:
+        (WebCore::IDBRequest::dispatchEvent):
+        (WebCore::IDBRequest::uncaughtExceptionInEventHandler):
+        * Modules/indexeddb/IDBRequest.h:
+
+2019-03-12  Sihui Liu  <sihui_...@apple.com>
+
         Layout Test imported/w3c/web-platform-tests/IndexedDB/transaction-abort-request-error.html is failing
         https://bugs.webkit.org/show_bug.cgi?id=195570
 

Modified: trunk/Source/WebCore/Modules/indexeddb/IDBRequest.cpp (242817 => 242818)


--- trunk/Source/WebCore/Modules/indexeddb/IDBRequest.cpp	2019-03-12 19:34:56 UTC (rev 242817)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBRequest.cpp	2019-03-12 19:36:47 UTC (rev 242818)
@@ -304,6 +304,7 @@
     ASSERT(!m_contextStopped);
 
     auto protectedThis = makeRef(*this);
+    m_dispatchingEvent = true;
 
     if (event.type() != eventNames().blockedEvent)
         m_readyState = ReadyState::Done;
@@ -331,7 +332,9 @@
     if (m_transaction && !m_pendingCursor && event.type() != eventNames().blockedEvent)
         m_transaction->removeRequest(*this);
 
-    if (!event.defaultPrevented() && event.type() == eventNames().errorEvent && m_transaction && !m_transaction->isFinishedOrFinishing()) {
+    if (m_hasUncaughtException)
+        m_transaction->abortDueToFailedRequest(DOMException::create(AbortError, "IDBTransaction will abort due to uncaught exception in an event handler"_s));
+    else if (!event.defaultPrevented() && event.type() == eventNames().errorEvent && m_transaction && !m_transaction->isFinishedOrFinishing()) {
         ASSERT(m_domError);
         m_transaction->abortDueToFailedRequest(*m_domError);
     }
@@ -338,6 +341,8 @@
 
     if (m_transaction)
         m_transaction->finishedDispatchEventForRequest(*this);
+
+    m_dispatchingEvent = false;
 }
 
 void IDBRequest::uncaughtExceptionInEventHandler()
@@ -346,6 +351,11 @@
 
     ASSERT(&originThread() == &Thread::current());
 
+    if (m_dispatchingEvent) {
+        ASSERT(!m_hasUncaughtException);
+        m_hasUncaughtException = true;
+        return;
+    }
     if (m_transaction && m_idbError.code() != AbortError)
         m_transaction->abortDueToFailedRequest(DOMException::create(AbortError, "IDBTransaction will abort due to uncaught exception in an event handler"_s));
 }

Modified: trunk/Source/WebCore/Modules/indexeddb/IDBRequest.h (242817 => 242818)


--- trunk/Source/WebCore/Modules/indexeddb/IDBRequest.h	2019-03-12 19:34:56 UTC (rev 242817)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBRequest.h	2019-03-12 19:36:47 UTC (rev 242818)
@@ -181,6 +181,9 @@
     RefPtr<IDBCursor> m_pendingCursor;
 
     Ref<IDBClient::IDBConnectionProxy> m_connectionProxy;
+
+    bool m_dispatchingEvent { false };
+    bool m_hasUncaughtException { false };
 };
 
 } // namespace WebCore
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to