Ignore:
Timestamp:
Sep 2, 2017, 9:42:51 PM (8 years ago)
Author:
[email protected]
Message:

Need an API to get the global context from JSObjectRef
https://bugs.webkit.org/show_bug.cgi?id=176291

Reviewed by Saam Barati.

Very simple additional API, starting off as SPI on principle.

  • API/JSObjectRef.cpp:

(JSObjectGetGlobalContext):

  • API/JSObjectRefPrivate.h:
  • API/tests/testapi.c:

(main):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/API/JSObjectRef.cpp

    r216460 r221546  
    692692    return toRef(result);
    693693}
     694
     695JSGlobalContextRef JSObjectGetGlobalContext(JSObjectRef objectRef)
     696{
     697    JSObject* object = toJS(objectRef);
     698    if (!object)
     699        return nullptr;
     700    return reinterpret_cast<JSGlobalContextRef>(object->globalObject()->globalExec());
     701}
     702
Note: See TracChangeset for help on using the changeset viewer.