Ignore:
Timestamp:
Feb 6, 2014, 5:56:45 PM (11 years ago)
Author:
[email protected]
Message:

+[JSContext currentCallee] should return the currently executing JS function
https://bugs.webkit.org/show_bug.cgi?id=122621

Reviewed by Geoffrey Garen.

It would be useful if there was a +[JSContext currentObject] API which was
callable from ObjC API callbacks. Its purpose would be to allow convenient
access to the JSValue wrapper for the currently-executing block callback.

  • API/JSContext.h:
  • API/JSContext.mm:

(+[JSContext currentCallee]):
(-[JSContext beginCallbackWithData:calleeValue:thisValue:argumentCount:arguments:]):

  • API/JSContextInternal.h:
  • API/ObjCCallbackFunction.mm:

(JSC::objCCallbackFunctionCallAsFunction):
(JSC::objCCallbackFunctionCallAsConstructor):

  • API/tests/testapi.mm:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/API/ObjCCallbackFunction.mm

    r159351 r163590  
    465465    JSValueRef result;
    466466    @autoreleasepool {
    467         [context beginCallbackWithData:&callbackData thisValue:thisObject argumentCount:argumentCount arguments:arguments];
     467        [context beginCallbackWithData:&callbackData calleeValue:function thisValue:thisObject argumentCount:argumentCount arguments:arguments];
    468468        result = impl->call(context, thisObject, argumentCount, arguments, exception);
    469469        if (context.exception)
     
    485485    JSValueRef result;
    486486    @autoreleasepool {
    487         [context beginCallbackWithData:&callbackData thisValue:nil argumentCount:argumentCount arguments:arguments];
     487        [context beginCallbackWithData:&callbackData calleeValue:constructor thisValue:nil argumentCount:argumentCount arguments:arguments];
    488488        result = impl->call(context, NULL, argumentCount, arguments, exception);
    489489        if (context.exception)
Note: See TracChangeset for help on using the changeset viewer.