Changeset 150938 in webkit
- Timestamp:
- May 29, 2013 5:10:59 PM (11 years ago)
- Location:
- trunk/Source/WebKit2
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r150936 r150938 1 2013-05-29 Anders Carlsson <andersca@apple.com> 2 3 WebKit should expose HSTS APIs to determine whether a host is in the HSTS cache and to reset HSTS policies 4 https://bugs.webkit.org/show_bug.cgi?id=117010 5 <rdar://problem/13689666> 6 7 Reviewed by Tim Horton. 8 9 * UIProcess/API/C/mac/WKContextPrivateMac.h: 10 * UIProcess/API/C/mac/WKContextPrivateMac.mm: 11 * UIProcess/API/C/mac/WKPagePrivateMac.cpp: 12 * UIProcess/API/C/mac/WKPagePrivateMac.h: 13 * UIProcess/WebContext.h: 14 (WebContext): 15 * UIProcess/mac/WebContextMac.mm: 16 (WebKit): 17 (WebKit::privateBrowsingSession): 18 (WebKit::WebContext::isURLKnownHSTSHost): 19 (WebKit::WebContext::resetHSTSHosts): 20 1 21 2013-05-29 Tim Horton <timothy_horton@apple.com> 2 22 -
trunk/Source/WebKit2/UIProcess/API/C/mac/WKContextPrivateMac.h
r149904 r150938 43 43 WK_EXPORT void WKContextGetInfoForInstalledPlugIns(WKContextRef context, WKContextGetInfoForInstalledPlugInsBlock block); 44 44 45 WK_EXPORT void WKContextResetHSTSHosts(WKContextRef context); 45 46 46 47 /* DEPRECATED - Please use constants from WKPluginInformation instead. */ -
trunk/Source/WebKit2/UIProcess/API/C/mac/WKContextPrivateMac.mm
r149904 r150938 88 88 } 89 89 90 void WKContextResetHSTSHosts(WKContextRef context) 91 { 92 return toImpl(context)->resetHSTSHosts(); 93 } 94 90 95 91 96 /* DEPRECATED - Please use constants from WKPluginInformation instead. */ -
trunk/Source/WebKit2/UIProcess/API/C/mac/WKPagePrivateMac.cpp
r95901 r150938 28 28 29 29 #include "WKAPICast.h" 30 #include "WebContext.h" 31 #include "WebPageGroup.h" 30 32 #include "WebPageProxy.h" 33 #include "WebPreferences.h" 31 34 32 35 using namespace WebKit; … … 36 39 return toImpl(pageRef)->processIdentifier(); 37 40 } 41 42 bool WKPageIsURLKnownHSTSHost(WKPageRef page, WKURLRef url) 43 { 44 WebPageProxy* webPageProxy = toImpl(page); 45 bool privateBrowsingEnabled = webPageProxy->pageGroup()->preferences()->privateBrowsingEnabled(); 46 47 return webPageProxy->process()->context()->isURLKnownHSTSHost(toImpl(url)->string(), privateBrowsingEnabled); 48 } -
trunk/Source/WebKit2/UIProcess/API/C/mac/WKPagePrivateMac.h
r95901 r150938 34 34 35 35 WK_EXPORT pid_t WKPageGetProcessIdentifier(WKPageRef page); 36 WK_EXPORT bool WKPageIsURLKnownHSTSHost(WKPageRef page, WKURLRef url); 36 37 37 38 #ifdef __cplusplus -
trunk/Source/WebKit2/UIProcess/WebContext.h
r150314 r150938 298 298 void processDidCachePage(WebProcessProxy*); 299 299 300 bool isURLKnownHSTSHost(const String& urlString, bool privateBrowsingEnabled) const; 301 void resetHSTSHosts(); 302 300 303 private: 301 304 WebContext(ProcessModel, const String& injectedBundlePath); -
trunk/Source/WebKit2/UIProcess/mac/WebContextMac.mm
r149476 r150938 47 47 #endif 48 48 49 50 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090 51 52 #if __has_include(<CFNetwork/CFURLProtocolPriv.h>) 53 #include <CFNetwork/CFURLProtocolPriv.h> 54 #else 55 extern "C" Boolean _CFNetworkIsKnownHSTSHostWithSession(CFURLRef url, CFURLStorageSessionRef session); 56 extern "C" void _CFNetworkResetHSTSHostsWithSession(CFURLStorageSessionRef session); 57 #endif 58 59 #endif 60 49 61 using namespace WebCore; 50 62 … … 561 573 } 562 574 575 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090 576 static CFURLStorageSessionRef privateBrowsingSession() 577 { 578 static CFURLStorageSessionRef session; 579 static dispatch_once_t once; 580 dispatch_once(&once, ^{ 581 NSString *identifier = [NSString stringWithFormat:@"%@.PrivateBrowsing", [[NSBundle mainBundle] bundleIdentifier]]; 582 583 session = WKCreatePrivateStorageSession((CFStringRef)identifier); 584 }); 585 586 return session; 587 } 588 #endif 589 590 bool WebContext::isURLKnownHSTSHost(const String& urlString, bool privateBrowsingEnabled) const 591 { 592 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090 593 RetainPtr<CFURLRef> url = KURL(KURL(), urlString).createCFURL(); 594 595 return _CFNetworkIsKnownHSTSHostWithSession(url.get(), privateBrowsingEnabled ? privateBrowsingSession() : nullptr); 596 #else 597 return false; 598 #endif 599 } 600 601 void WebContext::resetHSTSHosts() 602 { 603 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090 604 _CFNetworkResetHSTSHostsWithSession(nullptr); 605 _CFNetworkResetHSTSHostsWithSession(privateBrowsingSession()); 606 #endif 607 } 608 563 609 } // namespace WebKit
Note: See TracChangeset
for help on using the changeset viewer.