Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / storage / indexeddb / resources / invalid-keys.js
blob5a4d9f0363189e51a2f0592f4e00fc1968441296
1 if (this.importScripts) {
2     importScripts('../../../resources/js-test.js');
3     importScripts('shared.js');
6 description("Test IndexedDB invalid keys");
8 indexedDBTest(prepareDatabase);
9 function prepareDatabase()
11     db = event.target.result;
12     event.target.transaction.onabort = unexpectedAbortCallback;
13     objectStore = evalAndLog("db.createObjectStore('foo');");
14     testInvalidKeys();
17 function testInvalidKeys()
19     var invalidKeys = [
20         "void 0", // Undefined
21         "null", // Null
22         "(function() { return arguments; }())", // Arguments
23         "true", // Boolean
24         "false", // Boolean
25         "new Error", // Error
26         "function () {}", // Function
27         "JSON", // JSON
28         "Math", // Math
29         "NaN", // Number (special case)
30         "new Date(NaN)", // Date (special case)
31         "{}", // Object
32         "/regex/", // RegExp
33         "self", // global
34         "self.document", // HTMLDocument
35         "self.document.body" // HTMLBodyElement
36     ];
38     invalidKeys.forEach(function(key) {
39         evalAndExpectException("request = objectStore.put('value', " + key + ")", "0", "'DataError'");
40     });
42     finishJSTest();