[SCM] WebKit Debian packaging branch, webkit-1.3, updated. upstream/1.3.7-4207-g178b198

jorlow at chromium.org jorlow at chromium.org
Mon Feb 21 00:02:23 UTC 2011


The following commit has been merged in the webkit-1.3 branch:
commit 9460e2b77de7b08f61d4701bb08c860f96644fdb
Author: jorlow at chromium.org <jorlow at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Jan 27 19:24:23 2011 +0000

    2011-01-27  David Grogan  <dgrogan at google.com>
    
            Reviewed by Jeremy Orlow.
    
            initial support for close() in indexeddb backend
            https://bugs.webkit.org/show_bug.cgi?id=53150
    
            * storage/indexeddb/transaction-after-close-expected.txt: Added.
            * storage/indexeddb/transaction-after-close.html: Added.
    2011-01-27  David Grogan  <dgrogan at google.com>
    
            Reviewed by Jeremy Orlow.
    
            initial support for close() in indexeddb backend
            https://bugs.webkit.org/show_bug.cgi?id=53150
    
            Test: storage/indexeddb/transaction-after-close.html
    
            * storage/IDBDatabase.cpp:
            (WebCore::IDBDatabase::IDBDatabase):
            (WebCore::IDBDatabase::transaction):
            (WebCore::IDBDatabase::close):
            * storage/IDBDatabase.h:
            * storage/IDBDatabase.idl:
            * storage/IDBDatabaseBackendImpl.cpp:
            (WebCore::IDBDatabaseBackendImpl::transaction):
            (WebCore::IDBDatabaseBackendImpl::close):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@76820 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 38671cd..a4a8e12 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,13 @@
+2011-01-27  David Grogan  <dgrogan at google.com>
+
+        Reviewed by Jeremy Orlow.
+
+        initial support for close() in indexeddb backend
+        https://bugs.webkit.org/show_bug.cgi?id=53150
+
+        * storage/indexeddb/transaction-after-close-expected.txt: Added.
+        * storage/indexeddb/transaction-after-close.html: Added.
+
 2011-01-27  Dirk Schulze  <krit at webkit.org>
 
         Reviewed by Nikolas Zimmermann.
diff --git a/LayoutTests/storage/indexeddb/transaction-after-close-expected.txt b/LayoutTests/storage/indexeddb/transaction-after-close-expected.txt
new file mode 100644
index 0000000..653bd87
--- /dev/null
+++ b/LayoutTests/storage/indexeddb/transaction-after-close-expected.txt
@@ -0,0 +1,95 @@
+Test closing a database connection in IndexedDB.
+
+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('some db name')
+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
+result = db.setVersion('version 1')
+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.
+store = db.createObjectStore('store')
+request = store.put('x', 'y')
+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
+
+running first transaction
+currentTransaction = db.transaction([], webkitIDBTransaction.READ_WRITE)
+objectStore.put('a', 'b')
+db.close()
+Expecting exception from db.transaction([], webkitIDBTransaction.READ_WRITE)
+PASS code is webkitIDBDatabaseException.NOT_ALLOWED_ERR
+
+verify that we can reopen the db after calling close
+webkitIndexedDB.open('some db name')
+PASS 'onsuccess' in result is true
+PASS 'onerror' in result is true
+PASS 'readyState' in result is true
+An event should fire shortly...
+
+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
+
+second_db = event.result
+currentTransaction = second_db.transaction([], webkitIDBTransaction.READ_WRITE)
+request = store.put('1', '2')
+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
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/storage/indexeddb/transaction-after-close.html b/LayoutTests/storage/indexeddb/transaction-after-close.html
new file mode 100644
index 0000000..718c05a
--- /dev/null
+++ b/LayoutTests/storage/indexeddb/transaction-after-close.html
@@ -0,0 +1,105 @@
+<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 closing a database connection in IndexedDB.");
+if (window.layoutTestController)
+    layoutTestController.waitUntilDone();
+
+function test()
+{
+    shouldBeTrue("'webkitIndexedDB' in window");
+    shouldBeFalse("webkitIndexedDB == null");
+
+    result = evalAndLog("webkitIndexedDB.open('some db name')");
+    verifyResult(result);
+    result.onsuccess = openSuccess;
+    result.onerror = unexpectedErrorCallback;
+}
+
+function openSuccess()
+{
+    debug("openSuccess():");
+    verifySuccessEvent(event);
+    window.db = evalAndLog("db = event.result");
+    result = evalAndLog("result = db.setVersion('version 1')");
+    result.onsuccess = inSetVersion;
+    result.onerror = unexpectedErrorCallback;
+}
+
+function inSetVersion()
+{
+    verifySuccessEvent(event);
+    deleteAllObjectStores(db, doSetVersionStuff);
+}
+
+function doSetVersionStuff()
+{
+    event.result.oncomplete = runFirstRegularTransaction;
+    event.result.onabort = unexpectedAbortCallback;
+    store = evalAndLog("store = db.createObjectStore('store')");
+    request = evalAndLog("request = store.put('x', 'y')");
+    request.onsuccess = onPutSuccess;
+    request.onerror = unexpectedErrorCallback;
+}
+
+function onPutSuccess()
+{
+    verifySuccessEvent(event);
+}
+
+function runFirstRegularTransaction()
+{
+    debug("running first transaction")
+    currentTransaction = evalAndLog("currentTransaction = db.transaction([], webkitIDBTransaction.READ_WRITE)");
+    currentTransaction.onabort = unexpectedAbortCallback;
+    currentTransaction.oncomplete = firstTransactionComplete;
+    objectStore = currentTransaction.objectStore('store');
+    result = evalAndLog("objectStore.put('a', 'b')");
+    result.onerror = unexpectedErrorCallback;
+}
+
+function firstTransactionComplete()
+{
+    evalAndLog("db.close()");
+    evalAndExpectException("db.transaction([], webkitIDBTransaction.READ_WRITE)", "webkitIDBDatabaseException.NOT_ALLOWED_ERR");
+
+    debug("")
+    debug("verify that we can reopen the db after calling close")
+    result = evalAndLog("webkitIndexedDB.open('some db name')");
+    verifyResult(result);
+    result.onsuccess = onSecondOpen
+    result.onerror = unexpectedErrorCallback;
+}
+
+function onSecondOpen() {
+    verifySuccessEvent(event);
+    second_db = evalAndLog("second_db = event.result");
+    currentTransaction = evalAndLog("currentTransaction = second_db.transaction([], webkitIDBTransaction.READ_WRITE)");
+    store = currentTransaction.objectStore('store');
+    request = evalAndLog("request = store.put('1', '2')");
+    request.onsuccess = onFinalPutSuccess;
+    request.onerror = unexpectedErrorCallback;
+    currentTransaction.oncomplete = done;
+    currentTransaction.onabort = unexpectedAbortCallback;
+}
+
+function onFinalPutSuccess() {
+    verifySuccessEvent(event);
+}
+
+var successfullyParsed = true;
+
+test();
+
+</script>
+</body>
+</html>
diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog
index cb0e415..c13e311 100644
--- a/Source/WebCore/ChangeLog
+++ b/Source/WebCore/ChangeLog
@@ -1,3 +1,22 @@
+2011-01-27  David Grogan  <dgrogan at google.com>
+
+        Reviewed by Jeremy Orlow.
+
+        initial support for close() in indexeddb backend
+        https://bugs.webkit.org/show_bug.cgi?id=53150
+
+        Test: storage/indexeddb/transaction-after-close.html
+
+        * storage/IDBDatabase.cpp:
+        (WebCore::IDBDatabase::IDBDatabase):
+        (WebCore::IDBDatabase::transaction):
+        (WebCore::IDBDatabase::close):
+        * storage/IDBDatabase.h:
+        * storage/IDBDatabase.idl:
+        * storage/IDBDatabaseBackendImpl.cpp:
+        (WebCore::IDBDatabaseBackendImpl::transaction):
+        (WebCore::IDBDatabaseBackendImpl::close):
+
 2011-01-27  Dirk Schulze  <krit at webkit.org>
 
         Reviewed by Nikolas Zimmermann.
diff --git a/Source/WebCore/storage/IDBDatabase.cpp b/Source/WebCore/storage/IDBDatabase.cpp
index a82565f..cce3054 100644
--- a/Source/WebCore/storage/IDBDatabase.cpp
+++ b/Source/WebCore/storage/IDBDatabase.cpp
@@ -46,6 +46,7 @@ const unsigned long defaultTimeout = 0; // Infinite.
 
 IDBDatabase::IDBDatabase(PassRefPtr<IDBDatabaseBackendInterface> backend)
     : m_backend(backend)
+    , m_noNewTransactions(false)
 {
     // We pass a reference of this object before it can be adopted.
     relaxAdoptionRequirement();
@@ -109,6 +110,10 @@ PassRefPtr<IDBTransaction> IDBDatabase::transaction(ScriptExecutionContext* cont
         ec = IDBDatabaseException::CONSTRAINT_ERR;
         return 0;
     }
+    if (m_noNewTransactions) {
+        ec = IDBDatabaseException::NOT_ALLOWED_ERR;
+        return 0;
+    }
 
     // We need to create a new transaction synchronously. Locks are acquired asynchronously. Operations
     // can be queued against the transaction at any point. They will start executing as soon as the
@@ -126,7 +131,7 @@ PassRefPtr<IDBTransaction> IDBDatabase::transaction(ScriptExecutionContext* cont
 
 void IDBDatabase::close()
 {
-    m_backend->close();
+    m_noNewTransactions = true;
 }
 
 } // namespace WebCore
diff --git a/Source/WebCore/storage/IDBDatabase.h b/Source/WebCore/storage/IDBDatabase.h
index 8720036..a80d5a2 100644
--- a/Source/WebCore/storage/IDBDatabase.h
+++ b/Source/WebCore/storage/IDBDatabase.h
@@ -76,6 +76,8 @@ private:
 
     RefPtr<IDBDatabaseBackendInterface> m_backend;
     RefPtr<IDBTransactionBackendInterface> m_setVersionTransaction;
+
+    bool m_noNewTransactions;
 };
 
 } // namespace WebCore
diff --git a/Source/WebCore/storage/IDBDatabase.idl b/Source/WebCore/storage/IDBDatabase.idl
index e3b7508..4e40a10 100644
--- a/Source/WebCore/storage/IDBDatabase.idl
+++ b/Source/WebCore/storage/IDBDatabase.idl
@@ -40,8 +40,7 @@ module storage {
             raises (IDBDatabaseException);
         [CallWith=ScriptExecutionContext] IDBTransaction transaction(in [Optional] DOMStringList storeNames, in [Optional] unsigned short mode, in [Optional] unsigned long timeout)
             raises (IDBDatabaseException);
-        // FIXME: Implement.
-        //void close();
+        void close();
     };
 
 }

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list