Changeset 170320 in webkit
- Timestamp:
- Jun 23, 2014 2:32:43 PM (10 years ago)
- Location:
- trunk/Source/WebKit2
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r170319 r170320 1 2014-06-23 Dan Bernstein <mitz@apple.com> 2 3 [Cocoa] No way to grant storage quotas for web application cache 4 https://bugs.webkit.org/show_bug.cgi?id=134213 5 6 Reviewed by Anders Carlsson. 7 8 * UIProcess/API/APIUIClient.h: 9 (API::UIClient::reachedApplicationCacheOriginQuota): Added this new client function, with 10 a default implementation that calls the completion handler with the current quota. 11 12 * UIProcess/API/Cocoa/WKUIDelegatePrivate.h: Declared a new delegate method. 13 14 * UIProcess/API/Cocoa/_WKSecurityOrigin.mm: 15 (-[_WKSecurityOrigin _initWithSecurityOrigin:WebCore::]): Changed the parameter into a const 16 reference, since we copy it. 17 * UIProcess/API/Cocoa/_WKSecurityOriginInternal.h: 18 19 * UIProcess/Cocoa/UIDelegate.h: Override API::UIClient::reachedApplicationCacheOriginQuota. 20 Added flag to m_delegateMethods struct for new delegate method. 21 * UIProcess/Cocoa/UIDelegate.mm: 22 (WebKit::UIDelegate::setDelegate): Set new flag in m_delegateMethods struct. 23 (WebKit::UIDelegate::UIClient::exceededDatabaseQuota): Updated for change in 24 _WKSecurityOrigin initializer. 25 (WebKit::UIDelegate::UIClient::reachedApplicationCacheOriginQuota): Added. Calls the new 26 delegate method. 27 28 * UIProcess/WebPageProxy.cpp: 29 (WebKit::WebPageProxy::reachedApplicationCacheOriginQuota): Added. Forwards the message to 30 the UI client. 31 * UIProcess/WebPageProxy.h: 32 33 * UIProcess/WebPageProxy.messages.in: Added ReachedApplicationCacheOriginQuota message. 34 35 * WebProcess/InjectedBundle/API/APIInjectedBundlePageUIClient.h: 36 (API::InjectedBundle::PageUIClient::didReachApplicationCacheOriginQuota): Changed the return 37 type to bool, indicating whether the client handled the callback. 38 39 * WebProcess/InjectedBundle/InjectedBundlePageUIClient.cpp: 40 (WebKit::InjectedBundlePageUIClient::didReachApplicationCacheOriginQuota): Return the 41 appropriate value. 42 * WebProcess/InjectedBundle/InjectedBundlePageUIClient.h: 43 44 * WebProcess/WebCoreSupport/WebChromeClient.cpp: 45 (WebKit::WebChromeClient::reachedApplicationCacheOriginQuota): If the bundle client didn’t 46 handle the callback, send a message the the UI process, and update the quota with the reply. 47 1 48 2014-06-23 Tim Horton <timothy_horton@apple.com> 2 49 -
trunk/Source/WebKit2/UIProcess/API/APIUIClient.h
r170303 r170320 116 116 } 117 117 118 virtual void reachedApplicationCacheOriginQuota(WebKit::WebPageProxy*, const WebCore::SecurityOrigin&, uint64_t currentQuota, uint64_t totalBytesNeeded, std::function<void (unsigned long long)> completionHandler) 119 { 120 completionHandler(currentQuota); 121 } 122 118 123 virtual bool runOpenPanel(WebKit::WebPageProxy*, WebKit::WebFrameProxy*, WebKit::WebOpenPanelParameters*, WebKit::WebOpenPanelResultListenerProxy*) { return false; } 119 124 virtual bool decidePolicyForGeolocationPermissionRequest(WebKit::WebPageProxy*, WebKit::WebFrameProxy*, WebKit::WebSecurityOrigin*, WebKit::GeolocationPermissionRequestProxy*) { return false; } -
trunk/Source/WebKit2/UIProcess/API/Cocoa/WKUIDelegatePrivate.h
r170303 r170320 40 40 - (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; 41 41 42 // FIXME: This should be handled by the WKWebsiteDataStore delegate. 43 - (void)_webView:(WKWebView *)webView decideWebApplicationCacheQuotaForSecurityOrigin:(_WKSecurityOrigin *)securityOrigin currentQuota:(unsigned long long)currentQuota totalBytesNeeded:(unsigned long long)totalBytesNeeded decisionHandler:(void (^)(unsigned long long newQuota))decisionHandler; 44 42 45 - (void)_webView:(WKWebView *)webView printFrame:(_WKFrameHandle *)frame; 43 46 -
trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKSecurityOrigin.mm
r170303 r170320 36 36 } 37 37 38 - (instancetype)_initWithSecurityOrigin:( PassRefPtr<WebCore::SecurityOrigin>)origin38 - (instancetype)_initWithSecurityOrigin:(const WebCore::SecurityOrigin&)origin 39 39 { 40 40 if (!(self = [super init])) 41 41 return nil; 42 42 43 if (!origin) { 44 [self release]; 45 return nil; 46 } 47 48 _origin = origin->isolatedCopy(); 43 _origin = origin.isolatedCopy(); 49 44 return self; 50 45 } -
trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKSecurityOriginInternal.h
r170303 r170320 36 36 @interface _WKSecurityOrigin () 37 37 38 - (instancetype)_initWithSecurityOrigin:( PassRefPtr<WebCore::SecurityOrigin>)origin;38 - (instancetype)_initWithSecurityOrigin:(const WebCore::SecurityOrigin&)origin; 39 39 40 40 @end -
trunk/Source/WebKit2/UIProcess/Cocoa/UIDelegate.h
r170303 r170320 64 64 virtual void runJavaScriptPrompt(WebKit::WebPageProxy*, const WTF::String&, const WTF::String&, WebKit::WebFrameProxy*, std::function<void (const WTF::String&)> completionHandler) override; 65 65 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; 66 virtual void reachedApplicationCacheOriginQuota(WebPageProxy*, const WebCore::SecurityOrigin&, uint64_t currentQuota, uint64_t totalBytesNeeded, std::function<void (unsigned long long)> completionHandler) override; 66 67 virtual void printFrame(WebKit::WebPageProxy*, WebKit::WebFrameProxy*) override; 67 68 #if PLATFORM(IOS) … … 83 84 bool webViewRunJavaScriptTextInputPanelWithPromptDefaultTextInitiatedByFrameCompletionHandler : 1; 84 85 bool webViewDecideDatabaseQuotaForSecurityOriginCurrentQuotaCurrentOriginUsageCurrentDatabaseUsageExpectedUsageDecisionHandler : 1; 86 bool webViewDecideWebApplicationCacheQuotaForSecurityOriginCurrentQuotaTotalBytesNeeded : 1; 85 87 bool webViewPrintFrame : 1; 86 88 #if PLATFORM(IOS) -
trunk/Source/WebKit2/UIProcess/Cocoa/UIDelegate.mm
r170303 r170320 70 70 m_delegateMethods.webViewRunJavaScriptTextInputPanelWithPromptDefaultTextInitiatedByFrameCompletionHandler = [delegate respondsToSelector:@selector(webView:runJavaScriptTextInputPanelWithPrompt:defaultText:initiatedByFrame:completionHandler:)]; 71 71 m_delegateMethods.webViewDecideDatabaseQuotaForSecurityOriginCurrentQuotaCurrentOriginUsageCurrentDatabaseUsageExpectedUsageDecisionHandler = [delegate respondsToSelector:@selector(_webView:decideDatabaseQuotaForSecurityOrigin:currentQuota:currentOriginUsage:currentDatabaseUsage:expectedUsage:decisionHandler:)]; 72 m_delegateMethods.webViewDecideWebApplicationCacheQuotaForSecurityOriginCurrentQuotaTotalBytesNeeded = [delegate respondsToSelector:@selector(_webView:decideWebApplicationCacheQuotaForSecurityOrigin:currentQuota:totalBytesNeeded:decisionHandler:)]; 72 73 m_delegateMethods.webViewPrintFrame = [delegate respondsToSelector:@selector(_webView:printFrame:)]; 73 74 #if PLATFORM(IOS) … … 188 189 189 190 RefPtr<CompletionHandlerCallChecker> checker = CompletionHandlerCallChecker::create(delegate.get(), @selector(_webView:decideDatabaseQuotaForSecurityOrigin:currentQuota:currentOriginUsage:currentDatabaseUsage:expectedUsage:decisionHandler:)); 190 [(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) { 191 [(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) { 192 checker->didCallCompletionHandler(); 193 completionHandler(newQuota); 194 }]; 195 } 196 197 void UIDelegate::UIClient::reachedApplicationCacheOriginQuota(WebPageProxy*, const WebCore::SecurityOrigin& securityOrigin, uint64_t currentQuota, uint64_t totalBytesNeeded, std::function<void (unsigned long long)> completionHandler) 198 { 199 if (!m_uiDelegate.m_delegateMethods.webViewDecideWebApplicationCacheQuotaForSecurityOriginCurrentQuotaTotalBytesNeeded) { 200 completionHandler(currentQuota); 201 return; 202 } 203 204 auto delegate = m_uiDelegate.m_delegate.get(); 205 if (!delegate) { 206 completionHandler(currentQuota); 207 return; 208 } 209 210 RefPtr<CompletionHandlerCallChecker> checker = CompletionHandlerCallChecker::create(delegate.get(), @selector(_webView:decideWebApplicationCacheQuotaForSecurityOrigin:currentQuota:totalBytesNeeded:decisionHandler:)); 211 [(id <WKUIDelegatePrivate>)delegate _webView:m_uiDelegate.m_webView decideWebApplicationCacheQuotaForSecurityOrigin:adoptNS([[_WKSecurityOrigin alloc] _initWithSecurityOrigin:securityOrigin]).get() currentQuota:currentQuota totalBytesNeeded:totalBytesNeeded decisionHandler:[completionHandler, checker](unsigned long long newQuota) { 191 212 checker->didCallCompletionHandler(); 192 213 completionHandler(newQuota); -
trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp
r170319 r170320 4465 4465 } 4466 4466 4467 void WebPageProxy::reachedApplicationCacheOriginQuota(const String& originIdentifier, uint64_t currentQuota, uint64_t totalBytesNeeded, PassRefPtr<Messages::WebPageProxy::ReachedApplicationCacheOriginQuota::DelayedReply> reply) 4468 { 4469 RefPtr<SecurityOrigin> securityOrigin = SecurityOrigin::createFromDatabaseIdentifier(originIdentifier); 4470 MESSAGE_CHECK(securityOrigin); 4471 4472 m_uiClient->reachedApplicationCacheOriginQuota(this, *securityOrigin.get(), currentQuota, totalBytesNeeded, [reply](unsigned long long newQuota) { reply->send(newQuota); }); 4473 } 4474 4467 4475 void WebPageProxy::requestGeolocationPermissionForFrame(uint64_t geolocationID, uint64_t frameID, String originIdentifier) 4468 4476 { -
trunk/Source/WebKit2/UIProcess/WebPageProxy.h
r170319 r170320 1002 1002 void printFrame(uint64_t frameID); 1003 1003 void exceededDatabaseQuota(uint64_t frameID, const String& originIdentifier, const String& databaseName, const String& displayName, uint64_t currentQuota, uint64_t currentOriginUsage, uint64_t currentDatabaseUsage, uint64_t expectedUsage, PassRefPtr<Messages::WebPageProxy::ExceededDatabaseQuota::DelayedReply>); 1004 void reachedApplicationCacheOriginQuota(const String& originIdentifier, uint64_t currentQuota, uint64_t totalBytesNeeded, PassRefPtr<Messages::WebPageProxy::ReachedApplicationCacheOriginQuota::DelayedReply>); 1004 1005 void requestGeolocationPermissionForFrame(uint64_t geolocationID, uint64_t frameID, String originIdentifier); 1005 1006 void runModal(); -
trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in
r169310 r170320 242 242 ExceededDatabaseQuota(uint64_t frameID, String originIdentifier, String databaseName, String databaseDisplayName, uint64_t currentQuota, uint64_t currentOriginUsage, uint64_t currentDatabaseUsage, uint64_t expectedUsage) -> (uint64_t newQuota) Delayed 243 243 244 # Application cache messages 245 ReachedApplicationCacheOriginQuota(String originIdentifier, uint64_t currentQuota, uint64_t totalBytesNeeded) -> (uint64_t newQuota) Delayed 246 244 247 # Geolocation messages 245 248 RequestGeolocationPermissionForFrame(uint64_t geolocationID, uint64_t frameID, String originIdentifier) -
trunk/Source/WebKit2/WebProcess/InjectedBundle/API/APIInjectedBundlePageUIClient.h
r167514 r170320 70 70 virtual UIElementVisibility toolbarsAreVisible(WebKit::WebPage*) { return UIElementVisibility::Unknown; } 71 71 72 virtual void didReachApplicationCacheOriginQuota(WebKit::WebPage*, WebKit::WebSecurityOrigin*, int64_t totalBytesNeeded) { UNUSED_PARAM(totalBytesNeeded); }72 virtual bool didReachApplicationCacheOriginQuota(WebKit::WebPage*, WebKit::WebSecurityOrigin*, int64_t totalBytesNeeded) { UNUSED_PARAM(totalBytesNeeded); return false; } 73 73 virtual uint64_t didExceedDatabaseQuota(WebKit::WebPage*, WebKit::WebSecurityOrigin*, const WTF::String& databaseName, const WTF::String& databaseDisplayName, uint64_t currentQuotaBytes, uint64_t currentOriginUsageBytes, uint64_t currentDatabaseUsageBytes, uint64_t expectedUsageBytes) 74 74 { -
trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageUIClient.cpp
r167514 r170320 147 147 } 148 148 149 voidInjectedBundlePageUIClient::didReachApplicationCacheOriginQuota(WebPage* page, WebSecurityOrigin* origin, int64_t totalBytesNeeded)149 bool InjectedBundlePageUIClient::didReachApplicationCacheOriginQuota(WebPage* page, WebSecurityOrigin* origin, int64_t totalBytesNeeded) 150 150 { 151 151 if (!m_client.didReachApplicationCacheOriginQuota) 152 return ;152 return false; 153 153 154 154 m_client.didReachApplicationCacheOriginQuota(toAPI(page), toAPI(origin), totalBytesNeeded, m_client.base.clientInfo); 155 return true; 155 156 } 156 157 -
trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageUIClient.h
r166890 r170320 63 63 UIElementVisibility toolbarsAreVisible(WebPage*) override; 64 64 65 voiddidReachApplicationCacheOriginQuota(WebPage*, WebSecurityOrigin*, int64_t totalBytesNeeded) override;65 bool didReachApplicationCacheOriginQuota(WebPage*, WebSecurityOrigin*, int64_t totalBytesNeeded) override; 66 66 uint64_t didExceedDatabaseQuota(WebPage*, WebSecurityOrigin*, const String& databaseName, const String& databaseDisplayName, uint64_t currentQuotaBytes, uint64_t currentOriginUsageBytes, uint64_t currentDatabaseUsageBytes, uint64_t expectedUsageBytes) override; 67 67 -
trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp
r170133 r170320 50 50 #include "WebSearchPopupMenu.h" 51 51 #include "WebSecurityOrigin.h" 52 #include <WebCore/ApplicationCacheStorage.h> 52 53 #include <WebCore/AXObjectCache.h> 53 54 #include <WebCore/ColorChooser.h> … … 675 676 { 676 677 RefPtr<WebSecurityOrigin> webSecurityOrigin = WebSecurityOrigin::createFromString(origin->toString()); 677 m_page->injectedBundleUIClient().didReachApplicationCacheOriginQuota(m_page, webSecurityOrigin.get(), totalBytesNeeded); 678 if (m_page->injectedBundleUIClient().didReachApplicationCacheOriginQuota(m_page, webSecurityOrigin.get(), totalBytesNeeded)) 679 return; 680 681 unsigned syncSendFlags = IPC::InformPlatformProcessWillSuspend; 682 if (WebPage::synchronousMessagesShouldSpinRunLoop()) 683 syncSendFlags |= IPC::SpinRunLoopWhileWaitingForReply; 684 685 int64_t currentQuota = 0; 686 if (!cacheStorage().calculateQuotaForOrigin(origin, currentQuota)) 687 return; 688 689 uint64_t newQuota = 0; 690 WebProcess::shared().parentProcessConnection()->sendSync( 691 Messages::WebPageProxy::ReachedApplicationCacheOriginQuota(origin->databaseIdentifier(), currentQuota, totalBytesNeeded), 692 Messages::WebPageProxy::ReachedApplicationCacheOriginQuota::Reply(newQuota), m_page->pageID(), std::chrono::milliseconds::max(), syncSendFlags); 693 694 cacheStorage().storeUpdatedQuotaForOrigin(origin, newQuota); 678 695 } 679 696
Note: See TracChangeset
for help on using the changeset viewer.