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

hans at chromium.org hans at chromium.org
Wed Dec 22 16:32:16 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 99419fa10ed98fa755c69b2a0a8da0eb9647952c
Author: hans at chromium.org <hans at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Nov 25 10:04:57 2010 +0000

    2010-11-25  Hans Wennborg  <hans at chromium.org>
    
            Reviewed by Jeremy Orlow.
    
            IndexedDB: Disallow inserting records with NULL keys
            https://bugs.webkit.org/show_bug.cgi?id=50033
    
            Test inserting records with NULL key and make sure it fails.
    
            Update layout tests that previously inserted NULL keys.
    
            * storage/indexeddb/index-cursor.html:
            * storage/indexeddb/objectstore-basics-expected.txt:
            * storage/indexeddb/objectstore-basics.html:
            * storage/indexeddb/objectstore-cursor.html:
    2010-11-25  Hans Wennborg  <hans at chromium.org>
    
            Reviewed by Jeremy Orlow.
    
            IndexedDB: Disallow inserting records with NULL keys
            https://bugs.webkit.org/show_bug.cgi?id=50033
    
            Disallow inserting records with null keys into the object store.
    
            * storage/IDBKey.h:
            * storage/IDBObjectStoreBackendImpl.cpp:
            (WebCore::IDBObjectStoreBackendImpl::putInternal):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@72723 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 0343b0b..6d9edb0 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,19 @@
+2010-11-25  Hans Wennborg  <hans at chromium.org>
+
+        Reviewed by Jeremy Orlow.
+
+        IndexedDB: Disallow inserting records with NULL keys
+        https://bugs.webkit.org/show_bug.cgi?id=50033
+
+        Test inserting records with NULL key and make sure it fails.
+
+        Update layout tests that previously inserted NULL keys.
+
+        * storage/indexeddb/index-cursor.html:
+        * storage/indexeddb/objectstore-basics-expected.txt:
+        * storage/indexeddb/objectstore-basics.html:
+        * storage/indexeddb/objectstore-cursor.html:
+
 2010-11-24  Yuta Kitamura  <yutak at chromium.org>
 
         Reviewed by Kent Tamura.
diff --git a/LayoutTests/storage/indexeddb/index-cursor.html b/LayoutTests/storage/indexeddb/index-cursor.html
index 6a9d1ac..26ebca2 100644
--- a/LayoutTests/storage/indexeddb/index-cursor.html
+++ b/LayoutTests/storage/indexeddb/index-cursor.html
@@ -16,8 +16,8 @@ if (window.layoutTestController)
  
 // In order of how it should be sorted by IndexedDB.
 window.testData = [
-    null,
-    null,
+    1,
+    1,
     2,
     2,
     10,
@@ -72,6 +72,7 @@ function addData()
     result = evalAndLog("objectStore.add({'x': testData[nextToAdd]}, nextToAdd)");
     verifyResult(result);
     result.onsuccess = ++window.nextToAdd < testData.length ? addData : scheduleTests;
+    result.onerror = unexpectedErrorCallback;
 }
 
 function scheduleTests()
diff --git a/LayoutTests/storage/indexeddb/objectstore-basics-expected.txt b/LayoutTests/storage/indexeddb/objectstore-basics-expected.txt
index e0c9770..3252bcc 100644
--- a/LayoutTests/storage/indexeddb/objectstore-basics-expected.txt
+++ b/LayoutTests/storage/indexeddb/objectstore-basics-expected.txt
@@ -137,6 +137,48 @@ PASS event.target.readyState is event.target.DONE
 PASS event.code is webkitIDBDatabaseException.UNKNOWN_ERR
 db.transaction()
 store = transaction.objectStore('storeName')
+store.add({x: 'othervalue'}, null)
+PASS 'onsuccess' in result is true
+PASS 'onerror' in result is true
+PASS 'readyState' in result is true
+An event should fire shortly...
+
+addWithNullKeyFailre():
+Error event fired:
+PASS 'result' in event is false
+PASS 'code' in event is true
+PASS 'message' in event is true
+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.code is webkitIDBDatabaseException.DATA_ERR
+db.transaction()
+store = transaction.objectStore('storeName')
+store.add({x: null}, 'validkey')
+PASS 'onsuccess' in result is true
+PASS 'onerror' in result is true
+PASS 'readyState' in result is true
+An event should fire shortly...
+
+addWithNullIndexFailure():
+Error event fired:
+PASS 'result' in event is false
+PASS 'code' in event is true
+PASS 'message' in event is true
+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.code is webkitIDBDatabaseException.DATA_ERR
+db.transaction()
+store = transaction.objectStore('storeName')
 store.get('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 005247e..0501f30 100644
--- a/LayoutTests/storage/indexeddb/objectstore-basics.html
+++ b/LayoutTests/storage/indexeddb/objectstore-basics.html
@@ -171,6 +171,38 @@ function addAgainFailure()
     transaction.onabort = unexpectedErrorCallback;
     var store = evalAndLog("store = transaction.objectStore('storeName')");
 
+    result = evalAndLog("store.add({x: 'othervalue'}, null)");
+    verifyResult(result);
+    result.onsuccess = unexpectedSuccessCallback;
+    result.onerror = addWithNullKeyFailure;
+}
+
+function addWithNullKeyFailure()
+{
+    debug("addWithNullKeyFailre():");
+    verifyErrorEvent(event);
+    shouldBe("event.code", "webkitIDBDatabaseException.DATA_ERR");
+
+    transaction = evalAndLog("db.transaction()");
+    transaction.onabort = unexpectedErrorCallback;
+    var store = evalAndLog("store = transaction.objectStore('storeName')");
+
+    result = evalAndLog("store.add({x: null}, 'validkey')");
+    verifyResult(result);
+    result.onsuccess = unexpectedSuccessCallback;
+    result.onerror = addWithNullIndexFailure;
+}
+
+function addWithNullIndexFailure()
+{
+    debug("addWithNullIndexFailure():");
+    verifyErrorEvent(event);
+    shouldBe("event.code", "webkitIDBDatabaseException.DATA_ERR");
+
+    transaction = evalAndLog("db.transaction()");
+    transaction.onabort = unexpectedErrorCallback;
+    var store = evalAndLog("store = transaction.objectStore('storeName')");
+
     result = evalAndLog("store.get('key')");
     verifyResult(result);
     result.onsuccess = getSuccess;
diff --git a/LayoutTests/storage/indexeddb/objectstore-cursor.html b/LayoutTests/storage/indexeddb/objectstore-cursor.html
index d0d786b..d561315 100644
--- a/LayoutTests/storage/indexeddb/objectstore-cursor.html
+++ b/LayoutTests/storage/indexeddb/objectstore-cursor.html
@@ -16,7 +16,7 @@ if (window.layoutTestController)
  
 // In order of how it should be sorted by IndexedDB.
 window.testData = [
-    null,
+    1,
     2,
     3,
     10,
@@ -70,6 +70,7 @@ function addData()
     result = evalAndLog("objectStore.add('', testData[nextToAdd])");
     verifyResult(result);
     result.onsuccess = ++window.nextToAdd < testData.length ? addData : scheduleTests;
+    result.onerror = unexpectedErrorCallback;
 }
 
 function scheduleTests()
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index f0981a0..070b2af 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,16 @@
+2010-11-25  Hans Wennborg  <hans at chromium.org>
+
+        Reviewed by Jeremy Orlow.
+
+        IndexedDB: Disallow inserting records with NULL keys
+        https://bugs.webkit.org/show_bug.cgi?id=50033
+
+        Disallow inserting records with null keys into the object store.
+
+        * storage/IDBKey.h:
+        * storage/IDBObjectStoreBackendImpl.cpp:
+        (WebCore::IDBObjectStoreBackendImpl::putInternal):
+
 2010-11-25  Philippe Normand  <pnormand at igalia.com>
 
         Rubber-stamped by Xan Lopez.
diff --git a/WebCore/storage/IDBKey.h b/WebCore/storage/IDBKey.h
index 0303a38..b302fd7 100644
--- a/WebCore/storage/IDBKey.h
+++ b/WebCore/storage/IDBKey.h
@@ -55,7 +55,7 @@ public:
 
     // In order of the least to the highest precedent in terms of sort order.
     enum Type {
-        NullType = 0,
+        NullType = 0, // FIXME: Phase out support for null keys.
         StringType,
         NumberType
     };
diff --git a/WebCore/storage/IDBObjectStoreBackendImpl.cpp b/WebCore/storage/IDBObjectStoreBackendImpl.cpp
index 653fb4e..7fc4f98 100644
--- a/WebCore/storage/IDBObjectStoreBackendImpl.cpp
+++ b/WebCore/storage/IDBObjectStoreBackendImpl.cpp
@@ -211,6 +211,10 @@ void IDBObjectStoreBackendImpl::putInternal(ScriptExecutionContext*, PassRefPtr<
         callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::DATA_ERR, "No key supplied."));
         return;
     }
+    if (key->type() == IDBKey::NullType) {
+        callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::DATA_ERR, "NULL key is not allowed."));
+        return;
+    }
 
     Vector<RefPtr<IDBKey> > indexKeys;
     for (IndexMap::iterator it = objectStore->m_indexes.begin(); it != objectStore->m_indexes.end(); ++it) {
@@ -219,6 +223,10 @@ void IDBObjectStoreBackendImpl::putInternal(ScriptExecutionContext*, PassRefPtr<
             callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::UNKNOWN_ERR, "The key could not be fetched from an index's keyPath."));
             return;
         }
+        if (key->type() == IDBKey::NullType) {
+            callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::DATA_ERR, "One of the derived (from a keyPath) keys for an index is NULL."));
+            return;
+        }
         if (!it->second->addingKeyAllowed(key.get())) {
             callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::UNKNOWN_ERR, "One of the derived (from a keyPath) keys for an index does not satisfy its uniqueness requirements."));
             return;

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list