Changeset 228933 in webkit
- Timestamp:
- Feb 22, 2018 2:05:06 PM (6 years ago)
- Location:
- trunk/Source/WebKit
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r228930 r228933 1 2018-02-22 Ryosuke Niwa <rniwa@webkit.org> 2 3 Add an entitlement check for service worker on iOS 4 https://bugs.webkit.org/show_bug.cgi?id=182865 5 6 Reviewed by Dan Bernstein. 7 8 Addressed Dan's comment by using xpc_connection_copy_entitlement_value instead of obtaining the audit token first. 9 10 * Shared/mac/SandboxUtilities.h: 11 * Shared/mac/SandboxUtilities.mm: 12 (WebKit::connectedProcessHasEntitlement): 13 * StorageProcess/ios/StorageProcessIOS.mm: 14 (WebKit::StorageProcess::parentProcessHasServiceWorkerEntitlement const): 15 * WebProcess/WebPage/ios/WebPageIOS.mm: 16 (WebKit::WebPage::parentProcessHasServiceWorkerEntitlement const): 17 1 18 2018-02-22 Youenn Fablet <youenn@apple.com> 2 19 -
trunk/Source/WebKit/Shared/mac/SandboxUtilities.h
r228589 r228933 40 40 41 41 bool processHasEntitlement(NSString *entitlement); 42 bool connectedProcessHasEntitlement(xpc_connection_t, NSString*entitlement);42 bool connectedProcessHasEntitlement(xpc_connection_t, const char *entitlement); 43 43 44 44 } -
trunk/Source/WebKit/Shared/mac/SandboxUtilities.mm
r228589 r228933 29 29 #import <array> 30 30 #import <sys/param.h> 31 #import <wtf/OSObjectPtr.h> 31 32 #import <wtf/spi/cocoa/SecuritySPI.h> 32 33 #import <wtf/spi/darwin/SandboxSPI.h> … … 93 94 } 94 95 95 bool connectedProcessHasEntitlement(xpc_connection_t connection, NSString*entitlement)96 bool connectedProcessHasEntitlement(xpc_connection_t connection, const char *entitlement) 96 97 { 97 audit_token_t token; 98 xpc_connection_get_audit_token(connection, &token); 99 auto task = adoptCF(SecTaskCreateWithAuditToken(NULL, token)); 100 101 auto value = adoptCF(SecTaskCopyValueForEntitlement(task.get(), (__bridge CFStringRef)entitlement, nullptr)); 98 auto value = adoptOSObject(xpc_connection_copy_entitlement_value(connection, entitlement)); 102 99 if (!value) 103 100 return false; 104 101 105 if (CFGetTypeID(value.get()) != CFBooleanGetTypeID()) 106 return false; 107 108 return CFBooleanGetValue(static_cast<CFBooleanRef>(value.get())); 102 return xpc_get_type(value.get()) == XPC_TYPE_BOOL && xpc_bool_get_value(value.get()); 109 103 } 110 104 -
trunk/Source/WebKit/StorageProcess/ios/StorageProcessIOS.mm
r228589 r228933 62 62 bool StorageProcess::parentProcessHasServiceWorkerEntitlement() const 63 63 { 64 static bool hasEntitlement = connectedProcessHasEntitlement(parentProcessConnection()->xpcConnection(), @"com.apple.developer.WebKit.ServiceWorkers");64 static bool hasEntitlement = connectedProcessHasEntitlement(parentProcessConnection()->xpcConnection(), "com.apple.developer.WebKit.ServiceWorkers"); 65 65 return hasEntitlement; 66 66 } -
trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm
r228602 r228933 393 393 bool WebPage::parentProcessHasServiceWorkerEntitlement() const 394 394 { 395 static bool hasEntitlement = connectedProcessHasEntitlement(WebProcess::singleton().parentProcessConnection()->xpcConnection(), @"com.apple.developer.WebKit.ServiceWorkers");395 static bool hasEntitlement = connectedProcessHasEntitlement(WebProcess::singleton().parentProcessConnection()->xpcConnection(), "com.apple.developer.WebKit.ServiceWorkers"); 396 396 return hasEntitlement; 397 397 }
Note: See TracChangeset
for help on using the changeset viewer.