Module: wine Branch: master Commit: 1dfb75d9a38a4c14f74fff3d8eb1ad40cb37b140 URL: http://source.winehq.org/git/wine.git/?a=commit;h=1dfb75d9a38a4c14f74fff3d8e...
Author: Jacek Caban jacek@codeweavers.com Date: Tue Jul 24 13:17:32 2012 +0200
jscript: Use prototype for builtin RegExp properties.
---
dlls/jscript/regexp.c | 19 ++++++++++++++++++- dlls/jscript/tests/api.js | 7 +++++++ 2 files changed, 25 insertions(+), 1 deletions(-)
diff --git a/dlls/jscript/regexp.c b/dlls/jscript/regexp.c index 996f9f0..718a720 100644 --- a/dlls/jscript/regexp.c +++ b/dlls/jscript/regexp.c @@ -3807,6 +3807,23 @@ static const builtin_info_t RegExp_info = { NULL };
+static const builtin_prop_t RegExpInst_props[] = { + {globalW, RegExp_global, 0}, + {ignoreCaseW, RegExp_ignoreCase, 0}, + {lastIndexW, RegExp_lastIndex, 0}, + {multilineW, RegExp_multiline, 0}, + {sourceW, RegExp_source, 0} +}; + +static const builtin_info_t RegExpInst_info = { + JSCLASS_REGEXP, + {NULL, RegExp_value, 0}, + sizeof(RegExpInst_props)/sizeof(*RegExpInst_props), + RegExpInst_props, + RegExp_destructor, + NULL +}; + static HRESULT alloc_regexp(script_ctx_t *ctx, jsdisp_t *object_prototype, RegExpInstance **ret) { RegExpInstance *regexp; @@ -3819,7 +3836,7 @@ static HRESULT alloc_regexp(script_ctx_t *ctx, jsdisp_t *object_prototype, RegEx if(object_prototype) hres = init_dispex(®exp->dispex, ctx, &RegExp_info, object_prototype); else - hres = init_dispex_from_constr(®exp->dispex, ctx, &RegExp_info, ctx->regexp_constr); + hres = init_dispex_from_constr(®exp->dispex, ctx, &RegExpInst_info, ctx->regexp_constr);
if(FAILED(hres)) { heap_free(regexp); diff --git a/dlls/jscript/tests/api.js b/dlls/jscript/tests/api.js index fc787a9..9bc083d 100644 --- a/dlls/jscript/tests/api.js +++ b/dlls/jscript/tests/api.js @@ -232,6 +232,13 @@ ok(!obj.hasOwnProperty('toFixed'), "obj.hasOwnProperty('toFixed') is true"); ok(!Number.hasOwnProperty('toFixed'), "Number.hasOwnProperty('toFixed') is true"); ok(Number.prototype.hasOwnProperty('toFixed'), "Number.prototype.hasOwnProperty('toFixed') is false");
+obj = /x/; +ok(!obj.hasOwnProperty('exec'), "obj.hasOwnProperty('exec') is true"); +ok(obj.hasOwnProperty('source'), "obj.hasOwnProperty('source') is false"); +ok(!RegExp.hasOwnProperty('exec'), "RegExp.hasOwnProperty('exec') is true"); +ok(!RegExp.hasOwnProperty('source'), "RegExp.hasOwnProperty('source') is true"); +ok(RegExp.prototype.hasOwnProperty('source'), "RegExp.prototype.hasOwnProperty('source') is false"); + tmp = "" + new Object(); ok(tmp === "[object Object]", "'' + new Object() = " + tmp); (tmp = new Array).f = Object.prototype.toString;