jscript: Added SCRIPTITEM_ISVISIBLE flag implementation.

This commit is contained in:
Jacek Caban 2008-11-05 01:03:38 +01:00 committed by Alexandre Julliard
parent 73658a8bc0
commit 1b51a43a7c
4 changed files with 21 additions and 0 deletions

View File

@ -457,6 +457,16 @@ static HRESULT identifier_eval(exec_ctx_t *ctx, BSTR identifier, DWORD flags, ex
return S_OK;
}
for(item = ctx->parser->script->named_items; item; item = item->next) {
if((item->flags & SCRIPTITEM_ISVISIBLE) && !strcmpW(item->name, identifier)) {
ret->type = EXPRVAL_VARIANT;
V_VT(&ret->u.var) = VT_DISPATCH;
V_DISPATCH(&ret->u.var) = item->disp;
IDispatch_AddRef(item->disp);
return S_OK;
}
}
for(item = ctx->parser->script->named_items; item; item = item->next) {
hres = disp_get_id(item->disp, identifier, 0, &id);
if(SUCCEEDED(hres))

View File

@ -326,6 +326,7 @@ static HRESULT WINAPI JScript_Close(IActiveScript *iface)
iter2 = iter->next;
IDispatch_Release(iter->disp);
heap_free(iter->name);
heap_free(iter);
iter = iter2;
}
@ -390,6 +391,13 @@ static HRESULT WINAPI JScript_AddNamedItem(IActiveScript *iface,
item->disp = disp;
item->flags = dwFlags;
item->name = heap_strdupW(pstrName);
if(!item->name) {
IDispatch_Release(disp);
heap_free(item);
return E_OUTOFMEMORY;
}
item->next = This->ctx->named_items;
This->ctx->named_items = item;

View File

@ -154,6 +154,7 @@ HRESULT to_object(exec_ctx_t*,VARIANT*,IDispatch**);
typedef struct named_item_t {
IDispatch *disp;
DWORD flags;
LPWSTR name;
struct named_item_t *next;
} named_item_t;

View File

@ -702,6 +702,8 @@ static void run_tests(void)
parse_script_a("delete testObj.deleteTest;");
CHECK_CALLED(testobj_delete);
parse_script_a("ok(typeof(test) === 'object', \"typeof(test) != 'object'\");");
run_from_res("lang.js");
run_from_res("api.js");
run_from_res("regexp.js");