Title: [97168] trunk
Revision
97168
Author
[email protected]
Date
2011-10-11 12:22:14 -0700 (Tue, 11 Oct 2011)

Log Message

IndexedDB: implement IDBFactory.cmp method
https://bugs.webkit.org/show_bug.cgi?id=62293

Patch by Joshua Bell <[email protected]> on 2011-10-11
Reviewed by Tony Chang.

Source/WebCore:

* storage/IDBFactory.cpp:
(WebCore::IDBFactory::cmp):
* storage/IDBFactory.h:
* storage/IDBFactory.idl:
* storage/IDBKey.cpp:
(WebCore::IDBKey::compare):
(WebCore::IDBKey::isLessThan):
(WebCore::IDBKey::isEqual):
* storage/IDBKey.h:

LayoutTests:

Check for IDBFactory.deleteDatabase (NYI) marked as FAIL. crbug.com/72002
Tests for array keys (NYI) marked as FAIL. crbug.com/99876
Tests for invalid key exception types marked as FAIL. crbug.com/98930

* storage/indexeddb/factory-basics-expected.txt:
* storage/indexeddb/factory-basics.html:

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (97167 => 97168)


--- trunk/LayoutTests/ChangeLog	2011-10-11 19:01:14 UTC (rev 97167)
+++ trunk/LayoutTests/ChangeLog	2011-10-11 19:22:14 UTC (rev 97168)
@@ -1,3 +1,17 @@
+2011-10-11  Joshua Bell  <[email protected]>
+
+        IndexedDB: implement IDBFactory.cmp method
+        https://bugs.webkit.org/show_bug.cgi?id=62293
+
+        Reviewed by Tony Chang.
+
+        Check for IDBFactory.deleteDatabase (NYI) marked as FAIL. crbug.com/72002
+        Tests for array keys (NYI) marked as FAIL. crbug.com/99876
+        Tests for invalid key exception types marked as FAIL. crbug.com/98930
+
+        * storage/indexeddb/factory-basics-expected.txt:
+        * storage/indexeddb/factory-basics.html:
+
 2011-10-11  Dimitri Glazkov  <[email protected]>
 
         [Chromium] Unbarf Win testers after ambiguous expectations were added in r97149.

Modified: trunk/LayoutTests/storage/indexeddb/factory-basics-expected.txt (97167 => 97168)


--- trunk/LayoutTests/storage/indexeddb/factory-basics-expected.txt	2011-10-11 19:01:14 UTC (rev 97167)
+++ trunk/LayoutTests/storage/indexeddb/factory-basics-expected.txt	2011-10-11 19:22:14 UTC (rev 97168)
@@ -5,6 +5,11 @@
 
 indexedDB = window.indexedDB || window.webkitIndexedDB || window.mozIndexedDB;
 PASS indexedDB == null is false
+PASS typeof indexedDB.open === 'function' is true
+PASS typeof indexedDB.cmp === 'function' is true
+PASS typeof indexedDB.getDatabaseNames === 'function' is true
+deleteDatabase API is not yet implemented, so this will fail:
+FAIL typeof indexedDB.deleteDatabase === 'function' should be true. Was false.
 indexedDB.getDatabaseNames()
 databaseNames = event.target.result
 PASS databaseNames.contains('storage/indexeddb/factory-basics') is false

Modified: trunk/LayoutTests/storage/indexeddb/factory-basics.html (97167 => 97168)


--- trunk/LayoutTests/storage/indexeddb/factory-basics.html	2011-10-11 19:01:14 UTC (rev 97167)
+++ trunk/LayoutTests/storage/indexeddb/factory-basics.html	2011-10-11 19:22:14 UTC (rev 97168)
@@ -14,12 +14,18 @@
 if (window.layoutTestController) 
     layoutTestController.waitUntilDone();
 
-
 function test()
 {
     indexedDB = evalAndLog("indexedDB = window.indexedDB || window.webkitIndexedDB || window.mozIndexedDB;");
     shouldBeFalse("indexedDB == null");
 
+    shouldBeTrue("typeof indexedDB.open === 'function'");
+    shouldBeTrue("typeof indexedDB.cmp === 'function'");
+    shouldBeTrue("typeof indexedDB.getDatabaseNames === 'function'");
+
+    debug("deleteDatabase API is not yet implemented, so this will fail:");
+    shouldBeTrue("typeof indexedDB.deleteDatabase === 'function'");
+
     name = 'storage/indexeddb/factory-basics';
     description = "My Test Database";
 
@@ -55,7 +61,7 @@
     shouldBeFalse("databaseNames.contains('DATABASE THAT DOES NOT EXIST')");
 
     // FIXME: test indexedDB.deleteDatabase(databaseName)
-    // FIXME: test indexedDB.cmp(key1, key2)
+
     done();
 }
 

Added: trunk/LayoutTests/storage/indexeddb/factory-cmp-expected.txt (0 => 97168)


--- trunk/LayoutTests/storage/indexeddb/factory-cmp-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/storage/indexeddb/factory-cmp-expected.txt	2011-10-11 19:22:14 UTC (rev 97168)
@@ -0,0 +1,398 @@
+Test IndexedDB key comparison using IDBFactory.cmp().
+
+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
+PASS typeof indexedDB.cmp === 'function' is true
+
+compare valid keys
+(Array keys are not yet implemented so many tests will fail)
+PASS indexedDB.cmp(-Infinity,-Number.MAX_VALUE) === -1 is true
+PASS indexedDB.cmp(-Number.MAX_VALUE,-Infinity) === 1 is true
+PASS indexedDB.cmp(-Infinity,-Infinity) === 0 is true
+PASS indexedDB.cmp(-Number.MAX_VALUE,-Number.MAX_VALUE) === 0 is true
+PASS indexedDB.cmp(-Number.MAX_VALUE,-1) === -1 is true
+PASS indexedDB.cmp(-1,-Number.MAX_VALUE) === 1 is true
+PASS indexedDB.cmp(-Number.MAX_VALUE,-Number.MAX_VALUE) === 0 is true
+PASS indexedDB.cmp(-1,-1) === 0 is true
+PASS indexedDB.cmp(-1,-Number.MIN_VALUE) === -1 is true
+PASS indexedDB.cmp(-Number.MIN_VALUE,-1) === 1 is true
+PASS indexedDB.cmp(-1,-1) === 0 is true
+PASS indexedDB.cmp(-Number.MIN_VALUE,-Number.MIN_VALUE) === 0 is true
+PASS indexedDB.cmp(-Number.MIN_VALUE,0) === -1 is true
+PASS indexedDB.cmp(0,-Number.MIN_VALUE) === 1 is true
+PASS indexedDB.cmp(-Number.MIN_VALUE,-Number.MIN_VALUE) === 0 is true
+PASS indexedDB.cmp(0,0) === 0 is true
+PASS indexedDB.cmp(0,Number.MIN_VALUE) === -1 is true
+PASS indexedDB.cmp(Number.MIN_VALUE,0) === 1 is true
+PASS indexedDB.cmp(0,0) === 0 is true
+PASS indexedDB.cmp(Number.MIN_VALUE,Number.MIN_VALUE) === 0 is true
+PASS indexedDB.cmp(Number.MIN_VALUE,1) === -1 is true
+PASS indexedDB.cmp(1,Number.MIN_VALUE) === 1 is true
+PASS indexedDB.cmp(Number.MIN_VALUE,Number.MIN_VALUE) === 0 is true
+PASS indexedDB.cmp(1,1) === 0 is true
+PASS indexedDB.cmp(1,Number.MAX_VALUE) === -1 is true
+PASS indexedDB.cmp(Number.MAX_VALUE,1) === 1 is true
+PASS indexedDB.cmp(1,1) === 0 is true
+PASS indexedDB.cmp(Number.MAX_VALUE,Number.MAX_VALUE) === 0 is true
+PASS indexedDB.cmp(Number.MAX_VALUE,Infinity) === -1 is true
+PASS indexedDB.cmp(Infinity,Number.MAX_VALUE) === 1 is true
+PASS indexedDB.cmp(Number.MAX_VALUE,Number.MAX_VALUE) === 0 is true
+PASS indexedDB.cmp(Infinity,Infinity) === 0 is true
+PASS indexedDB.cmp(Infinity,new Date(0)) === -1 is true
+PASS indexedDB.cmp(new Date(0),Infinity) === 1 is true
+PASS indexedDB.cmp(Infinity,Infinity) === 0 is true
+PASS indexedDB.cmp(new Date(0),new Date(0)) === 0 is true
+PASS indexedDB.cmp(new Date(0),new Date(1000)) === -1 is true
+PASS indexedDB.cmp(new Date(1000),new Date(0)) === 1 is true
+PASS indexedDB.cmp(new Date(0),new Date(0)) === 0 is true
+PASS indexedDB.cmp(new Date(1000),new Date(1000)) === 0 is true
+PASS indexedDB.cmp(new Date(1000),new Date(1317399931023)) === -1 is true
+PASS indexedDB.cmp(new Date(1317399931023),new Date(1000)) === 1 is true
+PASS indexedDB.cmp(new Date(1000),new Date(1000)) === 0 is true
+PASS indexedDB.cmp(new Date(1317399931023),new Date(1317399931023)) === 0 is true
+PASS indexedDB.cmp(new Date(1317399931023),'') === -1 is true
+PASS indexedDB.cmp('',new Date(1317399931023)) === 1 is true
+PASS indexedDB.cmp(new Date(1317399931023),new Date(1317399931023)) === 0 is true
+PASS indexedDB.cmp('','') === 0 is true
+PASS indexedDB.cmp('','\0') === -1 is true
+PASS indexedDB.cmp('\0','') === 1 is true
+PASS indexedDB.cmp('','') === 0 is true
+PASS indexedDB.cmp('\0','\0') === 0 is true
+PASS indexedDB.cmp('\0','a') === -1 is true
+PASS indexedDB.cmp('a','\0') === 1 is true
+PASS indexedDB.cmp('\0','\0') === 0 is true
+PASS indexedDB.cmp('a','a') === 0 is true
+PASS indexedDB.cmp('a','aa') === -1 is true
+PASS indexedDB.cmp('aa','a') === 1 is true
+PASS indexedDB.cmp('a','a') === 0 is true
+PASS indexedDB.cmp('aa','aa') === 0 is true
+PASS indexedDB.cmp('aa','b') === -1 is true
+PASS indexedDB.cmp('b','aa') === 1 is true
+PASS indexedDB.cmp('aa','aa') === 0 is true
+PASS indexedDB.cmp('b','b') === 0 is true
+PASS indexedDB.cmp('b','ba') === -1 is true
+PASS indexedDB.cmp('ba','b') === 1 is true
+PASS indexedDB.cmp('b','b') === 0 is true
+PASS indexedDB.cmp('ba','ba') === 0 is true
+PASS indexedDB.cmp('ba','¢') === -1 is true
+PASS indexedDB.cmp('¢','ba') === 1 is true
+PASS indexedDB.cmp('ba','ba') === 0 is true
+PASS indexedDB.cmp('¢','¢') === 0 is true
+PASS indexedDB.cmp('¢','水') === -1 is true
+PASS indexedDB.cmp('水','¢') === 1 is true
+PASS indexedDB.cmp('¢','¢') === 0 is true
+PASS indexedDB.cmp('水','水') === 0 is true
+PASS indexedDB.cmp('水','𝄞') === -1 is true
+PASS indexedDB.cmp('𝄞','水') === 1 is true
+PASS indexedDB.cmp('水','水') === 0 is true
+PASS indexedDB.cmp('𝄞','𝄞') === 0 is true
+PASS indexedDB.cmp('𝄞','�') === -1 is true
+PASS indexedDB.cmp('�','𝄞') === 1 is true
+PASS indexedDB.cmp('𝄞','𝄞') === 0 is true
+PASS indexedDB.cmp('�','�') === 0 is true
+FAIL indexedDB.cmp('�',[]) === -1 should be true. Threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17
+FAIL indexedDB.cmp([],'�') === 1 should be true. Threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17
+PASS indexedDB.cmp('�','�') === 0 is true
+FAIL indexedDB.cmp([],[]) === 0 should be true. Threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17
+FAIL indexedDB.cmp([],[-Infinity]) === -1 should be true. Threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17
+FAIL indexedDB.cmp([-Infinity],[]) === 1 should be true. Threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17
+FAIL indexedDB.cmp([],[]) === 0 should be true. Threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17
+FAIL indexedDB.cmp([-Infinity],[-Infinity]) === 0 should be true. Threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17
+FAIL indexedDB.cmp([-Infinity],[-1.7976931348623157e+308]) === -1 should be true. Threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17
+FAIL indexedDB.cmp([-1.7976931348623157e+308],[-Infinity]) === 1 should be true. Threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17
+FAIL indexedDB.cmp([-Infinity],[-Infinity]) === 0 should be true. Threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17
+FAIL indexedDB.cmp([-1.7976931348623157e+308],[-1.7976931348623157e+308]) === 0 should be true. Threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17
+FAIL indexedDB.cmp([-1.7976931348623157e+308],[-1]) === -1 should be true. Threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17
+FAIL indexedDB.cmp([-1],[-1.7976931348623157e+308]) === 1 should be true. Threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17
+FAIL indexedDB.cmp([-1.7976931348623157e+308],[-1.7976931348623157e+308]) === 0 should be true. Threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17
+FAIL indexedDB.cmp([-1],[-1]) === 0 should be true. Threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17
+FAIL indexedDB.cmp([-1],[-5e-324]) === -1 should be true. Threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17
+FAIL indexedDB.cmp([-5e-324],[-1]) === 1 should be true. Threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17
+FAIL indexedDB.cmp([-1],[-1]) === 0 should be true. Threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17
+FAIL indexedDB.cmp([-5e-324],[-5e-324]) === 0 should be true. Threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17
+FAIL indexedDB.cmp([-5e-324],[0]) === -1 should be true. Threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17
+FAIL indexedDB.cmp([0],[-5e-324]) === 1 should be true. Threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17
+FAIL indexedDB.cmp([-5e-324],[-5e-324]) === 0 should be true. Threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17
+FAIL indexedDB.cmp([0],[0]) === 0 should be true. Threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17
+FAIL indexedDB.cmp([0],[5e-324]) === -1 should be true. Threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17
+FAIL indexedDB.cmp([5e-324],[0]) === 1 should be true. Threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17
+FAIL indexedDB.cmp([0],[0]) === 0 should be true. Threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17
+FAIL indexedDB.cmp([5e-324],[5e-324]) === 0 should be true. Threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17
+FAIL indexedDB.cmp([5e-324],[1]) === -1 should be true. Threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17
+FAIL indexedDB.cmp([1],[5e-324]) === 1 should be true. Threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17
+FAIL indexedDB.cmp([5e-324],[5e-324]) === 0 should be true. Threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17
+FAIL indexedDB.cmp([1],[1]) === 0 should be true. Threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17
+FAIL indexedDB.cmp([1],[1.7976931348623157e+308]) === -1 should be true. Threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17
+FAIL indexedDB.cmp([1.7976931348623157e+308],[1]) === 1 should be true. Threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17
+FAIL indexedDB.cmp([1],[1]) === 0 should be true. Threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17
+FAIL indexedDB.cmp([1.7976931348623157e+308],[1.7976931348623157e+308]) === 0 should be true. Threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17
+FAIL indexedDB.cmp([1.7976931348623157e+308],[Infinity]) === -1 should be true. Threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17
+FAIL indexedDB.cmp([Infinity],[1.7976931348623157e+308]) === 1 should be true. Threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17
+FAIL indexedDB.cmp([1.7976931348623157e+308],[1.7976931348623157e+308]) === 0 should be true. Threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17
+FAIL indexedDB.cmp([Infinity],[Infinity]) === 0 should be true. Threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17
+FAIL indexedDB.cmp([Infinity],[new Date(0)]) === -1 should be true. Threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17
+FAIL indexedDB.cmp([new Date(0)],[Infinity]) === 1 should be true. Threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17
+FAIL indexedDB.cmp([Infinity],[Infinity]) === 0 should be true. Threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17
+FAIL indexedDB.cmp([new Date(0)],[new Date(0)]) === 0 should be true. Threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17
+FAIL indexedDB.cmp([new Date(0)],[new Date(1000)]) === -1 should be true. Threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17
+FAIL indexedDB.cmp([new Date(1000)],[new Date(0)]) === 1 should be true. Threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17
+FAIL indexedDB.cmp([new Date(0)],[new Date(0)]) === 0 should be true. Threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17
+FAIL indexedDB.cmp([new Date(1000)],[new Date(1000)]) === 0 should be true. Threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17
+FAIL indexedDB.cmp([new Date(1000)],[new Date(1317399931023)]) === -1 should be true. Threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17
+FAIL indexedDB.cmp([new Date(1317399931023)],[new Date(1000)]) === 1 should be true. Threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17
+FAIL indexedDB.cmp([new Date(1000)],[new Date(1000)]) === 0 should be true. Threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17
+FAIL indexedDB.cmp([new Date(1317399931023)],[new Date(1317399931023)]) === 0 should be true. Threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17
+FAIL indexedDB.cmp([new Date(1317399931023)],['']) === -1 should be true. Threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17
+FAIL indexedDB.cmp([''],[new Date(1317399931023)]) === 1 should be true. Threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17
+FAIL indexedDB.cmp([new Date(1317399931023)],[new Date(1317399931023)]) === 0 should be true. Threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17
+FAIL indexedDB.cmp([''],['']) === 0 should be true. Threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17
+FAIL indexedDB.cmp([''],['\0']) === -1 should be true. Threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17
+FAIL indexedDB.cmp(['\0'],['']) === 1 should be true. Threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17
+FAIL indexedDB.cmp([''],['']) === 0 should be true. Threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17
+FAIL indexedDB.cmp(['\0'],['\0']) === 0 should be true. Threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17
+FAIL indexedDB.cmp(['\0'],['a']) === -1 should be true. Threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17
+FAIL indexedDB.cmp(['a'],['\0']) === 1 should be true. Threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17
+FAIL indexedDB.cmp(['\0'],['\0']) === 0 should be true. Threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17
+FAIL indexedDB.cmp(['a'],['a']) === 0 should be true. Threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17
+FAIL indexedDB.cmp(['a'],['aa']) === -1 should be true. Threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17
+FAIL indexedDB.cmp(['aa'],['a']) === 1 should be true. Threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17
+FAIL indexedDB.cmp(['a'],['a']) === 0 should be true. Threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17
+FAIL indexedDB.cmp(['aa'],['aa']) === 0 should be true. Threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17
+FAIL indexedDB.cmp(['aa'],['b']) === -1 should be true. Threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17
+FAIL indexedDB.cmp(['b'],['aa']) === 1 should be true. Threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17
+FAIL indexedDB.cmp(['aa'],['aa']) === 0 should be true. Threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17
+FAIL indexedDB.cmp(['b'],['b']) === 0 should be true. Threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17
+FAIL indexedDB.cmp(['b'],['ba']) === -1 should be true. Threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17
+FAIL indexedDB.cmp(['ba'],['b']) === 1 should be true. Threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17
+FAIL indexedDB.cmp(['b'],['b']) === 0 should be true. Threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17
+FAIL indexedDB.cmp(['ba'],['ba']) === 0 should be true. Threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17
+FAIL indexedDB.cmp(['ba'],['¢']) === -1 should be true. Threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17
+FAIL indexedDB.cmp(['¢'],['ba']) === 1 should be true. Threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17
+FAIL indexedDB.cmp(['ba'],['ba']) === 0 should be true. Threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17
+FAIL indexedDB.cmp(['¢'],['¢']) === 0 should be true. Threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17
+FAIL indexedDB.cmp(['¢'],['水']) === -1 should be true. Threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17
+FAIL indexedDB.cmp(['水'],['¢']) === 1 should be true. Threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17
+FAIL indexedDB.cmp(['¢'],['¢']) === 0 should be true. Threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17
+FAIL indexedDB.cmp(['水'],['水']) === 0 should be true. Threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17
+FAIL indexedDB.cmp(['水'],['𝄞']) === -1 should be true. Threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17
+FAIL indexedDB.cmp(['𝄞'],['水']) === 1 should be true. Threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17
+FAIL indexedDB.cmp(['水'],['水']) === 0 should be true. Threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17
+FAIL indexedDB.cmp(['𝄞'],['𝄞']) === 0 should be true. Threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17
+FAIL indexedDB.cmp(['𝄞'],['�']) === -1 should be true. Threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17
+FAIL indexedDB.cmp(['�'],['𝄞']) === 1 should be true. Threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17
+FAIL indexedDB.cmp(['𝄞'],['𝄞']) === 0 should be true. Threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17
+FAIL indexedDB.cmp(['�'],['�']) === 0 should be true. Threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17
+FAIL indexedDB.cmp(['�'],[[]]) === -1 should be true. Threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17
+FAIL indexedDB.cmp([[]],['�']) === 1 should be true. Threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17
+FAIL indexedDB.cmp(['�'],['�']) === 0 should be true. Threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17
+FAIL indexedDB.cmp([[]],[[]]) === 0 should be true. Threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17
+FAIL indexedDB.cmp([[]],[[], []]) === -1 should be true. Threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17
+FAIL indexedDB.cmp([[], []],[[]]) === 1 should be true. Threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17
+FAIL indexedDB.cmp([[]],[[]]) === 0 should be true. Threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17
+FAIL indexedDB.cmp([[], []],[[], []]) === 0 should be true. Threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17
+FAIL indexedDB.cmp([[], []],[[], [], []]) === -1 should be true. Threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17
+FAIL indexedDB.cmp([[], [], []],[[], []]) === 1 should be true. Threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17
+FAIL indexedDB.cmp([[], []],[[], []]) === 0 should be true. Threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17
+FAIL indexedDB.cmp([[], [], []],[[], [], []]) === 0 should be true. Threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17
+FAIL indexedDB.cmp([[], [], []],[[[]]]) === -1 should be true. Threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17
+FAIL indexedDB.cmp([[[]]],[[], [], []]) === 1 should be true. Threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17
+FAIL indexedDB.cmp([[], [], []],[[], [], []]) === 0 should be true. Threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17
+FAIL indexedDB.cmp([[[]]],[[[]]]) === 0 should be true. Threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17
+FAIL indexedDB.cmp([[[]]],[[[[]]]]) === -1 should be true. Threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17
+FAIL indexedDB.cmp([[[[]]]],[[[]]]) === 1 should be true. Threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17
+FAIL indexedDB.cmp([[[]]],[[[]]]) === 0 should be true. Threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17
+FAIL indexedDB.cmp([[[[]]]],[[[[]]]]) === 0 should be true. Threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17
+
+compare invalid keys
+Expecting exception from indexedDB.cmp(void 0, true)
+PASS Exception was thrown.
+FAIL code should be 5. Was 17.
+Expecting exception from indexedDB.cmp(true, void 0)
+PASS Exception was thrown.
+FAIL code should be 5. Was 17.
+Expecting exception from indexedDB.cmp(void 0, 'valid')
+PASS Exception was thrown.
+FAIL code should be 5. Was 17.
+Expecting exception from indexedDB.cmp('valid', void 0)
+PASS Exception was thrown.
+FAIL code should be 5. Was 17.
+Expecting exception from indexedDB.cmp(true, 'valid')
+PASS Exception was thrown.
+FAIL code should be 5. Was 17.
+Expecting exception from indexedDB.cmp('valid', true)
+PASS Exception was thrown.
+FAIL code should be 5. Was 17.
+Expecting exception from indexedDB.cmp(true, false)
+PASS Exception was thrown.
+FAIL code should be 5. Was 17.
+Expecting exception from indexedDB.cmp(false, true)
+PASS Exception was thrown.
+FAIL code should be 5. Was 17.
+Expecting exception from indexedDB.cmp(true, 'valid')
+PASS Exception was thrown.
+FAIL code should be 5. Was 17.
+Expecting exception from indexedDB.cmp('valid', true)
+PASS Exception was thrown.
+FAIL code should be 5. Was 17.
+Expecting exception from indexedDB.cmp(false, 'valid')
+PASS Exception was thrown.
+FAIL code should be 5. Was 17.
+Expecting exception from indexedDB.cmp('valid', false)
+PASS Exception was thrown.
+FAIL code should be 5. Was 17.
+Expecting exception from indexedDB.cmp(false, NaN)
+PASS Exception was thrown.
+FAIL code should be 5. Was 17.
+Expecting exception from indexedDB.cmp(NaN, false)
+PASS Exception was thrown.
+FAIL code should be 5. Was 17.
+Expecting exception from indexedDB.cmp(false, 'valid')
+PASS Exception was thrown.
+FAIL code should be 5. Was 17.
+Expecting exception from indexedDB.cmp('valid', false)
+PASS Exception was thrown.
+FAIL code should be 5. Was 17.
+Expecting exception from indexedDB.cmp(NaN, 'valid')
+PASS Exception was thrown.
+FAIL code should be 5. Was 17.
+Expecting exception from indexedDB.cmp('valid', NaN)
+PASS Exception was thrown.
+FAIL code should be 5. Was 17.
+Expecting exception from indexedDB.cmp(NaN, null)
+PASS Exception was thrown.
+FAIL code should be 5. Was 17.
+Expecting exception from indexedDB.cmp(null, NaN)
+PASS Exception was thrown.
+FAIL code should be 5. Was 17.
+Expecting exception from indexedDB.cmp(NaN, 'valid')
+PASS Exception was thrown.
+FAIL code should be 5. Was 17.
+Expecting exception from indexedDB.cmp('valid', NaN)
+PASS Exception was thrown.
+FAIL code should be 5. Was 17.
+Expecting exception from indexedDB.cmp(null, 'valid')
+PASS Exception was thrown.
+PASS code is IDBDatabaseException.DATA_ERR
+Expecting exception from indexedDB.cmp('valid', null)
+PASS Exception was thrown.
+PASS code is IDBDatabaseException.DATA_ERR
+Expecting exception from indexedDB.cmp(null, {})
+PASS Exception was thrown.
+FAIL code should be 5. Was 17.
+Expecting exception from indexedDB.cmp({}, null)
+PASS Exception was thrown.
+FAIL code should be 5. Was 17.
+Expecting exception from indexedDB.cmp(null, 'valid')
+PASS Exception was thrown.
+PASS code is IDBDatabaseException.DATA_ERR
+Expecting exception from indexedDB.cmp('valid', null)
+PASS Exception was thrown.
+PASS code is IDBDatabaseException.DATA_ERR
+Expecting exception from indexedDB.cmp({}, 'valid')
+PASS Exception was thrown.
+FAIL code should be 5. Was 17.
+Expecting exception from indexedDB.cmp('valid', {})
+PASS Exception was thrown.
+FAIL code should be 5. Was 17.
+Expecting exception from indexedDB.cmp({}, function () {})
+PASS Exception was thrown.
+FAIL code should be 5. Was 17.
+Expecting exception from indexedDB.cmp(function () {}, {})
+PASS Exception was thrown.
+FAIL code should be 5. Was 17.
+Expecting exception from indexedDB.cmp({}, 'valid')
+PASS Exception was thrown.
+FAIL code should be 5. Was 17.
+Expecting exception from indexedDB.cmp('valid', {})
+PASS Exception was thrown.
+FAIL code should be 5. Was 17.
+Expecting exception from indexedDB.cmp(function () {}, 'valid')
+PASS Exception was thrown.
+FAIL code should be 5. Was 17.
+Expecting exception from indexedDB.cmp('valid', function () {})
+PASS Exception was thrown.
+FAIL code should be 5. Was 17.
+Expecting exception from indexedDB.cmp(function () {}, /regex/)
+PASS Exception was thrown.
+FAIL code should be 5. Was 17.
+Expecting exception from indexedDB.cmp(/regex/, function () {})
+PASS Exception was thrown.
+FAIL code should be 5. Was 17.
+Expecting exception from indexedDB.cmp(function () {}, 'valid')
+PASS Exception was thrown.
+FAIL code should be 5. Was 17.
+Expecting exception from indexedDB.cmp('valid', function () {})
+PASS Exception was thrown.
+FAIL code should be 5. Was 17.
+Expecting exception from indexedDB.cmp(/regex/, 'valid')
+PASS Exception was thrown.
+FAIL code should be 5. Was 17.
+Expecting exception from indexedDB.cmp('valid', /regex/)
+PASS Exception was thrown.
+FAIL code should be 5. Was 17.
+Expecting exception from indexedDB.cmp(/regex/, window)
+PASS Exception was thrown.
+FAIL code should be 5. Was 17.
+Expecting exception from indexedDB.cmp(window, /regex/)
+PASS Exception was thrown.
+FAIL code should be 5. Was 17.
+Expecting exception from indexedDB.cmp(/regex/, 'valid')
+PASS Exception was thrown.
+FAIL code should be 5. Was 17.
+Expecting exception from indexedDB.cmp('valid', /regex/)
+PASS Exception was thrown.
+FAIL code should be 5. Was 17.
+Expecting exception from indexedDB.cmp(window, 'valid')
+PASS Exception was thrown.
+FAIL code should be 5. Was 17.
+Expecting exception from indexedDB.cmp('valid', window)
+PASS Exception was thrown.
+FAIL code should be 5. Was 17.
+Expecting exception from indexedDB.cmp(window, window.document)
+PASS Exception was thrown.
+FAIL code should be 5. Was 17.
+Expecting exception from indexedDB.cmp(window.document, window)
+PASS Exception was thrown.
+FAIL code should be 5. Was 17.
+Expecting exception from indexedDB.cmp(window, 'valid')
+PASS Exception was thrown.
+FAIL code should be 5. Was 17.
+Expecting exception from indexedDB.cmp('valid', window)
+PASS Exception was thrown.
+FAIL code should be 5. Was 17.
+Expecting exception from indexedDB.cmp(window.document, 'valid')
+PASS Exception was thrown.
+FAIL code should be 5. Was 17.
+Expecting exception from indexedDB.cmp('valid', window.document)
+PASS Exception was thrown.
+FAIL code should be 5. Was 17.
+Expecting exception from indexedDB.cmp(window.document, window.document.body)
+PASS Exception was thrown.
+FAIL code should be 5. Was 17.
+Expecting exception from indexedDB.cmp(window.document.body, window.document)
+PASS Exception was thrown.
+FAIL code should be 5. Was 17.
+Expecting exception from indexedDB.cmp(window.document, 'valid')
+PASS Exception was thrown.
+FAIL code should be 5. Was 17.
+Expecting exception from indexedDB.cmp('valid', window.document)
+PASS Exception was thrown.
+FAIL code should be 5. Was 17.
+Expecting exception from indexedDB.cmp(window.document.body, 'valid')
+PASS Exception was thrown.
+FAIL code should be 5. Was 17.
+Expecting exception from indexedDB.cmp('valid', window.document.body)
+PASS Exception was thrown.
+FAIL code should be 5. Was 17.
+
+compare identical keys
+PASS indexedDB.cmp(0, -0) === 0 is true
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/storage/indexeddb/factory-cmp.html (0 => 97168)


--- trunk/LayoutTests/storage/indexeddb/factory-cmp.html	                        (rev 0)
+++ trunk/LayoutTests/storage/indexeddb/factory-cmp.html	2011-10-11 19:22:14 UTC (rev 97168)
@@ -0,0 +1,161 @@
+<html>
+<head>
+<link rel="stylesheet" href=""
+<script src=""
+<script src=""
+<script src=""
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script>
+
+description("Test IndexedDB key comparison using IDBFactory.cmp().");
+if (window.layoutTestController) 
+    layoutTestController.waitUntilDone();
+
+function test()
+{
+    indexedDB = evalAndLog("indexedDB = window.indexedDB || window.webkitIndexedDB || window.mozIndexedDB;");
+    shouldBeFalse("indexedDB == null");
+    IDBDatabaseException = evalAndLog("IDBDatabaseException = window.IDBDatabaseException || window.webkitIDBDatabaseException;");
+    shouldBeFalse("IDBDatabaseException == null");
+
+    shouldBeTrue("typeof indexedDB.cmp === 'function'");
+
+    testValidKeys();
+    testInvalidKeys();
+    testIdenticalKeys();
+    done();
+}
+
+function testValidKeys()
+{
+    debug("");
+    debug("compare valid keys");
+
+    debug("(Array keys are not yet implemented so many tests will fail)");
+
+    var keys = [
+        "-Infinity",
+        "-Number.MAX_VALUE",
+        "-1",
+        "-Number.MIN_VALUE",
+        "0",
+        "Number.MIN_VALUE",
+        "1",
+        "Number.MAX_VALUE",
+        "Infinity",
+ 
+        "new Date(0)",
+        "new Date(1000)",
+        "new Date(1317399931023)",
+        
+        "''",
+        "'\x00'",
+        "'a'",
+        "'aa'",
+        "'b'",
+        "'ba'",
+
+        "'\xA2'", // U+00A2 CENT SIGN
+        "'\u6C34'", // U+6C34 CJK UNIFIED IDEOGRAPH (water)
+        "'\uD834\uDD1E'", // U+1D11E MUSICAL SYMBOL G-CLEF (UTF-16 surrogate pair)
+        "'\uFFFD'", // U+FFFD REPLACEMENT CHARACTER
+
+        // FIXME: Array keys are NYI, but these should pass once implemented
+        "[]",
+
+        "[-Infinity]",
+        "[-1.7976931348623157e+308]",
+        "[-1]",
+        "[-5e-324]",
+        "[0]",
+        "[5e-324]",
+        "[1]",
+        "[1.7976931348623157e+308]",
+        "[Infinity]",
+ 
+        "[new Date(0)]",
+        "[new Date(1000)]",
+        "[new Date(1317399931023)]",
+        
+        "['']",
+        "['\x00']",
+        "['a']",
+        "['aa']",
+        "['b']",
+        "['ba']",
+
+        "['\xA2']", // U+00A2 CENT SIGN
+        "['\u6C34']", // U+6C34 CJK UNIFIED IDEOGRAPH (water)
+        "['\uD834\uDD1E']", // U+1D11E MUSICAL SYMBOL G-CLEF (UTF-16 surrogate pair)
+        "['\uFFFD']", // U+FFFD REPLACEMENT CHARACTER
+
+        "[[]]",
+        
+        "[[], []]",
+        "[[], [], []]",
+
+        "[[[]]]",
+        "[[[[]]]]",
+    ];
+
+    var i, key1, key2;
+    for (i = 0; i < keys.length - 1; i += 1) {
+        key1 = keys[i];
+        key2 = keys[i + 1];
+        shouldBeTrue("indexedDB.cmp(" + key1 + "," + key2 + ") === -1");
+        shouldBeTrue("indexedDB.cmp(" + key2 + "," + key1 + ") === 1");
+        shouldBeTrue("indexedDB.cmp(" + key1 + "," + key1 + ") === 0");
+        shouldBeTrue("indexedDB.cmp(" + key2 + "," + key2 + ") === 0");
+    }
+}
+
+function testInvalidKeys()
+{
+    debug("");
+    debug("compare invalid keys");
+
+    var invalidKeys = [
+        "void 0", // undefined
+        "true",
+        "false",
+        "NaN",
+        "null",
+        "{}",
+        "function () {}",
+        "/regex/",
+        "window",
+        "window.document",
+        "window.document.body"
+    ];
+
+    var i, key1, key2;
+    for (i = 0; i < invalidKeys.length - 1; i += 1) {
+        key1 = invalidKeys[i];
+        key2 = invalidKeys[i + 1];
+        evalAndExpectException("indexedDB.cmp(" + key1 + ", " + key2 + ")", "IDBDatabaseException.DATA_ERR");
+        evalAndExpectException("indexedDB.cmp(" + key2 + ", " + key1 + ")", "IDBDatabaseException.DATA_ERR");
+        evalAndExpectException("indexedDB.cmp(" + key1 + ", 'valid')", "IDBDatabaseException.DATA_ERR");
+        evalAndExpectException("indexedDB.cmp('valid', " + key1 + ")", "IDBDatabaseException.DATA_ERR");
+        evalAndExpectException("indexedDB.cmp(" + key2 + ", 'valid')", "IDBDatabaseException.DATA_ERR");
+        evalAndExpectException("indexedDB.cmp('valid', " + key2 + ")", "IDBDatabaseException.DATA_ERR");
+    }
+}
+
+function testIdenticalKeys()
+{
+    debug("");
+    debug("compare identical keys");
+
+    shouldBeTrue("indexedDB.cmp(0, -0) === 0");
+}
+
+var successfullyParsed = true;
+
+test();
+
+</script>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (97167 => 97168)


--- trunk/Source/WebCore/ChangeLog	2011-10-11 19:01:14 UTC (rev 97167)
+++ trunk/Source/WebCore/ChangeLog	2011-10-11 19:22:14 UTC (rev 97168)
@@ -1,3 +1,20 @@
+2011-10-11  Joshua Bell  <[email protected]>
+
+        IndexedDB: implement IDBFactory.cmp method
+        https://bugs.webkit.org/show_bug.cgi?id=62293
+
+        Reviewed by Tony Chang.
+
+        * storage/IDBFactory.cpp:
+        (WebCore::IDBFactory::cmp):
+        * storage/IDBFactory.h:
+        * storage/IDBFactory.idl:
+        * storage/IDBKey.cpp:
+        (WebCore::IDBKey::compare):
+        (WebCore::IDBKey::isLessThan):
+        (WebCore::IDBKey::isEqual):
+        * storage/IDBKey.h:
+
 2011-10-11  No'am Rosenthal  <[email protected]>
 
         [Texmap] TextureMapperGL leaves GL in a modified state.

Modified: trunk/Source/WebCore/storage/IDBFactory.cpp (97167 => 97168)


--- trunk/Source/WebCore/storage/IDBFactory.cpp	2011-10-11 19:01:14 UTC (rev 97167)
+++ trunk/Source/WebCore/storage/IDBFactory.cpp	2011-10-11 19:22:14 UTC (rev 97168)
@@ -39,6 +39,7 @@
 #include "IDBDatabase.h"
 #include "IDBDatabaseException.h"
 #include "IDBFactoryBackendInterface.h"
+#include "IDBKey.h"
 #include "IDBKeyRange.h"
 #include "IDBRequest.h"
 #include "Page.h"
@@ -97,6 +98,19 @@
     return request;
 }
 
+short IDBFactory::cmp(PassRefPtr<IDBKey> first, PassRefPtr<IDBKey> second, ExceptionCode& ec)
+{
+    ASSERT(first);
+    ASSERT(second);
+
+    if (first->type() == IDBKey::NullType || second->type() == IDBKey::NullType) {
+        ec = IDBDatabaseException::DATA_ERR;
+        return 0;
+    }    
+    
+    return static_cast<short>(first->compare(second.get()));
+}
+
 } // namespace WebCore
 
 #endif // ENABLE(INDEXED_DATABASE)

Modified: trunk/Source/WebCore/storage/IDBFactory.h (97167 => 97168)


--- trunk/Source/WebCore/storage/IDBFactory.h	2011-10-11 19:01:14 UTC (rev 97167)
+++ trunk/Source/WebCore/storage/IDBFactory.h	2011-10-11 19:22:14 UTC (rev 97168)
@@ -58,6 +58,8 @@
 
     PassRefPtr<IDBRequest> open(ScriptExecutionContext*, const String& name, ExceptionCode&);
 
+    short cmp(PassRefPtr<IDBKey> first, PassRefPtr<IDBKey> second, ExceptionCode&);
+
 private:
     IDBFactory(IDBFactoryBackendInterface*);
 

Modified: trunk/Source/WebCore/storage/IDBFactory.idl (97167 => 97168)


--- trunk/Source/WebCore/storage/IDBFactory.idl	2011-10-11 19:01:14 UTC (rev 97167)
+++ trunk/Source/WebCore/storage/IDBFactory.idl	2011-10-11 19:22:14 UTC (rev 97168)
@@ -32,6 +32,9 @@
 
         [CallWith=ScriptExecutionContext] IDBRequest open(in DOMString name)
             raises (IDBDatabaseException);
+
+        short cmp(in IDBKey first, in IDBKey second)
+            raises (IDBDatabaseException);
     };
 
 }

Modified: trunk/Source/WebCore/storage/IDBKey.cpp (97167 => 97168)


--- trunk/Source/WebCore/storage/IDBKey.cpp	2011-10-11 19:01:14 UTC (rev 97167)
+++ trunk/Source/WebCore/storage/IDBKey.cpp	2011-10-11 19:22:14 UTC (rev 97168)
@@ -39,47 +39,41 @@
 {
 }
 
-bool IDBKey::isLessThan(const IDBKey* other) const
+int IDBKey::compare(const IDBKey* other) const
 {
     ASSERT(other);
-    if (other->m_type < m_type)
-        return true;
-    if (other->m_type > m_type)
-        return false;
+    if (m_type != other->m_type)
+        return m_type > other->m_type ? -1 : 1;
 
     switch (m_type) {
     case StringType:
-        return codePointCompare(other->m_string, m_string) > 0;
+        return -codePointCompare(other->m_string, m_string);
     case DateType:
-        return other->m_date > m_date;
+        return (m_date < other->m_date) ? -1 :
+                (m_date > other->m_date) ? 1 : 0;
     case NumberType:
-        return other->m_number > m_number;
+        return (m_number < other->m_number) ? -1 :
+                (m_number > other-> m_number) ? 1 : 0;
     case NullType:
-        return true;
+        return 0;
     }
 
     ASSERT_NOT_REACHED();
-    return false;
+    return 0;
 }
 
+bool IDBKey::isLessThan(const IDBKey* other) const
+{
+    ASSERT(other);
+    return compare(other) == -1;
+}
+
 bool IDBKey::isEqual(const IDBKey* other) const
 {
-    if (!other || other->m_type != m_type)
+    if (!other)
         return false;
 
-    switch (m_type) {
-    case StringType:
-        return other->m_string == m_string;
-    case DateType:
-        return other->m_date == m_date;
-    case NumberType:
-        return other->m_number == m_number;
-    case NullType:
-        return true;
-    }
-
-    ASSERT_NOT_REACHED();
-    return false;
+    return !compare(other);
 }
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/storage/IDBKey.h (97167 => 97168)


--- trunk/Source/WebCore/storage/IDBKey.h	2011-10-11 19:01:14 UTC (rev 97167)
+++ trunk/Source/WebCore/storage/IDBKey.h	2011-10-11 19:22:14 UTC (rev 97168)
@@ -97,6 +97,7 @@
         return m_number;
     }
 
+    int compare(const IDBKey* other) const;
     bool isLessThan(const IDBKey* other) const;
     bool isEqual(const IDBKey* other) const;
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to