haikuwebkit/ManualTests/indexeddb-persists.html

70 lines
2.3 KiB
HTML
Raw Permalink Normal View History

2010-10-26 Jeremy Orlow <jorlow@chromium.org> Reviewed by Steve Block. Quota for IndexedDB should be per origin not per database https://bugs.webkit.org/show_bug.cgi?id=48064 Verify our backing database can handle multiple indexes, objectStores, items in the index/object stores, etc within databases of different names. Also adjust the quota test so it doesn't fail with subtle differences in the backing db (which can change the size a bit). * storage/indexeddb/database-quota-expected.txt: * storage/indexeddb/database-quota.html: * storage/indexeddb/duplicates-expected.txt: Added. * storage/indexeddb/duplicates.html: Added. 2010-10-26 Jeremy Orlow <jorlow@chromium.org> Reviewed by Steve Block. Quota for IndexedDB should be per origin not per database https://bugs.webkit.org/show_bug.cgi?id=48064 Merge all databases for each origin into a single SQLiteDatabase. Replace the awkward metaData table with a Database table. Create a new IDBSQLiteDatabase class that wraps SQLiteDatabase and implements weak pointer semantics for IDBFactory. It's ref counted so multiple IDBDatabaseBackendImpls can share one. Fix uniqueness constraints that were overly conservitive. Get rid of the code that blows away existing data every time the database is opened. Get rid of the fairly useless indexedDB manual test and replace it with one that verifies data persists. Use name+origin (not just name) in our cache of IDBDatabaseBackend objects (so one origin can't access anothers' data). Test: storage/indexeddb/duplicates.html * WebCore.gypi: * manual-tests/indexed-database.html: Removed. * manual-tests/indexeddb-persists.html: Added. * storage/IDBDatabaseBackendImpl.cpp: (WebCore::extractMetaData): (WebCore::setMetaData): (WebCore::IDBDatabaseBackendImpl::IDBDatabaseBackendImpl): (WebCore::IDBDatabaseBackendImpl::setDescription): (WebCore::IDBDatabaseBackendImpl::sqliteDatabase): (WebCore::IDBDatabaseBackendImpl::createObjectStoreInternal): (WebCore::IDBDatabaseBackendImpl::setVersionInternal): (WebCore::IDBDatabaseBackendImpl::loadObjectStores): * storage/IDBDatabaseBackendImpl.h: (WebCore::IDBDatabaseBackendImpl::create): (WebCore::IDBDatabaseBackendImpl::id): * storage/IDBFactoryBackendImpl.cpp: (WebCore::IDBFactoryBackendImpl::removeSQLiteDatabase): (WebCore::openSQLiteDatabase): (WebCore::createTables): (WebCore::IDBFactoryBackendImpl::open): (WebCore::IDBFactoryBackendImpl::databaseFileName): * storage/IDBFactoryBackendImpl.h: * storage/IDBObjectStoreBackendImpl.cpp: (WebCore::putObjectStoreData): (WebCore::IDBObjectStoreBackendImpl::putInternal): * storage/IDBSQLiteDatabase.cpp: Added. (WebCore::IDBSQLiteDatabase::IDBSQLiteDatabase): (WebCore::IDBSQLiteDatabase::~IDBSQLiteDatabase): * storage/IDBSQLiteDatabase.h: Added. (WebCore::IDBSQLiteDatabase::create): (WebCore::IDBSQLiteDatabase::db): 2010-10-26 Jeremy Orlow <jorlow@chromium.org> Reviewed by Steve Block. Quota for IndexedDB should be per origin not per database https://bugs.webkit.org/show_bug.cgi?id=48064 * public/WebIDBFactory.h: * public/WebSecurityOrigin.h: * src/WebIDBFactory.cpp: (WebKit::WebIDBFactory::databaseFileName): * src/WebSecurityOrigin.cpp: (WebKit::WebSecurityOrigin::get): Canonical link: https://commits.webkit.org/61056@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@70522 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2010-10-26 15:21:32 +00:00
<html>
<body>
<p>This is a test that only applies to IndexedDB. <span id=enabled>Our test for whether you have it enabled seems to have failed.</span></p>
<p>Please follow these steps in order:</p>
<p>First, click <a href="javascript: setData()">here</a> to open a database and set some data within it.</p>
<p>Next, close the browser and then re-open this page.</p>
<p>Lastly, click <a href="javascript: verifyData()">here</a> to verify the data was there</p>
<p>Status: <span id=status>...</span></p>
<script>
if (!('webkitIndexedDB' in window))
document.getElementById("enabled").innerHTML = "<font color=red>Your build does NOT seem to have it enabled. So all code on this page is disabled.</font>";
else
document.getElementById("enabled").innerHTML = "<font color=green>Your build seems to have it enabled.</font>";
function status(str, color)
{
if (color)
str = "<font color='" + color + "'>" + str + "</font>";
document.getElementById("status").innerHTML = str;
}
function setData()
{
status("Something must have gone wrong (or we're still working)...", "red");
webkitIndexedDB.open("someDB", "some description").onsuccess = function() {
event.result.setVersion("some version").onsuccess = function() {
var db = event.source;
2010-11-26 Hans Wennborg <hans@chromium.org> Reviewed by Jeremy Orlow. IndexedDB: Rename IDBDatabase.objectStores to objectStoreNames https://bugs.webkit.org/show_bug.cgi?id=50102 Update layout tests to use the new name. * storage/indexeddb/database-basics-expected.txt: * storage/indexeddb/database-basics.html: * storage/indexeddb/database-quota-expected.txt: * storage/indexeddb/database-quota.html: * storage/indexeddb/objectstore-basics-expected.txt: * storage/indexeddb/objectstore-basics.html: * storage/indexeddb/resources/shared.js: (deleteAllObjectStores): * storage/indexeddb/transaction-basics-expected.txt: * storage/indexeddb/transaction-basics.html: * storage/indexeddb/tutorial.html: 2010-11-26 Hans Wennborg <hans@chromium.org> Reviewed by Jeremy Orlow. IndexedDB: Rename IDBDatabase.objectStores to objectStoreNames https://bugs.webkit.org/show_bug.cgi?id=50102 Rename as per the spec: http://dvcs.w3.org/hg/IndexedDB/raw-file/tip/Overview.html#database-interface * manual-tests/indexeddb-persists.html: * storage/IDBDatabase.h: (WebCore::IDBDatabase::objectStoreNames): * storage/IDBDatabase.idl: * storage/IDBDatabaseBackendImpl.cpp: (WebCore::IDBDatabaseBackendImpl::objectStoreNames): (WebCore::IDBDatabaseBackendImpl::setVersion): (WebCore::IDBDatabaseBackendImpl::transaction): * storage/IDBDatabaseBackendImpl.h: * storage/IDBDatabaseBackendInterface.h: 2010-11-26 Hans Wennborg <hans@chromium.org> Reviewed by Jeremy Orlow. IndexedDB: Rename IDBDatabase.objectStores to objectStoreNames https://bugs.webkit.org/show_bug.cgi?id=50102 Rename as per the spec: http://dvcs.w3.org/hg/IndexedDB/raw-file/tip/Overview.html#database-interface * public/WebIDBDatabase.h: (WebKit::WebIDBDatabase::objectStores): (WebKit::WebIDBDatabase::objectStoreNames): * src/IDBDatabaseProxy.cpp: (WebCore::IDBDatabaseProxy::objectStoreNames): * src/IDBDatabaseProxy.h: * src/WebIDBDatabaseImpl.cpp: (WebKit::WebIDBDatabaseImpl::objectStoreNames): * src/WebIDBDatabaseImpl.h: Canonical link: https://commits.webkit.org/63213@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@72754 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2010-11-26 11:03:59 +00:00
while (db.objectStoreNames.length)
db.removeObjectStore(db.objectStoreNames[0]);
2010-10-26 Jeremy Orlow <jorlow@chromium.org> Reviewed by Steve Block. Quota for IndexedDB should be per origin not per database https://bugs.webkit.org/show_bug.cgi?id=48064 Verify our backing database can handle multiple indexes, objectStores, items in the index/object stores, etc within databases of different names. Also adjust the quota test so it doesn't fail with subtle differences in the backing db (which can change the size a bit). * storage/indexeddb/database-quota-expected.txt: * storage/indexeddb/database-quota.html: * storage/indexeddb/duplicates-expected.txt: Added. * storage/indexeddb/duplicates.html: Added. 2010-10-26 Jeremy Orlow <jorlow@chromium.org> Reviewed by Steve Block. Quota for IndexedDB should be per origin not per database https://bugs.webkit.org/show_bug.cgi?id=48064 Merge all databases for each origin into a single SQLiteDatabase. Replace the awkward metaData table with a Database table. Create a new IDBSQLiteDatabase class that wraps SQLiteDatabase and implements weak pointer semantics for IDBFactory. It's ref counted so multiple IDBDatabaseBackendImpls can share one. Fix uniqueness constraints that were overly conservitive. Get rid of the code that blows away existing data every time the database is opened. Get rid of the fairly useless indexedDB manual test and replace it with one that verifies data persists. Use name+origin (not just name) in our cache of IDBDatabaseBackend objects (so one origin can't access anothers' data). Test: storage/indexeddb/duplicates.html * WebCore.gypi: * manual-tests/indexed-database.html: Removed. * manual-tests/indexeddb-persists.html: Added. * storage/IDBDatabaseBackendImpl.cpp: (WebCore::extractMetaData): (WebCore::setMetaData): (WebCore::IDBDatabaseBackendImpl::IDBDatabaseBackendImpl): (WebCore::IDBDatabaseBackendImpl::setDescription): (WebCore::IDBDatabaseBackendImpl::sqliteDatabase): (WebCore::IDBDatabaseBackendImpl::createObjectStoreInternal): (WebCore::IDBDatabaseBackendImpl::setVersionInternal): (WebCore::IDBDatabaseBackendImpl::loadObjectStores): * storage/IDBDatabaseBackendImpl.h: (WebCore::IDBDatabaseBackendImpl::create): (WebCore::IDBDatabaseBackendImpl::id): * storage/IDBFactoryBackendImpl.cpp: (WebCore::IDBFactoryBackendImpl::removeSQLiteDatabase): (WebCore::openSQLiteDatabase): (WebCore::createTables): (WebCore::IDBFactoryBackendImpl::open): (WebCore::IDBFactoryBackendImpl::databaseFileName): * storage/IDBFactoryBackendImpl.h: * storage/IDBObjectStoreBackendImpl.cpp: (WebCore::putObjectStoreData): (WebCore::IDBObjectStoreBackendImpl::putInternal): * storage/IDBSQLiteDatabase.cpp: Added. (WebCore::IDBSQLiteDatabase::IDBSQLiteDatabase): (WebCore::IDBSQLiteDatabase::~IDBSQLiteDatabase): * storage/IDBSQLiteDatabase.h: Added. (WebCore::IDBSQLiteDatabase::create): (WebCore::IDBSQLiteDatabase::db): 2010-10-26 Jeremy Orlow <jorlow@chromium.org> Reviewed by Steve Block. Quota for IndexedDB should be per origin not per database https://bugs.webkit.org/show_bug.cgi?id=48064 * public/WebIDBFactory.h: * public/WebSecurityOrigin.h: * src/WebIDBFactory.cpp: (WebKit::WebIDBFactory::databaseFileName): * src/WebSecurityOrigin.cpp: (WebKit::WebSecurityOrigin::get): Canonical link: https://commits.webkit.org/61056@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@70522 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2010-10-26 15:21:32 +00:00
db.createObjectStore("test").put("value", "key").onsuccess = function() {
status("Value set", "green");
}
}
}
}
function verifyData()
{
status("Something must have gone wrong (or we're still working)...", "red");
webkitIndexedDB.open("someDB", "some description").onsuccess = function() {
try {
var result = event.result.transaction([]).objectStore("test").get("key");
result.onsuccess = function() {
if (event.result == "value")
status("Value verified", "green");
else
status("Value incorrect!", "red");
}
result.onerror = function() {
status("An error occurred: " + event.code + " " + event.message, "red");
}
} catch (e) {
status("An exception occurred: " + e, "red");
}
}
}
</script>
</body>
</html>