From c9d05aabbad59d8d4fe9b5435c34ce7f0d4dc050 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Wed, 10 Mar 2021 17:26:57 +0100 Subject: [PATCH] Bug 703675: RegExp.prototype should be a regular expression object. --- jsbuiltin.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/jsbuiltin.c b/jsbuiltin.c index d5ca768..bf82b60 100644 --- a/jsbuiltin.c +++ b/jsbuiltin.c @@ -3,6 +3,7 @@ #include "jscompile.h" #include "jsvalue.h" #include "jsbuiltin.h" +#include "regexp.h" static void jsB_globalf(js_State *J, const char *name, js_CFunction cfun, int n) { @@ -198,9 +199,12 @@ void jsB_init(js_State *J) J->Boolean_prototype = jsV_newobject(J, JS_CBOOLEAN, J->Object_prototype); J->Number_prototype = jsV_newobject(J, JS_CNUMBER, J->Object_prototype); J->String_prototype = jsV_newobject(J, JS_CSTRING, J->Object_prototype); - J->RegExp_prototype = jsV_newobject(J, JS_COBJECT, J->Object_prototype); J->Date_prototype = jsV_newobject(J, JS_CDATE, J->Object_prototype); + J->RegExp_prototype = jsV_newobject(J, JS_CREGEXP, J->Object_prototype); + J->RegExp_prototype->u.r.prog = js_regcompx(J->alloc, J->actx, "(?:)", 0, NULL); + J->RegExp_prototype->u.r.source = js_strdup(J, "(?:)"); + /* All the native error types */ J->Error_prototype = jsV_newobject(J, JS_CERROR, J->Object_prototype); J->EvalError_prototype = jsV_newobject(J, JS_CERROR, J->Error_prototype);