<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[170320] trunk/Source/WebKit2</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/170320">170320</a></dd>
<dt>Author</dt> <dd>mitz@apple.com</dd>
<dt>Date</dt> <dd>2014-06-23 14:32:43 -0700 (Mon, 23 Jun 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>[Cocoa] No way to grant storage quotas for web application cache
https://bugs.webkit.org/show_bug.cgi?id=134213

Reviewed by Anders Carlsson.

* UIProcess/API/APIUIClient.h:
(API::UIClient::reachedApplicationCacheOriginQuota): Added this new client function, with
a default implementation that calls the completion handler with the current quota.

* UIProcess/API/Cocoa/WKUIDelegatePrivate.h: Declared a new delegate method.

* UIProcess/API/Cocoa/_WKSecurityOrigin.mm:
(-[_WKSecurityOrigin _initWithSecurityOrigin:WebCore::]): Changed the parameter into a const
reference, since we copy it.
* UIProcess/API/Cocoa/_WKSecurityOriginInternal.h:

* UIProcess/Cocoa/UIDelegate.h: Override API::UIClient::reachedApplicationCacheOriginQuota.
Added flag to m_delegateMethods struct for new delegate method.
* UIProcess/Cocoa/UIDelegate.mm:
(WebKit::UIDelegate::setDelegate): Set new flag in m_delegateMethods struct.
(WebKit::UIDelegate::UIClient::exceededDatabaseQuota): Updated for change in
_WKSecurityOrigin initializer.
(WebKit::UIDelegate::UIClient::reachedApplicationCacheOriginQuota): Added. Calls the new
delegate method.

* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::reachedApplicationCacheOriginQuota): Added. Forwards the message to
the UI client.
* UIProcess/WebPageProxy.h:

* UIProcess/WebPageProxy.messages.in: Added ReachedApplicationCacheOriginQuota message.

* WebProcess/InjectedBundle/API/APIInjectedBundlePageUIClient.h:
(API::InjectedBundle::PageUIClient::didReachApplicationCacheOriginQuota): Changed the return
type to bool, indicating whether the client handled the callback.

* WebProcess/InjectedBundle/InjectedBundlePageUIClient.cpp:
(WebKit::InjectedBundlePageUIClient::didReachApplicationCacheOriginQuota): Return the
appropriate value.
* WebProcess/InjectedBundle/InjectedBundlePageUIClient.h:

* WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::reachedApplicationCacheOriginQuota): If the bundle client didn’t
handle the callback, send a message the the UI process, and update the quota with the reply.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPIAPIUIClienth">trunk/Source/WebKit2/UIProcess/API/APIUIClient.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICocoaWKUIDelegatePrivateh">trunk/Source/WebKit2/UIProcess/API/Cocoa/WKUIDelegatePrivate.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICocoa_WKSecurityOriginmm">trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKSecurityOrigin.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICocoa_WKSecurityOriginInternalh">trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKSecurityOriginInternal.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessCocoaUIDelegateh">trunk/Source/WebKit2/UIProcess/Cocoa/UIDelegate.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessCocoaUIDelegatemm">trunk/Source/WebKit2/UIProcess/Cocoa/UIDelegate.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebPageProxycpp">trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebPageProxyh">trunk/Source/WebKit2/UIProcess/WebPageProxy.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebPageProxymessagesin">trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in</a></li>
<li><a href="#trunkSourceWebKit2WebProcessInjectedBundleAPIAPIInjectedBundlePageUIClienth">trunk/Source/WebKit2/WebProcess/InjectedBundle/API/APIInjectedBundlePageUIClient.h</a></li>
<li><a href="#trunkSourceWebKit2WebProcessInjectedBundleInjectedBundlePageUIClientcpp">trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageUIClient.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebProcessInjectedBundleInjectedBundlePageUIClienth">trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageUIClient.h</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebCoreSupportWebChromeClientcpp">trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (170319 => 170320)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2014-06-23 21:32:03 UTC (rev 170319)
+++ trunk/Source/WebKit2/ChangeLog        2014-06-23 21:32:43 UTC (rev 170320)
</span><span class="lines">@@ -1,3 +1,50 @@
</span><ins>+2014-06-23  Dan Bernstein  &lt;mitz@apple.com&gt;
+
+        [Cocoa] No way to grant storage quotas for web application cache
+        https://bugs.webkit.org/show_bug.cgi?id=134213
+
+        Reviewed by Anders Carlsson.
+
+        * UIProcess/API/APIUIClient.h:
+        (API::UIClient::reachedApplicationCacheOriginQuota): Added this new client function, with
+        a default implementation that calls the completion handler with the current quota.
+
+        * UIProcess/API/Cocoa/WKUIDelegatePrivate.h: Declared a new delegate method.
+
+        * UIProcess/API/Cocoa/_WKSecurityOrigin.mm:
+        (-[_WKSecurityOrigin _initWithSecurityOrigin:WebCore::]): Changed the parameter into a const
+        reference, since we copy it.
+        * UIProcess/API/Cocoa/_WKSecurityOriginInternal.h:
+
+        * UIProcess/Cocoa/UIDelegate.h: Override API::UIClient::reachedApplicationCacheOriginQuota.
+        Added flag to m_delegateMethods struct for new delegate method.
+        * UIProcess/Cocoa/UIDelegate.mm:
+        (WebKit::UIDelegate::setDelegate): Set new flag in m_delegateMethods struct.
+        (WebKit::UIDelegate::UIClient::exceededDatabaseQuota): Updated for change in
+        _WKSecurityOrigin initializer.
+        (WebKit::UIDelegate::UIClient::reachedApplicationCacheOriginQuota): Added. Calls the new
+        delegate method.
+
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::reachedApplicationCacheOriginQuota): Added. Forwards the message to
+        the UI client.
+        * UIProcess/WebPageProxy.h:
+
+        * UIProcess/WebPageProxy.messages.in: Added ReachedApplicationCacheOriginQuota message.
+
+        * WebProcess/InjectedBundle/API/APIInjectedBundlePageUIClient.h:
+        (API::InjectedBundle::PageUIClient::didReachApplicationCacheOriginQuota): Changed the return
+        type to bool, indicating whether the client handled the callback.
+
+        * WebProcess/InjectedBundle/InjectedBundlePageUIClient.cpp:
+        (WebKit::InjectedBundlePageUIClient::didReachApplicationCacheOriginQuota): Return the
+        appropriate value.
+        * WebProcess/InjectedBundle/InjectedBundlePageUIClient.h:
+
+        * WebProcess/WebCoreSupport/WebChromeClient.cpp:
+        (WebKit::WebChromeClient::reachedApplicationCacheOriginQuota): If the bundle client didn’t
+        handle the callback, send a message the the UI process, and update the quota with the reply.
+
</ins><span class="cx"> 2014-06-23  Tim Horton  &lt;timothy_horton@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [wk2] Synchronously wait a short time for a layer tree update after bringing a web view in-window
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIAPIUIClienth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/APIUIClient.h (170319 => 170320)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/APIUIClient.h        2014-06-23 21:32:03 UTC (rev 170319)
+++ trunk/Source/WebKit2/UIProcess/API/APIUIClient.h        2014-06-23 21:32:43 UTC (rev 170320)
</span><span class="lines">@@ -115,6 +115,11 @@
</span><span class="cx">         completionHandler(currentQuota);
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    virtual void reachedApplicationCacheOriginQuota(WebKit::WebPageProxy*, const WebCore::SecurityOrigin&amp;, uint64_t currentQuota, uint64_t totalBytesNeeded, std::function&lt;void (unsigned long long)&gt; completionHandler)
+    {
+        completionHandler(currentQuota);
+    }
+
</ins><span class="cx">     virtual bool runOpenPanel(WebKit::WebPageProxy*, WebKit::WebFrameProxy*, WebKit::WebOpenPanelParameters*, WebKit::WebOpenPanelResultListenerProxy*) { return false; }
</span><span class="cx">     virtual bool decidePolicyForGeolocationPermissionRequest(WebKit::WebPageProxy*, WebKit::WebFrameProxy*, WebKit::WebSecurityOrigin*, WebKit::GeolocationPermissionRequestProxy*) { return false; }
</span><span class="cx">     virtual bool decidePolicyForNotificationPermissionRequest(WebKit::WebPageProxy*, WebKit::WebSecurityOrigin*, WebKit::NotificationPermissionRequest*) { return false; }
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICocoaWKUIDelegatePrivateh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKUIDelegatePrivate.h (170319 => 170320)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKUIDelegatePrivate.h        2014-06-23 21:32:03 UTC (rev 170319)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKUIDelegatePrivate.h        2014-06-23 21:32:43 UTC (rev 170320)
</span><span class="lines">@@ -39,6 +39,9 @@
</span><span class="cx"> // FIXME: This should be handled by the WKWebsiteDataStore delegate.
</span><span class="cx"> - (void)_webView:(WKWebView *)webView decideDatabaseQuotaForSecurityOrigin:(_WKSecurityOrigin *)securityOrigin currentQuota:(unsigned long long)currentQuota currentOriginUsage:(unsigned long long)currentOriginUsage currentDatabaseUsage:(unsigned long long)currentUsage expectedUsage:(unsigned long long)expectedUsage decisionHandler:(void (^)(unsigned long long newQuota))decisionHandler;
</span><span class="cx"> 
</span><ins>+// FIXME: This should be handled by the WKWebsiteDataStore delegate.
+- (void)_webView:(WKWebView *)webView decideWebApplicationCacheQuotaForSecurityOrigin:(_WKSecurityOrigin *)securityOrigin currentQuota:(unsigned long long)currentQuota totalBytesNeeded:(unsigned long long)totalBytesNeeded decisionHandler:(void (^)(unsigned long long newQuota))decisionHandler;
+
</ins><span class="cx"> - (void)_webView:(WKWebView *)webView printFrame:(_WKFrameHandle *)frame;
</span><span class="cx"> 
</span><span class="cx"> #if TARGET_OS_IPHONE
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICocoa_WKSecurityOriginmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKSecurityOrigin.mm (170319 => 170320)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKSecurityOrigin.mm        2014-06-23 21:32:03 UTC (rev 170319)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKSecurityOrigin.mm        2014-06-23 21:32:43 UTC (rev 170320)
</span><span class="lines">@@ -35,17 +35,12 @@
</span><span class="cx">     RefPtr&lt;WebCore::SecurityOrigin&gt; _origin;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-- (instancetype)_initWithSecurityOrigin:(PassRefPtr&lt;WebCore::SecurityOrigin&gt;)origin
</del><ins>+- (instancetype)_initWithSecurityOrigin:(const WebCore::SecurityOrigin&amp;)origin
</ins><span class="cx"> {
</span><span class="cx">     if (!(self = [super init]))
</span><span class="cx">         return nil;
</span><span class="cx"> 
</span><del>-    if (!origin) {
-        [self release];
-        return nil;
-    }
-
-    _origin = origin-&gt;isolatedCopy();
</del><ins>+    _origin = origin.isolatedCopy();
</ins><span class="cx">     return self;
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICocoa_WKSecurityOriginInternalh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKSecurityOriginInternal.h (170319 => 170320)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKSecurityOriginInternal.h        2014-06-23 21:32:03 UTC (rev 170319)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKSecurityOriginInternal.h        2014-06-23 21:32:43 UTC (rev 170320)
</span><span class="lines">@@ -35,7 +35,7 @@
</span><span class="cx"> 
</span><span class="cx"> @interface _WKSecurityOrigin ()
</span><span class="cx"> 
</span><del>-- (instancetype)_initWithSecurityOrigin:(PassRefPtr&lt;WebCore::SecurityOrigin&gt;)origin;
</del><ins>+- (instancetype)_initWithSecurityOrigin:(const WebCore::SecurityOrigin&amp;)origin;
</ins><span class="cx"> 
</span><span class="cx"> @end
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessCocoaUIDelegateh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/Cocoa/UIDelegate.h (170319 => 170320)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/Cocoa/UIDelegate.h        2014-06-23 21:32:03 UTC (rev 170319)
+++ trunk/Source/WebKit2/UIProcess/Cocoa/UIDelegate.h        2014-06-23 21:32:43 UTC (rev 170320)
</span><span class="lines">@@ -63,6 +63,7 @@
</span><span class="cx">         virtual void runJavaScriptConfirm(WebKit::WebPageProxy*, const WTF::String&amp;, WebKit::WebFrameProxy*, std::function&lt;void (bool)&gt; completionHandler) override;
</span><span class="cx">         virtual void runJavaScriptPrompt(WebKit::WebPageProxy*, const WTF::String&amp;, const WTF::String&amp;, WebKit::WebFrameProxy*, std::function&lt;void (const WTF::String&amp;)&gt; completionHandler) override;
</span><span class="cx">         virtual void exceededDatabaseQuota(WebPageProxy*, WebFrameProxy*, WebSecurityOrigin*, const WTF::String&amp; databaseName, const WTF::String&amp; displayName, unsigned long long currentQuota, unsigned long long currentOriginUsage, unsigned long long currentUsage, unsigned long long expectedUsage, std::function&lt;void (unsigned long long)&gt;) override;
</span><ins>+        virtual void reachedApplicationCacheOriginQuota(WebPageProxy*, const WebCore::SecurityOrigin&amp;, uint64_t currentQuota, uint64_t totalBytesNeeded, std::function&lt;void (unsigned long long)&gt; completionHandler) override;
</ins><span class="cx">         virtual void printFrame(WebKit::WebPageProxy*, WebKit::WebFrameProxy*) override;
</span><span class="cx">     #if PLATFORM(IOS)
</span><span class="cx">         virtual RetainPtr&lt;NSArray&gt; actionsForElement(_WKActivatedElementInfo *, RetainPtr&lt;NSArray&gt; defaultActions) override;
</span><span class="lines">@@ -82,6 +83,7 @@
</span><span class="cx">         bool webViewRunJavaScriptConfirmPanelWithMessageInitiatedByFrameCompletionHandler : 1;
</span><span class="cx">         bool webViewRunJavaScriptTextInputPanelWithPromptDefaultTextInitiatedByFrameCompletionHandler : 1;
</span><span class="cx">         bool webViewDecideDatabaseQuotaForSecurityOriginCurrentQuotaCurrentOriginUsageCurrentDatabaseUsageExpectedUsageDecisionHandler : 1;
</span><ins>+        bool webViewDecideWebApplicationCacheQuotaForSecurityOriginCurrentQuotaTotalBytesNeeded : 1;
</ins><span class="cx">         bool webViewPrintFrame : 1;
</span><span class="cx"> #if PLATFORM(IOS)
</span><span class="cx">         bool webViewActionsForElementDefaultActions : 1;
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessCocoaUIDelegatemm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/Cocoa/UIDelegate.mm (170319 => 170320)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/Cocoa/UIDelegate.mm        2014-06-23 21:32:03 UTC (rev 170319)
+++ trunk/Source/WebKit2/UIProcess/Cocoa/UIDelegate.mm        2014-06-23 21:32:43 UTC (rev 170320)
</span><span class="lines">@@ -69,6 +69,7 @@
</span><span class="cx">     m_delegateMethods.webViewRunJavaScriptConfirmPanelWithMessageInitiatedByFrameCompletionHandler = [delegate respondsToSelector:@selector(webView:runJavaScriptConfirmPanelWithMessage:initiatedByFrame:completionHandler:)];
</span><span class="cx">     m_delegateMethods.webViewRunJavaScriptTextInputPanelWithPromptDefaultTextInitiatedByFrameCompletionHandler = [delegate respondsToSelector:@selector(webView:runJavaScriptTextInputPanelWithPrompt:defaultText:initiatedByFrame:completionHandler:)];
</span><span class="cx">     m_delegateMethods.webViewDecideDatabaseQuotaForSecurityOriginCurrentQuotaCurrentOriginUsageCurrentDatabaseUsageExpectedUsageDecisionHandler = [delegate respondsToSelector:@selector(_webView:decideDatabaseQuotaForSecurityOrigin:currentQuota:currentOriginUsage:currentDatabaseUsage:expectedUsage:decisionHandler:)];
</span><ins>+    m_delegateMethods.webViewDecideWebApplicationCacheQuotaForSecurityOriginCurrentQuotaTotalBytesNeeded = [delegate respondsToSelector:@selector(_webView:decideWebApplicationCacheQuotaForSecurityOrigin:currentQuota:totalBytesNeeded:decisionHandler:)];
</ins><span class="cx">     m_delegateMethods.webViewPrintFrame = [delegate respondsToSelector:@selector(_webView:printFrame:)];
</span><span class="cx"> #if PLATFORM(IOS)
</span><span class="cx">     m_delegateMethods.webViewActionsForElementDefaultActions = [delegate respondsToSelector:@selector(_webView:actionsForElement:defaultActions:)];
</span><span class="lines">@@ -187,12 +188,32 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     RefPtr&lt;CompletionHandlerCallChecker&gt; checker = CompletionHandlerCallChecker::create(delegate.get(), @selector(_webView:decideDatabaseQuotaForSecurityOrigin:currentQuota:currentOriginUsage:currentDatabaseUsage:expectedUsage:decisionHandler:));
</span><del>-    [(id &lt;WKUIDelegatePrivate&gt;)delegate _webView:m_uiDelegate.m_webView decideDatabaseQuotaForSecurityOrigin:adoptNS([[_WKSecurityOrigin alloc] _initWithSecurityOrigin:&amp;securityOrigin-&gt;securityOrigin()]).get() currentQuota:currentQuota currentOriginUsage:currentOriginUsage currentDatabaseUsage:currentUsage expectedUsage:expectedUsage decisionHandler:[completionHandler, checker](unsigned long long newQuota) {
</del><ins>+    [(id &lt;WKUIDelegatePrivate&gt;)delegate _webView:m_uiDelegate.m_webView decideDatabaseQuotaForSecurityOrigin:adoptNS([[_WKSecurityOrigin alloc] _initWithSecurityOrigin:securityOrigin-&gt;securityOrigin()]).get() currentQuota:currentQuota currentOriginUsage:currentOriginUsage currentDatabaseUsage:currentUsage expectedUsage:expectedUsage decisionHandler:[completionHandler, checker](unsigned long long newQuota) {
</ins><span class="cx">         checker-&gt;didCallCompletionHandler();
</span><span class="cx">         completionHandler(newQuota);
</span><span class="cx">     }];
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void UIDelegate::UIClient::reachedApplicationCacheOriginQuota(WebPageProxy*, const WebCore::SecurityOrigin&amp; securityOrigin, uint64_t currentQuota, uint64_t totalBytesNeeded, std::function&lt;void (unsigned long long)&gt; completionHandler)
+{
+    if (!m_uiDelegate.m_delegateMethods.webViewDecideWebApplicationCacheQuotaForSecurityOriginCurrentQuotaTotalBytesNeeded) {
+        completionHandler(currentQuota);
+        return;
+    }
+
+    auto delegate = m_uiDelegate.m_delegate.get();
+    if (!delegate) {
+        completionHandler(currentQuota);
+        return;
+    }
+
+    RefPtr&lt;CompletionHandlerCallChecker&gt; checker = CompletionHandlerCallChecker::create(delegate.get(), @selector(_webView:decideWebApplicationCacheQuotaForSecurityOrigin:currentQuota:totalBytesNeeded:decisionHandler:));
+    [(id &lt;WKUIDelegatePrivate&gt;)delegate _webView:m_uiDelegate.m_webView decideWebApplicationCacheQuotaForSecurityOrigin:adoptNS([[_WKSecurityOrigin alloc] _initWithSecurityOrigin:securityOrigin]).get() currentQuota:currentQuota totalBytesNeeded:totalBytesNeeded decisionHandler:[completionHandler, checker](unsigned long long newQuota) {
+        checker-&gt;didCallCompletionHandler();
+        completionHandler(newQuota);
+    }];
+}
+
</ins><span class="cx"> void UIDelegate::UIClient::printFrame(WebKit::WebPageProxy*, WebKit::WebFrameProxy* webFrameProxy)
</span><span class="cx"> {
</span><span class="cx">     ASSERT_ARG(webFrameProxy, webFrameProxy);
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebPageProxycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (170319 => 170320)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp        2014-06-23 21:32:03 UTC (rev 170319)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp        2014-06-23 21:32:43 UTC (rev 170320)
</span><span class="lines">@@ -4464,6 +4464,14 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void WebPageProxy::reachedApplicationCacheOriginQuota(const String&amp; originIdentifier, uint64_t currentQuota, uint64_t totalBytesNeeded, PassRefPtr&lt;Messages::WebPageProxy::ReachedApplicationCacheOriginQuota::DelayedReply&gt; reply)
+{
+    RefPtr&lt;SecurityOrigin&gt; securityOrigin = SecurityOrigin::createFromDatabaseIdentifier(originIdentifier);
+    MESSAGE_CHECK(securityOrigin);
+
+    m_uiClient-&gt;reachedApplicationCacheOriginQuota(this, *securityOrigin.get(), currentQuota, totalBytesNeeded, [reply](unsigned long long newQuota) { reply-&gt;send(newQuota); });
+}
+
</ins><span class="cx"> void WebPageProxy::requestGeolocationPermissionForFrame(uint64_t geolocationID, uint64_t frameID, String originIdentifier)
</span><span class="cx"> {
</span><span class="cx">     WebFrameProxy* frame = m_process-&gt;webFrame(frameID);
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebPageProxyh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.h (170319 => 170320)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebPageProxy.h        2014-06-23 21:32:03 UTC (rev 170319)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.h        2014-06-23 21:32:43 UTC (rev 170320)
</span><span class="lines">@@ -1001,6 +1001,7 @@
</span><span class="cx">     void runOpenPanel(uint64_t frameID, const WebCore::FileChooserSettings&amp;);
</span><span class="cx">     void printFrame(uint64_t frameID);
</span><span class="cx">     void exceededDatabaseQuota(uint64_t frameID, const String&amp; originIdentifier, const String&amp; databaseName, const String&amp; displayName, uint64_t currentQuota, uint64_t currentOriginUsage, uint64_t currentDatabaseUsage, uint64_t expectedUsage, PassRefPtr&lt;Messages::WebPageProxy::ExceededDatabaseQuota::DelayedReply&gt;);
</span><ins>+    void reachedApplicationCacheOriginQuota(const String&amp; originIdentifier, uint64_t currentQuota, uint64_t totalBytesNeeded, PassRefPtr&lt;Messages::WebPageProxy::ReachedApplicationCacheOriginQuota::DelayedReply&gt;);
</ins><span class="cx">     void requestGeolocationPermissionForFrame(uint64_t geolocationID, uint64_t frameID, String originIdentifier);
</span><span class="cx">     void runModal();
</span><span class="cx">     void notifyScrollerThumbIsVisibleInRect(const WebCore::IntRect&amp;);
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebPageProxymessagesin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in (170319 => 170320)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in        2014-06-23 21:32:03 UTC (rev 170319)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in        2014-06-23 21:32:43 UTC (rev 170320)
</span><span class="lines">@@ -241,6 +241,9 @@
</span><span class="cx">     # Database messages
</span><span class="cx">     ExceededDatabaseQuota(uint64_t frameID, String originIdentifier, String databaseName, String databaseDisplayName, uint64_t currentQuota, uint64_t currentOriginUsage, uint64_t currentDatabaseUsage, uint64_t expectedUsage) -&gt; (uint64_t newQuota) Delayed
</span><span class="cx"> 
</span><ins>+    # Application cache messages
+    ReachedApplicationCacheOriginQuota(String originIdentifier, uint64_t currentQuota, uint64_t totalBytesNeeded) -&gt; (uint64_t newQuota) Delayed
+
</ins><span class="cx">     # Geolocation messages
</span><span class="cx">     RequestGeolocationPermissionForFrame(uint64_t geolocationID, uint64_t frameID, String originIdentifier)
</span><span class="cx">     
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessInjectedBundleAPIAPIInjectedBundlePageUIClienth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/APIInjectedBundlePageUIClient.h (170319 => 170320)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/InjectedBundle/API/APIInjectedBundlePageUIClient.h        2014-06-23 21:32:03 UTC (rev 170319)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/API/APIInjectedBundlePageUIClient.h        2014-06-23 21:32:43 UTC (rev 170320)
</span><span class="lines">@@ -69,7 +69,7 @@
</span><span class="cx">     virtual UIElementVisibility menuBarIsVisible(WebKit::WebPage*) { return UIElementVisibility::Unknown; }
</span><span class="cx">     virtual UIElementVisibility toolbarsAreVisible(WebKit::WebPage*) { return UIElementVisibility::Unknown; }
</span><span class="cx"> 
</span><del>-    virtual void didReachApplicationCacheOriginQuota(WebKit::WebPage*, WebKit::WebSecurityOrigin*, int64_t totalBytesNeeded) { UNUSED_PARAM(totalBytesNeeded); }
</del><ins>+    virtual bool didReachApplicationCacheOriginQuota(WebKit::WebPage*, WebKit::WebSecurityOrigin*, int64_t totalBytesNeeded) { UNUSED_PARAM(totalBytesNeeded); return false; }
</ins><span class="cx">     virtual uint64_t didExceedDatabaseQuota(WebKit::WebPage*, WebKit::WebSecurityOrigin*, const WTF::String&amp; databaseName, const WTF::String&amp; databaseDisplayName, uint64_t currentQuotaBytes, uint64_t currentOriginUsageBytes, uint64_t currentDatabaseUsageBytes, uint64_t expectedUsageBytes)
</span><span class="cx">     {
</span><span class="cx">         UNUSED_PARAM(databaseName);
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessInjectedBundleInjectedBundlePageUIClientcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageUIClient.cpp (170319 => 170320)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageUIClient.cpp        2014-06-23 21:32:03 UTC (rev 170319)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageUIClient.cpp        2014-06-23 21:32:43 UTC (rev 170320)
</span><span class="lines">@@ -146,12 +146,13 @@
</span><span class="cx">     return toUIElementVisibility(m_client.toolbarsAreVisible(toAPI(page), m_client.base.clientInfo));
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void InjectedBundlePageUIClient::didReachApplicationCacheOriginQuota(WebPage* page, WebSecurityOrigin* origin, int64_t totalBytesNeeded)
</del><ins>+bool InjectedBundlePageUIClient::didReachApplicationCacheOriginQuota(WebPage* page, WebSecurityOrigin* origin, int64_t totalBytesNeeded)
</ins><span class="cx"> {
</span><span class="cx">     if (!m_client.didReachApplicationCacheOriginQuota)
</span><del>-        return;
</del><ins>+        return false;
</ins><span class="cx"> 
</span><span class="cx">     m_client.didReachApplicationCacheOriginQuota(toAPI(page), toAPI(origin), totalBytesNeeded, m_client.base.clientInfo);
</span><ins>+    return true;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> uint64_t InjectedBundlePageUIClient::didExceedDatabaseQuota(WebPage* page, WebSecurityOrigin* origin, const String&amp; databaseName, const String&amp; databaseDisplayName, uint64_t currentQuotaBytes, uint64_t currentOriginUsageBytes, uint64_t currentDatabaseUsageBytes, uint64_t expectedUsageBytes)
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessInjectedBundleInjectedBundlePageUIClienth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageUIClient.h (170319 => 170320)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageUIClient.h        2014-06-23 21:32:03 UTC (rev 170319)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageUIClient.h        2014-06-23 21:32:43 UTC (rev 170320)
</span><span class="lines">@@ -62,7 +62,7 @@
</span><span class="cx">     UIElementVisibility menuBarIsVisible(WebPage*) override;
</span><span class="cx">     UIElementVisibility toolbarsAreVisible(WebPage*) override;
</span><span class="cx"> 
</span><del>-    void didReachApplicationCacheOriginQuota(WebPage*, WebSecurityOrigin*, int64_t totalBytesNeeded) override;
</del><ins>+    bool didReachApplicationCacheOriginQuota(WebPage*, WebSecurityOrigin*, int64_t totalBytesNeeded) override;
</ins><span class="cx">     uint64_t didExceedDatabaseQuota(WebPage*, WebSecurityOrigin*, const String&amp; databaseName, const String&amp; databaseDisplayName, uint64_t currentQuotaBytes, uint64_t currentOriginUsageBytes, uint64_t currentDatabaseUsageBytes, uint64_t expectedUsageBytes) override;
</span><span class="cx"> 
</span><span class="cx">     String plugInStartLabelTitle(const String&amp; mimeType) const override;
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebCoreSupportWebChromeClientcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp (170319 => 170320)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp        2014-06-23 21:32:03 UTC (rev 170319)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp        2014-06-23 21:32:43 UTC (rev 170320)
</span><span class="lines">@@ -49,6 +49,7 @@
</span><span class="cx"> #include &quot;WebProcessProxyMessages.h&quot;
</span><span class="cx"> #include &quot;WebSearchPopupMenu.h&quot;
</span><span class="cx"> #include &quot;WebSecurityOrigin.h&quot;
</span><ins>+#include &lt;WebCore/ApplicationCacheStorage.h&gt;
</ins><span class="cx"> #include &lt;WebCore/AXObjectCache.h&gt;
</span><span class="cx"> #include &lt;WebCore/ColorChooser.h&gt;
</span><span class="cx"> #include &lt;WebCore/DatabaseManager.h&gt;
</span><span class="lines">@@ -674,7 +675,23 @@
</span><span class="cx"> void WebChromeClient::reachedApplicationCacheOriginQuota(SecurityOrigin* origin, int64_t totalBytesNeeded)
</span><span class="cx"> {
</span><span class="cx">     RefPtr&lt;WebSecurityOrigin&gt; webSecurityOrigin = WebSecurityOrigin::createFromString(origin-&gt;toString());
</span><del>-    m_page-&gt;injectedBundleUIClient().didReachApplicationCacheOriginQuota(m_page, webSecurityOrigin.get(), totalBytesNeeded);
</del><ins>+    if (m_page-&gt;injectedBundleUIClient().didReachApplicationCacheOriginQuota(m_page, webSecurityOrigin.get(), totalBytesNeeded))
+        return;
+
+    unsigned syncSendFlags = IPC::InformPlatformProcessWillSuspend;
+    if (WebPage::synchronousMessagesShouldSpinRunLoop())
+        syncSendFlags |= IPC::SpinRunLoopWhileWaitingForReply;
+
+    int64_t currentQuota = 0;
+    if (!cacheStorage().calculateQuotaForOrigin(origin, currentQuota))
+        return;
+
+    uint64_t newQuota = 0;
+    WebProcess::shared().parentProcessConnection()-&gt;sendSync(
+        Messages::WebPageProxy::ReachedApplicationCacheOriginQuota(origin-&gt;databaseIdentifier(), currentQuota, totalBytesNeeded),
+        Messages::WebPageProxy::ReachedApplicationCacheOriginQuota::Reply(newQuota), m_page-&gt;pageID(), std::chrono::milliseconds::max(), syncSendFlags);
+
+    cacheStorage().storeUpdatedQuotaForOrigin(origin, newQuota);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(DASHBOARD_SUPPORT)
</span></span></pre>
</div>
</div>

</body>
</html>