WebKit Bugzilla
Attachment 346068 Details for
Bug 188173
: Rename some JSC API functions/types.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-188173-20180730103438.patch (text/plain), 17.67 KB, created by
Keith Miller
on 2018-07-30 10:34:40 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Keith Miller
Created:
2018-07-30 10:34:40 PDT
Size:
17.67 KB
patch
obsolete
>Subversion Revision: 234371 >diff --git a/Source/JavaScriptCore/ChangeLog b/Source/JavaScriptCore/ChangeLog >index c9ffa59ac12c5b4b5cc33a7f72b7b0e52bf7a4af..b8a80cf04211f109df9c865718bff142ac3642e2 100644 >--- a/Source/JavaScriptCore/ChangeLog >+++ b/Source/JavaScriptCore/ChangeLog >@@ -1,3 +1,30 @@ >+2018-07-30 Keith Miller <keith_miller@apple.com> >+ >+ Rename some JSC API functions/types. >+ https://bugs.webkit.org/show_bug.cgi?id=188173 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * API/JSObjectRef.cpp: >+ (JSObjectHasPropertyForKey): >+ (JSObjectGetPropertyForKey): >+ (JSObjectSetPropertyForKey): >+ (JSObjectDeletePropertyForKey): >+ (JSObjectHasPropertyKey): Deleted. >+ (JSObjectGetPropertyKey): Deleted. >+ (JSObjectSetPropertyKey): Deleted. >+ (JSObjectDeletePropertyKey): Deleted. >+ * API/JSObjectRef.h: >+ * API/JSValue.h: >+ * API/JSValue.mm: >+ (-[JSValue valueForProperty:]): >+ (-[JSValue setValue:forProperty:]): >+ (-[JSValue deleteProperty:]): >+ (-[JSValue hasProperty:]): >+ (-[JSValue defineProperty:descriptor:]): >+ * API/tests/testapi.cpp: >+ (TestAPI::run): >+ > 2018-07-30 Mark Lam <mark.lam@apple.com> > > Add a debugging utility to dump the memory layout of a JSCell. >diff --git a/Source/JavaScriptCore/API/JSObjectRef.cpp b/Source/JavaScriptCore/API/JSObjectRef.cpp >index 5451a2f9a561347a92581d5f3e442462969d40ff..694d185fd50850250c27b014742940875e4dd2f6 100644 >--- a/Source/JavaScriptCore/API/JSObjectRef.cpp >+++ b/Source/JavaScriptCore/API/JSObjectRef.cpp >@@ -366,7 +366,7 @@ void JSObjectSetProperty(JSContextRef ctx, JSObjectRef object, JSStringRef prope > handleExceptionIfNeeded(scope, exec, exception); > } > >-bool JSObjectHasPropertyKey(JSContextRef ctx, JSObjectRef object, JSValueRef key, JSValueRef* exception) >+bool JSObjectHasPropertyForKey(JSContextRef ctx, JSObjectRef object, JSValueRef key, JSValueRef* exception) > { > if (!ctx) { > ASSERT_NOT_REACHED(); >@@ -387,7 +387,7 @@ bool JSObjectHasPropertyKey(JSContextRef ctx, JSObjectRef object, JSValueRef key > return result; > } > >-JSValueRef JSObjectGetPropertyKey(JSContextRef ctx, JSObjectRef object, JSValueRef key, JSValueRef* exception) >+JSValueRef JSObjectGetPropertyForKey(JSContextRef ctx, JSObjectRef object, JSValueRef key, JSValueRef* exception) > { > if (!ctx) { > ASSERT_NOT_REACHED(); >@@ -408,7 +408,7 @@ JSValueRef JSObjectGetPropertyKey(JSContextRef ctx, JSObjectRef object, JSValueR > return toRef(exec, jsValue); > } > >-void JSObjectSetPropertyKey(JSContextRef ctx, JSObjectRef object, JSValueRef key, JSValueRef value, JSPropertyAttributes attributes, JSValueRef* exception) >+void JSObjectSetPropertyForKey(JSContextRef ctx, JSObjectRef object, JSValueRef key, JSValueRef value, JSPropertyAttributes attributes, JSValueRef* exception) > { > if (!ctx) { > ASSERT_NOT_REACHED(); >@@ -439,7 +439,7 @@ void JSObjectSetPropertyKey(JSContextRef ctx, JSObjectRef object, JSValueRef key > handleExceptionIfNeeded(scope, exec, exception); > } > >-bool JSObjectDeletePropertyKey(JSContextRef ctx, JSObjectRef object, JSValueRef key, JSValueRef* exception) >+bool JSObjectDeletePropertyForKey(JSContextRef ctx, JSObjectRef object, JSValueRef key, JSValueRef* exception) > { > if (!ctx) { > ASSERT_NOT_REACHED(); >diff --git a/Source/JavaScriptCore/API/JSObjectRef.h b/Source/JavaScriptCore/API/JSObjectRef.h >index db5569a6cbd0ee0b7bcbfcc3e292f532975e676e..973abc3c4d819641fac9096ceb6b813848d87852 100644 >--- a/Source/JavaScriptCore/API/JSObjectRef.h >+++ b/Source/JavaScriptCore/API/JSObjectRef.h >@@ -562,7 +562,7 @@ JS_EXPORT bool JSObjectDeleteProperty(JSContextRef ctx, JSObjectRef object, JSSt > @result true if the object has a property whose name matches propertyKey, otherwise false. > @discussion This function is the same as performing "propertyKey in object" from JavaScript. > */ >-JS_EXPORT bool JSObjectHasPropertyKey(JSContextRef ctx, JSObjectRef object, JSValueRef propertyKey, JSValueRef* exception) JSC_API_AVAILABLE(macosx(JSC_MAC_TBA), ios(JSC_IOS_TBA)); >+JS_EXPORT bool JSObjectHasPropertyForKey(JSContextRef ctx, JSObjectRef object, JSValueRef propertyKey, JSValueRef* exception) JSC_API_AVAILABLE(macosx(JSC_MAC_TBA), ios(JSC_IOS_TBA)); > > /*! > @function >@@ -574,7 +574,7 @@ JS_EXPORT bool JSObjectHasPropertyKey(JSContextRef ctx, JSObjectRef object, JSVa > @result The property's value if object has the property key, otherwise the undefined value. > @discussion This function is the same as performing "object[propertyKey]" from JavaScript. > */ >-JS_EXPORT JSValueRef JSObjectGetPropertyKey(JSContextRef ctx, JSObjectRef object, JSValueRef propertyKey, JSValueRef* exception) JSC_API_AVAILABLE(macosx(JSC_MAC_TBA), ios(JSC_IOS_TBA)); >+JS_EXPORT JSValueRef JSObjectGetPropertyForKey(JSContextRef ctx, JSObjectRef object, JSValueRef propertyKey, JSValueRef* exception) JSC_API_AVAILABLE(macosx(JSC_MAC_TBA), ios(JSC_IOS_TBA)); > > /*! > @function >@@ -587,7 +587,7 @@ JS_EXPORT JSValueRef JSObjectGetPropertyKey(JSContextRef ctx, JSObjectRef object > @param exception A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception. > @discussion This function is the same as performing "object[propertyKey] = value" from JavaScript. > */ >-JS_EXPORT void JSObjectSetPropertyKey(JSContextRef ctx, JSObjectRef object, JSValueRef propertyKey, JSValueRef value, JSPropertyAttributes attributes, JSValueRef* exception) JSC_API_AVAILABLE(macosx(JSC_MAC_TBA), ios(JSC_IOS_TBA)); >+JS_EXPORT void JSObjectSetPropertyForKey(JSContextRef ctx, JSObjectRef object, JSValueRef propertyKey, JSValueRef value, JSPropertyAttributes attributes, JSValueRef* exception) JSC_API_AVAILABLE(macosx(JSC_MAC_TBA), ios(JSC_IOS_TBA)); > > /*! > @function >@@ -599,7 +599,7 @@ JS_EXPORT void JSObjectSetPropertyKey(JSContextRef ctx, JSObjectRef object, JSVa > @result true if the delete operation succeeds, otherwise false (for example, if the property has the kJSPropertyAttributeDontDelete attribute set). > @discussion This function is the same as performing "delete object[propertyKey]" from JavaScript. > */ >-JS_EXPORT bool JSObjectDeletePropertyKey(JSContextRef ctx, JSObjectRef object, JSValueRef propertyKey, JSValueRef* exception) JSC_API_AVAILABLE(macosx(JSC_MAC_TBA), ios(JSC_IOS_TBA)); >+JS_EXPORT bool JSObjectDeletePropertyForKey(JSContextRef ctx, JSObjectRef object, JSValueRef propertyKey, JSValueRef* exception) JSC_API_AVAILABLE(macosx(JSC_MAC_TBA), ios(JSC_IOS_TBA)); > > /*! > @function >diff --git a/Source/JavaScriptCore/API/JSValue.h b/Source/JavaScriptCore/API/JSValue.h >index 024ebb0a7550b3ece694404127adcc3e6cc97dfa..2c203fb173c826b46b4751fee7740c5a4dc6e88f 100644 >--- a/Source/JavaScriptCore/API/JSValue.h >+++ b/Source/JavaScriptCore/API/JSValue.h >@@ -48,9 +48,9 @@ NS_CLASS_AVAILABLE(10_9, 7_0) > @interface JSValue : NSObject > > #if (defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED < JSC_MAC_VERSION_TBA) || (defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && __IPHONE_OS_VERSION_MIN_REQUIRED < JSC_IOS_VERSION_TBA) >-typedef NSString *JSValuePropertyKeyType; >+typedef NSString *JSValueProperty; > #else >-typedef id JSValuePropertyKeyType; >+typedef id JSValueProperty; > #endif > > /*! >@@ -328,14 +328,14 @@ typedef id JSValuePropertyKeyType; > if the property does not exist. > @discussion Corresponds to the JavaScript operation <code>object[property]</code>. Pass an NSString * to access a named property. Other valid properties include symbols, numbers, and stringifiable objects. In macOS 10.13 and iOS 11 and below, 'property' was an NSString *. > */ >-- (JSValue *)valueForProperty:(JSValuePropertyKeyType)property; >+- (JSValue *)valueForProperty:(JSValueProperty)property; > > /*! > @method > @abstract Set a property on a JSValue. > @discussion Corresponds to the JavaScript operation <code>object[property] = value</code>. Pass an NSString * to access a named property. Other valid properties include symbols, numbers, and stringifiable objects. In macOS 10.13 and iOS 11 and below, 'property' was an NSString *. > */ >-- (void)setValue:(id)value forProperty:(JSValuePropertyKeyType)property; >+- (void)setValue:(id)value forProperty:(JSValueProperty)property; > > /*! > @method >@@ -343,7 +343,7 @@ typedef id JSValuePropertyKeyType; > @result YES if deletion is successful, NO otherwise. > @discussion Corresponds to the JavaScript operation <code>delete object[property]</code>. Pass an NSString * to access a named property. Other valid properties include symbols, numbers, and stringifiable objects. In macOS 10.13 and iOS 11 and below, 'property' was an NSString *. > */ >-- (BOOL)deleteProperty:(JSValuePropertyKeyType)property; >+- (BOOL)deleteProperty:(JSValueProperty)property; > > /*! > @method >@@ -352,7 +352,7 @@ typedef id JSValuePropertyKeyType; > @result Returns YES if property is present on the value. > @discussion Corresponds to the JavaScript operation <code>property in object</code>. Pass an NSString * to access a named property. Other valid properties include symbols, numbers, and stringifiable objects. In macOS 10.13 and iOS 11 and below, 'property' was an NSString *. > */ >-- (BOOL)hasProperty:(JSValuePropertyKeyType)property; >+- (BOOL)hasProperty:(JSValueProperty)property; > > /*! > @method >@@ -361,7 +361,7 @@ typedef id JSValuePropertyKeyType; > This method operates in accordance with the Object.defineProperty method in the > JavaScript language. Pass an NSString * to access a named property. Other valid properties include symbols, numbers, and stringifiable objects. In macOS 10.13 and iOS 11 and below, 'property' was an NSString *. > */ >-- (void)defineProperty:(JSValuePropertyKeyType)property descriptor:(id)descriptor; >+- (void)defineProperty:(JSValueProperty)property descriptor:(id)descriptor; > > /*! > @method >@@ -602,9 +602,9 @@ Create a JSValue from a CGRect. > */ > @interface JSValue (SubscriptSupport) > >-- (JSValue *)objectForKeyedSubscript:(JSValuePropertyKeyType)key; >+- (JSValue *)objectForKeyedSubscript:(JSValueProperty)key; > - (JSValue *)objectAtIndexedSubscript:(NSUInteger)index; >-- (void)setObject:(id)object forKeyedSubscript:(JSValuePropertyKeyType)key; >+- (void)setObject:(id)object forKeyedSubscript:(JSValueProperty)key; > - (void)setObject:(id)object atIndexedSubscript:(NSUInteger)index; > > @end >diff --git a/Source/JavaScriptCore/API/JSValue.mm b/Source/JavaScriptCore/API/JSValue.mm >index 3ff5c476d68902c264669a97bf282850465e97b8..543531ba4b8bf6280e63210f9e76c10afe7ccbb8 100644 >--- a/Source/JavaScriptCore/API/JSValue.mm >+++ b/Source/JavaScriptCore/API/JSValue.mm >@@ -264,7 +264,7 @@ inline Expected<Result, JSValueRef> performPropertyOperation(NSStringFunction st > > - (JSValue *)valueForProperty:(id)key > { >- auto result = performPropertyOperation<JSValueRef>(JSObjectGetProperty, JSObjectGetPropertyKey, self, key); >+ auto result = performPropertyOperation<JSValueRef>(JSObjectGetProperty, JSObjectGetPropertyForKey, self, key); > if (!result) > return [_context valueFromNotifyException:result.error()]; > >@@ -272,7 +272,7 @@ inline Expected<Result, JSValueRef> performPropertyOperation(NSStringFunction st > } > > >-- (void)setValue:(id)value forProperty:(JSValuePropertyKeyType)key >+- (void)setValue:(id)value forProperty:(JSValueProperty)key > { > // We need Unit business because void can't be assigned to in performPropertyOperation and I don't want to duplicate the code... > using Unit = std::tuple<>; >@@ -282,7 +282,7 @@ inline Expected<Result, JSValueRef> performPropertyOperation(NSStringFunction st > }; > > auto jsValueSetProperty = [] (auto... args) -> Unit { >- JSObjectSetPropertyKey(args...); >+ JSObjectSetPropertyForKey(args...); > return { }; > }; > >@@ -293,28 +293,28 @@ inline Expected<Result, JSValueRef> performPropertyOperation(NSStringFunction st > } > } > >-- (BOOL)deleteProperty:(JSValuePropertyKeyType)key >+- (BOOL)deleteProperty:(JSValueProperty)key > { >- Expected<BOOL, JSValueRef> result = performPropertyOperation<BOOL>(JSObjectDeleteProperty, JSObjectDeletePropertyKey, self, key); >+ Expected<BOOL, JSValueRef> result = performPropertyOperation<BOOL>(JSObjectDeleteProperty, JSObjectDeletePropertyForKey, self, key); > if (!result) > return [_context boolFromNotifyException:result.error()]; > return result.value(); > } > >-- (BOOL)hasProperty:(JSValuePropertyKeyType)key >+- (BOOL)hasProperty:(JSValueProperty)key > { > // The C-api doesn't return an exception value for the string version of has property. > auto stringHasProperty = [] (JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef*) -> BOOL { > return JSObjectHasProperty(ctx, object, propertyName); > }; > >- Expected<BOOL, JSValueRef> result = performPropertyOperation<BOOL>(stringHasProperty, JSObjectHasPropertyKey, self, key); >+ Expected<BOOL, JSValueRef> result = performPropertyOperation<BOOL>(stringHasProperty, JSObjectHasPropertyForKey, self, key); > if (!result) > return [_context boolFromNotifyException:result.error()]; > return result.value(); > } > >-- (void)defineProperty:(JSValuePropertyKeyType)key descriptor:(id)descriptor >+- (void)defineProperty:(JSValueProperty)key descriptor:(id)descriptor > { > [[_context globalObject][@"Object"] invokeMethod:@"defineProperty" withArguments:@[ self, key, descriptor ]]; > } >diff --git a/Source/JavaScriptCore/API/tests/testapi.cpp b/Source/JavaScriptCore/API/tests/testapi.cpp >index 45c36f89ec2cefe51e7db59c38571a5803263286..8a5777c53d5d2669d6714d7fb514a2c0876d6ae5 100644 >--- a/Source/JavaScriptCore/API/tests/testapi.cpp >+++ b/Source/JavaScriptCore/API/tests/testapi.cpp >@@ -293,7 +293,7 @@ int TestAPI::run() > [&] { > return callFunction(getFunction, object, key); > }, [&] (JSValueRef* exception) { >- return JSObjectGetPropertyKey(context, object, key, exception); >+ return JSObjectGetPropertyForKey(context, object, key, exception); > }, "checking get property keys"); > } > } >@@ -313,7 +313,7 @@ int TestAPI::run() > [&] { > return callFunction(setFunction, jsObject, key, theAnswer); > } , [&] (JSValueRef* exception) { >- JSObjectSetPropertyKey(context, apiObject, key, theAnswer, kJSPropertyAttributeNone, exception); >+ JSObjectSetPropertyForKey(context, apiObject, key, theAnswer, kJSPropertyAttributeNone, exception); > return JSValueMakeUndefined(context); > }, "setting property keys to the answer"); > // Check get is the same on API object. >@@ -321,14 +321,14 @@ int TestAPI::run() > [&] { > return callFunction(getFunction, apiObject, key); > }, [&] (JSValueRef* exception) { >- return JSObjectGetPropertyKey(context, apiObject, key, exception); >+ return JSObjectGetPropertyForKey(context, apiObject, key, exception); > }, "getting property keys from API objects"); > // Check get is the same on respective objects. > checkJSAndAPIMatch( > [&] { > return callFunction(getFunction, jsObject, key); > }, [&] (JSValueRef* exception) { >- return JSObjectGetPropertyKey(context, apiObject, key, exception); >+ return JSObjectGetPropertyForKey(context, apiObject, key, exception); > }, "getting property keys from respective objects"); > } > } >@@ -347,7 +347,7 @@ int TestAPI::run() > [&] { > return callFunction(hasFunction, object, key); > }, [&] (JSValueRef* exception) { >- return JSValueMakeBoolean(context, JSObjectHasPropertyKey(context, object, key, exception)); >+ return JSValueMakeBoolean(context, JSObjectHasPropertyForKey(context, object, key, exception)); > }, "checking has property keys unset"); > > check(!!callFunction(setFunction, object, key, theAnswer), "set property to the answer"); >@@ -356,7 +356,7 @@ int TestAPI::run() > [&] { > return callFunction(hasFunction, object, key); > }, [&] (JSValueRef* exception) { >- return JSValueMakeBoolean(context, JSObjectHasPropertyKey(context, object, key, exception)); >+ return JSValueMakeBoolean(context, JSObjectHasPropertyForKey(context, object, key, exception)); > }, "checking has property keys set"); > } > } >@@ -375,7 +375,7 @@ int TestAPI::run() > [&] { > return callFunction(deleteFunction, object, key); > }, [&] (JSValueRef* exception) { >- return JSValueMakeBoolean(context, JSObjectDeletePropertyKey(context, object, key, exception)); >+ return JSValueMakeBoolean(context, JSObjectDeletePropertyForKey(context, object, key, exception)); > }, "checking has property keys unset"); > > check(!!callFunction(setFunction, object, key, theAnswer), "set property to the answer"); >@@ -384,7 +384,7 @@ int TestAPI::run() > [&] { > return callFunction(deleteFunction, object, key); > }, [&] (JSValueRef* exception) { >- return JSValueMakeBoolean(context, JSObjectDeletePropertyKey(context, object, key, exception)); >+ return JSValueMakeBoolean(context, JSObjectDeletePropertyForKey(context, object, key, exception)); > }, "checking has property keys set"); > } > }
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
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 188173
: 346068