[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

jorlow at chromium.org jorlow at chromium.org
Wed Dec 22 16:29:31 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit f532b93debadcb206a26e5a915f18bdc5c542856
Author: jorlow at chromium.org <jorlow at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Nov 24 17:57:30 2010 +0000

    2010-11-23  Jeremy Orlow  <jorlow at chromium.org>
    
            Reviewed by Steve Block.
    
            Fix minor errors in IndexedDB
            https://bugs.webkit.org/show_bug.cgi?id=49970
    
            * storage/indexeddb/constants-expected.txt:
            * storage/indexeddb/constants.html:
            * storage/indexeddb/createAndRemoveObjectStore-expected.txt: Added.
            * storage/indexeddb/createAndRemoveObjectStore.html: Added.
    2010-11-23  Jeremy Orlow  <jorlow at chromium.org>
    
            Reviewed by Steve Block.
    
            Fix minor errors in IndexedDB
            https://bugs.webkit.org/show_bug.cgi?id=49970
    
            * Remove SNAPSHOT_READ per spec.
            * Assert that the transaction that changes the db is a setVersion
              transaction.
            * When an objectStore already exists, throw a CONSTRAINT_ERR.
            * When not in a setVersion transaction, throw a NOT_ALLOWED_ERR.
    
            Test: storage/indexeddb/createAndRemoveObjectStore.html
    
            * storage/IDBDatabase.cpp:
            (WebCore::IDBDatabase::createObjectStore):
            * storage/IDBDatabaseBackendImpl.cpp:
            (WebCore::IDBDatabaseBackendImpl::createObjectStore):
            * storage/IDBTransaction.h:
            * storage/IDBTransaction.idl:
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@72682 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index eedd68d..6b5f759 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,15 @@
+2010-11-23  Jeremy Orlow  <jorlow at chromium.org>
+
+        Reviewed by Steve Block.
+
+        Fix minor errors in IndexedDB
+        https://bugs.webkit.org/show_bug.cgi?id=49970
+
+        * storage/indexeddb/constants-expected.txt:
+        * storage/indexeddb/constants.html:
+        * storage/indexeddb/createAndRemoveObjectStore-expected.txt: Added.
+        * storage/indexeddb/createAndRemoveObjectStore.html: Added.
+
 2010-11-24  Alejandro G. Castro  <alex at igalia.com>
 
         Unreviewed, skip mathml/presentation again, apparently the issue
diff --git a/LayoutTests/storage/indexeddb/constants-expected.txt b/LayoutTests/storage/indexeddb/constants-expected.txt
index 8f53b56..01b8fa1 100644
--- a/LayoutTests/storage/indexeddb/constants-expected.txt
+++ b/LayoutTests/storage/indexeddb/constants-expected.txt
@@ -27,8 +27,7 @@ PASS webkitIDBCursor.PREV is 2
 PASS webkitIDBCursor.PREV_NO_DUPLICATE is 3
 PASS webkitIDBTransaction.READ_WRITE is 0
 PASS webkitIDBTransaction.READ_ONLY is 1
-PASS webkitIDBTransaction.SNAPSHOT_READ is 2
-PASS webkitIDBTransaction.VERSION_CHANGE is 3
+PASS webkitIDBTransaction.VERSION_CHANGE is 2
 PASS successfullyParsed is true
 
 TEST COMPLETE
diff --git a/LayoutTests/storage/indexeddb/constants.html b/LayoutTests/storage/indexeddb/constants.html
index 9cdf4c4..542ed32 100644
--- a/LayoutTests/storage/indexeddb/constants.html
+++ b/LayoutTests/storage/indexeddb/constants.html
@@ -44,8 +44,7 @@ function test()
 
     shouldBe("webkitIDBTransaction.READ_WRITE", "0");
     shouldBe("webkitIDBTransaction.READ_ONLY", "1");
-    shouldBe("webkitIDBTransaction.SNAPSHOT_READ", "2");
-    shouldBe("webkitIDBTransaction.VERSION_CHANGE", "3");
+    shouldBe("webkitIDBTransaction.VERSION_CHANGE", "2");
 }
 
 test();
diff --git a/LayoutTests/storage/indexeddb/createAndRemoveObjectStore-expected.txt b/LayoutTests/storage/indexeddb/createAndRemoveObjectStore-expected.txt
new file mode 100644
index 0000000..90bb974
--- /dev/null
+++ b/LayoutTests/storage/indexeddb/createAndRemoveObjectStore-expected.txt
@@ -0,0 +1,60 @@
+Test IndexedDB's create and removeObjectStore
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS 'webkitIndexedDB' in window is true
+PASS webkitIndexedDB == null is false
+webkitIndexedDB.open('name', 'description')
+PASS 'onsuccess' in result is true
+PASS 'onerror' in result is true
+PASS 'readyState' in result is true
+An event should fire shortly...
+
+openSuccess():
+Success event fired:
+PASS 'result' in event is true
+PASS 'code' in event is false
+PASS 'message' in event is false
+PASS 'source' in event is true
+PASS event.source != null is true
+PASS 'onsuccess' in event.target is true
+PASS 'onerror' in event.target is true
+PASS 'readyState' in event.target is true
+PASS event.target.readyState is event.target.DONE
+
+db = event.result
+Trying create
+PASS code is webkitIDBDatabaseException.NOT_ALLOWED_ERR
+Trying remove
+PASS code is webkitIDBDatabaseException.NOT_ALLOWED_ERR
+result = db.setVersion('version 1')
+Trying create
+PASS code is webkitIDBDatabaseException.NOT_ALLOWED_ERR
+Trying remove
+PASS code is webkitIDBDatabaseException.NOT_ALLOWED_ERR
+Success event fired:
+PASS 'result' in event is true
+PASS 'code' in event is false
+PASS 'message' in event is false
+PASS 'source' in event is true
+PASS event.source != null is true
+PASS 'onsuccess' in event.target is true
+PASS 'onerror' in event.target is true
+PASS 'readyState' in event.target is true
+PASS event.target.readyState is event.target.DONE
+
+Deleted all object stores.
+db.createObjectStore('tmp')
+Adding 'tmp' again
+PASS code is webkitIDBDatabaseException.CONSTRAINT_ERR
+trans = db.transaction([], webkitIDBTransaction.READ_WRITE)
+trans.objectStore('tmp').get(0)
+Trying create
+PASS code is webkitIDBDatabaseException.NOT_ALLOWED_ERR
+Trying remove
+PASS code is webkitIDBDatabaseException.NOT_ALLOWED_ERR
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/storage/indexeddb/createAndRemoveObjectStore.html b/LayoutTests/storage/indexeddb/createAndRemoveObjectStore.html
new file mode 100644
index 0000000..e05ea6e
--- /dev/null
+++ b/LayoutTests/storage/indexeddb/createAndRemoveObjectStore.html
@@ -0,0 +1,96 @@
+<html>
+<head>
+<link rel="stylesheet" href="../../fast/js/resources/js-test-style.css">
+<script src="../../fast/js/resources/js-test-pre.js"></script>
+<script src="../../fast/js/resources/js-test-post-function.js"></script>
+<script src="resources/shared.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script>
+
+description("Test IndexedDB's create and removeObjectStore");
+if (window.layoutTestController)
+    layoutTestController.waitUntilDone();
+
+function test()
+{
+    shouldBeTrue("'webkitIndexedDB' in window");
+    shouldBeFalse("webkitIndexedDB == null");
+
+    result = evalAndLog("webkitIndexedDB.open('name', 'description')");
+    verifyResult(result);
+    result.onsuccess = openSuccess;
+    result.onerror = unexpectedErrorCallback;
+}
+
+function openSuccess()
+{
+    debug("openSuccess():");
+    verifySuccessEvent(event);
+    window.db = evalAndLog("db = event.result");
+    testCreateAndRemove();
+    result = evalAndLog("result = db.setVersion('version 1')");
+    result.onsuccess = cleanDatabase;
+    result.onerror = unexpectedErrorCallback;
+    testCreateAndRemove();
+}
+
+function testCreateAndRemove()
+{
+    debug("Trying create");
+    try {
+        db.createObjectStore("some os");
+        testFailed("No exception thrown!");
+    } catch (e) {
+        code = e.code;
+        shouldBe("code", "webkitIDBDatabaseException.NOT_ALLOWED_ERR");
+    }
+    debug("Trying remove");
+    try {
+        db.createObjectStore("some os");
+        testFailed("No exception thrown!");
+    } catch (e) {
+        code = e.code;
+        shouldBe("code", "webkitIDBDatabaseException.NOT_ALLOWED_ERR");
+    }
+}
+
+function cleanDatabase()
+{
+    verifySuccessEvent(event);
+    deleteAllObjectStores(db, cleaned);
+}
+
+function cleaned()
+{
+    os = evalAndLog("db.createObjectStore('tmp')");
+    debug("Adding 'tmp' again");
+    try {
+        db.createObjectStore('tmp');
+        testFailed("No exception thrown!");
+    } catch (e) {
+        code = e.code;
+        shouldBe("code", "webkitIDBDatabaseException.CONSTRAINT_ERR");
+    }
+    trans = evalAndLog("trans = db.transaction([], webkitIDBTransaction.READ_WRITE)");
+    req = evalAndLog("trans.objectStore('tmp').get(0)");
+    req.onsuccess = unexpectedSuccessCallback;
+    req.onerror = tryOnceMore;
+}
+
+function tryOnceMore()
+{
+    testCreateAndRemove();
+
+    done();
+}
+
+var successfullyParsed = true;
+
+test();
+
+</script>
+</body>
+</html>
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 3ea21ac..d76f0c8 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,25 @@
+2010-11-23  Jeremy Orlow  <jorlow at chromium.org>
+
+        Reviewed by Steve Block.
+
+        Fix minor errors in IndexedDB
+        https://bugs.webkit.org/show_bug.cgi?id=49970
+
+        * Remove SNAPSHOT_READ per spec.
+        * Assert that the transaction that changes the db is a setVersion
+          transaction.
+        * When an objectStore already exists, throw a CONSTRAINT_ERR.
+        * When not in a setVersion transaction, throw a NOT_ALLOWED_ERR.
+
+        Test: storage/indexeddb/createAndRemoveObjectStore.html
+
+        * storage/IDBDatabase.cpp:
+        (WebCore::IDBDatabase::createObjectStore):
+        * storage/IDBDatabaseBackendImpl.cpp:
+        (WebCore::IDBDatabaseBackendImpl::createObjectStore):
+        * storage/IDBTransaction.h:
+        * storage/IDBTransaction.idl:
+
 2010-11-24  Philippe Normand  <pnormand at igalia.com>
 
         Reviewed by Xan Lopez.
diff --git a/WebCore/storage/IDBDatabase.cpp b/WebCore/storage/IDBDatabase.cpp
index 1ee0fa9..1536ba7 100644
--- a/WebCore/storage/IDBDatabase.cpp
+++ b/WebCore/storage/IDBDatabase.cpp
@@ -64,8 +64,10 @@ PassRefPtr<IDBObjectStore> IDBDatabase::createObjectStore(const String& name, co
     }
 
     RefPtr<IDBObjectStoreBackendInterface> objectStore = m_backend->createObjectStore(name, keyPath, autoIncrement, m_setVersionTransaction.get(), ec);
-    if (!objectStore)
+    if (!objectStore) {
+        // FIXME: ASSERT(ec) once UNKNOWN_ERR is not 0.
         return 0;
+    }
     return IDBObjectStore::create(objectStore.release(), m_setVersionTransaction.get());
 }
 
diff --git a/WebCore/storage/IDBDatabaseBackendImpl.cpp b/WebCore/storage/IDBDatabaseBackendImpl.cpp
index 004dc7b..2681900 100644
--- a/WebCore/storage/IDBDatabaseBackendImpl.cpp
+++ b/WebCore/storage/IDBDatabaseBackendImpl.cpp
@@ -138,8 +138,10 @@ PassRefPtr<DOMStringList> IDBDatabaseBackendImpl::objectStores() const
 
 PassRefPtr<IDBObjectStoreBackendInterface>  IDBDatabaseBackendImpl::createObjectStore(const String& name, const String& keyPath, bool autoIncrement, IDBTransactionBackendInterface* transactionPtr, ExceptionCode& ec)
 {
+    ASSERT(transactionPtr->mode() == IDBTransaction::VERSION_CHANGE);
+
     if (m_objectStores.contains(name)) {
-        // FIXME: Throw CONSTRAINT_ERR in this case.
+        ec = IDBDatabaseException::CONSTRAINT_ERR;
         return 0;
     }
 
@@ -150,6 +152,7 @@ PassRefPtr<IDBObjectStoreBackendInterface>  IDBDatabaseBackendImpl::createObject
     RefPtr<IDBTransactionBackendInterface> transaction = transactionPtr;
     if (!transaction->scheduleTask(createCallbackTask(&IDBDatabaseBackendImpl::createObjectStoreInternal, database, objectStore, transaction),
                                    createCallbackTask(&IDBDatabaseBackendImpl::removeObjectStoreFromMap, database, objectStore))) {
+        ec = IDBDatabaseException::NOT_ALLOWED_ERR;
         return 0;
     }
 
diff --git a/WebCore/storage/IDBTransaction.h b/WebCore/storage/IDBTransaction.h
index 8db5205..d0a9f0f 100644
--- a/WebCore/storage/IDBTransaction.h
+++ b/WebCore/storage/IDBTransaction.h
@@ -54,8 +54,7 @@ public:
     enum Mode {
         READ_WRITE = 0,
         READ_ONLY = 1,
-        SNAPSHOT_READ = 2,
-        VERSION_CHANGE = 3
+        VERSION_CHANGE = 2
     };
 
     unsigned short mode() const;
diff --git a/WebCore/storage/IDBTransaction.idl b/WebCore/storage/IDBTransaction.idl
index cdf9f63..b57ac4a 100644
--- a/WebCore/storage/IDBTransaction.idl
+++ b/WebCore/storage/IDBTransaction.idl
@@ -32,8 +32,7 @@ module storage {
         // Modes
         const unsigned short READ_WRITE = 0;
         const unsigned short READ_ONLY = 1;
-        const unsigned short SNAPSHOT_READ = 2;
-        const unsigned short VERSION_CHANGE = 3;
+        const unsigned short VERSION_CHANGE = 2;
 
         // Properties
         readonly attribute unsigned short mode;

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list