Title: [170303] trunk/Source/WebKit2
Revision
170303
Author
[email protected]
Date
2014-06-23 11:25:12 -0700 (Mon, 23 Jun 2014)

Log Message

[Cocoa] No way to grant storage quotas for WebSQL
https://bugs.webkit.org/show_bug.cgi?id=134175

Reviewed by Anders Carlsson.

* Shared/WebSecurityOrigin.h:
(WebKit::WebSecurityOrigin::securityOrigin): Changed to return a non-const reference.

* UIProcess/API/APIUIClient.h:
(API::UIClient::exceededDatabaseQuota): Added a completion handler parameter than takes the
new quota, and changed the return type to void.

* UIProcess/API/C/WKPage.cpp:
(WKPageSetPageUIClient): Changed the override of exceededDatabaseQuota to call the
completion handler with the new quota, or with the existing quota if the client doesn’t
implement the callback.

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

* UIProcess/API/Cocoa/_WKSecurityOrigin.h: Added.
* UIProcess/API/Cocoa/_WKSecurityOrigin.mm: Added.
(-[_WKSecurityOrigin _initWithSecurityOrigin:WebCore::]): Store the origin in an ivar.
(-[_WKSecurityOrigin protocol]): Added this accessor.
(-[_WKSecurityOrigin host]): Ditto.
(-[_WKSecurityOrigin port]): Ditto.
* UIProcess/API/Cocoa/_WKSecurityOriginInternal.h: Added.

* UIProcess/Cocoa/UIDelegate.h: Override API::UIClient::exceededDatabaseQuota. 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): Added. Calls the new delegate method.

* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::exceededDatabaseQuota): Updated for the new client interface: now
passing a completion handler that replies with the new quota.

* WebKit2.xcodeproj/project.pbxproj: Added references to new files, sorted a group.

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (170302 => 170303)


--- trunk/Source/WebKit2/ChangeLog	2014-06-23 18:16:39 UTC (rev 170302)
+++ trunk/Source/WebKit2/ChangeLog	2014-06-23 18:25:12 UTC (rev 170303)
@@ -1,3 +1,44 @@
+2014-06-23  Dan Bernstein  <[email protected]>
+
+        [Cocoa] No way to grant storage quotas for WebSQL
+        https://bugs.webkit.org/show_bug.cgi?id=134175
+
+        Reviewed by Anders Carlsson.
+
+        * Shared/WebSecurityOrigin.h:
+        (WebKit::WebSecurityOrigin::securityOrigin): Changed to return a non-const reference.
+
+        * UIProcess/API/APIUIClient.h:
+        (API::UIClient::exceededDatabaseQuota): Added a completion handler parameter than takes the
+        new quota, and changed the return type to void.
+
+        * UIProcess/API/C/WKPage.cpp:
+        (WKPageSetPageUIClient): Changed the override of exceededDatabaseQuota to call the
+        completion handler with the new quota, or with the existing quota if the client doesn’t
+        implement the callback.
+
+        * UIProcess/API/Cocoa/WKUIDelegatePrivate.h: Declared new delegate method.
+
+        * UIProcess/API/Cocoa/_WKSecurityOrigin.h: Added.
+        * UIProcess/API/Cocoa/_WKSecurityOrigin.mm: Added.
+        (-[_WKSecurityOrigin _initWithSecurityOrigin:WebCore::]): Store the origin in an ivar.
+        (-[_WKSecurityOrigin protocol]): Added this accessor.
+        (-[_WKSecurityOrigin host]): Ditto.
+        (-[_WKSecurityOrigin port]): Ditto.
+        * UIProcess/API/Cocoa/_WKSecurityOriginInternal.h: Added.
+
+        * UIProcess/Cocoa/UIDelegate.h: Override API::UIClient::exceededDatabaseQuota. 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): Added. Calls the new delegate method.
+
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::exceededDatabaseQuota): Updated for the new client interface: now
+        passing a completion handler that replies with the new quota.
+
+        * WebKit2.xcodeproj/project.pbxproj: Added references to new files, sorted a group.
+
 2014-06-23  Simon Fraser  <[email protected]>
 
         More build fixing after r170295.

Modified: trunk/Source/WebKit2/Shared/WebSecurityOrigin.h (170302 => 170303)


--- trunk/Source/WebKit2/Shared/WebSecurityOrigin.h	2014-06-23 18:16:39 UTC (rev 170302)
+++ trunk/Source/WebKit2/Shared/WebSecurityOrigin.h	2014-06-23 18:25:12 UTC (rev 170303)
@@ -51,7 +51,7 @@
         return adoptRef(new WebSecurityOrigin(securityOrigin));
     }
 
-    const WebCore::SecurityOrigin& securityOrigin() const { return *m_securityOrigin; }
+    WebCore::SecurityOrigin& securityOrigin() const { return *m_securityOrigin; }
 
 private:
     WebSecurityOrigin(PassRefPtr<WebCore::SecurityOrigin> securityOrigin)

Modified: trunk/Source/WebKit2/UIProcess/API/APIUIClient.h (170302 => 170303)


--- trunk/Source/WebKit2/UIProcess/API/APIUIClient.h	2014-06-23 18:16:39 UTC (rev 170302)
+++ trunk/Source/WebKit2/UIProcess/API/APIUIClient.h	2014-06-23 18:25:12 UTC (rev 170303)
@@ -110,9 +110,9 @@
     virtual void didDraw(WebKit::WebPageProxy*) { }
     virtual void pageDidScroll(WebKit::WebPageProxy*) { }
 
-    virtual unsigned long long exceededDatabaseQuota(WebKit::WebPageProxy*, WebKit::WebFrameProxy*, WebKit::WebSecurityOrigin*, const WTF::String&, const WTF::String&, unsigned long long currentQuota, unsigned long long, unsigned long long, unsigned long long)
+    virtual void exceededDatabaseQuota(WebKit::WebPageProxy*, WebKit::WebFrameProxy*, WebKit::WebSecurityOrigin*, const WTF::String&, const WTF::String&, unsigned long long currentQuota, unsigned long long, unsigned long long, unsigned long long, std::function<void (unsigned long long)> completionHandler)
     {
-        return currentQuota;
+        completionHandler(currentQuota);
     }
 
     virtual bool runOpenPanel(WebKit::WebPageProxy*, WebKit::WebFrameProxy*, WebKit::WebOpenPanelParameters*, WebKit::WebOpenPanelResultListenerProxy*) { return false; }

Modified: trunk/Source/WebKit2/UIProcess/API/C/WKPage.cpp (170302 => 170303)


--- trunk/Source/WebKit2/UIProcess/API/C/WKPage.cpp	2014-06-23 18:16:39 UTC (rev 170302)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKPage.cpp	2014-06-23 18:25:12 UTC (rev 170303)
@@ -1438,12 +1438,12 @@
             m_client.pageDidScroll(toAPI(page), m_client.base.clientInfo);
         }
 
-        virtual unsigned long long exceededDatabaseQuota(WebPageProxy* page, WebFrameProxy* frame, WebSecurityOrigin* origin, const String& databaseName, const String& databaseDisplayName, unsigned long long currentQuota, unsigned long long currentOriginUsage, unsigned long long currentDatabaseUsage, unsigned long long expectedUsage) override
+        virtual void exceededDatabaseQuota(WebPageProxy* page, WebFrameProxy* frame, WebSecurityOrigin* origin, const String& databaseName, const String& databaseDisplayName, unsigned long long currentQuota, unsigned long long currentOriginUsage, unsigned long long currentDatabaseUsage, unsigned long long expectedUsage, std::function<void (unsigned long long)> completionHandler) override
         {
             if (!m_client.exceededDatabaseQuota)
-                return currentQuota;
+                completionHandler(currentQuota);
 
-            return m_client.exceededDatabaseQuota(toAPI(page), toAPI(frame), toAPI(origin), toAPI(databaseName.impl()), toAPI(databaseDisplayName.impl()), currentQuota, currentOriginUsage, currentDatabaseUsage, expectedUsage, m_client.base.clientInfo);
+            completionHandler(m_client.exceededDatabaseQuota(toAPI(page), toAPI(frame), toAPI(origin), toAPI(databaseName.impl()), toAPI(databaseDisplayName.impl()), currentQuota, currentOriginUsage, currentDatabaseUsage, expectedUsage, m_client.base.clientInfo));
         }
 
         virtual bool runOpenPanel(WebPageProxy* page, WebFrameProxy* frame, WebOpenPanelParameters* parameters, WebOpenPanelResultListenerProxy* listener) override

Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKUIDelegatePrivate.h (170302 => 170303)


--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKUIDelegatePrivate.h	2014-06-23 18:16:39 UTC (rev 170302)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKUIDelegatePrivate.h	2014-06-23 18:25:12 UTC (rev 170303)
@@ -28,6 +28,7 @@
 #if WK_API_ENABLED
 
 #import <WebKit/_WKActivatedElementInfo.h>
+#import <WebKit/_WKSecurityOrigin.h>
 
 @class _WKFrameHandle;
 
@@ -35,6 +36,9 @@
 
 @optional
 
+// FIXME: This should be handled by the WKWebsiteDataStore delegate.
+- (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;
+
 - (void)_webView:(WKWebView *)webView printFrame:(_WKFrameHandle *)frame;
 
 #if TARGET_OS_IPHONE

Added: trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKSecurityOrigin.h (0 => 170303)


--- trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKSecurityOrigin.h	                        (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKSecurityOrigin.h	2014-06-23 18:25:12 UTC (rev 170303)
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2014 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import <WebKit/WKFoundation.h>
+
+#if WK_API_ENABLED
+
+#import <Foundation/Foundation.h>
+
+WK_CLASS_AVAILABLE(10_10, 8_0)
+@interface _WKSecurityOrigin : NSObject
+
+@property (nonatomic, readonly, copy) NSString *protocol;
+@property (nonatomic, readonly, copy) NSString *host;
+@property (nonatomic, readonly) unsigned short port;
+
+@end
+
+#endif

Added: trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKSecurityOrigin.mm (0 => 170303)


--- trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKSecurityOrigin.mm	                        (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKSecurityOrigin.mm	2014-06-23 18:25:12 UTC (rev 170303)
@@ -0,0 +1,69 @@
+/*
+ * Copyright (C) 2014 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "config.h"
+#import "_WKSecurityOriginInternal.h"
+
+#if WK_API_ENABLED
+
+#import <WebCore/SecurityOrigin.h>
+#import <wtf/RefPtr.h>
+
+@implementation _WKSecurityOrigin {
+    RefPtr<WebCore::SecurityOrigin> _origin;
+}
+
+- (instancetype)_initWithSecurityOrigin:(PassRefPtr<WebCore::SecurityOrigin>)origin
+{
+    if (!(self = [super init]))
+        return nil;
+
+    if (!origin) {
+        [self release];
+        return nil;
+    }
+
+    _origin = origin->isolatedCopy();
+    return self;
+}
+
+- (NSString *)protocol
+{
+    return _origin->protocol();
+}
+
+- (NSString *)host
+{
+    return _origin->host();
+}
+
+- (unsigned short)port
+{
+    return _origin->port();
+}
+
+@end
+
+#endif // WK_API_ENABLED

Added: trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKSecurityOriginInternal.h (0 => 170303)


--- trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKSecurityOriginInternal.h	                        (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKSecurityOriginInternal.h	2014-06-23 18:25:12 UTC (rev 170303)
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2014 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "_WKSecurityOrigin.h"
+
+#if WK_API_ENABLED
+
+#import <wtf/PassRefPtr.h>
+
+namespace WebCore {
+class SecurityOrigin;
+}
+
+@interface _WKSecurityOrigin ()
+
+- (instancetype)_initWithSecurityOrigin:(PassRefPtr<WebCore::SecurityOrigin>)origin;
+
+@end
+
+#endif

Modified: trunk/Source/WebKit2/UIProcess/Cocoa/UIDelegate.h (170302 => 170303)


--- trunk/Source/WebKit2/UIProcess/Cocoa/UIDelegate.h	2014-06-23 18:16:39 UTC (rev 170302)
+++ trunk/Source/WebKit2/UIProcess/Cocoa/UIDelegate.h	2014-06-23 18:25:12 UTC (rev 170303)
@@ -62,6 +62,7 @@
         virtual void runJavaScriptAlert(WebKit::WebPageProxy*, const WTF::String&, WebKit::WebFrameProxy*, std::function<void ()> completionHandler) override;
         virtual void runJavaScriptConfirm(WebKit::WebPageProxy*, const WTF::String&, WebKit::WebFrameProxy*, std::function<void (bool)> completionHandler) override;
         virtual void runJavaScriptPrompt(WebKit::WebPageProxy*, const WTF::String&, const WTF::String&, WebKit::WebFrameProxy*, std::function<void (const WTF::String&)> completionHandler) override;
+        virtual void exceededDatabaseQuota(WebPageProxy*, WebFrameProxy*, WebSecurityOrigin*, const WTF::String& databaseName, const WTF::String& displayName, unsigned long long currentQuota, unsigned long long currentOriginUsage, unsigned long long currentUsage, unsigned long long expectedUsage, std::function<void (unsigned long long)>) override;
         virtual void printFrame(WebKit::WebPageProxy*, WebKit::WebFrameProxy*) override;
     #if PLATFORM(IOS)
         virtual RetainPtr<NSArray> actionsForElement(_WKActivatedElementInfo *, RetainPtr<NSArray> defaultActions) override;
@@ -80,6 +81,7 @@
         bool webViewRunJavaScriptAlertPanelWithMessageInitiatedByFrameCompletionHandler : 1;
         bool webViewRunJavaScriptConfirmPanelWithMessageInitiatedByFrameCompletionHandler : 1;
         bool webViewRunJavaScriptTextInputPanelWithPromptDefaultTextInitiatedByFrameCompletionHandler : 1;
+        bool webViewDecideDatabaseQuotaForSecurityOriginCurrentQuotaCurrentOriginUsageCurrentDatabaseUsageExpectedUsageDecisionHandler : 1;
         bool webViewPrintFrame : 1;
 #if PLATFORM(IOS)
         bool webViewActionsForElementDefaultActions : 1;

Modified: trunk/Source/WebKit2/UIProcess/Cocoa/UIDelegate.mm (170302 => 170303)


--- trunk/Source/WebKit2/UIProcess/Cocoa/UIDelegate.mm	2014-06-23 18:16:39 UTC (rev 170302)
+++ trunk/Source/WebKit2/UIProcess/Cocoa/UIDelegate.mm	2014-06-23 18:25:12 UTC (rev 170303)
@@ -37,6 +37,7 @@
 #import "WKWindowFeaturesInternal.h"
 #import "WKUIDelegatePrivate.h"
 #import "_WKFrameHandleInternal.h"
+#import "_WKSecurityOriginInternal.h"
 
 namespace WebKit {
 
@@ -67,6 +68,7 @@
     m_delegateMethods.webViewRunJavaScriptAlertPanelWithMessageInitiatedByFrameCompletionHandler = [delegate respondsToSelector:@selector(webView:runJavaScriptAlertPanelWithMessage:initiatedByFrame:completionHandler:)];
     m_delegateMethods.webViewRunJavaScriptConfirmPanelWithMessageInitiatedByFrameCompletionHandler = [delegate respondsToSelector:@selector(webView:runJavaScriptConfirmPanelWithMessage:initiatedByFrame:completionHandler:)];
     m_delegateMethods.webViewRunJavaScriptTextInputPanelWithPromptDefaultTextInitiatedByFrameCompletionHandler = [delegate respondsToSelector:@selector(webView:runJavaScriptTextInputPanelWithPrompt:defaultText:initiatedByFrame:completionHandler:)];
+    m_delegateMethods.webViewDecideDatabaseQuotaForSecurityOriginCurrentQuotaCurrentOriginUsageCurrentDatabaseUsageExpectedUsageDecisionHandler = [delegate respondsToSelector:@selector(_webView:decideDatabaseQuotaForSecurityOrigin:currentQuota:currentOriginUsage:currentDatabaseUsage:expectedUsage:decisionHandler:)];
     m_delegateMethods.webViewPrintFrame = [delegate respondsToSelector:@selector(_webView:printFrame:)];
 #if PLATFORM(IOS)
     m_delegateMethods.webViewActionsForElementDefaultActions = [delegate respondsToSelector:@selector(_webView:actionsForElement:defaultActions:)];
@@ -171,6 +173,26 @@
     }];
 }
 
+void UIDelegate::UIClient::exceededDatabaseQuota(WebPageProxy*, WebFrameProxy*, WebSecurityOrigin* securityOrigin, const WTF::String& databaseName, const WTF::String& displayName, unsigned long long currentQuota, unsigned long long currentOriginUsage, unsigned long long currentUsage, unsigned long long expectedUsage, std::function<void (unsigned long long)> completionHandler)
+{
+    if (!m_uiDelegate.m_delegateMethods.webViewDecideDatabaseQuotaForSecurityOriginCurrentQuotaCurrentOriginUsageCurrentDatabaseUsageExpectedUsageDecisionHandler) {
+        completionHandler(currentQuota);
+        return;
+    }
+
+    auto delegate = m_uiDelegate.m_delegate.get();
+    if (!delegate) {
+        completionHandler(currentQuota);
+        return;
+    }
+
+    RefPtr<CompletionHandlerCallChecker> checker = CompletionHandlerCallChecker::create(delegate.get(), @selector(_webView:decideDatabaseQuotaForSecurityOrigin:currentQuota:currentOriginUsage:currentDatabaseUsage:expectedUsage:decisionHandler:));
+    [(id <WKUIDelegatePrivate>)delegate _webView:m_uiDelegate.m_webView decideDatabaseQuotaForSecurityOrigin:adoptNS([[_WKSecurityOrigin alloc] _initWithSecurityOrigin:&securityOrigin->securityOrigin()]).get() currentQuota:currentQuota currentOriginUsage:currentOriginUsage currentDatabaseUsage:currentUsage expectedUsage:expectedUsage decisionHandler:[completionHandler, checker](unsigned long long newQuota) {
+        checker->didCallCompletionHandler();
+        completionHandler(newQuota);
+    }];
+}
+
 void UIDelegate::UIClient::printFrame(WebKit::WebPageProxy*, WebKit::WebFrameProxy* webFrameProxy)
 {
     ASSERT_ARG(webFrameProxy, webFrameProxy);

Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (170302 => 170303)


--- trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp	2014-06-23 18:16:39 UTC (rev 170302)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp	2014-06-23 18:25:12 UTC (rev 170303)
@@ -4444,12 +4444,12 @@
         MESSAGE_CHECK(frame);
 
         RefPtr<WebSecurityOrigin> origin = WebSecurityOrigin::create(SecurityOrigin::createFromDatabaseIdentifier(record->originIdentifier));
-
-        uint64_t newQuota = m_uiClient->exceededDatabaseQuota(this, frame, origin.get(),
+        auto currentReply = record->reply;
+        m_uiClient->exceededDatabaseQuota(this, frame, origin.get(),
             record->databaseName, record->displayName, record->currentQuota,
-            record->currentOriginUsage, record->currentDatabaseUsage, record->expectedUsage);
+            record->currentOriginUsage, record->currentDatabaseUsage, record->expectedUsage,
+            [currentReply](unsigned long long newQuota) { currentReply->send(newQuota); });
 
-        record->reply->send(newQuota);
         record = records.next();
     }
 }

Modified: trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj (170302 => 170303)


--- trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj	2014-06-23 18:16:39 UTC (rev 170302)
+++ trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj	2014-06-23 18:25:12 UTC (rev 170303)
@@ -710,6 +710,9 @@
 		3769079A18F31CB2001DFF04 /* APIInjectedBundlePageUIClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 3769079818F31CB2001DFF04 /* APIInjectedBundlePageUIClient.h */; };
 		3769079E18F340A2001DFF04 /* APIInjectedBundleFormClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 3769079C18F340A2001DFF04 /* APIInjectedBundleFormClient.h */; };
 		37694525184FC6B600CDE21F /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BCF5068412431861005955AE /* Security.framework */; };
+		376C51191957452E0007B0FA /* _WKSecurityOrigin.mm in Sources */ = {isa = PBXBuildFile; fileRef = 376C51171957452E0007B0FA /* _WKSecurityOrigin.mm */; };
+		376C511A1957452E0007B0FA /* _WKSecurityOrigin.h in Headers */ = {isa = PBXBuildFile; fileRef = 376C51181957452E0007B0FA /* _WKSecurityOrigin.h */; settings = {ATTRIBUTES = (Private, ); }; };
+		376C511D19574F5F0007B0FA /* _WKSecurityOriginInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 376C511B195748C20007B0FA /* _WKSecurityOriginInternal.h */; };
 		377EAD4517E2C51A002D193D /* WKDeclarationSpecifiers.h in Headers */ = {isa = PBXBuildFile; fileRef = 377EAD4417E2C51A002D193D /* WKDeclarationSpecifiers.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		377EAD4817E2C77B002D193D /* WKUserContentInjectedFrames.h in Headers */ = {isa = PBXBuildFile; fileRef = 377EAD4617E2C77B002D193D /* WKUserContentInjectedFrames.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		377EAD4917E2C77B002D193D /* WKUserScriptInjectionTime.h in Headers */ = {isa = PBXBuildFile; fileRef = 377EAD4717E2C77B002D193D /* WKUserScriptInjectionTime.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -2703,6 +2706,9 @@
 		37608821150414F700FC82C7 /* WKRenderObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKRenderObject.h; sourceTree = "<group>"; };
 		3769079818F31CB2001DFF04 /* APIInjectedBundlePageUIClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = APIInjectedBundlePageUIClient.h; path = API/APIInjectedBundlePageUIClient.h; sourceTree = "<group>"; };
 		3769079C18F340A2001DFF04 /* APIInjectedBundleFormClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = APIInjectedBundleFormClient.h; sourceTree = "<group>"; };
+		376C51171957452E0007B0FA /* _WKSecurityOrigin.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = _WKSecurityOrigin.mm; sourceTree = "<group>"; };
+		376C51181957452E0007B0FA /* _WKSecurityOrigin.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = _WKSecurityOrigin.h; sourceTree = "<group>"; };
+		376C511B195748C20007B0FA /* _WKSecurityOriginInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = _WKSecurityOriginInternal.h; sourceTree = "<group>"; };
 		377EAD4417E2C51A002D193D /* WKDeclarationSpecifiers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKDeclarationSpecifiers.h; sourceTree = "<group>"; };
 		377EAD4617E2C77B002D193D /* WKUserContentInjectedFrames.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKUserContentInjectedFrames.h; sourceTree = "<group>"; };
 		377EAD4717E2C77B002D193D /* WKUserScriptInjectionTime.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKUserScriptInjectionTime.h; sourceTree = "<group>"; };
@@ -4971,6 +4977,9 @@
 				37A64E5618F38F4600EB30F1 /* _WKFormInputSession.h */,
 				1A43E828188F3CDC009E4D30 /* _WKProcessPoolConfiguration.h */,
 				1A43E827188F3CDC009E4D30 /* _WKProcessPoolConfiguration.mm */,
+				376C51181957452E0007B0FA /* _WKSecurityOrigin.h */,
+				376C51171957452E0007B0FA /* _WKSecurityOrigin.mm */,
+				376C511B195748C20007B0FA /* _WKSecurityOriginInternal.h */,
 				2D6B371918A967AD0042AE80 /* _WKThumbnailView.h */,
 				2D6B371A18A967AD0042AE80 /* _WKThumbnailView.mm */,
 				2DACE64D18ADBFF000E4CA76 /* _WKThumbnailViewInternal.h */,
@@ -4988,8 +4997,8 @@
 				37C4C08418149C5B003688B9 /* WKBackForwardListItem.mm */,
 				37C4C08818149F23003688B9 /* WKBackForwardListItemInternal.h */,
 				1AF4592D19464B2000F9D4A2 /* WKError.h */,
+				1AF4592C19464B2000F9D4A2 /* WKError.mm */,
 				1A2D252A194688FD004537B0 /* WKErrorInternal.h */,
-				1AF4592C19464B2000F9D4A2 /* WKError.mm */,
 				1A4D664A18A3030E00D82E21 /* WKFrameInfo.h */,
 				1A4D664918A3030E00D82E21 /* WKFrameInfo.mm */,
 				1A4D664D18A3031B00D82E21 /* WKFrameInfoInternal.h */,
@@ -7042,6 +7051,7 @@
 				1A43E82A188F3CDC009E4D30 /* _WKProcessPoolConfiguration.h in Headers */,
 				1F7506B31859164500EC0FF7 /* WKWebProcessPlugInNodeHandle.h in Headers */,
 				377EAD4517E2C51A002D193D /* WKDeclarationSpecifiers.h in Headers */,
+				376C511D19574F5F0007B0FA /* _WKSecurityOriginInternal.h in Headers */,
 				1FB00AC7185F76460019142E /* WKWebProcessPlugInPageGroup.h in Headers */,
 				377EAD4917E2C77B002D193D /* WKUserScriptInjectionTime.h in Headers */,
 				263172CF18B469490065B9C3 /* NativeWebTouchEvent.h in Headers */,
@@ -7072,6 +7082,7 @@
 				BC8699B5116AADAA002A925B /* WKView.h in Headers */,
 				BC8F2F2B16273A2C005FACB5 /* WKWebProcessPlugInBrowserContextController.h in Headers */,
 				1AD8790A18B6C38A006CAFD7 /* WKUIDelegate.h in Headers */,
+				376C511A1957452E0007B0FA /* _WKSecurityOrigin.h in Headers */,
 				290F4272172A0C7400939FF0 /* ChildProcessSupplement.h in Headers */,
 				1A6F9F9011E13EFC00DB1371 /* CommandLine.h in Headers */,
 				37C4E9F6131C6E7E0029BD5A /* config.h in Headers */,
@@ -8987,6 +8998,7 @@
 				1AB31A9616BC688100F6DBC9 /* StorageManagerMessageReceiver.cpp in Sources */,
 				1A44B95716B737AA00B7BBD8 /* StorageNamespaceImpl.cpp in Sources */,
 				1AFF49001833DE78009AB15A /* WKDeprecatedFunctions.cpp in Sources */,
+				376C51191957452E0007B0FA /* _WKSecurityOrigin.mm in Sources */,
 				517DD5BE180DA7D30081660B /* DatabaseProcessProxy.cpp in Sources */,
 				51654EFD184EF33F007DC837 /* UniqueIDBDatabaseBackingStoreSQLite.cpp in Sources */,
 				296BD85E15019BC30071F424 /* StringUtilities.mm in Sources */,
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to