ref: c9d05aabbad59d8d4fe9b5435c34ce7f0d4dc050
parent: a34fdf2af87cc13b1d85cd19812c4d0b722f3e3a
author: Tor Andersson <tor.andersson@artifex.com>
date: Wed Mar 10 12:26:57 EST 2021
Bug 703675: RegExp.prototype should be a regular expression object.
--- 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,8 +199,11 @@
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);