Merge remote-tracking branch 'origin/master' into custom

This commit is contained in:
roytam1 2021-02-12 10:52:27 +08:00
commit b1db2370ed
37 changed files with 1562 additions and 1471 deletions

View file

@ -1,5 +1,5 @@
<?xml version='1.0' encoding='utf-8'?> <?xml version='1.0' encoding='utf-8'?>
<blocklist lastupdate="1612384668000" <blocklist lastupdate="1612644720000"
xmlns="http://www.mozilla.org/2006/addons-blocklist"> xmlns="http://www.mozilla.org/2006/addons-blocklist">
<emItems> <emItems>
<emItem blockID="i545" id="superlrcs@svenyor.net"> <emItem blockID="i545" id="superlrcs@svenyor.net">
@ -2532,7 +2532,7 @@ xmlns="http://www.mozilla.org/2006/addons-blocklist">
<emItem blockID="pm117" id="treestyletabforpm@oinkoink"> <emItem blockID="pm117" id="treestyletabforpm@oinkoink">
<versionRange minVersion="0" maxVersion="0.0.5" severity="3"> <versionRange minVersion="0" maxVersion="0.0.5" severity="3">
</versionRange> </versionRange>
<emItem> </emItem>
</emItems> </emItems>
<pluginItems> <pluginItems>
<pluginItem blockID="p26"> <pluginItem blockID="p26">

Binary file not shown.

View file

@ -32,6 +32,14 @@
# define moz_dont_include_mozalloc_for_cstdlib # define moz_dont_include_mozalloc_for_cstdlib
#endif #endif
#ifndef moz_dont_include_mozalloc_for_type_traits
# define moz_dont_include_mozalloc_for_type_traits
#endif
#ifndef moz_dont_include_mozalloc_for_limits
# define moz_dont_include_mozalloc_for_limits
#endif
// Include mozalloc after the STL header and all other headers it includes // Include mozalloc after the STL header and all other headers it includes
// have been preprocessed. // have been preprocessed.
#if !defined(MOZ_INCLUDE_MOZALLOC_H) && \ #if !defined(MOZ_INCLUDE_MOZALLOC_H) && \

View file

@ -863,13 +863,22 @@ gl::ErrorOrResult<GLuint> InternalFormat::computeDepthPitch(GLenum formatType,
GLint rowLength, GLint rowLength,
GLint imageHeight) const GLint imageHeight) const
{ {
GLuint rows = CheckedNumeric<GLuint> pixelsHeight(imageHeight > 0 ? static_cast<GLuint>(imageHeight)
(imageHeight > 0 ? static_cast<GLuint>(imageHeight) : static_cast<GLuint>(height)); : static_cast<GLuint>(height));
CheckedNumeric<GLuint> rowCount;
if (compressed) {
CheckedNumeric<GLuint> checkedBlockHeight(compressedBlockHeight);
rowCount = (pixelsHeight + checkedBlockHeight - 1u) / checkedBlockHeight;
} else {
rowCount = pixelsHeight;
}
GLuint rowPitch = 0; GLuint rowPitch = 0;
ANGLE_TRY_RESULT(computeRowPitch(formatType, width, alignment, rowLength), rowPitch); ANGLE_TRY_RESULT(computeRowPitch(formatType, width, alignment, rowLength), rowPitch);
CheckedNumeric<GLuint> checkedRowPitch(rowPitch); CheckedNumeric<GLuint> checkedRowPitch(rowPitch);
auto depthPitch = checkedRowPitch * rows; auto depthPitch = checkedRowPitch * rowCount;
ANGLE_TRY_CHECKED_MATH(depthPitch); ANGLE_TRY_CHECKED_MATH(depthPitch);
return depthPitch.ValueOrDie(); return depthPitch.ValueOrDie();
} }

View file

@ -24,10 +24,12 @@
* Red Hat Author(s): Behdad Esfahbod * Red Hat Author(s): Behdad Esfahbod
*/ */
#ifndef __FreeBSD__
/* http://www.oracle.com/technetwork/articles/servers-storage-dev/standardheaderfiles-453865.html */ /* http://www.oracle.com/technetwork/articles/servers-storage-dev/standardheaderfiles-453865.html */
#ifndef _POSIX_C_SOURCE #ifndef _POSIX_C_SOURCE
#define _POSIX_C_SOURCE 199309L #define _POSIX_C_SOURCE 199309L
#endif #endif
#endif
#include "hb-private.hh" #include "hb-private.hh"

View file

@ -1,5 +1,7 @@
commit 4d027901ef4d3288b2ca264ba1f532cf826190ac commit 95120170afa0cf622a18da37d3af58abf8ecd40e
Author: Yoshito Umaoka <yumaoka@users.noreply.github.com> Author: Yoshito Umaoka <yumaoka@users.noreply.github.com>
Date: Fri Sep 13 18:23:18 2019 -0400 Date: Wed Jan 27 09:48:37 2021 -0500
ICU-20823 ICU time zone data updates for 2019c ICU-21467 tzdata 2021a updates. Also updated build script. With this … (#17)
change, we no longer release ICU time zone data updates for ICU 4.2 or older releases.

View file

@ -1 +1 @@
2019c 2021a

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -1,5 +1,6 @@
// © 2016 and later: Unicode, Inc. and others. // © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html#License // License & terms of use: http://www.unicode.org/copyright.html
// Generated using tools/cldr/cldr-to-icu/build-icu-data.xml
metaZones:table(nofallback){ metaZones:table(nofallback){
mapTimezones{ mapTimezones{
Acre{ Acre{
@ -289,6 +290,7 @@ metaZones:table(nofallback){
RS{"Europe/Belgrade"} RS{"Europe/Belgrade"}
SE{"Europe/Stockholm"} SE{"Europe/Stockholm"}
SI{"Europe/Ljubljana"} SI{"Europe/Ljubljana"}
SJ{"Arctic/Longyearbyen"}
SK{"Europe/Bratislava"} SK{"Europe/Bratislava"}
SM{"Europe/San_Marino"} SM{"Europe/San_Marino"}
TN{"Africa/Tunis"} TN{"Africa/Tunis"}
@ -894,6 +896,11 @@ metaZones:table(nofallback){
{ {
"Africa_Eastern", "Africa_Eastern",
"2000-01-15 10:00", "2000-01-15 10:00",
"2021-01-31 21:00",
}
{
"Africa_Central",
"2021-01-31 21:00",
"9999-12-31 23:59", "9999-12-31 23:59",
} }
} }
@ -1273,6 +1280,11 @@ metaZones:table(nofallback){
{ {
"Argentina_Western", "Argentina_Western",
"2008-01-21 02:00", "2008-01-21 02:00",
"2009-10-11 04:00",
}
{
"Argentina",
"2009-10-11 04:00",
"9999-12-31 23:59", "9999-12-31 23:59",
} }
} }
@ -1548,6 +1560,11 @@ metaZones:table(nofallback){
{ {
"America_Pacific", "America_Pacific",
"1973-10-28 09:00", "1973-10-28 09:00",
"2020-11-01 07:00",
}
{
"America_Mountain",
"2020-11-01 07:00",
"9999-12-31 23:59", "9999-12-31 23:59",
} }
} }
@ -1653,11 +1670,11 @@ metaZones:table(nofallback){
{ {
"America_Eastern", "America_Eastern",
"1970-01-01 00:00", "1970-01-01 00:00",
"2015-11-01 06:00", "2015-03-08 07:00",
} }
{ {
"Atlantic", "Atlantic",
"2015-11-01 06:00", "2015-03-08 07:00",
"2018-03-11 07:00", "2018-03-11 07:00",
} }
{ {
@ -2521,6 +2538,13 @@ metaZones:table(nofallback){
"America:Whitehorse"{ "America:Whitehorse"{
{ {
"America_Pacific", "America_Pacific",
"1970-01-01 00:00",
"2020-11-01 07:00",
}
{
"America_Mountain",
"2020-11-01 07:00",
"9999-12-31 23:59",
} }
} }
"America:Winnipeg"{ "America:Winnipeg"{
@ -2579,6 +2603,31 @@ metaZones:table(nofallback){
{ {
"Australia_Western", "Australia_Western",
"2018-03-10 17:00", "2018-03-10 17:00",
"2018-10-06 20:00",
}
{
"Casey",
"2018-10-06 20:00",
"2019-03-16 16:00",
}
{
"Australia_Western",
"2019-03-16 16:00",
"2019-10-03 19:00",
}
{
"Casey",
"2019-10-03 19:00",
"2020-03-07 16:00",
}
{
"Australia_Western",
"2020-03-07 16:00",
"2020-10-03 16:01",
}
{
"Casey",
"2020-10-03 16:01",
"9999-12-31 23:59", "9999-12-31 23:59",
} }
} }
@ -2595,13 +2644,6 @@ metaZones:table(nofallback){
"Antarctica:Macquarie"{ "Antarctica:Macquarie"{
{ {
"Australia_Eastern", "Australia_Eastern",
"1970-01-01 00:00",
"2010-04-03 16:00",
}
{
"Macquarie",
"2010-04-03 16:00",
"9999-12-31 23:59",
} }
} }
"Antarctica:Mawson"{ "Antarctica:Mawson"{
@ -2720,7 +2762,7 @@ metaZones:table(nofallback){
} }
{ {
"Kazakhstan_Western", "Kazakhstan_Western",
"2005-10-30 21:00", "2004-10-30 21:00",
"9999-12-31 23:59", "9999-12-31 23:59",
} }
} }
@ -2830,6 +2872,11 @@ metaZones:table(nofallback){
{ {
"Choibalsan", "Choibalsan",
"1983-03-31 16:00", "1983-03-31 16:00",
"2008-03-30 15:00",
}
{
"Mongolia",
"2008-03-30 15:00",
"9999-12-31 23:59", "9999-12-31 23:59",
} }
} }
@ -4013,18 +4060,6 @@ metaZones:table(nofallback){
"Europe:Volgograd"{ "Europe:Volgograd"{
{ {
"Volgograd", "Volgograd",
"1970-01-01 00:00",
"1992-03-28 22:00",
}
{
"Moscow",
"1992-03-28 22:00",
"2018-10-27 23:00",
}
{
"Volgograd",
"2018-10-27 23:00",
"9999-12-31 23:59",
} }
} }
"Europe:Warsaw"{ "Europe:Warsaw"{

View file

@ -1,5 +1,6 @@
// © 2016 and later: Unicode, Inc. and others. // © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html#License // License & terms of use: http://www.unicode.org/copyright.html
// Generated using tools/cldr/cldr-to-icu/build-icu-data.xml
timezoneTypes:table(nofallback){ timezoneTypes:table(nofallback){
bcpTypeAlias{ bcpTypeAlias{
tz{ tz{
@ -27,6 +28,7 @@ timezoneTypes:table(nofallback){
"America:Indiana:Indianapolis"{"America/Indianapolis"} "America:Indiana:Indianapolis"{"America/Indianapolis"}
"America:Kentucky:Louisville"{"America/Louisville"} "America:Kentucky:Louisville"{"America/Louisville"}
"America:Knox_IN"{"America/Indiana/Knox"} "America:Knox_IN"{"America/Indiana/Knox"}
"America:Nuuk"{"America/Godthab"}
"America:Porto_Acre"{"America/Rio_Branco"} "America:Porto_Acre"{"America/Rio_Branco"}
"America:Rosario"{"America/Cordoba"} "America:Rosario"{"America/Cordoba"}
"America:Shiprock"{"America/Denver"} "America:Shiprock"{"America/Denver"}

View file

@ -1,5 +1,6 @@
// © 2016 and later: Unicode, Inc. and others. // © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html#License // License & terms of use: http://www.unicode.org/copyright.html
// Generated using tools/cldr/cldr-to-icu/build-icu-data.xml
windowsZones:table(nofallback){ windowsZones:table(nofallback){
mapTimezones{ mapTimezones{
"AUS Central Standard Time"{ "AUS Central Standard Time"{
@ -156,7 +157,7 @@ windowsZones:table(nofallback){
} }
"Central Pacific Standard Time"{ "Central Pacific Standard Time"{
001{"Pacific/Guadalcanal"} 001{"Pacific/Guadalcanal"}
AU{"Antarctica/Macquarie"} AQ{"Antarctica/Casey"}
FM{"Pacific/Ponape Pacific/Kosrae"} FM{"Pacific/Ponape Pacific/Kosrae"}
NC{"Pacific/Noumea"} NC{"Pacific/Noumea"}
SB{"Pacific/Guadalcanal"} SB{"Pacific/Guadalcanal"}
@ -212,7 +213,6 @@ windowsZones:table(nofallback){
KM{"Indian/Comoro"} KM{"Indian/Comoro"}
MG{"Indian/Antananarivo"} MG{"Indian/Antananarivo"}
SO{"Africa/Mogadishu"} SO{"Africa/Mogadishu"}
SS{"Africa/Juba"}
TZ{"Africa/Dar_es_Salaam"} TZ{"Africa/Dar_es_Salaam"}
UG{"Africa/Kampala"} UG{"Africa/Kampala"}
YT{"Indian/Mayotte"} YT{"Indian/Mayotte"}
@ -466,7 +466,7 @@ windowsZones:table(nofallback){
} }
"Pacific Standard Time"{ "Pacific Standard Time"{
001{"America/Los_Angeles"} 001{"America/Los_Angeles"}
CA{"America/Vancouver America/Dawson America/Whitehorse"} CA{"America/Vancouver"}
US{"America/Los_Angeles"} US{"America/Los_Angeles"}
ZZ{"PST8PDT"} ZZ{"PST8PDT"}
} }
@ -593,7 +593,6 @@ windowsZones:table(nofallback){
} }
"Singapore Standard Time"{ "Singapore Standard Time"{
001{"Asia/Singapore"} 001{"Asia/Singapore"}
AQ{"Antarctica/Casey"}
BN{"Asia/Brunei"} BN{"Asia/Brunei"}
ID{"Asia/Makassar"} ID{"Asia/Makassar"}
MY{"Asia/Kuala_Lumpur Asia/Kuching"} MY{"Asia/Kuala_Lumpur Asia/Kuching"}
@ -610,6 +609,7 @@ windowsZones:table(nofallback){
MW{"Africa/Blantyre"} MW{"Africa/Blantyre"}
MZ{"Africa/Maputo"} MZ{"Africa/Maputo"}
RW{"Africa/Kigali"} RW{"Africa/Kigali"}
SS{"Africa/Juba"}
SZ{"Africa/Mbabane"} SZ{"Africa/Mbabane"}
ZA{"Africa/Johannesburg"} ZA{"Africa/Johannesburg"}
ZM{"Africa/Lusaka"} ZM{"Africa/Lusaka"}
@ -634,7 +634,7 @@ windowsZones:table(nofallback){
} }
"Tasmania Standard Time"{ "Tasmania Standard Time"{
001{"Australia/Hobart"} 001{"Australia/Hobart"}
AU{"Australia/Hobart Australia/Currie"} AU{"Australia/Hobart Australia/Currie Antarctica/Macquarie"}
} }
"Tocantins Standard Time"{ "Tocantins Standard Time"{
001{"America/Araguaina"} 001{"America/Araguaina"}
@ -674,7 +674,6 @@ windowsZones:table(nofallback){
} }
"US Mountain Standard Time"{ "US Mountain Standard Time"{
001{"America/Phoenix"} 001{"America/Phoenix"}
CA{"America/Dawson_Creek America/Creston America/Fort_Nelson"}
MX{"America/Hermosillo"} MX{"America/Hermosillo"}
US{"America/Phoenix"} US{"America/Phoenix"}
ZZ{"Etc/GMT+7"} ZZ{"Etc/GMT+7"}
@ -811,5 +810,12 @@ windowsZones:table(nofallback){
001{"Asia/Yakutsk"} 001{"Asia/Yakutsk"}
RU{"Asia/Yakutsk Asia/Khandyga"} RU{"Asia/Yakutsk Asia/Khandyga"}
} }
"Yukon Standard Time"{
001{"America/Whitehorse"}
CA{
"America/Whitehorse America/Creston America/Dawson America/Dawson_Cre"
"ek America/Fort_Nelson"
}
}
} }
} }

File diff suppressed because it is too large Load diff

View file

@ -141,35 +141,29 @@ template <typename CharT>
static bool static bool
EvalStringMightBeJSON(const mozilla::Range<const CharT> chars) EvalStringMightBeJSON(const mozilla::Range<const CharT> chars)
{ {
// If the eval string starts with '(' or '[' and ends with ')' or ']', it may be JSON. // If the eval string starts with '(' or '[' and ends with ')' or ']', it
// Try the JSON parser first because it's much faster. If the eval string // may be JSON. Try the JSON parser first because it's much faster. If
// isn't JSON, JSON parsing will probably fail quickly, so little time // the eval string isn't JSON, JSON parsing will probably fail quickly, so
// will be lost. // little time will be lost.
size_t length = chars.length(); size_t length = chars.length();
if (length > 2 && if (length < 2)
((chars[0] == '[' && chars[length - 1] == ']') || return false;
(chars[0] == '(' && chars[length - 1] == ')')))
{
// Remarkably, JavaScript syntax is not a superset of JSON syntax:
// strings in JavaScript cannot contain the Unicode line and paragraph
// terminator characters U+2028 and U+2029, but strings in JSON can.
// Rather than force the JSON parser to handle this quirk when used by
// eval, we simply don't use the JSON parser when either character
// appears in the provided string. See bug 657367.
if (sizeof(CharT) > 1) {
for (RangedPtr<const CharT> cp = chars.begin() + 1, end = chars.end() - 1;
cp < end;
cp++)
{
char16_t c = *cp;
if (c == 0x2028 || c == 0x2029)
return false;
}
}
return true; // It used to be that strings in JavaScript forbid U+2028 LINE SEPARATOR
} // and U+2029 PARAGRAPH SEPARATOR, so something like
return false; //
// eval("['" + "\u2028" + "']");
//
// i.e. an array containing a string with a line separator in it, *would*
// be JSON but *would not* be valid JavaScript. Handing such a string to
// the JSON parser would then fail to recognize a syntax error. As of
// <https://tc39.github.io/proposal-json-superset/> JavaScript strings may
// contain these two code points, so it's safe to JSON-parse eval strings
// that contain them.
CharT first = chars[0], last = chars[length - 1];
return (first == '[' && last == ']') ||
(first == '(' && last == ')');
} }
template <typename CharT> template <typename CharT>

View file

@ -1,5 +1,5 @@
// Generated by make_intl_data.py. DO NOT EDIT. // Generated by make_intl_data.py. DO NOT EDIT.
// tzdata version = 2019c // tzdata version = 2021a
#ifndef builtin_IntlTimeZoneData_h #ifndef builtin_IntlTimeZoneData_h
#define builtin_IntlTimeZoneData_h #define builtin_IntlTimeZoneData_h
@ -22,6 +22,7 @@ const char* const ianaZonesTreatedAsLinksByICU[] = {
"America/Ensenada", // America/Tijuana [backzone] "America/Ensenada", // America/Tijuana [backzone]
"America/Indiana/Indianapolis", // America/Indianapolis [northamerica] "America/Indiana/Indianapolis", // America/Indianapolis [northamerica]
"America/Kentucky/Louisville", // America/Louisville [northamerica] "America/Kentucky/Louisville", // America/Louisville [northamerica]
"America/Nuuk", // America/Godthab [europe]
"America/Rosario", // America/Cordoba [backzone] "America/Rosario", // America/Cordoba [backzone]
"Asia/Chongqing", // Asia/Shanghai [backzone] "Asia/Chongqing", // Asia/Shanghai [backzone]
"Asia/Harbin", // Asia/Shanghai [backzone] "Asia/Harbin", // Asia/Shanghai [backzone]
@ -56,6 +57,7 @@ const LinkAndTarget ianaLinksCanonicalizedDifferentlyByICU[] = {
{ "America/Catamarca", "America/Argentina/Catamarca" }, // America/Catamarca [backward] { "America/Catamarca", "America/Argentina/Catamarca" }, // America/Catamarca [backward]
{ "America/Cordoba", "America/Argentina/Cordoba" }, // America/Cordoba [backward] { "America/Cordoba", "America/Argentina/Cordoba" }, // America/Cordoba [backward]
{ "America/Fort_Wayne", "America/Indiana/Indianapolis" }, // America/Indianapolis [backward] { "America/Fort_Wayne", "America/Indiana/Indianapolis" }, // America/Indianapolis [backward]
{ "America/Godthab", "America/Nuuk" }, // America/Godthab [backward]
{ "America/Indianapolis", "America/Indiana/Indianapolis" }, // America/Indianapolis [backward] { "America/Indianapolis", "America/Indiana/Indianapolis" }, // America/Indianapolis [backward]
{ "America/Jujuy", "America/Argentina/Jujuy" }, // America/Jujuy [backward] { "America/Jujuy", "America/Argentina/Jujuy" }, // America/Jujuy [backward]
{ "America/Kralendijk", "America/Curacao" }, // America/Kralendijk [southamerica] { "America/Kralendijk", "America/Curacao" }, // America/Kralendijk [southamerica]

View file

@ -603,6 +603,10 @@ TokenStream::TokenBuf::findEOLMax(size_t start, size_t max)
if (n >= max) if (n >= max)
break; break;
n++; n++;
// This stops at U+2028 LINE SEPARATOR or U+2029 PARAGRAPH SEPARATOR in
// string and template literals. These code points do affect line and
// column coordinates, even as they encode their literal values.
if (TokenBuf::isRawEOLChar(*p++)) if (TokenBuf::isRawEOLChar(*p++))
break; break;
} }
@ -2129,8 +2133,9 @@ TokenStream::getStringOrTemplateToken(int untilChar, Token** tp)
} }
break; break;
} }
} else if (TokenBuf::isRawEOLChar(c)) { } else if (c == '\r' || c == '\n') {
if (!parsingTemplate) { if (!parsingTemplate) {
// String literals don't allow ASCII line breaks.
ungetCharIgnoreEOL(c); ungetCharIgnoreEOL(c);
error(JSMSG_UNTERMINATED_STRING); error(JSMSG_UNTERMINATED_STRING);
return false; return false;
@ -2138,10 +2143,18 @@ TokenStream::getStringOrTemplateToken(int untilChar, Token** tp)
if (c == '\r') { if (c == '\r') {
c = '\n'; c = '\n';
if (userbuf.peekRawChar() == '\n') if (userbuf.peekRawChar() == '\n')
// Treat CRLF as a single line break.
skipCharsIgnoreEOL(1); skipCharsIgnoreEOL(1);
} }
updateLineInfoForEOL(); updateLineInfoForEOL();
updateFlagsForEOL(); updateFlagsForEOL();
} else if (c == LINE_SEPARATOR || c == PARA_SEPARATOR) {
// U+2028 LINE SEPARATOR and U+2029 PARAGRAPH SEPARATOR encode
// their literal values in template literals and (as of the
// JSON superset proposal) string literals, but they still count
// as line terminators when computing line/column coordinates.
updateLineInfoForEOL();
updateFlagsForEOL();
} else if (parsingTemplate && c == '$') { } else if (parsingTemplate && c == '$') {
if ((nc = getCharIgnoreEOL()) == '{') if ((nc = getCharIgnoreEOL()) == '{')
break; break;

View file

@ -55,13 +55,10 @@ function testEvalHackNotJSON() {
arr = eval("[]; var z; [1, 2, 3, \"abc\u1200\"]"); arr = eval("[]; var z; [1, 2, 3, \"abc\u1200\"]");
assertEq(JSON.stringify(arr), '[1,2,3,"abc\u1200"]'); assertEq(JSON.stringify(arr), '[1,2,3,"abc\u1200"]');
try { // JSON superset
eval("[1, 2, 3, \"abc\u2028\"]"); var arr = eval("[1, 2, 3, \"abc\u2028\"]");
throw new Error("U+2028 shouldn't eval"); assertEq(arr.length, 4);
} catch (e) { assertEq(arr[3], "abc\u2028");
assertEq(e instanceof SyntaxError, true,
"should have thrown a SyntaxError, instead got " + e);
}
} }
testEvalHackNotJSON(); testEvalHackNotJSON();

View file

@ -39,78 +39,122 @@ const Class js::JSONClass = {
JSCLASS_HAS_CACHED_PROTO(JSProto_JSON) JSCLASS_HAS_CACHED_PROTO(JSProto_JSON)
}; };
static inline bool /* ES5 15.12.3 Quote.
IsQuoteSpecialCharacter(char16_t c) * Requires that the destination has enough space allocated for src after escaping
* (that is, `2 + 6 * (srcEnd - srcBegin)` characters).
*/
template <typename SrcCharT, typename DstCharT>
static MOZ_ALWAYS_INLINE RangedPtr<DstCharT>
InfallibleQuote(RangedPtr<const SrcCharT> srcBegin, RangedPtr<const SrcCharT> srcEnd, RangedPtr<DstCharT> dstPtr)
{ {
static_assert('\b' < ' ', "'\\b' must be treated as special below"); // Maps characters < 256 to the value that must follow the '\\' in the quoted string.
static_assert('\f' < ' ', "'\\f' must be treated as special below"); // Entries with 'u' are handled as \\u00xy, and entries with 0 are not escaped in any way.
static_assert('\n' < ' ', "'\\n' must be treated as special below"); // Characters >= 256 are all assumed to be unescaped.
static_assert('\r' < ' ', "'\\r' must be treated as special below"); static const Latin1Char escapeLookup[256] = {
static_assert('\t' < ' ', "'\\t' must be treated as special below"); 'u', 'u', 'u', 'u', 'u', 'u', 'u', 'u', 'b', 't',
'n', 'u', 'f', 'r', 'u', 'u', 'u', 'u', 'u', 'u',
return c == '"' || c == '\\' || c < ' '; 'u', 'u', 'u', 'u', 'u', 'u', 'u', 'u', 'u', 'u',
} 'u', 'u', 0, 0, '\"', 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
/* ES5 15.12.3 Quote. */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
template <typename CharT> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
static bool 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Quote(StringBuffer& sb, JSLinearString* str) 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
{ 0, 0, '\\', // rest are all zeros
size_t len = str->length(); };
/* Step 1. */ /* Step 1. */
if (!sb.append('"')) *dstPtr++ = '"';
return false;
// XXX: This is a rather ugly in-line definition. Move it somewhere better?
auto ToLowerHex = [](uint8_t u) {
MOZ_ASSERT(u <= 0xF);
return "0123456789abcdef"[u];
};
/* Step 2. */ /* Step 2. */
JS::AutoCheckCannotGC nogc; while (srcBegin != srcEnd) {
const RangedPtr<const CharT> buf(str->chars<CharT>(nogc), len); const SrcCharT c = *srcBegin++;
for (size_t i = 0; i < len; ++i) {
/* Batch-append maximal character sequences containing no escapes. */ // Handle the Latin-1 cases.
size_t mark = i; if (MOZ_LIKELY(c < sizeof(escapeLookup))) {
do { Latin1Char escaped = escapeLookup[c];
if (IsQuoteSpecialCharacter(buf[i]))
break; // Directly copy non-escaped code points.
} while (++i < len); if (escaped == 0) {
if (i > mark) { *dstPtr++ = c;
if (!sb.appendSubstring(str, mark, i - mark)) continue;
return false; }
if (i == len)
break; // Escape the rest, elaborating Unicode escapes when needed.
*dstPtr++ = '\\';
*dstPtr++ = escaped;
if (escaped == 'u') {
*dstPtr++ = '0';
*dstPtr++ = '0';
uint8_t x = c >> 4;
MOZ_ASSERT(x < 10);
*dstPtr++ = '0' + x;
*dstPtr++ = ToLowerHex(c & 0xF);
}
continue;
} }
char16_t c = buf[i]; // Non-ASCII non-surrogates are directly copied.
if (c == '"' || c == '\\') { if (!unicode::IsSurrogate(c)) {
if (!sb.append('\\') || !sb.append(c)) *dstPtr++ = c;
return false; continue;
} else if (c == '\b' || c == '\f' || c == '\n' || c == '\r' || c == '\t') {
char16_t abbrev = (c == '\b')
? 'b'
: (c == '\f')
? 'f'
: (c == '\n')
? 'n'
: (c == '\r')
? 'r'
: 't';
if (!sb.append('\\') || !sb.append(abbrev))
return false;
} else {
MOZ_ASSERT(c < ' ');
if (!sb.append("\\u00"))
return false;
MOZ_ASSERT((c >> 4) < 10);
uint8_t x = c >> 4, y = c % 16;
if (!sb.append(Latin1Char('0' + x)) ||
!sb.append(Latin1Char(y < 10 ? '0' + y : 'a' + (y - 10))))
{
return false;
}
} }
// So too for complete surrogate pairs.
if (MOZ_LIKELY(unicode::IsLeadSurrogate(c) &&
srcBegin < srcEnd &&
unicode::IsTrailSurrogate(*srcBegin)))
{
*dstPtr++ = c;
*dstPtr++ = *srcBegin++;
continue;
}
// But lone surrogates are Unicode-escaped.
char32_t as32 = char32_t(c);
*dstPtr++ = '\\';
*dstPtr++ = 'u';
*dstPtr++ = ToLowerHex(as32 >> 12);
*dstPtr++ = ToLowerHex((as32 >> 8) & 0xF);
*dstPtr++ = ToLowerHex((as32 >> 4) & 0xF);
*dstPtr++ = ToLowerHex(as32 & 0xF);
} }
/* Steps 3-4. */ /* Steps 3-4. */
return sb.append('"'); *dstPtr++ = '"';
return dstPtr;
}
template <typename SrcCharT, typename CharVectorT>
static bool
Quote(CharVectorT& sb, JSLinearString* str)
{
// We resize the backing buffer to the maximum size we could possibly need,
// write the escaped string into it, and shrink it back to the size we ended
// up needing.
size_t len = str->length();
size_t sbInitialLen = sb.length();
if (!sb.growByUninitialized(len * 6 + 2))
return false;
typedef typename CharVectorT::ElementType DstCharT;
JS::AutoCheckCannotGC nogc;
RangedPtr<const SrcCharT> srcBegin{str->chars<SrcCharT>(nogc), len};
RangedPtr<DstCharT> dstBegin{sb.begin(), sb.begin(), sb.end()};
RangedPtr<DstCharT> dstEnd = InfallibleQuote(srcBegin, srcBegin + len, dstBegin + sbInitialLen);
size_t newSize = dstEnd - dstBegin;
sb.shrinkTo(newSize);
return true;
} }
static bool static bool
@ -120,14 +164,23 @@ Quote(JSContext* cx, StringBuffer& sb, JSString* str)
if (!linear) if (!linear)
return false; return false;
return linear->hasLatin1Chars() // Check if either has non-latin1 before calling ensure, so that the buffer's
? Quote<Latin1Char>(sb, linear) // hasEnsured flag is set if the converstion to twoByte was automatic.
: Quote<char16_t>(sb, linear); if (!sb.isUnderlyingBufferLatin1() || linear->hasTwoByteChars()) {
if (!sb.ensureTwoByteChars())
return false;
}
if (linear->hasTwoByteChars())
return Quote<char16_t>(sb.rawTwoByteBuffer(), linear);
return sb.isUnderlyingBufferLatin1()
? Quote<Latin1Char>(sb.latin1Chars(), linear)
: Quote<Latin1Char>(sb.rawTwoByteBuffer(), linear);
} }
namespace { namespace {
using ObjectSet = GCHashSet<JSObject*, MovableCellHasher<JSObject*>, SystemAllocPolicy>; using ObjectVector = GCVector<JSObject*, 8>;
class StringifyContext class StringifyContext
{ {
@ -138,7 +191,7 @@ class StringifyContext
: sb(sb), : sb(sb),
gap(gap), gap(gap),
replacer(cx, replacer), replacer(cx, replacer),
stack(cx), stack(cx, ObjectVector(cx)),
propertyList(propertyList), propertyList(propertyList),
depth(0), depth(0),
maybeSafely(maybeSafely) maybeSafely(maybeSafely)
@ -147,14 +200,10 @@ class StringifyContext
MOZ_ASSERT_IF(maybeSafely, gap.empty()); MOZ_ASSERT_IF(maybeSafely, gap.empty());
} }
bool init() {
return stack.init(8);
}
StringBuffer& sb; StringBuffer& sb;
const StringBuffer& gap; const StringBuffer& gap;
RootedObject replacer; RootedObject replacer;
Rooted<ObjectSet> stack; Rooted<ObjectVector> stack;
const AutoIdVector& propertyList; const AutoIdVector& propertyList;
uint32_t depth; uint32_t depth;
bool maybeSafely; bool maybeSafely;
@ -302,29 +351,34 @@ class CycleDetector
{ {
public: public:
CycleDetector(StringifyContext* scx, HandleObject obj) CycleDetector(StringifyContext* scx, HandleObject obj)
: stack(&scx->stack), obj_(obj) { : stack_(&scx->stack)
} , obj_(obj)
, appended_(false)
{}
bool foundCycle(JSContext* cx) { MOZ_ALWAYS_INLINE bool foundCycle(JSContext* cx) {
auto addPtr = stack.lookupForAdd(obj_); JSObject* obj = obj_;
if (addPtr) { for (JSObject* obj2 : stack_) {
JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr, JSMSG_JSON_CYCLIC_VALUE); if (MOZ_UNLIKELY(obj == obj2)) {
return false; JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr, JSMSG_JSON_CYCLIC_VALUE);
return false;
}
} }
if (!stack.add(addPtr, obj_)) { appended_ = stack_.append(obj);
ReportOutOfMemory(cx); return appended_;
return false;
}
return true;
} }
~CycleDetector() { ~CycleDetector() {
stack.remove(obj_); if (MOZ_LIKELY(appended_)) {
MOZ_ASSERT(stack_.back() == obj_);
stack_.popBack();
}
} }
private: private:
MutableHandle<ObjectSet> stack; MutableHandle<ObjectVector> stack_;
HandleObject obj_; HandleObject obj_;
bool appended_;
}; };
/* ES5 15.12.3 JO. */ /* ES5 15.12.3 JO. */
@ -747,8 +801,6 @@ js::Stringify(JSContext* cx, MutableHandleValue vp, JSObject* replacer_, const V
/* Step 12. */ /* Step 12. */
StringifyContext scx(cx, sb, gap, replacer, propertyList, StringifyContext scx(cx, sb, gap, replacer, propertyList,
stringifyBehavior == StringifyBehavior::RestrictedSafe); stringifyBehavior == StringifyBehavior::RestrictedSafe);
if (!scx.init())
return false;
if (!PreprocessValue(cx, wrapper, HandleId(emptyId), vp, &scx)) if (!PreprocessValue(cx, wrapper, HandleId(emptyId), vp, &scx))
return false; return false;
if (IsFilteredValue(vp)) if (IsFilteredValue(vp))

View file

@ -1,7 +1,7 @@
// |reftest| skip-if(!this.hasOwnProperty("Intl")) // |reftest| skip-if(!this.hasOwnProperty("Intl"))
// Generated by make_intl_data.py. DO NOT EDIT. // Generated by make_intl_data.py. DO NOT EDIT.
// tzdata version = 2019c // tzdata version = 2021a
const tzMapper = [ const tzMapper = [
x => x, x => x,
@ -17,6 +17,7 @@ const links = {
"America/Catamarca": "America/Argentina/Catamarca", "America/Catamarca": "America/Argentina/Catamarca",
"America/Cordoba": "America/Argentina/Cordoba", "America/Cordoba": "America/Argentina/Cordoba",
"America/Fort_Wayne": "America/Indiana/Indianapolis", "America/Fort_Wayne": "America/Indiana/Indianapolis",
"America/Godthab": "America/Nuuk",
"America/Indianapolis": "America/Indiana/Indianapolis", "America/Indianapolis": "America/Indiana/Indianapolis",
"America/Jujuy": "America/Argentina/Jujuy", "America/Jujuy": "America/Argentina/Jujuy",
"America/Knox_IN": "America/Indiana/Knox", "America/Knox_IN": "America/Indiana/Knox",

View file

@ -1,7 +1,7 @@
// |reftest| skip-if(!this.hasOwnProperty("Intl")) // |reftest| skip-if(!this.hasOwnProperty("Intl"))
// Generated by make_intl_data.py. DO NOT EDIT. // Generated by make_intl_data.py. DO NOT EDIT.
// tzdata version = 2019c // tzdata version = 2021a
const tzMapper = [ const tzMapper = [
x => x, x => x,
@ -79,6 +79,7 @@ const links = {
"Asia/Vientiane": "Asia/Vientiane", "Asia/Vientiane": "Asia/Vientiane",
"Atlantic/Jan_Mayen": "Atlantic/Jan_Mayen", "Atlantic/Jan_Mayen": "Atlantic/Jan_Mayen",
"Atlantic/St_Helena": "Atlantic/St_Helena", "Atlantic/St_Helena": "Atlantic/St_Helena",
"Australia/Currie": "Australia/Currie",
"Europe/Belfast": "Europe/Belfast", "Europe/Belfast": "Europe/Belfast",
"Europe/Guernsey": "Europe/Guernsey", "Europe/Guernsey": "Europe/Guernsey",
"Europe/Isle_of_Man": "Europe/Isle_of_Man", "Europe/Isle_of_Man": "Europe/Isle_of_Man",

View file

@ -1,7 +1,7 @@
// |reftest| skip-if(!this.hasOwnProperty("Intl")) // |reftest| skip-if(!this.hasOwnProperty("Intl"))
// Generated by make_intl_data.py. DO NOT EDIT. // Generated by make_intl_data.py. DO NOT EDIT.
// tzdata version = 2019c // tzdata version = 2021a
const tzMapper = [ const tzMapper = [
x => x, x => x,

View file

@ -1,7 +1,7 @@
// |reftest| skip-if(!this.hasOwnProperty("Intl")) // |reftest| skip-if(!this.hasOwnProperty("Intl"))
// Generated by make_intl_data.py. DO NOT EDIT. // Generated by make_intl_data.py. DO NOT EDIT.
// tzdata version = 2019c // tzdata version = 2021a
const tzMapper = [ const tzMapper = [
x => x, x => x,

View file

@ -34,6 +34,9 @@ assertStringify({'mmm\\mmm':"hmm"}, '{"mmm\\\\mmm":"hmm"}');
assertStringify({'mmm\\mmm\\mmm':"hmm"}, '{"mmm\\\\mmm\\\\mmm":"hmm"}'); assertStringify({'mmm\\mmm\\mmm':"hmm"}, '{"mmm\\\\mmm\\\\mmm":"hmm"}');
assertStringify({"mm\u000bmm":"hmm"}, '{"mm\\u000bmm":"hmm"}'); assertStringify({"mm\u000bmm":"hmm"}, '{"mm\\u000bmm":"hmm"}');
assertStringify({"mm\u0000mm":"hmm"}, '{"mm\\u0000mm":"hmm"}'); assertStringify({"mm\u0000mm":"hmm"}, '{"mm\\u0000mm":"hmm"}');
assertStringify({"\u0000\u000b":""}, '{"\\u0000\\u000b":""}');
assertStringify({"\u000b\ufdfd":"hmm"}, '{"\\u000b\ufdfd":"hmm"}');
assertStringify({"\u000b\ufdfd":"h\xfc\ufdfdm"}, '{"\\u000b\ufdfd":"h\xfc\ufdfdm"}');
var x = {"free":"variable"}; var x = {"free":"variable"};
assertStringify(x, '{"free":"variable"}'); assertStringify(x, '{"free":"variable"}');

View file

@ -3,7 +3,9 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
var BUGNUMBER = 657367; var BUGNUMBER = 657367;
var summary = "eval must not parse strings containing U+2028 or U+2029"; var summary =
"eval via the JSON parser should parse strings containing U+2028/U+2029 " +
"(as of <https://tc39.github.io/proposal-json-superset/>, that is)";
print(BUGNUMBER + ": " + summary); print(BUGNUMBER + ": " + summary);
@ -11,59 +13,8 @@ print(BUGNUMBER + ": " + summary);
* BEGIN TEST * * BEGIN TEST *
**************/ **************/
function esc(s) assertEq(eval('("\u2028")'), "\u2028");
{ assertEq(eval('("\u2029")'), "\u2029");
return s.split("").map(function(v)
{
var code =
("000" + v.charCodeAt(0).toString(16)).slice(-4);
return "\\u" + code;
}).join("");
}
try
{
var r = eval('"\u2028"');
throw new Error("\"\\u2028\" didn't throw, returned " + esc(r));
}
catch (e)
{
assertEq(e instanceof SyntaxError, true,
"U+2028 is not a valid string character");
}
try
{
var r = eval('("\u2028")');
throw new Error("(\"\\u2028\") didn't throw, returned " + esc(r));
}
catch (e)
{
assertEq(e instanceof SyntaxError, true,
"U+2028 is not a valid string character");
}
try
{
var r = eval('"\u2029"');
throw new Error("\"\\u2029\" didn't throw, returned " + esc(r));
}
catch (e)
{
assertEq(e instanceof SyntaxError, true,
"U+2029 is not a valid string character");
}
try
{
var r = eval('("\u2029")');
throw new Error("(\"\\u2029\") didn't throw, returned " + esc(r));
}
catch (e)
{
assertEq(e instanceof SyntaxError, true,
"U+2029 is not a valid string character");
}
/******************************************************************************/ /******************************************************************************/

View file

@ -61,12 +61,8 @@ class StringBuffer
MOZ_ALWAYS_INLINE bool isLatin1() const { return cb.constructed<Latin1CharBuffer>(); } MOZ_ALWAYS_INLINE bool isLatin1() const { return cb.constructed<Latin1CharBuffer>(); }
MOZ_ALWAYS_INLINE bool isTwoByte() const { return !isLatin1(); } MOZ_ALWAYS_INLINE bool isTwoByte() const { return !isLatin1(); }
MOZ_ALWAYS_INLINE Latin1CharBuffer& latin1Chars() { return cb.ref<Latin1CharBuffer>(); }
MOZ_ALWAYS_INLINE TwoByteCharBuffer& twoByteChars() { return cb.ref<TwoByteCharBuffer>(); } MOZ_ALWAYS_INLINE TwoByteCharBuffer& twoByteChars() { return cb.ref<TwoByteCharBuffer>(); }
MOZ_ALWAYS_INLINE const Latin1CharBuffer& latin1Chars() const {
return cb.ref<Latin1CharBuffer>();
}
MOZ_ALWAYS_INLINE const TwoByteCharBuffer& twoByteChars() const { MOZ_ALWAYS_INLINE const TwoByteCharBuffer& twoByteChars() const {
return cb.ref<TwoByteCharBuffer>(); return cb.ref<TwoByteCharBuffer>();
} }
@ -84,6 +80,12 @@ class StringBuffer
cb.construct<Latin1CharBuffer>(cx); cb.construct<Latin1CharBuffer>(cx);
} }
MOZ_ALWAYS_INLINE Latin1CharBuffer& latin1Chars() { return cb.ref<Latin1CharBuffer>(); }
MOZ_ALWAYS_INLINE const Latin1CharBuffer& latin1Chars() const {
return cb.ref<Latin1CharBuffer>();
}
void clear() { void clear() {
if (isLatin1()) if (isLatin1())
latin1Chars().clear(); latin1Chars().clear();
@ -134,6 +136,11 @@ class StringBuffer
return append(Latin1Char(c)); return append(Latin1Char(c));
} }
TwoByteCharBuffer& rawTwoByteBuffer() {
MOZ_ASSERT(hasEnsuredTwoByteChars_);
return twoByteChars();
}
inline MOZ_MUST_USE bool append(const char16_t* begin, const char16_t* end); inline MOZ_MUST_USE bool append(const char16_t* begin, const char16_t* end);
MOZ_MUST_USE bool append(const char16_t* chars, size_t len) { MOZ_MUST_USE bool append(const char16_t* chars, size_t len) {

View file

@ -466,6 +466,19 @@ IsTrailSurrogate(uint32_t codePoint)
return codePoint >= TrailSurrogateMin && codePoint <= TrailSurrogateMax; return codePoint >= TrailSurrogateMin && codePoint <= TrailSurrogateMax;
} }
/**
* Returns true if the given value is a UTF-16 surrogate.
*
* This function is intended for use in contexts where 32-bit values may need
* to be tested to see if they reside in the surrogate range, so it doesn't
* just take char16_t.
*/
inline bool
IsSurrogate(uint32_t codePoint)
{
return LeadSurrogateMin <= codePoint && codePoint <= TrailSurrogateMax;
}
inline char16_t inline char16_t
LeadSurrogate(uint32_t codePoint) LeadSurrogate(uint32_t codePoint)
{ {

View file

@ -5256,7 +5256,7 @@ malloc_init_hard(void)
* Another thread initialized the allocator before this one * Another thread initialized the allocator before this one
* acquired init_lock. * acquired init_lock.
*/ */
#ifndef MOZ_MEMORY_WINDOWS #if !(defined(MOZ_MEMORY_WINDOWS) || defined(__FreeBSD__))
malloc_mutex_unlock(&init_lock); malloc_mutex_unlock(&init_lock);
#endif #endif
return (false); return (false);
@ -6760,7 +6760,8 @@ jemalloc_darwin_init(void)
#define is_malloc_(a) malloc_is_ ## a #define is_malloc_(a) malloc_is_ ## a
#define is_malloc(a) is_malloc_(a) #define is_malloc(a) is_malloc_(a)
#if !defined(MOZ_MEMORY_DARWIN) && (is_malloc(malloc_impl) == 1) #if !(defined(MOZ_MEMORY_DARWIN) || defined(MOZ_MEMORY_BSD)) && \
(is_malloc(malloc_impl) == 1)
# if defined(__GLIBC__) && !defined(__UCLIBC__) # if defined(__GLIBC__) && !defined(__UCLIBC__)
/* /*
* glibc provides the RTLD_DEEPBIND flag for dlopen which can make it possible * glibc provides the RTLD_DEEPBIND flag for dlopen which can make it possible