jscript: Store builtin constructor's length in instance object.
This commit is contained in:
parent
913278c5cb
commit
0cbe1574fe
|
@ -358,6 +358,9 @@ static HRESULT prop_put(DispatchEx *This, dispex_prop_t *prop, VARIANT *val,
|
|||
{
|
||||
HRESULT hres;
|
||||
|
||||
if(prop->flags & PROPF_CONST)
|
||||
return S_OK;
|
||||
|
||||
switch(prop->type) {
|
||||
case PROP_BUILTIN:
|
||||
if(!(prop->flags & PROPF_METHOD)) {
|
||||
|
@ -974,6 +977,18 @@ HRESULT jsdisp_propput_name(DispatchEx *obj, const WCHAR *name, VARIANT *val, js
|
|||
return prop_put(obj, prop, val, ei, caller);
|
||||
}
|
||||
|
||||
HRESULT jsdisp_propput_const(DispatchEx *obj, const WCHAR *name, VARIANT *val)
|
||||
{
|
||||
dispex_prop_t *prop;
|
||||
HRESULT hres;
|
||||
|
||||
hres = ensure_prop_name(obj, name, FALSE, PROPF_ENUM|PROPF_CONST, &prop);
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
|
||||
return VariantCopy(&prop->u.var, val);
|
||||
}
|
||||
|
||||
HRESULT jsdisp_propput_idx(DispatchEx *obj, DWORD idx, VARIANT *val, jsexcept_t *ei, IServiceProvider *caller)
|
||||
{
|
||||
WCHAR buf[12];
|
||||
|
|
|
@ -606,6 +606,15 @@ HRESULT create_builtin_function(script_ctx_t *ctx, builtin_invoke_t value_proc,
|
|||
if(FAILED(hres))
|
||||
return hres;
|
||||
|
||||
if(builtin_info) {
|
||||
VARIANT var;
|
||||
|
||||
V_VT(&var) = VT_I4;
|
||||
V_I4(&var) = function->length;
|
||||
hres = jsdisp_propput_const(&function->dispex, lengthW, &var);
|
||||
}
|
||||
|
||||
if(SUCCEEDED(hres))
|
||||
hres = set_prototype(ctx, &function->dispex, prototype);
|
||||
if(FAILED(hres)) {
|
||||
jsdisp_release(&function->dispex);
|
||||
|
|
|
@ -68,6 +68,7 @@ extern HINSTANCE jscript_hinstance;
|
|||
#define PROPF_METHOD 0x0100
|
||||
#define PROPF_ENUM 0x0200
|
||||
#define PROPF_CONSTR 0x0400
|
||||
#define PROPF_CONST 0x0800
|
||||
|
||||
/* NOTE: Keep in sync with names in Object.toString implementation */
|
||||
typedef enum {
|
||||
|
@ -203,6 +204,7 @@ HRESULT disp_propget(script_ctx_t*,IDispatch*,DISPID,VARIANT*,jsexcept_t*,IServi
|
|||
HRESULT disp_propput(script_ctx_t*,IDispatch*,DISPID,VARIANT*,jsexcept_t*,IServiceProvider*);
|
||||
HRESULT jsdisp_propget(DispatchEx*,DISPID,VARIANT*,jsexcept_t*,IServiceProvider*);
|
||||
HRESULT jsdisp_propput_name(DispatchEx*,const WCHAR*,VARIANT*,jsexcept_t*,IServiceProvider*);
|
||||
HRESULT jsdisp_propput_const(DispatchEx*,const WCHAR*,VARIANT*);
|
||||
HRESULT jsdisp_propput_idx(DispatchEx*,DWORD,VARIANT*,jsexcept_t*,IServiceProvider*);
|
||||
HRESULT jsdisp_propget_name(DispatchEx*,LPCWSTR,VARIANT*,jsexcept_t*,IServiceProvider*);
|
||||
HRESULT jsdisp_get_idx(DispatchEx*,DWORD,VARIANT*,jsexcept_t*,IServiceProvider*);
|
||||
|
@ -320,6 +322,7 @@ typedef struct {
|
|||
|
||||
#define REM_CHECK_GLOBAL 0x0001
|
||||
#define REM_RESET_INDEX 0x0002
|
||||
#define REM_NO_CTX_UPDATE 0x0004
|
||||
HRESULT regexp_match_next(script_ctx_t*,DispatchEx*,DWORD,const WCHAR*,DWORD,const WCHAR**,match_result_t**,
|
||||
DWORD*,DWORD*,match_result_t*);
|
||||
HRESULT regexp_match(script_ctx_t*,DispatchEx*,const WCHAR*,DWORD,BOOL,match_result_t**,DWORD*);
|
||||
|
|
|
@ -2129,7 +2129,7 @@ ok(ActiveXObject.length == 1, "ActiveXObject.length = " + ActiveXObject.length);
|
|||
ok(Array.length == 1, "Array.length = " + Array.length);
|
||||
ok(Boolean.length == 1, "Boolean.length = " + Boolean.length);
|
||||
ok(CollectGarbage.length == 0, "CollectGarbage.length = " + CollectGarbage.length);
|
||||
//ok(Date.length == 7, "Date.length = " + Date.length);
|
||||
ok(Date.length == 7, "Date.length = " + Date.length);
|
||||
ok(Enumerator.length == 7, "Enumerator.length = " + Enumerator.length);
|
||||
ok(Error.length == 1, "Error.length = " + Error.length);
|
||||
ok(EvalError.length == 1, "EvalError.length = " + EvalError.length);
|
||||
|
@ -2147,7 +2147,7 @@ ok(ScriptEngineMajorVersion.length == 0,
|
|||
"ScriptEngineMajorVersion.length = " + ScriptEngineMajorVersion.length);
|
||||
ok(ScriptEngineMinorVersion.length == 0,
|
||||
"ScriptEngineMinorVersion.length = " + ScriptEngineMinorVersion.length);
|
||||
//ok(String.length == 1, "String.length = " + String.length);
|
||||
ok(String.length == 1, "String.length = " + String.length);
|
||||
ok(SyntaxError.length == 1, "SyntaxError.length = " + SyntaxError.length);
|
||||
ok(TypeError.length == 1, "TypeError.length = " + TypeError.length);
|
||||
ok(URIError.length == 1, "URIError.length = " + URIError.length);
|
||||
|
@ -2164,4 +2164,7 @@ ok(parseFloat.length == 1, "parseFloat.length = " + parseFloat.length);
|
|||
ok(parseInt.length == 2, "parseInt.length = " + parseInt.length);
|
||||
ok(unescape.length == 1, "unescape.length = " + unescape.length);
|
||||
|
||||
String.length = 3;
|
||||
ok(String.length == 1, "String.length = " + String.length);
|
||||
|
||||
reportSuccess();
|
||||
|
|
Loading…
Reference in New Issue