2010-11-11 02:25:40 +03:00
|
|
|
<!--
|
|
|
|
Any copyright is dedicated to the Public Domain.
|
|
|
|
http://creativecommons.org/publicdomain/zero/1.0/
|
|
|
|
-->
|
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<title>Indexed Database Property Test</title>
|
|
|
|
|
|
|
|
<script type="text/javascript" src="/MochiKit/packed.js"></script>
|
|
|
|
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
|
|
|
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
|
|
|
|
|
|
|
<script type="text/javascript;version=1.7">
|
|
|
|
function testSteps()
|
|
|
|
{
|
2011-01-03 23:03:06 +03:00
|
|
|
let request = mozIndexedDB.open(window.location.pathname, "");
|
2010-11-11 02:25:40 +03:00
|
|
|
request.onerror = errorHandler;
|
|
|
|
request.onsuccess = grabEventAndContinueHandler;
|
|
|
|
let event = yield;
|
|
|
|
|
2011-01-07 09:21:36 +03:00
|
|
|
let db = event.target.result;
|
2010-11-11 02:25:40 +03:00
|
|
|
|
|
|
|
request = db.setVersion("1");
|
|
|
|
request.onerror = errorHandler;
|
|
|
|
request.onsuccess = grabEventAndContinueHandler;
|
|
|
|
event = yield;
|
|
|
|
|
2011-01-07 09:21:36 +03:00
|
|
|
let transaction = event.target.transaction;
|
2010-11-11 02:25:40 +03:00
|
|
|
|
2010-12-21 19:02:01 +03:00
|
|
|
let objectStore1 = db.createObjectStore("foo");
|
2010-11-11 02:25:40 +03:00
|
|
|
let objectStore2 = transaction.objectStore("foo");
|
|
|
|
ok(objectStore1 === objectStore2, "Got same objectStores");
|
|
|
|
|
|
|
|
let index1 = objectStore1.createIndex("bar", "key");
|
|
|
|
let index2 = objectStore2.index("bar");
|
|
|
|
ok(index1 === index2, "Got same indexes");
|
|
|
|
|
|
|
|
transaction.oncomplete = continueToNextStep;
|
|
|
|
yield;
|
|
|
|
|
|
|
|
transaction = db.transaction("foo");
|
|
|
|
|
|
|
|
let objectStore3 = transaction.objectStore("foo");
|
|
|
|
let objectStore4 = transaction.objectStore("foo");
|
|
|
|
ok(objectStore3 === objectStore4, "Got same objectStores");
|
|
|
|
|
|
|
|
ok(objectStore3 !== objectStore1, "Different objectStores");
|
|
|
|
ok(objectStore4 !== objectStore2, "Different objectStores");
|
|
|
|
|
|
|
|
let index3 = objectStore3.index("bar");
|
|
|
|
let index4 = objectStore4.index("bar");
|
|
|
|
ok(index3 === index4, "Got same indexes");
|
|
|
|
|
|
|
|
ok(index3 !== index1, "Different indexes");
|
|
|
|
ok(index4 !== index2, "Different indexes");
|
|
|
|
|
|
|
|
finishTest();
|
|
|
|
yield;
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
<script type="text/javascript;version=1.7" src="helpers.js"></script>
|
|
|
|
|
|
|
|
</head>
|
|
|
|
|
|
|
|
<body onload="runTest();"></body>
|
|
|
|
|
|
|
|
</html>
|