Title: [88660] trunk
Revision
88660
Author
[email protected]
Date
2011-06-13 11:29:05 -0700 (Mon, 13 Jun 2011)

Log Message

2011-06-13  Mark Pilgrim  <[email protected]>

        Reviewed by Tony Chang.

        IndexedDB: setVersion() version argument is required
        https://bugs.webkit.org/show_bug.cgi?id=62401

        * storage/indexeddb/setVersion-undefined-expected.txt: Added.
        * storage/indexeddb/setVersion-undefined.html: Added.
2011-06-13  Mark Pilgrim  <[email protected]>

        Reviewed by Tony Chang.

        IndexedDB: setVersion() version argument is required
        https://bugs.webkit.org/show_bug.cgi?id=62401

        Test: storage/indexeddb/setVersion-undefined.html

        * storage/IDBDatabase.cpp:
        (WebCore::IDBDatabase::setVersion): check for null version
        * storage/IDBDatabase.idl: add IDL magic to force undefined to null so we can handle both missing and null arguments

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (88659 => 88660)


--- trunk/LayoutTests/ChangeLog	2011-06-13 18:22:24 UTC (rev 88659)
+++ trunk/LayoutTests/ChangeLog	2011-06-13 18:29:05 UTC (rev 88660)
@@ -1,3 +1,13 @@
+2011-06-13  Mark Pilgrim  <[email protected]>
+
+        Reviewed by Tony Chang.
+
+        IndexedDB: setVersion() version argument is required
+        https://bugs.webkit.org/show_bug.cgi?id=62401
+
+        * storage/indexeddb/setVersion-undefined-expected.txt: Added.
+        * storage/indexeddb/setVersion-undefined.html: Added.
+
 2011-06-13  Dimitri Glazkov  <[email protected]>
 
         [Chromium] Clean up test expectations, add a flake.

Added: trunk/LayoutTests/storage/indexeddb/setVersion-undefined-expected.txt (0 => 88660)


--- trunk/LayoutTests/storage/indexeddb/setVersion-undefined-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/storage/indexeddb/setVersion-undefined-expected.txt	2011-06-13 18:29:05 UTC (rev 88660)
@@ -0,0 +1,25 @@
+Test IndexedDB version string is required and can not be null
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+indexedDB = window.indexedDB || window.webkitIndexedDB || window.mozIndexedDB;
+PASS indexedDB == null is false
+IDBDatabaseException = window.IDBDatabaseException || window.webkitIDBDatabaseException;
+PASS IDBDatabaseException == null is false
+IDBCursor = window.IDBCursor || window.webkitIDBCursor;
+PASS IDBCursor == null is false
+IDBKeyRange = window.IDBKeyRange || window.webkitIDBKeyRange;
+PASS IDBKeyRange == null is false
+indexedDB.open(name, description)
+db = event.target.result
+Expecting exception from db.setVersion();
+PASS Exception was thrown.
+PASS code is IDBDatabaseException.NON_TRANSIENT_ERR
+Expecting exception from db.setVersion(null);
+PASS Exception was thrown.
+PASS code is IDBDatabaseException.NON_TRANSIENT_ERR
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/storage/indexeddb/setVersion-undefined.html (0 => 88660)


--- trunk/LayoutTests/storage/indexeddb/setVersion-undefined.html	                        (rev 0)
+++ trunk/LayoutTests/storage/indexeddb/setVersion-undefined.html	2011-06-13 18:29:05 UTC (rev 88660)
@@ -0,0 +1,51 @@
+<!DOCTYPE html> 
+<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 version string is required and can not be null");
+if (window.layoutTestController)
+    layoutTestController.waitUntilDone();
+ 
+function test()
+{
+    indexedDB = evalAndLog("indexedDB = window.indexedDB || window.webkitIndexedDB || window.mozIndexedDB;");
+    shouldBeFalse("indexedDB == null");
+    IDBDatabaseException = evalAndLog("IDBDatabaseException = window.IDBDatabaseException || window.webkitIDBDatabaseException;");
+    shouldBeFalse("IDBDatabaseException == null");
+    IDBCursor = evalAndLog("IDBCursor = window.IDBCursor || window.webkitIDBCursor;");
+    shouldBeFalse("IDBCursor == null");
+    IDBKeyRange = evalAndLog("IDBKeyRange = window.IDBKeyRange || window.webkitIDBKeyRange;");
+    shouldBeFalse("IDBKeyRange == null");
+ 
+    name = window.location.pathname;
+    description = "My Test Database";
+    request = evalAndLog("indexedDB.open(name, description)");
+    request._onsuccess_ = openSuccess;
+    request._onerror_ = unexpectedErrorCallback;
+}
+ 
+function openSuccess()
+{
+    db = evalAndLog("db = event.target.result");
+ 
+    request = evalAndExpectException("db.setVersion();", "IDBDatabaseException.NON_TRANSIENT_ERR");
+    request = evalAndExpectException("db.setVersion(null);", "IDBDatabaseException.NON_TRANSIENT_ERR");
+    done();
+}
+ 
+var successfullyParsed = true;
+ 
+test();
+ 
+</script> 
+</body> 
+</html>

Modified: trunk/Source/WebCore/ChangeLog (88659 => 88660)


--- trunk/Source/WebCore/ChangeLog	2011-06-13 18:22:24 UTC (rev 88659)
+++ trunk/Source/WebCore/ChangeLog	2011-06-13 18:29:05 UTC (rev 88660)
@@ -1,3 +1,16 @@
+2011-06-13  Mark Pilgrim  <[email protected]>
+
+        Reviewed by Tony Chang.
+
+        IndexedDB: setVersion() version argument is required
+        https://bugs.webkit.org/show_bug.cgi?id=62401
+
+        Test: storage/indexeddb/setVersion-undefined.html
+
+        * storage/IDBDatabase.cpp:
+        (WebCore::IDBDatabase::setVersion): check for null version
+        * storage/IDBDatabase.idl: add IDL magic to force undefined to null so we can handle both missing and null arguments
+
 2011-06-13  Simon Fraser  <[email protected]>
 
         Reviewed by Adele Peterson.

Modified: trunk/Source/WebCore/storage/IDBDatabase.cpp (88659 => 88660)


--- trunk/Source/WebCore/storage/IDBDatabase.cpp	2011-06-13 18:22:24 UTC (rev 88659)
+++ trunk/Source/WebCore/storage/IDBDatabase.cpp	2011-06-13 18:29:05 UTC (rev 88660)
@@ -105,6 +105,11 @@
 
 PassRefPtr<IDBVersionChangeRequest> IDBDatabase::setVersion(ScriptExecutionContext* context, const String& version, ExceptionCode& ec)
 {
+    if (version.isNull()) {
+        ec = IDBDatabaseException::NON_TRANSIENT_ERR;
+        return 0;
+    }
+
     RefPtr<IDBVersionChangeRequest> request = IDBVersionChangeRequest::create(context, IDBAny::create(this), version);
     m_backend->setVersion(version, request, m_databaseCallbacks, ec);
     return request;

Modified: trunk/Source/WebCore/storage/IDBDatabase.idl (88659 => 88660)


--- trunk/Source/WebCore/storage/IDBDatabase.idl	2011-06-13 18:22:24 UTC (rev 88659)
+++ trunk/Source/WebCore/storage/IDBDatabase.idl	2011-06-13 18:29:05 UTC (rev 88660)
@@ -43,7 +43,7 @@
             raises (IDBDatabaseException);
         void deleteObjectStore(in DOMString name)
             raises (IDBDatabaseException);
-        [CallWith=ScriptExecutionContext] IDBVersionChangeRequest setVersion(in DOMString version)
+        [CallWith=ScriptExecutionContext] IDBVersionChangeRequest setVersion(in [ConvertUndefinedOrNullToNullString] DOMString version)
             raises (IDBDatabaseException);
         [CallWith=ScriptExecutionContext] IDBTransaction transaction(in [Optional] DOMStringList storeNames, in [Optional] unsigned short mode)
             raises (IDBDatabaseException);
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to