Merge mozilla-central and inbound

This commit is contained in:
Ed Morley 2014-06-10 16:40:17 +01:00
commit 6b907ae33a
31 changed files with 392 additions and 242 deletions

View File

@ -25,8 +25,8 @@ case "$target" in
*-mingw*)
if test -z "$CC"; then CC=cl; fi
if test -z "$CXX"; then CXX=cl; fi
if test -z "$CPP"; then CPP="cl -E -nologo"; fi
if test -z "$CXXCPP"; then CXXCPP="cl -TP -E -nologo"; ac_cv_prog_CXXCPP="$CXXCPP"; fi
if test -z "$CPP"; then CPP="$CC -E -nologo"; fi
if test -z "$CXXCPP"; then CXXCPP="$CXX -TP -E -nologo"; ac_cv_prog_CXXCPP="$CXXCPP"; fi
if test -z "$LD"; then LD=link; fi
if test -z "$AS"; then
case "${target_cpu}" in

View File

@ -183,7 +183,6 @@ Link::SetHost(const nsAString &aHost)
(void)uri->SetHostPort(NS_ConvertUTF16toUTF8(aHost));
SetHrefAttribute(uri);
return;
}
void

View File

@ -64,6 +64,7 @@ skip-if = (buildapp == 'b2g' && toolkit != 'gonk') #Bug 931116, b2g desktop spec
[test_url.html]
[test_url_data.html]
[test_url_empty_port.html]
[test_url_malformedHost.html]
[test_urlExceptions.html]
[test_urlSearchParams.html]
[test_urlutils_stringify.html]

View File

@ -0,0 +1,48 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=1020041
-->
<head>
<meta charset="utf-8">
<title>Test for Bug 1020041</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1020041">Mozilla Bug 1020041</a>
<p id="display"></p>
<div id="content" style="display: none">
<iframe name="x" id="x"></iframe>
<iframe name="y" id="y"></iframe>
</div>
<pre id="test">
</pre>
<a id="link" href="http://www.example.com:8080">foobar</a>
<area id="area" href="http://www.example.com:8080" />
<script type="application/javascript">
var tests = [
{ host: '?', expected: 'www.example.com' },
{ host: 'what?' , expected: 'what' },
{ host: 'so what' , expected: 'www.example.com' },
{ host: 'aa#bb' , expected: 'aa' },
{ host: 'a/b' , expected: 'a' },
{ host: 'a\\b', expected: 'a' },
{ host: '[2001::1]#bla:10', expected: '[2001::1]'}
];
for (var i = 0; i < tests.length; ++i) {
var url = new URL('http://www.example.com');
url.host = tests[i].host;
is (url.host, tests[i].expected, "URL.host is: " + url.host);
url = new URL('http://www.example.com');
url.hostname = tests[i].host;
is (url.hostname, tests[i].expected, "URL.hostname is: " + url.host);
}
</script>
</body>
</html>

View File

@ -0,0 +1,29 @@
function test(s) {
var lat1 = toLatin1(s);
var twoByte = "\u1200" + lat1;
twoByte.indexOf("X"); // Flatten.
twoByte = twoByte.substr(1);
assertEq(isLatin1(lat1), true);
assertEq(isLatin1(twoByte), false);
assertEq(Date.parse(lat1), Date.parse(twoByte));
}
// ISO format
test("2014-06-06");
test("2014-06-06T08:30+01:00");
test("T11:59Z");
// Non-ISO format
test("06 Jun 2014, 17:20:36");
test("6 Jun 2014");
test("Wed Nov 05 21:49:11 GMT-0800 1997");
test("Jan 30 2014 2:30 PM");
// Invalid
test("06 Aaa 2014, 17:20:36");
test("6 Jun 10");
test("2014-13-06");
test("2014-06-06T08:30+99:00");

View File

@ -70,10 +70,8 @@ CodeGeneratorShared::CodeGeneratorShared(MIRGenerator *gen, LIRGraph *graph, Mac
// (like x64) which require the stack to be aligned.
if (StackKeptAligned || gen->needsInitialStackAlignment()) {
unsigned alignmentAtCall = AlignmentAtAsmJSPrologue + frameDepth_;
if (unsigned rem = alignmentAtCall % StackAlignment) {
frameInitialAdjustment_ = StackAlignment - rem;
frameDepth_ += frameInitialAdjustment_;
}
if (unsigned rem = alignmentAtCall % StackAlignment)
frameDepth_ += StackAlignment - rem;
}
// FrameSizeClass is only used for bailing, which cannot happen in

View File

@ -50,6 +50,8 @@ using namespace js::types;
using mozilla::ArrayLength;
using mozilla::IsFinite;
using mozilla::IsNaN;
using JS::AutoCheckCannotGC;
using JS::GenericNaN;
/*
@ -547,33 +549,20 @@ static const int ttb[] = {
10000 + 8 * 60, 10000 + 7 * 60 /* PST/PDT */
};
/* helper for date_parse */
template <typename CharT>
static bool
date_regionMatches(const char* s1, int s1off, const jschar* s2, int s2off,
int count, int ignoreCase)
RegionMatches(const char *s1, int s1off, const CharT *s2, int s2off, int count)
{
bool result = false;
/* return true if matches, otherwise, false */
while (count > 0 && s1[s1off] && s2[s2off]) {
if (ignoreCase) {
if (unicode::ToLowerCase(s1[s1off]) != unicode::ToLowerCase(s2[s2off]))
break;
} else {
if ((jschar)s1[s1off] != s2[s2off]) {
break;
}
}
if (unicode::ToLowerCase(s1[s1off]) != unicode::ToLowerCase(s2[s2off]))
break;
s1off++;
s2off++;
count--;
}
if (count == 0) {
result = true;
}
return result;
return count == 0;
}
/* find UTC time from given date... no 1900 correction! */
@ -649,13 +638,13 @@ date_UTC(JSContext *cx, unsigned argc, Value *vp)
* Succeed if any digits are converted. Advance *i only
* as digits are consumed.
*/
template <typename CharT>
static bool
digits(size_t *result, const jschar *s, size_t *i, size_t limit)
ParseDigits(size_t *result, const CharT *s, size_t *i, size_t limit)
{
size_t init = *i;
*result = 0;
while (*i < limit &&
('0' <= s[*i] && s[*i] <= '9')) {
while (*i < limit && ('0' <= s[*i] && s[*i] <= '9')) {
*result *= 10;
*result += (s[*i] - '0');
++(*i);
@ -671,14 +660,14 @@ digits(size_t *result, const jschar *s, size_t *i, size_t limit)
* Succeed if any digits are converted. Advance *i only
* as digits are consumed.
*/
template <typename CharT>
static bool
fractional(double *result, const jschar *s, size_t *i, size_t limit)
ParseFractional(double *result, const CharT *s, size_t *i, size_t limit)
{
double factor = 0.1;
size_t init = *i;
*result = 0.0;
while (*i < limit &&
('0' <= s[*i] && s[*i] <= '9')) {
while (*i < limit && ('0' <= s[*i] && s[*i] <= '9')) {
*result += (s[*i] - '0') * factor;
factor *= 0.1;
++(*i);
@ -693,12 +682,13 @@ fractional(double *result, const jschar *s, size_t *i, size_t limit)
* Succeed if exactly n digits are converted. Advance *i only
* on success.
*/
template <typename CharT>
static bool
ndigits(size_t n, size_t *result, const jschar *s, size_t* i, size_t limit)
ParseDigitsN(size_t n, size_t *result, const CharT *s, size_t *i, size_t limit)
{
size_t init = *i;
if (digits(result, s, i, Min(limit, init+n)))
if (ParseDigits(result, s, i, Min(limit, init + n)))
return (*i - init) == n;
*i = init;
@ -768,14 +758,10 @@ DaysInMonth(int year, int month)
* s = one or more digits representing a decimal fraction of a second
* TZD = time zone designator (Z or +hh:mm or -hh:mm or missing for local)
*/
template <typename CharT>
static bool
date_parseISOString(JSLinearString *str, double *result, DateTimeInfo *dtInfo)
ParseISODate(const CharT *s, size_t length, double *result, DateTimeInfo *dtInfo)
{
double msec;
const jschar *s;
size_t limit;
size_t i = 0;
int tzMul = 1;
int dateMul = 1;
@ -790,30 +776,19 @@ date_parseISOString(JSLinearString *str, double *result, DateTimeInfo *dtInfo)
size_t tzHour = 0;
size_t tzMin = 0;
#define PEEK(ch) (i < limit && s[i] == ch)
#define PEEK(ch) (i < length && s[i] == ch)
#define NEED(ch) \
JS_BEGIN_MACRO \
if (i >= limit || s[i] != ch) { goto syntax; } else { ++i; } \
JS_END_MACRO
#define NEED(ch) \
if (i >= length || s[i] != ch) { return false; } else { ++i; }
#define DONE_DATE_UNLESS(ch) \
JS_BEGIN_MACRO \
if (i >= limit || s[i] != ch) { goto done_date; } else { ++i; } \
JS_END_MACRO
#define DONE_DATE_UNLESS(ch) \
if (i >= length || s[i] != ch) { goto done_date; } else { ++i; }
#define DONE_UNLESS(ch) \
JS_BEGIN_MACRO \
if (i >= limit || s[i] != ch) { goto done; } else { ++i; } \
JS_END_MACRO
#define DONE_UNLESS(ch) \
if (i >= length || s[i] != ch) { goto done; } else { ++i; }
#define NEED_NDIGITS(n, field) \
JS_BEGIN_MACRO \
if (!ndigits(n, &field, s, &i, limit)) { goto syntax; } \
JS_END_MACRO
s = str->chars();
limit = str->length();
#define NEED_NDIGITS(n, field) \
if (!ParseDigitsN(n, &field, s, &i, length)) { return false; }
if (PEEK('+') || PEEK('-')) {
if (PEEK('-'))
@ -839,8 +814,8 @@ date_parseISOString(JSLinearString *str, double *result, DateTimeInfo *dtInfo)
NEED_NDIGITS(2, sec);
if (PEEK('.')) {
++i;
if (!fractional(&frac, s, &i, limit))
goto syntax;
if (!ParseFractional(&frac, s, &i, length))
return false;
}
}
@ -856,7 +831,7 @@ date_parseISOString(JSLinearString *str, double *result, DateTimeInfo *dtInfo)
* allow "-0700" as a time zone offset, not just "-07:00".
*/
if (PEEK(':'))
++i;
++i;
NEED_NDIGITS(2, tzMin);
} else {
isLocalTime = true;
@ -872,149 +847,143 @@ date_parseISOString(JSLinearString *str, double *result, DateTimeInfo *dtInfo)
|| sec > 59
|| tzHour > 23
|| tzMin > 59)
goto syntax;
{
return false;
}
if (i != limit)
goto syntax;
if (i != length)
return false;
month -= 1; /* convert month to 0-based */
msec = date_msecFromDate(dateMul * (double)year, month, day,
hour, min, sec,
frac * 1000.0);;
double msec = date_msecFromDate(dateMul * double(year), month, day,
hour, min, sec, frac * 1000.0);
if (isLocalTime) {
if (isLocalTime)
msec = UTC(msec, dtInfo);
} else {
msec -= ((tzMul) * ((tzHour * msPerHour)
+ (tzMin * msPerMinute)));
}
else
msec -= tzMul * (tzHour * msPerHour + tzMin * msPerMinute);
if (msec < -8.64e15 || msec > 8.64e15)
goto syntax;
return false;
*result = msec;
return true;
syntax:
/* syntax error */
*result = 0;
return false;
#undef PEEK
#undef NEED
#undef DONE_UNLESS
#undef NEED_NDIGITS
}
template <typename CharT>
static bool
date_parseString(JSLinearString *str, double *result, DateTimeInfo *dtInfo)
ParseDate(const CharT *s, size_t length, double *result, DateTimeInfo *dtInfo)
{
double msec;
if (ParseISODate(s, length, result, dtInfo))
return true;
if (length == 0)
return false;
const jschar *s;
size_t limit;
size_t i = 0;
int year = -1;
int mon = -1;
int mday = -1;
int hour = -1;
int min = -1;
int sec = -1;
int c = -1;
int n = -1;
int tzoffset = -1;
int tzOffset = -1;
int prevc = 0;
bool seenplusminus = false;
int temp;
bool seenmonthname = false;
if (date_parseISOString(str, result, dtInfo))
return true;
bool seenPlusMinus = false;
bool seenMonthName = false;
s = str->chars();
limit = str->length();
if (limit == 0)
goto syntax;
while (i < limit) {
c = s[i];
size_t i = 0;
while (i < length) {
int c = s[i];
i++;
if (c <= ' ' || c == ',' || c == '-') {
if (c == '-' && '0' <= s[i] && s[i] <= '9') {
prevc = c;
}
if (c == '-' && '0' <= s[i] && s[i] <= '9')
prevc = c;
continue;
}
if (c == '(') { /* comments) */
int depth = 1;
while (i < limit) {
while (i < length) {
c = s[i];
i++;
if (c == '(') depth++;
else if (c == ')')
if (c == '(') {
depth++;
} else if (c == ')') {
if (--depth <= 0)
break;
}
}
continue;
}
if ('0' <= c && c <= '9') {
n = c - '0';
while (i < limit && '0' <= (c = s[i]) && c <= '9') {
int n = c - '0';
while (i < length && '0' <= (c = s[i]) && c <= '9') {
n = n * 10 + c - '0';
i++;
}
/* allow TZA before the year, so
* 'Wed Nov 05 21:49:11 GMT-0800 1997'
* works */
/* uses of seenplusminus allow : in TZA, so Java
* no-timezone style of GMT+4:30 works
/*
* Allow TZA before the year, so 'Wed Nov 05 21:49:11 GMT-0800 1997'
* works.
*
* Uses of seenPlusMinus allow ':' in TZA, so Java no-timezone style
* of GMT+4:30 works.
*/
if ((prevc == '+' || prevc == '-')/* && year>=0 */) {
/* make ':' case below change tzoffset */
seenplusminus = true;
/* Make ':' case below change tzOffset. */
seenPlusMinus = true;
/* offset */
if (n < 24)
n = n * 60; /* EG. "GMT-3" */
else
n = n % 100 + n / 100 * 60; /* eg "GMT-0430" */
if (prevc == '+') /* plus means east of GMT */
n = -n;
if (tzoffset != 0 && tzoffset != -1)
goto syntax;
tzoffset = n;
if (tzOffset != 0 && tzOffset != -1)
return false;
tzOffset = n;
} else if (prevc == '/' && mon >= 0 && mday >= 0 && year < 0) {
if (c <= ' ' || c == ',' || c == '/' || i >= limit)
if (c <= ' ' || c == ',' || c == '/' || i >= length)
year = n;
else
goto syntax;
return false;
} else if (c == ':') {
if (hour < 0)
hour = /*byte*/ n;
else if (min < 0)
min = /*byte*/ n;
else
goto syntax;
return false;
} else if (c == '/') {
/* until it is determined that mon is the actual
month, keep it as 1-based rather than 0-based */
/*
* Until it is determined that mon is the actual month, keep
* it as 1-based rather than 0-based.
*/
if (mon < 0)
mon = /*byte*/ n;
else if (mday < 0)
mday = /*byte*/ n;
else
goto syntax;
} else if (i < limit && c != ',' && c > ' ' && c != '-' && c != '(') {
goto syntax;
} else if (seenplusminus && n < 60) { /* handle GMT-3:30 */
if (tzoffset < 0)
tzoffset -= n;
return false;
} else if (i < length && c != ',' && c > ' ' && c != '-' && c != '(') {
return false;
} else if (seenPlusMinus && n < 60) { /* handle GMT-3:30 */
if (tzOffset < 0)
tzOffset -= n;
else
tzoffset += n;
tzOffset += n;
} else if (hour >= 0 && min < 0) {
min = /*byte*/ n;
} else if (prevc == ':' && min >= 0 && sec < 0) {
@ -1026,7 +995,7 @@ date_parseString(JSLinearString *str, double *result, DateTimeInfo *dtInfo)
} else if (mon >= 0 && mday >= 0 && year < 0) {
year = n;
} else {
goto syntax;
return false;
}
prevc = 0;
} else if (c == '/' || c == ':' || c == '+' || c == '-') {
@ -1034,16 +1003,18 @@ date_parseString(JSLinearString *str, double *result, DateTimeInfo *dtInfo)
} else {
size_t st = i - 1;
int k;
while (i < limit) {
while (i < length) {
c = s[i];
if (!(('A' <= c && c <= 'Z') || ('a' <= c && c <= 'z')))
break;
i++;
}
if (i <= st + 1)
goto syntax;
for (k = ArrayLength(wtb); --k >= 0;)
if (date_regionMatches(wtb[k], 0, s, st, i-st, 1)) {
return false;
for (k = ArrayLength(wtb); --k >= 0;) {
if (RegionMatches(wtb[k], 0, s, st, i - st)) {
int action = ttb[k];
if (action != 0) {
if (action < 0) {
@ -1052,23 +1023,23 @@ date_parseString(JSLinearString *str, double *result, DateTimeInfo *dtInfo)
* 12:30, instead of blindly adding 12 if PM.
*/
JS_ASSERT(action == -1 || action == -2);
if (hour > 12 || hour < 0) {
goto syntax;
} else {
if (action == -1 && hour == 12) { /* am */
hour = 0;
} else if (action == -2 && hour != 12) { /* pm */
hour += 12;
}
}
if (hour > 12 || hour < 0)
return false;
if (action == -1 && hour == 12) /* am */
hour = 0;
else if (action == -2 && hour != 12) /* pm */
hour += 12;
} else if (action <= 13) { /* month! */
/* Adjust mon to be 1-based until the final values
for mon, mday and year are adjusted below */
if (seenmonthname) {
goto syntax;
}
seenmonthname = true;
temp = /*byte*/ (action - 2) + 1;
/*
* Adjust mon to be 1-based until the final values
* for mon, mday and year are adjusted below.
*/
if (seenMonthName)
return false;
seenMonthName = true;
int temp = /*byte*/ (action - 2) + 1;
if (mon < 0) {
mon = temp;
@ -1079,53 +1050,58 @@ date_parseString(JSLinearString *str, double *result, DateTimeInfo *dtInfo)
year = mon;
mon = temp;
} else {
goto syntax;
return false;
}
} else {
tzoffset = action - 10000;
tzOffset = action - 10000;
}
}
break;
}
}
if (k < 0)
goto syntax;
return false;
prevc = 0;
}
}
if (year < 0 || mon < 0 || mday < 0)
goto syntax;
return false;
/*
Case 1. The input string contains an English month name.
The form of the string can be month f l, or f month l, or
f l month which each evaluate to the same date.
If f and l are both greater than or equal to 70, or
both less than 70, the date is invalid.
The year is taken to be the greater of the values f, l.
If the year is greater than or equal to 70 and less than 100,
it is considered to be the number of years after 1900.
Case 2. The input string is of the form "f/m/l" where f, m and l are
integers, e.g. 7/16/45.
Adjust the mon, mday and year values to achieve 100% MSIE
compatibility.
a. If 0 <= f < 70, f/m/l is interpreted as month/day/year.
i. If year < 100, it is the number of years after 1900
ii. If year >= 100, it is the number of years after 0.
b. If 70 <= f < 100
i. If m < 70, f/m/l is interpreted as
year/month/day where year is the number of years after
1900.
ii. If m >= 70, the date is invalid.
c. If f >= 100
i. If m < 70, f/m/l is interpreted as
year/month/day where year is the number of years after 0.
ii. If m >= 70, the date is invalid.
*/
if (seenmonthname) {
if ((mday >= 70 && year >= 70) || (mday < 70 && year < 70)) {
goto syntax;
}
* Case 1. The input string contains an English month name.
* The form of the string can be month f l, or f month l, or
* f l month which each evaluate to the same date.
* If f and l are both greater than or equal to 70, or
* both less than 70, the date is invalid.
* The year is taken to be the greater of the values f, l.
* If the year is greater than or equal to 70 and less than 100,
* it is considered to be the number of years after 1900.
* Case 2. The input string is of the form "f/m/l" where f, m and l are
* integers, e.g. 7/16/45.
* Adjust the mon, mday and year values to achieve 100% MSIE
* compatibility.
* a. If 0 <= f < 70, f/m/l is interpreted as month/day/year.
* i. If year < 100, it is the number of years after 1900
* ii. If year >= 100, it is the number of years after 0.
* b. If 70 <= f < 100
* i. If m < 70, f/m/l is interpreted as
* year/month/day where year is the number of years after
* 1900.
* ii. If m >= 70, the date is invalid.
* c. If f >= 100
* i. If m < 70, f/m/l is interpreted as
* year/month/day where year is the number of years after 0.
* ii. If m >= 70, the date is invalid.
*/
if (seenMonthName) {
if ((mday >= 70 && year >= 70) || (mday < 70 && year < 70))
return false;
if (mday > year) {
temp = year;
int temp = year;
year = mday;
mday = temp;
}
@ -1138,23 +1114,24 @@ date_parseString(JSLinearString *str, double *result, DateTimeInfo *dtInfo)
}
} else if (mon < 100) { /* (b) year/month/day */
if (mday < 70) {
temp = year;
int temp = year;
year = mon + 1900;
mon = mday;
mday = temp;
} else {
goto syntax;
return false;
}
} else { /* (c) year/month/day */
if (mday < 70) {
temp = year;
int temp = year;
year = mon;
mon = mday;
mday = temp;
} else {
goto syntax;
return false;
}
}
mon -= 1; /* convert month to 0-based */
if (sec < 0)
sec = 0;
@ -1163,21 +1140,24 @@ date_parseString(JSLinearString *str, double *result, DateTimeInfo *dtInfo)
if (hour < 0)
hour = 0;
msec = date_msecFromDate(year, mon, mday, hour, min, sec, 0);
double msec = date_msecFromDate(year, mon, mday, hour, min, sec, 0);
if (tzoffset == -1) { /* no time zone specified, have to use local */
if (tzOffset == -1) /* no time zone specified, have to use local */
msec = UTC(msec, dtInfo);
} else {
msec += tzoffset * msPerMinute;
}
else
msec += tzOffset * msPerMinute;
*result = msec;
return true;
}
syntax:
/* syntax error */
*result = 0;
return false;
static bool
ParseDate(JSLinearString *s, double *result, DateTimeInfo *dtInfo)
{
AutoCheckCannotGC nogc;
return s->hasLatin1Chars()
? ParseDate(s->latin1Chars(nogc), s->length(), result, dtInfo)
: ParseDate(s->twoByteChars(nogc), s->length(), result, dtInfo);
}
static bool
@ -1198,7 +1178,7 @@ date_parse(JSContext *cx, unsigned argc, Value *vp)
return false;
double result;
if (!date_parseString(linearStr, &result, &cx->runtime()->dateTimeInfo)) {
if (!ParseDate(linearStr, &result, &cx->runtime()->dateTimeInfo)) {
args.rval().setNaN();
return true;
}
@ -2981,7 +2961,7 @@ js_Date(JSContext *cx, unsigned argc, Value *vp)
if (!linearStr)
return false;
if (!date_parseString(linearStr, &d, &cx->runtime()->dateTimeInfo))
if (!ParseDate(linearStr, &d, &cx->runtime()->dateTimeInfo))
d = GenericNaN();
else
d = TimeClip(d);

View File

@ -3531,7 +3531,7 @@ CloneIntoReadStructuredClone(JSContext *cx,
if (!JS_WrapObject(cx, &obj))
return nullptr;
if (!xpc::NewFunctionForwarder(cx, obj, false, &functionValue))
if (!xpc::NewFunctionForwarder(cx, obj, true, &functionValue))
return nullptr;
return &functionValue.toObject();

View File

@ -161,8 +161,14 @@
'CloneInto should only work on less privileged target scopes.');
}
var test = { a: function() { return 42; } }
var test = { a: function() { return 42; } };
cloneAndTestWithFunctions(test);
// Check that we're cloning input to functions:
test = { a: function(obj) { return obj; } };
var clonedTest = Cu.cloneInto(test, sandbox, {cloneFunctions: true});
var testInput = {};
isnot(clonedTest.a(testInput), testInput, "Objects should not be identical");
]]>
</script>
</window>

View File

@ -148,18 +148,13 @@ Abs<long double>(const long double d)
#if defined(_WIN32) && (_MSC_VER >= 1300) && (defined(_M_IX86) || defined(_M_AMD64) || defined(_M_X64))
# define MOZ_BITSCAN_WINDOWS
extern "C" {
unsigned char _BitScanForward(unsigned long* Index, unsigned long mask);
unsigned char _BitScanReverse(unsigned long* Index, unsigned long mask);
# include <intrin.h>
# pragma intrinsic(_BitScanForward, _BitScanReverse)
# if defined(_M_AMD64) || defined(_M_X64)
# define MOZ_BITSCAN_WINDOWS64
unsigned char _BitScanForward64(unsigned long* index, unsigned __int64 mask);
unsigned char _BitScanReverse64(unsigned long* index, unsigned __int64 mask);
# pragma intrinsic(_BitScanForward64, _BitScanReverse64)
# endif
} // extern "C"
#endif

View File

@ -548,16 +548,45 @@ thread_info_cleanup(void *arg) {
thread_info_t *tinfo = (thread_info_t *)arg;
pthread_attr_destroy(&tinfo->threadAttr);
uintptr_t pageGuard = ceilToPage((uintptr_t)tinfo->stk);
mprotect((void*)pageGuard, getPageSize(), PROT_READ | PROT_WRITE);
free(tinfo->stk);
REAL(pthread_mutex_lock)(&sThreadCountLock);
/* unlink tinfo from sAllThreads */
tinfo->remove();
pthread_mutex_unlock(&sThreadCountLock);
// while sThreadCountLock is held, since delete calls wrapped functions
// which try to lock sThreadCountLock. This results in deadlock. And we
// need to delete |tinfo| before decreasing sThreadCount, so Nuwa won't
// get ready before tinfo is cleaned.
delete tinfo;
REAL(pthread_mutex_lock)(&sThreadCountLock);
sThreadCount--;
pthread_cond_signal(&sThreadChangeCond);
pthread_mutex_unlock(&sThreadCountLock);
}
free(tinfo->stk);
delete tinfo;
static void*
cleaner_thread(void *arg) {
thread_info_t *tinfo = (thread_info_t *)arg;
pthread_t *thread = sIsNuwaProcess ? &tinfo->origThreadID
: &tinfo->recreatedThreadID;
// Wait until target thread end.
while (!pthread_kill(*thread, 0)) {
sched_yield();
}
thread_info_cleanup(tinfo);
return nullptr;
}
static void
thread_cleanup(void *arg) {
pthread_t thread;
REAL(pthread_create)(&thread, nullptr, &cleaner_thread, arg);
pthread_detach(thread);
}
static void *
@ -573,7 +602,7 @@ _thread_create_startup(void *arg) {
tinfo->origThreadID = REAL(pthread_self)();
tinfo->origNativeThreadID = gettid();
pthread_cleanup_push(thread_info_cleanup, tinfo);
pthread_cleanup_push(thread_cleanup, tinfo);
r = tinfo->startupFunc(tinfo->startupArg);

View File

@ -1163,7 +1163,6 @@ nsSocketTransport::BuildSocket(PRFileDesc *&fd, bool &proxyTransparent, bool &us
}
}
CleanupTypes();
return rv;
}

View File

@ -35,6 +35,7 @@ nsIIDNService *nsStandardURL::gIDN = nullptr;
bool nsStandardURL::gInitialized = false;
bool nsStandardURL::gEscapeUTF8 = true;
bool nsStandardURL::gAlwaysEncodeInUTF8 = true;
char nsStandardURL::gHostLimitDigits[] = { '/', '\\', '?', '#', 0 };
#if defined(PR_LOGGING)
//
@ -1423,6 +1424,18 @@ nsStandardURL::SetPassword(const nsACString &input)
return NS_OK;
}
void
nsStandardURL::FindHostLimit(nsACString::const_iterator& aStart,
nsACString::const_iterator& aEnd)
{
for (int32_t i = 0; gHostLimitDigits[i]; ++i) {
nsACString::const_iterator c(aStart);
if (FindCharInReadable(gHostLimitDigits[i], c, aEnd)) {
aEnd = c;
}
}
}
NS_IMETHODIMP
nsStandardURL::SetHostPort(const nsACString &aValue)
{
@ -1438,6 +1451,8 @@ nsStandardURL::SetHostPort(const nsACString &aValue)
nsACString::const_iterator iter(start);
bool isIPv6 = false;
FindHostLimit(start, end);
if (*start == '[') { // IPv6 address
if (!FindCharInReadable(']', iter, end)) {
// the ] character is missing
@ -1496,7 +1511,15 @@ nsStandardURL::SetHost(const nsACString &input)
{
ENSURE_MUTABLE();
const nsPromiseFlatCString &flat = PromiseFlatCString(input);
const nsPromiseFlatCString &hostname = PromiseFlatCString(input);
nsACString::const_iterator start, end;
hostname.BeginReading(start);
hostname.EndReading(end);
FindHostLimit(start, end);
const nsCString flat(Substring(start, end));
const char *host = flat.get();
LOG(("nsStandardURL::SetHost [host=%s]\n", host));

View File

@ -226,6 +226,9 @@ private:
static void PrefsChanged(nsIPrefBranch *prefs, const char *pref);
void FindHostLimit(nsACString::const_iterator& aStart,
nsACString::const_iterator& aEnd);
// mSpec contains the normalized version of the URL spec (UTF-8 encoded).
nsCString mSpec;
int32_t mDefaultPort;
@ -270,6 +273,7 @@ private:
// global objects. don't use COMPtr as its destructor will cause a
// coredump if we leak it.
static nsIIDNService *gIDN;
static char gHostLimitDigits[];
static bool gInitialized;
static bool gEscapeUTF8;
static bool gAlwaysEncodeInUTF8;

View File

@ -1003,8 +1003,7 @@ Http2Compressor::EncodeHeaderBlock(const nsCString &nvInput,
name.EqualsLiteral("proxy-connection") ||
name.EqualsLiteral("te") ||
name.EqualsLiteral("transfer-encoding") ||
name.EqualsLiteral("upgrade") ||
name.EqualsLiteral("accept-encoding")) {
name.EqualsLiteral("upgrade")) {
continue;
}
@ -1062,10 +1061,12 @@ Http2Compressor::EncodeHeaderBlock(const nsCString &nvInput,
}
nsDependentCSubstring cookie = Substring(beginBuffer + nextCookie,
beginBuffer + semiSpaceIndex);
ProcessHeader(nvPair(name, cookie), true);
// cookies less than 20 bytes are not indexed
ProcessHeader(nvPair(name, cookie), name.Length() < 20);
nextCookie = semiSpaceIndex + 2;
}
} else {
// allow indexing of every non-cookie except authorization
ProcessHeader(nvPair(name, value), name.EqualsLiteral("authorization"));
}
}

View File

@ -33,6 +33,10 @@
namespace mozilla {
namespace net {
#if defined(_MSC_VER) && defined(__clang__)
// This is needed until http://llvm.org/PR19987 is fixed
class __multiple_inheritance HttpChannelChild;
#endif
class HttpChannelChild : public PHttpChannelChild
, public HttpBaseChannel
, public HttpAsyncAborter<HttpChannelChild>

View File

@ -1031,6 +1031,10 @@ SpdyStream3::Uncompress(z_stream *context,
char *blockStart,
uint32_t blockLen)
{
// ensure the minimum size
EnsureBuffer(mDecompressBuffer, SpdySession3::kDefaultBufferSize,
mDecompressBufferUsed, mDecompressBufferSize);
mDecompressedBytes += blockLen;
context->avail_in = blockLen;
@ -1043,22 +1047,23 @@ SpdyStream3::Uncompress(z_stream *context,
mDecompressBufferUsed;
context->avail_out = mDecompressBufferSize - mDecompressBufferUsed;
int zlib_rv = inflate(context, Z_NO_FLUSH);
LOG3(("SpdyStream3::Uncompress %p zlib_rv %d\n", this, zlib_rv));
if (zlib_rv == Z_NEED_DICT) {
if (triedDictionary) {
LOG3(("SpdySession3::Uncompress %p Dictionary Error\n", this));
LOG3(("SpdyStream3::Uncompress %p Dictionary Error\n", this));
return NS_ERROR_ILLEGAL_VALUE;
}
triedDictionary = true;
inflateSetDictionary(context, kDictionary, sizeof(kDictionary));
}
if (zlib_rv == Z_DATA_ERROR)
} else if (zlib_rv == Z_DATA_ERROR) {
LOG3(("SpdyStream3::Uncompress %p inflate returned data err\n", this));
return NS_ERROR_ILLEGAL_VALUE;
if (zlib_rv == Z_MEM_ERROR)
} else if (zlib_rv < Z_OK) { // probably Z_MEM_ERROR
LOG3(("SpdyStream3::Uncompress %p inflate returned %d\n", this, zlib_rv));
return NS_ERROR_FAILURE;
}
// zlib's inflate() decreases context->avail_out by the amount it places
// in the output buffer

View File

@ -1047,6 +1047,10 @@ SpdyStream31::Uncompress(z_stream *context,
char *blockStart,
uint32_t blockLen)
{
// ensure the minimum size
EnsureBuffer(mDecompressBuffer, SpdySession31::kDefaultBufferSize,
mDecompressBufferUsed, mDecompressBufferSize);
mDecompressedBytes += blockLen;
context->avail_in = blockLen;
@ -1059,22 +1063,23 @@ SpdyStream31::Uncompress(z_stream *context,
mDecompressBufferUsed;
context->avail_out = mDecompressBufferSize - mDecompressBufferUsed;
int zlib_rv = inflate(context, Z_NO_FLUSH);
LOG3(("SpdyStream31::Uncompress %p zlib_rv %d\n", this, zlib_rv));
if (zlib_rv == Z_NEED_DICT) {
if (triedDictionary) {
LOG3(("SpdySession31::Uncompress %p Dictionary Error\n", this));
LOG3(("SpdyStream31::Uncompress %p Dictionary Error\n", this));
return NS_ERROR_ILLEGAL_VALUE;
}
triedDictionary = true;
inflateSetDictionary(context, kDictionary, sizeof(kDictionary));
}
if (zlib_rv == Z_DATA_ERROR)
} else if (zlib_rv == Z_DATA_ERROR) {
LOG3(("SpdyStream31::Uncompress %p inflate returned data err\n", this));
return NS_ERROR_ILLEGAL_VALUE;
if (zlib_rv == Z_MEM_ERROR)
} else if (zlib_rv < Z_OK) { // probably Z_MEM_ERROR
LOG3(("SpdyStream31::Uncompress %p inflate returned %d\n", this, zlib_rv));
return NS_ERROR_FAILURE;
}
// zlib's inflate() decreases context->avail_out by the amount it places
// in the output buffer

View File

@ -24,6 +24,12 @@
"other": {
"tests": ["a11yr", "ts_paint", "tpaint", "sessionrestore", "sessionrestore_no_auto_restore"]
},
"other_nolinux64": {
"tests": ["a11yr", "ts_paint", "tpaint", "sessionrestore", "sessionrestore_no_auto_restore"]
},
"other_linux64": {
"tests": ["a11yr", "ts_paint", "tpaint", "sessionrestore", "sessionrestore_no_auto_restore", "media_tests"]
},
"svgr": {
"tests": ["tsvgx", "tsvgr_opacity", "tart", "tscrollx", "cart"]
},

View File

@ -49,3 +49,5 @@ RCINCLUDE = 'crashreporter.rc'
# Don't use the STL wrappers in the crashreporter clients; they don't
# link with -lmozalloc, and it really doesn't matter here anyway.
DISABLE_STL_WRAPPING = True
include('/toolkit/crashreporter/crashreporter.mozbuild')

View File

@ -0,0 +1,15 @@
# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
# Suppress warnings in third-party code.
if CONFIG['_MSC_VER']:
CXXFLAGS += [
'-wd4005', # macro redefinition
]
elif CONFIG['GNU_CXX']:
CXXFLAGS += [
'-Wno-unused-local-typedefs',
]

View File

@ -19,3 +19,5 @@ if CONFIG['OS_TARGET'] == 'Android':
LOCAL_INCLUDES += [
'/toolkit/crashreporter/google-breakpad/src/common/android/include',
]
include('/toolkit/crashreporter/crashreporter.mozbuild')

View File

@ -26,3 +26,4 @@ LOCAL_INCLUDES += [
'/toolkit/crashreporter/google-breakpad/src',
]
include('/toolkit/crashreporter/crashreporter.mozbuild')

View File

@ -25,3 +25,5 @@ if CONFIG['OS_TARGET'] == 'Android':
LOCAL_INCLUDES += [
'/toolkit/crashreporter/google-breakpad/src/common/android/include',
]
include('/toolkit/crashreporter/crashreporter.mozbuild')

View File

@ -88,6 +88,8 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk':
if CONFIG['OS_TARGET'] == 'Android':
DEFINES['NO_STABS_SUPPORT'] = True
include('/toolkit/crashreporter/crashreporter.mozbuild')
LOCAL_INCLUDES += [
'..',
]

View File

@ -28,3 +28,4 @@ LOCAL_INCLUDES += [
'../..',
]
include('/toolkit/crashreporter/crashreporter.mozbuild')

View File

@ -103,14 +103,6 @@ LOCAL_INCLUDES += [
'google-breakpad/src',
]
# Suppress warnings in third-party code.
if CONFIG['_MSC_VER']:
CXXFLAGS += [
'-wd4005', # macro redefinition
]
elif CONFIG['GNU_CXX']:
CXXFLAGS += [
'-Wno-unused-local-typedefs',
]
include('/toolkit/crashreporter/crashreporter.mozbuild')
FAIL_ON_WARNINGS = True

View File

@ -37,3 +37,4 @@ LOCAL_INCLUDES += [
'../google-breakpad/src/',
]
include('/toolkit/crashreporter/crashreporter.mozbuild')

View File

@ -27,10 +27,10 @@ function loadWebapp(manifest, parameters, onLoad) {
becomeWebapp(url.spec, parameters, function onBecome() {
function onLoadApp() {
gAppBrowser.removeEventListener("DOMContentLoaded", onLoadApp, true);
gAppBrowser.removeEventListener("load", onLoadApp, true);
onLoad();
}
gAppBrowser.addEventListener("DOMContentLoaded", onLoadApp, true);
gAppBrowser.addEventListener("load", onLoadApp, true);
gAppBrowser.setAttribute("src", WebappRT.launchURI);
});

View File

@ -245,7 +245,7 @@ nsLookAndFeel::NativeGetColor(ColorID aID, nscolor &aColor)
aColor = NS_RGB(0xA3,0xA3,0xA3);
break;
case eColorID__moz_mac_menutextdisable:
aColor = NS_RGB(0x88,0x88,0x88);
aColor = NS_RGB(0x98,0x98,0x98);
break;
case eColorID__moz_mac_menutextselect:
aColor = GetColorFromNSColor([NSColor selectedMenuItemTextColor]);

View File

@ -71,7 +71,7 @@ var colors = {
//"-moz-mac-focusring": ["rgb(83, 144, 210)", "rgb(95, 112, 130)", "rgb(63, 152, 221)", "rgb(108, 126, 141)"],
"-moz-mac-menuselect": ["rgb(115, 132, 153)", "rgb(127, 127, 127)", "rgb(56, 117, 215)", "rgb(255, 193, 31)", "rgb(243, 70, 72)", "rgb(255, 138, 34)", "rgb(102, 197, 71)", "rgb(140, 78, 184)"],
"-moz-mac-menushadow": ["rgb(163, 163, 163)"],
"-moz-mac-menutextdisable": ["rgb(152, 152, 152)", "rgb(136, 136, 136)"],
"-moz-mac-menutextdisable": ["rgb(152, 152, 152)"],
"-moz-mac-menutextselect": ["rgb(255, 255, 255)"],
"-moz-mac-disabledtoolbartext": ["rgb(127, 127, 127)"],
"-moz-mac-secondaryhighlight": ["rgb(212, 212, 212)"],