Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(225)

Side by Side Diff: LayoutTests/storage/indexeddb/resources/keypath-arrays.js

Issue 1184503003: IndexedDB: Array-type keypaths should not be returned as DOMStringLists (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 if (this.importScripts) { 1 if (this.importScripts) {
2 importScripts('../../../resources/js-test.js'); 2 importScripts('../../../resources/js-test.js');
3 importScripts('shared.js'); 3 importScripts('shared.js');
4 } 4 }
5 5
6 description("Test IndexedDB Array-type keyPaths"); 6 description("Test IndexedDB Array-type keyPaths");
7 7
8 indexedDBTest(prepareDatabase, testKeyPaths); 8 indexedDBTest(prepareDatabase, testKeyPaths);
9 function prepareDatabase() 9 function prepareDatabase()
10 { 10 {
11 db = event.target.result; 11 db = event.target.result;
12 event.target.transaction.onabort = unexpectedAbortCallback; 12 event.target.transaction.onabort = unexpectedAbortCallback;
13 evalAndLog("store = db.createObjectStore('store', {keyPath: ['a', 'b']})"); 13 evalAndLog("store = db.createObjectStore('store', {keyPath: ['a', 'b']})");
14 evalAndLog("store.createIndex('index', ['c', 'd'])"); 14 evalAndLog("index = store.createIndex('index', ['c', 'd'])");
15
16 shouldBeTrue("areArraysEqual(index.keyPath, ['c', 'd'])");
17 shouldBeFalse("index.keyPath instanceof DOMStringList");
15 18
16 evalAndExpectException("db.createObjectStore('store-with-generator', {keyPat h: ['a', 'b'], autoIncrement: true})", "DOMException.INVALID_ACCESS_ERR"); 19 evalAndExpectException("db.createObjectStore('store-with-generator', {keyPat h: ['a', 'b'], autoIncrement: true})", "DOMException.INVALID_ACCESS_ERR");
17 evalAndExpectException("store.createIndex('index-multientry', ['e', 'f'], {m ultiEntry: true})", "DOMException.INVALID_ACCESS_ERR"); 20 evalAndExpectException("store.createIndex('index-multientry', ['e', 'f'], {m ultiEntry: true})", "DOMException.INVALID_ACCESS_ERR");
18 21
19 debug(""); 22 debug("");
20 debug("Empty arrays are not valid key paths:"); 23 debug("Empty arrays are not valid key paths:");
21 evalAndExpectException("db.createObjectStore('store-keypath-empty-array', {k eyPath: []})", "DOMException.SYNTAX_ERR"); 24 evalAndExpectException("db.createObjectStore('store-keypath-empty-array', {k eyPath: []})", "DOMException.SYNTAX_ERR");
22 evalAndExpectException("store.createIndex('index-keypath-empty-array', [])", "DOMException.SYNTAX_ERR"); 25 evalAndExpectException("store.createIndex('index-keypath-empty-array', [])", "DOMException.SYNTAX_ERR");
23 } 26 }
24 27
(...skipping 29 matching lines...) Expand all
54 request.onsuccess = function () { 57 request.onsuccess = function () {
55 evalAndLog("cursor = request.result"); 58 evalAndLog("cursor = request.result");
56 shouldBeNonNull("cursor"); 59 shouldBeNonNull("cursor");
57 shouldBeEqualToString("JSON.stringify(cursor.primaryKey)", "[1,2]"); 60 shouldBeEqualToString("JSON.stringify(cursor.primaryKey)", "[1,2]");
58 shouldBeEqualToString("JSON.stringify(cursor.key)", "[3,4]"); 61 shouldBeEqualToString("JSON.stringify(cursor.key)", "[3,4]");
59 }; 62 };
60 }; 63 };
61 64
62 transaction.oncomplete = finishJSTest; 65 transaction.oncomplete = finishJSTest;
63 } 66 }
OLDNEW
« no previous file with comments | « LayoutTests/storage/indexeddb/keypath-arrays-expected.txt ('k') | Source/bindings/modules/v8/V8BindingForModules.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698