jscript: Added stub implementation of Date constructor properties.
This commit is contained in:
parent
dd5a9a0aa1
commit
41e297af11
|
@ -829,7 +829,7 @@ HRESULT create_array_constr(script_ctx_t *ctx, DispatchEx **ret)
|
||||||
if(FAILED(hres))
|
if(FAILED(hres))
|
||||||
return hres;
|
return hres;
|
||||||
|
|
||||||
hres = create_builtin_function(ctx, ArrayConstr_value, PROPF_CONSTR, &array->dispex, ret);
|
hres = create_builtin_function(ctx, ArrayConstr_value, NULL, PROPF_CONSTR, &array->dispex, ret);
|
||||||
|
|
||||||
IDispatchEx_Release(_IDispatchEx_(&array->dispex));
|
IDispatchEx_Release(_IDispatchEx_(&array->dispex));
|
||||||
return hres;
|
return hres;
|
||||||
|
|
|
@ -142,7 +142,7 @@ HRESULT create_bool_constr(script_ctx_t *ctx, DispatchEx **ret)
|
||||||
if(FAILED(hres))
|
if(FAILED(hres))
|
||||||
return hres;
|
return hres;
|
||||||
|
|
||||||
hres = create_builtin_function(ctx, BoolConstr_value, PROPF_CONSTR, &bool->dispex, ret);
|
hres = create_builtin_function(ctx, BoolConstr_value, NULL, PROPF_CONSTR, &bool->dispex, ret);
|
||||||
|
|
||||||
jsdisp_release(&bool->dispex);
|
jsdisp_release(&bool->dispex);
|
||||||
return hres;
|
return hres;
|
||||||
|
|
|
@ -87,6 +87,9 @@ static const WCHAR setUTCMonthW[] = {'s','e','t','U','T','C','M','o','n','t','h'
|
||||||
static const WCHAR setFullYearW[] = {'s','e','t','F','u','l','l','Y','e','a','r',0};
|
static const WCHAR setFullYearW[] = {'s','e','t','F','u','l','l','Y','e','a','r',0};
|
||||||
static const WCHAR setUTCFullYearW[] = {'s','e','t','U','T','C','F','u','l','l','Y','e','a','r',0};
|
static const WCHAR setUTCFullYearW[] = {'s','e','t','U','T','C','F','u','l','l','Y','e','a','r',0};
|
||||||
|
|
||||||
|
static const WCHAR UTCW[] = {'U','T','C',0};
|
||||||
|
static const WCHAR parseW[] = {'p','a','r','s','e',0};
|
||||||
|
|
||||||
/*ECMA-262 3rd Edition 15.9.1.2 */
|
/*ECMA-262 3rd Edition 15.9.1.2 */
|
||||||
#define MS_PER_DAY 86400000
|
#define MS_PER_DAY 86400000
|
||||||
#define MS_PER_HOUR 3600000
|
#define MS_PER_HOUR 3600000
|
||||||
|
@ -2197,6 +2200,20 @@ static HRESULT create_date(script_ctx_t *ctx, BOOL use_constr, DOUBLE time, Disp
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static HRESULT DateConstr_parse(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
|
||||||
|
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
|
||||||
|
{
|
||||||
|
FIXME("\n");
|
||||||
|
return E_NOTIMPL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static HRESULT DateConstr_UTC(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
|
||||||
|
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
|
||||||
|
{
|
||||||
|
FIXME("\n");
|
||||||
|
return E_NOTIMPL;
|
||||||
|
}
|
||||||
|
|
||||||
static HRESULT DateConstr_value(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
|
static HRESULT DateConstr_value(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
|
||||||
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
|
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
|
||||||
{
|
{
|
||||||
|
@ -2339,6 +2356,20 @@ static HRESULT DateConstr_value(DispatchEx *dispex, LCID lcid, WORD flags, DISPP
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const builtin_prop_t DateConstr_props[] = {
|
||||||
|
{UTCW, DateConstr_UTC, PROPF_METHOD},
|
||||||
|
{parseW, DateConstr_parse, PROPF_METHOD}
|
||||||
|
};
|
||||||
|
|
||||||
|
static const builtin_info_t DateConstr_info = {
|
||||||
|
JSCLASS_FUNCTION,
|
||||||
|
{NULL, Function_value, 0},
|
||||||
|
sizeof(DateConstr_props)/sizeof(*DateConstr_props),
|
||||||
|
DateConstr_props,
|
||||||
|
NULL,
|
||||||
|
NULL
|
||||||
|
};
|
||||||
|
|
||||||
HRESULT create_date_constr(script_ctx_t *ctx, DispatchEx **ret)
|
HRESULT create_date_constr(script_ctx_t *ctx, DispatchEx **ret)
|
||||||
{
|
{
|
||||||
DispatchEx *date;
|
DispatchEx *date;
|
||||||
|
@ -2348,7 +2379,7 @@ HRESULT create_date_constr(script_ctx_t *ctx, DispatchEx **ret)
|
||||||
if(FAILED(hres))
|
if(FAILED(hres))
|
||||||
return hres;
|
return hres;
|
||||||
|
|
||||||
hres = create_builtin_function(ctx, DateConstr_value, PROPF_CONSTR, date, ret);
|
hres = create_builtin_function(ctx, DateConstr_value, &DateConstr_info, PROPF_CONSTR, date, ret);
|
||||||
|
|
||||||
jsdisp_release(date);
|
jsdisp_release(date);
|
||||||
return hres;
|
return hres;
|
||||||
|
|
|
@ -293,7 +293,7 @@ static HRESULT prop_get(DispatchEx *This, dispex_prop_t *prop, LCID lcid, DISPPA
|
||||||
case PROP_BUILTIN:
|
case PROP_BUILTIN:
|
||||||
if(prop->u.p->flags & PROPF_METHOD) {
|
if(prop->u.p->flags & PROPF_METHOD) {
|
||||||
DispatchEx *obj;
|
DispatchEx *obj;
|
||||||
hres = create_builtin_function(This->ctx, prop->u.p->invoke, prop->u.p->flags, NULL, &obj);
|
hres = create_builtin_function(This->ctx, prop->u.p->invoke, NULL, prop->u.p->flags, NULL, &obj);
|
||||||
if(FAILED(hres))
|
if(FAILED(hres))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -341,7 +341,7 @@ static HRESULT Function_isPrototypeOf(DispatchEx *dispex, LCID lcid, WORD flags,
|
||||||
return E_NOTIMPL;
|
return E_NOTIMPL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT Function_value(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
|
HRESULT Function_value(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
|
||||||
VARIANT *retv, jsexcept_t *ei, IServiceProvider *caller)
|
VARIANT *retv, jsexcept_t *ei, IServiceProvider *caller)
|
||||||
{
|
{
|
||||||
FunctionInstance *function;
|
FunctionInstance *function;
|
||||||
|
@ -435,7 +435,8 @@ static HRESULT FunctionProt_value(DispatchEx *dispex, LCID lcid, WORD flags, DIS
|
||||||
return E_NOTIMPL;
|
return E_NOTIMPL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT create_function(script_ctx_t *ctx, DWORD flags, BOOL funcprot, DispatchEx *prototype, FunctionInstance **ret)
|
static HRESULT create_function(script_ctx_t *ctx, const builtin_info_t *builtin_info, DWORD flags,
|
||||||
|
BOOL funcprot, DispatchEx *prototype, FunctionInstance **ret)
|
||||||
{
|
{
|
||||||
FunctionInstance *function;
|
FunctionInstance *function;
|
||||||
HRESULT hres;
|
HRESULT hres;
|
||||||
|
@ -446,6 +447,8 @@ static HRESULT create_function(script_ctx_t *ctx, DWORD flags, BOOL funcprot, Di
|
||||||
|
|
||||||
if(funcprot)
|
if(funcprot)
|
||||||
hres = init_dispex(&function->dispex, ctx, &Function_info, prototype);
|
hres = init_dispex(&function->dispex, ctx, &Function_info, prototype);
|
||||||
|
else if(builtin_info)
|
||||||
|
hres = init_dispex_from_constr(&function->dispex, ctx, builtin_info, ctx->function_constr);
|
||||||
else
|
else
|
||||||
hres = init_dispex_from_constr(&function->dispex, ctx, &Function_info, ctx->function_constr);
|
hres = init_dispex_from_constr(&function->dispex, ctx, &Function_info, ctx->function_constr);
|
||||||
if(FAILED(hres))
|
if(FAILED(hres))
|
||||||
|
@ -473,13 +476,13 @@ static HRESULT create_function(script_ctx_t *ctx, DWORD flags, BOOL funcprot, Di
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT create_builtin_function(script_ctx_t *ctx, builtin_invoke_t value_proc, DWORD flags,
|
HRESULT create_builtin_function(script_ctx_t *ctx, builtin_invoke_t value_proc,
|
||||||
DispatchEx *prototype, DispatchEx **ret)
|
const builtin_info_t *builtin_info, DWORD flags, DispatchEx *prototype, DispatchEx **ret)
|
||||||
{
|
{
|
||||||
FunctionInstance *function;
|
FunctionInstance *function;
|
||||||
HRESULT hres;
|
HRESULT hres;
|
||||||
|
|
||||||
hres = create_function(ctx, flags, FALSE, prototype, &function);
|
hres = create_function(ctx, builtin_info, flags, FALSE, prototype, &function);
|
||||||
if(FAILED(hres))
|
if(FAILED(hres))
|
||||||
return hres;
|
return hres;
|
||||||
|
|
||||||
|
@ -502,7 +505,7 @@ HRESULT create_source_function(parser_ctx_t *ctx, parameter_t *parameters, sourc
|
||||||
if(FAILED(hres))
|
if(FAILED(hres))
|
||||||
return hres;
|
return hres;
|
||||||
|
|
||||||
hres = create_function(ctx->script, PROPF_CONSTR, FALSE, prototype, &function);
|
hres = create_function(ctx->script, NULL, PROPF_CONSTR, FALSE, prototype, &function);
|
||||||
jsdisp_release(prototype);
|
jsdisp_release(prototype);
|
||||||
if(FAILED(hres))
|
if(FAILED(hres))
|
||||||
return hres;
|
return hres;
|
||||||
|
@ -534,13 +537,13 @@ HRESULT init_function_constr(script_ctx_t *ctx)
|
||||||
FunctionInstance *prot, *constr;
|
FunctionInstance *prot, *constr;
|
||||||
HRESULT hres;
|
HRESULT hres;
|
||||||
|
|
||||||
hres = create_function(ctx, PROPF_CONSTR, TRUE, NULL, &prot);
|
hres = create_function(ctx, NULL, PROPF_CONSTR, TRUE, NULL, &prot);
|
||||||
if(FAILED(hres))
|
if(FAILED(hres))
|
||||||
return hres;
|
return hres;
|
||||||
|
|
||||||
prot->value_proc = FunctionProt_value;
|
prot->value_proc = FunctionProt_value;
|
||||||
|
|
||||||
hres = create_function(ctx, PROPF_CONSTR, TRUE, &prot->dispex, &constr);
|
hres = create_function(ctx, NULL, PROPF_CONSTR, TRUE, &prot->dispex, &constr);
|
||||||
jsdisp_release(&prot->dispex);
|
jsdisp_release(&prot->dispex);
|
||||||
if(FAILED(hres))
|
if(FAILED(hres))
|
||||||
return hres;
|
return hres;
|
||||||
|
|
|
@ -132,7 +132,10 @@ HRESULT jsdisp_propget_name(DispatchEx*,LPCWSTR,LCID,VARIANT*,jsexcept_t*,IServi
|
||||||
HRESULT jsdisp_propget_idx(DispatchEx*,DWORD,LCID,VARIANT*,jsexcept_t*,IServiceProvider*);
|
HRESULT jsdisp_propget_idx(DispatchEx*,DWORD,LCID,VARIANT*,jsexcept_t*,IServiceProvider*);
|
||||||
HRESULT jsdisp_get_id(DispatchEx*,const WCHAR*,DWORD,DISPID*);
|
HRESULT jsdisp_get_id(DispatchEx*,const WCHAR*,DWORD,DISPID*);
|
||||||
|
|
||||||
HRESULT create_builtin_function(script_ctx_t*,builtin_invoke_t,DWORD,DispatchEx*,DispatchEx**);
|
HRESULT create_builtin_function(script_ctx_t*,builtin_invoke_t,const builtin_info_t*,DWORD,
|
||||||
|
DispatchEx*,DispatchEx**);
|
||||||
|
HRESULT Function_value(DispatchEx*,LCID,WORD,DISPPARAMS*,VARIANT*,jsexcept_t*,IServiceProvider*);
|
||||||
|
|
||||||
|
|
||||||
HRESULT create_object(script_ctx_t*,DispatchEx*,DispatchEx**);
|
HRESULT create_object(script_ctx_t*,DispatchEx*,DispatchEx**);
|
||||||
HRESULT create_math(script_ctx_t*,DispatchEx**);
|
HRESULT create_math(script_ctx_t*,DispatchEx**);
|
||||||
|
|
|
@ -263,7 +263,7 @@ HRESULT create_number_constr(script_ctx_t *ctx, DispatchEx **ret)
|
||||||
return hres;
|
return hres;
|
||||||
|
|
||||||
V_VT(&number->num) = VT_I4;
|
V_VT(&number->num) = VT_I4;
|
||||||
hres = create_builtin_function(ctx, NumberConstr_value, PROPF_CONSTR, &number->dispex, ret);
|
hres = create_builtin_function(ctx, NumberConstr_value, NULL, PROPF_CONSTR, &number->dispex, ret);
|
||||||
|
|
||||||
jsdisp_release(&number->dispex);
|
jsdisp_release(&number->dispex);
|
||||||
return hres;
|
return hres;
|
||||||
|
|
|
@ -154,7 +154,7 @@ HRESULT create_object_constr(script_ctx_t *ctx, DispatchEx **ret)
|
||||||
if(FAILED(hres))
|
if(FAILED(hres))
|
||||||
return hres;
|
return hres;
|
||||||
|
|
||||||
hres = create_builtin_function(ctx, ObjectConstr_value, PROPF_CONSTR, object, ret);
|
hres = create_builtin_function(ctx, ObjectConstr_value, NULL, PROPF_CONSTR, object, ret);
|
||||||
|
|
||||||
jsdisp_release(object);
|
jsdisp_release(object);
|
||||||
return hres;
|
return hres;
|
||||||
|
|
|
@ -3685,7 +3685,7 @@ HRESULT create_regexp_constr(script_ctx_t *ctx, DispatchEx **ret)
|
||||||
if(FAILED(hres))
|
if(FAILED(hres))
|
||||||
return hres;
|
return hres;
|
||||||
|
|
||||||
hres = create_builtin_function(ctx, RegExpConstr_value, PROPF_CONSTR, ®exp->dispex, ret);
|
hres = create_builtin_function(ctx, RegExpConstr_value, NULL, PROPF_CONSTR, ®exp->dispex, ret);
|
||||||
|
|
||||||
jsdisp_release(®exp->dispex);
|
jsdisp_release(®exp->dispex);
|
||||||
return hres;
|
return hres;
|
||||||
|
|
|
@ -1370,7 +1370,7 @@ HRESULT create_string_constr(script_ctx_t *ctx, DispatchEx **ret)
|
||||||
if(FAILED(hres))
|
if(FAILED(hres))
|
||||||
return hres;
|
return hres;
|
||||||
|
|
||||||
hres = create_builtin_function(ctx, StringConstr_value, PROPF_CONSTR, &string->dispex, ret);
|
hres = create_builtin_function(ctx, StringConstr_value, NULL, PROPF_CONSTR, &string->dispex, ret);
|
||||||
|
|
||||||
jsdisp_release(&string->dispex);
|
jsdisp_release(&string->dispex);
|
||||||
return hres;
|
return hres;
|
||||||
|
|
Loading…
Reference in New Issue