mirror of
https://github.com/reactos/reactos.git
synced 2025-08-04 21:27:30 +00:00
[JSCRIPT] Sync with Wine 3.0. CORE-14225
This commit is contained in:
parent
08fb1fc8fe
commit
3381ee4b89
5 changed files with 32 additions and 23 deletions
|
@ -1867,12 +1867,13 @@ static BOOL alloc_variable(compiler_ctx_t *ctx, const WCHAR *name)
|
||||||
return alloc_local(ctx, ident, ctx->func->var_cnt++);
|
return alloc_local(ctx, ident, ctx->func->var_cnt++);
|
||||||
}
|
}
|
||||||
|
|
||||||
static BOOL visit_function_expression(compiler_ctx_t *ctx, function_expression_t *expr)
|
static HRESULT visit_function_expression(compiler_ctx_t *ctx, function_expression_t *expr)
|
||||||
{
|
{
|
||||||
expr->func_id = ctx->func->func_cnt++;
|
expr->func_id = ctx->func->func_cnt++;
|
||||||
ctx->func_tail = ctx->func_tail ? (ctx->func_tail->next = expr) : (ctx->func_head = expr);
|
ctx->func_tail = ctx->func_tail ? (ctx->func_tail->next = expr) : (ctx->func_head = expr);
|
||||||
|
|
||||||
return !expr->identifier || expr->event_target || alloc_variable(ctx, expr->identifier);
|
return !expr->identifier || expr->event_target || alloc_variable(ctx, expr->identifier)
|
||||||
|
? S_OK : E_OUTOFMEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT visit_expression(compiler_ctx_t *ctx, expression_t *expr)
|
static HRESULT visit_expression(compiler_ctx_t *ctx, expression_t *expr)
|
||||||
|
@ -1985,7 +1986,7 @@ static HRESULT visit_expression(compiler_ctx_t *ctx, expression_t *expr)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case EXPR_FUNC:
|
case EXPR_FUNC:
|
||||||
visit_function_expression(ctx, (function_expression_t*)expr);
|
hres = visit_function_expression(ctx, (function_expression_t*)expr);
|
||||||
break;
|
break;
|
||||||
case EXPR_MEMBER:
|
case EXPR_MEMBER:
|
||||||
hres = visit_expression(ctx, ((member_expression_t*)expr)->expression);
|
hres = visit_expression(ctx, ((member_expression_t*)expr)->expression);
|
||||||
|
|
|
@ -1096,6 +1096,8 @@ HRESULT disp_call(script_ctx_t *ctx, IDispatch *disp, DISPID id, WORD flags, uns
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(ctx != jsdisp->ctx)
|
||||||
|
flags &= ~DISPATCH_JSCRIPT_INTERNAL_MASK;
|
||||||
hres = jsdisp_call(jsdisp, id, flags, argc, argv, ret);
|
hres = jsdisp_call(jsdisp, id, flags, argc, argv, ret);
|
||||||
jsdisp_release(jsdisp);
|
jsdisp_release(jsdisp);
|
||||||
return hres;
|
return hres;
|
||||||
|
@ -1184,6 +1186,8 @@ HRESULT disp_call_value(script_ctx_t *ctx, IDispatch *disp, IDispatch *jsthis, W
|
||||||
|
|
||||||
jsdisp = iface_to_jsdisp(disp);
|
jsdisp = iface_to_jsdisp(disp);
|
||||||
if(jsdisp) {
|
if(jsdisp) {
|
||||||
|
if(ctx != jsdisp->ctx)
|
||||||
|
flags &= ~DISPATCH_JSCRIPT_INTERNAL_MASK;
|
||||||
hres = jsdisp_call_value(jsdisp, jsthis, flags, argc, argv, r);
|
hres = jsdisp_call_value(jsdisp, jsthis, flags, argc, argv, r);
|
||||||
jsdisp_release(jsdisp);
|
jsdisp_release(jsdisp);
|
||||||
return hres;
|
return hres;
|
||||||
|
|
|
@ -18,8 +18,6 @@
|
||||||
|
|
||||||
#include "jscript.h"
|
#include "jscript.h"
|
||||||
|
|
||||||
WINE_DECLARE_DEBUG_CHANNEL(jscript_except);
|
|
||||||
|
|
||||||
static const WCHAR booleanW[] = {'b','o','o','l','e','a','n',0};
|
static const WCHAR booleanW[] = {'b','o','o','l','e','a','n',0};
|
||||||
static const WCHAR functionW[] = {'f','u','n','c','t','i','o','n',0};
|
static const WCHAR functionW[] = {'f','u','n','c','t','i','o','n',0};
|
||||||
static const WCHAR numberW[] = {'n','u','m','b','e','r',0};
|
static const WCHAR numberW[] = {'n','u','m','b','e','r',0};
|
||||||
|
@ -2661,29 +2659,27 @@ static void print_backtrace(script_ctx_t *ctx)
|
||||||
call_frame_t *frame;
|
call_frame_t *frame;
|
||||||
|
|
||||||
for(frame = ctx->call_ctx; frame; frame = frame->prev_frame) {
|
for(frame = ctx->call_ctx; frame; frame = frame->prev_frame) {
|
||||||
TRACE_(jscript_except)("%u\t", depth);
|
WARN("%u\t", depth);
|
||||||
depth++;
|
depth++;
|
||||||
|
|
||||||
if(frame->this_obj && frame->this_obj != to_disp(ctx->global) && frame->this_obj != ctx->host_global)
|
if(frame->this_obj && frame->this_obj != to_disp(ctx->global) && frame->this_obj != ctx->host_global)
|
||||||
TRACE_(jscript_except)("%p->", frame->this_obj);
|
WARN("%p->", frame->this_obj);
|
||||||
TRACE_(jscript_except)("%s(", frame->function->name ? debugstr_w(frame->function->name) : "[unnamed]");
|
WARN("%s(", frame->function->name ? debugstr_w(frame->function->name) : "[unnamed]");
|
||||||
if(frame->base_scope && frame->base_scope->frame) {
|
if(frame->base_scope && frame->base_scope->frame) {
|
||||||
for(i=0; i < frame->argc; i++) {
|
for(i=0; i < frame->argc; i++) {
|
||||||
if(i < frame->function->param_cnt)
|
if(i < frame->function->param_cnt)
|
||||||
TRACE_(jscript_except)("%s%s=%s", i ? ", " : "",
|
WARN("%s%s=%s", i ? ", " : "", debugstr_w(frame->function->params[i]),
|
||||||
debugstr_w(frame->function->params[i]),
|
debugstr_jsval(ctx->stack[local_off(frame, -i-1)]));
|
||||||
debugstr_jsval(ctx->stack[local_off(frame, -i-1)]));
|
|
||||||
else
|
else
|
||||||
TRACE_(jscript_except)("%s%s", i ? ", " : "",
|
WARN("%s%s", i ? ", " : "", debugstr_jsval(ctx->stack[local_off(frame, -i-1)]));
|
||||||
debugstr_jsval(ctx->stack[local_off(frame, -i-1)]));
|
|
||||||
}
|
}
|
||||||
}else {
|
}else {
|
||||||
TRACE_(jscript_except)("[detached frame]");
|
WARN("[detached frame]");
|
||||||
}
|
}
|
||||||
TRACE_(jscript_except)(")\n");
|
WARN(")\n");
|
||||||
|
|
||||||
if(!(frame->flags & EXEC_RETURN_TO_INTERP)) {
|
if(!(frame->flags & EXEC_RETURN_TO_INTERP)) {
|
||||||
TRACE_(jscript_except)("%u\t[native code]\n", depth);
|
WARN("%u\t[native code]\n", depth);
|
||||||
depth++;
|
depth++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2697,26 +2693,24 @@ static HRESULT unwind_exception(script_ctx_t *ctx, HRESULT exception_hres)
|
||||||
unsigned catch_off;
|
unsigned catch_off;
|
||||||
HRESULT hres;
|
HRESULT hres;
|
||||||
|
|
||||||
TRACE("%08x\n", exception_hres);
|
if(WARN_ON(jscript)) {
|
||||||
|
|
||||||
if(TRACE_ON(jscript_except)) {
|
|
||||||
jsdisp_t *error_obj;
|
jsdisp_t *error_obj;
|
||||||
jsval_t msg;
|
jsval_t msg;
|
||||||
|
|
||||||
static const WCHAR messageW[] = {'m','e','s','s','a','g','e',0};
|
static const WCHAR messageW[] = {'m','e','s','s','a','g','e',0};
|
||||||
|
|
||||||
TRACE_(jscript_except)("Exception %08x %s", exception_hres, debugstr_jsval(ctx->ei.val));
|
WARN("Exception %08x %s", exception_hres, debugstr_jsval(ctx->ei.val));
|
||||||
if(jsval_type(ctx->ei.val) == JSV_OBJECT) {
|
if(jsval_type(ctx->ei.val) == JSV_OBJECT) {
|
||||||
error_obj = to_jsdisp(get_object(ctx->ei.val));
|
error_obj = to_jsdisp(get_object(ctx->ei.val));
|
||||||
if(error_obj) {
|
if(error_obj) {
|
||||||
hres = jsdisp_propget_name(error_obj, messageW, &msg);
|
hres = jsdisp_propget_name(error_obj, messageW, &msg);
|
||||||
if(SUCCEEDED(hres)) {
|
if(SUCCEEDED(hres)) {
|
||||||
TRACE_(jscript_except)(" (message %s)", debugstr_jsval(msg));
|
WARN(" (message %s)", debugstr_jsval(msg));
|
||||||
jsval_release(msg);
|
jsval_release(msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
TRACE_(jscript_except)(" in:\n");
|
WARN(" in:\n");
|
||||||
|
|
||||||
print_backtrace(ctx);
|
print_backtrace(ctx);
|
||||||
}
|
}
|
||||||
|
|
|
@ -287,12 +287,22 @@ HRESULT variant_to_jsval(VARIANT *var, jsval_t *r)
|
||||||
case VT_I2:
|
case VT_I2:
|
||||||
*r = jsval_number(V_I2(var));
|
*r = jsval_number(V_I2(var));
|
||||||
return S_OK;
|
return S_OK;
|
||||||
|
case VT_UI2:
|
||||||
|
*r = jsval_number(V_UI2(var));
|
||||||
|
return S_OK;
|
||||||
case VT_INT:
|
case VT_INT:
|
||||||
*r = jsval_number(V_INT(var));
|
*r = jsval_number(V_INT(var));
|
||||||
return S_OK;
|
return S_OK;
|
||||||
case VT_UI4:
|
case VT_UI4:
|
||||||
*r = jsval_number(V_UI4(var));
|
*r = jsval_number(V_UI4(var));
|
||||||
return S_OK;
|
return S_OK;
|
||||||
|
case VT_UI8:
|
||||||
|
/*
|
||||||
|
* Native doesn't support VT_UI8 here, but it's needed for IE9+ APIs
|
||||||
|
* (native IE9 doesn't use jscript.dll for JavaScript).
|
||||||
|
*/
|
||||||
|
*r = jsval_number(V_UI8(var));
|
||||||
|
return S_OK;
|
||||||
case VT_R4:
|
case VT_R4:
|
||||||
*r = jsval_number(V_R4(var));
|
*r = jsval_number(V_R4(var));
|
||||||
return S_OK;
|
return S_OK;
|
||||||
|
|
|
@ -85,7 +85,7 @@ reactos/dll/win32/inseng # Synced to Wine-3.0
|
||||||
reactos/dll/win32/iphlpapi # Out of sync
|
reactos/dll/win32/iphlpapi # Out of sync
|
||||||
reactos/dll/win32/itircl # Synced to WineStaging-2.9
|
reactos/dll/win32/itircl # Synced to WineStaging-2.9
|
||||||
reactos/dll/win32/itss # Synced to Wine-3.0
|
reactos/dll/win32/itss # Synced to Wine-3.0
|
||||||
reactos/dll/win32/jscript # Synced to WineStaging-2.16
|
reactos/dll/win32/jscript # Synced to Wine-3.0
|
||||||
reactos/dll/win32/jsproxy # Synced to WineStaging-2.16
|
reactos/dll/win32/jsproxy # Synced to WineStaging-2.16
|
||||||
reactos/dll/win32/loadperf # Synced to WineStaging-2.9
|
reactos/dll/win32/loadperf # Synced to WineStaging-2.9
|
||||||
reactos/dll/win32/lz32 # Synced to WineStaging-2.9
|
reactos/dll/win32/lz32 # Synced to WineStaging-2.9
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue