Title: [193970] trunk
Revision
193970
Author
beid...@apple.com
Date
2015-12-11 11:56:18 -0800 (Fri, 11 Dec 2015)

Log Message

Modern IDB: storage/indexeddb/intversion-abort-in-initial-upgradeneeded.html fails.
https://bugs.webkit.org/show_bug.cgi?id=152177

Reviewed by Alex Christensen.

Source/WebCore:

No new tests (At least one failing test now passes).

* Modules/indexeddb/client/IDBOpenDBRequestImpl.cpp:
(WebCore::IDBClient::IDBOpenDBRequest::versionChangeTransactionDidFinish): Renamed from below.
(WebCore::IDBClient::IDBOpenDBRequest::versionChangeTransactionWillFinish): Deleted.
* Modules/indexeddb/client/IDBOpenDBRequestImpl.h:

* Modules/indexeddb/client/IDBRequestImpl.cpp:
(WebCore::IDBClient::IDBRequest::setVersionChangeTransaction): OpenDBRequests usually don't have transactions,
  unless they end up being upgrade requests.
* Modules/indexeddb/client/IDBRequestImpl.h:

* Modules/indexeddb/client/IDBTransactionImpl.cpp:
(WebCore::IDBClient::IDBTransaction::IDBTransaction): Call setVersionChangeTransaction on the request if appropriate.
(WebCore::IDBClient::IDBTransaction::dispatchEvent): Call versionChangeTransactionDidFinish after the
  abort/complete events fire.
(WebCore::IDBClient::IDBTransaction::abort): Deleted.
(WebCore::IDBClient::IDBTransaction::commit): Deleted.

LayoutTests:

* platform/mac-wk1/TestExpectations:
* platform/wk2/storage/indexeddb/intversion-abort-in-initial-upgradeneeded-expected.txt: Copied from LayoutTests/storage/indexeddb/intversion-abort-in-initial-upgradeneeded-expected.txt.
* storage/indexeddb/intversion-abort-in-initial-upgradeneeded-expected.txt:
* storage/indexeddb/resources/intversion-abort-in-initial-upgradeneeded.js:

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (193969 => 193970)


--- trunk/LayoutTests/ChangeLog	2015-12-11 19:49:56 UTC (rev 193969)
+++ trunk/LayoutTests/ChangeLog	2015-12-11 19:56:18 UTC (rev 193970)
@@ -1,3 +1,15 @@
+2015-12-11  Brady Eidson  <beid...@apple.com>
+
+        Modern IDB: storage/indexeddb/intversion-abort-in-initial-upgradeneeded.html fails.
+        https://bugs.webkit.org/show_bug.cgi?id=152177
+
+        Reviewed by Alex Christensen.
+
+        * platform/mac-wk1/TestExpectations:
+        * platform/wk2/storage/indexeddb/intversion-abort-in-initial-upgradeneeded-expected.txt: Copied from LayoutTests/storage/indexeddb/intversion-abort-in-initial-upgradeneeded-expected.txt.
+        * storage/indexeddb/intversion-abort-in-initial-upgradeneeded-expected.txt:
+        * storage/indexeddb/resources/intversion-abort-in-initial-upgradeneeded.js:
+
 2015-12-11  Jiewen Tan  <jiewen_...@apple.com>
 
         Do not fire load events from frames with scripting disabled

Modified: trunk/LayoutTests/platform/mac-wk1/TestExpectations (193969 => 193970)


--- trunk/LayoutTests/platform/mac-wk1/TestExpectations	2015-12-11 19:49:56 UTC (rev 193969)
+++ trunk/LayoutTests/platform/mac-wk1/TestExpectations	2015-12-11 19:56:18 UTC (rev 193970)
@@ -97,7 +97,6 @@
 storage/indexeddb/delete-closed-database-object.html [ Failure ]
 storage/indexeddb/index-basics.html [ Failure ]
 storage/indexeddb/index-duplicate-keypaths.html [ Failure ]
-storage/indexeddb/intversion-abort-in-initial-upgradeneeded.html [ Failure ]
 storage/indexeddb/intversion-close-in-oncomplete.html [ Failure ]
 storage/indexeddb/intversion-close-in-upgradeneeded.html [ Failure ]
 storage/indexeddb/intversion-gated-on-delete.html [ Failure ]

Copied: trunk/LayoutTests/platform/wk2/storage/indexeddb/intversion-abort-in-initial-upgradeneeded-expected.txt (from rev 193969, trunk/LayoutTests/storage/indexeddb/intversion-abort-in-initial-upgradeneeded-expected.txt) (0 => 193970)


--- trunk/LayoutTests/platform/wk2/storage/indexeddb/intversion-abort-in-initial-upgradeneeded-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/wk2/storage/indexeddb/intversion-abort-in-initial-upgradeneeded-expected.txt	2015-12-11 19:56:18 UTC (rev 193970)
@@ -0,0 +1,30 @@
+Test that an abort in the initial upgradeneeded sets version back to 0
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+indexedDB = self.indexedDB || self.webkitIndexedDB || self.mozIndexedDB || self.msIndexedDB || self.OIndexedDB;
+
+dbname = "intversion-abort-in-initial-upgradeneeded.html"
+indexedDB.deleteDatabase(dbname)
+indexedDB.open(dbname, 2)
+request._onupgradeneeded_ = upgradeNeeded
+request._onerror_ = onError
+
+upgradeNeeded():
+PASS db.version is 2
+transaction.abort()
+
+onAbort():
+PASS event.target.db.version is 0
+PASS request.transaction is non-null.
+
+onError():
+FAIL event.target.result should be undefined (of type undefined). Was [object IDBDatabase] (of type object).
+PASS request is event.target
+PASS event.target.error.name is "AbortError"
+PASS request.transaction is null
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Modified: trunk/LayoutTests/storage/indexeddb/intversion-abort-in-initial-upgradeneeded-expected.txt (193969 => 193970)


--- trunk/LayoutTests/storage/indexeddb/intversion-abort-in-initial-upgradeneeded-expected.txt	2015-12-11 19:49:56 UTC (rev 193969)
+++ trunk/LayoutTests/storage/indexeddb/intversion-abort-in-initial-upgradeneeded-expected.txt	2015-12-11 19:56:18 UTC (rev 193970)
@@ -20,10 +20,9 @@
 PASS request.transaction is non-null.
 
 onError():
-PASS db is event.target.result
+PASS event.target.result is undefined
 PASS request is event.target
 PASS event.target.error.name is "AbortError"
-PASS event.target.result.version is 0
 PASS request.transaction is null
 PASS successfullyParsed is true
 

Modified: trunk/LayoutTests/storage/indexeddb/resources/intversion-abort-in-initial-upgradeneeded.js (193969 => 193970)


--- trunk/LayoutTests/storage/indexeddb/resources/intversion-abort-in-initial-upgradeneeded.js	2015-12-11 19:49:56 UTC (rev 193969)
+++ trunk/LayoutTests/storage/indexeddb/resources/intversion-abort-in-initial-upgradeneeded.js	2015-12-11 19:56:18 UTC (rev 193970)
@@ -44,10 +44,9 @@
 function onError(evt)
 {
     preamble(evt);
-    shouldBe("db", "event.target.result");
+    shouldBe("event.target.result", "undefined");
     shouldBe("request", "event.target");
     shouldBeEqualToString("event.target.error.name", "AbortError");
-    shouldBe("event.target.result.version", "0");
     shouldBeNull("request.transaction");
     finishJSTest();
 }

Modified: trunk/Source/WebCore/ChangeLog (193969 => 193970)


--- trunk/Source/WebCore/ChangeLog	2015-12-11 19:49:56 UTC (rev 193969)
+++ trunk/Source/WebCore/ChangeLog	2015-12-11 19:56:18 UTC (rev 193970)
@@ -1,5 +1,31 @@
 2015-12-11  Brady Eidson  <beid...@apple.com>
 
+        Modern IDB: storage/indexeddb/intversion-abort-in-initial-upgradeneeded.html fails.
+        https://bugs.webkit.org/show_bug.cgi?id=152177
+
+        Reviewed by Alex Christensen.
+
+        No new tests (At least one failing test now passes).
+
+        * Modules/indexeddb/client/IDBOpenDBRequestImpl.cpp:
+        (WebCore::IDBClient::IDBOpenDBRequest::versionChangeTransactionDidFinish): Renamed from below.
+        (WebCore::IDBClient::IDBOpenDBRequest::versionChangeTransactionWillFinish): Deleted.
+        * Modules/indexeddb/client/IDBOpenDBRequestImpl.h:
+        
+        * Modules/indexeddb/client/IDBRequestImpl.cpp:
+        (WebCore::IDBClient::IDBRequest::setVersionChangeTransaction): OpenDBRequests usually don't have transactions, 
+          unless they end up being upgrade requests.
+        * Modules/indexeddb/client/IDBRequestImpl.h:
+        
+        * Modules/indexeddb/client/IDBTransactionImpl.cpp:
+        (WebCore::IDBClient::IDBTransaction::IDBTransaction): Call setVersionChangeTransaction on the request if appropriate.
+        (WebCore::IDBClient::IDBTransaction::dispatchEvent): Call versionChangeTransactionDidFinish after the 
+          abort/complete events fire.
+        (WebCore::IDBClient::IDBTransaction::abort): Deleted.
+        (WebCore::IDBClient::IDBTransaction::commit): Deleted.
+
+2015-12-11  Brady Eidson  <beid...@apple.com>
+
         Modern IDB: storage/indexeddb/index-count.html fails.
         https://bugs.webkit.org/show_bug.cgi?id=152175
 

Modified: trunk/Source/WebCore/Modules/indexeddb/client/IDBOpenDBRequestImpl.cpp (193969 => 193970)


--- trunk/Source/WebCore/Modules/indexeddb/client/IDBOpenDBRequestImpl.cpp	2015-12-11 19:49:56 UTC (rev 193969)
+++ trunk/Source/WebCore/Modules/indexeddb/client/IDBOpenDBRequestImpl.cpp	2015-12-11 19:56:18 UTC (rev 193970)
@@ -67,10 +67,10 @@
     enqueueEvent(Event::create(eventNames().errorEvent, true, true));
 }
 
-void IDBOpenDBRequest::versionChangeTransactionWillFinish()
+void IDBOpenDBRequest::versionChangeTransactionDidFinish()
 {
     // 3.3.7 "versionchange" transaction steps
-    // When the transaction is finished, immediately set request's transaction property to null.
+    // When the transaction is finished, after firing complete/abort on the transaction, immediately set request's transaction property to null.
     m_shouldExposeTransactionToDOM = false;
 }
 

Modified: trunk/Source/WebCore/Modules/indexeddb/client/IDBOpenDBRequestImpl.h (193969 => 193970)


--- trunk/Source/WebCore/Modules/indexeddb/client/IDBOpenDBRequestImpl.h	2015-12-11 19:49:56 UTC (rev 193969)
+++ trunk/Source/WebCore/Modules/indexeddb/client/IDBOpenDBRequestImpl.h	2015-12-11 19:56:18 UTC (rev 193970)
@@ -53,7 +53,7 @@
     void requestCompleted(const IDBResultData&);
     void requestBlocked(uint64_t oldVersion, uint64_t newVersion);
 
-    void versionChangeTransactionWillFinish();
+    void versionChangeTransactionDidFinish();
     void fireSuccessAfterVersionChangeCommit();
     void fireErrorAfterVersionChangeCompletion();
 

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


--- trunk/Source/WebCore/Modules/indexeddb/client/IDBRequestImpl.cpp	2015-12-11 19:49:56 UTC (rev 193969)
+++ trunk/Source/WebCore/Modules/indexeddb/client/IDBRequestImpl.cpp	2015-12-11 19:56:18 UTC (rev 193970)
@@ -155,6 +155,15 @@
     m_source = IDBAny::create(cursor);
 }
 
+void IDBRequest::setVersionChangeTransaction(IDBTransaction& transaction)
+{
+    ASSERT(!m_transaction);
+    ASSERT(transaction.isVersionChange());
+    ASSERT(!transaction.isFinishedOrFinishing());
+
+    m_transaction = &transaction;
+}
+
 RefPtr<WebCore::IDBTransaction> IDBRequest::transaction() const
 {
     return m_shouldExposeTransactionToDOM ? m_transaction : nullptr;

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


--- trunk/Source/WebCore/Modules/indexeddb/client/IDBRequestImpl.h	2015-12-11 19:49:56 UTC (rev 193969)
+++ trunk/Source/WebCore/Modules/indexeddb/client/IDBRequestImpl.h	2015-12-11 19:56:18 UTC (rev 193970)
@@ -98,6 +98,7 @@
     const IDBCursor* pendingCursor() const { return m_pendingCursor.get(); }
 
     void setSource(IDBCursor&);
+    void setVersionChangeTransaction(IDBTransaction&);
 
 protected:
     IDBRequest(IDBConnectionToServer&, ScriptExecutionContext*);

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


--- trunk/Source/WebCore/Modules/indexeddb/client/IDBTransactionImpl.cpp	2015-12-11 19:49:56 UTC (rev 193969)
+++ trunk/Source/WebCore/Modules/indexeddb/client/IDBTransactionImpl.cpp	2015-12-11 19:56:18 UTC (rev 193970)
@@ -71,6 +71,7 @@
 
     if (m_info.mode() == IndexedDB::TransactionMode::VersionChange) {
         ASSERT(m_openDBRequest);
+        m_openDBRequest->setVersionChangeTransaction(*this);
         m_startedOnServer = true;
     } else {
         activate();
@@ -190,9 +191,6 @@
     if (isVersionChange()) {
         for (auto& objectStore : m_referencedObjectStores.values())
             objectStore->rollbackInfoForVersionChangeAbort();
-
-        ASSERT(m_openDBRequest);
-        m_openDBRequest->versionChangeTransactionWillFinish();
     }
     
     m_abortQueue.swap(m_transactionOperationQueue);
@@ -309,11 +307,6 @@
     m_state = IndexedDB::TransactionState::Committing;
     m_database->willCommitTransaction(*this);
 
-    if (isVersionChange()) {
-        ASSERT(m_openDBRequest);
-        m_openDBRequest->versionChangeTransactionWillFinish();
-    }
-
     auto operation = createTransactionOperation(*this, nullptr, &IDBTransaction::commitOnServer);
     scheduleOperation(WTF::move(operation));
 }
@@ -425,13 +418,16 @@
 
     bool result = IDBEventDispatcher::dispatch(event, targets);
 
-    if (isVersionChange() && event.type() == eventNames().completeEvent) {
+    if (isVersionChange()) {
         ASSERT(m_openDBRequest);
+        m_openDBRequest->versionChangeTransactionDidFinish();
 
-        if (m_database->isClosingOrClosed())
-            m_openDBRequest->fireErrorAfterVersionChangeCompletion();
-        else
-            m_openDBRequest->fireSuccessAfterVersionChangeCommit();
+        if (event.type() == eventNames().completeEvent) {
+            if (m_database->isClosingOrClosed())
+                m_openDBRequest->fireErrorAfterVersionChangeCompletion();
+            else
+                m_openDBRequest->fireSuccessAfterVersionChangeCommit();
+        }
     }
 
     return result;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to