diff options
author | Ben Murdoch <benm@google.com> | 2011-05-13 16:23:25 +0100 |
---|---|---|
committer | Ben Murdoch <benm@google.com> | 2011-05-16 11:35:02 +0100 |
commit | 65f03d4f644ce73618e5f4f50dd694b26f55ae12 (patch) | |
tree | f478babb801e720de7bfaee23443ffe029f58731 /LayoutTests | |
parent | 47de4a2fb7262c7ebdb9cd133ad2c54c187454d0 (diff) | |
download | external_webkit-65f03d4f644ce73618e5f4f50dd694b26f55ae12.zip external_webkit-65f03d4f644ce73618e5f4f50dd694b26f55ae12.tar.gz external_webkit-65f03d4f644ce73618e5f4f50dd694b26f55ae12.tar.bz2 |
Merge WebKit at r75993: Initial merge by git.
Change-Id: I602bbdc3974787a3b0450456a30a7868286921c3
Diffstat (limited to 'LayoutTests')
22 files changed, 424 insertions, 165 deletions
diff --git a/LayoutTests/fast/dom/Geolocation/resources/window-close-popup.html b/LayoutTests/fast/dom/Geolocation/resources/window-close-popup.html new file mode 100644 index 0000000..cfeabae --- /dev/null +++ b/LayoutTests/fast/dom/Geolocation/resources/window-close-popup.html @@ -0,0 +1,19 @@ +<script> +var mockLatitude = 51.478; +var mockLongitude = -0.166; +var mockAccuracy = 100.0; + +function loadNext() { + var geolocation = navigator.geolocation; + + if (window.layoutTestController) { + layoutTestController.setGeolocationPermission(true); + layoutTestController.setMockGeolocationPosition(mockLatitude, mockLongitude, mockAccuracy); + } + + navigator.geolocation.watchPosition( + function(p) { window.opener.gotPosition(); }, + function(e) { window.opener.failedToCreateWatch(e); }); +} +</script> +<body onload="loadNext()"></body> diff --git a/LayoutTests/fast/dom/Geolocation/script-tests/window-close-crash.js b/LayoutTests/fast/dom/Geolocation/script-tests/window-close-crash.js new file mode 100644 index 0000000..b27df61 --- /dev/null +++ b/LayoutTests/fast/dom/Geolocation/script-tests/window-close-crash.js @@ -0,0 +1,41 @@ +description("Tests the assertion that the GeolocationClient should not be updating<br>" + + "when the GeolocationController is destroyed.<br>" + + "See https://bugs.webkit.org/show_bug.cgi?id=52216"); + +var otherWindow; + +if (window.layoutTestController) { + layoutTestController.waitUntilDone(); + layoutTestController.setCanOpenWindows(); + layoutTestController.setCloseRemainingWindowsWhenComplete(true); +} else + testFailed('This test can not be run without the LayoutTestController'); + +function gotPosition(p) +{ + testPassed("Received Geoposition."); + otherWindow.close(); + window.setTimeout(waitForWindowToClose, 0); +} + +function waitForWindowToClose() +{ + if (!otherWindow.closed) { + window.setTimeout(waitForWindowToClose, 0); + return; + } + testPassed("Success - no crash!"); + finishJSTest(); +} + +function failedToCreateWatch(e) +{ + testFailed("Failed to create watch: " + e); + finishJSTest(); +} + +debug("Main page opening resources/window-close-popup.html"); +otherWindow = window.open("resources/window-close-popup.html"); + +window.jsTestIsAsync = true; +window.successfullyParsed = true; diff --git a/LayoutTests/fast/dom/Geolocation/window-close-crash-expected.txt b/LayoutTests/fast/dom/Geolocation/window-close-crash-expected.txt new file mode 100644 index 0000000..bc136e6 --- /dev/null +++ b/LayoutTests/fast/dom/Geolocation/window-close-crash-expected.txt @@ -0,0 +1,14 @@ +Tests the assertion that the GeolocationClient should not be updating +when the GeolocationController is destroyed. +See https://bugs.webkit.org/show_bug.cgi?id=52216 + +On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". + + +Main page opening resources/window-close-popup.html +PASS Received Geoposition. +PASS Success - no crash! +PASS successfullyParsed is true + +TEST COMPLETE + diff --git a/LayoutTests/fast/dom/Geolocation/window-close-crash.html b/LayoutTests/fast/dom/Geolocation/window-close-crash.html new file mode 100644 index 0000000..fc23692 --- /dev/null +++ b/LayoutTests/fast/dom/Geolocation/window-close-crash.html @@ -0,0 +1,13 @@ +<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> +<html> +<head> +<link rel="stylesheet" href="../../js/resources/js-test-style.css"> +<script src="../../js/resources/js-test-pre.js"></script> +</head> +<body> +<p id="description"></p> +<div id="console"></div> +<script src="script-tests/window-close-crash.js"></script> +<script src="../../js/resources/js-test-post.js"></script> +</body> +</html> diff --git a/LayoutTests/fast/events/touch/document-create-touch-list-expected.txt b/LayoutTests/fast/events/touch/document-create-touch-list-expected.txt index 99d578c..c664b2a 100644 --- a/LayoutTests/fast/events/touch/document-create-touch-list-expected.txt +++ b/LayoutTests/fast/events/touch/document-create-touch-list-expected.txt @@ -8,6 +8,11 @@ PASS touchList is non-null. PASS touchList.length is 0 PASS touchList.item(0) is null PASS touchList.item(1) is null +PASS ts.touches.length is 2 +PASS ts.touches[0].identifier is 12341 +PASS ts.touches[0].clientX is 60 +PASS ts.touches[1].screenY is 120 +PASS ts.ctrlKey is true PASS successfullyParsed is true TEST COMPLETE diff --git a/LayoutTests/fast/events/touch/script-tests/document-create-touch-list.js b/LayoutTests/fast/events/touch/script-tests/document-create-touch-list.js index 9c87c9a..526badc 100644 --- a/LayoutTests/fast/events/touch/script-tests/document-create-touch-list.js +++ b/LayoutTests/fast/events/touch/script-tests/document-create-touch-list.js @@ -2,11 +2,43 @@ description("This tests support for the document.createTouchList API."); shouldBeTrue('"createTouchList" in document'); +// Test createTouchList with no arguments. var touchList = document.createTouchList(); shouldBeNonNull("touchList"); shouldBe("touchList.length", "0"); shouldBeNull("touchList.item(0)"); shouldBeNull("touchList.item(1)"); +// Test createTouchList with Touch objects as arguments. +try { + var t = document.createTouch(window, document.body, 12341, 60, 65, 100, 105); + var t2 = document.createTouch(window, document.body, 12342, 50, 55, 115, 120); + var tl = document.createTouchList(t, t2); + + var evt = document.createEvent("TouchEvent"); + evt.initTouchEvent(tl, tl, tl, "touchstart", window, 0, 0, 0, 0, true, false, false, false); + + document.body.addEventListener("touchstart", function handleTouchStart(ev) { + ts = ev; + shouldBe("ts.touches.length", "2"); + shouldBe("ts.touches[0].identifier", "12341"); + shouldBe("ts.touches[0].clientX", "60"); + shouldBe("ts.touches[1].screenY", "120"); + shouldBe("ts.ctrlKey", "true"); + }); + + document.body.dispatchEvent(evt); +} catch(e) { + testFailed("An exception was thrown: " + e.message); +} + +// Test createTouchList with invalid arguments which throws exceptions. +try { + var tl = document.createTouchList(1, 2); +} catch(e) { + testFailed("An exception was thrown: " + e.message); +} + successfullyParsed = true; isSuccessfullyParsed(); + diff --git a/LayoutTests/storage/indexeddb/cursor-delete-expected.txt b/LayoutTests/storage/indexeddb/cursor-delete-expected.txt index 1fdf9ed..8d1bba2 100644 --- a/LayoutTests/storage/indexeddb/cursor-delete-expected.txt +++ b/LayoutTests/storage/indexeddb/cursor-delete-expected.txt @@ -48,7 +48,7 @@ objectStore.add('myValue2', 'myKey2') objectStore.add('myValue3', 'myKey3') objectStore.add('myValue4', 'myKey4') openCursor1 -trans = db.transaction('test', webkitIDBTransaction.READ_WRITE) +trans = db.transaction({objectStoreNames: 'test', mode: webkitIDBTransaction.READ_WRITE}) trans.objectStore('test').openCursor({range: keyRange}) PASS 'onsuccess' in result is true PASS 'onerror' in result is true @@ -85,9 +85,8 @@ PASS 'onerror' in event.target is true PASS 'readyState' in event.target is true PASS event.target.readyState is event.target.DONE -WARN: shouldBe() expects string arguments -PASS null is null -trans = db.transaction('test', webkitIDBTransaction.READ_WRITE) +PASS event.result is null +trans = db.transaction({objectStoreNames: 'test', mode: webkitIDBTransaction.READ_WRITE}) objectStore = trans.objectStore('test') objectStore.add('myValue1', 'myKey1') PASS 'onsuccess' in result is true diff --git a/LayoutTests/storage/indexeddb/cursor-delete.html b/LayoutTests/storage/indexeddb/cursor-delete.html index ce62d6a..9e1ddc3 100644 --- a/LayoutTests/storage/indexeddb/cursor-delete.html +++ b/LayoutTests/storage/indexeddb/cursor-delete.html @@ -59,7 +59,7 @@ function createAndPopulateObjectStore() function openCursor() { debug("openCursor1"); - evalAndLog("trans = db.transaction('test', webkitIDBTransaction.READ_WRITE)"); + evalAndLog("trans = db.transaction({objectStoreNames: 'test', mode: webkitIDBTransaction.READ_WRITE})"); keyRange = webkitIDBKeyRange.lowerBound("myKey1"); result = evalAndLog("trans.objectStore('test').openCursor({range: keyRange})"); verifyResult(result); @@ -86,13 +86,13 @@ function cursorSuccess() function cursorEmpty() { verifySuccessEvent(event); - shouldBeNull(event.result); + shouldBeNull("event.result"); trans.oncomplete = addObject; } function addObject() { - evalAndLog("trans = db.transaction('test', webkitIDBTransaction.READ_WRITE)"); + evalAndLog("trans = db.transaction({objectStoreNames: 'test', mode: webkitIDBTransaction.READ_WRITE})"); objectStore = evalAndLog("objectStore = trans.objectStore('test')"); result = evalAndLog("objectStore.add('myValue1', 'myKey1')"); verifyResult(result); diff --git a/LayoutTests/storage/indexeddb/cursor-index-delete-expected.txt b/LayoutTests/storage/indexeddb/cursor-index-delete-expected.txt index 4598556..27f3117 100644 --- a/LayoutTests/storage/indexeddb/cursor-index-delete-expected.txt +++ b/LayoutTests/storage/indexeddb/cursor-index-delete-expected.txt @@ -49,7 +49,7 @@ objectStore.add({x: 2}, 'myKey2') objectStore.add({x: 3}, 'myKey3') objectStore.add({x: 4}, 'myKey4') openCursor1 -trans = db.transaction('test', webkitIDBTransaction.READ_WRITE) +trans = db.transaction({objectStoreNames: 'test', mode: webkitIDBTransaction.READ_WRITE}) trans.objectStore('test').index('testIndex').openCursor({range: keyRange}) PASS 'onsuccess' in result is true PASS 'onerror' in result is true @@ -87,7 +87,7 @@ PASS 'readyState' in event.target is true PASS event.target.readyState is event.target.DONE PASS event.result is null -trans = db.transaction('test', webkitIDBTransaction.READ_WRITE) +trans = db.transaction({objectStoreNames: 'test', mode: webkitIDBTransaction.READ_WRITE}) objectStore = trans.objectStore('test') objectStore.add({x: 1}, 'myKey1') PASS 'onsuccess' in result is true diff --git a/LayoutTests/storage/indexeddb/cursor-index-delete.html b/LayoutTests/storage/indexeddb/cursor-index-delete.html index ea10f02..1bddf63 100644 --- a/LayoutTests/storage/indexeddb/cursor-index-delete.html +++ b/LayoutTests/storage/indexeddb/cursor-index-delete.html @@ -61,7 +61,7 @@ function createAndPopulateObjectStoreAndIndex() function openCursor() { debug("openCursor1"); - evalAndLog("trans = db.transaction('test', webkitIDBTransaction.READ_WRITE)"); + evalAndLog("trans = db.transaction({objectStoreNames: 'test', mode: webkitIDBTransaction.READ_WRITE})"); keyRange = webkitIDBKeyRange.lowerBound(1); result = evalAndLog("trans.objectStore('test').index('testIndex').openCursor({range: keyRange})"); verifyResult(result); @@ -95,7 +95,7 @@ function cursorEmpty() function addObject() { - evalAndLog("trans = db.transaction('test', webkitIDBTransaction.READ_WRITE)"); + evalAndLog("trans = db.transaction({objectStoreNames: 'test', mode: webkitIDBTransaction.READ_WRITE})"); objectStore = evalAndLog("objectStore = trans.objectStore('test')"); result = evalAndLog("objectStore.add({x: 1}, 'myKey1')"); verifyResult(result); diff --git a/LayoutTests/storage/indexeddb/database-quota-expected.txt b/LayoutTests/storage/indexeddb/database-quota-expected.txt index 3ea24d9..0f06145 100644 --- a/LayoutTests/storage/indexeddb/database-quota-expected.txt +++ b/LayoutTests/storage/indexeddb/database-quota-expected.txt @@ -64,7 +64,7 @@ PASS db.objectStoreNames.length is 1 PASS db.objectStoreNames.contains('') is false PASS db.objectStoreNames.contains('test456') is false PASS db.objectStoreNames.contains('test123') is true -trans = db.transaction() +trans = db.transaction({mode: webkitIDBTransaction.READ_WRITE}) Creating 'data' which contains 64K of data PASS data.length is 65536 store = trans.objectStore('test123') diff --git a/LayoutTests/storage/indexeddb/database-quota.html b/LayoutTests/storage/indexeddb/database-quota.html index b4207d4..d21b051 100644 --- a/LayoutTests/storage/indexeddb/database-quota.html +++ b/LayoutTests/storage/indexeddb/database-quota.html @@ -53,8 +53,8 @@ function createNewObjectStore() shouldBe("db.objectStoreNames.length", "0"); shouldBe("db.objectStoreNames.contains('')", "false"); - objectStore = evalAndLog('db.createObjectStore("test123")');
- checkObjectStore();
+ objectStore = evalAndLog('db.createObjectStore("test123")'); + checkObjectStore(); commitAndContinue(); } @@ -64,54 +64,54 @@ function checkObjectStore() shouldBe("db.objectStoreNames.length", "1"); shouldBe("db.objectStoreNames.contains('')", "false"); shouldBe("db.objectStoreNames.contains('test456')", "false"); - shouldBe("db.objectStoreNames.contains('test123')", "true");
-}
-
-function commitAndContinue()
-{
+ shouldBe("db.objectStoreNames.contains('test123')", "true"); +} + +function commitAndContinue() +{ window.setTimeout(checkQuotaEnforcing, 0); -}
-
-function checkQuotaEnforcing()
-{
- var trans = evalAndLog("trans = db.transaction()");
- trans.onabort = testComplete;
- trans.oncomplete = unexpectedCompleteCallback;
- debug("Creating 'data' which contains 64K of data");
- window.data = "X";
- for (var i = 0; i < 16; i++)
- data += data;
- shouldBe("data.length", "65536");
- window.dataAdded = 0;
- window.store = evalAndLog("store = trans.objectStore('test123')");
- addData();
-}
-
-function addData()
-{
- if (dataAdded < 5 * 1024 * 1024) {
+} + +function checkQuotaEnforcing() +{ + var trans = evalAndLog("trans = db.transaction({mode: webkitIDBTransaction.READ_WRITE})"); + trans.onabort = testComplete; + trans.oncomplete = unexpectedCompleteCallback; + debug("Creating 'data' which contains 64K of data"); + window.data = "X"; + for (var i = 0; i < 16; i++) + data += data; + shouldBe("data.length", "65536"); + window.dataAdded = 0; + window.store = evalAndLog("store = trans.objectStore('test123')"); + addData(); +} + +function addData() +{ + if (dataAdded < 5 * 1024 * 1024) { if (dataAdded > 0) store = event.source; - } else {
- testFailed("added more than quota");
- done();
- return;
- }
- dataAdded += 65536;
- result = store.add({x: data}, dataAdded);
- result.onsuccess = addData;
- result.onerror = logError;
-}
-
-function logError()
-{
- debug("Error function called: (" + event.code + ") " + event.message);
- verifyErrorEvent(event);
-}
-
-function testComplete()
-{
- testPassed("Adding data failed due to quota error. Data added was about " + Math.round(dataAdded / 1024 / 1024) + " MB");
+ } else { + testFailed("added more than quota"); + done(); + return; + } + dataAdded += 65536; + result = store.add({x: data}, dataAdded); + result.onsuccess = addData; + result.onerror = logError; +} + +function logError() +{ + debug("Error function called: (" + event.code + ") " + event.message); + verifyErrorEvent(event); +} + +function testComplete() +{ + testPassed("Adding data failed due to quota error. Data added was about " + Math.round(dataAdded / 1024 / 1024) + " MB"); done(); } diff --git a/LayoutTests/storage/indexeddb/objectstore-basics-expected.txt b/LayoutTests/storage/indexeddb/objectstore-basics-expected.txt index 6e74165..b842dcc 100644 --- a/LayoutTests/storage/indexeddb/objectstore-basics-expected.txt +++ b/LayoutTests/storage/indexeddb/objectstore-basics-expected.txt @@ -95,7 +95,7 @@ PASS store.indexNames[1] is null PASS store.indexNames[100] is null PASS store.indexNames.item(1) is null PASS store.indexNames.item(100) is null -transaction = db.transaction() +transaction = db.transaction({mode: webkitIDBTransaction.READ_WRITE}) store = transaction.objectStore('storeName') Try to insert data with a Date key: store.add({x: 'foo'}, testDate) @@ -137,7 +137,7 @@ PASS 'readyState' in event.target is true PASS event.target.readyState is event.target.DONE PASS event.code is webkitIDBDatabaseException.UNKNOWN_ERR -db.transaction() +db.transaction({mode: webkitIDBTransaction.READ_WRITE}) store = transaction.objectStore('storeName') store.add({x: 'othervalue'}, null) PASS 'onsuccess' in result is true @@ -158,7 +158,7 @@ PASS 'readyState' in event.target is true PASS event.target.readyState is event.target.DONE PASS event.code is webkitIDBDatabaseException.DATA_ERR -db.transaction() +db.transaction({mode: webkitIDBTransaction.READ_WRITE}) store = transaction.objectStore('storeName') store.add({x: null}, 'validkey') PASS 'onsuccess' in result is true @@ -179,7 +179,7 @@ PASS 'readyState' in event.target is true PASS event.target.readyState is event.target.DONE PASS event.code is webkitIDBDatabaseException.DATA_ERR -db.transaction() +db.transaction({mode: webkitIDBTransaction.READ_WRITE}) store = transaction.objectStore('storeName') store.get('key') PASS 'onsuccess' in result is true diff --git a/LayoutTests/storage/indexeddb/objectstore-basics.html b/LayoutTests/storage/indexeddb/objectstore-basics.html index 144e296..d388aa0 100644 --- a/LayoutTests/storage/indexeddb/objectstore-basics.html +++ b/LayoutTests/storage/indexeddb/objectstore-basics.html @@ -141,7 +141,7 @@ var testDateB = new Date("Wed Jan 05 2011 15:54:49"); function addData() { - var transaction = evalAndLog("transaction = db.transaction()"); + var transaction = evalAndLog("transaction = db.transaction({mode: webkitIDBTransaction.READ_WRITE})"); transaction.onabort = unexpectedAbortCallback; window.store = evalAndLog("store = transaction.objectStore('storeName')"); @@ -189,7 +189,7 @@ function addAgainFailure() // FIXME: This error code needs to be specced. shouldBe("event.code", "webkitIDBDatabaseException.UNKNOWN_ERR"); - transaction = evalAndLog("db.transaction()"); + transaction = evalAndLog("db.transaction({mode: webkitIDBTransaction.READ_WRITE})"); transaction.onabort = unexpectedErrorCallback; var store = evalAndLog("store = transaction.objectStore('storeName')"); @@ -205,7 +205,7 @@ function addWithNullKeyFailure() verifyErrorEvent(event); shouldBe("event.code", "webkitIDBDatabaseException.DATA_ERR"); - transaction = evalAndLog("db.transaction()"); + transaction = evalAndLog("db.transaction({mode: webkitIDBTransaction.READ_WRITE})"); transaction.onabort = unexpectedErrorCallback; var store = evalAndLog("store = transaction.objectStore('storeName')"); @@ -221,7 +221,7 @@ function addWithNullIndexFailure() verifyErrorEvent(event); shouldBe("event.code", "webkitIDBDatabaseException.DATA_ERR"); - transaction = evalAndLog("db.transaction()"); + transaction = evalAndLog("db.transaction({mode: webkitIDBTransaction.READ_WRITE})"); transaction.onabort = unexpectedErrorCallback; var store = evalAndLog("store = transaction.objectStore('storeName')"); diff --git a/LayoutTests/storage/indexeddb/objectstore-removeobjectstore-expected.txt b/LayoutTests/storage/indexeddb/objectstore-removeobjectstore-expected.txt index e45ff73..37492db 100644 --- a/LayoutTests/storage/indexeddb/objectstore-removeobjectstore-expected.txt +++ b/LayoutTests/storage/indexeddb/objectstore-removeobjectstore-expected.txt @@ -61,7 +61,7 @@ PASS 'onerror' in event.target is true PASS 'readyState' in event.target is true PASS event.target.readyState is event.target.DONE -db.transaction() +db.transaction({mode: webkitIDBTransaction.READ_WRITE}) store = transaction.objectStore('storeName') store.get('key') PASS 'onsuccess' in result is true @@ -102,7 +102,7 @@ trans = event.result PASS trans !== null is true db.deleteObjectStore('storeName') db.createObjectStore('storeName', null) -db.transaction() +db.transaction({mode: webkitIDBTransaction.READ_WRITE}) store = transaction.objectStore('storeName') store.get('key') PASS 'onsuccess' in result is true diff --git a/LayoutTests/storage/indexeddb/objectstore-removeobjectstore.html b/LayoutTests/storage/indexeddb/objectstore-removeobjectstore.html index c531dcf..a08f071 100644 --- a/LayoutTests/storage/indexeddb/objectstore-removeobjectstore.html +++ b/LayoutTests/storage/indexeddb/objectstore-removeobjectstore.html @@ -59,7 +59,7 @@ function getValue() { verifySuccessEvent(event); - transaction = evalAndLog("db.transaction()"); + transaction = evalAndLog("db.transaction({mode: webkitIDBTransaction.READ_WRITE})"); transaction.onabort = unexpectedErrorCallback; var store = evalAndLog("store = transaction.objectStore('storeName')"); @@ -99,7 +99,7 @@ function createObjectStoreAgain() function getValueAgain() { - transaction = evalAndLog("db.transaction()"); + transaction = evalAndLog("db.transaction({mode: webkitIDBTransaction.READ_WRITE})"); transaction.onabort = unexpectedErrorCallback; var store = evalAndLog("store = transaction.objectStore('storeName')"); diff --git a/LayoutTests/storage/indexeddb/transaction-basics-expected.txt b/LayoutTests/storage/indexeddb/transaction-basics-expected.txt index a3bd90a..f026154 100644 --- a/LayoutTests/storage/indexeddb/transaction-basics-expected.txt +++ b/LayoutTests/storage/indexeddb/transaction-basics-expected.txt @@ -172,7 +172,7 @@ trans = event.result PASS trans !== null is true Deleted all object stores. db.createObjectStore('storeName', null) -db.transaction() +db.transaction({mode: webkitIDBTransaction.READ_WRITE}) store = transaction.objectStore('storeName') PASS store.name is "storeName" Abort event fired: diff --git a/LayoutTests/storage/indexeddb/transaction-basics.html b/LayoutTests/storage/indexeddb/transaction-basics.html index cd42419..8995e6d 100644 --- a/LayoutTests/storage/indexeddb/transaction-basics.html +++ b/LayoutTests/storage/indexeddb/transaction-basics.html @@ -1,28 +1,28 @@ -<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 transaction basics."); -if (window.layoutTestController) - layoutTestController.waitUntilDone(); - -function test() -{ - shouldBeTrue("'webkitIndexedDB' in window"); - shouldBeFalse("webkitIndexedDB == null"); - - result = evalAndLog("webkitIndexedDB.open('name')"); - verifyResult(result); - result.onsuccess = openSuccess; - result.onerror = unexpectedErrorCallback; +<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 transaction basics.");
+if (window.layoutTestController)
+ layoutTestController.waitUntilDone();
+
+function test()
+{
+ shouldBeTrue("'webkitIndexedDB' in window");
+ shouldBeFalse("webkitIndexedDB == null");
+
+ result = evalAndLog("webkitIndexedDB.open('name')");
+ verifyResult(result);
+ result.onsuccess = openSuccess;
+ result.onerror = unexpectedErrorCallback;
}
function openSuccess()
@@ -184,7 +184,7 @@ function checkMetadataEmpty() {
shouldBe("window.db.objectStoreNames", "[]");
shouldBe("window.db.objectStoreNames.length", "0");
- shouldBe("window.db.objectStoreNames.contains('storeFail')", "false"); + shouldBe("window.db.objectStoreNames.contains('storeFail')", "false");
}
function checkMetadataExistingObjectStore()
@@ -192,63 +192,63 @@ function checkMetadataExistingObjectStore() shouldBe("db.objectStoreNames", "['storeFail']");
shouldBe("db.objectStoreNames.length", "1");
shouldBe("db.objectStoreNames.contains('storeFail')", "true");
-} - -function setNewVersion() -{ - result = evalAndLog("db.setVersion('new version')"); - verifyResult(result); - result.onsuccess = setVersionSuccess; - result.onerror = unexpectedErrorCallback; -} - -function setVersionSuccess() -{ - debug("setVersionSuccess():"); - verifySuccessEvent(event); - window.trans = evalAndLog("trans = event.result"); - shouldBeTrue("trans !== null"); - trans.onabort = unexpectedAbortCallback; - trans.oncomplete = completeCallback; - window.completeEventFired = false; - - deleteAllObjectStores(db, createObjectStoreAndStartTransaction); +}
+
+function setNewVersion()
+{
+ result = evalAndLog("db.setVersion('new version')");
+ verifyResult(result);
+ result.onsuccess = setVersionSuccess;
+ result.onerror = unexpectedErrorCallback;
+}
+
+function setVersionSuccess()
+{
+ debug("setVersionSuccess():");
+ verifySuccessEvent(event);
+ window.trans = evalAndLog("trans = event.result");
+ shouldBeTrue("trans !== null");
+ trans.onabort = unexpectedAbortCallback;
+ trans.oncomplete = completeCallback;
+ window.completeEventFired = false;
+
+ deleteAllObjectStores(db, createObjectStoreAndStartTransaction);
}
function createObjectStoreAndStartTransaction()
{
- evalAndLog("db.createObjectStore('storeName', null)"); - transaction = evalAndLog("db.transaction()"); - transaction.onabort = abortCallback; - var store = evalAndLog("store = transaction.objectStore('storeName')"); - shouldBeEqualToString("store.name", "storeName"); -} - -function completeCallback() -{ - verifyCompleteEvent(event); - window.completeEventFired = true; -} - -function abortCallback() -{ - verifyAbortEvent(event); - checkForCompleteEvent(); -} - -function checkForCompleteEvent() -{ - if (completeEventFired) { - testPassed("oncomplete event had fired"); - done(); - } else - setTimeout(checkForCompleteEvent, 1); -} - -var successfullyParsed = true; - -test(); - -</script> -</body> -</html> + evalAndLog("db.createObjectStore('storeName', null)");
+ transaction = evalAndLog("db.transaction({mode: webkitIDBTransaction.READ_WRITE})");
+ transaction.onabort = abortCallback;
+ var store = evalAndLog("store = transaction.objectStore('storeName')");
+ shouldBeEqualToString("store.name", "storeName");
+}
+
+function completeCallback()
+{
+ verifyCompleteEvent(event);
+ window.completeEventFired = true;
+}
+
+function abortCallback()
+{
+ verifyAbortEvent(event);
+ checkForCompleteEvent();
+}
+
+function checkForCompleteEvent()
+{
+ if (completeEventFired) {
+ testPassed("oncomplete event had fired");
+ done();
+ } else
+ setTimeout(checkForCompleteEvent, 1);
+}
+
+var successfullyParsed = true;
+
+test();
+
+</script>
+</body>
+</html>
diff --git a/LayoutTests/storage/indexeddb/transaction-crash-on-abort-expected.txt b/LayoutTests/storage/indexeddb/transaction-crash-on-abort-expected.txt index 413643c..139189e 100644 --- a/LayoutTests/storage/indexeddb/transaction-crash-on-abort-expected.txt +++ b/LayoutTests/storage/indexeddb/transaction-crash-on-abort-expected.txt @@ -24,7 +24,7 @@ PASS 'readyState' in event.target is true PASS event.target.readyState is event.target.DONE db = event.result -db.transaction([]) +db.transaction() window.gc() PASS successfullyParsed is true diff --git a/LayoutTests/storage/indexeddb/transaction-crash-on-abort.html b/LayoutTests/storage/indexeddb/transaction-crash-on-abort.html index 1b13c87..92aeb31 100644 --- a/LayoutTests/storage/indexeddb/transaction-crash-on-abort.html +++ b/LayoutTests/storage/indexeddb/transaction-crash-on-abort.html @@ -23,16 +23,16 @@ function test() verifyResult(result); result.onsuccess = openSuccess; result.onerror = unexpectedErrorCallback; -}
-
-function openSuccess()
-{
- debug("openSuccess():");
- verifySuccessEvent(event);
- db = evalAndLog("db = event.result");
- evalAndLog("db.transaction([])");
- evalAndLog("window.gc()");
- done();
+} + +function openSuccess() +{ + debug("openSuccess():"); + verifySuccessEvent(event); + db = evalAndLog("db = event.result"); + evalAndLog("db.transaction()"); + evalAndLog("window.gc()"); + done(); } var successfullyParsed = true; diff --git a/LayoutTests/storage/indexeddb/transaction-read-only-expected.txt b/LayoutTests/storage/indexeddb/transaction-read-only-expected.txt new file mode 100644 index 0000000..9d3d668 --- /dev/null +++ b/LayoutTests/storage/indexeddb/transaction-read-only-expected.txt @@ -0,0 +1,56 @@ +Test read-only transactions 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('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') +store.put('x', 'y') +trans = db.transaction() +Expecting exception from trans.objectStore('store').put('a', 'b') +PASS code is webkitIDBDatabaseException.READ_ONLY_ERR +trans = db.transaction() +Expecting exception from trans.objectStore('store').delete('x') +PASS code is webkitIDBDatabaseException.READ_ONLY_ERR +trans = db.transaction() +cur = trans.objectStore('store').openCursor() +PASS !event.result is false +Expecting exception from event.result.delete() +PASS code is webkitIDBDatabaseException.READ_ONLY_ERR +PASS successfullyParsed is true + +TEST COMPLETE + diff --git a/LayoutTests/storage/indexeddb/transaction-read-only.html b/LayoutTests/storage/indexeddb/transaction-read-only.html new file mode 100644 index 0000000..fba6b95 --- /dev/null +++ b/LayoutTests/storage/indexeddb/transaction-read-only.html @@ -0,0 +1,80 @@ +<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 read-only transactions in IndexedDB."); +if (window.layoutTestController) + layoutTestController.waitUntilDone(); + +function test() +{ + shouldBeTrue("'webkitIndexedDB' in window"); + shouldBeFalse("webkitIndexedDB == null"); + + result = evalAndLog("webkitIndexedDB.open('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 = cleanDatabase; + result.onerror = unexpectedErrorCallback; +} + +function cleanDatabase() +{ + verifySuccessEvent(event); + deleteAllObjectStores(db, setVersionStuff); +} + +function setVersionStuff() +{ + event.result.oncomplete = setVersionDone; + event.result.onabort = unexpectedAbortCallback; + store = evalAndLog("store = db.createObjectStore('store')"); + evalAndLog("store.put('x', 'y')"); +} + +function setVersionDone() +{ + trans = evalAndLog("trans = db.transaction()"); + evalAndExpectException("trans.objectStore('store').put('a', 'b')", "webkitIDBDatabaseException.READ_ONLY_ERR"); + + trans = evalAndLog("trans = db.transaction()"); + evalAndExpectException("trans.objectStore('store').delete('x')", "webkitIDBDatabaseException.READ_ONLY_ERR"); + + trans = evalAndLog("trans = db.transaction()"); + cur = evalAndLog("cur = trans.objectStore('store').openCursor()"); + cur.onsuccess = gotCursor; + cur.onerror = unexpectedErrorCallback; +} + +function gotCursor() +{ + shouldBeFalse("!event.result"); + evalAndExpectException("event.result.delete()", "webkitIDBDatabaseException.READ_ONLY_ERR"); + + done(); +} + +var successfullyParsed = true; + +test(); + +</script> +</body> +</html> |