Diff
Modified: trunk/LayoutTests/ChangeLog (111224 => 111225)
--- trunk/LayoutTests/ChangeLog 2012-03-19 20:09:55 UTC (rev 111224)
+++ trunk/LayoutTests/ChangeLog 2012-03-19 20:12:24 UTC (rev 111225)
@@ -1,3 +1,30 @@
+2012-03-19 Joshua Bell <[email protected]>
+
+ IndexedDB: Test cleanup - don't create transactions w/in transaction callback
+ https://bugs.webkit.org/show_bug.cgi?id=81532
+
+ The spec precludes creating transactions within a synchronous transaction callback;
+ for the current implementation, that's only the success callback for a setVersion()
+ call. This isn't enforced yet - see http://webkit.org/b/80547
+
+ Reviewed by Tony Chang.
+
+ * storage/indexeddb/create-and-remove-object-store.html: Split out oncomplete handler.
+ * storage/indexeddb/create-object-store-options.html: Split out oncomplete handler.
+ * storage/indexeddb/factory-deletedatabase.html: Listen on complete event.
+ * storage/indexeddb/mozilla/autoincrement-indexes.html: Split out oncomplete handler.
+ * storage/indexeddb/mozilla/clear.html: Listen on complete event.
+ * storage/indexeddb/mozilla/indexes.html: Split out oncomplete handler.
+ * storage/indexeddb/mozilla/readonly-transactions.html: Split out oncomplete handler.
+ * storage/indexeddb/mozilla/readwrite-transactions.html: Split out oncomplete handler.
+ * storage/indexeddb/noblobs.html: Pass function reference, don't call function.
+ * storage/indexeddb/objectstore-clear.html: Split out oncomplete handler.
+ * storage/indexeddb/objectstore-removeobjectstore.html: Listen on complete event.
+ * storage/indexeddb/transaction-abort-with-js-recursion-cross-frame.html: Split out oncomplete handler.
+ * storage/indexeddb/transaction-abort-with-js-recursion.html: Split out oncomplete handler.
+ * storage/indexeddb/transaction-crash-on-abort.html: Split out oncomplete handler.
+ * storage/indexeddb/two-version-changes.html: Split out oncomplete handler.
+
2012-03-19 Levi Weintraub <[email protected]>
[Chromium] Marking fast/text/international/font-fallback-to-common-script.html as flaky for image
Modified: trunk/LayoutTests/storage/indexeddb/create-and-remove-object-store.html (111224 => 111225)
--- trunk/LayoutTests/storage/indexeddb/create-and-remove-object-store.html 2012-03-19 20:09:55 UTC (rev 111224)
+++ trunk/LayoutTests/storage/indexeddb/create-and-remove-object-store.html 2012-03-19 20:12:24 UTC (rev 111225)
@@ -41,7 +41,11 @@
os = evalAndLog("db.createObjectStore('tmp')");
evalAndExpectException("db.createObjectStore('tmp')", "IDBDatabaseException.CONSTRAINT_ERR");
+ event.target.result._oncomplete_ = setVersionComplete;
+}
+function setVersionComplete()
+{
trans = evalAndLog("trans = db.transaction(['tmp'])");
request = evalAndLog("trans.objectStore('tmp').get(0)");
request._onsuccess_ = tryOnceMore;
Modified: trunk/LayoutTests/storage/indexeddb/create-object-store-options.html (111224 => 111225)
--- trunk/LayoutTests/storage/indexeddb/create-object-store-options.html 2012-03-19 20:09:55 UTC (rev 111224)
+++ trunk/LayoutTests/storage/indexeddb/create-object-store-options.html 2012-03-19 20:12:24 UTC (rev 111225)
@@ -35,7 +35,11 @@
debug("db.createObjectStore('c', {autoIncrement: true});");
db.createObjectStore('c', {autoIncrement: true});
+ event.target.result._oncomplete_ = setVersionComplete;
+}
+function setVersionComplete()
+{
trans = evalAndLog("trans = db.transaction(['a', 'b'], IDBTransaction.READ_WRITE)");
shouldBe("trans.mode", "IDBTransaction.READ_WRITE");
Modified: trunk/LayoutTests/storage/indexeddb/factory-deletedatabase.html (111224 => 111225)
--- trunk/LayoutTests/storage/indexeddb/factory-deletedatabase.html 2012-03-19 20:09:55 UTC (rev 111224)
+++ trunk/LayoutTests/storage/indexeddb/factory-deletedatabase.html 2012-03-19 20:12:24 UTC (rev 111225)
@@ -36,8 +36,8 @@
shouldBeTrue("store.indexNames.contains('indexName')");
request = evalAndLog("store.add('value', 'key')");
- request._onsuccess_ = getValue;
request._onerror_ = unexpectedErrorCallback;
+ trans._oncomplete_ = getValue;
}
function getValue()
Modified: trunk/LayoutTests/storage/indexeddb/mozilla/autoincrement-indexes.html (111224 => 111225)
--- trunk/LayoutTests/storage/indexeddb/mozilla/autoincrement-indexes.html 2012-03-19 20:09:55 UTC (rev 111224)
+++ trunk/LayoutTests/storage/indexeddb/mozilla/autoincrement-indexes.html 2012-03-19 20:12:24 UTC (rev 111225)
@@ -37,6 +37,7 @@
function setupObjectStore()
{
+ trans = event.target.result;
deleteAllObjectStores(db);
objectStore = evalAndLog("objectStore = db.createObjectStore('foo', { keyPath: 'id', autoIncrement: true });");
@@ -53,7 +54,11 @@
{
key = evalAndLog("key = event.target.result;");
shouldBeFalse("key == null");
+ trans._oncomplete_ = setVersionComplete;
+}
+function setVersionComplete()
+{
objectStore = evalAndLog("objectStore = db.transaction('foo').objectStore('foo');");
first = evalAndLog("first = objectStore.index('first');");
request = evalAndLog("request = first.get('foo');");
Modified: trunk/LayoutTests/storage/indexeddb/mozilla/clear.html (111224 => 111225)
--- trunk/LayoutTests/storage/indexeddb/mozilla/clear.html 2012-03-19 20:09:55 UTC (rev 111224)
+++ trunk/LayoutTests/storage/indexeddb/mozilla/clear.html 2012-03-19 20:12:24 UTC (rev 111225)
@@ -41,8 +41,8 @@
objectStore = evalAndLog("objectStore = db.createObjectStore('foo', { autoIncrement: true });");
request = evalAndLog("request = objectStore.add({});");
- request._onsuccess_ = clear;
request._onerror_ = unexpectedErrorCallback;
+ event.target.result._oncomplete_ = clear;
}
function clear()
Modified: trunk/LayoutTests/storage/indexeddb/mozilla/indexes.html (111224 => 111225)
--- trunk/LayoutTests/storage/indexeddb/mozilla/indexes.html 2012-03-19 20:09:55 UTC (rev 111224)
+++ trunk/LayoutTests/storage/indexeddb/mozilla/indexes.html 2012-03-19 20:12:24 UTC (rev 111225)
@@ -83,6 +83,7 @@
function createAndPopulateObjectStore()
{
deleteAllObjectStores(db);
+ trans = event.target.result;
objectStore = evalAndLog("objectStore = db.createObjectStore(objectStoreName);");
@@ -106,7 +107,11 @@
evalAndLog("objectStore.createIndex(indexData[i].name, indexData[i].keyPath, indexData[i].options);");
}
shouldBe("objectStore.indexNames.length", "indexData.length");
+ trans._oncomplete_ = setVersionComplete;
+}
+function setVersionComplete()
+{
objectStore = evalAndLog("objectStore = db.transaction(objectStoreName).objectStore(objectStoreName);");
// Check global properties to make sure they are correct.
Modified: trunk/LayoutTests/storage/indexeddb/mozilla/readonly-transactions.html (111224 => 111225)
--- trunk/LayoutTests/storage/indexeddb/mozilla/readonly-transactions.html 2012-03-19 20:09:55 UTC (rev 111224)
+++ trunk/LayoutTests/storage/indexeddb/mozilla/readonly-transactions.html 2012-03-19 20:12:24 UTC (rev 111225)
@@ -41,6 +41,11 @@
osName = "test store";
objectStore = evalAndLog("objectStore = db.createObjectStore(osName, { autoIncrement: true });");
+ event.target.result._oncomplete_ = setVersionComplete;
+}
+
+function setVersionComplete()
+{
evalAndExpectException("db.transaction([osName]).objectStore(osName).add({});", "IDBDatabaseException.READ_ONLY_ERR");
evalAndExpectException("db.transaction(osName).objectStore(osName).add({});", "IDBDatabaseException.READ_ONLY_ERR");
key1 = evalAndLog("key1 = 1;");
Modified: trunk/LayoutTests/storage/indexeddb/mozilla/readwrite-transactions.html (111224 => 111225)
--- trunk/LayoutTests/storage/indexeddb/mozilla/readwrite-transactions.html 2012-03-19 20:09:55 UTC (rev 111224)
+++ trunk/LayoutTests/storage/indexeddb/mozilla/readwrite-transactions.html 2012-03-19 20:12:24 UTC (rev 111225)
@@ -41,6 +41,11 @@
osName = "test store";
objectStore = evalAndLog("objectStore = db.createObjectStore(osName, { autoIncrement: true });");
+ event.target.result._oncomplete_ = setVersionComplete;
+}
+
+function setVersionComplete()
+{
request = evalAndLog("request = db.transaction([osName], IDBTransaction.READ_WRITE).objectStore(osName).add({});");
request._onsuccess_ = postAdd;
request._onerror_ = unexpectedErrorCallback;
Modified: trunk/LayoutTests/storage/indexeddb/noblobs.html (111224 => 111225)
--- trunk/LayoutTests/storage/indexeddb/noblobs.html 2012-03-19 20:09:55 UTC (rev 111224)
+++ trunk/LayoutTests/storage/indexeddb/noblobs.html 2012-03-19 20:12:24 UTC (rev 111225)
@@ -47,7 +47,7 @@
var trans = request.result;
trans._onerror_ = unexpectedErrorCallback;
trans._onabort_ = unexpectedAbortCallback;
- trans._oncomplete_ = testBlob();
+ trans._oncomplete_ = testBlob;
};
};
};
Modified: trunk/LayoutTests/storage/indexeddb/objectstore-clear.html (111224 => 111225)
--- trunk/LayoutTests/storage/indexeddb/objectstore-clear.html 2012-03-19 20:09:55 UTC (rev 111224)
+++ trunk/LayoutTests/storage/indexeddb/objectstore-clear.html 2012-03-19 20:12:24 UTC (rev 111225)
@@ -81,7 +81,11 @@
{
debug("openKeyCursorSuccess():");
shouldBeNull("event.target.result");
+ trans._oncomplete_ = setVersionComplete;
+}
+function setVersionComplete()
+{
transaction = evalAndLog("db.transaction(['otherStoreName'])");
transaction._onabort_ = unexpectedErrorCallback;
var otherStore = evalAndLog("otherStore = transaction.objectStore('otherStoreName')");
Modified: trunk/LayoutTests/storage/indexeddb/objectstore-removeobjectstore.html (111224 => 111225)
--- trunk/LayoutTests/storage/indexeddb/objectstore-removeobjectstore.html 2012-03-19 20:09:55 UTC (rev 111224)
+++ trunk/LayoutTests/storage/indexeddb/objectstore-removeobjectstore.html 2012-03-19 20:12:24 UTC (rev 111225)
@@ -38,8 +38,8 @@
shouldBeTrue("store.indexNames.contains('indexName')");
request = evalAndLog("store.add('value', 'key')");
- request._onsuccess_ = getValue;
request._onerror_ = unexpectedErrorCallback;
+ trans._oncomplete_ = getValue;
}
function getValue()
@@ -75,7 +75,7 @@
function createObjectStoreAgain()
{
evalAndLog("db.createObjectStore('storeName', null)");
- getValueAgain();
+ trans._oncomplete_ = getValueAgain;
}
function getValueAgain()
Modified: trunk/LayoutTests/storage/indexeddb/transaction-abort-with-js-recursion-cross-frame.html (111224 => 111225)
--- trunk/LayoutTests/storage/indexeddb/transaction-abort-with-js-recursion-cross-frame.html 2012-03-19 20:09:55 UTC (rev 111224)
+++ trunk/LayoutTests/storage/indexeddb/transaction-abort-with-js-recursion-cross-frame.html 2012-03-19 20:12:24 UTC (rev 111225)
@@ -27,12 +27,16 @@
function setVersion() {
db = evalAndLog("db = event.target.result");
request = evalAndLog("db.setVersion('new version')");
- request._onsuccess_ = click;
+ request._onsuccess_ = setVersionSuccess;
request._onerror_ = unexpectedErrorCallback;
}
+function setVersionSuccess() {
+ store = db.createObjectStore('objectStore', null);
+ event.target.result._oncomplete_ = click;
+}
+
function click() {
- store = db.createObjectStore('objectStore', null);
body._onclick_ = test;
var pendingTransaction = evalAndLog("pendingTransaction = db.transaction(['objectStore'], IDBTransaction.READ_WRITE)");
pendingTransaction._onsuccess_ = unexpectedErrorCallback;
Modified: trunk/LayoutTests/storage/indexeddb/transaction-abort-with-js-recursion.html (111224 => 111225)
--- trunk/LayoutTests/storage/indexeddb/transaction-abort-with-js-recursion.html 2012-03-19 20:09:55 UTC (rev 111224)
+++ trunk/LayoutTests/storage/indexeddb/transaction-abort-with-js-recursion.html 2012-03-19 20:12:24 UTC (rev 111225)
@@ -24,12 +24,18 @@
function setVersion() {
db = evalAndLog("db = event.target.result");
request = evalAndLog("db.setVersion('new version')");
- request._onsuccess_ = click;
+ request._onsuccess_ = setVersionSuccess;
request._onerror_ = unexpectedErrorCallback;
}
-function click() {
+function setVersionSuccess()
+{
store = db.createObjectStore('objectStore', null);
+ event.target.result._oncomplete_ = click;
+}
+
+function click()
+{
body._onclick_ = test;
var pendingTransaction = evalAndLog("pendingTransaction = db.transaction(['objectStore'], IDBTransaction.READ_WRITE)");
pendingTransaction._onsuccess_ = unexpectedErrorCallback;
Modified: trunk/LayoutTests/storage/indexeddb/transaction-crash-on-abort.html (111224 => 111225)
--- trunk/LayoutTests/storage/indexeddb/transaction-crash-on-abort.html 2012-03-19 20:09:55 UTC (rev 111224)
+++ trunk/LayoutTests/storage/indexeddb/transaction-crash-on-abort.html 2012-03-19 20:12:24 UTC (rev 111225)
@@ -29,6 +29,11 @@
function setVersionSuccess()
{
evalAndLog("db.createObjectStore('foo')");
+ event.target.result._oncomplete_ = setVersionComplete;
+}
+
+function setVersionComplete()
+{
evalAndLog("db.transaction('foo')");
evalAndLog("self.gc()");
finishJSTest();
Modified: trunk/LayoutTests/storage/indexeddb/two-version-changes.html (111224 => 111225)
--- trunk/LayoutTests/storage/indexeddb/two-version-changes.html 2012-03-19 20:09:55 UTC (rev 111224)
+++ trunk/LayoutTests/storage/indexeddb/two-version-changes.html 2012-03-19 20:12:24 UTC (rev 111225)
@@ -44,6 +44,7 @@
function inSetVersion1()
{
debug("setVersion() #1 callback");
+ trans = event.target.result;
evalAndLog("self.store1 = db.createObjectStore('test-store1')");
shouldBe("++self.state", "1");
var req = evalAndLog("self.store1.put('aaa', 111)");
@@ -57,9 +58,11 @@
function inSetVersion2()
{
debug("setVersion() #2 callback");
+ trans = event.target.result;
shouldBe("++self.state", "4");
evalAndLog("self.store2 = db.createObjectStore('test-store2')");
+
var req = evalAndLog("self.store2.put('bbb', 222)");
req._onerror_ = unexpectedErrorCallback;
req._onsuccess_ = function (e) {
@@ -83,6 +86,11 @@
function checkResults() {
shouldBeEqualToString("self.db.version", "version 2");
+ trans._oncomplete_ = setVersionComplete;
+}
+
+function setVersionComplete()
+{
trans = evalAndLog("self.trans = db.transaction(['test-store1', 'test-store2'])");
store = evalAndLog("self.store = self.trans.objectStore('test-store1')");
req = evalAndLog("self.req = self.store.get(111)");