]> git.kaiwu.me - quickjs.git/commitdiff
Don't call well-known Symbol methods for RegExp on primitive values
authorFabrice Bellard <fabrice@bellard.org>
Thu, 11 Dec 2025 18:27:19 +0000 (19:27 +0100)
committerFabrice Bellard <fabrice@bellard.org>
Thu, 11 Dec 2025 18:27:19 +0000 (19:27 +0100)
TODO
quickjs.c
test262.conf

diff --git a/TODO b/TODO
index 9ddeaad63c9825cdfc2b5cb1e89cb709d0921d61..a0cb6043e48e0966b7fdb82bdc0174df3e296716 100644 (file)
--- a/TODO
+++ b/TODO
@@ -63,4 +63,4 @@ Test262o:   0/11262 errors, 463 excluded
 Test262o commit: 7da91bceb9ce7613f87db47ddd1292a2dda58b42 (es5-tests branch)
 
 Test262:
-Result: 66/83295 errors, 2590 excluded, 5767 skipped
+Result: 66/83341 errors, 2567 excluded, 5767 skipped
index 3e88d7b9f703c6c019df4db84cd8b16b81b16404..f86379f70d4dbc98b78c8be2ab321ece2400de99 100644 (file)
--- a/quickjs.c
+++ b/quickjs.c
@@ -45142,7 +45142,7 @@ static JSValue js_string_match(JSContext *ctx, JSValueConst this_val,
     if (JS_IsUndefined(O) || JS_IsNull(O))
         return JS_ThrowTypeError(ctx, "cannot convert to object");
 
-    if (!JS_IsUndefined(regexp) && !JS_IsNull(regexp)) {
+    if (JS_IsObject(regexp)) {
         matcher = JS_GetProperty(ctx, regexp, atom);
         if (JS_IsException(matcher))
             return JS_EXCEPTION;
@@ -45322,7 +45322,7 @@ static JSValue js_string_replace(JSContext *ctx, JSValueConst this_val,
     replaceValue_str = JS_UNDEFINED;
     repl_str = JS_UNDEFINED;
 
-    if (!JS_IsUndefined(searchValue) && !JS_IsNull(searchValue)) {
+    if (JS_IsObject(searchValue)) {
         JSValue replacer;
         if (is_replaceAll) {
             if (check_regexp_g_flag(ctx, searchValue) < 0)
@@ -45433,7 +45433,7 @@ static JSValue js_string_split(JSContext *ctx, JSValueConst this_val,
     A = JS_UNDEFINED;
     R = JS_UNDEFINED;
 
-    if (!JS_IsUndefined(separator) && !JS_IsNull(separator)) {
+    if (JS_IsObject(separator)) {
         JSValue splitter;
         splitter = JS_GetProperty(ctx, separator, JS_ATOM_Symbol_split);
         if (JS_IsException(splitter))
index 308f245e18db06e7da7936b5239e90155c03ece7..aa76e639510e203eb8373d920674098e6e69f1dd 100644 (file)
@@ -255,54 +255,6 @@ test262/test/built-ins/ThrowTypeError/unique-per-realm-function-proto.js
 #test262/test/built-ins/RegExp/CharacterClassEscapes/
 #test262/test/built-ins/RegExp/property-escapes/
 
-# not yet in official specification
-test262/test/built-ins/String/prototype/match/cstm-matcher-on-bigint-primitive.js
-test262/test/built-ins/String/prototype/match/cstm-matcher-on-bigint-primitive.js
-test262/test/built-ins/String/prototype/match/cstm-matcher-on-boolean-primitive.js
-test262/test/built-ins/String/prototype/match/cstm-matcher-on-boolean-primitive.js
-test262/test/built-ins/String/prototype/match/cstm-matcher-on-number-primitive.js
-test262/test/built-ins/String/prototype/match/cstm-matcher-on-number-primitive.js
-test262/test/built-ins/String/prototype/match/cstm-matcher-on-string-primitive.js
-test262/test/built-ins/String/prototype/match/cstm-matcher-on-string-primitive.js
-test262/test/built-ins/String/prototype/matchAll/cstm-matchall-on-bigint-primitive.js
-test262/test/built-ins/String/prototype/matchAll/cstm-matchall-on-bigint-primitive.js
-test262/test/built-ins/String/prototype/matchAll/cstm-matchall-on-number-primitive.js
-test262/test/built-ins/String/prototype/matchAll/cstm-matchall-on-number-primitive.js
-test262/test/built-ins/String/prototype/matchAll/cstm-matchall-on-string-primitive.js
-test262/test/built-ins/String/prototype/matchAll/cstm-matchall-on-string-primitive.js
-test262/test/built-ins/String/prototype/replace/cstm-replace-on-bigint-primitive.js
-test262/test/built-ins/String/prototype/replace/cstm-replace-on-bigint-primitive.js
-test262/test/built-ins/String/prototype/replace/cstm-replace-on-boolean-primitive.js
-test262/test/built-ins/String/prototype/replace/cstm-replace-on-boolean-primitive.js
-test262/test/built-ins/String/prototype/replace/cstm-replace-on-number-primitive.js
-test262/test/built-ins/String/prototype/replace/cstm-replace-on-number-primitive.js
-test262/test/built-ins/String/prototype/replace/cstm-replace-on-string-primitive.js
-test262/test/built-ins/String/prototype/replace/cstm-replace-on-string-primitive.js
-test262/test/built-ins/String/prototype/replaceAll/cstm-replaceall-on-bigint-primitive.js
-test262/test/built-ins/String/prototype/replaceAll/cstm-replaceall-on-bigint-primitive.js
-test262/test/built-ins/String/prototype/replaceAll/cstm-replaceall-on-boolean-primitive.js
-test262/test/built-ins/String/prototype/replaceAll/cstm-replaceall-on-boolean-primitive.js
-test262/test/built-ins/String/prototype/replaceAll/cstm-replaceall-on-number-primitive.js
-test262/test/built-ins/String/prototype/replaceAll/cstm-replaceall-on-number-primitive.js
-test262/test/built-ins/String/prototype/replaceAll/cstm-replaceall-on-string-primitive.js
-test262/test/built-ins/String/prototype/replaceAll/cstm-replaceall-on-string-primitive.js
-test262/test/built-ins/String/prototype/search/cstm-search-on-bigint-primitive.js
-test262/test/built-ins/String/prototype/search/cstm-search-on-bigint-primitive.js
-test262/test/built-ins/String/prototype/search/cstm-search-on-boolean-primitive.js
-test262/test/built-ins/String/prototype/search/cstm-search-on-boolean-primitive.js
-test262/test/built-ins/String/prototype/search/cstm-search-on-number-primitive.js
-test262/test/built-ins/String/prototype/search/cstm-search-on-number-primitive.js
-test262/test/built-ins/String/prototype/search/cstm-search-on-string-primitive.js
-test262/test/built-ins/String/prototype/search/cstm-search-on-string-primitive.js
-test262/test/built-ins/String/prototype/split/cstm-split-on-bigint-primitive.js
-test262/test/built-ins/String/prototype/split/cstm-split-on-bigint-primitive.js
-test262/test/built-ins/String/prototype/split/cstm-split-on-boolean-primitive.js
-test262/test/built-ins/String/prototype/split/cstm-split-on-boolean-primitive.js
-test262/test/built-ins/String/prototype/split/cstm-split-on-number-primitive.js
-test262/test/built-ins/String/prototype/split/cstm-split-on-number-primitive.js
-test262/test/built-ins/String/prototype/split/cstm-split-on-string-primitive.js
-test262/test/built-ins/String/prototype/split/cstm-split-on-string-primitive.js
-
 ####################################
 # staging tests