Source/WebCore/ChangeLog

 12012-01-25 Eugene Girard <girard@chromium.org>
 2
 3 IndexedDB createObjectStore should throw if options arg is invalid
 4 https://bugs.webkit.org/show_bug.cgi?id=58471
 5
 6 Reviewed by NOBODY (OOPS!).
 7
 8 We can now identify OptionsObjects that are instantiated with
 9 non-objects. (As opposed to OptionsObjects that are instantiated
 10 with null or undefined, which can be detected with isNullOrUndefined.)
 11
 12 (Considered adding the isObject test into isNullOrUndefined, since they
 13 are logically equivalent, but many existing code paths and unit tests
 14 depend on the current implementation of isNullOrUndefined.)
 15
 16 Test: storage/indexeddb/createObjectStore-bad-options.html
 17
 18 * bindings/v8/OptionsObject.cpp:
 19 (WebCore::OptionsObject::isObject):
 20 * bindings/v8/OptionsObject.h:
 21 * storage/IDBDatabase.cpp:
 22 (WebCore::IDBDatabase::createObjectStore):
 23
1242012-01-23 Nikolas Zimmermann <nzimmermann@rim.com>
225
326 SVG animation repaint issue with image and dynamic clipPath

Source/WebCore/bindings/v8/OptionsObject.cpp

@@OptionsObject& OptionsObject::operator=(const OptionsObject& optionsObject)
6464 return *this;
6565}
6666
 67bool OptionsObject::isObject() const
 68{
 69 return !isUndefinedOrNull() && m_options->IsObject();
 70}
 71
6772bool OptionsObject::isUndefinedOrNull() const
6873{
6974 if (m_options.IsEmpty())

Source/WebCore/bindings/v8/OptionsObject.h

@@public:
4949
5050 OptionsObject& operator=(const OptionsObject&);
5151
 52 bool isObject() const;
5253 bool isUndefinedOrNull() const;
5354
5455 bool get(const String&, bool&) const;

Source/WebCore/storage/IDBDatabase.cpp

@@PassRefPtr<IDBObjectStore> IDBDatabase::createObjectStore(const String& name, co
8989 return 0;
9090 }
9191
 92 if (!options.isUndefinedOrNull() && !options.isObject()) {
 93 ec = IDBDatabaseException::CONSTRAINT_ERR;
 94 return 0;
 95 }
 96
9297 String keyPath;
9398 bool keyPathExists = options.getWithUndefinedOrNullCheck("keyPath", keyPath);
9499 if (keyPathExists && !IDBIsValidKeyPath(keyPath)) {

LayoutTests/ChangeLog

 12012-01-25 Eugene Girard <girard@chromium.org>
 2
 3 IndexedDB createObjectStore should throw if options arg is invalid
 4 https://bugs.webkit.org/show_bug.cgi?id=58471
 5
 6 Reviewed by NOBODY (OOPS!).
 7
 8 * storage/indexeddb/createObjectStore-bad-options-expected.txt: Added.
 9 * storage/indexeddb/createObjectStore-bad-options.html: Added.
 10
1112012-01-23 Anton Muhin <antonm@chromium.org>
212
313 Unreviewed tweaking of test expectations: it should be IMAGE instead of IMAGE+TEXT.

LayoutTests/storage/indexeddb/createObjectStore-bad-options-expected.txt

 1Test IndexedDB's creating object store with bad options
 2
 3On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 4
 5
 6PASS 'webkitIndexedDB' in window is true
 7PASS webkitIndexedDB == null is false
 8webkitIndexedDB.open(name, description)
 9openSuccess():
 10db = event.target.result
 11request = db.setVersion('version 1')
 12cleanDatabase():
 13Deleted all object stores.
 14Expecting exception from db.createObjectStore('foo', 'bar');
 15PASS Exception was thrown.
 16PASS code is webkitIDBDatabaseException.CONSTRAINT_ERR
 17PASS successfullyParsed is true
 18
 19TEST COMPLETE
 20

LayoutTests/storage/indexeddb/createObjectStore-bad-options.html

 1<!DOCTYPE html>
 2<!--
 3 original test: http://mxr.mozilla.org/mozilla2.0/source/dom/indexedDB/test/test_create_objectStore.html
 4 license of original test:
 5 " Any copyright is dedicated to the Public Domain.
 6 http://creativecommons.org/publicdomain/zero/1.0/ "
 7-->
 8<html>
 9<head>
 10<link rel="stylesheet" href="../../fast/js/resources/js-test-style.css">
 11<script src="../../fast/js/resources/js-test-post-function.js"></script>
 12<script src="../../fast/js/resources/js-test-pre.js"></script>
 13<script src="resources/shared.js"></script>
 14</head>
 15
 16<body>
 17<p id="description"></p>
 18<div id="console"></div>
 19<script>
 20
 21<!--
 22description("Test IndexedDB's creating object store with bad options");
 23-->
 24if (window.layoutTestController)
 25 layoutTestController.waitUntilDone();
 26
 27function test()
 28{
 29 shouldBeTrue("'webkitIndexedDB' in window");
 30 shouldBeFalse("webkitIndexedDB == null");
 31
 32 name = window.location.pathname;
 33 description = "My Test Database";
 34 request = evalAndLog("webkitIndexedDB.open(name, description)");
 35 request.onsuccess = openSuccess;
 36 request.onerror = unexpectedErrorCallback;
 37}
 38
 39function openSuccess()
 40{
 41 debug("openSuccess():");
 42 db = evalAndLog("db = event.target.result");
 43
 44 request = evalAndLog("request = db.setVersion('version 1')");
 45 request.onsuccess = cleanDatabase;
 46 request.onerror = unexpectedErrorCallback;
 47}
 48
 49function cleanDatabase()
 50{
 51 debug("cleanDatabase():");
 52 deleteAllObjectStores(db);
 53 evalAndExpectException("db.createObjectStore('foo', 'bar');", "webkitIDBDatabaseException.CONSTRAINT_ERR");
 54
 55 done();
 56}
 57
 58var successfullyParsed = true;
 59
 60test();
 61
 62</script>
 63</body>
 64</html>
 65