Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com --- dlls/jscript/engine.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-)
diff --git a/dlls/jscript/engine.c b/dlls/jscript/engine.c index 4ff4297..bac855b 100644 --- a/dlls/jscript/engine.c +++ b/dlls/jscript/engine.c @@ -662,12 +662,27 @@ static BOOL lookup_global_members(script_ctx_t *ctx, BSTR identifier, exprval_t
LIST_FOR_EACH_ENTRY(item, &ctx->named_items, named_item_t, entry) { if(item->flags & SCRIPTITEM_GLOBALMEMBERS) { - hres = disp_get_id(ctx, item->disp, identifier, identifier, 0, &id); + IDispatch *disp = item->disp; + + IDispatch_AddRef(disp); + if(ret) { + jsval_t val = jsval_disp(disp); + + hres = convert_to_proxy(ctx, &val); + if(SUCCEEDED(hres)) + disp = get_object(val); + else + IDispatch_AddRef(disp); + } + + hres = disp_get_id(ctx, disp, identifier, identifier, 0, &id); if(SUCCEEDED(hres)) { if(ret) - exprval_set_disp_ref(ret, item->disp, id); + exprval_set_disp_ref(ret, disp, id); + IDispatch_Release(disp); return TRUE; } + IDispatch_Release(disp); } }
@@ -779,7 +794,7 @@ static HRESULT identifier_eval(script_ctx_t *ctx, BSTR identifier, exprval_t *re IDispatch_AddRef(item->disp); ret->type = EXPRVAL_JSVAL; ret->u.val = jsval_disp(item->disp); - return S_OK; + return convert_to_proxy(ctx, &ret->u.val); }
if(lookup_global_members(ctx, identifier, ret))