jscript: Use enter_script and leave_script to call script site notifications.
Signed-off-by: Jacek Caban <jacek@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
9855c248f8
commit
33984c390d
|
@ -2977,6 +2977,11 @@ HRESULT exec_source(script_ctx_t *ctx, DWORD flags, bytecode_t *bytecode, functi
|
||||||
unsigned i;
|
unsigned i;
|
||||||
HRESULT hres;
|
HRESULT hres;
|
||||||
|
|
||||||
|
if(!ctx->ei->enter_notified) {
|
||||||
|
ctx->ei->enter_notified = TRUE;
|
||||||
|
IActiveScriptSite_OnEnterScript(ctx->site);
|
||||||
|
}
|
||||||
|
|
||||||
for(i = 0; i < function->func_cnt; i++) {
|
for(i = 0; i < function->func_cnt; i++) {
|
||||||
jsdisp_t *func_obj;
|
jsdisp_t *func_obj;
|
||||||
|
|
||||||
|
|
|
@ -227,6 +227,7 @@ struct _jsexcept_t {
|
||||||
BOOL valid_value;
|
BOOL valid_value;
|
||||||
jsval_t value;
|
jsval_t value;
|
||||||
|
|
||||||
|
BOOL enter_notified;
|
||||||
jsexcept_t *prev;
|
jsexcept_t *prev;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -129,22 +129,12 @@ HRESULT leave_script(script_ctx_t *ctx, HRESULT result)
|
||||||
result = ei->error;
|
result = ei->error;
|
||||||
if(FAILED(result))
|
if(FAILED(result))
|
||||||
WARN("%08x\n", result);
|
WARN("%08x\n", result);
|
||||||
|
if(ei->enter_notified && ctx->site)
|
||||||
|
IActiveScriptSite_OnLeaveScript(ctx->site);
|
||||||
reset_ei(ei);
|
reset_ei(ei);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT exec_global_code(JScript *This, bytecode_t *code)
|
|
||||||
{
|
|
||||||
HRESULT hres;
|
|
||||||
|
|
||||||
IActiveScriptSite_OnEnterScript(This->site);
|
|
||||||
|
|
||||||
hres = exec_source(This->ctx, EXEC_GLOBAL, code, &code->global_code, NULL, NULL, NULL, This->ctx->global, 0, NULL, NULL);
|
|
||||||
|
|
||||||
IActiveScriptSite_OnLeaveScript(This->site);
|
|
||||||
return hres;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void clear_script_queue(JScript *This)
|
static void clear_script_queue(JScript *This)
|
||||||
{
|
{
|
||||||
while(!list_empty(&This->queued_code))
|
while(!list_empty(&This->queued_code))
|
||||||
|
@ -176,7 +166,7 @@ static void exec_queued_code(JScript *This)
|
||||||
|
|
||||||
LIST_FOR_EACH_ENTRY(iter, &This->queued_code, bytecode_t, entry) {
|
LIST_FOR_EACH_ENTRY(iter, &This->queued_code, bytecode_t, entry) {
|
||||||
enter_script(This->ctx, &ei);
|
enter_script(This->ctx, &ei);
|
||||||
hres = exec_global_code(This, iter);
|
hres = exec_source(This->ctx, EXEC_GLOBAL, iter, &iter->global_code, NULL, NULL, NULL, This->ctx->global, 0, NULL, NULL);
|
||||||
leave_script(This->ctx, hres);
|
leave_script(This->ctx, hres);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -818,8 +808,6 @@ static HRESULT WINAPI JScriptParse_ParseScriptText(IActiveScriptParse *iface,
|
||||||
if(dwFlags & SCRIPTTEXT_ISEXPRESSION) {
|
if(dwFlags & SCRIPTTEXT_ISEXPRESSION) {
|
||||||
jsval_t r;
|
jsval_t r;
|
||||||
|
|
||||||
IActiveScriptSite_OnEnterScript(This->site);
|
|
||||||
|
|
||||||
hres = exec_source(This->ctx, EXEC_GLOBAL, code, &code->global_code, NULL, NULL, NULL, This->ctx->global, 0, NULL, &r);
|
hres = exec_source(This->ctx, EXEC_GLOBAL, code, &code->global_code, NULL, NULL, NULL, This->ctx->global, 0, NULL, &r);
|
||||||
if(SUCCEEDED(hres)) {
|
if(SUCCEEDED(hres)) {
|
||||||
if(pvarResult)
|
if(pvarResult)
|
||||||
|
@ -827,7 +815,6 @@ static HRESULT WINAPI JScriptParse_ParseScriptText(IActiveScriptParse *iface,
|
||||||
jsval_release(r);
|
jsval_release(r);
|
||||||
}
|
}
|
||||||
|
|
||||||
IActiveScriptSite_OnLeaveScript(This->site);
|
|
||||||
return leave_script(This->ctx, hres);
|
return leave_script(This->ctx, hres);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -840,8 +827,7 @@ static HRESULT WINAPI JScriptParse_ParseScriptText(IActiveScriptParse *iface,
|
||||||
if(!pvarResult && !is_started(This->ctx)) {
|
if(!pvarResult && !is_started(This->ctx)) {
|
||||||
list_add_tail(&This->queued_code, &code->entry);
|
list_add_tail(&This->queued_code, &code->entry);
|
||||||
}else {
|
}else {
|
||||||
hres = exec_global_code(This, code);
|
hres = exec_source(This->ctx, EXEC_GLOBAL, code, &code->global_code, NULL, NULL, NULL, This->ctx->global, 0, NULL, NULL);
|
||||||
|
|
||||||
if(code->is_persistent)
|
if(code->is_persistent)
|
||||||
list_add_tail(&This->persistent_code, &code->entry);
|
list_add_tail(&This->persistent_code, &code->entry);
|
||||||
else
|
else
|
||||||
|
|
|
@ -105,9 +105,7 @@ static void _call_change_type(unsigned line, IVariantChangeType *change_type, VA
|
||||||
ok_(__FILE__,line)(hres == S_OK, "ChangeType(%d) failed: %08x\n", vt, hres);
|
ok_(__FILE__,line)(hres == S_OK, "ChangeType(%d) failed: %08x\n", vt, hres);
|
||||||
ok_(__FILE__,line)(V_VT(dst) == vt, "V_VT(dst) = %d\n", V_VT(dst));
|
ok_(__FILE__,line)(V_VT(dst) == vt, "V_VT(dst) = %d\n", V_VT(dst));
|
||||||
if(V_VT(src) == VT_DISPATCH && vt != VT_BOOL) {
|
if(V_VT(src) == VT_DISPATCH && vt != VT_BOOL) {
|
||||||
todo_wine
|
|
||||||
CHECK_CALLED(OnEnterScript);
|
CHECK_CALLED(OnEnterScript);
|
||||||
todo_wine
|
|
||||||
CHECK_CALLED(OnLeaveScript);
|
CHECK_CALLED(OnLeaveScript);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue