AppleOpenSource/WebKit2-7609.3.5.1.3/WebProcess/InjectedBundle/API/glib/WebKitFrame.cpp
/**
 * webkit_frame_get_js_value_for_dom_object_in_script_world:
 * @frame: a #WebKitFrame
 * @dom_object: a #WebKitDOMObject
 * @world: a #WebKitScriptWorld
 *
 * Get a #JSCValue referencing the given DOM object. The value is created in the JavaScript execution
 * context of @frame for the given #WebKitScriptWorld.
 *
 * Returns: (transfer full): the #JSCValue referencing @dom_object
 *
 * Since: 2.22
 */


Get a #JSCValue referencing the given DOM object. The value is created in the JavaScript execution
context of @frame for the given #WebKitScriptWorld.




Get a #JSCValue referencing the given DOM object . The value is created in the JavaScript execution context of @frame for the given #WebKitScriptWorld .
JSCValue* webkit_frame_get_js_value_for_dom_object_in_script_world(WebKitFrame* frame, WebKitDOMObject* domObject, WebKitScriptWorld* world)
{
    g_return_val_if_fail(WEBKIT_IS_FRAME(frame), nullptr);
    g_return_val_if_fail(WEBKIT_DOM_IS_OBJECT(domObject), nullptr);
    g_return_val_if_fail(WEBKIT_IS_SCRIPT_WORLD(world), nullptr);
    auto* wkWorld = webkitScriptWorldGetInjectedBundleScriptWorld(world);
    auto jsContext = jscContextGetOrCreate(frame->priv->webFrame->jsContextForWorld(wkWorld));
    JSDOMWindow* globalObject = frame->priv->webFrame->coreFrame()->script().globalObject(wkWorld->coreWorld());
    JSValueRef jsValue = nullptr;
    {
        JSC::JSLockHolder lock(globalObject);
        if (WEBKIT_DOM_IS_NODE(domObject))
            jsValue = toRef(globalObject, toJS(globalObject, globalObject, WebKit::core(WEBKIT_DOM_NODE(domObject))));
    }
    return jsValue ? jscContextGetOrCreateValue(jsContext.get(), jsValue).leakRef() : nullptr;
}
JSCValue * webkit_frame_get_js_value_for_dom_object_in_script_world ( WebKitFrame * frame , WebKitDOMObject * domObject , WebKitScriptWorld * world ) { g_return_val_if_fail ( WEBKIT_IS_FRAME ( frame ) , nullptr ) ; g_return_val_if_fail ( WEBKIT_DOM_IS_OBJECT ( domObject ) , nullptr ) ; g_return_val_if_fail ( WEBKIT_IS_SCRIPT_WORLD ( world ) , nullptr ) ; auto * wkWorld = webkitScriptWorldGetInjectedBundleScriptWorld ( world ) ; auto jsContext = jscContextGetOrCreate ( frame -> priv -> webFrame -> jsContextForWorld ( wkWorld ) ) ; JSDOMWindow * globalObject = frame -> priv -> webFrame -> coreFrame ( ) -> script ( ) . globalObject ( wkWorld -> coreWorld ( ) ) ; JSValueRef jsValue = nullptr ; { JSC :: JSLockHolder lock ( globalObject ) ; if ( WEBKIT_DOM_IS_NODE ( domObject ) ) jsValue = toRef ( globalObject , toJS ( globalObject , globalObject , WebKit :: core ( WEBKIT_DOM_NODE ( domObject ) ) ) ) ; } return jsValue ? jscContextGetOrCreateValue ( jsContext . get ( ) , jsValue ) . leakRef ( ) : nullptr ; }
webkit_frame_get_js_value_for_dom_object_in_script_world:
 @frame: a #WebKitFrame
 @dom_object: a #WebKitDOMObject
 @world: a #WebKitScriptWorld
webkit_frame_get_js_value_for_dom_object_in_script_world : @frame : a #WebKitFrame @dom_object : a #WebKitDOMObject @world : a #WebKitScriptWorld