[JSCRIPT] Sync with Wine Staging 3.9. CORE-14656

This commit is contained in:
Amine Khaldi 2018-06-04 03:38:45 +01:00
parent 454e360303
commit 3f071cc527
18 changed files with 1926 additions and 1057 deletions

View file

@ -180,11 +180,13 @@ HRESULT setup_arguments_object(script_ctx_t *ctx, call_frame_t *frame)
args->argc = frame->argc;
args->frame = frame;
hres = jsdisp_propput_dontenum(&args->jsdisp, lengthW, jsval_number(args->argc));
hres = jsdisp_define_data_property(&args->jsdisp, lengthW, PROPF_WRITABLE | PROPF_CONFIGURABLE,
jsval_number(args->argc));
if(SUCCEEDED(hres))
hres = jsdisp_propput_dontenum(&args->jsdisp, caleeW, jsval_disp(to_disp(&args->function->dispex)));
hres = jsdisp_define_data_property(&args->jsdisp, caleeW, PROPF_WRITABLE | PROPF_CONFIGURABLE,
jsval_obj(&args->function->dispex));
if(SUCCEEDED(hres))
hres = jsdisp_propput(frame->base_scope->jsobj, argumentsW, PROPF_DONTDELETE, jsval_obj(&args->jsdisp));
hres = jsdisp_propput(frame->base_scope->jsobj, argumentsW, PROPF_WRITABLE, jsval_obj(&args->jsdisp));
if(FAILED(hres)) {
jsdisp_release(&args->jsdisp);
return hres;
@ -358,12 +360,6 @@ static HRESULT Function_get_length(script_ctx_t *ctx, jsdisp_t *jsthis, jsval_t
return S_OK;
}
static HRESULT Function_set_length(script_ctx_t *ctx, jsdisp_t *jsthis, jsval_t value)
{
FIXME("\n");
return E_NOTIMPL;
}
static HRESULT Function_toString(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv,
jsval_t *r)
{
@ -588,9 +584,9 @@ static void Function_destructor(jsdisp_t *dispex)
static const builtin_prop_t Function_props[] = {
{applyW, Function_apply, PROPF_METHOD|2},
{argumentsW, NULL, 0, Function_get_arguments, builtin_set_const},
{argumentsW, NULL, 0, Function_get_arguments},
{callW, Function_call, PROPF_METHOD|1},
{lengthW, NULL, 0, Function_get_length, Function_set_length},
{lengthW, NULL, 0, Function_get_length},
{toStringW, Function_toString, PROPF_METHOD}
};
@ -604,8 +600,8 @@ static const builtin_info_t Function_info = {
};
static const builtin_prop_t FunctionInst_props[] = {
{argumentsW, NULL, 0, Function_get_arguments, builtin_set_const},
{lengthW, NULL, 0, Function_get_length, Function_set_length}
{argumentsW, NULL, 0, Function_get_arguments},
{lengthW, NULL, 0, Function_get_length}
};
static const builtin_info_t FunctionInst_info = {
@ -645,11 +641,6 @@ static HRESULT create_function(script_ctx_t *ctx, const builtin_info_t *builtin_
return S_OK;
}
static inline HRESULT set_prototype(script_ctx_t *ctx, jsdisp_t *dispex, jsdisp_t *prototype)
{
return jsdisp_propput_dontenum(dispex, prototypeW, jsval_obj(prototype));
}
HRESULT create_builtin_function(script_ctx_t *ctx, builtin_invoke_t value_proc, const WCHAR *name,
const builtin_info_t *builtin_info, DWORD flags, jsdisp_t *prototype, jsdisp_t **ret)
{
@ -661,9 +652,10 @@ HRESULT create_builtin_function(script_ctx_t *ctx, builtin_invoke_t value_proc,
return hres;
if(builtin_info)
hres = jsdisp_propput_const(&function->dispex, lengthW, jsval_number(function->length));
hres = jsdisp_define_data_property(&function->dispex, lengthW, 0,
jsval_number(function->length));
if(SUCCEEDED(hres))
hres = set_prototype(ctx, &function->dispex, prototype);
hres = jsdisp_define_data_property(&function->dispex, prototypeW, 0, jsval_obj(prototype));
if(FAILED(hres)) {
jsdisp_release(&function->dispex);
return hres;
@ -680,7 +672,8 @@ static HRESULT set_constructor_prop(script_ctx_t *ctx, jsdisp_t *constr, jsdisp_
{
static const WCHAR constructorW[] = {'c','o','n','s','t','r','u','c','t','o','r',0};
return jsdisp_propput_dontenum(prot, constructorW, jsval_obj(constr));
return jsdisp_define_data_property(prot, constructorW, PROPF_WRITABLE | PROPF_CONFIGURABLE,
jsval_obj(constr));
}
HRESULT create_builtin_constructor(script_ctx_t *ctx, builtin_invoke_t value_proc, const WCHAR *name,
@ -716,7 +709,8 @@ HRESULT create_source_function(script_ctx_t *ctx, bytecode_t *code, function_cod
hres = create_function(ctx, NULL, PROPF_CONSTR, FALSE, NULL, &function);
if(SUCCEEDED(hres)) {
hres = set_prototype(ctx, &function->dispex, prototype);
hres = jsdisp_define_data_property(&function->dispex, prototypeW, PROPF_WRITABLE,
jsval_obj(prototype));
if(SUCCEEDED(hres))
hres = set_constructor_prop(ctx, &function->dispex, prototype);
if(FAILED(hres))
@ -874,7 +868,7 @@ HRESULT init_function_constr(script_ctx_t *ctx, jsdisp_t *object_prototype)
if(SUCCEEDED(hres)) {
constr->value_proc = FunctionConstr_value;
constr->name = FunctionW;
hres = set_prototype(ctx, &constr->dispex, &prot->dispex);
hres = jsdisp_define_data_property(&constr->dispex, prototypeW, 0, jsval_obj(&prot->dispex));
if(SUCCEEDED(hres))
hres = set_constructor_prop(ctx, &constr->dispex, &prot->dispex);
if(FAILED(hres))