Skip to content
This repository was archived by the owner on Jun 24, 2022. It is now read-only.

Commit 76b4e1b

Browse files
[JSC API] We should support the symbol type in our C/Obj-C API
https://bugs.webkit.org/show_bug.cgi?id=175836 Reviewed by Filip Pizlo. This patch makes the following API additions: 1) Test if a JSValue/JSValueRef is a symbol via any of the methods API are able to test for the types of other JSValues. 2) Create a symbol on both APIs. 3) Get/Set/Delete/Define property now take ids in the Obj-C API. 4) Add Get/Set/Delete in the C API. We can do 3 because it is both binary and source compatable with the existing API. I added (4) because the current property access APIs only have the ability to get Strings. It was possible to merge symbols into JSStringRef but that felt confusing and exposes implementation details of our engine. The new functions match the same meaning that they have in JS, thus should be forward compatible with any future language extensions. Lastly, this patch adds the same availability preproccessing phase in WebCore to JavaScriptCore, which enables TBA features for testing on previous releases. * API/APICast.h: * API/JSBasePrivate.h: * API/JSContext.h: * API/JSContextPrivate.h: * API/JSContextRef.h: * API/JSContextRefInternal.h: * API/JSContextRefPrivate.h: * API/JSManagedValue.h: * API/JSObjectRef.cpp: (JSObjectHasPropertyKey): (JSObjectGetPropertyKey): (JSObjectSetPropertyKey): (JSObjectDeletePropertyKey): * API/JSObjectRef.h: * API/JSRemoteInspector.h: * API/JSTypedArray.h: * API/JSValue.h: * API/JSValue.mm: (+[JSValue valueWithNewSymbolFromDescription:inContext:]): (performPropertyOperation): (-[JSValue valueForProperty:valueForProperty:]): (-[JSValue setValue:forProperty:setValue:forProperty:]): (-[JSValue deleteProperty:deleteProperty:]): (-[JSValue hasProperty:hasProperty:]): (-[JSValue defineProperty:descriptor:defineProperty:descriptor:]): (-[JSValue isSymbol]): (-[JSValue objectForKeyedSubscript:]): (-[JSValue setObject:forKeyedSubscript:]): (-[JSValue valueForProperty:]): Deleted. (-[JSValue setValue:forProperty:]): Deleted. (-[JSValue deleteProperty:]): Deleted. (-[JSValue hasProperty:]): Deleted. (-[JSValue defineProperty:descriptor:]): Deleted. * API/JSValueRef.cpp: (JSValueGetType): (JSValueIsSymbol): (JSValueMakeSymbol): * API/JSValueRef.h: * API/WebKitAvailability.h: * API/tests/CurrentThisInsideBlockGetterTest.mm: * API/tests/CustomGlobalObjectClassTest.c: * API/tests/DateTests.mm: * API/tests/JSExportTests.mm: * API/tests/JSNode.c: * API/tests/JSNodeList.c: * API/tests/Node.c: * API/tests/NodeList.c: * API/tests/minidom.c: * API/tests/testapi.c: (main): * API/tests/testapi.cpp: Added. (APIString::APIString): (APIString::~APIString): (APIString::operator JSStringRef): (APIContext::APIContext): (APIContext::~APIContext): (APIContext::operator JSGlobalContextRef): (APIVector::APIVector): (APIVector::~APIVector): (APIVector::append): (testCAPIViaCpp): (TestAPI::evaluateScript): (TestAPI::callFunction): (TestAPI::functionReturnsTrue): (TestAPI::check): (TestAPI::checkJSAndAPIMatch): (TestAPI::interestingObjects): (TestAPI::interestingKeys): (TestAPI::run): * API/tests/testapi.mm: (testObjectiveCAPIMain): * JavaScriptCore.xcodeproj/project.pbxproj: * config.h: * postprocess-headers.sh: * shell/CMakeLists.txt: * testmem/testmem.mm: git-svn-id: http://svn.webkit.org/repository/webkit/trunk@234227 268f45cc-cd09-0410-ab3c-d52691b4dbfc
1 parent 6b73930 commit 76b4e1b

35 files changed

+1109
-164
lines changed

Source/JavaScriptCore/API/APICast.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
#include "JSCJSValue.h"
3131
#include "JSCJSValueInlines.h"
3232
#include "JSGlobalObject.h"
33+
#include "HeapCellInlines.h"
3334

3435
namespace JSC {
3536
class ExecState;

Source/JavaScriptCore/API/JSBasePrivate.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ owns a large non-GC memory region. Calling this function will encourage the
4343
garbage collector to collect soon, hoping to reclaim that large non-GC memory
4444
region.
4545
*/
46-
JS_EXPORT void JSReportExtraMemoryCost(JSContextRef ctx, size_t size) CF_AVAILABLE(10_6, 7_0);
46+
JS_EXPORT void JSReportExtraMemoryCost(JSContextRef ctx, size_t size) JSC_API_AVAILABLE(macosx(10.6), ios(7.0));
4747

4848
JS_EXPORT void JSDisableGCTimer(void);
4949

Source/JavaScriptCore/API/JSContext.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ NS_CLASS_AVAILABLE(10_9, 7_0)
7878
@param sourceURL A URL for the script's source file. Used by debuggers and when reporting exceptions. This parameter is informative only: it does not change the behavior of the script.
7979
@result The last value generated by the script.
8080
*/
81-
- (JSValue *)evaluateScript:(NSString *)script withSourceURL:(NSURL *)sourceURL NS_AVAILABLE(10_10, 8_0);
81+
- (JSValue *)evaluateScript:(NSString *)script withSourceURL:(NSURL *)sourceURL JSC_API_AVAILABLE(macosx(10.10), ios(8.0));
8282

8383
/*!
8484
@methodgroup Callback Accessors
@@ -101,7 +101,7 @@ NS_CLASS_AVAILABLE(10_9, 7_0)
101101
a callback from JavaScript this method will return nil.
102102
@result The currently executing JavaScript function or nil if there isn't one.
103103
*/
104-
+ (JSValue *)currentCallee NS_AVAILABLE(10_10, 8_0);
104+
+ (JSValue *)currentCallee JSC_API_AVAILABLE(macosx(10.10), ios(8.0));
105105

106106
/*!
107107
@method
@@ -176,7 +176,7 @@ NS_CLASS_AVAILABLE(10_9, 7_0)
176176
@property
177177
@discussion Name of the JSContext. Exposed when remote debugging the context.
178178
*/
179-
@property (copy) NSString *name NS_AVAILABLE(10_10, 8_0);
179+
@property (copy) NSString *name JSC_API_AVAILABLE(macosx(10.10), ios(8.0));
180180

181181
@end
182182

Source/JavaScriptCore/API/JSContextPrivate.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,19 +36,19 @@
3636
@property
3737
@discussion Remote inspection setting of the JSContext. Default value is YES.
3838
*/
39-
@property (setter=_setRemoteInspectionEnabled:) BOOL _remoteInspectionEnabled NS_AVAILABLE(10_10, 8_0);
39+
@property (setter=_setRemoteInspectionEnabled:) BOOL _remoteInspectionEnabled JSC_API_AVAILABLE(macosx(10.10), ios(8.0));
4040

4141
/*!
4242
@property
4343
@discussion Set whether or not the native call stack is included when reporting exceptions. Default value is YES.
4444
*/
45-
@property (setter=_setIncludesNativeCallStackWhenReportingExceptions:) BOOL _includesNativeCallStackWhenReportingExceptions NS_AVAILABLE(10_10, 8_0);
45+
@property (setter=_setIncludesNativeCallStackWhenReportingExceptions:) BOOL _includesNativeCallStackWhenReportingExceptions JSC_API_AVAILABLE(macosx(10.10), ios(8.0));
4646

4747
/*!
4848
@property
4949
@discussion Set the run loop the Web Inspector debugger should use when evaluating JavaScript in the JSContext.
5050
*/
51-
@property (setter=_setDebuggerRunLoop:) CFRunLoopRef _debuggerRunLoop NS_AVAILABLE(10_10, 8_0);
51+
@property (setter=_setDebuggerRunLoop:) CFRunLoopRef _debuggerRunLoop JSC_API_AVAILABLE(macosx(10.10), ios(8.0));
5252

5353
@end
5454

Source/JavaScriptCore/API/JSContextRef.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -53,22 +53,22 @@ extern "C" {
5353
JSContextGroup's run loop once it has been created.
5454
@result The created JSContextGroup.
5555
*/
56-
JS_EXPORT JSContextGroupRef JSContextGroupCreate(void) CF_AVAILABLE(10_6, 7_0);
56+
JS_EXPORT JSContextGroupRef JSContextGroupCreate(void) JSC_API_AVAILABLE(macosx(10.6), ios(7.0));
5757

5858
/*!
5959
@function
6060
@abstract Retains a JavaScript context group.
6161
@param group The JSContextGroup to retain.
6262
@result A JSContextGroup that is the same as group.
6363
*/
64-
JS_EXPORT JSContextGroupRef JSContextGroupRetain(JSContextGroupRef group) CF_AVAILABLE(10_6, 7_0);
64+
JS_EXPORT JSContextGroupRef JSContextGroupRetain(JSContextGroupRef group) JSC_API_AVAILABLE(macosx(10.6), ios(7.0));
6565

6666
/*!
6767
@function
6868
@abstract Releases a JavaScript context group.
6969
@param group The JSContextGroup to release.
7070
*/
71-
JS_EXPORT void JSContextGroupRelease(JSContextGroupRef group) CF_AVAILABLE(10_6, 7_0);
71+
JS_EXPORT void JSContextGroupRelease(JSContextGroupRef group) JSC_API_AVAILABLE(macosx(10.6), ios(7.0));
7272

7373
/*!
7474
@function
@@ -83,7 +83,7 @@ JS_EXPORT void JSContextGroupRelease(JSContextGroupRef group) CF_AVAILABLE(10_6,
8383
NULL to use the default object class.
8484
@result A JSGlobalContext with a global object of class globalObjectClass.
8585
*/
86-
JS_EXPORT JSGlobalContextRef JSGlobalContextCreate(JSClassRef globalObjectClass) CF_AVAILABLE(10_5, 7_0);
86+
JS_EXPORT JSGlobalContextRef JSGlobalContextCreate(JSClassRef globalObjectClass) JSC_API_AVAILABLE(macosx(10.5), ios(7.0));
8787

8888
/*!
8989
@function
@@ -97,7 +97,7 @@ JS_EXPORT JSGlobalContextRef JSGlobalContextCreate(JSClassRef globalObjectClass)
9797
@result A JSGlobalContext with a global object of class globalObjectClass and a context
9898
group equal to group.
9999
*/
100-
JS_EXPORT JSGlobalContextRef JSGlobalContextCreateInGroup(JSContextGroupRef group, JSClassRef globalObjectClass) CF_AVAILABLE(10_6, 7_0);
100+
JS_EXPORT JSGlobalContextRef JSGlobalContextCreateInGroup(JSContextGroupRef group, JSClassRef globalObjectClass) JSC_API_AVAILABLE(macosx(10.6), ios(7.0));
101101

102102
/*!
103103
@function
@@ -128,15 +128,15 @@ JS_EXPORT JSObjectRef JSContextGetGlobalObject(JSContextRef ctx);
128128
@param ctx The JSContext whose group you want to get.
129129
@result ctx's group.
130130
*/
131-
JS_EXPORT JSContextGroupRef JSContextGetGroup(JSContextRef ctx) CF_AVAILABLE(10_6, 7_0);
131+
JS_EXPORT JSContextGroupRef JSContextGetGroup(JSContextRef ctx) JSC_API_AVAILABLE(macosx(10.6), ios(7.0));
132132

133133
/*!
134134
@function
135135
@abstract Gets the global context of a JavaScript execution context.
136136
@param ctx The JSContext whose global context you want to get.
137137
@result ctx's global context.
138138
*/
139-
JS_EXPORT JSGlobalContextRef JSContextGetGlobalContext(JSContextRef ctx) CF_AVAILABLE(10_7, 7_0);
139+
JS_EXPORT JSGlobalContextRef JSContextGetGlobalContext(JSContextRef ctx) JSC_API_AVAILABLE(macosx(10.7), ios(7.0));
140140

141141
/*!
142142
@function
@@ -146,15 +146,15 @@ JS_EXPORT JSGlobalContextRef JSContextGetGlobalContext(JSContextRef ctx) CF_AVAI
146146
@discussion A JSGlobalContext's name is exposed for remote debugging to make it
147147
easier to identify the context you would like to attach to.
148148
*/
149-
JS_EXPORT JSStringRef JSGlobalContextCopyName(JSGlobalContextRef ctx) CF_AVAILABLE(10_10, 8_0);
149+
JS_EXPORT JSStringRef JSGlobalContextCopyName(JSGlobalContextRef ctx) JSC_API_AVAILABLE(macosx(10.10), ios(8.0));
150150

151151
/*!
152152
@function
153153
@abstract Sets the remote debugging name for a context.
154154
@param ctx The JSGlobalContext that you want to name.
155155
@param name The remote debugging name to set on ctx.
156156
*/
157-
JS_EXPORT void JSGlobalContextSetName(JSGlobalContextRef ctx, JSStringRef name) CF_AVAILABLE(10_10, 8_0);
157+
JS_EXPORT void JSGlobalContextSetName(JSGlobalContextRef ctx, JSStringRef name) JSC_API_AVAILABLE(macosx(10.10), ios(8.0));
158158

159159
#ifdef __cplusplus
160160
}

Source/JavaScriptCore/API/JSContextRefInternal.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,15 @@ extern "C" {
4242
@abstract Gets the run loop used by the Web Inspector debugger when evaluating JavaScript in this context.
4343
@param ctx The JSGlobalContext whose setting you want to get.
4444
*/
45-
JS_EXPORT CFRunLoopRef JSGlobalContextGetDebuggerRunLoop(JSGlobalContextRef ctx) CF_AVAILABLE(10_10, 8_0);
45+
JS_EXPORT CFRunLoopRef JSGlobalContextGetDebuggerRunLoop(JSGlobalContextRef ctx) JSC_API_AVAILABLE(macosx(10.10), ios(8.0));
4646

4747
/*!
4848
@function
4949
@abstract Sets the run loop used by the Web Inspector debugger when evaluating JavaScript in this context.
5050
@param ctx The JSGlobalContext that you want to change.
5151
@param runLoop The new value of the setting for the context.
5252
*/
53-
JS_EXPORT void JSGlobalContextSetDebuggerRunLoop(JSGlobalContextRef ctx, CFRunLoopRef runLoop) CF_AVAILABLE(10_10, 8_0);
53+
JS_EXPORT void JSGlobalContextSetDebuggerRunLoop(JSGlobalContextRef ctx, CFRunLoopRef runLoop) JSC_API_AVAILABLE(macosx(10.10), ios(8.0));
5454
#endif
5555

5656
#ifdef __cplusplus

Source/JavaScriptCore/API/JSContextRefPrivate.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ extern "C" {
4444
@param ctx The JSContext whose backtrace you want to get
4545
@result A string containing the backtrace
4646
*/
47-
JS_EXPORT JSStringRef JSContextCreateBacktrace(JSContextRef ctx, unsigned maxStackSize) CF_AVAILABLE(10_6, 7_0);
47+
JS_EXPORT JSStringRef JSContextCreateBacktrace(JSContextRef ctx, unsigned maxStackSize) JSC_API_AVAILABLE(macosx(10.6), ios(7.0));
4848

4949

5050
/*!
@@ -85,14 +85,14 @@ typedef bool
8585
need to call JSContextGroupSetExecutionTimeLimit before you start executing
8686
any scripts.
8787
*/
88-
JS_EXPORT void JSContextGroupSetExecutionTimeLimit(JSContextGroupRef group, double limit, JSShouldTerminateCallback callback, void* context) CF_AVAILABLE(10_6, 7_0);
88+
JS_EXPORT void JSContextGroupSetExecutionTimeLimit(JSContextGroupRef group, double limit, JSShouldTerminateCallback callback, void* context) JSC_API_AVAILABLE(macosx(10.6), ios(7.0));
8989

9090
/*!
9191
@function
9292
@abstract Clears the script execution time limit.
9393
@param group The JavaScript context group that the time limit is cleared on.
9494
*/
95-
JS_EXPORT void JSContextGroupClearExecutionTimeLimit(JSContextGroupRef group) CF_AVAILABLE(10_6, 7_0);
95+
JS_EXPORT void JSContextGroupClearExecutionTimeLimit(JSContextGroupRef group) JSC_API_AVAILABLE(macosx(10.6), ios(7.0));
9696

9797
/*!
9898
@function
@@ -101,15 +101,15 @@ JS_EXPORT void JSContextGroupClearExecutionTimeLimit(JSContextGroupRef group) CF
101101
@result The value of the setting, true if remote inspection is enabled, otherwise false.
102102
@discussion Remote inspection is true by default.
103103
*/
104-
JS_EXPORT bool JSGlobalContextGetRemoteInspectionEnabled(JSGlobalContextRef ctx) CF_AVAILABLE(10_10, 8_0);
104+
JS_EXPORT bool JSGlobalContextGetRemoteInspectionEnabled(JSGlobalContextRef ctx) JSC_API_AVAILABLE(macosx(10.10), ios(8.0));
105105

106106
/*!
107107
@function
108108
@abstract Sets the remote inspection setting for a context.
109109
@param ctx The JSGlobalContext that you want to change.
110110
@param enabled The new remote inspection enabled setting for the context.
111111
*/
112-
JS_EXPORT void JSGlobalContextSetRemoteInspectionEnabled(JSGlobalContextRef ctx, bool enabled) CF_AVAILABLE(10_10, 8_0);
112+
JS_EXPORT void JSGlobalContextSetRemoteInspectionEnabled(JSGlobalContextRef ctx, bool enabled) JSC_API_AVAILABLE(macosx(10.10), ios(8.0));
113113

114114
/*!
115115
@function
@@ -118,15 +118,15 @@ JS_EXPORT void JSGlobalContextSetRemoteInspectionEnabled(JSGlobalContextRef ctx,
118118
@result The value of the setting, true if remote inspection is enabled, otherwise false.
119119
@discussion This setting is true by default.
120120
*/
121-
JS_EXPORT bool JSGlobalContextGetIncludesNativeCallStackWhenReportingExceptions(JSGlobalContextRef ctx) CF_AVAILABLE(10_10, 8_0);
121+
JS_EXPORT bool JSGlobalContextGetIncludesNativeCallStackWhenReportingExceptions(JSGlobalContextRef ctx) JSC_API_AVAILABLE(macosx(10.10), ios(8.0));
122122

123123
/*!
124124
@function
125125
@abstract Sets the include native call stack when reporting exceptions setting for a context.
126126
@param ctx The JSGlobalContext that you want to change.
127127
@param includesNativeCallStack The new value of the setting for the context.
128128
*/
129-
JS_EXPORT void JSGlobalContextSetIncludesNativeCallStackWhenReportingExceptions(JSGlobalContextRef ctx, bool includesNativeCallStack) CF_AVAILABLE(10_10, 8_0);
129+
JS_EXPORT void JSGlobalContextSetIncludesNativeCallStackWhenReportingExceptions(JSGlobalContextRef ctx, bool includesNativeCallStack) JSC_API_AVAILABLE(macosx(10.10), ios(8.0));
130130

131131
#ifdef __cplusplus
132132
}

Source/JavaScriptCore/API/JSManagedValue.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ NS_CLASS_AVAILABLE(10_9, 7_0)
5757
@result The new JSManagedValue.
5858
*/
5959
+ (JSManagedValue *)managedValueWithValue:(JSValue *)value;
60-
+ (JSManagedValue *)managedValueWithValue:(JSValue *)value andOwner:(id)owner NS_AVAILABLE(10_10, 8_0);
60+
+ (JSManagedValue *)managedValueWithValue:(JSValue *)value andOwner:(id)owner JSC_API_AVAILABLE(macosx(10.10), ios(8.0));
6161

6262
/*!
6363
@method

Source/JavaScriptCore/API/JSObjectRef.cpp

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,100 @@ void JSObjectSetProperty(JSContextRef ctx, JSObjectRef object, JSStringRef prope
366366
handleExceptionIfNeeded(scope, exec, exception);
367367
}
368368

369+
bool JSObjectHasPropertyKey(JSContextRef ctx, JSObjectRef object, JSValueRef key, JSValueRef* exception)
370+
{
371+
if (!ctx) {
372+
ASSERT_NOT_REACHED();
373+
return false;
374+
}
375+
ExecState* exec = toJS(ctx);
376+
VM& vm = exec->vm();
377+
JSLockHolder locker(vm);
378+
auto scope = DECLARE_CATCH_SCOPE(vm);
379+
380+
JSObject* jsObject = toJS(object);
381+
Identifier ident = toJS(exec, key).toPropertyKey(exec);
382+
if (handleExceptionIfNeeded(scope, exec, exception) == ExceptionStatus::DidThrow)
383+
return false;
384+
385+
bool result = jsObject->hasProperty(exec, ident);
386+
handleExceptionIfNeeded(scope, exec, exception);
387+
return result;
388+
}
389+
390+
JSValueRef JSObjectGetPropertyKey(JSContextRef ctx, JSObjectRef object, JSValueRef key, JSValueRef* exception)
391+
{
392+
if (!ctx) {
393+
ASSERT_NOT_REACHED();
394+
return nullptr;
395+
}
396+
ExecState* exec = toJS(ctx);
397+
VM& vm = exec->vm();
398+
JSLockHolder locker(vm);
399+
auto scope = DECLARE_CATCH_SCOPE(vm);
400+
401+
JSObject* jsObject = toJS(object);
402+
Identifier ident = toJS(exec, key).toPropertyKey(exec);
403+
if (handleExceptionIfNeeded(scope, exec, exception) == ExceptionStatus::DidThrow)
404+
return nullptr;
405+
406+
JSValue jsValue = jsObject->get(exec, ident);
407+
handleExceptionIfNeeded(scope, exec, exception);
408+
return toRef(exec, jsValue);
409+
}
410+
411+
void JSObjectSetPropertyKey(JSContextRef ctx, JSObjectRef object, JSValueRef key, JSValueRef value, JSPropertyAttributes attributes, JSValueRef* exception)
412+
{
413+
if (!ctx) {
414+
ASSERT_NOT_REACHED();
415+
return;
416+
}
417+
ExecState* exec = toJS(ctx);
418+
VM& vm = exec->vm();
419+
JSLockHolder locker(vm);
420+
auto scope = DECLARE_CATCH_SCOPE(vm);
421+
422+
JSObject* jsObject = toJS(object);
423+
JSValue jsValue = toJS(exec, value);
424+
425+
Identifier ident = toJS(exec, key).toPropertyKey(exec);
426+
if (handleExceptionIfNeeded(scope, exec, exception) == ExceptionStatus::DidThrow)
427+
return;
428+
429+
bool doesNotHaveProperty = attributes && !jsObject->hasProperty(exec, ident);
430+
if (LIKELY(!scope.exception())) {
431+
if (doesNotHaveProperty) {
432+
PropertyDescriptor desc(jsValue, attributes);
433+
jsObject->methodTable(vm)->defineOwnProperty(jsObject, exec, ident, desc, false);
434+
} else {
435+
PutPropertySlot slot(jsObject);
436+
jsObject->methodTable(vm)->put(jsObject, exec, ident, jsValue, slot);
437+
}
438+
}
439+
handleExceptionIfNeeded(scope, exec, exception);
440+
}
441+
442+
bool JSObjectDeletePropertyKey(JSContextRef ctx, JSObjectRef object, JSValueRef key, JSValueRef* exception)
443+
{
444+
if (!ctx) {
445+
ASSERT_NOT_REACHED();
446+
return false;
447+
}
448+
ExecState* exec = toJS(ctx);
449+
VM& vm = exec->vm();
450+
JSLockHolder locker(vm);
451+
auto scope = DECLARE_CATCH_SCOPE(vm);
452+
453+
JSObject* jsObject = toJS(object);
454+
Identifier ident = toJS(exec, key).toPropertyKey(exec);
455+
if (handleExceptionIfNeeded(scope, exec, exception) == ExceptionStatus::DidThrow)
456+
return false;
457+
458+
bool result = jsObject->methodTable(vm)->deleteProperty(jsObject, exec, ident);
459+
handleExceptionIfNeeded(scope, exec, exception);
460+
return result;
461+
}
462+
369463
JSValueRef JSObjectGetPropertyAtIndex(JSContextRef ctx, JSObjectRef object, unsigned propertyIndex, JSValueRef* exception)
370464
{
371465
if (!ctx) {

0 commit comments

Comments
 (0)