[SCM] WebKit Debian packaging branch, webkit-1.2, updated. upstream/1.1.90-6072-g9a69373

eric at webkit.org eric at webkit.org
Wed Apr 7 23:16:50 UTC 2010


The following commit has been merged in the webkit-1.2 branch:
commit d7e262e5a8ccf918902e07b8e195d1a4795e8579
Author: eric at webkit.org <eric at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Oct 30 20:20:32 2009 +0000

    2009-10-30  Ben Murdoch  <benm at google.com>
    
            Reviewed by David Kilzer.
    
            openDatabase() with empty version sets db version up incorrectly
            https://bugs.webkit.org/show_bug.cgi?id=28417
    
            * storage/open-database-set-empty-version-expected.txt: Added.
            * storage/open-database-set-empty-version.html: Added.
    2009-10-30  Ben Murdoch  <benm at google.com>
    
            Reviewed by David Kilzer.
    
            openDatabase() with empty version sets db version up incorrectly
            https://bugs.webkit.org/show_bug.cgi?id=28417
    
            Test: storage/open-database-set-empty-version.html
    
            * storage/Database.cpp:
            (WebCore::Database::performOpenAndVerify): Raise an exception if the current database version does not match the expected version when the current version is the empty string.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@50350 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 95ee8fa..ea40c09 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,13 @@
+2009-10-30  Ben Murdoch  <benm at google.com>
+
+        Reviewed by David Kilzer.
+
+        openDatabase() with empty version sets db version up incorrectly
+        https://bugs.webkit.org/show_bug.cgi?id=28417
+
+        * storage/open-database-set-empty-version-expected.txt: Added.
+        * storage/open-database-set-empty-version.html: Added.
+
 2009-10-30  Shinichiro Hamaji  <hamaji at chromium.org>
 
         Reviewed by Darin Adler.
diff --git a/LayoutTests/storage/open-database-set-empty-version-expected.txt b/LayoutTests/storage/open-database-set-empty-version-expected.txt
new file mode 100644
index 0000000..fa2a450
--- /dev/null
+++ b/LayoutTests/storage/open-database-set-empty-version-expected.txt
@@ -0,0 +1,2 @@
+This tests that calling openDatabase with an empty version string sets the current version of that database to the empty string and subsequent attempts to open the database with a different expected version throw an exception.
+SUCCESS, an exception was thrown. Error: INVALID_STATE_ERR: DOM Exception 11
diff --git a/LayoutTests/storage/open-database-set-empty-version.html b/LayoutTests/storage/open-database-set-empty-version.html
new file mode 100644
index 0000000..f3607fd
--- /dev/null
+++ b/LayoutTests/storage/open-database-set-empty-version.html
@@ -0,0 +1,26 @@
+<html>
+<head>
+<script>
+function runTest() {
+    if (window.layoutTestController) {
+        layoutTestController.dumpAsText();
+        layoutTestController.clearAllDatabases();
+    }
+    
+    try {    
+        var db = openDatabase('28417Test', '', 'Test for bug 28417: openDatabase() with empty version sets db version up incorrectly', 0);
+        // The next openDatabase call should fail because the database version was set to '' by the call above, and now we are expecting a different version.
+        var db2 = openDatabase('28417Test', 'test', 'Test for bug 28417: openDatabase() with empty version sets db version up incorrectly', 0);
+    } catch (e) {
+        document.getElementById('result').innerHTML = 'SUCCESS, an exception was thrown. ' + e;
+    }
+}
+</script>
+</head>
+<body onload="runTest()">
+<div>This tests that calling openDatabase with an empty version string sets the current version of that database to the empty string and subsequent attempts to open the database with a different expected version throw an exception.</div>
+<div id="result">
+FAILURE - an exception was expected.
+</div>
+</body>
+</html>
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 27eed28..369684a 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,15 @@
+2009-10-30  Ben Murdoch  <benm at google.com>
+
+        Reviewed by David Kilzer.
+
+        openDatabase() with empty version sets db version up incorrectly
+        https://bugs.webkit.org/show_bug.cgi?id=28417
+
+        Test: storage/open-database-set-empty-version.html
+
+        * storage/Database.cpp:
+        (WebCore::Database::performOpenAndVerify): Raise an exception if the current database version does not match the expected version when the current version is the empty string.
+
 2009-10-30  John Gregg  <johnnyg at google.com>
 
         Reviewed by David Levin.
diff --git a/WebCore/storage/Database.cpp b/WebCore/storage/Database.cpp
index 2f82743..411c1d3 100644
--- a/WebCore/storage/Database.cpp
+++ b/WebCore/storage/Database.cpp
@@ -497,15 +497,13 @@ bool Database::performOpenAndVerify(ExceptionCode& e)
         currentVersion = "";
     }
 
-    // FIXME: For now, the spec says that if the database has no version, it is valid for any "Expected version" string.  That seems silly and I think it should be
-    // changed, and here's where we would change it
-    if (m_expectedVersion.length()) {
-        if (currentVersion.length() && m_expectedVersion != currentVersion) {
-            LOG(StorageAPI, "page expects version %s from database %s, which actually has version name %s - openDatabase() call will fail", m_expectedVersion.ascii().data(),
-                databaseDebugName().ascii().data(), currentVersion.ascii().data());
-            e = INVALID_STATE_ERR;
-            return false;
-        }
+    // If the expected version isn't the empty string, ensure that the current database version we have matches that version. Otherwise, set an exception.
+    // If the expected version is the empty string, then we always return with whatever version of the database we have.
+    if (m_expectedVersion.length() && m_expectedVersion != currentVersion) {
+        LOG(StorageAPI, "page expects version %s from database %s, which actually has version name %s - openDatabase() call will fail", m_expectedVersion.ascii().data(),
+            databaseDebugName().ascii().data(), currentVersion.ascii().data());
+        e = INVALID_STATE_ERR;
+        return false;
     }
 
     return true;

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list