Changeset 170303 in webkit
- Timestamp:
- Jun 23, 2014 11:25:12 AM (10 years ago)
- Location:
- trunk/Source/WebKit2
- Files:
-
- 3 added
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r170300 r170303 1 2014-06-23 Dan Bernstein <mitz@apple.com> 2 3 [Cocoa] No way to grant storage quotas for WebSQL 4 https://bugs.webkit.org/show_bug.cgi?id=134175 5 6 Reviewed by Anders Carlsson. 7 8 * Shared/WebSecurityOrigin.h: 9 (WebKit::WebSecurityOrigin::securityOrigin): Changed to return a non-const reference. 10 11 * UIProcess/API/APIUIClient.h: 12 (API::UIClient::exceededDatabaseQuota): Added a completion handler parameter than takes the 13 new quota, and changed the return type to void. 14 15 * UIProcess/API/C/WKPage.cpp: 16 (WKPageSetPageUIClient): Changed the override of exceededDatabaseQuota to call the 17 completion handler with the new quota, or with the existing quota if the client doesn’t 18 implement the callback. 19 20 * UIProcess/API/Cocoa/WKUIDelegatePrivate.h: Declared new delegate method. 21 22 * UIProcess/API/Cocoa/_WKSecurityOrigin.h: Added. 23 * UIProcess/API/Cocoa/_WKSecurityOrigin.mm: Added. 24 (-[_WKSecurityOrigin _initWithSecurityOrigin:WebCore::]): Store the origin in an ivar. 25 (-[_WKSecurityOrigin protocol]): Added this accessor. 26 (-[_WKSecurityOrigin host]): Ditto. 27 (-[_WKSecurityOrigin port]): Ditto. 28 * UIProcess/API/Cocoa/_WKSecurityOriginInternal.h: Added. 29 30 * UIProcess/Cocoa/UIDelegate.h: Override API::UIClient::exceededDatabaseQuota. Added flag 31 to m_delegateMethods struct for new delegate method. 32 * UIProcess/Cocoa/UIDelegate.mm: 33 (WebKit::UIDelegate::setDelegate): Set new flag in m_delegateMethods struct. 34 (WebKit::UIDelegate::UIClient::exceededDatabaseQuota): Added. Calls the new delegate method. 35 36 * UIProcess/WebPageProxy.cpp: 37 (WebKit::WebPageProxy::exceededDatabaseQuota): Updated for the new client interface: now 38 passing a completion handler that replies with the new quota. 39 40 * WebKit2.xcodeproj/project.pbxproj: Added references to new files, sorted a group. 41 1 42 2014-06-23 Simon Fraser <simon.fraser@apple.com> 2 43 -
trunk/Source/WebKit2/Shared/WebSecurityOrigin.h
r170133 r170303 52 52 } 53 53 54 constWebCore::SecurityOrigin& securityOrigin() const { return *m_securityOrigin; }54 WebCore::SecurityOrigin& securityOrigin() const { return *m_securityOrigin; } 55 55 56 56 private: -
trunk/Source/WebKit2/UIProcess/API/APIUIClient.h
r168325 r170303 111 111 virtual void pageDidScroll(WebKit::WebPageProxy*) { } 112 112 113 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)113 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) 114 114 { 115 return currentQuota;115 completionHandler(currentQuota); 116 116 } 117 117 -
trunk/Source/WebKit2/UIProcess/API/C/WKPage.cpp
r170126 r170303 1439 1439 } 1440 1440 1441 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) override1441 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 1442 1442 { 1443 1443 if (!m_client.exceededDatabaseQuota) 1444 return currentQuota;1445 1446 return m_client.exceededDatabaseQuota(toAPI(page), toAPI(frame), toAPI(origin), toAPI(databaseName.impl()), toAPI(databaseDisplayName.impl()), currentQuota, currentOriginUsage, currentDatabaseUsage, expectedUsage, m_client.base.clientInfo);1444 completionHandler(currentQuota); 1445 1446 completionHandler(m_client.exceededDatabaseQuota(toAPI(page), toAPI(frame), toAPI(origin), toAPI(databaseName.impl()), toAPI(databaseDisplayName.impl()), currentQuota, currentOriginUsage, currentDatabaseUsage, expectedUsage, m_client.base.clientInfo)); 1447 1447 } 1448 1448 -
trunk/Source/WebKit2/UIProcess/API/Cocoa/WKUIDelegatePrivate.h
r169727 r170303 29 29 30 30 #import <WebKit/_WKActivatedElementInfo.h> 31 #import <WebKit/_WKSecurityOrigin.h> 31 32 32 33 @class _WKFrameHandle; … … 35 36 36 37 @optional 38 39 // FIXME: This should be handled by the WKWebsiteDataStore delegate. 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; 37 41 38 42 - (void)_webView:(WKWebView *)webView printFrame:(_WKFrameHandle *)frame; -
trunk/Source/WebKit2/UIProcess/Cocoa/UIDelegate.h
r169727 r170303 63 63 virtual void runJavaScriptConfirm(WebKit::WebPageProxy*, const WTF::String&, WebKit::WebFrameProxy*, std::function<void (bool)> completionHandler) override; 64 64 virtual void runJavaScriptPrompt(WebKit::WebPageProxy*, const WTF::String&, const WTF::String&, WebKit::WebFrameProxy*, std::function<void (const WTF::String&)> completionHandler) override; 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; 65 66 virtual void printFrame(WebKit::WebPageProxy*, WebKit::WebFrameProxy*) override; 66 67 #if PLATFORM(IOS) … … 81 82 bool webViewRunJavaScriptConfirmPanelWithMessageInitiatedByFrameCompletionHandler : 1; 82 83 bool webViewRunJavaScriptTextInputPanelWithPromptDefaultTextInitiatedByFrameCompletionHandler : 1; 84 bool webViewDecideDatabaseQuotaForSecurityOriginCurrentQuotaCurrentOriginUsageCurrentDatabaseUsageExpectedUsageDecisionHandler : 1; 83 85 bool webViewPrintFrame : 1; 84 86 #if PLATFORM(IOS) -
trunk/Source/WebKit2/UIProcess/Cocoa/UIDelegate.mm
r169854 r170303 38 38 #import "WKUIDelegatePrivate.h" 39 39 #import "_WKFrameHandleInternal.h" 40 #import "_WKSecurityOriginInternal.h" 40 41 41 42 namespace WebKit { … … 68 69 m_delegateMethods.webViewRunJavaScriptConfirmPanelWithMessageInitiatedByFrameCompletionHandler = [delegate respondsToSelector:@selector(webView:runJavaScriptConfirmPanelWithMessage:initiatedByFrame:completionHandler:)]; 69 70 m_delegateMethods.webViewRunJavaScriptTextInputPanelWithPromptDefaultTextInitiatedByFrameCompletionHandler = [delegate respondsToSelector:@selector(webView:runJavaScriptTextInputPanelWithPrompt:defaultText:initiatedByFrame:completionHandler:)]; 71 m_delegateMethods.webViewDecideDatabaseQuotaForSecurityOriginCurrentQuotaCurrentOriginUsageCurrentDatabaseUsageExpectedUsageDecisionHandler = [delegate respondsToSelector:@selector(_webView:decideDatabaseQuotaForSecurityOrigin:currentQuota:currentOriginUsage:currentDatabaseUsage:expectedUsage:decisionHandler:)]; 70 72 m_delegateMethods.webViewPrintFrame = [delegate respondsToSelector:@selector(_webView:printFrame:)]; 71 73 #if PLATFORM(IOS) … … 172 174 } 173 175 176 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) 177 { 178 if (!m_uiDelegate.m_delegateMethods.webViewDecideDatabaseQuotaForSecurityOriginCurrentQuotaCurrentOriginUsageCurrentDatabaseUsageExpectedUsageDecisionHandler) { 179 completionHandler(currentQuota); 180 return; 181 } 182 183 auto delegate = m_uiDelegate.m_delegate.get(); 184 if (!delegate) { 185 completionHandler(currentQuota); 186 return; 187 } 188 189 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 checker->didCallCompletionHandler(); 192 completionHandler(newQuota); 193 }]; 194 } 195 174 196 void UIDelegate::UIClient::printFrame(WebKit::WebPageProxy*, WebKit::WebFrameProxy* webFrameProxy) 175 197 { -
trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp
r170254 r170303 4445 4445 4446 4446 RefPtr<WebSecurityOrigin> origin = WebSecurityOrigin::create(SecurityOrigin::createFromDatabaseIdentifier(record->originIdentifier)); 4447 4448 uint64_t newQuota =m_uiClient->exceededDatabaseQuota(this, frame, origin.get(),4447 auto currentReply = record->reply; 4448 m_uiClient->exceededDatabaseQuota(this, frame, origin.get(), 4449 4449 record->databaseName, record->displayName, record->currentQuota, 4450 record->currentOriginUsage, record->currentDatabaseUsage, record->expectedUsage );4451 4452 record->reply->send(newQuota); 4450 record->currentOriginUsage, record->currentDatabaseUsage, record->expectedUsage, 4451 [currentReply](unsigned long long newQuota) { currentReply->send(newQuota); }); 4452 4453 4453 record = records.next(); 4454 4454 } -
trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj
r170219 r170303 711 711 3769079E18F340A2001DFF04 /* APIInjectedBundleFormClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 3769079C18F340A2001DFF04 /* APIInjectedBundleFormClient.h */; }; 712 712 37694525184FC6B600CDE21F /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BCF5068412431861005955AE /* Security.framework */; }; 713 376C51191957452E0007B0FA /* _WKSecurityOrigin.mm in Sources */ = {isa = PBXBuildFile; fileRef = 376C51171957452E0007B0FA /* _WKSecurityOrigin.mm */; }; 714 376C511A1957452E0007B0FA /* _WKSecurityOrigin.h in Headers */ = {isa = PBXBuildFile; fileRef = 376C51181957452E0007B0FA /* _WKSecurityOrigin.h */; settings = {ATTRIBUTES = (Private, ); }; }; 715 376C511D19574F5F0007B0FA /* _WKSecurityOriginInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 376C511B195748C20007B0FA /* _WKSecurityOriginInternal.h */; }; 713 716 377EAD4517E2C51A002D193D /* WKDeclarationSpecifiers.h in Headers */ = {isa = PBXBuildFile; fileRef = 377EAD4417E2C51A002D193D /* WKDeclarationSpecifiers.h */; settings = {ATTRIBUTES = (Private, ); }; }; 714 717 377EAD4817E2C77B002D193D /* WKUserContentInjectedFrames.h in Headers */ = {isa = PBXBuildFile; fileRef = 377EAD4617E2C77B002D193D /* WKUserContentInjectedFrames.h */; settings = {ATTRIBUTES = (Private, ); }; }; … … 2704 2707 3769079818F31CB2001DFF04 /* APIInjectedBundlePageUIClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = APIInjectedBundlePageUIClient.h; path = API/APIInjectedBundlePageUIClient.h; sourceTree = "<group>"; }; 2705 2708 3769079C18F340A2001DFF04 /* APIInjectedBundleFormClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = APIInjectedBundleFormClient.h; sourceTree = "<group>"; }; 2709 376C51171957452E0007B0FA /* _WKSecurityOrigin.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = _WKSecurityOrigin.mm; sourceTree = "<group>"; }; 2710 376C51181957452E0007B0FA /* _WKSecurityOrigin.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = _WKSecurityOrigin.h; sourceTree = "<group>"; }; 2711 376C511B195748C20007B0FA /* _WKSecurityOriginInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = _WKSecurityOriginInternal.h; sourceTree = "<group>"; }; 2706 2712 377EAD4417E2C51A002D193D /* WKDeclarationSpecifiers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKDeclarationSpecifiers.h; sourceTree = "<group>"; }; 2707 2713 377EAD4617E2C77B002D193D /* WKUserContentInjectedFrames.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKUserContentInjectedFrames.h; sourceTree = "<group>"; }; … … 4972 4978 1A43E828188F3CDC009E4D30 /* _WKProcessPoolConfiguration.h */, 4973 4979 1A43E827188F3CDC009E4D30 /* _WKProcessPoolConfiguration.mm */, 4980 376C51181957452E0007B0FA /* _WKSecurityOrigin.h */, 4981 376C51171957452E0007B0FA /* _WKSecurityOrigin.mm */, 4982 376C511B195748C20007B0FA /* _WKSecurityOriginInternal.h */, 4974 4983 2D6B371918A967AD0042AE80 /* _WKThumbnailView.h */, 4975 4984 2D6B371A18A967AD0042AE80 /* _WKThumbnailView.mm */, … … 4989 4998 37C4C08818149F23003688B9 /* WKBackForwardListItemInternal.h */, 4990 4999 1AF4592D19464B2000F9D4A2 /* WKError.h */, 5000 1AF4592C19464B2000F9D4A2 /* WKError.mm */, 4991 5001 1A2D252A194688FD004537B0 /* WKErrorInternal.h */, 4992 1AF4592C19464B2000F9D4A2 /* WKError.mm */,4993 5002 1A4D664A18A3030E00D82E21 /* WKFrameInfo.h */, 4994 5003 1A4D664918A3030E00D82E21 /* WKFrameInfo.mm */, … … 7043 7052 1F7506B31859164500EC0FF7 /* WKWebProcessPlugInNodeHandle.h in Headers */, 7044 7053 377EAD4517E2C51A002D193D /* WKDeclarationSpecifiers.h in Headers */, 7054 376C511D19574F5F0007B0FA /* _WKSecurityOriginInternal.h in Headers */, 7045 7055 1FB00AC7185F76460019142E /* WKWebProcessPlugInPageGroup.h in Headers */, 7046 7056 377EAD4917E2C77B002D193D /* WKUserScriptInjectionTime.h in Headers */, … … 7073 7083 BC8F2F2B16273A2C005FACB5 /* WKWebProcessPlugInBrowserContextController.h in Headers */, 7074 7084 1AD8790A18B6C38A006CAFD7 /* WKUIDelegate.h in Headers */, 7085 376C511A1957452E0007B0FA /* _WKSecurityOrigin.h in Headers */, 7075 7086 290F4272172A0C7400939FF0 /* ChildProcessSupplement.h in Headers */, 7076 7087 1A6F9F9011E13EFC00DB1371 /* CommandLine.h in Headers */, … … 8988 8999 1A44B95716B737AA00B7BBD8 /* StorageNamespaceImpl.cpp in Sources */, 8989 9000 1AFF49001833DE78009AB15A /* WKDeprecatedFunctions.cpp in Sources */, 9001 376C51191957452E0007B0FA /* _WKSecurityOrigin.mm in Sources */, 8990 9002 517DD5BE180DA7D30081660B /* DatabaseProcessProxy.cpp in Sources */, 8991 9003 51654EFD184EF33F007DC837 /* UniqueIDBDatabaseBackingStoreSQLite.cpp in Sources */,
Note: See TracChangeset
for help on using the changeset viewer.