Diff
Modified: trunk/LayoutTests/ChangeLog (122126 => 122127)
--- trunk/LayoutTests/ChangeLog 2012-07-09 18:58:55 UTC (rev 122126)
+++ trunk/LayoutTests/ChangeLog 2012-07-09 19:04:03 UTC (rev 122127)
@@ -1,3 +1,17 @@
+2012-07-09 Joshua Bell <[email protected]>
+
+ IndexedDB: Empty arrays shouldn't be valid key paths
+ https://bugs.webkit.org/show_bug.cgi?id=90798
+
+ Reviewed by Tony Chang.
+
+ * storage/indexeddb/keypath-arrays-expected.txt:
+ * storage/indexeddb/keypath-basics-expected.txt:
+ * storage/indexeddb/resources/keypath-arrays.js:
+ (openSuccess.request.onsuccess):
+ (openSuccess):
+ * storage/indexeddb/resources/keypath-basics.js:
+
2012-07-09 Zan Dobersek <[email protected]>
[Gtk] Unskip the CSS Regions layout tests
Modified: trunk/LayoutTests/storage/indexeddb/keypath-arrays-expected.txt (122126 => 122127)
--- trunk/LayoutTests/storage/indexeddb/keypath-arrays-expected.txt 2012-07-09 18:58:55 UTC (rev 122126)
+++ trunk/LayoutTests/storage/indexeddb/keypath-arrays-expected.txt 2012-07-09 19:04:03 UTC (rev 122127)
@@ -20,6 +20,14 @@
PASS Exception was thrown.
PASS code is DOMException.NOT_SUPPORTED_ERR
+Empty arrays are not valid key paths:
+Expecting exception from db.createObjectStore('store-keypath-empty-array', {keyPath: []})
+PASS Exception was thrown.
+PASS code is DOMException.SYNTAX_ERR
+Expecting exception from store.createIndex('index-keypath-empty-array', [])
+PASS Exception was thrown.
+PASS code is DOMException.SYNTAX_ERR
+
testKeyPaths():
transaction = db.transaction(['store'], 'readwrite')
store = transaction.objectStore('store')
Modified: trunk/LayoutTests/storage/indexeddb/keypath-basics-expected.txt (122126 => 122127)
--- trunk/LayoutTests/storage/indexeddb/keypath-basics-expected.txt 2012-07-09 18:58:55 UTC (rev 122126)
+++ trunk/LayoutTests/storage/indexeddb/keypath-basics-expected.txt 2012-07-09 19:04:03 UTC (rev 122127)
@@ -48,10 +48,6 @@
PASS Exception was thrown.
PASS code is DOMException.INVALID_ACCESS_ERR
Deleted all object stores.
-Expecting exception from store = db.createObjectStore('storeName', {autoIncrement: true, keyPath: []})
-PASS Exception was thrown.
-PASS code is DOMException.INVALID_ACCESS_ERR
-Deleted all object stores.
Expecting exception from store = db.createObjectStore('storeName', {autoIncrement: true, keyPath: ['a']})
PASS Exception was thrown.
PASS code is DOMException.INVALID_ACCESS_ERR
@@ -132,6 +128,13 @@
PASS Exception was thrown.
PASS code is DOMException.SYNTAX_ERR
Deleted all object stores.
+Expecting exception from db.createObjectStore('name', {keyPath: []})
+PASS Exception was thrown.
+PASS code is DOMException.SYNTAX_ERR
+Expecting exception from db.createObjectStore('name').createIndex('name', [])
+PASS Exception was thrown.
+PASS code is DOMException.SYNTAX_ERR
+Deleted all object stores.
PASS successfullyParsed is true
TEST COMPLETE
Modified: trunk/LayoutTests/storage/indexeddb/resources/keypath-arrays.js (122126 => 122127)
--- trunk/LayoutTests/storage/indexeddb/resources/keypath-arrays.js 2012-07-09 18:58:55 UTC (rev 122126)
+++ trunk/LayoutTests/storage/indexeddb/resources/keypath-arrays.js 2012-07-09 19:04:03 UTC (rev 122127)
@@ -34,6 +34,11 @@
evalAndExpectException("db.createObjectStore('store-with-generator', {keyPath: ['a', 'b'], autoIncrement: true})", "DOMException.INVALID_ACCESS_ERR");
evalAndExpectException("store.createIndex('index-multientry', ['e', 'f'], {multiEntry: true})", "DOMException.NOT_SUPPORTED_ERR");
+ debug("");
+ debug("Empty arrays are not valid key paths:");
+ evalAndExpectException("db.createObjectStore('store-keypath-empty-array', {keyPath: []})", "DOMException.SYNTAX_ERR");
+ evalAndExpectException("store.createIndex('index-keypath-empty-array', [])", "DOMException.SYNTAX_ERR");
+
transaction._oncomplete_ = testKeyPaths;
};
}
Modified: trunk/LayoutTests/storage/indexeddb/resources/keypath-basics.js (122126 => 122127)
--- trunk/LayoutTests/storage/indexeddb/resources/keypath-basics.js 2012-07-09 18:58:55 UTC (rev 122126)
+++ trunk/LayoutTests/storage/indexeddb/resources/keypath-basics.js 2012-07-09 19:04:03 UTC (rev 122127)
@@ -60,7 +60,7 @@
debug("");
debug("Object store key path may not be empty or an array if autoIncrement is true");
- testKeyPaths = ["''", "[]", "['a']", "['']"];
+ testKeyPaths = ["''", "['a']", "['']"];
testKeyPaths.forEach(function (keyPath) {
store = evalAndExpectException("store = db.createObjectStore('storeName', {autoIncrement: true, keyPath: " + keyPath + "})", "DOMException.INVALID_ACCESS_ERR");
deleteAllObjectStores(db);
@@ -68,7 +68,7 @@
debug("");
debug("Key paths which are never valid:");
- testKeyPaths = ["' '", "'foo '", "'foo bar'", "'foo. bar'", "'foo .bar'", "'foo..bar'", "'+foo'", "'foo%'", "'1'", "'1.0'"];
+ testKeyPaths = ["' '", "'foo '", "'foo bar'", "'foo. bar'", "'foo .bar'", "'foo..bar'", "'+foo'", "'foo%'", "'1'", "'1.0'", "[]"];
testKeyPaths.forEach(function (keyPath) {
evalAndExpectException("db.createObjectStore('name', {keyPath: " + keyPath + "})", "DOMException.SYNTAX_ERR");
evalAndExpectException("db.createObjectStore('name').createIndex('name', " + keyPath + ")", "DOMException.SYNTAX_ERR");
Modified: trunk/Source/WebCore/ChangeLog (122126 => 122127)
--- trunk/Source/WebCore/ChangeLog 2012-07-09 18:58:55 UTC (rev 122126)
+++ trunk/Source/WebCore/ChangeLog 2012-07-09 19:04:03 UTC (rev 122127)
@@ -1,3 +1,21 @@
+2012-07-09 Joshua Bell <[email protected]>
+
+ IndexedDB: Empty arrays shouldn't be valid key paths
+ https://bugs.webkit.org/show_bug.cgi?id=90798
+
+ Reviewed by Tony Chang.
+
+ Other IDB implementations already enforce this although it is not yet in
+ the spec (see https://www.w3.org/Bugs/Public/show_bug.cgi?id=17657). If an
+ empty array is passed as the key path arg to IDBDatabase.createObjectStore()
+ or IDBObjectStore.createIndex(), a SYNTAX_ERR DOMException is now thrown.
+
+ Test: storage/indexeddb/keypath-arrays.html
+ storage/indexeddb/keypath-basics.html
+
+ * Modules/indexeddb/IDBKeyPath.cpp:
+ (WebCore::IDBKeyPath::isValid): Test for empty array.
+
2012-07-09 Dana Jansens <[email protected]>
[chromium] Create render surfaces on main thread only for the current frame
Modified: trunk/Source/WebCore/Modules/indexeddb/IDBKeyPath.cpp (122126 => 122127)
--- trunk/Source/WebCore/Modules/indexeddb/IDBKeyPath.cpp 2012-07-09 18:58:55 UTC (rev 122126)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBKeyPath.cpp 2012-07-09 19:04:03 UTC (rev 122127)
@@ -207,6 +207,8 @@
return IDBIsValidKeyPath(m_string);
case ArrayType:
+ if (m_array.isEmpty())
+ return false;
for (size_t i = 0; i < m_array.size(); ++i) {
if (!IDBIsValidKeyPath(m_array[i]))
return false;