Title: [128623] trunk
Revision
128623
Author
commit-qu...@webkit.org
Date
2012-09-14 09:59:33 -0700 (Fri, 14 Sep 2012)

Log Message

WebKitTestRunner needs layoutTestController.dumpDatabaseCallbacks
https://bugs.webkit.org/show_bug.cgi?id=57570

Patch by Christophe Dumez <christophe.du...@intel.com> on 2012-09-14
Reviewed by Kenneth Rohde Christiansen.

Source/WebKit2:

Add new didExceedDatabaseQuota callback to WKBundlePageUIClient
and call it from WebChromeClient::exceededDatabaseQuota().
This is needed by WebKitTestRunner to dump information about
database callbacks.

* Shared/APIClientTraits.h:
* WebProcess/InjectedBundle/API/c/WKBundlePage.h:
* WebProcess/InjectedBundle/InjectedBundle.cpp:
(WebKit::InjectedBundle::setDatabaseQuota): Call WebDatabaseManager::setQuotaForOrigin()
with "file__0" instead of "file:///" as origin identifier. WebDatabaseManager expects
a database identifier, not a string representation of the security origin. "file__0" is
the string that is used as databaseIdentifier of local files. This bug was causing the
database quota not to be set. The test cases would therefore fail due to the quota being
0 instead of the value explicitly set.
* WebProcess/InjectedBundle/InjectedBundlePageUIClient.cpp:
(WebKit::InjectedBundlePageUIClient::didExceedDatabaseQuota):
(WebKit):
* WebProcess/InjectedBundle/InjectedBundlePageUIClient.h:
(InjectedBundlePageUIClient):
* WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::exceededDatabaseQuota):

Tools:

Implement testRunner.dumpDatabaseCallbacks in WebKitTestRunner
and dump the information expected by the test cases.

* WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
* WebKitTestRunner/InjectedBundle/InjectedBundle.cpp:
(WTR::InjectedBundle::beginTesting): Explicitly set the default
database quota.
* WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:
(WTR::securityOriginToStr): New convenience function to convert
a security origin to the string expected in test results.
(WTR):
(WTR::InjectedBundlePage::InjectedBundlePage):
(WTR::InjectedBundlePage::didExceedDatabaseQuota):
(WTR::InjectedBundlePage::didReachApplicationCacheOriginQuota): Minor
refactoring to share code with didExceedDatabaseQuota.
* WebKitTestRunner/InjectedBundle/InjectedBundlePage.h:
(InjectedBundlePage):
* WebKitTestRunner/InjectedBundle/TestRunner.cpp:
(WTR::TestRunner::TestRunner):
* WebKitTestRunner/InjectedBundle/TestRunner.h:
(WTR::TestRunner::dumpDatabaseCallbacks):
(WTR::TestRunner::shouldDumpDatabaseCallbacks):
(TestRunner):

LayoutTests:

Unskip several test cases which require implementation of
testRunner.dumpDatabaseCallbacks in WebKitTestRunner.

* platform/wk2/Skipped:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (128622 => 128623)


--- trunk/LayoutTests/ChangeLog	2012-09-14 16:58:59 UTC (rev 128622)
+++ trunk/LayoutTests/ChangeLog	2012-09-14 16:59:33 UTC (rev 128623)
@@ -1,3 +1,15 @@
+2012-09-14  Christophe Dumez  <christophe.du...@intel.com>
+
+        WebKitTestRunner needs layoutTestController.dumpDatabaseCallbacks
+        https://bugs.webkit.org/show_bug.cgi?id=57570
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        Unskip several test cases which require implementation of
+        testRunner.dumpDatabaseCallbacks in WebKitTestRunner.
+
+        * platform/wk2/Skipped:
+
 2012-09-14  Sudarsana Nagineni  <sudarsana.nagin...@linux.intel.com>
 
         [EFL] Gardening of the WK2 Debug Bot failing tests

Modified: trunk/LayoutTests/platform/wk2/Skipped (128622 => 128623)


--- trunk/LayoutTests/platform/wk2/Skipped	2012-09-14 16:58:59 UTC (rev 128622)
+++ trunk/LayoutTests/platform/wk2/Skipped	2012-09-14 16:59:33 UTC (rev 128623)
@@ -288,11 +288,6 @@
 platform/mac/editing/deleting/deletionUI-minimum-size.html
 platform/mac/editing/deleting/deletionUI-successful-deletion.html
 
-# WebKitTestRunner needs layoutTestController.dumpDatabaseCallbacks
-# <https://bugs.webkit.org/show_bug.cgi?id=57570>
-storage/websql/open-database-creation-callback.html
-storage/websql/quota-tracking.html
-
 # WebKitTestRunner needs layoutTestController.setMockGeolocationPosition
 # and layoutTestController.setMockGeolocationError
 # <https://bugs.webkit.org/show_bug.cgi?id=59201>

Modified: trunk/Source/WebKit2/ChangeLog (128622 => 128623)


--- trunk/Source/WebKit2/ChangeLog	2012-09-14 16:58:59 UTC (rev 128622)
+++ trunk/Source/WebKit2/ChangeLog	2012-09-14 16:59:33 UTC (rev 128623)
@@ -1,5 +1,34 @@
 2012-09-14  Christophe Dumez  <christophe.du...@intel.com>
 
+        WebKitTestRunner needs layoutTestController.dumpDatabaseCallbacks
+        https://bugs.webkit.org/show_bug.cgi?id=57570
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        Add new didExceedDatabaseQuota callback to WKBundlePageUIClient
+        and call it from WebChromeClient::exceededDatabaseQuota().
+        This is needed by WebKitTestRunner to dump information about
+        database callbacks.
+
+        * Shared/APIClientTraits.h:
+        * WebProcess/InjectedBundle/API/c/WKBundlePage.h:
+        * WebProcess/InjectedBundle/InjectedBundle.cpp:
+        (WebKit::InjectedBundle::setDatabaseQuota): Call WebDatabaseManager::setQuotaForOrigin()
+        with "file__0" instead of "file:///" as origin identifier. WebDatabaseManager expects
+        a database identifier, not a string representation of the security origin. "file__0" is
+        the string that is used as databaseIdentifier of local files. This bug was causing the
+        database quota not to be set. The test cases would therefore fail due to the quota being
+        0 instead of the value explicitly set.
+        * WebProcess/InjectedBundle/InjectedBundlePageUIClient.cpp:
+        (WebKit::InjectedBundlePageUIClient::didExceedDatabaseQuota):
+        (WebKit):
+        * WebProcess/InjectedBundle/InjectedBundlePageUIClient.h:
+        (InjectedBundlePageUIClient):
+        * WebProcess/WebCoreSupport/WebChromeClient.cpp:
+        (WebKit::WebChromeClient::exceededDatabaseQuota):
+
+2012-09-14  Christophe Dumez  <christophe.du...@intel.com>
+
         WebKitTestRunner needs layoutTestController.setStopProvisionalFrameLoads
         https://bugs.webkit.org/show_bug.cgi?id=42691
 

Modified: trunk/Source/WebKit2/Shared/APIClientTraits.h (128622 => 128623)


--- trunk/Source/WebKit2/Shared/APIClientTraits.h	2012-09-14 16:58:59 UTC (rev 128622)
+++ trunk/Source/WebKit2/Shared/APIClientTraits.h	2012-09-14 16:59:33 UTC (rev 128623)
@@ -55,7 +55,7 @@
 };
 
 template<> struct APIClientTraits<WKBundlePageUIClient> {
-    static const size_t interfaceSizesByVersion[2];
+    static const size_t interfaceSizesByVersion[3];
 };
 
 template<> struct APIClientTraits<WKPageContextMenuClient> {

Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.h (128622 => 128623)


--- trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.h	2012-09-14 16:58:59 UTC (rev 128622)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.h	2012-09-14 16:59:33 UTC (rev 128623)
@@ -237,6 +237,7 @@
 typedef WKBundlePageUIElementVisibility (*WKBundlePageMenuBarIsVisibleCallback)(WKBundlePageRef page, const void *clientInfo);
 typedef WKBundlePageUIElementVisibility (*WKBundlePageToolbarsAreVisibleCallback)(WKBundlePageRef page, const void *clientInfo);
 typedef void (*WKBundlePageReachedAppCacheOriginQuotaCallback)(WKBundlePageRef page, WKSecurityOriginRef origin, int64_t totalBytesNeeded, const void *clientInfo);
+typedef uint64_t (*WKBundlePageExceededDatabaseQuotaCallback)(WKBundlePageRef page, WKSecurityOriginRef origin, WKStringRef databaseName, WKStringRef databaseDisplayName, uint64_t currentQuotaBytes, uint64_t currentOriginUsageBytes, uint64_t currentDatabaseUsageBytes, uint64_t expectedUsageBytes, const void *clientInfo);
 
 struct WKBundlePageUIClient {
     int                                                                 version;
@@ -258,10 +259,14 @@
 
     // Version 1.
     WKBundlePageReachedAppCacheOriginQuotaCallback                      didReachApplicationCacheOriginQuota;
+
+    // Version 2.
+    WKBundlePageExceededDatabaseQuotaCallback                           didExceedDatabaseQuota;
+
 };
 typedef struct WKBundlePageUIClient WKBundlePageUIClient;
 
-enum { kWKBundlePageUIClientCurrentVersion = 1 };
+enum { kWKBundlePageUIClientCurrentVersion = 2 };
 
 // Editor client
 typedef bool (*WKBundlePageShouldBeginEditingCallback)(WKBundlePageRef page, WKBundleRangeHandleRef range, const void* clientInfo);

Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp (128622 => 128623)


--- trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp	2012-09-14 16:58:59 UTC (rev 128622)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp	2012-09-14 16:59:33 UTC (rev 128623)
@@ -327,7 +327,9 @@
 void InjectedBundle::setDatabaseQuota(uint64_t quota)
 {
 #if ENABLE(SQL_DATABASE)
-    WebDatabaseManager::shared().setQuotaForOrigin("file:///", quota);
+    // Historically, we've used the following (somewhat non-sensical) string
+    // for the databaseIdentifier of local files.
+    WebDatabaseManager::shared().setQuotaForOrigin("file__0", quota);
 #endif
 }
 

Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageUIClient.cpp (128622 => 128623)


--- trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageUIClient.cpp	2012-09-14 16:58:59 UTC (rev 128622)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageUIClient.cpp	2012-09-14 16:59:33 UTC (rev 128623)
@@ -155,4 +155,12 @@
     m_client.didReachApplicationCacheOriginQuota(toAPI(page), toAPI(origin), totalBytesNeeded, m_client.clientInfo);
 }
 
+uint64_t InjectedBundlePageUIClient::didExceedDatabaseQuota(WebPage* page, WebSecurityOrigin* origin, const String& databaseName, const String& databaseDisplayName, uint64_t currentQuotaBytes, uint64_t currentOriginUsageBytes, uint64_t currentDatabaseUsageBytes, uint64_t expectedUsageBytes)
+{
+    if (!m_client.didExceedDatabaseQuota)
+        return 0;
+
+    return m_client.didExceedDatabaseQuota(toAPI(page), toAPI(origin), toAPI(databaseName.impl()), toAPI(databaseDisplayName.impl()), currentQuotaBytes, currentOriginUsageBytes, currentDatabaseUsageBytes, expectedUsageBytes, m_client.clientInfo);
+}
+
 } // namespace WebKit

Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageUIClient.h (128622 => 128623)


--- trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageUIClient.h	2012-09-14 16:58:59 UTC (rev 128622)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageUIClient.h	2012-09-14 16:59:33 UTC (rev 128623)
@@ -67,6 +67,7 @@
     WKBundlePageUIElementVisibility toolbarsAreVisible(WebPage*);
 
     void didReachApplicationCacheOriginQuota(WebPage*, WebSecurityOrigin*, int64_t totalBytesNeeded);
+    uint64_t didExceedDatabaseQuota(WebPage*, WebSecurityOrigin*, const String& databaseName, const String& databaseDisplayName, uint64_t currentQuotaBytes, uint64_t currentOriginUsageBytes, uint64_t currentDatabaseUsageBytes, uint64_t expectedUsageBytes);
 };
 
 } // namespace WebKit

Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp (128622 => 128623)


--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp	2012-09-14 16:58:59 UTC (rev 128622)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp	2012-09-14 16:59:33 UTC (rev 128623)
@@ -536,10 +536,15 @@
     uint64_t currentQuota = DatabaseTracker::tracker().quotaForOrigin(origin);
     uint64_t currentOriginUsage = DatabaseTracker::tracker().usageForOrigin(origin);
     uint64_t newQuota = 0;
-    WebProcess::shared().connection()->sendSync(
-        Messages::WebPageProxy::ExceededDatabaseQuota(webFrame->frameID(), origin->databaseIdentifier(), databaseName, details.displayName(), currentQuota, currentOriginUsage, details.currentUsage(), details.expectedUsage()),
-        Messages::WebPageProxy::ExceededDatabaseQuota::Reply(newQuota), m_page->pageID());
+    RefPtr<WebSecurityOrigin> webSecurityOrigin = WebSecurityOrigin::createFromDatabaseIdentifier(origin->databaseIdentifier());
+    newQuota = m_page->injectedBundleUIClient().didExceedDatabaseQuota(m_page, webSecurityOrigin.get(), databaseName, details.displayName(), currentQuota, currentOriginUsage, details.currentUsage(), details.expectedUsage());
 
+    if (!newQuota) {
+        WebProcess::shared().connection()->sendSync(
+            Messages::WebPageProxy::ExceededDatabaseQuota(webFrame->frameID(), origin->databaseIdentifier(), databaseName, details.displayName(), currentQuota, currentOriginUsage, details.currentUsage(), details.expectedUsage()),
+            Messages::WebPageProxy::ExceededDatabaseQuota::Reply(newQuota), m_page->pageID());
+    }
+
     DatabaseTracker::tracker().setQuota(origin, newQuota);
 }
 #endif

Modified: trunk/Tools/ChangeLog (128622 => 128623)


--- trunk/Tools/ChangeLog	2012-09-14 16:58:59 UTC (rev 128622)
+++ trunk/Tools/ChangeLog	2012-09-14 16:59:33 UTC (rev 128623)
@@ -1,3 +1,34 @@
+2012-09-14  Christophe Dumez  <christophe.du...@intel.com>
+
+        WebKitTestRunner needs layoutTestController.dumpDatabaseCallbacks
+        https://bugs.webkit.org/show_bug.cgi?id=57570
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        Implement testRunner.dumpDatabaseCallbacks in WebKitTestRunner
+        and dump the information expected by the test cases.
+
+        * WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
+        * WebKitTestRunner/InjectedBundle/InjectedBundle.cpp:
+        (WTR::InjectedBundle::beginTesting): Explicitly set the default
+        database quota.
+        * WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:
+        (WTR::securityOriginToStr): New convenience function to convert
+        a security origin to the string expected in test results.
+        (WTR):
+        (WTR::InjectedBundlePage::InjectedBundlePage):
+        (WTR::InjectedBundlePage::didExceedDatabaseQuota):
+        (WTR::InjectedBundlePage::didReachApplicationCacheOriginQuota): Minor
+        refactoring to share code with didExceedDatabaseQuota.
+        * WebKitTestRunner/InjectedBundle/InjectedBundlePage.h:
+        (InjectedBundlePage):
+        * WebKitTestRunner/InjectedBundle/TestRunner.cpp:
+        (WTR::TestRunner::TestRunner):
+        * WebKitTestRunner/InjectedBundle/TestRunner.h:
+        (WTR::TestRunner::dumpDatabaseCallbacks):
+        (WTR::TestRunner::shouldDumpDatabaseCallbacks):
+        (TestRunner):
+
 2012-09-14  Tor Arne Vestbø  <tor.arne.ves...@nokia.com>
 
         [Qt] Set force_static_libs_as_shared early enough to be caught by configure

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl (128622 => 128623)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl	2012-09-14 16:58:59 UTC (rev 128622)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl	2012-09-14 16:59:33 UTC (rev 128623)
@@ -48,6 +48,7 @@
         void dumpResourceResponseMIMETypes();
         void dumpWillCacheResponse();
         void dumpApplicationCacheDelegateCallbacks();
+        void dumpDatabaseCallbacks();
 
         // Special options.
         void keepWebHistory();

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp (128622 => 128623)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp	2012-09-14 16:58:59 UTC (rev 128622)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp	2012-09-14 16:59:33 UTC (rev 128623)
@@ -260,6 +260,7 @@
     WKBundleClearAllDatabases(m_bundle);
     WKBundleClearApplicationCache(m_bundle);
     WKBundleResetOriginAccessWhitelists(m_bundle);
+    WKBundleSetDatabaseQuota(m_bundle, 5 * 1024 * 1024);
 }
 
 void InjectedBundle::done()

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp (128622 => 128623)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp	2012-09-14 16:58:59 UTC (rev 128622)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp	2012-09-14 16:59:33 UTC (rev 128623)
@@ -194,6 +194,20 @@
     return stringBuilder.toString();
 }
 
+static WTF::String securityOriginToStr(WKSecurityOriginRef origin)
+{
+    WTF::StringBuilder stringBuilder;
+    stringBuilder.append('{');
+    stringBuilder.append(toWTFString(adoptWK(WKSecurityOriginCopyProtocol(origin))));
+    stringBuilder.appendLiteral(", ");
+    stringBuilder.append(toWTFString(adoptWK(WKSecurityOriginCopyHost(origin))));
+    stringBuilder.appendLiteral(", ");
+    stringBuilder.appendNumber(WKSecurityOriginGetPort(origin));
+    stringBuilder.append('}');
+
+    return stringBuilder.toString();
+}
+
 static WTF::String frameToStr(WKBundleFrameRef frame)
 {
     WKRetainPtr<WKStringRef> name(AdoptWK, WKBundleFrameCopyName(frame));
@@ -360,6 +374,7 @@
         0, /*menuBarIsVisible*/
         0, /*toolbarsAreVisible*/
         didReachApplicationCacheOriginQuota,
+        didExceedDatabaseQuota,
     };
     WKBundlePageSetUIClient(m_page, &uiClient);
 
@@ -1335,6 +1350,11 @@
     static_cast<InjectedBundlePage*>(const_cast<void*>(clientInfo))->didReachApplicationCacheOriginQuota(origin, totalBytesNeeded);
 }
 
+uint64_t InjectedBundlePage::didExceedDatabaseQuota(WKBundlePageRef page, WKSecurityOriginRef origin, WKStringRef databaseName, WKStringRef databaseDisplayName, uint64_t currentQuotaBytes, uint64_t currentOriginUsageBytes, uint64_t currentDatabaseUsageBytes, uint64_t expectedUsageBytes, const void* clientInfo)
+{
+    return static_cast<InjectedBundlePage*>(const_cast<void*>(clientInfo))->didExceedDatabaseQuota(origin, databaseName, databaseDisplayName, currentQuotaBytes, currentOriginUsageBytes, currentDatabaseUsageBytes, expectedUsageBytes);
+}
+
 static WTF::String lastFileURLPathComponent(const WTF::String& path)
 {
     size_t pos = path.find("file://");
@@ -1421,25 +1441,20 @@
 
 void InjectedBundlePage::didReachApplicationCacheOriginQuota(WKSecurityOriginRef origin, int64_t totalBytesNeeded)
 {
-    if (!InjectedBundle::shared().testRunner()->shouldDumpApplicationCacheDelegateCallbacks())
-        return;
+    if (InjectedBundle::shared().testRunner()->shouldDumpApplicationCacheDelegateCallbacks()) {
+        // For example, numbers from 30000 - 39999 will output as 30000.
+        // Rounding up or down does not really matter for these tests. It's
+        // sufficient to just get a range of 10000 to determine if we were
+        // above or below a threshold.
+        int64_t truncatedSpaceNeeded = (totalBytesNeeded / 10000) * 10000;
 
-    // For example, numbers from 30000 - 39999 will output as 30000.
-    // Rounding up or down does not really matter for these tests. It's
-    // sufficient to just get a range of 10000 to determine if we were
-    // above or below a threshold.
-    int64_t truncatedSpaceNeeded = (totalBytesNeeded / 10000) * 10000;
+        InjectedBundle::shared().stringBuilder()->appendLiteral("UI DELEGATE APPLICATION CACHE CALLBACK: exceededApplicationCacheOriginQuotaForSecurityOrigin:");
+        InjectedBundle::shared().stringBuilder()->append(securityOriginToStr(origin));
+        InjectedBundle::shared().stringBuilder()->appendLiteral(" totalSpaceNeeded:~");
+        InjectedBundle::shared().stringBuilder()->appendNumber(truncatedSpaceNeeded);
+        InjectedBundle::shared().stringBuilder()->append('\n');
+    }
 
-    InjectedBundle::shared().stringBuilder()->appendLiteral("UI DELEGATE APPLICATION CACHE CALLBACK: exceededApplicationCacheOriginQuotaForSecurityOrigin:{");
-    InjectedBundle::shared().stringBuilder()->append(toWTFString(adoptWK(WKSecurityOriginCopyProtocol(origin))));
-    InjectedBundle::shared().stringBuilder()->appendLiteral(", ");
-    InjectedBundle::shared().stringBuilder()->append(toWTFString(adoptWK(WKSecurityOriginCopyHost(origin))));
-    InjectedBundle::shared().stringBuilder()->appendLiteral(", ");
-    InjectedBundle::shared().stringBuilder()->appendNumber(WKSecurityOriginGetPort(origin));
-    InjectedBundle::shared().stringBuilder()->appendLiteral("} totalSpaceNeeded:~");
-    InjectedBundle::shared().stringBuilder()->appendNumber(truncatedSpaceNeeded);
-    InjectedBundle::shared().stringBuilder()->append('\n');
-
     if (InjectedBundle::shared().testRunner()->shouldDisallowIncreaseForApplicationCacheQuota())
         return;
 
@@ -1447,6 +1462,20 @@
     WKBundleResetApplicationCacheOriginQuota(InjectedBundle::shared().bundle(), adoptWK(WKSecurityOriginCopyToString(origin)).get());
 }
 
+uint64_t InjectedBundlePage::didExceedDatabaseQuota(WKSecurityOriginRef origin, WKStringRef databaseName, WKStringRef databaseDisplayName, uint64_t currentQuotaBytes, uint64_t currentOriginUsageBytes, uint64_t currentDatabaseUsageBytes, uint64_t expectedUsageBytes)
+{
+    if (InjectedBundle::shared().testRunner()->shouldDumpDatabaseCallbacks()) {
+        InjectedBundle::shared().stringBuilder()->appendLiteral("UI DELEGATE DATABASE CALLBACK: exceededDatabaseQuotaForSecurityOrigin:");
+        InjectedBundle::shared().stringBuilder()->append(securityOriginToStr(origin));
+        InjectedBundle::shared().stringBuilder()->appendLiteral(" database:");
+        InjectedBundle::shared().stringBuilder()->append(toWTFString(databaseName));
+        InjectedBundle::shared().stringBuilder()->append('\n');
+    }
+
+    static const uint64_t defaultQuota = 5 * 1024 * 1024;
+    return defaultQuota;
+}
+
 // Editor Client Callbacks
 
 bool InjectedBundlePage::shouldBeginEditing(WKBundlePageRef page, WKBundleRangeHandleRef range, const void* clientInfo)

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.h (128622 => 128623)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.h	2012-09-14 16:58:59 UTC (rev 128622)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.h	2012-09-14 16:59:33 UTC (rev 128623)
@@ -125,12 +125,14 @@
     static void willRunJavaScriptConfirm(WKBundlePageRef, WKStringRef message, WKBundleFrameRef frame, const void* clientInfo);
     static void willRunJavaScriptPrompt(WKBundlePageRef, WKStringRef message, WKStringRef defaultValue, WKBundleFrameRef frame, const void* clientInfo);
     static void didReachApplicationCacheOriginQuota(WKBundlePageRef, WKSecurityOriginRef, int64_t totalBytesNeeded, const void* clientInfo);
+    static uint64_t didExceedDatabaseQuota(WKBundlePageRef, WKSecurityOriginRef, WKStringRef databaseName, WKStringRef databaseDisplayName, uint64_t currentQuotaBytes, uint64_t currentOriginUsageBytes, uint64_t currentDatabaseUsageBytes, uint64_t expectedUsageBytes, const void* clientInfo);
     void willAddMessageToConsole(WKStringRef message, uint32_t lineNumber);
     void willSetStatusbarText(WKStringRef statusbarText);
     void willRunJavaScriptAlert(WKStringRef message, WKBundleFrameRef);
     void willRunJavaScriptConfirm(WKStringRef message, WKBundleFrameRef);
     void willRunJavaScriptPrompt(WKStringRef message, WKStringRef defaultValue, WKBundleFrameRef);
     void didReachApplicationCacheOriginQuota(WKSecurityOriginRef, int64_t totalBytesNeeded);
+    uint64_t didExceedDatabaseQuota(WKSecurityOriginRef, WKStringRef databaseName, WKStringRef databaseDisplayName, uint64_t currentQuotaBytes, uint64_t currentOriginUsageBytes, uint64_t currentDatabaseUsageBytes, uint64_t expectedUsageBytes);
 
 #if ENABLE(FULLSCREEN_API)
     // Full Screen client

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp (128622 => 128623)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp	2012-09-14 16:58:59 UTC (rev 128622)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp	2012-09-14 16:59:33 UTC (rev 128623)
@@ -81,6 +81,7 @@
     , m_dumpResourceResponseMIMETypes(false)
     , m_dumpWillCacheResponse(false)
     , m_dumpApplicationCacheDelegateCallbacks(false)
+    , m_dumpDatabaseCallbacks(false)
     , m_disallowIncreaseForApplicationCacheQuota(false)
     , m_waitToDump(false)
     , m_testRepaint(false)

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h (128622 => 128623)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h	2012-09-14 16:58:59 UTC (rev 128622)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h	2012-09-14 16:59:33 UTC (rev 128623)
@@ -83,6 +83,7 @@
     void dumpResourceResponseMIMETypes() { m_dumpResourceResponseMIMETypes = true; }
     void dumpWillCacheResponse() { m_dumpWillCacheResponse = true; }
     void dumpApplicationCacheDelegateCallbacks() { m_dumpApplicationCacheDelegateCallbacks = true; }
+    void dumpDatabaseCallbacks() { m_dumpDatabaseCallbacks = true; }
 
     void setShouldDumpFrameLoadCallbacks(bool value) { m_dumpFrameLoadCallbacks = value; }
     void setShouldDumpProgressFinishedCallback(bool value) { m_dumpProgressFinishedCallback = value; }
@@ -177,6 +178,7 @@
     bool shouldDumpResourceResponseMIMETypes() const { return m_dumpResourceResponseMIMETypes; }
     bool shouldDumpWillCacheResponse() const { return m_dumpWillCacheResponse; }
     bool shouldDumpApplicationCacheDelegateCallbacks() const { return m_dumpApplicationCacheDelegateCallbacks; }
+    bool shouldDumpDatabaseCallbacks() const { return m_dumpDatabaseCallbacks; }
 
     bool isPolicyDelegateEnabled() const { return m_policyDelegateEnabled; }
     bool isPolicyDelegatePermissive() const { return m_policyDelegatePermissive; }
@@ -279,6 +281,7 @@
     bool m_dumpResourceResponseMIMETypes;
     bool m_dumpWillCacheResponse;
     bool m_dumpApplicationCacheDelegateCallbacks;
+    bool m_dumpDatabaseCallbacks;
     bool m_disallowIncreaseForApplicationCacheQuota;
     bool m_waitToDump; // True if waitUntilDone() has been called, but notifyDone() has not yet been called.
     bool m_testRepaint;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to