-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Modern IDB: After versionchange transactions complete, fire onsuccess…
… on the original IDBOpenDBRequest https://bugs.webkit.org/show_bug.cgi?id=151522 Reviewed by Alex Christensen. Source/WebCore: Test: storage/indexeddb/modern/opendatabase-success-after-versionchange.html (And changes to other existing tests) * Modules/indexeddb/client/IDBDatabaseImpl.cpp: (WebCore::IDBClient::IDBDatabase::startVersionChangeTransaction): * Modules/indexeddb/client/IDBDatabaseImpl.h: * Modules/indexeddb/client/IDBOpenDBRequestImpl.cpp: (WebCore::IDBClient::IDBOpenDBRequest::fireSuccessAfterVersionChangeCommit): (WebCore::IDBClient::IDBOpenDBRequest::onUpgradeNeeded): * Modules/indexeddb/client/IDBOpenDBRequestImpl.h: * Modules/indexeddb/client/IDBTransactionImpl.cpp: (WebCore::IDBClient::IDBTransaction::create): (WebCore::IDBClient::IDBTransaction::IDBTransaction): (WebCore::IDBClient::IDBTransaction::dispatchEvent): * Modules/indexeddb/client/IDBTransactionImpl.h: LayoutTests: * storage/indexeddb/modern/deletedatabase-1-expected.txt: * storage/indexeddb/modern/deletedatabase-1.html: * storage/indexeddb/modern/deletedatabase-2-expected.txt: * storage/indexeddb/modern/deletedatabase-2.html: * storage/indexeddb/modern/opendatabase-success-after-versionchange-expected.txt: Added. * storage/indexeddb/modern/opendatabase-success-after-versionchange.html: Added. * storage/indexeddb/modern/opendatabase-versions-expected.txt: * storage/indexeddb/modern/opendatabase-versions.html: * storage/indexeddb/modern/versionchange-event-expected.txt: * storage/indexeddb/modern/versionchange-event.html: Canonical link: https://commits.webkit.org/169682@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@192720 268f45cc-cd09-0410-ab3c-d52691b4dbfc
- Loading branch information
Showing
18 changed files
with
163 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
LayoutTests/storage/indexeddb/modern/opendatabase-success-after-versionchange-expected.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
This test verifies that: | ||
- Opening a new database results in the onupgradeneeded handler being called on the IDBOpenDBRequest. | ||
- The versionchange transaction representing the upgrade commits successfully. | ||
- After that transaction commits, the onsuccess handler on the original IDBOpenDBRequest is called. | ||
upgradeneeded: old version - 0 new version - 1 | ||
[object IDBTransaction] | ||
Version change complete | ||
Got the onsuccess handler as expected. | ||
Done | ||
|
61 changes: 61 additions & 0 deletions
61
LayoutTests/storage/indexeddb/modern/opendatabase-success-after-versionchange.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
This test verifies that:<br> | ||
- Opening a new database results in the onupgradeneeded handler being called on the IDBOpenDBRequest.<br> | ||
- The versionchange transaction representing the upgrade commits successfully.<br> | ||
- After that transaction commits, the onsuccess handler on the original IDBOpenDBRequest is called.<br> | ||
<div id="logger"></div> | ||
<script> | ||
|
||
if (window.testRunner) { | ||
testRunner.waitUntilDone(); | ||
testRunner.dumpAsText(); | ||
} | ||
|
||
function done() | ||
{ | ||
log("Done"); | ||
if (window.testRunner) | ||
testRunner.notifyDone(); | ||
} | ||
|
||
function log(message) | ||
{ | ||
document.getElementById("logger").innerHTML += message + "<br>"; | ||
} | ||
|
||
var request = window.indexedDB.open("OpenDatabaseSuccessAfterVersionChangeDatabase"); | ||
|
||
request.onsuccess = function() | ||
{ | ||
log("Got the onsuccess handler as expected."); | ||
done(); | ||
} | ||
request.onerror = function(e) | ||
{ | ||
log("Unexpected onerror handler called"); | ||
done(); | ||
} | ||
|
||
request.onupgradeneeded = function(e) | ||
{ | ||
log("upgradeneeded: old version - " + e.oldVersion + " new version - " + e.newVersion); | ||
log(request.transaction); | ||
|
||
request.transaction.oncomplete = function() | ||
{ | ||
log("Version change complete"); | ||
} | ||
|
||
request.transaction.onabort = function() | ||
{ | ||
log("Version change unexpected abort"); | ||
done(); | ||
} | ||
|
||
request.transaction.onerror = function() | ||
{ | ||
log("Version change unexpected error"); | ||
done(); | ||
} | ||
} | ||
|
||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
LayoutTests/storage/indexeddb/modern/versionchange-event-expected.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters