blob: 5a4d9f0363189e51a2f0592f4e00fc1968441296 [file] [log] [blame]
if (this.importScripts) {
importScripts('../../../resources/js-test.js');
importScripts('shared.js');
}
description("Test IndexedDB invalid keys");
indexedDBTest(prepareDatabase);
function prepareDatabase()
{
db = event.target.result;
event.target.transaction.onabort = unexpectedAbortCallback;
objectStore = evalAndLog("db.createObjectStore('foo');");
testInvalidKeys();
}
function testInvalidKeys()
{
var invalidKeys = [
"void 0", // Undefined
"null", // Null
"(function() { return arguments; }())", // Arguments
"true", // Boolean
"false", // Boolean
"new Error", // Error
"function () {}", // Function
"JSON", // JSON
"Math", // Math
"NaN", // Number (special case)
"new Date(NaN)", // Date (special case)
"{}", // Object
"/regex/", // RegExp
"self", // global
"self.document", // HTMLDocument
"self.document.body" // HTMLBodyElement
];
invalidKeys.forEach(function(key) {
evalAndExpectException("request = objectStore.put('value', " + key + ")", "0", "'DataError'");
});
finishJSTest();
}