WebKit Bugzilla
Attachment 343440 Details for
Bug 186973
: [Cocoa] Improve ARC compatibility of more code in JavaScriptCore
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-186973-20180623095652.patch (text/plain), 65.24 KB, created by
Darin Adler
on 2018-06-23 09:56:52 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Darin Adler
Created:
2018-06-23 09:56:52 PDT
Size:
65.24 KB
patch
obsolete
>Subversion Revision: 233128 >diff --git a/Source/JavaScriptCore/ChangeLog b/Source/JavaScriptCore/ChangeLog >index 49cef2e2c7a86b44597532ad464a9e3ba0dd0db4..1ba676572c17d3486166563187581870a1aec1c2 100644 >--- a/Source/JavaScriptCore/ChangeLog >+++ b/Source/JavaScriptCore/ChangeLog >@@ -1,3 +1,77 @@ >+2018-06-23 Darin Adler <darin@apple.com> >+ >+ [Cocoa] Improve ARC compatibility of more code in JavaScriptCore >+ https://bugs.webkit.org/show_bug.cgi?id=186973 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * API/JSContext.mm: >+ (WeakContextRef::WeakContextRef): Deleted. >+ (WeakContextRef::~WeakContextRef): Deleted. >+ (WeakContextRef::get): Deleted. >+ (WeakContextRef::set): Deleted. >+ >+ * API/JSContextInternal.h: Removed unneeded header guards since this is >+ an Objective-C++ header. Removed unused WeakContextRef class. Removed declaration >+ of method -[JSContext initWithGlobalContextRef:] and JSContext property wrapperMap >+ since neither is used outside the class implementation. >+ >+ * API/JSManagedValue.mm: >+ (-[JSManagedValue initWithValue:]): Use a bridging cast. >+ (-[JSManagedValue dealloc]): Ditto. >+ (-[JSManagedValue didAddOwner:]): Ditto. >+ (-[JSManagedValue didRemoveOwner:]): Ditto. >+ (JSManagedValueHandleOwner::isReachableFromOpaqueRoots): Ditto. >+ (JSManagedValueHandleOwner::finalize): Ditto. >+ * API/JSValue.mm: >+ (+[JSValue valueWithNewRegularExpressionFromPattern:flags:inContext:]): Ditto. >+ (+[JSValue valueWithNewErrorFromMessage:inContext:]): Ditto. >+ (-[JSValue valueForProperty:]): Ditto. >+ (-[JSValue setValue:forProperty:]): Ditto. >+ (-[JSValue deleteProperty:]): Ditto. >+ (-[JSValue hasProperty:]): Ditto. >+ (-[JSValue invokeMethod:withArguments:]): Ditto. >+ (valueToObjectWithoutCopy): Ditto. Also removed unneeded explicit type names. >+ (valueToArray): Ditto. >+ (valueToDictionary): Ditto. >+ (objectToValueWithoutCopy): Ditto. >+ (objectToValue): Ditto. >+ * API/JSVirtualMachine.mm: >+ (+[JSVMWrapperCache addWrapper:forJSContextGroupRef:]): Ditto. >+ (+[JSVMWrapperCache wrapperForJSContextGroupRef:]): Ditto. >+ (-[JSVirtualMachine isOldExternalObject:]): Ditto. >+ (-[JSVirtualMachine addManagedReference:withOwner:]): Ditto. >+ (-[JSVirtualMachine removeManagedReference:withOwner:]): Ditto. >+ (-[JSVirtualMachine contextForGlobalContextRef:]): Ditto. >+ (-[JSVirtualMachine addContext:forGlobalContextRef:]): Ditto. >+ (scanExternalObjectGraph): Ditto. >+ (scanExternalRememberedSet): Ditto. >+ * API/JSWrapperMap.mm: >+ (makeWrapper): Ditto. >+ (-[JSObjCClassInfo wrapperForObject:inContext:]): Ditto. >+ (-[JSWrapperMap objcWrapperForJSValueRef:inContext:]): Ditto. >+ (tryUnwrapObjcObject): Ditto. >+ * API/ObjCCallbackFunction.mm: >+ (blockSignatureContainsClass): Ditto. >+ (objCCallbackFunctionForMethod): Switched from retain to CFRetain, but not >+ sure we will be keeping this the same way under ARC. >+ (objCCallbackFunctionForBlock): Use a bridging cast. >+ >+ * API/ObjcRuntimeExtras.h: >+ (protocolImplementsProtocol): Use a more specific type that includes the >+ explicit __unsafe_unretained for copied protocol lists. >+ (forEachProtocolImplementingProtocol): Ditto. >+ >+ * inspector/remote/cocoa/RemoteInspectorCocoa.mm: >+ (Inspector::convertNSNullToNil): Added to replace the CONVERT_NSNULL_TO_NIL macro. >+ (Inspector::RemoteInspector::receivedSetupMessage): Use convertNSNullToNil. >+ >+ * inspector/remote/cocoa/RemoteInspectorXPCConnection.mm: Moved the >+ CFXPCBridge SPI to a header named CFXPCBridgeSPI.h. >+ (auditTokenHasEntitlement): Deleted. Moved to Entitlements.h/cpp in WTF. >+ (Inspector::RemoteInspectorXPCConnection::handleEvent): Use WTF::hasEntitlement. >+ (Inspector::RemoteInspectorXPCConnection::sendMessage): Use a bridging cast. >+ > 2018-06-22 Keith Miller <keith_miller@apple.com> > > We need to have a getDirectConcurrently for use in the compilers >diff --git a/Source/WTF/ChangeLog b/Source/WTF/ChangeLog >index 821ead2e8f0c03e004a8fe3a0bdd4690a402eae4..9b76e2597140bc53aa4076a31060d2442770bc29 100644 >--- a/Source/WTF/ChangeLog >+++ b/Source/WTF/ChangeLog >@@ -1,3 +1,22 @@ >+2018-06-23 Darin Adler <darin@apple.com> >+ >+ [Cocoa] Improve ARC compatibility of more code in JavaScriptCore >+ https://bugs.webkit.org/show_bug.cgi?id=186973 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * WTF.xcodeproj/project.pbxproj: Added CFXPCBridgeSPI.h, fixed a few >+ other small problems in the project file, and let Xcode fix a few too. >+ >+ * wtf/cocoa/Entitlements.h: Added hasEntitlement function with overloads >+ for an audit token and an XPC connection. >+ * wtf/cocoa/Entitlements.mm: >+ (WTF::hasEntitlement): Added, with overloads for a SecTask, an audit token, >+ and an XPC connection. >+ (WTF::processHasEntitlement): Refactored to use the function above. >+ >+ * wtf/spi/cocoa/CFXPCBridgeSPI.h: Added. >+ > 2018-06-22 Darin Adler <darin@apple.com> > > [Cocoa] Convert the small bit of Objective-C++ code in WTF to ARC >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index 7e95d6bd255af6c3cbd9e4ba08fb22f8d6ab363d..fa5fb1dc0c8c87140b918c30def3e9e95a9349df 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,23 @@ >+2018-06-23 Darin Adler <darin@apple.com> >+ >+ [Cocoa] Improve ARC compatibility of more code in JavaScriptCore >+ https://bugs.webkit.org/show_bug.cgi?id=186973 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * Shared/EntryPointUtilities/mac/XPCService/XPCServiceEntryPoint.mm: >+ (WebKit::XPCServiceInitializerDelegate::hasEntitlement): Use WTF::hasEntitlement. >+ >+ * Shared/mac/SandboxUtilities.h: Removed connectedProcessHasEntitlement since >+ we can now use WTF::hasEntitlement instead. >+ * Shared/mac/SandboxUtilities.mm: Ditto. >+ >+ * StorageProcess/ios/StorageProcessIOS.mm: >+ (WebKit::StorageProcess::parentProcessHasServiceWorkerEntitlement): Use >+ WTF::hasEntitlement. >+ * WebProcess/WebPage/ios/WebPageIOS.mm: >+ (WebKit::WebPage::parentProcessHasServiceWorkerEntitlement): Ditto. >+ > 2018-06-23 Yusuke Suzuki <utatane.tea@gmail.com> > > [WTF] Add user-defined literal for ASCIILiteral >diff --git a/Source/JavaScriptCore/API/JSContext.mm b/Source/JavaScriptCore/API/JSContext.mm >index d8b0a7562a035f3f7d5444ee3c2cb87f07c69723..f4e88c144eaa169190b6ca337d54ba0db5d61b35 100644 >--- a/Source/JavaScriptCore/API/JSContext.mm >+++ b/Source/JavaScriptCore/API/JSContext.mm >@@ -337,24 +337,4 @@ + (JSContext *)contextWithJSGlobalContextRef:(JSGlobalContextRef)globalContext > > @end > >-WeakContextRef::WeakContextRef(JSContext *context) >-{ >- objc_initWeak(&m_weakContext, context); >-} >- >-WeakContextRef::~WeakContextRef() >-{ >- objc_destroyWeak(&m_weakContext); >-} >- >-JSContext * WeakContextRef::get() >-{ >- return objc_loadWeak(&m_weakContext); >-} >- >-void WeakContextRef::set(JSContext *context) >-{ >- objc_storeWeak(&m_weakContext, context); >-} >- > #endif >diff --git a/Source/JavaScriptCore/API/JSContextInternal.h b/Source/JavaScriptCore/API/JSContextInternal.h >index b37cfa4415f8c89be591caa739fa670b234ce3fd..28f709c1e48f1e1a80385650aae6e41cd35150fa 100644 >--- a/Source/JavaScriptCore/API/JSContextInternal.h >+++ b/Source/JavaScriptCore/API/JSContextInternal.h >@@ -23,9 +23,6 @@ > * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. > */ > >-#ifndef JSContextInternal_h >-#define JSContextInternal_h >- > #import <JavaScriptCore/JavaScriptCore.h> > > #if JSC_OBJC_API_ENABLED >@@ -33,7 +30,7 @@ > #import <JavaScriptCore/JSContext.h> > > struct CallbackData { >- CallbackData *next; >+ CallbackData* next; > JSContext *context; > JSValue *preservedException; > JSValueRef calleeValue; >@@ -43,24 +40,10 @@ struct CallbackData { > NSArray *currentArguments; > }; > >-class WeakContextRef { >-public: >- WeakContextRef(JSContext * = nil); >- ~WeakContextRef(); >- >- JSContext * get(); >- void set(JSContext *); >- >-private: >- JSContext *m_weakContext; >-}; >- > @class JSWrapperMap; > > @interface JSContext(Internal) > >-- (instancetype)initWithGlobalContextRef:(JSGlobalContextRef)context; >- > - (void)notifyException:(JSValueRef)exception; > - (JSValue *)valueFromNotifyException:(JSValueRef)exception; > - (BOOL)boolFromNotifyException:(JSValueRef)exception; >@@ -71,10 +54,6 @@ private: > - (JSValue *)wrapperForObjCObject:(id)object; > - (JSValue *)wrapperForJSObject:(JSValueRef)value; > >-@property (readonly, retain) JSWrapperMap *wrapperMap; >- > @end > > #endif >- >-#endif // JSContextInternal_h >diff --git a/Source/JavaScriptCore/API/JSManagedValue.mm b/Source/JavaScriptCore/API/JSManagedValue.mm >index 099b04ac83ff2bf6290908625626d0b1d3b41854..29c717db3b3d1d18571855b8e13e67e58a44cbde 100644 >--- a/Source/JavaScriptCore/API/JSManagedValue.mm >+++ b/Source/JavaScriptCore/API/JSManagedValue.mm >@@ -88,7 +88,7 @@ - (instancetype)initWithValue:(JSValue *)value > JSC::ExecState* exec = toJS([value.context JSGlobalContextRef]); > JSC::JSGlobalObject* globalObject = exec->lexicalGlobalObject(); > auto& owner = managedValueHandleOwner(); >- JSC::Weak<JSC::JSGlobalObject> weak(globalObject, &owner, self); >+ JSC::Weak<JSC::JSGlobalObject> weak(globalObject, &owner, (__bridge void*)self); > m_globalObject.swap(weak); > > m_lock = &exec->vm().apiLock(); >@@ -99,9 +99,9 @@ - (instancetype)initWithValue:(JSValue *)value > > JSC::JSValue jsValue = toJS(exec, [value JSValueRef]); > if (jsValue.isObject()) >- m_weakValue.setObject(JSC::jsCast<JSC::JSObject*>(jsValue.asCell()), owner, self); >+ m_weakValue.setObject(JSC::jsCast<JSC::JSObject*>(jsValue.asCell()), owner, (__bridge void*)self); > else if (jsValue.isString()) >- m_weakValue.setString(JSC::jsCast<JSC::JSString*>(jsValue.asCell()), owner, self); >+ m_weakValue.setString(JSC::jsCast<JSC::JSString*>(jsValue.asCell()), owner, (__bridge void*)self); > else > m_weakValue.setPrimitive(jsValue); > return self; >@@ -113,7 +113,7 @@ - (void)dealloc > if (virtualMachine) { > NSMapTable *copy = [m_owners copy]; > for (id owner in [copy keyEnumerator]) { >- size_t count = reinterpret_cast<size_t>(NSMapGet(m_owners, owner)); >+ size_t count = reinterpret_cast<size_t>(NSMapGet(m_owners, (__bridge void*)owner)); > while (count--) > [virtualMachine removeManagedReference:self withOwner:owner]; > } >@@ -127,23 +127,23 @@ - (void)dealloc > > - (void)didAddOwner:(id)owner > { >- size_t count = reinterpret_cast<size_t>(NSMapGet(m_owners, owner)); >- NSMapInsert(m_owners, owner, reinterpret_cast<void*>(count + 1)); >+ size_t count = reinterpret_cast<size_t>(NSMapGet(m_owners, (__bridge void*)owner)); >+ NSMapInsert(m_owners, (__bridge void*)owner, reinterpret_cast<void*>(count + 1)); > } > > - (void)didRemoveOwner:(id)owner > { >- size_t count = reinterpret_cast<size_t>(NSMapGet(m_owners, owner)); >+ size_t count = reinterpret_cast<size_t>(NSMapGet(m_owners, (__bridge void*)owner)); > > if (!count) > return; > > if (count == 1) { >- NSMapRemove(m_owners, owner); >+ NSMapRemove(m_owners, (__bridge void*)owner); > return; > } > >- NSMapInsert(m_owners, owner, reinterpret_cast<void*>(count - 1)); >+ NSMapInsert(m_owners, (__bridge void*)owner, reinterpret_cast<void*>(count - 1)); > } > > - (JSValue *)value >@@ -184,13 +184,13 @@ @end > > bool JSManagedValueHandleOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown>, void* context, JSC::SlotVisitor& visitor) > { >- JSManagedValue *managedValue = static_cast<JSManagedValue *>(context); >- return visitor.containsOpaqueRoot(managedValue); >+ JSManagedValue *managedValue = (__bridge JSManagedValue *)context; >+ return visitor.containsOpaqueRoot((__bridge void*)managedValue); > } > > void JSManagedValueHandleOwner::finalize(JSC::Handle<JSC::Unknown>, void* context) > { >- JSManagedValue *managedValue = static_cast<JSManagedValue *>(context); >+ JSManagedValue *managedValue = (__bridge JSManagedValue *)context; > [managedValue disconnectValue]; > } > >diff --git a/Source/JavaScriptCore/API/JSValue.mm b/Source/JavaScriptCore/API/JSValue.mm >index 5c3c05689d46a7514586efad288ab4e7c3215566..a2668448ffbc7bf5534374d17da2beb4c7419883 100644 >--- a/Source/JavaScriptCore/API/JSValue.mm >+++ b/Source/JavaScriptCore/API/JSValue.mm >@@ -123,8 +123,8 @@ + (JSValue *)valueWithNewArrayInContext:(JSContext *)context > > + (JSValue *)valueWithNewRegularExpressionFromPattern:(NSString *)pattern flags:(NSString *)flags inContext:(JSContext *)context > { >- JSStringRef patternString = JSStringCreateWithCFString((CFStringRef)pattern); >- JSStringRef flagsString = JSStringCreateWithCFString((CFStringRef)flags); >+ JSStringRef patternString = JSStringCreateWithCFString((__bridge CFStringRef)pattern); >+ JSStringRef flagsString = JSStringCreateWithCFString((__bridge CFStringRef)flags); > JSValueRef arguments[2] = { JSValueMakeString([context JSGlobalContextRef], patternString), JSValueMakeString([context JSGlobalContextRef], flagsString) }; > JSStringRelease(patternString); > JSStringRelease(flagsString); >@@ -134,7 +134,7 @@ + (JSValue *)valueWithNewRegularExpressionFromPattern:(NSString *)pattern flags: > > + (JSValue *)valueWithNewErrorFromMessage:(NSString *)message inContext:(JSContext *)context > { >- JSStringRef string = JSStringCreateWithCFString((CFStringRef)message); >+ JSStringRef string = JSStringCreateWithCFString((__bridge CFStringRef)message); > JSValueRef argument = JSValueMakeString([context JSGlobalContextRef], string); > JSStringRelease(string); > >@@ -241,7 +241,7 @@ - (JSValue *)valueForProperty:(NSString *)propertyName > if (exception) > return [_context valueFromNotifyException:exception]; > >- JSStringRef name = JSStringCreateWithCFString((CFStringRef)propertyName); >+ JSStringRef name = JSStringCreateWithCFString((__bridge CFStringRef)propertyName); > JSValueRef result = JSObjectGetProperty([_context JSGlobalContextRef], object, name, &exception); > JSStringRelease(name); > if (exception) >@@ -259,7 +259,7 @@ - (void)setValue:(id)value forProperty:(NSString *)propertyName > return; > } > >- JSStringRef name = JSStringCreateWithCFString((CFStringRef)propertyName); >+ JSStringRef name = JSStringCreateWithCFString((__bridge CFStringRef)propertyName); > JSObjectSetProperty([_context JSGlobalContextRef], object, name, objectToValue(_context, value), 0, &exception); > JSStringRelease(name); > if (exception) { >@@ -275,7 +275,7 @@ - (BOOL)deleteProperty:(NSString *)propertyName > if (exception) > return [_context boolFromNotifyException:exception]; > >- JSStringRef name = JSStringCreateWithCFString((CFStringRef)propertyName); >+ JSStringRef name = JSStringCreateWithCFString((__bridge CFStringRef)propertyName); > BOOL result = JSObjectDeleteProperty([_context JSGlobalContextRef], object, name, &exception); > JSStringRelease(name); > if (exception) >@@ -291,7 +291,7 @@ - (BOOL)hasProperty:(NSString *)propertyName > if (exception) > return [_context boolFromNotifyException:exception]; > >- JSStringRef name = JSStringCreateWithCFString((CFStringRef)propertyName); >+ JSStringRef name = JSStringCreateWithCFString((__bridge CFStringRef)propertyName); > BOOL result = JSObjectHasProperty([_context JSGlobalContextRef], object, name); > JSStringRelease(name); > return result; >@@ -461,7 +461,7 @@ - (JSValue *)invokeMethod:(NSString *)method withArguments:(NSArray *)arguments > if (exception) > return [_context valueFromNotifyException:exception]; > >- JSStringRef name = JSStringCreateWithCFString((CFStringRef)method); >+ JSStringRef name = JSStringCreateWithCFString((__bridge CFStringRef)method); > JSValueRef function = JSObjectGetProperty([_context JSGlobalContextRef], thisObject, name, &exception); > JSStringRelease(name); > if (exception) >@@ -694,21 +694,21 @@ static JSContainerConvertor::Task valueToObjectWithoutCopy(JSGlobalContextRef co > ASSERT(JSValueIsUndefined(context, value)); > primitive = nil; > } >- return (JSContainerConvertor::Task){ value, primitive, ContainerNone }; >+ return { value, primitive, ContainerNone }; > } > > JSObjectRef object = JSValueToObject(context, value, 0); > > if (id wrapped = tryUnwrapObjcObject(context, object)) >- return (JSContainerConvertor::Task){ object, wrapped, ContainerNone }; >+ return { object, wrapped, ContainerNone }; > > if (isDate(vm, object, context)) >- return (JSContainerConvertor::Task){ object, [NSDate dateWithTimeIntervalSince1970:JSValueToNumber(context, object, 0) / 1000.0], ContainerNone }; >+ return { object, [NSDate dateWithTimeIntervalSince1970:JSValueToNumber(context, object, 0) / 1000.0], ContainerNone }; > > if (isArray(vm, object, context)) >- return (JSContainerConvertor::Task){ object, [NSMutableArray array], ContainerArray }; >+ return { object, [NSMutableArray array], ContainerArray }; > >- return (JSContainerConvertor::Task){ object, [NSMutableDictionary dictionary], ContainerDictionary }; >+ return { object, [NSMutableDictionary dictionary], ContainerDictionary }; > } > > static id containerValueToObject(JSGlobalContextRef context, JSContainerConvertor::Task task) >@@ -822,7 +822,7 @@ id valueToArray(JSGlobalContextRef context, JSValueRef value, JSValueRef* except > } > > if (JSValueIsObject(context, value)) >- return containerValueToObject(context, (JSContainerConvertor::Task){ value, [NSMutableArray array], ContainerArray}); >+ return containerValueToObject(context, { value, [NSMutableArray array], ContainerArray}); > > JSC::JSLockHolder locker(toJS(context)); > if (!(JSValueIsNull(context, value) || JSValueIsUndefined(context, value))) { >@@ -844,7 +844,7 @@ id valueToDictionary(JSGlobalContextRef context, JSValueRef value, JSValueRef* e > } > > if (JSValueIsObject(context, value)) >- return containerValueToObject(context, (JSContainerConvertor::Task){ value, [NSMutableDictionary dictionary], ContainerDictionary}); >+ return containerValueToObject(context, { value, [NSMutableDictionary dictionary], ContainerDictionary}); > > JSC::JSLockHolder locker(toJS(context)); > if (!(JSValueIsNull(context, value) || JSValueIsUndefined(context, value))) { >@@ -925,49 +925,49 @@ static ObjcContainerConvertor::Task objectToValueWithoutCopy(JSContext *context, > JSGlobalContextRef contextRef = [context JSGlobalContextRef]; > > if (!object) >- return (ObjcContainerConvertor::Task){ object, JSValueMakeUndefined(contextRef), ContainerNone }; >+ return { object, JSValueMakeUndefined(contextRef), ContainerNone }; > > if (!class_conformsToProtocol(object_getClass(object), getJSExportProtocol())) { > if ([object isKindOfClass:[NSArray class]]) >- return (ObjcContainerConvertor::Task){ object, JSObjectMakeArray(contextRef, 0, NULL, 0), ContainerArray }; >+ return { object, JSObjectMakeArray(contextRef, 0, NULL, 0), ContainerArray }; > > if ([object isKindOfClass:[NSDictionary class]]) >- return (ObjcContainerConvertor::Task){ object, JSObjectMake(contextRef, 0, 0), ContainerDictionary }; >+ return { object, JSObjectMake(contextRef, 0, 0), ContainerDictionary }; > > if ([object isKindOfClass:[NSNull class]]) >- return (ObjcContainerConvertor::Task){ object, JSValueMakeNull(contextRef), ContainerNone }; >+ return { object, JSValueMakeNull(contextRef), ContainerNone }; > > if ([object isKindOfClass:[JSValue class]]) >- return (ObjcContainerConvertor::Task){ object, ((JSValue *)object)->m_value, ContainerNone }; >+ return { object, ((JSValue *)object)->m_value, ContainerNone }; > > if ([object isKindOfClass:[NSString class]]) { >- JSStringRef string = JSStringCreateWithCFString((CFStringRef)object); >+ JSStringRef string = JSStringCreateWithCFString((__bridge CFStringRef)object); > JSValueRef js = JSValueMakeString(contextRef, string); > JSStringRelease(string); >- return (ObjcContainerConvertor::Task){ object, js, ContainerNone }; >+ return { object, js, ContainerNone }; > } > > if ([object isKindOfClass:[NSNumber class]]) { > if (isNSBoolean(object)) >- return (ObjcContainerConvertor::Task){ object, JSValueMakeBoolean(contextRef, [object boolValue]), ContainerNone }; >- return (ObjcContainerConvertor::Task){ object, JSValueMakeNumber(contextRef, [object doubleValue]), ContainerNone }; >+ return { object, JSValueMakeBoolean(contextRef, [object boolValue]), ContainerNone }; >+ return { object, JSValueMakeNumber(contextRef, [object doubleValue]), ContainerNone }; > } > > if ([object isKindOfClass:[NSDate class]]) { > JSValueRef argument = JSValueMakeNumber(contextRef, [object timeIntervalSince1970] * 1000.0); > JSObjectRef result = JSObjectMakeDate(contextRef, 1, &argument, 0); >- return (ObjcContainerConvertor::Task){ object, result, ContainerNone }; >+ return { object, result, ContainerNone }; > } > > if ([object isKindOfClass:[JSManagedValue class]]) { > JSValue *value = [static_cast<JSManagedValue *>(object) value]; > if (!value) >- return (ObjcContainerConvertor::Task) { object, JSValueMakeUndefined(contextRef), ContainerNone }; >- return (ObjcContainerConvertor::Task){ object, value->m_value, ContainerNone }; >+ return { object, JSValueMakeUndefined(contextRef), ContainerNone }; >+ return { object, value->m_value, ContainerNone }; > } > } > >- return (ObjcContainerConvertor::Task){ object, valueInternalValue([context wrapperForObjCObject:object]), ContainerNone }; >+ return { object, valueInternalValue([context wrapperForObjCObject:object]), ContainerNone }; > } > > JSValueRef objectToValue(JSContext *context, id object) >@@ -1000,7 +1000,7 @@ JSValueRef objectToValue(JSContext *context, id object) > NSDictionary *dictionary = (NSDictionary *)current.objc; > for (id key in [dictionary keyEnumerator]) { > if ([key isKindOfClass:[NSString class]]) { >- JSStringRef propertyName = JSStringCreateWithCFString((CFStringRef)key); >+ JSStringRef propertyName = JSStringCreateWithCFString((__bridge CFStringRef)key); > JSObjectSetProperty(contextRef, js, propertyName, convertor.convert([dictionary objectForKey:key]), 0, 0); > JSStringRelease(propertyName); > } >diff --git a/Source/JavaScriptCore/API/JSVirtualMachine.mm b/Source/JavaScriptCore/API/JSVirtualMachine.mm >index 1e20791b45a884bbdbbcb2a40cb724930e8c076b..bfbb6c1085f79e420fbeb6e67ea5ada69ea941c8 100644 >--- a/Source/JavaScriptCore/API/JSVirtualMachine.mm >+++ b/Source/JavaScriptCore/API/JSVirtualMachine.mm >@@ -69,13 +69,13 @@ @implementation JSVMWrapperCache > + (void)addWrapper:(JSVirtualMachine *)wrapper forJSContextGroupRef:(JSContextGroupRef)group > { > std::lock_guard<Lock> lock(wrapperCacheMutex); >- NSMapInsert(wrapperCache(), group, wrapper); >+ NSMapInsert(wrapperCache(), group, (__bridge void*)wrapper); > } > > + (JSVirtualMachine *)wrapperForJSContextGroupRef:(JSContextGroupRef)group > { > std::lock_guard<Lock> lock(wrapperCacheMutex); >- return static_cast<JSVirtualMachine *>(NSMapGet(wrapperCache(), group)); >+ return (__bridge JSVirtualMachine *)NSMapGet(wrapperCache(), group); > } > > @end >@@ -153,7 +153,7 @@ static id getInternalObjcObject(id object) > - (bool)isOldExternalObject:(id)object > { > JSC::VM* vm = toJS(m_group); >- return vm->heap.collectorSlotVisitor().containsOpaqueRoot(object); >+ return vm->heap.collectorSlotVisitor().containsOpaqueRoot((__bridge void*)object); > } > > - (void)addExternalRememberedObject:(id)object >@@ -186,11 +186,10 @@ - (void)addManagedReference:(id)object withOwner:(id)owner > ownedObjects = [[NSMapTable alloc] initWithKeyOptions:weakIDOptions valueOptions:integerOptions capacity:1]; > > [m_externalObjectGraph setObject:ownedObjects forKey:owner]; >- [ownedObjects release]; > } > >- size_t count = reinterpret_cast<size_t>(NSMapGet(ownedObjects, object)); >- NSMapInsert(ownedObjects, object, reinterpret_cast<void*>(count + 1)); >+ size_t count = reinterpret_cast<size_t>(NSMapGet(ownedObjects, (__bridge void*)object)); >+ NSMapInsert(ownedObjects, (__bridge void*)object, reinterpret_cast<void*>(count + 1)); > } > > - (void)removeManagedReference:(id)object withOwner:(id)owner >@@ -211,14 +210,14 @@ - (void)removeManagedReference:(id)object withOwner:(id)owner > if (!ownedObjects) > return; > >- size_t count = reinterpret_cast<size_t>(NSMapGet(ownedObjects, object)); >+ size_t count = reinterpret_cast<size_t>(NSMapGet(ownedObjects, (__bridge void*)object)); > if (count > 1) { >- NSMapInsert(ownedObjects, object, reinterpret_cast<void*>(count - 1)); >+ NSMapInsert(ownedObjects, (__bridge void*)object, reinterpret_cast<void*>(count - 1)); > return; > } > > if (count == 1) >- NSMapRemove(ownedObjects, object); >+ NSMapRemove(ownedObjects, (__bridge void*)object); > > if (![ownedObjects count]) { > [m_externalObjectGraph removeObjectForKey:owner]; >@@ -245,12 +244,12 @@ + (JSVirtualMachine *)virtualMachineWithContextGroupRef:(JSContextGroupRef)group > > - (JSContext *)contextForGlobalContextRef:(JSGlobalContextRef)globalContext > { >- return static_cast<JSContext *>(NSMapGet(m_contextCache, globalContext)); >+ return (__bridge JSContext *)NSMapGet(m_contextCache, globalContext); > } > > - (void)addContext:(JSContext *)wrapper forGlobalContextRef:(JSGlobalContextRef)globalContext > { >- NSMapInsert(m_contextCache, globalContext, wrapper); >+ NSMapInsert(m_contextCache, globalContext, (__bridge void*)wrapper); > } > > - (Lock&)externalDataMutex >@@ -294,9 +293,9 @@ static void scanExternalObjectGraph(JSC::VM& vm, JSC::SlotVisitor& visitor, void > continue; > > auto appendOwnedObjects = [&] { >- NSMapTable *ownedObjects = [externalObjectGraph objectForKey:static_cast<id>(nextRoot)]; >+ NSMapTable *ownedObjects = [externalObjectGraph objectForKey:(__bridge id)nextRoot]; > for (id ownedObject in ownedObjects) >- stack.append(static_cast<void*>(ownedObject)); >+ stack.append((__bridge void*)ownedObject); > }; > > if (lockAcquired) >@@ -329,7 +328,7 @@ void scanExternalRememberedSet(JSC::VM& vm, JSC::SlotVisitor& visitor) > NSMapTable *ownedObjects = [externalObjectGraph objectForKey:key]; > bool lockAcquired = true; > for (id ownedObject in ownedObjects) >- scanExternalObjectGraph(vm, visitor, ownedObject, lockAcquired); >+ scanExternalObjectGraph(vm, visitor, (__bridge void*)ownedObject, lockAcquired); > } > [externalRememberedSet removeAllObjects]; > } >diff --git a/Source/JavaScriptCore/API/JSWrapperMap.mm b/Source/JavaScriptCore/API/JSWrapperMap.mm >index 019923ac9610ded144040c04cd73726a2d3d3afe..91a2129c6bf5aaae1d2a06435f955f91b8a164e1 100644 >--- a/Source/JavaScriptCore/API/JSWrapperMap.mm >+++ b/Source/JavaScriptCore/API/JSWrapperMap.mm >@@ -125,7 +125,7 @@ static JSC::JSObject* makeWrapper(JSContextRef ctx, JSClassRef jsClass, id wrapp > > ASSERT(jsClass); > JSC::JSCallbackObject<JSC::JSAPIWrapperObject>* object = JSC::JSCallbackObject<JSC::JSAPIWrapperObject>::create(exec, exec->lexicalGlobalObject(), exec->lexicalGlobalObject()->objcWrapperObjectStructure(), jsClass, 0); >- object->setWrappedObject(wrappedObject); >+ object->setWrappedObject((__bridge void*)wrappedObject); > if (JSC::JSObject* prototype = jsClass->prototype(exec)) > object->setPrototypeDirect(vm, prototype); > >@@ -524,8 +524,8 @@ - (JSC::JSObject*)wrapperForObject:(id)object inContext:(JSContext *)context > JSC::VM& vm = exec->vm(); > JSC::JSLockHolder locker(vm); > >- JSC::JSCallbackObject<JSC::JSAPIWrapperObject>* wrapper = JSC::JSCallbackObject<JSC::JSAPIWrapperObject>::create(exec, exec->lexicalGlobalObject(), structure, m_classRef, 0); >- wrapper->setWrappedObject(object); >+ auto wrapper = JSC::JSCallbackObject<JSC::JSAPIWrapperObject>::create(exec, exec->lexicalGlobalObject(), structure, m_classRef, 0); >+ wrapper->setWrappedObject((__bridge void*)object); > return wrapper; > } > >@@ -644,10 +644,10 @@ - (JSValue *)jsWrapperForObject:(id)object inContext:(JSContext *)context > - (JSValue *)objcWrapperForJSValueRef:(JSValueRef)value inContext:context > { > ASSERT(toJSGlobalObject([context JSGlobalContextRef])->wrapperMap() == self); >- JSValue *wrapper = static_cast<JSValue *>(NSMapGet(m_cachedObjCWrappers, value)); >+ JSValue *wrapper = (__bridge JSValue *)NSMapGet(m_cachedObjCWrappers, value); > if (!wrapper) { > wrapper = [[[JSValue alloc] initWithValue:value inContext:context] autorelease]; >- NSMapInsert(m_cachedObjCWrappers, value, wrapper); >+ NSMapInsert(m_cachedObjCWrappers, value, (__bridge void*)wrapper); > } > return wrapper; > } >@@ -664,7 +664,7 @@ id tryUnwrapObjcObject(JSGlobalContextRef context, JSValueRef value) > JSC::JSLockHolder locker(toJS(context)); > JSC::VM& vm = toJS(context)->vm(); > if (toJS(object)->inherits<JSC::JSCallbackObject<JSC::JSAPIWrapperObject>>(vm)) >- return (id)JSC::jsCast<JSC::JSAPIWrapperObject*>(toJS(object))->wrappedObject(); >+ return (__bridge id)JSC::jsCast<JSC::JSAPIWrapperObject*>(toJS(object))->wrappedObject(); > if (id target = tryUnwrapConstructor(&vm, object)) > return target; > return nil; >diff --git a/Source/JavaScriptCore/API/ObjCCallbackFunction.mm b/Source/JavaScriptCore/API/ObjCCallbackFunction.mm >index 8886fe039fd9b455c34b359c1ee7d14acd84648e..c4e73a866d6b60b08823d78210450c905c3ed7f3 100644 >--- a/Source/JavaScriptCore/API/ObjCCallbackFunction.mm >+++ b/Source/JavaScriptCore/API/ObjCCallbackFunction.mm >@@ -603,7 +603,7 @@ static bool blockSignatureContainsClass() > { > static bool containsClass = ^{ > id block = ^(NSString *string){ return string; }; >- return _Block_has_signature(block) && strstr(_Block_signature(block), "NSString"); >+ return _Block_has_signature((__bridge void*)block) && strstr(_Block_signature((__bridge void*)block), "NSString"); > }(); > return containsClass; > } >@@ -677,18 +677,20 @@ JSObjectRef objCCallbackFunctionForMethod(JSContext *context, Class cls, Protoco > { > NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:[NSMethodSignature signatureWithObjCTypes:types]]; > [invocation setSelector:sel]; >- // We need to retain the target Class because m_invocation doesn't retain it by default (and we don't want it to). >- // FIXME: What releases it? >- if (!isInstanceMethod) >- [invocation setTarget:[cls retain]]; >+ if (!isInstanceMethod) { >+ [invocation setTarget:cls]; >+ // We need to retain the target Class because m_invocation doesn't retain it by default (and we don't want it to). >+ // FIXME: What releases it? >+ CFRetain((__bridge CFTypeRef)cls); >+ } > return objCCallbackFunctionForInvocation(context, invocation, isInstanceMethod ? CallbackInstanceMethod : CallbackClassMethod, isInstanceMethod ? cls : nil, _protocol_getMethodTypeEncoding(protocol, sel, YES, isInstanceMethod)); > } > > JSObjectRef objCCallbackFunctionForBlock(JSContext *context, id target) > { >- if (!_Block_has_signature(target)) >+ if (!_Block_has_signature((__bridge void*)target)) > return nullptr; >- const char* signature = _Block_signature(target); >+ const char* signature = _Block_signature((__bridge void*)target); > NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:[NSMethodSignature signatureWithObjCTypes:signature]]; > > // We don't want to use -retainArguments because that leaks memory. Arguments >diff --git a/Source/JavaScriptCore/API/ObjcRuntimeExtras.h b/Source/JavaScriptCore/API/ObjcRuntimeExtras.h >index 2d7db6619257a69d181ac9f7960ea398acd96907..20d8b85847a553a33cdfc13f52ec6a4d952f8c2f 100644 >--- a/Source/JavaScriptCore/API/ObjcRuntimeExtras.h >+++ b/Source/JavaScriptCore/API/ObjcRuntimeExtras.h >@@ -40,7 +40,7 @@ inline std::unique_ptr<T, WTF::SystemFree<T>> adoptSystem(U value) > inline bool protocolImplementsProtocol(Protocol *candidate, Protocol *target) > { > unsigned protocolProtocolsCount; >- auto protocolProtocols = adoptSystem<Protocol*[]>(protocol_copyProtocolList(candidate, &protocolProtocolsCount)); >+ auto protocolProtocols = adoptSystem<__unsafe_unretained Protocol*[]>(protocol_copyProtocolList(candidate, &protocolProtocolsCount)); > for (unsigned i = 0; i < protocolProtocolsCount; ++i) { > if (protocol_isEqual(protocolProtocols[i], target)) > return true; >@@ -59,7 +59,7 @@ inline void forEachProtocolImplementingProtocol(Class cls, Protocol *target, voi > // Initially fill the worklist with the Class's protocols. > { > unsigned protocolsCount; >- auto protocols = adoptSystem<Protocol*[]>(class_copyProtocolList(cls, &protocolsCount)); >+ auto protocols = adoptSystem<__unsafe_unretained Protocol*[]>(class_copyProtocolList(cls, &protocolsCount)); > worklist.append(protocols.get(), protocolsCount); > } > >@@ -69,7 +69,7 @@ inline void forEachProtocolImplementingProtocol(Class cls, Protocol *target, voi > worklist.removeLast(); > > // Are we encountering this Protocol for the first time? >- if (!visited.add(protocol).isNewEntry) >+ if (!visited.add((__bridge void*)protocol).isNewEntry) > continue; > > // If it implements the protocol, make the callback. >@@ -82,7 +82,7 @@ inline void forEachProtocolImplementingProtocol(Class cls, Protocol *target, voi > // Add incorporated protocols to the worklist. > { > unsigned protocolsCount; >- auto protocols = adoptSystem<Protocol*[]>(protocol_copyProtocolList(protocol, &protocolsCount)); >+ auto protocols = adoptSystem<__unsafe_unretained Protocol*[]>(protocol_copyProtocolList(protocol, &protocolsCount)); > worklist.append(protocols.get(), protocolsCount); > } > } >diff --git a/Source/JavaScriptCore/inspector/remote/cocoa/RemoteInspectorCocoa.mm b/Source/JavaScriptCore/inspector/remote/cocoa/RemoteInspectorCocoa.mm >index 1bc44412cb06717979da42049c9fafcd37052a87..6188069739a727274ffb490a6a787a9282b22769 100644 >--- a/Source/JavaScriptCore/inspector/remote/cocoa/RemoteInspectorCocoa.mm >+++ b/Source/JavaScriptCore/inspector/remote/cocoa/RemoteInspectorCocoa.mm >@@ -59,15 +59,14 @@ > return; \ > } while (0); > >-#define CONVERT_NSNULL_TO_NIL(expr) \ >- do { \ >- if ([expr isEqual:[NSNull null]]) \ >- expr = nil; \ >- } while (0); >- >- > namespace Inspector { > >+static void convertNSNullToNil(__strong NSNumber *& number) >+{ >+ if ([number isEqual:[NSNull null]]) >+ number = nil; >+} >+ > static bool canAccessWebInspectorMachPort() > { > return !sandbox_check(getpid(), "mach-lookup", static_cast<enum sandbox_filter_type>(SANDBOX_FILTER_GLOBAL_NAME | SANDBOX_CHECK_NO_REPORT), WIRXPCMachPortName); >@@ -491,7 +490,7 @@ void RemoteInspector::receivedSetupMessage(NSDictionary *userInfo) > BAIL_IF_UNEXPECTED_TYPE(sender, [NSString class]); > > NSNumber *automaticallyPauseNumber = userInfo[WIRAutomaticallyPause]; >- CONVERT_NSNULL_TO_NIL(automaticallyPauseNumber); >+ convertNSNullToNil(automaticallyPauseNumber); > BAIL_IF_UNEXPECTED_TYPE_ALLOWING_NIL(automaticallyPauseNumber, [NSNumber class]); > BOOL automaticallyPause = automaticallyPauseNumber.boolValue; > >diff --git a/Source/JavaScriptCore/inspector/remote/cocoa/RemoteInspectorXPCConnection.mm b/Source/JavaScriptCore/inspector/remote/cocoa/RemoteInspectorXPCConnection.mm >index cea6c9c1af1e60102a12345ecf986994356b0e32..753ac4a8cc0d9bd30ed588fba8ca30a782966cd2 100644 >--- a/Source/JavaScriptCore/inspector/remote/cocoa/RemoteInspectorXPCConnection.mm >+++ b/Source/JavaScriptCore/inspector/remote/cocoa/RemoteInspectorXPCConnection.mm >@@ -34,36 +34,11 @@ > #import <wtf/Lock.h> > #import <wtf/Ref.h> > #import <wtf/RetainPtr.h> >+#import <wtf/cocoa/Entitlements.h> >+#import <wtf/spi/cocoa/CFXPCBridgeSPI.h> > #import <wtf/spi/cocoa/SecuritySPI.h> > #import <wtf/spi/darwin/XPCSPI.h> > >-#if USE(APPLE_INTERNAL_SDK) >-#import <CoreFoundation/CFXPCBridge.h> >-#else >-extern "C" { >- xpc_object_t _CFXPCCreateXPCMessageWithCFObject(CFTypeRef); >- CFTypeRef _CFXPCCreateCFObjectFromXPCMessage(xpc_object_t); >-} >-#endif >- >-#if PLATFORM(MAC) >-static bool auditTokenHasEntitlement(audit_token_t token, NSString *entitlement) >-{ >- auto task = adoptCF(SecTaskCreateWithAuditToken(kCFAllocatorDefault, token)); >- if (!task) >- return false; >- >- auto value = adoptCF(SecTaskCopyValueForEntitlement(task.get(), (CFStringRef)entitlement, nullptr)); >- if (!value) >- return false; >- >- if (CFGetTypeID(value.get()) != CFBooleanGetTypeID()) >- return false; >- >- return CFBooleanGetValue(static_cast<CFBooleanRef>(value.get())); >-} >-#endif >- > namespace Inspector { > > // Constants private to this file for message serialization on both ends. >@@ -173,7 +148,7 @@ void RemoteInspectorXPCConnection::handleEvent(xpc_object_t object) > if (!m_validated) { > audit_token_t token; > xpc_connection_get_audit_token(m_connection, &token); >- if (!auditTokenHasEntitlement(token, @"com.apple.private.webinspector.webinspectord")) { >+ if (!WTF::hasEntitlement(token, "com.apple.private.webinspector.webinspectord")) { > std::lock_guard<Lock> lock(m_mutex); > // This will trigger one last XPC_ERROR_CONNECTION_INVALID event on the queue and deref us. > closeOnQueue(); >@@ -211,7 +186,7 @@ void RemoteInspectorXPCConnection::sendMessage(NSString *messageName, NSDictiona > if (userInfo) > [dictionary setObject:userInfo forKey:RemoteInspectorXPCConnectionUserInfoKey]; > >- xpc_object_t xpcDictionary = _CFXPCCreateXPCMessageWithCFObject((CFDictionaryRef)dictionary.get()); >+ xpc_object_t xpcDictionary = _CFXPCCreateXPCMessageWithCFObject((__bridge CFDictionaryRef)dictionary.get()); > ASSERT_WITH_MESSAGE(xpcDictionary && xpc_get_type(xpcDictionary) == XPC_TYPE_DICTIONARY, "Unable to serialize xpc message"); > if (!xpcDictionary) > return; >diff --git a/Source/WTF/WTF.xcodeproj/project.pbxproj b/Source/WTF/WTF.xcodeproj/project.pbxproj >index 4ef67e0d424ba32fec65f572d639f84e8c743fe1..35c91fd820de5a3ed1732fb99ede38f336cccad0 100644 >--- a/Source/WTF/WTF.xcodeproj/project.pbxproj >+++ b/Source/WTF/WTF.xcodeproj/project.pbxproj >@@ -44,7 +44,7 @@ > 0FEC3C5E1F368A9700F59B6C /* ReadWriteLock.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0FEC3C5C1F368A9700F59B6C /* ReadWriteLock.cpp */; }; > 0FFF19DC1BB334EB00886D91 /* ParallelHelperPool.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0FFF19DA1BB334EB00886D91 /* ParallelHelperPool.cpp */; }; > 14022F4118F5C3FC007FF0EB /* libbmalloc.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 14022F4018F5C3FC007FF0EB /* libbmalloc.a */; }; >- 143DDE9620C8BC37007F76FA /* Entitlements.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 143DDE9520C8BC37007F76FA /* Entitlements.cpp */; }; >+ 143DDE9620C8BC37007F76FA /* Entitlements.mm in Sources */ = {isa = PBXBuildFile; fileRef = 143DDE9520C8BC37007F76FA /* Entitlements.mm */; }; > 143F611F1565F0F900DB514A /* RAMSize.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 143F611D1565F0F900DB514A /* RAMSize.cpp */; }; > 1447AEC618FCE57700B3D7FF /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1447AEC518FCE57700B3D7FF /* Foundation.framework */; }; > 1447AEC718FCE58000B3D7FF /* libWTF.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5D247B6214689B8600E78B76 /* libWTF.a */; }; >@@ -141,6 +141,7 @@ > C2BCFC401F61D13000C9222C /* Language.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C2BCFC3E1F61D13000C9222C /* Language.cpp */; }; > C2BCFC421F61D61600C9222C /* LanguageCF.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C2BCFC411F61D61600C9222C /* LanguageCF.cpp */; }; > C2BCFC551F621F3F00C9222C /* LineEnding.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C2BCFC531F621F3F00C9222C /* LineEnding.cpp */; }; >+ C805EF39E5F14481A96D39FC /* ASCIILiteral.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C6F050790D9C432A99085E75 /* ASCIILiteral.cpp */; }; > CD5497AC15857D0300B5BC30 /* MediaTime.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CD5497AA15857D0300B5BC30 /* MediaTime.cpp */; }; > DCEE22011CEA7551000C2396 /* BlockObjCExceptions.mm in Sources */ = {isa = PBXBuildFile; fileRef = DCEE21FD1CEA7551000C2396 /* BlockObjCExceptions.mm */; }; > E15556F518A0CC18006F48FB /* CryptographicUtilities.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E15556F318A0CC18006F48FB /* CryptographicUtilities.cpp */; }; >@@ -155,7 +156,6 @@ > FE05FAFF1FE5007500093230 /* WTFAssertions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FE05FAFE1FE5007500093230 /* WTFAssertions.cpp */; }; > FE85416E1FBE285D008DA5DA /* Poisoned.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FE85416C1FBE285B008DA5DA /* Poisoned.cpp */; }; > FEDACD3D1630F83F00C69634 /* StackStats.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FEDACD3B1630F83F00C69634 /* StackStats.cpp */; }; >- C805EF39E5F14481A96D39FC /* ASCIILiteral.cpp in Resources */ = {isa = PBXBuildFile; fileRef = C6F050790D9C432A99085E75 /* ASCIILiteral.cpp */; }; > /* End PBXBuildFile section */ > > /* Begin PBXContainerItemProxy section */ >@@ -270,7 +270,7 @@ > 0FFF19DB1BB334EB00886D91 /* ParallelHelperPool.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ParallelHelperPool.h; sourceTree = "<group>"; }; > 132743924FC54E469F5A8E6E /* StdUnorderedSet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StdUnorderedSet.h; sourceTree = "<group>"; }; > 14022F4018F5C3FC007FF0EB /* libbmalloc.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libbmalloc.a; sourceTree = BUILT_PRODUCTS_DIR; }; >- 143DDE9520C8BC37007F76FA /* Entitlements.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Entitlements.cpp; sourceTree = "<group>"; }; >+ 143DDE9520C8BC37007F76FA /* Entitlements.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = Entitlements.mm; sourceTree = "<group>"; }; > 143DDE9720C8BE99007F76FA /* Entitlements.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Entitlements.h; sourceTree = "<group>"; }; > 143F611D1565F0F900DB514A /* RAMSize.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RAMSize.cpp; sourceTree = "<group>"; }; > 143F611E1565F0F900DB514A /* RAMSize.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RAMSize.h; sourceTree = "<group>"; }; >@@ -316,7 +316,7 @@ > 1C181C951D30800A00F5FA16 /* TextBreakIteratorInternalICUCocoa.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TextBreakIteratorInternalICUCocoa.cpp; sourceTree = "<group>"; }; > 1CCDB1491E566626006C73C0 /* TextBreakIteratorCF.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TextBreakIteratorCF.h; sourceTree = "<group>"; }; > 1CCDB14D1E566898006C73C0 /* TextBreakIteratorICU.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TextBreakIteratorICU.h; sourceTree = "<group>"; }; >- 1CCDB1511E566BC5006C73C0 /* CFStringSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CFStringSPI.h; path = cf/CFStringSPI.h; sourceTree = "<group>"; }; >+ 1CCDB1511E566BC5006C73C0 /* CFStringSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CFStringSPI.h; sourceTree = "<group>"; }; > 1FA47C88152502DA00568D1B /* WebCoreThread.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebCoreThread.cpp; sourceTree = "<group>"; }; > 1FA47C89152502DA00568D1B /* WebCoreThread.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebCoreThread.h; sourceTree = "<group>"; }; > 24F1B248619F412296D1C19C /* RandomDevice.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RandomDevice.h; sourceTree = "<group>"; }; >@@ -331,6 +331,7 @@ > 3137E1D7DBD84AC38FAE4D34 /* IndexSet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IndexSet.h; sourceTree = "<group>"; }; > 313EDEC9778E49C9BEA91CFC /* StackTrace.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StackTrace.cpp; sourceTree = "<group>"; }; > 37C7CC291EA40A73007BD956 /* WeakLinking.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WeakLinking.h; sourceTree = "<group>"; }; >+ 382029E246C84B0099FD6764 /* ASCIILiteral.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASCIILiteral.h; sourceTree = "<group>"; }; > 391BD6BA4D164FD294F9A93D /* StdMap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StdMap.h; sourceTree = "<group>"; }; > 413FE8F51F8D2EAB00F6D7D7 /* CallbackAggregator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CallbackAggregator.h; sourceTree = "<group>"; }; > 430B47871AAAAC1A001223DA /* StringCommon.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StringCommon.h; sourceTree = "<group>"; }; >@@ -405,6 +406,7 @@ > 83FBA93119DF459700F30ADB /* TypeCasts.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TypeCasts.h; sourceTree = "<group>"; }; > 86F46F5F1A2840EE00CCBF22 /* RefCounter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RefCounter.h; sourceTree = "<group>"; }; > 933D63191FCB6AB90032ECD6 /* StringHasher.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StringHasher.h; sourceTree = "<group>"; }; >+ 9384B73E20DEA284005B73B2 /* CFXPCBridgeSPI.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CFXPCBridgeSPI.h; sourceTree = "<group>"; }; > 93934BD218A1E8C300D0D6A1 /* StringViewCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = StringViewCocoa.mm; sourceTree = "<group>"; }; > 93934BD418A1F16900D0D6A1 /* StringViewCF.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StringViewCF.cpp; sourceTree = "<group>"; }; > 93AC91A718942FC400244939 /* LChar.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LChar.h; sourceTree = "<group>"; }; >@@ -599,6 +601,7 @@ > C2BCFC531F621F3F00C9222C /* LineEnding.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LineEnding.cpp; sourceTree = "<group>"; }; > C2BCFC541F621F3F00C9222C /* LineEnding.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LineEnding.h; sourceTree = "<group>"; }; > C4F8A93619C65EB400B2B15D /* Stopwatch.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Stopwatch.h; sourceTree = "<group>"; }; >+ C6F050790D9C432A99085E75 /* ASCIILiteral.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ASCIILiteral.cpp; sourceTree = "<group>"; }; > C8F597CA2A57417FBAB92FD6 /* RandomDevice.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RandomDevice.cpp; sourceTree = "<group>"; }; > CD5497AA15857D0300B5BC30 /* MediaTime.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MediaTime.cpp; sourceTree = "<group>"; }; > CD5497AB15857D0300B5BC30 /* MediaTime.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MediaTime.h; sourceTree = "<group>"; }; >@@ -606,7 +609,7 @@ > CD7600FF1F90A3CA00026E26 /* UnsafePointer.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = UnsafePointer.h; sourceTree = "<group>"; }; > CE46516D19DB1FB4003ECA05 /* NSMapTableSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NSMapTableSPI.h; sourceTree = "<group>"; }; > CE73E02419DCB7AB00580D5C /* XPCSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XPCSPI.h; sourceTree = "<group>"; }; >- DCEE21FA1CEA7538000C2396 /* CFBundleSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CFBundleSPI.h; path = cf/CFBundleSPI.h; sourceTree = "<group>"; }; >+ DCEE21FA1CEA7538000C2396 /* CFBundleSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CFBundleSPI.h; sourceTree = "<group>"; }; > DCEE21FC1CEA7551000C2396 /* BlockObjCExceptions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BlockObjCExceptions.h; sourceTree = "<group>"; }; > DCEE21FD1CEA7551000C2396 /* BlockObjCExceptions.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = BlockObjCExceptions.mm; sourceTree = "<group>"; }; > DCEE22041CEB9869000C2396 /* BackwardsGraph.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BackwardsGraph.h; sourceTree = "<group>"; }; >@@ -648,8 +651,6 @@ > FEDACD3C1630F83F00C69634 /* StackStats.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StackStats.h; sourceTree = "<group>"; }; > FEF295BF20B49DCB00CF283A /* UTF8ConversionError.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UTF8ConversionError.h; sourceTree = "<group>"; }; > FF0A436588954F3CB07DBECA /* StdList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StdList.h; sourceTree = "<group>"; }; >- 382029E246C84B0099FD6764 /* ASCIILiteral.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASCIILiteral.h; sourceTree = "<group>"; }; >- C6F050790D9C432A99085E75 /* ASCIILiteral.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ASCIILiteral.cpp; sourceTree = "<group>"; }; > /* End PBXFileReference section */ > > /* Begin PBXFrameworksBuildPhase section */ >@@ -1271,6 +1272,7 @@ > CE46516C19DB1FB4003ECA05 /* cocoa */ = { > isa = PBXGroup; > children = ( >+ 9384B73E20DEA284005B73B2 /* CFXPCBridgeSPI.h */, > 93D191CF20CAECE800C51B8E /* FoundationSPI.h */, > CE46516D19DB1FB4003ECA05 /* NSMapTableSPI.h */, > A5098B011C16A4F900087797 /* SecuritySPI.h */, >@@ -1305,7 +1307,7 @@ > DCEE21FA1CEA7538000C2396 /* CFBundleSPI.h */, > 1CCDB1511E566BC5006C73C0 /* CFStringSPI.h */, > ); >- name = cf; >+ path = cf; > sourceTree = "<group>"; > }; > E43A46851E228B5700276B05 /* persistence */ = { >@@ -1327,8 +1329,8 @@ > children = ( > 1469419B16EAB10A0024E146 /* AutodrainedPool.cpp */, > E38C41241EB4E04C0042957D /* CPUTimeCocoa.cpp */, >- 143DDE9520C8BC37007F76FA /* Entitlements.cpp */, > 143DDE9720C8BE99007F76FA /* Entitlements.h */, >+ 143DDE9520C8BC37007F76FA /* Entitlements.mm */, > 7A6EBA3320746C34004F9C44 /* MachSendRight.cpp */, > ADF2CE651E39F106006889DB /* MemoryFootprintCocoa.cpp */, > AD89B6B91E64150F0090707F /* MemoryPressureHandlerCocoa.mm */, >@@ -1444,7 +1446,7 @@ > isa = PBXSourcesBuildPhase; > buildActionMask = 2147483647; > files = ( >- C805EF39E5F14481A96D39FC /* ASCIILiteral.cpp in Resources */, >+ C805EF39E5F14481A96D39FC /* ASCIILiteral.cpp in Sources */, > A8A47386151A825B004123FF /* Assertions.cpp in Sources */, > A8A47435151A825B004123FF /* AtomicString.cpp in Sources */, > 70ECA60D1B02426800449739 /* AtomicStringImpl.cpp in Sources */, >@@ -1480,7 +1482,7 @@ > A8A473AE151A825B004123FF /* diy-fp.cc in Sources */, > A8A473B0151A825B004123FF /* double-conversion.cc in Sources */, > A8A473BA151A825B004123FF /* dtoa.cpp in Sources */, >- 143DDE9620C8BC37007F76FA /* Entitlements.cpp in Sources */, >+ 143DDE9620C8BC37007F76FA /* Entitlements.mm in Sources */, > A8A473B3151A825B004123FF /* fast-dtoa.cc in Sources */, > 0F7C5FB61D885CF20044F5E2 /* FastBitVector.cpp in Sources */, > A8A473C3151A825B004123FF /* FastMalloc.cpp in Sources */, >diff --git a/Source/WTF/wtf/cocoa/Entitlements.cpp b/Source/WTF/wtf/cocoa/Entitlements.cpp >deleted file mode 100644 >index ecad951d01daff034bfb03f684c3c95456ba107d..0000000000000000000000000000000000000000 >--- a/Source/WTF/wtf/cocoa/Entitlements.cpp >+++ /dev/null >@@ -1,51 +0,0 @@ >-/* >- * Copyright (C) 2018 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. >- */ >- >-#include "config.h" >-#include "Entitlements.h" >- >-#include <wtf/RetainPtr.h> >-#include <wtf/spi/cocoa/SecuritySPI.h> >- >-namespace WTF { >- >-bool processHasEntitlement(const char* entitlement) >-{ >- auto task = adoptCF(SecTaskCreateFromSelf(kCFAllocatorDefault)); >- if (!task) >- return false; >- >- auto cfEntitlement = adoptCF(CFStringCreateWithCStringNoCopy(kCFAllocatorDefault, entitlement, kCFStringEncodingUTF8, kCFAllocatorNull)); >- auto value = adoptCF(SecTaskCopyValueForEntitlement(task.get(), cfEntitlement.get(), nullptr)); >- if (!value) >- return false; >- >- if (CFGetTypeID(value.get()) != CFBooleanGetTypeID()) >- return false; >- >- return CFBooleanGetValue(static_cast<CFBooleanRef>(value.get())); >-} >- >-} // namespace WTF >diff --git a/Source/WTF/wtf/cocoa/Entitlements.h b/Source/WTF/wtf/cocoa/Entitlements.h >index 46a9a2468abf8860634e3544cb89417bb541a2f8..06985ea3265b0657c491c773fbe5e399929e58b3 100644 >--- a/Source/WTF/wtf/cocoa/Entitlements.h >+++ b/Source/WTF/wtf/cocoa/Entitlements.h >@@ -25,8 +25,12 @@ > > #if PLATFORM(COCOA) > >+#include <wtf/spi/darwin/XPCSPI.h> >+ > namespace WTF { > >+WTF_EXPORT bool hasEntitlement(audit_token_t, const char* entitlement); >+WTF_EXPORT bool hasEntitlement(xpc_connection_t, const char* entitlement); > WTF_EXPORT bool processHasEntitlement(const char* entitlement); > > } // namespace WTF >diff --git a/Source/WTF/wtf/cocoa/Entitlements.mm b/Source/WTF/wtf/cocoa/Entitlements.mm >new file mode 100644 >index 0000000000000000000000000000000000000000..4813db829566215c2a2ff47ea200e617d93e2d27 >--- /dev/null >+++ b/Source/WTF/wtf/cocoa/Entitlements.mm >@@ -0,0 +1,60 @@ >+/* >+ * Copyright (C) 2018 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. >+ */ >+ >+#include "config.h" >+#include "Entitlements.h" >+ >+#include <wtf/OSObjectPtr.h> >+#include <wtf/RetainPtr.h> >+#include <wtf/spi/cocoa/SecuritySPI.h> >+ >+namespace WTF { >+ >+static bool hasEntitlement(SecTaskRef task, const char* entitlement) >+{ >+ if (!task) >+ return false; >+ auto string = adoptCF(CFStringCreateWithCStringNoCopy(kCFAllocatorDefault, entitlement, kCFStringEncodingASCII, kCFAllocatorNull)); >+ auto value = adoptCF(SecTaskCopyValueForEntitlement(task, string.get(), nullptr)); >+ return value && CFGetTypeID(value.get()) == CFBooleanGetTypeID() && CFBooleanGetValue(static_cast<CFBooleanRef>(value.get())); >+} >+ >+bool hasEntitlement(audit_token_t token, const char* entitlement) >+{ >+ return hasEntitlement(adoptCF(SecTaskCreateWithAuditToken(kCFAllocatorDefault, token)).get(), entitlement); >+} >+ >+bool hasEntitlement(xpc_connection_t connection, const char *entitlement) >+{ >+ auto value = adoptOSObject(xpc_connection_copy_entitlement_value(connection, entitlement)); >+ return value && xpc_get_type(value.get()) == XPC_TYPE_BOOL && xpc_bool_get_value(value.get()); >+} >+ >+bool processHasEntitlement(const char* entitlement) >+{ >+ return hasEntitlement(adoptCF(SecTaskCreateFromSelf(kCFAllocatorDefault)).get(), entitlement); >+} >+ >+} // namespace WTF >diff --git a/Source/WTF/wtf/spi/cocoa/CFXPCBridgeSPI.h b/Source/WTF/wtf/spi/cocoa/CFXPCBridgeSPI.h >new file mode 100644 >index 0000000000000000000000000000000000000000..d23abde1865a13c2cc49adf41e556213ad402a90 >--- /dev/null >+++ b/Source/WTF/wtf/spi/cocoa/CFXPCBridgeSPI.h >@@ -0,0 +1,37 @@ >+/* >+ * Copyright (C) 2018 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. ``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 >+ * 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. >+ */ >+ >+#pragma once >+ >+#if USE(APPLE_INTERNAL_SDK) >+#import <CoreFoundation/CFXPCBridge.h> >+#endif >+ >+WTF_EXTERN_C_BEGIN >+ >+xpc_object_t _CFXPCCreateXPCMessageWithCFObject(CFTypeRef); >+CFTypeRef _CFXPCCreateCFObjectFromXPCMessage(xpc_object_t); >+ >+WTF_EXTERN_C_END >diff --git a/Source/WebKit/Shared/EntryPointUtilities/mac/XPCService/XPCServiceEntryPoint.mm b/Source/WebKit/Shared/EntryPointUtilities/mac/XPCService/XPCServiceEntryPoint.mm >index 778c833d97d1d6efa264c9f6e232efd2ce324211..dd250884c1ca96b97c19486c82be3d1f694bcd8d 100644 >--- a/Source/WebKit/Shared/EntryPointUtilities/mac/XPCService/XPCServiceEntryPoint.mm >+++ b/Source/WebKit/Shared/EntryPointUtilities/mac/XPCService/XPCServiceEntryPoint.mm >@@ -29,6 +29,7 @@ > #import "SandboxUtilities.h" > #import "XPCServiceEntryPoint.h" > #import <WebCore/Process.h> >+#import <wtf/cocoa/Entitlements.h> > > using namespace WebCore; > >@@ -140,11 +141,7 @@ bool XPCServiceInitializerDelegate::getExtraInitializationData(HashMap<String, S > > bool XPCServiceInitializerDelegate::hasEntitlement(const char* entitlement) > { >- auto value = adoptOSObject(xpc_connection_copy_entitlement_value(m_connection.get(), entitlement)); >- if (!value) >- return false; >- >- return xpc_get_type(value.get()) == XPC_TYPE_BOOL && xpc_bool_get_value(value.get()); >+ return WTF::hasEntitlement(m_connection.get(), entitlement); > } > > bool XPCServiceInitializerDelegate::isClientSandboxed() >diff --git a/Source/WebKit/Shared/mac/SandboxUtilities.h b/Source/WebKit/Shared/mac/SandboxUtilities.h >index d60f427d6797873e32222b62b565302c95e636ab..c05d781d8306fe603c7e5dd0475ef6a0dab42af0 100644 >--- a/Source/WebKit/Shared/mac/SandboxUtilities.h >+++ b/Source/WebKit/Shared/mac/SandboxUtilities.h >@@ -38,6 +38,4 @@ bool processHasContainer(); > // Returns an empty string if the process is not in a container. > String pathForProcessContainer(); > >-bool connectedProcessHasEntitlement(xpc_connection_t, const char *entitlement); >- > } >diff --git a/Source/WebKit/Shared/mac/SandboxUtilities.mm b/Source/WebKit/Shared/mac/SandboxUtilities.mm >index afc6b24ae1d7e889eac073f6cd96d0422d6231bb..dc350fb4f25248deee65cba1f23954fb82e730cb 100644 >--- a/Source/WebKit/Shared/mac/SandboxUtilities.mm >+++ b/Source/WebKit/Shared/mac/SandboxUtilities.mm >@@ -29,7 +29,6 @@ > #import <array> > #import <sys/param.h> > #import <wtf/OSObjectPtr.h> >-#import <wtf/cocoa/Entitlements.h> > #import <wtf/spi/darwin/SandboxSPI.h> > #import <wtf/spi/darwin/XPCSPI.h> > #import <wtf/text/WTFString.h> >@@ -77,13 +76,4 @@ String pathForProcessContainer() > return String::fromUTF8(path.data()); > } > >-bool connectedProcessHasEntitlement(xpc_connection_t connection, const char *entitlement) >-{ >- auto value = adoptOSObject(xpc_connection_copy_entitlement_value(connection, entitlement)); >- if (!value) >- return false; >- >- return xpc_get_type(value.get()) == XPC_TYPE_BOOL && xpc_bool_get_value(value.get()); >-} >- > } >diff --git a/Source/WebKit/StorageProcess/ios/StorageProcessIOS.mm b/Source/WebKit/StorageProcess/ios/StorageProcessIOS.mm >index ece0c103dbc44bd1980abab83e2146a530f0e626..77119b38cb4d17b025a3beb3eb7a5f4f1998da82 100644 >--- a/Source/WebKit/StorageProcess/ios/StorageProcessIOS.mm >+++ b/Source/WebKit/StorageProcess/ios/StorageProcessIOS.mm >@@ -30,12 +30,7 @@ > #import "StorageProcess.h" > > #import "SandboxInitializationParameters.h" >-#import "SandboxUtilities.h" >-#import <WebCore/FileSystem.h> >-#import <WebCore/LocalizedStrings.h> >-#import <WebCore/NotImplemented.h> >- >-using namespace WebCore; >+#import <wtf/cocoa/Entitlements.h> > > #define ENABLE_MANUAL_DATABASE_SANDBOXING 0 > >@@ -61,7 +56,7 @@ void StorageProcess::initializeSandbox(const ChildProcessInitializationParameter > > bool StorageProcess::parentProcessHasServiceWorkerEntitlement() const > { >- static bool hasEntitlement = connectedProcessHasEntitlement(parentProcessConnection()->xpcConnection(), "com.apple.developer.WebKit.ServiceWorkers"); >+ static bool hasEntitlement = WTF::hasEntitlement(parentProcessConnection()->xpcConnection(), "com.apple.developer.WebKit.ServiceWorkers"); > return hasEntitlement; > } > >diff --git a/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm b/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm >index a795986aa9f9dc9005c4e87c216671bdc7086974..c2de7194a87205428d1eb05404bb5f6c5b69731a 100644 >--- a/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm >+++ b/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm >@@ -113,6 +113,7 @@ > #import <wtf/MemoryPressureHandler.h> > #import <wtf/SetForScope.h> > #import <wtf/SoftLinking.h> >+#import <wtf/cocoa/Entitlements.h> > #import <wtf/text/TextStream.h> > > #if ENABLE(MEDIA_STREAM) >@@ -399,7 +400,7 @@ bool WebPage::handleEditingKeyboardEvent(KeyboardEvent* event) > > bool WebPage::parentProcessHasServiceWorkerEntitlement() const > { >- static bool hasEntitlement = connectedProcessHasEntitlement(WebProcess::singleton().parentProcessConnection()->xpcConnection(), "com.apple.developer.WebKit.ServiceWorkers"); >+ static bool hasEntitlement = WTF::hasEntitlement(WebProcess::singleton().parentProcessConnection()->xpcConnection(), "com.apple.developer.WebKit.ServiceWorkers"); > return hasEntitlement; > } >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
mitz:
review+
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 186973
: 343440 |
343977
|
344027