mirror of
https://github.com/classilla/tenfourfox.git
synced 2024-09-10 11:54:40 +00:00
78 lines
1.3 KiB
HTML
78 lines
1.3 KiB
HTML
<!DOCTYPE HTML>
|
|
<html>
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<title>Test for bug 924104</title>
|
|
</head>
|
|
<body>
|
|
<div id="container"></div>
|
|
<script type="application/javascript;version=1.7">
|
|
|
|
var gStore;
|
|
|
|
function is(a, b, msg) {
|
|
alert((a === b ? 'OK' : 'KO') + ' ' + msg)
|
|
}
|
|
|
|
function ok(a, msg) {
|
|
alert((a ? 'OK' : 'KO')+ ' ' + msg)
|
|
}
|
|
|
|
function cbError() {
|
|
alert('KO error');
|
|
}
|
|
|
|
function finish() {
|
|
alert('DONE');
|
|
}
|
|
|
|
function testGetDataStores() {
|
|
navigator.getDataStores('foo').then(function(stores) {
|
|
gStore = stores[0];
|
|
runTest();
|
|
}, cbError);
|
|
}
|
|
|
|
function testBug924104() {
|
|
gStore
|
|
.add({})
|
|
.then(
|
|
function(index) {
|
|
ok(index, "store.add() created item" + index);
|
|
return gStore.get(index);
|
|
},
|
|
cbError)
|
|
.then(
|
|
function(obj) {
|
|
ok(true, "store.get() works");
|
|
var status = false;
|
|
try {
|
|
obj['foobar'] = 42;
|
|
status = true;
|
|
} catch(e) {}
|
|
ok(status, "Object is editable");
|
|
runTest();
|
|
},
|
|
cbError);
|
|
}
|
|
|
|
var tests = [
|
|
testGetDataStores,
|
|
testBug924104
|
|
];
|
|
|
|
function runTest() {
|
|
if (!tests.length) {
|
|
finish();
|
|
return;
|
|
}
|
|
|
|
var test = tests.shift();
|
|
test();
|
|
}
|
|
|
|
runTest();
|
|
</script>
|
|
</body>
|
|
</html>
|