Revision fb690bc22dd76408313b02fc08b55cbdf3350c22 authored by jgraham on 03 January 2014, 16:04:38 UTC, committed by jgraham on 03 January 2014, 16:04:38 UTC
Add tool for generating test list in JSON format
idbobjectstore_add14.htm
<!DOCTYPE html>
<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="content-type" />
<title> IDBObjectStore.add() - Attempt to add a record where a value being indexed does not meet the constraints of a valid key </title>
<script type="text/javascript" src="support.js"></script>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script type="text/javascript">
var objectStoreName = "objectstore";
var indexName = "index";
var records = [{indexedProperty:{property:"data"}},
{indexedProperty:"string"},
{indexedProperty:1},
{indexedProperty:new Date()},
{indexedProperty:new RegExp(/test/i)},
{indexedProperty:[{property:"data"}]}];var record = {key:1, indexedProperty:{property:"data"}};
var db = null;
var t = async_test();
function RunTest() {
var rqOpen = window.indexedDB.open(databaseName, databaseVersion);
rqOpen.onupgradeneeded = t.step_func(function(event) {
db = event.target.result;
db.onerror = t.step_func(assert_database_error);
var objStore = db.createObjectStore(objectStoreName, {autoIncrement:true});
var index = objStore.createIndex(indexName, "indexedProperty");
for(var i = 0; i < records.length; i++) {
objStore.add(records[i]);
}
var rqCount = index.count();
rqCount.onsuccess = t.step_func(function(event) {
assert_equals(event.target.result, 3, 'event.target.result');
t.done();
});
});
rqOpen.onerror = t.step_func(assert_open_request_error);
}
add_completion_callback(function() { if(db) db.close(); });
setup(function() {
var rqDelete = window.indexedDB.deleteDatabase(databaseName);
rqDelete.onsuccess = t.step_func( RunTest );
});
</script>
</head>
<body>
<div id="log"></div>
</body>
</html>
![swh spinner](/static/img/swh-spinner.gif)
Computing file changes ...