Commit 1dfb75d9 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

jscript: Use prototype for builtin RegExp properties.

parent 3b80361a
......@@ -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(&regexp->dispex, ctx, &RegExp_info, object_prototype);
else
hres = init_dispex_from_constr(&regexp->dispex, ctx, &RegExp_info, ctx->regexp_constr);
hres = init_dispex_from_constr(&regexp->dispex, ctx, &RegExpInst_info, ctx->regexp_constr);
if(FAILED(hres)) {
heap_free(regexp);
......
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment