Title: [91309] trunk
Revision
91309
Author
[email protected]
Date
2011-07-19 15:13:56 -0700 (Tue, 19 Jul 2011)

Log Message

Source/WebCore: [V8] Wait until no v8 context is on the stack before
cancelling pending indexed db transactions.
https://bugs.webkit.org/show_bug.cgi?id=64552

Reviewed by Adam Barth.

Test: storage/indexeddb/transaction-abort-with-js-recursion.html

* bindings/v8/V8Proxy.cpp:
(WebCore::V8Proxy::didLeaveScriptContext):

LayoutTests: Test for https://bugs.webkit.org/show_bug.cgi?id=64552.

Reviewed by Adam Barth.

* storage/indexeddb/transaction-abort-with-js-recursion-expected.txt: Added.
* storage/indexeddb/transaction-abort-with-js-recursion.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (91308 => 91309)


--- trunk/LayoutTests/ChangeLog	2011-07-19 22:08:54 UTC (rev 91308)
+++ trunk/LayoutTests/ChangeLog	2011-07-19 22:13:56 UTC (rev 91309)
@@ -1,3 +1,12 @@
+2011-07-19  Nate Chapin  <[email protected]>
+
+        Test for https://bugs.webkit.org/show_bug.cgi?id=64552.
+
+        Reviewed by Adam Barth.
+
+        * storage/indexeddb/transaction-abort-with-js-recursion-expected.txt: Added.
+        * storage/indexeddb/transaction-abort-with-js-recursion.html: Added.
+
 2011-07-19  Mike West  <[email protected]>
 
         Sending a `Ping-From` header for cross-origin pings from non-HTTPS documents.

Added: trunk/LayoutTests/storage/indexeddb/transaction-abort-with-js-recursion-expected.txt (0 => 91309)


--- trunk/LayoutTests/storage/indexeddb/transaction-abort-with-js-recursion-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/storage/indexeddb/transaction-abort-with-js-recursion-expected.txt	2011-07-19 22:13:56 UTC (rev 91309)
@@ -0,0 +1,21 @@
+Test that pending transactions are not aborted during recursive JS calls until all JS is finished.
+
+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('transaction-abort-with-js-recursion')
+db = event.target.result
+db.setVersion('new version')
+pendingTransaction = db.transaction([], webkitIDBTransaction.READ_WRITE)
+Start re-entrant JS
+transaction = db.transaction([], webkitIDBTransaction.READ_WRITE)
+End re-entrant JS
+store = pendingTransaction.objectStore('objectStore')
+PASS store !== undefined is true
+Pending transaction aborted
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/storage/indexeddb/transaction-abort-with-js-recursion.html (0 => 91309)


--- trunk/LayoutTests/storage/indexeddb/transaction-abort-with-js-recursion.html	                        (rev 0)
+++ trunk/LayoutTests/storage/indexeddb/transaction-abort-with-js-recursion.html	2011-07-19 22:13:56 UTC (rev 91309)
@@ -0,0 +1,72 @@
+<html>
+<head>
+<link rel="stylesheet" href=""
+<script src=""
+<script src=""
+<script src=""
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script>
+
+var transaction;
+var store;
+var db;
+var body = document.getElementsByTagName("body")[0];
+
+description("Test that pending transactions are not aborted during recursive JS calls until all JS is finished.");
+if (window.layoutTestController)
+    layoutTestController.waitUntilDone();
+
+function setup() {
+    shouldBeTrue("'webkitIndexedDB' in window");
+    shouldBeFalse("webkitIndexedDB == null");
+
+    request = evalAndLog("webkitIndexedDB.open('transaction-abort-with-js-recursion')");
+    request._onsuccess_ = setVersion;
+    request._onerror_ = unexpectedErrorCallback;
+}
+
+function setVersion() {
+    db = evalAndLog("db = event.target.result");
+    request = evalAndLog("db.setVersion('new version')");
+    request._onsuccess_ = click;
+    request._onerror_ = unexpectedErrorCallback;
+}
+
+function click() {
+    body._onclick_ = test;
+    var pendingTransaction = evalAndLog("pendingTransaction = db.transaction([], webkitIDBTransaction.READ_WRITE)");
+    pendingTransaction._onsuccess_ = unexpectedErrorCallback;
+    pendingTransaction._onerror_ = unexpectedErrorCallback;
+    pendingTransaction._onabort_ = abortCallback;
+    var event = document.createEvent("MouseEvent");
+    event.initMouseEvent("click", true, true, document.defaultView, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
+    body.dispatchEvent(event);
+    var store = evalAndLog("store = pendingTransaction.objectStore('objectStore')");
+    shouldBeTrue("store !== undefined");
+    body._onclick_ = undefined;
+}
+
+function test()
+{
+    debug("Start re-entrant JS");
+    store = db.createObjectStore('objectStore', null);
+    transaction = evalAndLog("transaction = db.transaction([], webkitIDBTransaction.READ_WRITE)");
+    debug("End re-entrant JS");
+}
+
+
+function abortCallback()
+{
+    debug("Pending transaction aborted");
+    done();
+}
+
+setup();
+var successfullyParsed = true;
+
+</script>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (91308 => 91309)


--- trunk/Source/WebCore/ChangeLog	2011-07-19 22:08:54 UTC (rev 91308)
+++ trunk/Source/WebCore/ChangeLog	2011-07-19 22:13:56 UTC (rev 91309)
@@ -1,3 +1,16 @@
+2011-07-19  Nate Chapin  <[email protected]>
+
+        [V8] Wait until no v8 context is on the stack before
+        cancelling pending indexed db transactions.
+        https://bugs.webkit.org/show_bug.cgi?id=64552
+
+        Reviewed by Adam Barth.
+
+        Test: storage/indexeddb/transaction-abort-with-js-recursion.html
+
+        * bindings/v8/V8Proxy.cpp:
+        (WebCore::V8Proxy::didLeaveScriptContext):
+
 2011-07-19  MORITA Hajime  <[email protected]>
 
         Crash in CompositeEditCommand::replaceTextInNodePreservingMarkers.

Modified: trunk/Source/WebCore/bindings/v8/V8Proxy.cpp (91308 => 91309)


--- trunk/Source/WebCore/bindings/v8/V8Proxy.cpp	2011-07-19 22:08:54 UTC (rev 91308)
+++ trunk/Source/WebCore/bindings/v8/V8Proxy.cpp	2011-07-19 22:13:56 UTC (rev 91309)
@@ -611,17 +611,17 @@
     Page* page = m_frame->page();
     if (!page)
         return;
+    // If we've just left a top level script context and local storage has been
+    // instantiated, we must ensure that any storage locks have been freed.
+    // Per http://dev.w3.org/html5/spec/Overview.html#storage-mutex
+    if (m_recursion)
+        return;
 #if ENABLE(INDEXED_DATABASE)
     // If we've just left a script context and indexed database has been
     // instantiated, we must let its transaction coordinator know so it can terminate
     // any not-yet-started transactions.
     IDBPendingTransactionMonitor::abortPendingTransactions();
 #endif // ENABLE(INDEXED_DATABASE)
-    // If we've just left a top level script context and local storage has been
-    // instantiated, we must ensure that any storage locks have been freed.
-    // Per http://dev.w3.org/html5/spec/Overview.html#storage-mutex
-    if (m_recursion != 0)
-        return;
     if (page->group().hasLocalStorage())
         page->group().localStorage()->unlock();
 }
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to