jscript: Use prototype for builtin RegExp properties.
This commit is contained in:
parent
3b80361a70
commit
1dfb75d9a3
@ -3807,6 +3807,23 @@ static const builtin_info_t RegExp_info = {
|
|||||||
NULL
|
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)
|
static HRESULT alloc_regexp(script_ctx_t *ctx, jsdisp_t *object_prototype, RegExpInstance **ret)
|
||||||
{
|
{
|
||||||
RegExpInstance *regexp;
|
RegExpInstance *regexp;
|
||||||
@ -3819,7 +3836,7 @@ static HRESULT alloc_regexp(script_ctx_t *ctx, jsdisp_t *object_prototype, RegEx
|
|||||||
if(object_prototype)
|
if(object_prototype)
|
||||||
hres = init_dispex(®exp->dispex, ctx, &RegExp_info, object_prototype);
|
hres = init_dispex(®exp->dispex, ctx, &RegExp_info, object_prototype);
|
||||||
else
|
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)) {
|
if(FAILED(hres)) {
|
||||||
heap_free(regexp);
|
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.hasOwnProperty('toFixed'), "Number.hasOwnProperty('toFixed') is true");
|
||||||
ok(Number.prototype.hasOwnProperty('toFixed'), "Number.prototype.hasOwnProperty('toFixed') is false");
|
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();
|
tmp = "" + new Object();
|
||||||
ok(tmp === "[object Object]", "'' + new Object() = " + tmp);
|
ok(tmp === "[object Object]", "'' + new Object() = " + tmp);
|
||||||
(tmp = new Array).f = Object.prototype.toString;
|
(tmp = new Array).f = Object.prototype.toString;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user