- Revision
- 89466
- Author
- [email protected]
- Date
- 2011-06-22 13:09:05 -0700 (Wed, 22 Jun 2011)
Log Message
2011-06-22 Kentaro Hara <[email protected]>
Reviewed by Tony Chang.
Check |keypath| argument of createObjectStore(). Remove storage/indexeddb/keypath-as-array.html.
https://bugs.webkit.org/show_bug.cgi?id=63054
At the head of createObjectStore(), we parse |keypath| argument and throw an exception
if the |keypath| is invalid. With this parsing, we remove keypath-as-array.html because
the current keypath parser does not support an array of keypath and (more importantly)
the current implementation of ObjectStore does not support multiple keypaths.
We added keypath-basics.html that demonstrates that we do not support an array of keypaths.
* storage/indexeddb/keypath-as-array-expected.txt: Removed.
* storage/indexeddb/keypath-as-array.html: Removed.
* storage/indexeddb/keypath-basics-expected.txt: Added.
* storage/indexeddb/keypath-basics.html: Added.
2011-06-22 Kentaro Hara <[email protected]>
Reviewed by Tony Chang.
Check |keypath| argument of createObjectStore(). Remove storage/indexeddb/keypath-as-array.html.
https://bugs.webkit.org/show_bug.cgi?id=63054
At the head of createObjectStore(), we parse |keypath| argument and throw an exception
if the |keypath| is invalid. With this parsing, we remove keypath-as-array.html because
the current keypath parser does not support an array of keypath and (more importantly)
the current implementation of ObjectStore does not support multiple keypaths.
We added keypath-basics.html that demonstrates that we do not support an array of keypaths.
Tests: storage/indexeddb/keypath-basics.html
* storage/IDBDatabase.cpp:
(WebCore::IDBDatabase::createObjectStore):
* storage/IDBKeyPath.cpp:
(WebCore::IDBIsValidKeyPath):
* storage/IDBKeyPath.h:
Modified Paths
Added Paths
Removed Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (89465 => 89466)
--- trunk/LayoutTests/ChangeLog 2011-06-22 20:07:37 UTC (rev 89465)
+++ trunk/LayoutTests/ChangeLog 2011-06-22 20:09:05 UTC (rev 89466)
@@ -1,3 +1,21 @@
+2011-06-22 Kentaro Hara <[email protected]>
+
+ Reviewed by Tony Chang.
+
+ Check |keypath| argument of createObjectStore(). Remove storage/indexeddb/keypath-as-array.html.
+ https://bugs.webkit.org/show_bug.cgi?id=63054
+
+ At the head of createObjectStore(), we parse |keypath| argument and throw an exception
+ if the |keypath| is invalid. With this parsing, we remove keypath-as-array.html because
+ the current keypath parser does not support an array of keypath and (more importantly)
+ the current implementation of ObjectStore does not support multiple keypaths.
+ We added keypath-basics.html that demonstrates that we do not support an array of keypaths.
+
+ * storage/indexeddb/keypath-as-array-expected.txt: Removed.
+ * storage/indexeddb/keypath-as-array.html: Removed.
+ * storage/indexeddb/keypath-basics-expected.txt: Added.
+ * storage/indexeddb/keypath-basics.html: Added.
+
2011-06-22 Geoffrey Garen <[email protected]>
Reviewed by Oliver Hunt.
Deleted: trunk/LayoutTests/storage/indexeddb/keypath-as-array-expected.txt (89465 => 89466)
--- trunk/LayoutTests/storage/indexeddb/keypath-as-array-expected.txt 2011-06-22 20:07:37 UTC (rev 89465)
+++ trunk/LayoutTests/storage/indexeddb/keypath-as-array-expected.txt 2011-06-22 20:09:05 UTC (rev 89466)
@@ -1,28 +0,0 @@
-Test IndexedDB key path corner cases
-
-On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-
-
-indexedDB = window.indexedDB || window.webkitIndexedDB || window.mozIndexedDB;
-PASS indexedDB == null is false
-IDBDatabaseException = window.IDBDatabaseException || window.webkitIDBDatabaseException;
-PASS IDBDatabaseException == null is false
-IDBCursor = window.IDBCursor || window.webkitIDBCursor;
-PASS IDBCursor == null is false
-IDBKeyRange = window.IDBKeyRange || window.webkitIDBKeyRange;
-PASS IDBKeyRange == null is false
-indexedDB.open(name, description)
-db = event.target.result
-request = db.setVersion('1')
-Deleted all object stores.
-test keypath as array
-db.createObjectStore('foo', {keyPath: ['foo'], autoIncrement: true})
-db.createObjectStore('foobar', {keyPath: ['foo', 'bar'], autoIncrement: true})
-db.createObjectStore('empty', {keyPath: [], autoIncrement: true})
-db.createObjectStore('nested', {keyPath: [[]], autoIncrement: true})
-db.createObjectStore('arrayofempty', {keyPath: ['', ''], autoIncrement: true})
-db.createObjectStore('arrayoffloat', {keyPath: [1.0, 2.0], autoIncrement: true})
-PASS successfullyParsed is true
-
-TEST COMPLETE
-
Added: trunk/LayoutTests/storage/indexeddb/keypath-basics-expected.txt (0 => 89466)
--- trunk/LayoutTests/storage/indexeddb/keypath-basics-expected.txt (rev 0)
+++ trunk/LayoutTests/storage/indexeddb/keypath-basics-expected.txt 2011-06-22 20:09:05 UTC (rev 89466)
@@ -0,0 +1,60 @@
+Test for valid and invalid keypaths
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+indexedDB = window.indexedDB || window.webkitIndexedDB || window.mozIndexedDB;
+PASS indexedDB == null is false
+IDBDatabaseException = window.IDBDatabaseException || window.webkitIDBDatabaseException;
+PASS IDBDatabaseException == null is false
+IDBCursor = window.IDBCursor || window.webkitIDBCursor;
+PASS IDBCursor == null is false
+IDBKeyRange = window.IDBKeyRange || window.webkitIDBKeyRange;
+PASS IDBKeyRange == null is false
+indexedDB.open(name, description)
+db = event.target.result
+request = db.setVersion('1')
+Deleted all object stores.
+db.createObjectStore('name', {keyPath: globalKeyPath})
+Deleted all object stores.
+db.createObjectStore('name', {keyPath: globalKeyPath})
+Deleted all object stores.
+db.createObjectStore('name', {keyPath: globalKeyPath})
+Deleted all object stores.
+db.createObjectStore('name', {keyPath: globalKeyPath})
+Deleted all object stores.
+db.createObjectStore('name', {keyPath: globalKeyPath})
+Deleted all object stores.
+Deleted all object stores.
+Expecting exception from db.createObjectStore('name', {keyPath: globalKeyPath})
+PASS Exception was thrown.
+PASS code is IDBDatabaseException.NON_TRANSIENT_ERR
+Deleted all object stores.
+Expecting exception from db.createObjectStore('name', {keyPath: globalKeyPath})
+PASS Exception was thrown.
+PASS code is IDBDatabaseException.NON_TRANSIENT_ERR
+Deleted all object stores.
+Expecting exception from db.createObjectStore('name', {keyPath: globalKeyPath})
+PASS Exception was thrown.
+PASS code is IDBDatabaseException.NON_TRANSIENT_ERR
+Deleted all object stores.
+Expecting exception from db.createObjectStore('name', {keyPath: globalKeyPath})
+PASS Exception was thrown.
+PASS code is IDBDatabaseException.NON_TRANSIENT_ERR
+Deleted all object stores.
+Expecting exception from db.createObjectStore('name', {keyPath: globalKeyPath})
+PASS Exception was thrown.
+PASS code is IDBDatabaseException.NON_TRANSIENT_ERR
+Deleted all object stores.
+Expecting exception from db.createObjectStore('name', {keyPath: globalKeyPath})
+PASS Exception was thrown.
+PASS code is IDBDatabaseException.NON_TRANSIENT_ERR
+Deleted all object stores.
+Expecting exception from db.createObjectStore('name', {keyPath: globalKeyPath})
+PASS Exception was thrown.
+PASS code is IDBDatabaseException.NON_TRANSIENT_ERR
+Deleted all object stores.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Modified: trunk/Source/WebCore/ChangeLog (89465 => 89466)
--- trunk/Source/WebCore/ChangeLog 2011-06-22 20:07:37 UTC (rev 89465)
+++ trunk/Source/WebCore/ChangeLog 2011-06-22 20:09:05 UTC (rev 89466)
@@ -1,3 +1,24 @@
+2011-06-22 Kentaro Hara <[email protected]>
+
+ Reviewed by Tony Chang.
+
+ Check |keypath| argument of createObjectStore(). Remove storage/indexeddb/keypath-as-array.html.
+ https://bugs.webkit.org/show_bug.cgi?id=63054
+
+ At the head of createObjectStore(), we parse |keypath| argument and throw an exception
+ if the |keypath| is invalid. With this parsing, we remove keypath-as-array.html because
+ the current keypath parser does not support an array of keypath and (more importantly)
+ the current implementation of ObjectStore does not support multiple keypaths.
+ We added keypath-basics.html that demonstrates that we do not support an array of keypaths.
+
+ Tests: storage/indexeddb/keypath-basics.html
+
+ * storage/IDBDatabase.cpp:
+ (WebCore::IDBDatabase::createObjectStore):
+ * storage/IDBKeyPath.cpp:
+ (WebCore::IDBIsValidKeyPath):
+ * storage/IDBKeyPath.h:
+
2011-06-22 Young Han Lee <[email protected]>
Reviewed by Simon Fraser.
Modified: trunk/Source/WebCore/storage/IDBDatabase.cpp (89465 => 89466)
--- trunk/Source/WebCore/storage/IDBDatabase.cpp 2011-06-22 20:07:37 UTC (rev 89465)
+++ trunk/Source/WebCore/storage/IDBDatabase.cpp 2011-06-22 20:09:05 UTC (rev 89466)
@@ -35,6 +35,7 @@
#include "IDBEventDispatcher.h"
#include "IDBFactoryBackendInterface.h"
#include "IDBIndex.h"
+#include "IDBKeyPath.h"
#include "IDBObjectStore.h"
#include "IDBVersionChangeEvent.h"
#include "IDBVersionChangeRequest.h"
@@ -81,6 +82,11 @@
String keyPath;
options.getKeyString("keyPath", keyPath);
+ if (!IDBIsValidKeyPath(keyPath)) {
+ ec = IDBDatabaseException::NON_TRANSIENT_ERR;
+ return 0;
+ }
+
bool autoIncrement = false;
options.getKeyBool("autoIncrement", autoIncrement);
// FIXME: Look up evictable and pass that on as well.
Modified: trunk/Source/WebCore/storage/IDBKeyPath.cpp (89465 => 89466)
--- trunk/Source/WebCore/storage/IDBKeyPath.cpp 2011-06-22 20:07:37 UTC (rev 89465)
+++ trunk/Source/WebCore/storage/IDBKeyPath.cpp 2011-06-22 20:09:05 UTC (rev 89466)
@@ -158,6 +158,14 @@
return TokenNumber;
}
+bool IDBIsValidKeyPath(const String& keyPath)
+{
+ IDBKeyPathParseError error;
+ Vector<IDBKeyPathElement> keyPathElements;
+ IDBParseKeyPath(keyPath, keyPathElements, error);
+ return error == IDBKeyPathParseErrorNone;
+}
+
void IDBParseKeyPath(const String& keyPath, Vector<IDBKeyPathElement>& elements, IDBKeyPathParseError& error)
{
// This is a simplified parser loosely based on LiteralParser.
Modified: trunk/Source/WebCore/storage/IDBKeyPath.h (89465 => 89466)
--- trunk/Source/WebCore/storage/IDBKeyPath.h 2011-06-22 20:07:37 UTC (rev 89465)
+++ trunk/Source/WebCore/storage/IDBKeyPath.h 2011-06-22 20:09:05 UTC (rev 89466)
@@ -55,6 +55,7 @@
IDBKeyPathParseErrorDot,
};
+bool IDBIsValidKeyPath(const String&);
void IDBParseKeyPath(const String&, Vector<IDBKeyPathElement>&, IDBKeyPathParseError&);
} // namespace WebCore