Title: [98258] trunk
- Revision
- 98258
- Author
- [email protected]
- Date
- 2011-10-24 11:31:55 -0700 (Mon, 24 Oct 2011)
Log Message
IndexedDB add should fail adding an inline and passed key simultaneously
https://bugs.webkit.org/show_bug.cgi?id=58598
Patch by Joshua Bell <[email protected]> on 2011-10-24
Reviewed by Tony Chang.
Source/WebCore:
Test: storage/indexeddb/mozilla/key-requirements-inline-and-passed.html
Implement the spec clause: passing a key into add() or put() when
the object store has a key path ("inline key") is an error.
* storage/IDBObjectStoreBackendImpl.cpp:
(WebCore::IDBObjectStoreBackendImpl::put):
LayoutTests:
* storage/indexeddb/mozilla/key-requirements-inline-and-passed.html: Added.
* storage/indexeddb/mozilla/key-requirements-inline-and-passed-expected.txt: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (98257 => 98258)
--- trunk/LayoutTests/ChangeLog 2011-10-24 18:29:40 UTC (rev 98257)
+++ trunk/LayoutTests/ChangeLog 2011-10-24 18:31:55 UTC (rev 98258)
@@ -1,3 +1,13 @@
+2011-10-24 Joshua Bell <[email protected]>
+
+ IndexedDB add should fail adding an inline and passed key simultaneously
+ https://bugs.webkit.org/show_bug.cgi?id=58598
+
+ Reviewed by Tony Chang.
+
+ * storage/indexeddb/mozilla/key-requirements-inline-and-passed.html: Added.
+ * storage/indexeddb/mozilla/key-requirements-inline-and-passed-expected.txt: Added.
+
2011-10-24 Cary Clark <[email protected]>
Unreviewed gardening: third chunk of baselines for Chromium-Skia
Added: trunk/LayoutTests/storage/indexeddb/mozilla/key-requirements-inline-and-passed-expected.txt (0 => 98258)
--- trunk/LayoutTests/storage/indexeddb/mozilla/key-requirements-inline-and-passed-expected.txt (rev 0)
+++ trunk/LayoutTests/storage/indexeddb/mozilla/key-requirements-inline-and-passed-expected.txt 2011-10-24 18:31:55 UTC (rev 98258)
@@ -0,0 +1,21 @@
+Test IndexedDB's behavior adding inline and passed key simultaneously
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS 'webkitIndexedDB' in window is true
+PASS webkitIndexedDB == null is false
+webkitIndexedDB.open(name, description)
+openSuccess():
+db = event.target.result
+request = db.setVersion('version 1')
+cleanDatabase():
+Deleted all object stores.
+objectStore = db.createObjectStore('baz', { keyPath: 'id' });
+Expecting exception from objectStore.add({id: 5}, 5);
+PASS Exception was thrown.
+PASS code is webkitIDBDatabaseException.DATA_ERR
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/storage/indexeddb/mozilla/key-requirements-inline-and-passed.html (0 => 98258)
--- trunk/LayoutTests/storage/indexeddb/mozilla/key-requirements-inline-and-passed.html (rev 0)
+++ trunk/LayoutTests/storage/indexeddb/mozilla/key-requirements-inline-and-passed.html 2011-10-24 18:31:55 UTC (rev 98258)
@@ -0,0 +1,61 @@
+<!DOCTYPE html>
+<!--
+ original test: http://mxr.mozilla.org/mozilla2.0/source/dom/indexedDB/test/test_key_requirements.html
+ license of original test:
+ " Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/ "
+-->
+<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's behavior adding inline and passed key simultaneously");
+if (window.layoutTestController)
+ layoutTestController.waitUntilDone();
+
+function test()
+{
+ shouldBeTrue("'webkitIndexedDB' in window");
+ shouldBeFalse("webkitIndexedDB == null");
+
+ name = window.location.pathname;
+ description = "My Test Database";
+ request = evalAndLog("webkitIndexedDB.open(name, description)");
+ request._onsuccess_ = openSuccess;
+ request._onerror_ = unexpectedErrorCallback;
+}
+
+function openSuccess()
+{
+ debug("openSuccess():");
+ db = evalAndLog("db = event.target.result");
+
+ request = evalAndLog("request = db.setVersion('version 1')");
+ request._onsuccess_ = cleanDatabase;
+ request._onerror_ = unexpectedErrorCallback;
+}
+
+function cleanDatabase()
+{
+ debug("cleanDatabase():");
+ deleteAllObjectStores(db);
+ objectStore = evalAndLog("objectStore = db.createObjectStore('baz', { keyPath: 'id' });");
+ evalAndExpectException("objectStore.add({id: 5}, 5);", "webkitIDBDatabaseException.DATA_ERR");
+ done();
+}
+
+var successfullyParsed = true;
+
+test();
+
+</script>
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (98257 => 98258)
--- trunk/Source/WebCore/ChangeLog 2011-10-24 18:29:40 UTC (rev 98257)
+++ trunk/Source/WebCore/ChangeLog 2011-10-24 18:31:55 UTC (rev 98258)
@@ -1,3 +1,18 @@
+2011-10-24 Joshua Bell <[email protected]>
+
+ IndexedDB add should fail adding an inline and passed key simultaneously
+ https://bugs.webkit.org/show_bug.cgi?id=58598
+
+ Reviewed by Tony Chang.
+
+ Test: storage/indexeddb/mozilla/key-requirements-inline-and-passed.html
+
+ Implement the spec clause: passing a key into add() or put() when
+ the object store has a key path ("inline key") is an error.
+
+ * storage/IDBObjectStoreBackendImpl.cpp:
+ (WebCore::IDBObjectStoreBackendImpl::put):
+
2011-10-24 Simon Fraser <[email protected]>
Improve debug compositing border colors
Modified: trunk/Source/WebCore/storage/IDBObjectStoreBackendImpl.cpp (98257 => 98258)
--- trunk/Source/WebCore/storage/IDBObjectStoreBackendImpl.cpp 2011-10-24 18:29:40 UTC (rev 98257)
+++ trunk/Source/WebCore/storage/IDBObjectStoreBackendImpl.cpp 2011-10-24 18:31:55 UTC (rev 98258)
@@ -143,6 +143,11 @@
return;
}
+ if (key && hasKeyPath && (putMode == AddOnly || putMode == AddOrUpdate)) {
+ ec = IDBDatabaseException::DATA_ERR;
+ return;
+ }
+
// FIXME: This should throw a SERIAL_ERR on structured clone problems.
// FIXME: This should throw a DATA_ERR when the wrong key/keyPath data is supplied.
if (!transaction->scheduleTask(createCallbackTask(&IDBObjectStoreBackendImpl::putInternal, objectStore, value, key, putMode, callbacks, transaction)))
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes