Modified: trunk/LayoutTests/ChangeLog (113394 => 113395)
--- trunk/LayoutTests/ChangeLog 2012-04-05 23:40:48 UTC (rev 113394)
+++ trunk/LayoutTests/ChangeLog 2012-04-05 23:54:06 UTC (rev 113395)
@@ -1,3 +1,23 @@
+2012-04-05 Joshua Bell <[email protected]>
+
+ IndexedDB: Support string.length in keyPaths
+ https://bugs.webkit.org/show_bug.cgi?id=83221
+
+ Reviewed by Kentaro Hara.
+
+ * storage/indexeddb/keypath-intrinsic-properties-expected.txt: Added.
+ * storage/indexeddb/keypath-intrinsic-properties.html: Added.
+ * storage/indexeddb/resources/keypath-intrinsic-properties.js: Added.
+ (test.request.onsuccess):
+ (test):
+ (openSuccess.request.onsuccess):
+ (openSuccess):
+ (testKeyPaths.checkStringLengths.request.onsuccess):
+ (testKeyPaths.checkStringLengths):
+ (testKeyPaths.checkArrayLengths.request.onsuccess):
+ (testKeyPaths.checkArrayLengths):
+ (testKeyPaths):
+
2012-04-05 Tony Chang <[email protected]>
[chromium] Unreviewed gardening. Remove some tests that are passing consistently.
Added: trunk/LayoutTests/storage/indexeddb/keypath-intrinsic-properties-expected.txt (0 => 113395)
--- trunk/LayoutTests/storage/indexeddb/keypath-intrinsic-properties-expected.txt (rev 0)
+++ trunk/LayoutTests/storage/indexeddb/keypath-intrinsic-properties-expected.txt 2012-04-05 23:54:06 UTC (rev 113395)
@@ -0,0 +1,41 @@
+Test IndexedDB keyPath with intrinsic properties
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+indexedDB = self.indexedDB || self.webkitIndexedDB || self.mozIndexedDB || self.msIndexedDB || self.OIndexedDB;
+
+indexedDB.deleteDatabase('keypath-intrinsic-properties')
+indexedDB.open('keypath-intrinsic-properties')
+
+openSuccess():
+db = event.target.result
+request = db.setVersion('1')
+store = db.createObjectStore('store', {keyPath: 'id'})
+store.createIndex('string length', 'string.length')
+store.createIndex('array length', 'array.length')
+
+testKeyPaths():
+transaction = db.transaction('store', IDBTransaction.READ_WRITE)
+store = transaction.objectStore('store')
+store.put({"id":"id#0","string":"","array":[]})
+store.put({"id":"id#1","string":"xx","array":["x","x","x"]})
+store.put({"id":"id#2","string":"xxxx","array":["x","x","x","x","x","x"]})
+store.put({"id":"id#3","string":"xxxxxx","array":["x","x","x","x","x","x","x","x","x"]})
+store.put({"id":"id#4","string":"xxxxxxxx","array":["x","x","x","x","x","x","x","x","x","x","x","x"]})
+request = store.index('string length').openCursor()
+PASS cursor.key is cursor.value.string.length
+PASS cursor.key is cursor.value.string.length
+PASS cursor.key is cursor.value.string.length
+PASS cursor.key is cursor.value.string.length
+PASS cursor.key is cursor.value.string.length
+request = store.index('array length').openCursor()
+PASS cursor.key is cursor.value.array.length
+PASS cursor.key is cursor.value.array.length
+PASS cursor.key is cursor.value.array.length
+PASS cursor.key is cursor.value.array.length
+PASS cursor.key is cursor.value.array.length
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/storage/indexeddb/keypath-intrinsic-properties.html (0 => 113395)
--- trunk/LayoutTests/storage/indexeddb/keypath-intrinsic-properties.html (rev 0)
+++ trunk/LayoutTests/storage/indexeddb/keypath-intrinsic-properties.html 2012-04-05 23:54:06 UTC (rev 113395)
@@ -0,0 +1,10 @@
+<html>
+<head>
+<script src=""
+<script src=""
+</head>
+<body>
+<script src=""
+<script src=""
+</body>
+</html>
Added: trunk/LayoutTests/storage/indexeddb/resources/keypath-intrinsic-properties.js (0 => 113395)
--- trunk/LayoutTests/storage/indexeddb/resources/keypath-intrinsic-properties.js (rev 0)
+++ trunk/LayoutTests/storage/indexeddb/resources/keypath-intrinsic-properties.js 2012-04-05 23:54:06 UTC (rev 113395)
@@ -0,0 +1,88 @@
+if (this.importScripts) {
+ importScripts('../../../fast/js/resources/js-test-pre.js');
+ importScripts('shared.js');
+}
+
+description("Test IndexedDB keyPath with intrinsic properties");
+
+function test()
+{
+ removeVendorPrefixes();
+
+ request = evalAndLog("indexedDB.deleteDatabase('keypath-intrinsic-properties')");
+ request._onerror_ = unexpectedErrorCallback;
+ request._onsuccess_ = function () {
+ request = evalAndLog("indexedDB.open('keypath-intrinsic-properties')");
+ request._onerror_ = unexpectedErrorCallback;
+ request._onsuccess_ = openSuccess;
+ };
+}
+
+function openSuccess()
+{
+ debug("");
+ debug("openSuccess():");
+ db = evalAndLog("db = event.target.result");
+ request = evalAndLog("request = db.setVersion('1')");
+ request._onerror_ = unexpectedErrorCallback;
+ request._onsuccess_ = function () {
+ transaction = request.result;
+ transaction._onabort_ = unexpectedAbortCallback;
+ evalAndLog("store = db.createObjectStore('store', {keyPath: 'id'})");
+ evalAndLog("store.createIndex('string length', 'string.length')");
+ evalAndLog("store.createIndex('array length', 'array.length')");
+
+ transaction._oncomplete_ = testKeyPaths;
+ };
+}
+
+function testKeyPaths()
+{
+ debug("");
+ debug("testKeyPaths():");
+
+ transaction = evalAndLog("transaction = db.transaction('store', IDBTransaction.READ_WRITE)");
+ transaction._onabort_ = unexpectedAbortCallback;
+ store = evalAndLog("store = transaction.objectStore('store')");
+
+ for (var i = 0; i < 5; i += 1) {
+ var datum = {
+ id: 'id#' + i,
+ string: Array(i * 2 + 1).join('x'),
+ array: Array(i * 3 + 1).join('x').split(/(?:)/)
+ };
+ evalAndLog("store.put("+JSON.stringify(datum)+")");
+ }
+
+ checkStringLengths();
+
+ function checkStringLengths() {
+ evalAndLog("request = store.index('string length').openCursor()");
+ request._onerror_ = unexpectedErrorCallback;
+ request._onsuccess_ = function (e) {
+ cursor = e.target.result;
+ if (cursor) {
+ shouldBe("cursor.key", "cursor.value.string.length");
+ cursor.continue();
+ } else {
+ checkArrayLengths();
+ }
+ }
+ }
+
+ function checkArrayLengths() {
+ evalAndLog("request = store.index('array length').openCursor()");
+ request._onerror_ = unexpectedErrorCallback;
+ request._onsuccess_ = function (e) {
+ cursor = e.target.result;
+ if (cursor) {
+ shouldBe("cursor.key", "cursor.value.array.length");
+ cursor.continue();
+ }
+ }
+ }
+
+ transaction._oncomplete_ = finishJSTest;
+}
+
+test();
Modified: trunk/Source/WebCore/ChangeLog (113394 => 113395)
--- trunk/Source/WebCore/ChangeLog 2012-04-05 23:40:48 UTC (rev 113394)
+++ trunk/Source/WebCore/ChangeLog 2012-04-05 23:54:06 UTC (rev 113395)
@@ -1,3 +1,20 @@
+2012-04-05 Joshua Bell <[email protected]>
+
+ IndexedDB: Support string.length in keyPaths
+ https://bugs.webkit.org/show_bug.cgi?id=83221
+
+ Special case in the IDB spec - keyPaths can reference the |length| property
+ of string values. Other instrinsic properties (|length| of Array, etc) are
+ handled automagically. Relevant section of the updated spec is:
+ http://dvcs.w3.org/hg/IndexedDB/raw-file/tip/Overview.html#key-path-construct
+
+ Reviewed by Kentaro Hara.
+
+ Test: storage/indexeddb/keypath-intrinsic-properties.html
+
+ * bindings/v8/IDBBindingUtilities.cpp:
+ (WebCore):
+
2012-04-05 Arvid Nilsson <[email protected]>
[BlackBerry] Update the InstrumentedPlatformCanvas after rebasing Skia
Modified: trunk/Source/WebCore/bindings/v8/IDBBindingUtilities.cpp (113394 => 113395)
--- trunk/Source/WebCore/bindings/v8/IDBBindingUtilities.cpp 2012-04-05 23:40:48 UTC (rev 113394)
+++ trunk/Source/WebCore/bindings/v8/IDBBindingUtilities.cpp 2012-04-05 23:54:06 UTC (rev 113395)
@@ -106,6 +106,11 @@
bool get(v8::Handle<v8::Value>& object, const String& keyPathElement)
{
+ if (object->IsString() && keyPathElement == "length") {
+ int32_t length = v8::Handle<v8::String>::Cast(object)->Length();
+ object = v8::Number::New(length);
+ return true;
+ }
return object->IsObject() && getValueFrom(v8String(keyPathElement), object);
}