From a2652e5bc46b411f894d0a343f6ea6a83f07e3e2 Mon Sep 17 00:00:00 2001 From: wolfbeast Date: Fri, 4 May 2018 12:08:48 +0200 Subject: Issue #325 Part 5: Remove non-Intl legacy code paths from js. --- js/src/jsstr.cpp | 2 -- 1 file changed, 2 deletions(-) (limited to 'js/src/jsstr.cpp') diff --git a/js/src/jsstr.cpp b/js/src/jsstr.cpp index 7adeed620..a97a73237 100644 --- a/js/src/jsstr.cpp +++ b/js/src/jsstr.cpp @@ -36,9 +36,7 @@ #include "jit/InlinableNatives.h" #include "js/Conversions.h" #include "js/UniquePtr.h" -#if ENABLE_INTL_API #include "unicode/unorm.h" -#endif #include "vm/GlobalObject.h" #include "vm/Interpreter.h" #include "vm/Opcodes.h" -- cgit v1.2.3 From 74c62cd3373e23fe77f509373f581c33872d813d Mon Sep 17 00:00:00 2001 From: wolfbeast Date: Fri, 4 May 2018 21:47:32 +0200 Subject: Issue #325 Part 14: Remove EXPOSE_INTL_API conditionals. --- js/src/jsstr.cpp | 41 ----------------------------------------- 1 file changed, 41 deletions(-) (limited to 'js/src/jsstr.cpp') diff --git a/js/src/jsstr.cpp b/js/src/jsstr.cpp index a97a73237..01b407626 100644 --- a/js/src/jsstr.cpp +++ b/js/src/jsstr.cpp @@ -897,38 +897,6 @@ js::str_toLocaleUpperCase(JSContext* cx, unsigned argc, Value* vp) return ToUpperCaseHelper(cx, args); } -#if !EXPOSE_INTL_API -bool -js::str_localeCompare(JSContext* cx, unsigned argc, Value* vp) -{ - CallArgs args = CallArgsFromVp(argc, vp); - RootedString str(cx, ToStringForStringFunction(cx, args.thisv())); - if (!str) - return false; - - RootedString thatStr(cx, ToString(cx, args.get(0))); - if (!thatStr) - return false; - - if (cx->runtime()->localeCallbacks && cx->runtime()->localeCallbacks->localeCompare) { - RootedValue result(cx); - if (!cx->runtime()->localeCallbacks->localeCompare(cx, str, thatStr, &result)) - return false; - - args.rval().set(result); - return true; - } - - int32_t result; - if (!CompareStrings(cx, str, thatStr, &result)) - return false; - - args.rval().setInt32(result); - return true; -} -#endif - -#if EXPOSE_INTL_API /* ES6 20140210 draft 21.1.3.12. */ bool js::str_normalize(JSContext* cx, unsigned argc, Value* vp) @@ -1005,7 +973,6 @@ js::str_normalize(JSContext* cx, unsigned argc, Value* vp) args.rval().setString(ns); return true; } -#endif bool js::str_charAt(JSContext* cx, unsigned argc, Value* vp) @@ -2597,15 +2564,9 @@ static const JSFunctionSpec string_methods[] = { JS_FN("trimRight", str_trimRight, 0,0), JS_FN("toLocaleLowerCase", str_toLocaleLowerCase, 0,0), JS_FN("toLocaleUpperCase", str_toLocaleUpperCase, 0,0), -#if EXPOSE_INTL_API JS_SELF_HOSTED_FN("localeCompare", "String_localeCompare", 1,0), -#else - JS_FN("localeCompare", str_localeCompare, 1,0), -#endif JS_SELF_HOSTED_FN("repeat", "String_repeat", 1,0), -#if EXPOSE_INTL_API JS_FN("normalize", str_normalize, 0,0), -#endif /* Perl-ish methods (search is actually Python-esque). */ JS_SELF_HOSTED_FN("match", "String_match", 1,0), @@ -2916,9 +2877,7 @@ static const JSFunctionSpec string_static_methods[] = { JS_SELF_HOSTED_FN("trimRight", "String_static_trimRight", 1,0), JS_SELF_HOSTED_FN("toLocaleLowerCase","String_static_toLocaleLowerCase",1,0), JS_SELF_HOSTED_FN("toLocaleUpperCase","String_static_toLocaleUpperCase",1,0), -#if EXPOSE_INTL_API JS_SELF_HOSTED_FN("normalize", "String_static_normalize", 1,0), -#endif JS_SELF_HOSTED_FN("concat", "String_static_concat", 2,0), JS_SELF_HOSTED_FN("localeCompare", "String_static_localeCompare", 2,0), -- cgit v1.2.3 From 240f52db8e97c9c65592771ddffb6efbdd210c15 Mon Sep 17 00:00:00 2001 From: wolfbeast Date: Thu, 7 Jun 2018 13:21:06 +0200 Subject: Reinstate string.prototype.contains() This adds a compatibility function aliased to string.prototype.includes(). --- js/src/jsstr.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'js/src/jsstr.cpp') diff --git a/js/src/jsstr.cpp b/js/src/jsstr.cpp index 01b407626..4151d012b 100644 --- a/js/src/jsstr.cpp +++ b/js/src/jsstr.cpp @@ -1534,7 +1534,7 @@ RopeMatch(JSContext* cx, JSRope* text, JSLinearString* pat, int* match) return true; } -/* ES6 draft rc4 21.1.3.7. */ +/* ES6 2015 ST 21.1.3.7 String.prototype.includes */ bool js::str_includes(JSContext* cx, unsigned argc, Value* vp) { @@ -1591,6 +1591,13 @@ js::str_includes(JSContext* cx, unsigned argc, Value* vp) return true; } +/* ES6 draft