Changeset 221546 in webkit for trunk/Source/JavaScriptCore/API
- Timestamp:
- Sep 2, 2017, 9:42:51 PM (8 years ago)
- Location:
- trunk/Source/JavaScriptCore/API
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/API/JSObjectRef.cpp
r216460 r221546 692 692 return toRef(result); 693 693 } 694 695 JSGlobalContextRef 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 -
trunk/Source/JavaScriptCore/API/JSObjectRefPrivate.h
r216460 r221546 70 70 JS_EXPORT JSObjectRef JSObjectGetProxyTarget(JSObjectRef); 71 71 72 JS_EXPORT JSGlobalContextRef JSObjectGetGlobalContext(JSObjectRef object); 73 72 74 #ifdef __cplusplus 73 75 } -
trunk/Source/JavaScriptCore/API/tests/testapi.c
r220403 r221546 2041 2041 } 2042 2042 2043 // Check JSObjectGetGlobalContext 2044 { 2045 JSGlobalContextRef context = JSGlobalContextCreateInGroup(NULL, NULL); 2046 { 2047 JSObjectRef globalObject = JSContextGetGlobalObject(context); 2048 assertTrue(JSObjectGetGlobalContext(globalObject) == context, "global object context is correct"); 2049 JSObjectRef object = JSObjectMake(context, NULL, NULL); 2050 assertTrue(JSObjectGetGlobalContext(object) == context, "regular object context is correct"); 2051 JSStringRef returnFunctionSource = JSStringCreateWithUTF8CString("return this;"); 2052 JSObjectRef theFunction = JSObjectMakeFunction(context, NULL, 0, NULL, returnFunctionSource, NULL, 1, NULL); 2053 assertTrue(JSObjectGetGlobalContext(theFunction) == context, "function object context is correct"); 2054 assertTrue(JSObjectGetGlobalContext(NULL) == NULL, "NULL object context is NULL"); 2055 JSStringRelease(returnFunctionSource); 2056 } 2057 JSGlobalContextRelease(context); 2058 } 2043 2059 failed = testTypedArrayCAPI() || failed; 2044 2060 failed = testExecutionTimeLimit() || failed;
Note:
See TracChangeset
for help on using the changeset viewer.