Diff
Modified: trunk/LayoutTests/ChangeLog (127048 => 127049)
--- trunk/LayoutTests/ChangeLog 2012-08-29 21:05:26 UTC (rev 127048)
+++ trunk/LayoutTests/ChangeLog 2012-08-29 21:17:21 UTC (rev 127049)
@@ -1,3 +1,20 @@
+2012-08-29 David Grogan <[email protected]>
+
+ IndexedDB: Throw TypeError for invalid version parameters
+ https://bugs.webkit.org/show_bug.cgi?id=95143
+
+ Reviewed by Tony Chang.
+
+ * http/tests/inspector/indexeddb/indexeddb-test.js:
+ Remove 0 as a version parameter now that it will throw TypeError. It
+ should have been a no-op anyway.
+
+ * storage/indexeddb/intversion-bad-parameters-expected.txt: Added.
+ * storage/indexeddb/intversion-bad-parameters.html: Added.
+ * storage/indexeddb/resources/intversion-bad-parameters.js: Added.
+ (test):
+ (deleteSuccess):
+
2012-08-29 Jessie Berlin <[email protected]>
ASSERTION FAILED: enclosingIntRect(rendererMappedResult) == enclosingIntRect(FloatQuad(result).boundingBox()) : WebCore::FloatRect WebCore::RenderGeometryMap::absoluteRect(const WebCore::FloatRect &) const
Modified: trunk/LayoutTests/http/tests/inspector/indexeddb/indexeddb-test.js (127048 => 127049)
--- trunk/LayoutTests/http/tests/inspector/indexeddb/indexeddb-test.js 2012-08-29 21:05:26 UTC (rev 127048)
+++ trunk/LayoutTests/http/tests/inspector/indexeddb/indexeddb-test.js 2012-08-29 21:17:21 UTC (rev 127049)
@@ -167,7 +167,7 @@
function createDatabase(callback, databaseName)
{
- var request = indexedDB.open(databaseName, 0);
+ var request = indexedDB.open(databaseName);
request._onerror_ = onIndexedDBError;
request._onsuccess_ = closeDatabase;
Added: trunk/LayoutTests/storage/indexeddb/intversion-bad-parameters-expected.txt (0 => 127049)
--- trunk/LayoutTests/storage/indexeddb/intversion-bad-parameters-expected.txt (rev 0)
+++ trunk/LayoutTests/storage/indexeddb/intversion-bad-parameters-expected.txt 2012-08-29 21:17:21 UTC (rev 127049)
@@ -0,0 +1,29 @@
+Test that bad version parameters cause TypeError
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+indexedDB = self.indexedDB || self.webkitIndexedDB || self.mozIndexedDB || self.msIndexedDB || self.OIndexedDB;
+
+dbname = "intversion-bad-parameters.html"
+indexedDB.deleteDatabase(dbname)
+
+deleteSuccess():
+Expecting TypeError exception from indexedDB.open(dbname, 'stringversion')
+PASS Exception was thrown.
+PASS indexedDB.open(dbname, 'stringversion') threw TypeError: Type error
+Expecting TypeError exception from indexedDB.open(dbname, 0)
+PASS Exception was thrown.
+PASS indexedDB.open(dbname, 0) threw TypeError: Type error
+Expecting TypeError exception from indexedDB.open(dbname, -5)
+PASS Exception was thrown.
+PASS indexedDB.open(dbname, -5) threw TypeError: Type error
+
+FIXME: Using -1 doesn't throw TypeError but it should
+Expecting TypeError exception from request = indexedDB.open(dbname, -1)
+FAIL No exception thrown!
+FAIL Success function called unexpectedly.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/storage/indexeddb/intversion-bad-parameters.html (0 => 127049)
--- trunk/LayoutTests/storage/indexeddb/intversion-bad-parameters.html (rev 0)
+++ trunk/LayoutTests/storage/indexeddb/intversion-bad-parameters.html 2012-08-29 21:17:21 UTC (rev 127049)
@@ -0,0 +1,10 @@
+<html>
+<head>
+<script src=""
+<script src=""
+</head>
+<body>
+<script src=""
+<script src=""
+</body>
+</html>
Added: trunk/LayoutTests/storage/indexeddb/resources/intversion-bad-parameters.js (0 => 127049)
--- trunk/LayoutTests/storage/indexeddb/resources/intversion-bad-parameters.js (rev 0)
+++ trunk/LayoutTests/storage/indexeddb/resources/intversion-bad-parameters.js 2012-08-29 21:17:21 UTC (rev 127049)
@@ -0,0 +1,32 @@
+if (this.importScripts) {
+ importScripts('../../../fast/js/resources/js-test-pre.js');
+ importScripts('shared.js');
+}
+
+description("Test that bad version parameters cause TypeError");
+
+function test()
+{
+ removeVendorPrefixes();
+ setDBNameFromPath();
+
+ request = evalAndLog("indexedDB.deleteDatabase(dbname)");
+ request._onsuccess_ = deleteSuccess;
+ request._onerror_ = unexpectedErrorCallback;
+}
+
+function deleteSuccess(evt) {
+ preamble();
+ evalAndExpectExceptionClass("indexedDB.open(dbname, 'stringversion')", "TypeError");
+ evalAndExpectExceptionClass("indexedDB.open(dbname, 0)", "TypeError");
+ evalAndExpectExceptionClass("indexedDB.open(dbname, -5)", "TypeError");
+ debug("");
+ debug("FIXME: Using -1 doesn't throw TypeError but it should");
+ evalAndExpectExceptionClass("request = indexedDB.open(dbname, -1)", "TypeError");
+ request._onsuccess_ = unexpectedSuccessCallback;
+ request._onerror_ = unexpectedErrorCallback;
+ request._onblocked_ = unexpectedBlockedCallback;
+ request._onupgradeneeded_ = unexpectedUpgradeNeededCallback;
+}
+
+test();
Modified: trunk/Source/WebCore/ChangeLog (127048 => 127049)
--- trunk/Source/WebCore/ChangeLog 2012-08-29 21:05:26 UTC (rev 127048)
+++ trunk/Source/WebCore/ChangeLog 2012-08-29 21:17:21 UTC (rev 127049)
@@ -1,3 +1,19 @@
+2012-08-29 David Grogan <[email protected]>
+
+ IndexedDB: Throw TypeError for invalid version parameters
+ https://bugs.webkit.org/show_bug.cgi?id=95143
+
+ Reviewed by Tony Chang.
+
+ Still need to throw for -1, but developers are running into the string
+ scenario so handling that is more urgent. See
+ https://groups.google.com/a/chromium.org/forum/?fromgroups=#!topic/chromium-html5/QvjsPbBdP4M
+
+ Test: storage/indexeddb/intversion-bad-parameters.html
+
+ * Modules/indexeddb/IDBFactory.cpp:
+ (WebCore::IDBFactory::open):
+
2012-08-29 Alexandru Chiculita <[email protected]>
[CSS Shaders] Use CSS transform parsing code within CSS Shader
Modified: trunk/Source/WebCore/Modules/indexeddb/IDBFactory.cpp (127048 => 127049)
--- trunk/Source/WebCore/Modules/indexeddb/IDBFactory.cpp 2012-08-29 21:05:26 UTC (rev 127048)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBFactory.cpp 2012-08-29 21:17:21 UTC (rev 127049)
@@ -111,6 +111,12 @@
ec = NATIVE_TYPE_ERR;
return 0;
}
+ // FIXME: We need to throw an error if script passes -1. Somehow refactor
+ // this to avoid wanting to throw an error with the sentinel.
+ if (!version || version < IDBDatabaseMetadata::NoIntVersion) {
+ ec = NATIVE_TYPE_ERR;
+ return 0;
+ }
if (!isContextValid(context))
return 0;