[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-10851-g50815da

hans at chromium.org hans at chromium.org
Wed Dec 22 18:46:06 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 7e77539239209ec2c52504847e3f415d073c3ac9
Author: hans at chromium.org <hans at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Dec 17 15:10:21 2010 +0000

    2010-12-17  Hans Wennborg  <hans at chromium.org>
    
            Reviewed by Jeremy Orlow.
    
            IndexedDB: Support Date objects as keys.
            https://bugs.webkit.org/show_bug.cgi?id=51193
    
            Update layout tests to check that having Date objects as keys work.
    
            * storage/indexeddb/objectstore-basics-expected.txt:
            * storage/indexeddb/objectstore-basics.html:
    2010-12-17  Hans Wennborg  <hans at chromium.org>
    
            Reviewed by Jeremy Orlow.
    
            IndexedDB: Support Date objects as keys.
            https://bugs.webkit.org/show_bug.cgi?id=51193
    
            * bindings/v8/IDBBindingUtilities.cpp:
            (WebCore::createIDBKeyFromValue):
            Use the new IDBKey factory functions, and support Date objects.
            * bindings/v8/custom/V8IDBKeyCustom.cpp:
            (WebCore::toV8):
            Create Date objects from DateType keys.
            * storage/IDBKey.cpp:
            (WebCore::IDBKey::fromQuery):
            (WebCore::IDBKey::isEqual):
            (WebCore::IDBKey::whereSyntax):
            (WebCore::IDBKey::lowerCursorWhereFragment):
            (WebCore::IDBKey::upperCursorWhereFragment):
            (WebCore::IDBKey::bind):
            (WebCore::IDBKey::bindWithNulls):
            Update all SQL related functions to handle Date keys.
            * storage/IDBKey.h:
            (WebCore::IDBKey::createNull):
            (WebCore::IDBKey::createNumber):
            (WebCore::IDBKey::createString):
            (WebCore::IDBKey::createDate):
            Rename the create factories; since both number and date is just a
            double, function overloading can't be used to discriminate between
            the factories.
            (WebCore::IDBKey::date):
            Add getter for the date value.
    2010-12-17  Hans Wennborg  <hans at chromium.org>
    
            Reviewed by Jeremy Orlow.
    
            IndexedDB: Support Date objects as keys.
            https://bugs.webkit.org/show_bug.cgi?id=51193
    
            Update to match the underlying WebCore IDBKey class:
            add the DateType, add create() functions for each type,
            deprecate the public constructors (will be removed once
            Chromium side is updated).
    
            * public/WebIDBKey.h:
            (WebKit::WebIDBKey::WebIDBKey):
            * src/AssertMatchingEnums.cpp:
            * src/WebIDBKey.cpp:
            (WebKit::WebIDBKey::createString):
            (WebKit::WebIDBKey::createDate):
            (WebKit::WebIDBKey::createNumber):
            (WebKit::WebIDBKey::assignNull):
            (WebKit::WebIDBKey::assignString):
            (WebKit::WebIDBKey::assignDate):
            (WebKit::WebIDBKey::assignNumber):
            (WebKit::WebIDBKey::date):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@74266 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index b87eccb..125fc83 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,15 @@
+2010-12-17  Hans Wennborg  <hans at chromium.org>
+
+        Reviewed by Jeremy Orlow.
+
+        IndexedDB: Support Date objects as keys.
+        https://bugs.webkit.org/show_bug.cgi?id=51193
+
+        Update layout tests to check that having Date objects as keys work.
+
+        * storage/indexeddb/objectstore-basics-expected.txt:
+        * storage/indexeddb/objectstore-basics.html:
+
 2010-12-17  Sergio Villar Senin  <svillar at igalia.com>
 
         Unreviewed, tests were skipped due to a bug in libsoup
diff --git a/LayoutTests/storage/indexeddb/objectstore-basics-expected.txt b/LayoutTests/storage/indexeddb/objectstore-basics-expected.txt
index e736d2f..17746d3 100644
--- a/LayoutTests/storage/indexeddb/objectstore-basics-expected.txt
+++ b/LayoutTests/storage/indexeddb/objectstore-basics-expected.txt
@@ -98,22 +98,13 @@ PASS store.indexNames.item(100) is null
 transaction = db.transaction()
 store = transaction.objectStore('storeName')
 Try to insert data with a Date key:
-store.add({x: 'foo'}, new Date())
-PASS Exception thrown
-PASS code is DOMException.TYPE_MISMATCH_ERR
+store.add({x: 'foo'}, testDate)
 Try to insert a value not handled by structured clone:
 store.add({x: 'bar', y: document.getElementById('console')}, 'bar')
 PASS Exception thrown
 PASS code is DOMException.NOT_SUPPORTED_ERR
 Try to insert data where key path yields a Date key:
-store.add({x: new Date()}, 'foo')
-PASS Adding data where key path yielded Date key resulted in error.
-store.add({x: 'value'}, 'key')
-PASS 'onsuccess' in result is true
-PASS 'onerror' in result is true
-PASS 'readyState' in result is true
-An event should fire shortly...
-
+store.add({x: new Date(), y: 'value'}, 'key')
 addSuccess():
 Success event fired:
 PASS 'result' in event is true
@@ -127,7 +118,7 @@ PASS 'readyState' in event.target is true
 PASS event.target.readyState is event.target.DONE
 
 PASS event.result is "key"
-event.source.add({x: 'value'}, 'zzz')
+event.source.add({x: 'foo'}, 'zzz')
 PASS 'onsuccess' in result is true
 PASS 'onerror' in result is true
 PASS 'readyState' in result is true
@@ -208,8 +199,22 @@ PASS 'onerror' in event.target is true
 PASS 'readyState' in event.target is true
 PASS event.target.readyState is event.target.DONE
 
-PASS event.result.x is "value"
+PASS event.result.y is "value"
 store = event.source
+store.get(testDate)
+getSuccessDateKey():
+Success event fired:
+PASS 'result' in event is true
+PASS 'code' in event is false
+PASS 'message' in event is false
+PASS 'source' in event is true
+PASS event.source != null is true
+PASS 'onsuccess' in event.target is true
+PASS 'onerror' in event.target is true
+PASS 'readyState' in event.target is true
+PASS event.target.readyState is event.target.DONE
+
+PASS event.result.x is "foo"
 store.delete('key')
 PASS 'onsuccess' in result is true
 PASS 'onerror' in result is true
diff --git a/LayoutTests/storage/indexeddb/objectstore-basics.html b/LayoutTests/storage/indexeddb/objectstore-basics.html
index 3d2a1d2..a368c01 100644
--- a/LayoutTests/storage/indexeddb/objectstore-basics.html
+++ b/LayoutTests/storage/indexeddb/objectstore-basics.html
@@ -136,6 +136,7 @@ function checkMetadata()
     addData();
 }
 
+var testDate = new Date("August 25, 1991 20:57:08");
 
 function addData()
 {
@@ -144,17 +145,13 @@ function addData()
     window.store = evalAndLog("store = transaction.objectStore('storeName')");
 
     debug("Try to insert data with a Date key:");
-    // FIXME: This should work in the future.
-    try {
-        debug("store.add({x: 'foo'}, new Date())");
-        store.add({x: 'foo'}, new Date());
-        testFailed("Passing a Date as key argument should have thrown.");
-    } catch (err) {
-        testPassed("Exception thrown");
-        code = err.code;
-        shouldBe("code", "DOMException.TYPE_MISMATCH_ERR");
-    }
+    result = evalAndLog("store.add({x: 'foo'}, testDate)");
+    result.onsuccess = addDateSuccess;
+    result.onerror = unexpectedErrorCallback;
+}
 
+function addDateSuccess()
+{
     debug("Try to insert a value not handled by structured clone:");
     try {
         debug("store.add({x: 'bar', y: document.getElementById('console')}, 'bar')");
@@ -166,19 +163,8 @@ function addData()
         shouldBe("code", "DOMException.NOT_SUPPORTED_ERR");
     }
 
-    // FIXME: This should work in the future.
     debug("Try to insert data where key path yields a Date key:");
-    result = evalAndLog("store.add({x: new Date()}, 'foo')");
-    result.onsuccess = unexpectedSuccessCallback;
-    result.onerror = addKeyPathYieldingDateFailure;
-}
-
-function addKeyPathYieldingDateFailure()
-{
-    testPassed("Adding data where key path yielded Date key resulted in error.");
-
-    result = evalAndLog("store.add({x: 'value'}, 'key')");
-    verifyResult(result);
+    result = evalAndLog("store.add({x: new Date(), y: 'value'}, 'key')");
     result.onsuccess = addSuccess;
     result.onerror = unexpectedErrorCallback;
 }
@@ -189,7 +175,7 @@ function addSuccess()
     verifySuccessEvent(event);
     shouldBeEqualToString("event.result", "key");
 
-    result = evalAndLog("event.source.add({x: 'value'}, 'zzz')");
+    result = evalAndLog("event.source.add({x: 'foo'}, 'zzz')");
     verifyResult(result);
     result.onsuccess = unexpectedSuccessCallback;
     result.onerror = addAgainFailure;
@@ -248,8 +234,19 @@ function getSuccess()
 {
     debug("getSuccess():");
     verifySuccessEvent(event);
-    shouldBeEqualToString("event.result.x", "value");
+    shouldBeEqualToString("event.result.y", "value");
+
     var store = evalAndLog("store = event.source");
+    result = evalAndLog("store.get(testDate)");
+    result.onsuccess = getSuccessDateKey;
+    result.onerror = unexpectedErrorCallback;
+}
+
+function getSuccessDateKey()
+{
+    debug("getSuccessDateKey():");
+    verifySuccessEvent(event);
+    shouldBeEqualToString("event.result.x", "foo");
 
     result = evalAndLog("store.delete('key')");
     verifyResult(result);
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 834fb80..e80abf1 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,36 @@
+2010-12-17  Hans Wennborg  <hans at chromium.org>
+
+        Reviewed by Jeremy Orlow.
+
+        IndexedDB: Support Date objects as keys.
+        https://bugs.webkit.org/show_bug.cgi?id=51193
+
+        * bindings/v8/IDBBindingUtilities.cpp:
+        (WebCore::createIDBKeyFromValue):
+        Use the new IDBKey factory functions, and support Date objects.
+        * bindings/v8/custom/V8IDBKeyCustom.cpp:
+        (WebCore::toV8):
+        Create Date objects from DateType keys.
+        * storage/IDBKey.cpp:
+        (WebCore::IDBKey::fromQuery):
+        (WebCore::IDBKey::isEqual):
+        (WebCore::IDBKey::whereSyntax):
+        (WebCore::IDBKey::lowerCursorWhereFragment):
+        (WebCore::IDBKey::upperCursorWhereFragment):
+        (WebCore::IDBKey::bind):
+        (WebCore::IDBKey::bindWithNulls):
+        Update all SQL related functions to handle Date keys.
+        * storage/IDBKey.h:
+        (WebCore::IDBKey::createNull):
+        (WebCore::IDBKey::createNumber):
+        (WebCore::IDBKey::createString):
+        (WebCore::IDBKey::createDate):
+        Rename the create factories; since both number and date is just a
+        double, function overloading can't be used to discriminate between
+        the factories.
+        (WebCore::IDBKey::date):
+        Add getter for the date value.
+
 2010-12-17  Pavel Podivilov  <podivilov at chromium.org>
 
         Reviewed by Pavel Feldman.
diff --git a/WebCore/bindings/v8/IDBBindingUtilities.cpp b/WebCore/bindings/v8/IDBBindingUtilities.cpp
index 509d7c5..2e8d4fe 100644
--- a/WebCore/bindings/v8/IDBBindingUtilities.cpp
+++ b/WebCore/bindings/v8/IDBBindingUtilities.cpp
@@ -40,13 +40,13 @@ namespace WebCore {
 PassRefPtr<IDBKey> createIDBKeyFromValue(v8::Handle<v8::Value> value)
 {
     if (value->IsNull())
-        return IDBKey::create();
+        return IDBKey::createNull();
     if (value->IsNumber())
-        return IDBKey::create(value->NumberValue());
+        return IDBKey::createNumber(value->NumberValue());
     if (value->IsString())
-        return IDBKey::create(v8ValueToWebCoreString(value));
+        return IDBKey::createString(v8ValueToWebCoreString(value));
     if (value->IsDate())
-        return 0; // Signals type error. FIXME: Implement dates.
+        return IDBKey::createDate(value->NumberValue());
 
     return 0; // Signals type error.
 }
diff --git a/WebCore/bindings/v8/custom/V8IDBKeyCustom.cpp b/WebCore/bindings/v8/custom/V8IDBKeyCustom.cpp
index be05a80..3805dca 100644
--- a/WebCore/bindings/v8/custom/V8IDBKeyCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8IDBKeyCustom.cpp
@@ -48,7 +48,8 @@ v8::Handle<v8::Value> toV8(IDBKey* key)
         return v8::Number::New(key->number());
     case IDBKey::StringType:
         return v8String(key->string());
-    // FIXME: Implement dates.
+    case IDBKey::DateType:
+        return v8::Date::New(key->date());
     }
 
     ASSERT_NOT_REACHED();
diff --git a/WebCore/storage/IDBKey.cpp b/WebCore/storage/IDBKey.cpp
index d400382..eb38d81 100644
--- a/WebCore/storage/IDBKey.cpp
+++ b/WebCore/storage/IDBKey.cpp
@@ -38,18 +38,6 @@ IDBKey::IDBKey()
 {
 }
 
-IDBKey::IDBKey(double number)
-    : m_type(NumberType)
-    , m_number(number)
-{
-}
-
-IDBKey::IDBKey(const String& string)
-    : m_type(StringType)
-    , m_string(string.crossThreadString())
-{
-}
-
 IDBKey::~IDBKey()
 {
 }
@@ -57,17 +45,15 @@ IDBKey::~IDBKey()
 PassRefPtr<IDBKey> IDBKey::fromQuery(SQLiteStatement& query, int baseColumn)
 {
     if (!query.isColumnNull(baseColumn))
-        return IDBKey::create(query.getColumnText(baseColumn));
+        return IDBKey::createString(query.getColumnText(baseColumn));
 
-    if (!query.isColumnNull(baseColumn + 1)) {
-        ASSERT_NOT_REACHED(); // FIXME: Implement date.
-        return IDBKey::create();
-    }
+    if (!query.isColumnNull(baseColumn + 1))
+        return IDBKey::createDate(query.getColumnDouble(baseColumn + 1));
 
     if (!query.isColumnNull(baseColumn + 2))
-        return IDBKey::create(query.getColumnDouble(baseColumn + 2));
+        return IDBKey::createNumber(query.getColumnDouble(baseColumn + 2));
 
-    return IDBKey::create(); // Null.
+    return IDBKey::createNull();
 }
 
 bool IDBKey::isEqual(IDBKey* other)
@@ -78,7 +64,8 @@ bool IDBKey::isEqual(IDBKey* other)
     switch (m_type) {
     case StringType:
         return other->m_string == m_string;
-    // FIXME: Implement dates.
+    case DateType:
+        return other->m_date == m_date;
     case NumberType:
         return other->m_number == m_number;
     case NullType:
@@ -96,7 +83,8 @@ String IDBKey::whereSyntax(String qualifiedTableName) const
         return qualifiedTableName + "keyString = ?  AND  " + qualifiedTableName + "keyDate IS NULL  AND  " + qualifiedTableName + "keyNumber IS NULL  ";
     case IDBKey::NumberType:
         return qualifiedTableName + "keyString IS NULL  AND  " + qualifiedTableName + "keyDate IS NULL  AND  " + qualifiedTableName + "keyNumber = ?  ";
-    // FIXME: Implement date.
+    case IDBKey::DateType:
+        return qualifiedTableName + "keyString IS NULL  AND  " + qualifiedTableName + "keyDate = ?  AND  " + qualifiedTableName + "keyNumber IS NULL  ";
     case IDBKey::NullType:
         return qualifiedTableName + "keyString IS NULL  AND  " + qualifiedTableName + "keyDate IS NULL  AND  " + qualifiedTableName + "keyNumber IS NULL  ";
     }
@@ -110,7 +98,8 @@ String IDBKey::lowerCursorWhereFragment(String comparisonOperator, String qualif
     switch (m_type) {
     case StringType:
         return "? " + comparisonOperator + " " + qualifiedTableName + "keyString  AND  ";
-    // FIXME: Implement date.
+    case DateType:
+        return "(? " + comparisonOperator + " " + qualifiedTableName + "keyDate  OR NOT " + qualifiedTableName + "keyString IS NULL)  AND  ";
     case NumberType:
         return "(? " + comparisonOperator + " " + qualifiedTableName + "keyNumber  OR  NOT " + qualifiedTableName + "keyString IS NULL  OR  NOT " + qualifiedTableName + "keyDate IS NULL)  AND  ";
     case NullType:
@@ -127,7 +116,8 @@ String IDBKey::upperCursorWhereFragment(String comparisonOperator, String qualif
     switch (m_type) {
     case StringType:
         return "(" + qualifiedTableName + "keyString " + comparisonOperator + " ?  OR  " + qualifiedTableName + "keyString IS NULL)  AND  ";
-    // FIXME: Implement date.
+    case DateType:
+        return "(" + qualifiedTableName + "keyDate " + comparisonOperator + " ? OR " + qualifiedTableName + "keyDate IS NULL)  AND  " + qualifiedTableName + "keyString IS NULL  AND  ";
     case NumberType:
         return "(" + qualifiedTableName + "keyNumber " + comparisonOperator + " ? OR " + qualifiedTableName + "keyNumber IS NULL)  AND  " + qualifiedTableName + "keyString IS NULL  AND  " + qualifiedTableName + "keyDate IS NULL  AND  ";
     case NullType:
@@ -146,6 +136,9 @@ int IDBKey::bind(SQLiteStatement& query, int column) const
     case IDBKey::StringType:
         query.bindText(column, m_string);
         return 1;
+    case IDBKey::DateType:
+        query.bindDouble(column, m_date);
+        return 1;
     case IDBKey::NumberType:
         query.bindDouble(column, m_number);
         return 1;
@@ -165,6 +158,11 @@ void IDBKey::bindWithNulls(SQLiteStatement& query, int baseColumn) const
         query.bindNull(baseColumn + 1);
         query.bindNull(baseColumn + 2);
         break;
+    case IDBKey::DateType:
+        query.bindNull(baseColumn + 0);
+        query.bindDouble(baseColumn + 1, m_date);
+        query.bindNull(baseColumn + 2);
+        break;
     case IDBKey::NumberType:
         query.bindNull(baseColumn + 0);
         query.bindNull(baseColumn + 1);
diff --git a/WebCore/storage/IDBKey.h b/WebCore/storage/IDBKey.h
index 051351f..9118743 100644
--- a/WebCore/storage/IDBKey.h
+++ b/WebCore/storage/IDBKey.h
@@ -36,27 +36,46 @@ namespace WebCore {
 
 class SQLiteStatement;
 
-// FIXME: Add dates.
 class IDBKey : public ThreadSafeShared<IDBKey> {
 public:
-    static PassRefPtr<IDBKey> create()
+    static PassRefPtr<IDBKey> createNull()
     {
-        return adoptRef(new IDBKey());
+        RefPtr<IDBKey> idbKey(new IDBKey());
+        idbKey->m_type = NullType;
+        return idbKey.release();
     }
-    static PassRefPtr<IDBKey> create(double number)
+
+    static PassRefPtr<IDBKey> createNumber(double number)
     {
-        return adoptRef(new IDBKey(number));
+        RefPtr<IDBKey> idbKey(new IDBKey());
+        idbKey->m_type = NumberType;
+        idbKey->m_number = number;
+        return idbKey.release();
     }
-    static PassRefPtr<IDBKey> create(const String& string)
+
+    static PassRefPtr<IDBKey> createString(const String& string)
+    {
+        RefPtr<IDBKey> idbKey(new IDBKey());
+        idbKey->m_type = StringType;
+        idbKey->m_string = string;
+        return idbKey.release();
+    }
+
+    static PassRefPtr<IDBKey> createDate(double date)
     {
-        return adoptRef(new IDBKey(string));
+        RefPtr<IDBKey> idbKey(new IDBKey());
+        idbKey->m_type = DateType;
+        idbKey->m_date = date;
+        return idbKey.release();
     }
+
     ~IDBKey();
 
     // In order of the least to the highest precedent in terms of sort order.
     enum Type {
         NullType = 0, // FIXME: Phase out support for null keys.
         StringType,
+        DateType,
         NumberType
     };
 
@@ -68,6 +87,12 @@ public:
         return m_string;
     }
 
+    double date() const
+    {
+        ASSERT(m_type == DateType);
+        return m_date;
+    }
+
     double number() const
     {
         ASSERT(m_type == NumberType);
@@ -88,11 +113,10 @@ public:
 
 private:
     IDBKey();
-    explicit IDBKey(double);
-    explicit IDBKey(const String&);
 
     Type m_type;
     String m_string;
+    double m_date;
     double m_number;
 };
 
diff --git a/WebKit/chromium/ChangeLog b/WebKit/chromium/ChangeLog
index 522aaff..0488f0a 100644
--- a/WebKit/chromium/ChangeLog
+++ b/WebKit/chromium/ChangeLog
@@ -1,3 +1,28 @@
+2010-12-17  Hans Wennborg  <hans at chromium.org>
+
+        Reviewed by Jeremy Orlow.
+
+        IndexedDB: Support Date objects as keys.
+        https://bugs.webkit.org/show_bug.cgi?id=51193
+
+        Update to match the underlying WebCore IDBKey class:
+        add the DateType, add create() functions for each type,
+        deprecate the public constructors (will be removed once
+        Chromium side is updated).
+
+        * public/WebIDBKey.h:
+        (WebKit::WebIDBKey::WebIDBKey):
+        * src/AssertMatchingEnums.cpp:
+        * src/WebIDBKey.cpp:
+        (WebKit::WebIDBKey::createString):
+        (WebKit::WebIDBKey::createDate):
+        (WebKit::WebIDBKey::createNumber):
+        (WebKit::WebIDBKey::assignNull):
+        (WebKit::WebIDBKey::assignString):
+        (WebKit::WebIDBKey::assignDate):
+        (WebKit::WebIDBKey::assignNumber):
+        (WebKit::WebIDBKey::date):
+
 2010-12-17  James Simonsen  <simonjam at chromium.org>
 
         Reviewed by Darin Fisher.
diff --git a/WebKit/chromium/public/WebIDBKey.h b/WebKit/chromium/public/WebIDBKey.h
index c77a5b7..561af2f 100644
--- a/WebKit/chromium/public/WebIDBKey.h
+++ b/WebKit/chromium/public/WebIDBKey.h
@@ -44,11 +44,16 @@ public:
     ~WebIDBKey() { reset(); }
 
     WEBKIT_API static WebIDBKey createNull();
+    WEBKIT_API static WebIDBKey createString(const WebString&);
+    WEBKIT_API static WebIDBKey createDate(double);
+    WEBKIT_API static WebIDBKey createNumber(double);
     WEBKIT_API static WebIDBKey createInvalid();
     WEBKIT_API static WebIDBKey createFromValueAndKeyPath(const WebSerializedScriptValue&, const WebIDBKeyPath&);
 
-    WebIDBKey(const WebString& string) { assign(string); }
-    WebIDBKey(double number) { assign(number); }
+    // FIXME: Remove these two constructors after Chromium side is done.
+    WebIDBKey(const WebString& string) { assignString(string); }
+    WebIDBKey(double number) { assignNumber(number); }
+
     WebIDBKey(const WebIDBKey& e) { assign(e); }
     WebIDBKey& operator=(const WebIDBKey& e)
     {
@@ -58,14 +63,16 @@ public:
 
     WEBKIT_API void assign(const WebIDBKey&);
     WEBKIT_API void assignNull();
-    WEBKIT_API void assign(const WebString&);
-    WEBKIT_API void assign(double);
+    WEBKIT_API void assignString(const WebString&);
+    WEBKIT_API void assignDate(double);
+    WEBKIT_API void assignNumber(double);
     WEBKIT_API void assignInvalid();
     WEBKIT_API void reset();
 
     enum Type {
         NullType = 0,
         StringType,
+        DateType,
         NumberType,
         // Types not in WebCore::IDBKey:
         InvalidType
@@ -73,7 +80,8 @@ public:
 
     WEBKIT_API Type type() const;
     WEBKIT_API WebString string() const; // Only valid for StringType.
-    WEBKIT_API double number() const; // Only valid for numberType.
+    WEBKIT_API double date() const; // Only valid for DateType.
+    WEBKIT_API double number() const; // Only valid for NumberType.
 
 #if WEBKIT_IMPLEMENTATION
     WebIDBKey(const WTF::PassRefPtr<WebCore::IDBKey>&);
diff --git a/WebKit/chromium/src/AssertMatchingEnums.cpp b/WebKit/chromium/src/AssertMatchingEnums.cpp
index ceeed8d..ba9b4e7 100644
--- a/WebKit/chromium/src/AssertMatchingEnums.cpp
+++ b/WebKit/chromium/src/AssertMatchingEnums.cpp
@@ -365,6 +365,7 @@ COMPILE_ASSERT_MATCHING_ENUM(WebView::UserStyleInjectInSubsequentDocuments, Inje
 
 COMPILE_ASSERT_MATCHING_ENUM(WebIDBKey::NullType, IDBKey::NullType);
 COMPILE_ASSERT_MATCHING_ENUM(WebIDBKey::StringType, IDBKey::StringType);
+COMPILE_ASSERT_MATCHING_ENUM(WebIDBKey::DateType, IDBKey::DateType);
 COMPILE_ASSERT_MATCHING_ENUM(WebIDBKey::NumberType, IDBKey::NumberType);
 
 #if ENABLE(FILE_SYSTEM)
diff --git a/WebKit/chromium/src/WebIDBKey.cpp b/WebKit/chromium/src/WebIDBKey.cpp
index b7a7db8..7e84df1 100644
--- a/WebKit/chromium/src/WebIDBKey.cpp
+++ b/WebKit/chromium/src/WebIDBKey.cpp
@@ -48,6 +48,27 @@ WebIDBKey WebIDBKey::createNull()
     return key;
 }
 
+WebIDBKey WebIDBKey::createString(const WebString& string)
+{
+    WebIDBKey key;
+    key.assignString(string);
+    return key;
+}
+
+WebIDBKey WebIDBKey::createDate(double date)
+{
+    WebIDBKey key;
+    key.assignDate(date);
+    return key;
+}
+
+WebIDBKey WebIDBKey::createNumber(double number)
+{
+    WebIDBKey key;
+    key.assignNumber(number);
+    return key;
+}
+
 WebIDBKey WebIDBKey::createInvalid()
 {
     WebIDBKey key;
@@ -69,17 +90,22 @@ void WebIDBKey::assign(const WebIDBKey& value)
 
 void WebIDBKey::assignNull()
 {
-    m_private = IDBKey::create();
+    m_private = IDBKey::createNull();
+}
+
+void WebIDBKey::assignString(const WebString& string)
+{
+    m_private = IDBKey::createString(string);
 }
 
-void WebIDBKey::assign(const WebString& string)
+void WebIDBKey::assignDate(double date)
 {
-    m_private = IDBKey::create(string);
+    m_private = IDBKey::createDate(date);
 }
 
-void WebIDBKey::assign(double number)
+void WebIDBKey::assignNumber(double number)
 {
-    m_private = IDBKey::create(number);
+    m_private = IDBKey::createNumber(number);
 }
 
 void WebIDBKey::assignInvalid()
@@ -104,6 +130,11 @@ WebString WebIDBKey::string() const
     return m_private->string();
 }
 
+double WebIDBKey::date() const
+{
+    return m_private->date();
+}
+
 double WebIDBKey::number() const
 {
     return m_private->number();

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list