Merge mozilla-inbound to mozilla-central a=merge

This commit is contained in:
Razvan Maries 2018-12-19 23:58:38 +02:00
Родитель dbdaa6c12c c074144472
Коммит 0e169796a1
27 изменённых файлов: 286 добавлений и 180 удалений

Просмотреть файл

@ -1599,6 +1599,8 @@ def security_hardening_cflags(hardening_flag, asan, optimize, c_compiler, target
flags = []
js_flags = []
ldflags = []
js_ldflags = []
# FORTIFY_SOURCE ------------------------------------
# If hardening is explicitly enabled, or not explicitly disabled
@ -1621,6 +1623,14 @@ def security_hardening_cflags(hardening_flag, asan, optimize, c_compiler, target
if target.os != 'WINNT' or c_compiler == 'gcc':
flags.append("-fstack-protector-strong")
if c_compiler.type == 'clang-cl':
flags.append("-guard:cf")
js_flags.append("-guard:cf")
# nolongjmp is needed because clang doesn't emit the CFG tables of
# setjmp return addresses https://bugs.llvm.org/show_bug.cgi?id=40057
ldflags.append("-guard:cf,nolongjmp")
js_ldflags.append("-guard:cf,nolongjmp")
# If ASAN _is_ on, undefine FOTIFY_SOURCE just to be safe
if asan:
flags.append("-U_FORTIFY_SOURCE")
@ -1636,12 +1646,16 @@ def security_hardening_cflags(hardening_flag, asan, optimize, c_compiler, target
return namespace(
flags=flags,
ldflags=ldflags,
js_flags=js_flags,
js_ldflags=js_ldflags,
)
add_old_configure_assignment('MOZ_HARDENING_CFLAGS', security_hardening_cflags.flags)
add_old_configure_assignment('MOZ_HARDENING_LDFLAGS', security_hardening_cflags.ldflags)
add_old_configure_assignment('MOZ_HARDENING_CFLAGS_JS', security_hardening_cflags.js_flags)
add_old_configure_assignment('MOZ_HARDENING_LDFLAGS_JS', security_hardening_cflags.js_ldflags)
# Code Coverage
# ==============================================================

Просмотреть файл

@ -149,7 +149,6 @@
#include "nsCommandManager.h"
#include "nsPIDOMWindow.h"
#include "nsPILoadGroupInternal.h"
#include "nsPIWindowRoot.h"
#include "IHistory.h"
@ -6693,11 +6692,6 @@ nsresult nsDocShell::EndPageLoad(nsIWebProgress* aProgress,
if (NS_SUCCEEDED(rv) && !channelCreationTime.IsNull()) {
Telemetry::AccumulateTimeDelta(Telemetry::TOTAL_CONTENT_PAGE_LOAD_TIME,
channelCreationTime);
nsCOMPtr<nsPILoadGroupInternal> internalLoadGroup =
do_QueryInterface(mLoadGroup);
if (internalLoadGroup) {
internalLoadGroup->OnEndPageLoad(aChannel);
}
}
}

5
dom/cache/DBSchema.cpp поставляемый
Просмотреть файл

@ -1349,7 +1349,7 @@ nsresult QueryCache(mozIStorageConnection* aConn, CacheId aCacheId,
"FROM entries "
"LEFT OUTER JOIN response_headers ON "
"entries.id=response_headers.entry_id "
"AND response_headers.name='vary' "
"AND response_headers.name='vary' COLLATE NOCASE "
"WHERE entries.cache_id=:cache_id "
"AND entries.request_url_no_query_hash=:url_no_query_hash ");
@ -1469,7 +1469,8 @@ nsresult MatchByVaryHeader(mozIStorageConnection* aConn,
nsCOMPtr<mozIStorageStatement> state;
nsresult rv = aConn->CreateStatement(
NS_LITERAL_CSTRING("SELECT value FROM response_headers "
"WHERE name='vary' AND entry_id=:entry_id;"),
"WHERE name='vary' COLLATE NOCASE "
"AND entry_id=:entry_id;"),
getter_AddRefs(state));
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;

Просмотреть файл

@ -38,9 +38,12 @@ EmptyBody::EmptyBody(nsIGlobalObject* aGlobal,
AbortSignalImpl* aAbortSignalImpl,
already_AddRefed<nsIInputStream> aBodyStream)
: FetchBody<EmptyBody>(aGlobal),
mPrincipalInfo(aPrincipalInfo),
mAbortSignalImpl(aAbortSignalImpl),
mBodyStream(std::move(aBodyStream)) {}
mBodyStream(std::move(aBodyStream)) {
if (aPrincipalInfo) {
mPrincipalInfo = MakeUnique<mozilla::ipc::PrincipalInfo>(*aPrincipalInfo);
}
}
EmptyBody::~EmptyBody() = default;

Просмотреть файл

@ -838,6 +838,15 @@ FetchDriver::OnStartRequest(nsIRequest* aRequest, nsISupports* aContext) {
response = new InternalResponse(responseStatus, statusText);
UniquePtr<mozilla::ipc::PrincipalInfo> principalInfo(
new mozilla::ipc::PrincipalInfo());
nsresult rv = PrincipalToPrincipalInfo(mPrincipal, principalInfo.get());
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}
response->SetPrincipalInfo(std::move(principalInfo));
response->Headers()->FillResponseHeaders(httpChannel);
// If Content-Encoding or Transfer-Encoding headers are set, then the actual
@ -1374,11 +1383,23 @@ void FetchDriver::SetController(
void FetchDriver::SetRequestHeaders(nsIHttpChannel* aChannel) const {
MOZ_ASSERT(aChannel);
// nsIHttpChannel has a set of pre-configured headers (Accept,
// Accept-Languages, ...) and we don't want to merge the Request's headers
// with them. This array is used to know if the current header has been aleady
// set, if yes, we ask necko to merge it with the previous one, otherwise, we
// don't want the merge.
nsTArray<nsCString> headersSet;
AutoTArray<InternalHeaders::Entry, 5> headers;
mRequest->Headers()->GetEntries(headers);
bool hasAccept = false;
for (uint32_t i = 0; i < headers.Length(); ++i) {
if (!hasAccept && headers[i].mName.EqualsLiteral("accept")) {
bool alreadySet = headersSet.Contains(headers[i].mName);
if (!alreadySet) {
headersSet.AppendElement(headers[i].mName);
}
if (!hasAccept && headers[i].mName.EqualsIgnoreCase("accept")) {
hasAccept = true;
}
if (headers[i].mValue.IsEmpty()) {
@ -1387,7 +1408,7 @@ void FetchDriver::SetRequestHeaders(nsIHttpChannel* aChannel) const {
MOZ_ASSERT(NS_SUCCEEDED(rv));
} else {
DebugOnly<nsresult> rv = aChannel->SetRequestHeader(
headers[i].mName, headers[i].mValue, false /* merge */);
headers[i].mName, headers[i].mValue, alreadySet /* merge */);
MOZ_ASSERT(NS_SUCCEEDED(rv));
}
}

Просмотреть файл

@ -51,9 +51,12 @@ void InternalHeaders::Append(const nsACString& aName, const nsACString& aValue,
return;
}
nsAutoCString name(aName);
ReuseExistingNameIfExists(name);
SetListDirty();
mList.AppendElement(Entry(lowerName, trimValue));
mList.AppendElement(Entry(name, trimValue));
}
void InternalHeaders::Delete(const nsACString& aName, ErrorResult& aRv) {
@ -68,7 +71,7 @@ void InternalHeaders::Delete(const nsACString& aName, ErrorResult& aRv) {
// remove in reverse order to minimize copying
for (int32_t i = mList.Length() - 1; i >= 0; --i) {
if (lowerName == mList[i].mName) {
if (mList[i].mName.EqualsIgnoreCase(lowerName.get())) {
mList.RemoveElementAt(i);
}
}
@ -87,7 +90,7 @@ void InternalHeaders::Get(const nsACString& aName, nsACString& aValue,
bool firstValueFound = false;
for (uint32_t i = 0; i < mList.Length(); ++i) {
if (lowerName == mList[i].mName) {
if (mList[i].mName.EqualsIgnoreCase(lowerName.get())) {
if (firstValueFound) {
aValue += delimiter;
}
@ -112,7 +115,7 @@ void InternalHeaders::GetFirst(const nsACString& aName, nsACString& aValue,
}
for (uint32_t i = 0; i < mList.Length(); ++i) {
if (lowerName == mList[i].mName) {
if (mList[i].mName.EqualsIgnoreCase(lowerName.get())) {
aValue = mList[i].mValue;
return;
}
@ -131,7 +134,7 @@ bool InternalHeaders::Has(const nsACString& aName, ErrorResult& aRv) const {
}
for (uint32_t i = 0; i < mList.Length(); ++i) {
if (lowerName == mList[i].mName) {
if (mList[i].mName.EqualsIgnoreCase(lowerName.get())) {
return true;
}
}
@ -155,7 +158,7 @@ void InternalHeaders::Set(const nsACString& aName, const nsACString& aValue,
// remove in reverse order to minimize copying
for (int32_t i = mList.Length() - 1; i >= 0; --i) {
if (lowerName == mList[i].mName) {
if (mList[i].mName.EqualsIgnoreCase(lowerName.get())) {
firstIndex = std::min(firstIndex, i);
mList.RemoveElementAt(i);
}
@ -163,10 +166,10 @@ void InternalHeaders::Set(const nsACString& aName, const nsACString& aValue,
if (firstIndex < INT32_MAX) {
Entry* entry = mList.InsertElementAt(firstIndex);
entry->mName = lowerName;
entry->mName = aName;
entry->mValue = trimValue;
} else {
mList.AppendElement(Entry(lowerName, trimValue));
mList.AppendElement(Entry(aName, trimValue));
}
}
@ -184,7 +187,7 @@ void InternalHeaders::SetGuard(HeadersGuardEnum aGuard, ErrorResult& aRv) {
InternalHeaders::~InternalHeaders() {}
// static
bool InternalHeaders::IsSimpleHeader(const nsACString& aName,
bool InternalHeaders::IsSimpleHeader(const nsCString& aName,
const nsACString& aValue) {
if (aValue.Length() > 128) {
return false;
@ -192,22 +195,23 @@ bool InternalHeaders::IsSimpleHeader(const nsACString& aName,
// Note, we must allow a null content-type value here to support
// get("content-type"), but the IsInvalidValue() check will prevent null
// from being set or appended.
return (aName.EqualsLiteral("accept") &&
return (aName.EqualsIgnoreCase("accept") &&
nsContentUtils::IsAllowedNonCorsAccept(aValue)) ||
(aName.EqualsLiteral("accept-language") &&
(aName.EqualsIgnoreCase("accept-language") &&
nsContentUtils::IsAllowedNonCorsLanguage(aValue)) ||
(aName.EqualsLiteral("content-language") &&
(aName.EqualsIgnoreCase("content-language") &&
nsContentUtils::IsAllowedNonCorsLanguage(aValue)) ||
(aName.EqualsLiteral("content-type") &&
(aName.EqualsIgnoreCase("content-type") &&
nsContentUtils::IsAllowedNonCorsContentType(aValue));
}
// static
bool InternalHeaders::IsRevalidationHeader(const nsACString& aName) {
return aName.EqualsLiteral("if-modified-since") ||
aName.EqualsLiteral("if-none-match") ||
aName.EqualsLiteral("if-unmodified-since") ||
aName.EqualsLiteral("if-match") || aName.EqualsLiteral("if-range");
bool InternalHeaders::IsRevalidationHeader(const nsCString& aName) {
return aName.EqualsIgnoreCase("if-modified-since") ||
aName.EqualsIgnoreCase("if-none-match") ||
aName.EqualsIgnoreCase("if-unmodified-since") ||
aName.EqualsIgnoreCase("if-match") ||
aName.EqualsIgnoreCase("if-range");
}
// static
@ -240,24 +244,24 @@ bool InternalHeaders::IsImmutable(ErrorResult& aRv) const {
return false;
}
bool InternalHeaders::IsForbiddenRequestHeader(const nsACString& aName) const {
bool InternalHeaders::IsForbiddenRequestHeader(const nsCString& aName) const {
return mGuard == HeadersGuardEnum::Request &&
nsContentUtils::IsForbiddenRequestHeader(aName);
}
bool InternalHeaders::IsForbiddenRequestNoCorsHeader(
const nsACString& aName) const {
const nsCString& aName) const {
return mGuard == HeadersGuardEnum::Request_no_cors &&
!IsSimpleHeader(aName, EmptyCString());
}
bool InternalHeaders::IsForbiddenRequestNoCorsHeader(
const nsACString& aName, const nsACString& aValue) const {
const nsCString& aName, const nsACString& aValue) const {
return mGuard == HeadersGuardEnum::Request_no_cors &&
!IsSimpleHeader(aName, aValue);
}
bool InternalHeaders::IsForbiddenResponseHeader(const nsACString& aName) const {
bool InternalHeaders::IsForbiddenResponseHeader(const nsCString& aName) const {
return mGuard == HeadersGuardEnum::Response &&
nsContentUtils::IsForbiddenResponseHeader(aName);
}
@ -399,12 +403,12 @@ already_AddRefed<InternalHeaders> InternalHeaders::CORSHeaders(
nsCaseInsensitiveCStringArrayComparator comp;
for (uint32_t i = 0; i < aHeaders->mList.Length(); ++i) {
const Entry& entry = aHeaders->mList[i];
if (entry.mName.EqualsASCII("cache-control") ||
entry.mName.EqualsASCII("content-language") ||
entry.mName.EqualsASCII("content-type") ||
entry.mName.EqualsASCII("expires") ||
entry.mName.EqualsASCII("last-modified") ||
entry.mName.EqualsASCII("pragma") ||
if (entry.mName.EqualsIgnoreCase("cache-control") ||
entry.mName.EqualsIgnoreCase("content-language") ||
entry.mName.EqualsIgnoreCase("content-type") ||
entry.mName.EqualsIgnoreCase("expires") ||
entry.mName.EqualsIgnoreCase("last-modified") ||
entry.mName.EqualsIgnoreCase("pragma") ||
exposeNamesArray.Contains(entry.mName, comp)) {
cors->Append(entry.mName, entry.mValue, result);
MOZ_ASSERT(!result.Failed());
@ -454,7 +458,7 @@ void InternalHeaders::MaybeSortList() {
for (const Entry& entry : mList) {
bool found = false;
for (Entry& sortedEntry : mSortedList) {
if (sortedEntry.mName == entry.mName) {
if (sortedEntry.mName.EqualsIgnoreCase(entry.mName.get())) {
sortedEntry.mValue += ", ";
sortedEntry.mValue += entry.mValue;
found = true;
@ -463,7 +467,9 @@ void InternalHeaders::MaybeSortList() {
}
if (!found) {
mSortedList.InsertElementSorted(entry, comparator);
Entry newEntry = entry;
ToLowerCase(newEntry.mName);
mSortedList.InsertElementSorted(newEntry, comparator);
}
}
}
@ -473,5 +479,14 @@ void InternalHeaders::SetListDirty() {
mListDirty = true;
}
void InternalHeaders::ReuseExistingNameIfExists(nsCString& aName) const {
for (const Entry& entry : mList) {
if (entry.mName.EqualsIgnoreCase(aName.get())) {
aName = entry.mName;
break;
}
}
}
} // namespace dom
} // namespace mozilla

Просмотреть файл

@ -125,17 +125,17 @@ class InternalHeaders final {
static bool IsInvalidName(const nsACString& aName, ErrorResult& aRv);
static bool IsInvalidValue(const nsACString& aValue, ErrorResult& aRv);
bool IsImmutable(ErrorResult& aRv) const;
bool IsForbiddenRequestHeader(const nsACString& aName) const;
bool IsForbiddenRequestNoCorsHeader(const nsACString& aName) const;
bool IsForbiddenRequestNoCorsHeader(const nsACString& aName,
bool IsForbiddenRequestHeader(const nsCString& aName) const;
bool IsForbiddenRequestNoCorsHeader(const nsCString& aName) const;
bool IsForbiddenRequestNoCorsHeader(const nsCString& aName,
const nsACString& aValue) const;
bool IsForbiddenResponseHeader(const nsACString& aName) const;
bool IsForbiddenResponseHeader(const nsCString& aName) const;
bool IsInvalidMutableHeader(const nsACString& aName, ErrorResult& aRv) const {
bool IsInvalidMutableHeader(const nsCString& aName, ErrorResult& aRv) const {
return IsInvalidMutableHeader(aName, EmptyCString(), aRv);
}
bool IsInvalidMutableHeader(const nsACString& aName, const nsACString& aValue,
bool IsInvalidMutableHeader(const nsCString& aName, const nsACString& aValue,
ErrorResult& aRv) const {
return IsInvalidName(aName, aRv) || IsInvalidValue(aValue, aRv) ||
IsImmutable(aRv) || IsForbiddenRequestHeader(aName) ||
@ -143,9 +143,13 @@ class InternalHeaders final {
IsForbiddenResponseHeader(aName);
}
static bool IsSimpleHeader(const nsACString& aName, const nsACString& aValue);
// This method updates the passed name to match the capitalization of a header
// with the same name (ignoring case, per the spec).
void ReuseExistingNameIfExists(nsCString& aName) const;
static bool IsRevalidationHeader(const nsACString& aName);
static bool IsSimpleHeader(const nsCString& aName, const nsACString& aValue);
static bool IsRevalidationHeader(const nsCString& aName);
void MaybeSortList();
void SetListDirty();

Просмотреть файл

@ -508,16 +508,22 @@ bool MutableBlobStorage::MaybeCreateTemporaryFile(
RefPtr<MutableBlobStorage> self = this;
nsCOMPtr<nsIRunnable> r = NS_NewRunnableFunction(
"MutableBlobStorage::MaybeCreateTemporaryFile",
[self]() { self->MaybeCreateTemporaryFileOnMainThread(); });
EventTarget()->Dispatch(r.forget(), NS_DISPATCH_SYNC);
return !!mActor;
[self]() {
MutexAutoLock lock(self->mMutex);
self->MaybeCreateTemporaryFileOnMainThread(lock);
if (!self->mActor) {
self->ErrorPropagated(NS_ERROR_FAILURE);
}
});
EventTarget()->Dispatch(r.forget(), NS_DISPATCH_NORMAL);
return true;
}
MaybeCreateTemporaryFileOnMainThread();
MaybeCreateTemporaryFileOnMainThread(aProofOfLock);
return !!mActor;
}
void MutableBlobStorage::MaybeCreateTemporaryFileOnMainThread() {
void MutableBlobStorage::MaybeCreateTemporaryFileOnMainThread(const MutexAutoLock& aProofOfLock) {
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(!mActor);

Просмотреть файл

@ -86,7 +86,7 @@ class MutableBlobStorage final {
uint64_t aSize) const;
bool MaybeCreateTemporaryFile(const MutexAutoLock& aProofOfLock);
void MaybeCreateTemporaryFileOnMainThread();
void MaybeCreateTemporaryFileOnMainThread(const MutexAutoLock& aProofOfLock);
MOZ_MUST_USE nsresult
DispatchToIOThread(already_AddRefed<nsIRunnable> aRunnable);

Просмотреть файл

@ -16,9 +16,10 @@
#include "SVGContentUtils.h"
#include "SVGTransformListSMILType.h"
namespace mozilla {
using namespace mozilla::dom;
using namespace mozilla::dom::SVGTransform_Binding;
using namespace dom;
namespace mozilla {
nsresult nsSVGAnimatedTransformList::SetBaseValueString(
const nsAString& aValue, nsSVGElement* aSVGElement) {

Просмотреть файл

@ -1,7 +1,7 @@
var data = new Array(256).join("1234567890ABCDEF");
function test_basic() {
info("Simple test");
function test_fetch_basic() {
info("Simple fetch test");
fetch("/tests/dom/xhr/tests/temporaryFileBlob.sjs",
{ method: "POST", body: data })
@ -10,6 +10,9 @@ function test_basic() {
}).then(blob => {
ok(blob instanceof Blob, "We have a blob!");
is(blob.size, data.length, "Data length matches");
if ("SpecialPowers" in self) {
is(SpecialPowers.wrap(blob).blobImplType, "StreamBlobImpl", "We have a blob stored into a stream file");
}
var fr = new FileReader();
fr.readAsText(blob);
@ -20,7 +23,53 @@ function test_basic() {
});
}
function test_worker() {
function test_fetch_worker() {
info("fetch in workers");
var w = new Worker('worker_temporaryFileBlob.js');
w.onmessage = function(e) {
if (e.data.type == 'info') {
info(e.data.msg);
} else if (e.data.type == 'check') {
ok(e.data.what, e.data.msg);
} else if (e.data.type == 'finish') {
next();
} else {
ok(false, 'Something wrong happened');
}
}
w.postMessage('fetch');
}
function test_xhr_basic() {
info("Simple XHR test");
let xhr = new XMLHttpRequest();
xhr.responseType = "blob";
xhr.open("POST", "/tests/dom/xhr/tests/temporaryFileBlob.sjs");
xhr.send(data);
xhr.onreadystatechange = function() {
if (xhr.readyState == 4) {
let blob = xhr.response;
ok(blob instanceof Blob, "We have a blob!");
is(blob.size, data.length, "Data length matches");
if ("SpecialPowers" in self) {
is(SpecialPowers.wrap(blob).blobImplType, "StreamBlobImpl", "We have a blob stored into a stream file");
}
var fr = new FileReader();
fr.readAsText(blob);
fr.onload = function() {
is(fr.result, data, "Data content matches");
next();
}
}
}
}
function test_xhr_worker() {
info("XHR in workers");
var w = new Worker('worker_temporaryFileBlob.js');
w.onmessage = function(e) {
@ -35,5 +84,5 @@ function test_worker() {
}
}
w.postMessage(42);
w.postMessage('xhr');
}

Просмотреть файл

@ -12,8 +12,10 @@
var tests = [
// from common_temporaryFileBlob.js:
test_basic,
test_worker,
test_fetch_basic,
test_fetch_worker,
test_xhr_basic,
test_xhr_worker,
];
function next() {

Просмотреть файл

@ -17,5 +17,9 @@ function next() {
}
onmessage = function(e) {
test_basic();
if (e == 'xhr') {
test_xhr_basic();
} else {
test_fetch_basic();
}
}

Просмотреть файл

@ -737,12 +737,16 @@ JS_FRIEND_API bool js::CheckGrayMarkingState(JSRuntime* rt) {
return tracer.check(session);
}
static Zone* GetCellZone(Cell* cell) {
static Zone* GetCellZoneFromAnyThread(Cell* cell) {
if (cell->is<JSObject>()) {
return cell->as<JSObject>()->zone();
return cell->as<JSObject>()->zoneFromAnyThread();
}
return cell->asTenured().zone();
if (cell->is<JSString>()) {
return cell->as<JSString>()->zoneFromAnyThread();
}
return cell->asTenured().zoneFromAnyThread();
}
static JSObject* MaybeGetDelegate(Cell* cell) {
@ -757,17 +761,18 @@ static JSObject* MaybeGetDelegate(Cell* cell) {
bool js::gc::CheckWeakMapEntryMarking(const WeakMapBase* map, Cell* key,
Cell* value) {
DebugOnly<Zone*> zone = map->zone();
MOZ_ASSERT(CurrentThreadCanAccessZone(zone));
MOZ_ASSERT(zone->isGCMarking());
JSObject* object = map->memberOf;
MOZ_ASSERT_IF(object, object->zone() == zone);
// Debugger weak maps can have keys in different zones.
Zone* keyZone = GetCellZone(key);
Zone* keyZone = GetCellZoneFromAnyThread(key);
MOZ_ASSERT_IF(!map->allowKeysInOtherZones(),
keyZone == zone || keyZone->isAtomsZone());
Zone* valueZone = GetCellZone(value);
Zone* valueZone = GetCellZoneFromAnyThread(value);
MOZ_ASSERT(valueZone == zone || valueZone->isAtomsZone());
CellColor mapColor = map->markColor == MarkColor::Black ? CellColor::Black

Просмотреть файл

@ -0,0 +1,9 @@
// |jit-test| skip-if: helperThreadCount() === 0
evalInWorker(`
var sym4 = Symbol.match;
function test(makeNonArray) {}
function basicSweeping() {}
var wm1 = new WeakMap();
wm1.set(basicSweeping, sym4);
startgc(100000, 'shrinking');
`);

Просмотреть файл

@ -137,10 +137,12 @@ void Simulator::init(Decoder* decoder, FILE* stream) {
set_sp(tos);
// Set the sample period to 10, as the VIXL examples and tests are short.
instrumentation_ = js_new<Instrument>("vixl_stats.csv", 10);
if (!instrumentation_) {
oom_ = true;
return;
if (getenv("VIXL_STATS")) {
instrumentation_ = js_new<Instrument>("vixl_stats.csv", 10);
if (!instrumentation_) {
oom_ = true;
return;
}
}
// Print a warning about exclusive-access instructions, but only the first

Просмотреть файл

@ -204,6 +204,10 @@ void Simulator::set_trace_parameters(int parameters) {
void Simulator::set_instruction_stats(bool value) {
if (instrumentation_ == nullptr) {
return;
}
if (value != instruction_stats_) {
if (value) {
decoder_->AppendVisitor(instrumentation_);

Просмотреть файл

@ -519,6 +519,7 @@ dnl ========================================================
CFLAGS="$CFLAGS $MOZ_HARDENING_CFLAGS_JS"
CPPFLAGS="$CPPFLAGS $MOZ_HARDENING_CFLAGS_JS"
CXXFLAGS="$CXXFLAGS $MOZ_HARDENING_CFLAGS_JS"
LDFLAGS="$LDFLAGS $MOZ_HARDENING_LDFLAGS_JS"
dnl ========================================================
dnl System overrides of the defaults for target

Просмотреть файл

@ -127,7 +127,6 @@ XPIDL_SOURCES += [
'nsIURIWithSpecialOrigin.idl',
'nsIURL.idl',
'nsIURLParser.idl',
'nsPILoadGroupInternal.idl',
'nsPISocketTransportService.idl',
]

Просмотреть файл

@ -83,19 +83,17 @@ static void RescheduleRequest(nsIRequest *aRequest, int32_t delta) {
if (p) p->AdjustPriority(delta);
}
nsLoadGroup::nsLoadGroup(nsISupports *outer)
nsLoadGroup::nsLoadGroup()
: mForegroundCount(0),
mLoadFlags(LOAD_NORMAL),
mDefaultLoadFlags(0),
mPriority(PRIORITY_NORMAL),
mRequests(&sRequestHashOps, sizeof(RequestMapEntry)),
mStatus(NS_OK),
mPriority(PRIORITY_NORMAL),
mIsCanceling(false),
mDefaultLoadIsTimed(false),
mTimedRequests(0),
mCachedRequests(0),
mTimedNonCachedRequestsUntilOnEndPageLoad(0) {
NS_INIT_AGGREGATED(outer);
mCachedRequests(0) {
LOG(("LOADGROUP [%p]: Created.\n", this));
}
@ -115,15 +113,12 @@ nsLoadGroup::~nsLoadGroup() {
////////////////////////////////////////////////////////////////////////////////
// nsISupports methods:
NS_IMPL_AGGREGATED(nsLoadGroup)
NS_INTERFACE_MAP_BEGIN_AGGREGATED(nsLoadGroup)
NS_INTERFACE_MAP_ENTRY(nsILoadGroup)
NS_INTERFACE_MAP_ENTRY(nsPILoadGroupInternal)
NS_INTERFACE_MAP_ENTRY(nsILoadGroupChild)
NS_INTERFACE_MAP_ENTRY(nsIRequest)
NS_INTERFACE_MAP_ENTRY(nsISupportsPriority)
NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference)
NS_INTERFACE_MAP_END
NS_IMPL_ISUPPORTS(nsLoadGroup,
nsILoadGroup,
nsILoadGroupChild,
nsIRequest,
nsISupportsPriority,
nsISupportsWeakReference)
////////////////////////////////////////////////////////////////////////////////
// nsIRequest methods:
@ -538,8 +533,6 @@ nsLoadGroup::RemoveRequest(nsIRequest *request, nsISupports *ctxt,
rv = timedChannel->GetCacheReadStart(&timeStamp);
if (NS_SUCCEEDED(rv) && !timeStamp.IsNull()) {
++mCachedRequests;
} else {
mTimedNonCachedRequestsUntilOnEndPageLoad++;
}
rv = timedChannel->GetAsyncOpen(&timeStamp);
@ -695,18 +688,6 @@ nsLoadGroup::GetRootLoadGroup(nsILoadGroup **aRootLoadGroup) {
return NS_OK;
}
////////////////////////////////////////////////////////////////////////////////
// nsPILoadGroupInternal methods:
NS_IMETHODIMP
nsLoadGroup::OnEndPageLoad(nsIChannel *aDefaultChannel) {
LOG(("nsLoadGroup::OnEndPageLoad this=%p default-request=%p", this,
aDefaultChannel));
// for the moment, nothing to do here.
return NS_OK;
}
////////////////////////////////////////////////////////////////////////////////
// nsISupportsPriority methods:

Просмотреть файл

@ -8,8 +8,6 @@
#include "nsILoadGroup.h"
#include "nsILoadGroupChild.h"
#include "nsPILoadGroupInternal.h"
#include "nsAgg.h"
#include "nsCOMPtr.h"
#include "nsWeakReference.h"
#include "nsISupportsPriority.h"
@ -26,10 +24,9 @@ namespace net {
class nsLoadGroup : public nsILoadGroup,
public nsILoadGroupChild,
public nsISupportsPriority,
public nsSupportsWeakReference,
public nsPILoadGroupInternal {
public nsSupportsWeakReference {
public:
NS_DECL_AGGREGATED
NS_DECL_ISUPPORTS
////////////////////////////////////////////////////////////////////////////
// nsIRequest methods:
@ -38,7 +35,6 @@ class nsLoadGroup : public nsILoadGroup,
////////////////////////////////////////////////////////////////////////////
// nsILoadGroup methods:
NS_DECL_NSILOADGROUP
NS_DECL_NSPILOADGROUPINTERNAL
////////////////////////////////////////////////////////////////////////////
// nsILoadGroupChild methods:
@ -51,12 +47,13 @@ class nsLoadGroup : public nsILoadGroup,
////////////////////////////////////////////////////////////////////////////
// nsLoadGroup methods:
explicit nsLoadGroup(nsISupports* outer);
virtual ~nsLoadGroup();
nsLoadGroup();
nsresult Init();
protected:
virtual ~nsLoadGroup();
nsresult MergeLoadFlags(nsIRequest* aRequest, nsLoadFlags& flags);
nsresult MergeDefaultLoadFlags(nsIRequest* aRequest, nsLoadFlags& flags);
@ -69,6 +66,7 @@ class nsLoadGroup : public nsILoadGroup,
uint32_t mForegroundCount;
uint32_t mLoadFlags;
uint32_t mDefaultLoadFlags;
int32_t mPriority;
nsCOMPtr<nsILoadGroup> mLoadGroup; // load groups can contain load groups
nsCOMPtr<nsIInterfaceRequestor> mCallbacks;
@ -82,18 +80,14 @@ class nsLoadGroup : public nsILoadGroup,
nsWeakPtr mParentLoadGroup;
nsresult mStatus;
int32_t mPriority;
bool mIsCanceling;
bool mDefaultLoadIsTimed;
/* Telemetry */
mozilla::TimeStamp mDefaultRequestCreationTime;
bool mDefaultLoadIsTimed;
uint32_t mTimedRequests;
uint32_t mCachedRequests;
/* For nsPILoadGroupInternal */
uint32_t mTimedNonCachedRequestsUntilOnEndPageLoad;
nsCString mUserAgentOverrideCache;
};

Просмотреть файл

@ -1,28 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* 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/. */
#include "nsISupports.idl"
interface nsIChannel;
/**
* Dumping ground for load group experimental work.
* This interface will never be frozen. If you are
* using any feature exposed by this interface, be aware that this interface
* will change and you will be broken. You have been warned.
*/
[scriptable, uuid(6ef2f8ac-9584-48f3-957a-0c94fff0c8c7)]
interface nsPILoadGroupInternal : nsISupports
{
/**
* Called when the load group has loaded main page and
* subresources. (i.e.essentially DOMComplete)
*
* @param aDefaultChanel
* The request channel for the base apge
*/
void OnEndPageLoad(in nsIChannel aDefaultChannel);
};

Просмотреть файл

@ -113,7 +113,7 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(nsAtomicFileOutputStream)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsSafeFileOutputStream)
typedef mozilla::net::nsLoadGroup nsLoadGroup;
NS_GENERIC_AGGREGATED_CONSTRUCTOR_INIT(nsLoadGroup, Init)
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsLoadGroup, Init)
#include "ArrayBufferInputStream.h"
NS_GENERIC_FACTORY_CONSTRUCTOR(ArrayBufferInputStream)

Просмотреть файл

@ -1314,10 +1314,35 @@ nsresult EnsureMIMEOfScript(nsIURI *aURI, nsHttpResponseHead *aResponseHead,
if (nsContentUtils::IsJavascriptMIMEType(typeString)) {
// script load has type script
AccumulateCategorical(
Telemetry::LABELS_SCRIPT_BLOCK_INCORRECT_MIME_2::javaScript);
Telemetry::LABELS_SCRIPT_BLOCK_INCORRECT_MIME_3::javaScript);
return NS_OK;
}
switch (aLoadInfo->InternalContentPolicyType()) {
case nsIContentPolicy::TYPE_SCRIPT:
case nsIContentPolicy::TYPE_INTERNAL_SCRIPT:
case nsIContentPolicy::TYPE_INTERNAL_SCRIPT_PRELOAD:
AccumulateCategorical(
Telemetry::LABELS_SCRIPT_BLOCK_INCORRECT_MIME_3::script_load);
break;
case nsIContentPolicy::TYPE_INTERNAL_WORKER:
case nsIContentPolicy::TYPE_INTERNAL_SHARED_WORKER:
AccumulateCategorical(
Telemetry::LABELS_SCRIPT_BLOCK_INCORRECT_MIME_3::worker_load);
break;
case nsIContentPolicy::TYPE_INTERNAL_SERVICE_WORKER:
AccumulateCategorical(
Telemetry::LABELS_SCRIPT_BLOCK_INCORRECT_MIME_3::serviceworker_load);
break;
case nsIContentPolicy::TYPE_INTERNAL_WORKER_IMPORT_SCRIPTS:
AccumulateCategorical(
Telemetry::LABELS_SCRIPT_BLOCK_INCORRECT_MIME_3::importScript_load);
break;
default:
MOZ_ASSERT_UNREACHABLE("unexpected script type");
break;
}
nsCOMPtr<nsIURI> requestURI;
aLoadInfo->LoadingPrincipal()->GetURI(getter_AddRefs(requestURI));
@ -1327,7 +1352,7 @@ nsresult EnsureMIMEOfScript(nsIURI *aURI, nsHttpResponseHead *aResponseHead,
if (NS_SUCCEEDED(rv)) {
// same origin
AccumulateCategorical(
Telemetry::LABELS_SCRIPT_BLOCK_INCORRECT_MIME_2::same_origin);
Telemetry::LABELS_SCRIPT_BLOCK_INCORRECT_MIME_3::same_origin);
} else {
bool cors = false;
nsAutoCString corsOrigin;
@ -1353,11 +1378,11 @@ nsresult EnsureMIMEOfScript(nsIURI *aURI, nsHttpResponseHead *aResponseHead,
if (cors) {
// cors origin
AccumulateCategorical(
Telemetry::LABELS_SCRIPT_BLOCK_INCORRECT_MIME_2::CORS_origin);
Telemetry::LABELS_SCRIPT_BLOCK_INCORRECT_MIME_3::CORS_origin);
} else {
// cross origin
AccumulateCategorical(
Telemetry::LABELS_SCRIPT_BLOCK_INCORRECT_MIME_2::cross_origin);
Telemetry::LABELS_SCRIPT_BLOCK_INCORRECT_MIME_3::cross_origin);
}
}
@ -1365,22 +1390,22 @@ nsresult EnsureMIMEOfScript(nsIURI *aURI, nsHttpResponseHead *aResponseHead,
if (StringBeginsWith(contentType, NS_LITERAL_CSTRING("image/"))) {
// script load has type image
AccumulateCategorical(
Telemetry::LABELS_SCRIPT_BLOCK_INCORRECT_MIME_2::image);
Telemetry::LABELS_SCRIPT_BLOCK_INCORRECT_MIME_3::image);
block = true;
} else if (StringBeginsWith(contentType, NS_LITERAL_CSTRING("audio/"))) {
// script load has type audio
AccumulateCategorical(
Telemetry::LABELS_SCRIPT_BLOCK_INCORRECT_MIME_2::audio);
Telemetry::LABELS_SCRIPT_BLOCK_INCORRECT_MIME_3::audio);
block = true;
} else if (StringBeginsWith(contentType, NS_LITERAL_CSTRING("video/"))) {
// script load has type video
AccumulateCategorical(
Telemetry::LABELS_SCRIPT_BLOCK_INCORRECT_MIME_2::video);
Telemetry::LABELS_SCRIPT_BLOCK_INCORRECT_MIME_3::video);
block = true;
} else if (StringBeginsWith(contentType, NS_LITERAL_CSTRING("text/csv"))) {
// script load has type text/csv
AccumulateCategorical(
Telemetry::LABELS_SCRIPT_BLOCK_INCORRECT_MIME_2::text_csv);
Telemetry::LABELS_SCRIPT_BLOCK_INCORRECT_MIME_3::text_csv);
block = true;
}
@ -1407,14 +1432,14 @@ nsresult EnsureMIMEOfScript(nsIURI *aURI, nsHttpResponseHead *aResponseHead,
if (StringBeginsWith(contentType, NS_LITERAL_CSTRING("text/plain"))) {
// script load has type text/plain
AccumulateCategorical(
Telemetry::LABELS_SCRIPT_BLOCK_INCORRECT_MIME_2::text_plain);
Telemetry::LABELS_SCRIPT_BLOCK_INCORRECT_MIME_3::text_plain);
return NS_OK;
}
if (StringBeginsWith(contentType, NS_LITERAL_CSTRING("text/xml"))) {
// script load has type text/xml
AccumulateCategorical(
Telemetry::LABELS_SCRIPT_BLOCK_INCORRECT_MIME_2::text_xml);
Telemetry::LABELS_SCRIPT_BLOCK_INCORRECT_MIME_3::text_xml);
return NS_OK;
}
@ -1422,34 +1447,48 @@ nsresult EnsureMIMEOfScript(nsIURI *aURI, nsHttpResponseHead *aResponseHead,
NS_LITERAL_CSTRING("application/octet-stream"))) {
// script load has type application/octet-stream
AccumulateCategorical(
Telemetry::LABELS_SCRIPT_BLOCK_INCORRECT_MIME_2::app_octet_stream);
Telemetry::LABELS_SCRIPT_BLOCK_INCORRECT_MIME_3::app_octet_stream);
return NS_OK;
}
if (StringBeginsWith(contentType, NS_LITERAL_CSTRING("application/xml"))) {
// script load has type application/xml
AccumulateCategorical(
Telemetry::LABELS_SCRIPT_BLOCK_INCORRECT_MIME_2::app_xml);
Telemetry::LABELS_SCRIPT_BLOCK_INCORRECT_MIME_3::app_xml);
return NS_OK;
}
if (StringBeginsWith(contentType, NS_LITERAL_CSTRING("application/json"))) {
// script load has type application/json
AccumulateCategorical(
Telemetry::LABELS_SCRIPT_BLOCK_INCORRECT_MIME_3::app_json);
return NS_OK;
}
if (StringBeginsWith(contentType, NS_LITERAL_CSTRING("text/json"))) {
// script load has type text/json
AccumulateCategorical(
Telemetry::LABELS_SCRIPT_BLOCK_INCORRECT_MIME_3::text_json);
return NS_OK;
}
if (StringBeginsWith(contentType, NS_LITERAL_CSTRING("text/html"))) {
// script load has type text/html
AccumulateCategorical(
Telemetry::LABELS_SCRIPT_BLOCK_INCORRECT_MIME_2::text_html);
Telemetry::LABELS_SCRIPT_BLOCK_INCORRECT_MIME_3::text_html);
return NS_OK;
}
if (contentType.IsEmpty()) {
// script load has no type
AccumulateCategorical(
Telemetry::LABELS_SCRIPT_BLOCK_INCORRECT_MIME_2::empty);
Telemetry::LABELS_SCRIPT_BLOCK_INCORRECT_MIME_3::empty);
return NS_OK;
}
// script load has unknown type
AccumulateCategorical(
Telemetry::LABELS_SCRIPT_BLOCK_INCORRECT_MIME_2::unknown);
Telemetry::LABELS_SCRIPT_BLOCK_INCORRECT_MIME_3::unknown);
return NS_OK;
}

Просмотреть файл

@ -404,6 +404,7 @@ dnl ========================================================
CFLAGS="$CFLAGS $MOZ_HARDENING_CFLAGS"
CPPFLAGS="$CPPFLAGS $MOZ_HARDENING_CFLAGS"
CXXFLAGS="$CXXFLAGS $MOZ_HARDENING_CFLAGS"
LDFLAGS="$LDFLAGS $MOZ_HARDENING_LDFLAGS"
dnl ========================================================
dnl GNU specific defaults

Просмотреть файл

@ -1,15 +0,0 @@
[request-headers-case.any.html]
[Multiple headers with the same name, different case (THIS-is-A-test first)]
expected: FAIL
[Multiple headers with the same name, different case (THIS-IS-A-TEST first)]
expected: FAIL
[request-headers-case.any.worker.html]
[Multiple headers with the same name, different case (THIS-is-A-test first)]
expected: FAIL
[Multiple headers with the same name, different case (THIS-IS-A-TEST first)]
expected: FAIL

Просмотреть файл

@ -7897,14 +7897,14 @@
"n_values": 3,
"description": "Whether the user is in safe mode (No, Yes, Forced)"
},
"SCRIPT_BLOCK_INCORRECT_MIME_2": {
"SCRIPT_BLOCK_INCORRECT_MIME_3": {
"record_in_processes": ["main", "content"],
"alert_emails": ["ckerschbaumer@mozilla.com"],
"bug_numbers": [1288361, 1299267, 1399990],
"expires_in_version": "63",
"bug_numbers": [1288361, 1299267, 1399990, 1510225],
"expires_in_version": "70",
"kind": "categorical",
"labels": ["unknown","javaScript","image", "audio", "video","text_plain","text_csv","text_xml","app_octet_stream","app_xml","text_html","empty","worker_load","importSript_load","script_load","same_origin","CORS_origin","cross_origin"],
"description": "Whether the script load has a MIME type of ...? (unknown, javaScript, image, audio, video, text_plain, text_csv, text_xml, app_octet_stream, app_xml, text_html, empty). Whether the script load is from ...? (worker_load, importSript_load, script_load). Whether the script load is of ...? (same_origin, CORS_origin, cross_origin)"
"labels": ["unknown","javaScript","image", "audio", "video","text_plain","text_csv","text_xml","app_octet_stream","app_xml","app_json","text_json","text_html","empty","serviceworker_load","worker_load","importScript_load","script_load","same_origin","CORS_origin","cross_origin"],
"description": "Whether the script load has a MIME type of ...? (unknown, javaScript, image, audio, video, text_plain, text_csv, text_xml, app_octet_stream, app_xml, app_json, text_json, text_html, empty). Whether the script load is from ...? (serviceworker_load, worker_load, importSript_load, script_load). Whether the script load is of ...? (same_origin, CORS_origin, cross_origin)"
},
"NEWTAB_PAGE_ENABLED": {
"record_in_processes": ["main", "content"],