MozReview-Commit-ID: 2BQd8Y4xcTc
This commit is contained in:
Wes Kocher 2017-07-03 17:35:58 -07:00
Родитель f27c0cbece 61dfd12d1b
Коммит 50ae69bb30
39 изменённых файлов: 344 добавлений и 127 удалений

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

@ -520,6 +520,7 @@ EventListenerManager::EnableDevice(EventMessage aEventMessage)
// Falls back to SENSOR_ROTATION_VECTOR and SENSOR_ORIENTATION if
// unavailable on device.
window->EnableDeviceSensor(SENSOR_GAME_ROTATION_VECTOR);
window->EnableDeviceSensor(SENSOR_ROTATION_VECTOR);
#else
window->EnableDeviceSensor(SENSOR_ORIENTATION);
#endif

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

@ -7,6 +7,7 @@
#include "GeckoProfiler.h"
#include "RenderThread.h"
#include "nsThreadUtils.h"
#include "mtransport/runnable_utils.h"
#include "mozilla/layers/CompositorThread.h"
#include "mozilla/layers/CompositorBridgeParent.h"
#include "mozilla/StaticPtr.h"
@ -23,6 +24,7 @@ RenderThread::RenderThread(base::Thread* aThread)
: mThread(aThread)
, mPendingFrameCountMapLock("RenderThread.mPendingFrameCountMapLock")
, mRenderTextureMapLock("RenderThread.mRenderTextureMapLock")
, mHasShutdown(false)
{
}
@ -66,11 +68,29 @@ RenderThread::ShutDown()
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(sRenderThread);
// TODO(nical): sync with the render thread
{
MutexAutoLock lock(sRenderThread->mRenderTextureMapLock);
sRenderThread->mHasShutdown = true;
}
layers::SynchronousTask task("RenderThread");
RefPtr<Runnable> runnable = WrapRunnable(
RefPtr<RenderThread>(sRenderThread.get()),
&RenderThread::ShutDownTask,
&task);
sRenderThread->Loop()->PostTask(runnable.forget());
task.Wait();
sRenderThread = nullptr;
}
void
RenderThread::ShutDownTask(layers::SynchronousTask* aTask)
{
layers::AutoCompleteTask complete(aTask);
MOZ_ASSERT(IsInRenderThread());
}
// static
MessageLoop*
RenderThread::Loop()
@ -89,6 +109,11 @@ void
RenderThread::AddRenderer(wr::WindowId aWindowId, UniquePtr<RendererOGL> aRenderer)
{
MOZ_ASSERT(IsInRenderThread());
if (mHasShutdown) {
return;
}
mRenderers[aWindowId] = Move(aRenderer);
MutexAutoLock lock(mPendingFrameCountMapLock);
@ -99,6 +124,11 @@ void
RenderThread::RemoveRenderer(wr::WindowId aWindowId)
{
MOZ_ASSERT(IsInRenderThread());
if (mHasShutdown) {
return;
}
mRenderers.erase(aWindowId);
MutexAutoLock lock(mPendingFrameCountMapLock);
@ -123,6 +153,10 @@ RenderThread::GetRenderer(wr::WindowId aWindowId)
void
RenderThread::NewFrameReady(wr::WindowId aWindowId)
{
if (mHasShutdown) {
return;
}
if (!IsInRenderThread()) {
Loop()->PostTask(
NewRunnableMethod<wr::WindowId>("wr::RenderThread::NewFrameReady",
@ -139,6 +173,10 @@ RenderThread::NewFrameReady(wr::WindowId aWindowId)
void
RenderThread::NewScrollFrameReady(wr::WindowId aWindowId, bool aCompositeNeeded)
{
if (mHasShutdown) {
return;
}
if (!IsInRenderThread()) {
Loop()->PostTask(NewRunnableMethod<wr::WindowId, bool>(
"wr::RenderThread::NewScrollFrameReady",
@ -289,6 +327,9 @@ RenderThread::RegisterExternalImage(uint64_t aExternalImageId, already_AddRefed<
{
MutexAutoLock lock(mRenderTextureMapLock);
if (mHasShutdown) {
return;
}
MOZ_ASSERT(!mRenderTextures.GetWeak(aExternalImageId));
mRenderTextures.Put(aExternalImageId, Move(aTexture));
}
@ -297,6 +338,9 @@ void
RenderThread::UnregisterExternalImage(uint64_t aExternalImageId)
{
MutexAutoLock lock(mRenderTextureMapLock);
if (mHasShutdown) {
return;
}
MOZ_ASSERT(mRenderTextures.GetWeak(aExternalImageId));
if (!IsInRenderThread()) {
// The RenderTextureHost should be released in render thread. So, post the

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

@ -18,6 +18,7 @@
#include "mozilla/webrender/webrender_ffi.h"
#include "mozilla/UniquePtr.h"
#include "mozilla/webrender/WebRenderTypes.h"
#include "mozilla/layers/SynchronousTask.h"
namespace mozilla {
namespace wr {
@ -143,6 +144,7 @@ private:
explicit RenderThread(base::Thread* aThread);
void DeferredRenderTextureHostDestroy(RefPtr<RenderTextureHost> aTexture);
void ShutDownTask(layers::SynchronousTask* aTask);
~RenderThread();
@ -157,6 +159,7 @@ private:
Mutex mRenderTextureMapLock;
nsRefPtrHashtable<nsUint64HashKey, RenderTextureHost> mRenderTextures;
bool mHasShutdown;
};
} // namespace wr

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

@ -85,6 +85,7 @@ JSCompartment::JSCompartment(Zone* zone, const JS::CompartmentOptions& options =
randomKeyGenerator_(runtime_->forkRandomKeyGenerator()),
watchpointMap(nullptr),
scriptCountsMap(nullptr),
scriptNameMap(nullptr),
debugScriptMap(nullptr),
debugEnvs(nullptr),
enumerators(nullptr),
@ -115,6 +116,7 @@ JSCompartment::~JSCompartment()
js_delete(jitCompartment_);
js_delete(watchpointMap);
js_delete(scriptCountsMap);
js_delete(scriptNameMap);
js_delete(debugScriptMap);
js_delete(debugEnvs);
js_delete(objectMetadataTable);
@ -810,6 +812,7 @@ JSCompartment::finishRoots()
objectMetadataTable->clear();
clearScriptCounts();
clearScriptNames();
if (nonSyntacticLexicalEnvironments_)
nonSyntacticLexicalEnvironments_->clear();
@ -1008,6 +1011,14 @@ JSCompartment::fixupScriptMapsAfterMovingGC()
}
}
if (scriptNameMap) {
for (ScriptNameMap::Enum e(*scriptNameMap); !e.empty(); e.popFront()) {
JSScript* script = e.front().key();
if (!IsAboutToBeFinalizedUnbarriered(&script) && script != e.front().key())
e.rekeyFront(script);
}
}
if (debugScriptMap) {
for (DebugScriptMap::Enum e(*debugScriptMap); !e.empty(); e.popFront()) {
JSScript* script = e.front().key();
@ -1030,6 +1041,15 @@ JSCompartment::checkScriptMapsAfterMovingGC()
}
}
if (scriptNameMap) {
for (auto r = scriptNameMap->all(); !r.empty(); r.popFront()) {
JSScript* script = r.front().key();
CheckGCThingAfterMovingGC(script);
auto ptr = scriptNameMap->lookup(script);
MOZ_RELEASE_ASSERT(ptr.found() && &*ptr == &r.front());
}
}
if (debugScriptMap) {
for (auto r = debugScriptMap->all(); !r.empty(); r.popFront()) {
JSScript* script = r.front().key();
@ -1274,6 +1294,7 @@ JSCompartment::updateDebuggerObservesCoverage()
return;
clearScriptCounts();
clearScriptNames();
}
bool
@ -1315,6 +1336,19 @@ JSCompartment::clearScriptCounts()
scriptCountsMap = nullptr;
}
void
JSCompartment::clearScriptNames()
{
if (!scriptNameMap)
return;
for (ScriptNameMap::Range r = scriptNameMap->all(); !r.empty(); r.popFront())
js_delete(r.front().value());
js_delete(scriptNameMap);
scriptNameMap = nullptr;
}
void
JSCompartment::clearBreakpointsIn(FreeOp* fop, js::Debugger* dbg, HandleObject handler)
{

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

@ -1090,6 +1090,7 @@ struct JSCompartment
bool collectCoverageForDebug() const;
bool collectCoverageForPGO() const;
void clearScriptCounts();
void clearScriptNames();
bool needsDelazificationForDebugger() const {
return debugModeBits & DebuggerNeedsDelazification;
@ -1116,6 +1117,7 @@ struct JSCompartment
js::WatchpointMap* watchpointMap;
js::ScriptCountsMap* scriptCountsMap;
js::ScriptNameMap* scriptNameMap;
js::DebugScriptMap* debugScriptMap;

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

@ -7315,6 +7315,28 @@ gc::MergeCompartments(JSCompartment* source, JSCompartment* target)
// Atoms which are marked in source's zone are now marked in target's zone.
cx->atomMarking().adoptMarkedAtoms(target->zone(), source->zone());
// Merge script name maps in the target compartment's map.
if (cx->runtime()->lcovOutput().isEnabled()) {
AutoEnterOOMUnsafeRegion oomUnsafe;
if (!target->scriptNameMap) {
target->scriptNameMap = cx->new_<ScriptNameMap>();
if (!target->scriptNameMap)
oomUnsafe.crash("Failed to create a script name map.");
if (!target->scriptNameMap->init())
oomUnsafe.crash("Failed to initialize a script name map.");
}
for (ScriptNameMap::Range r = source->scriptNameMap->all(); !r.empty(); r.popFront()) {
JSScript* key = r.front().key();
const char* value = r.front().value();
if (!target->scriptNameMap->putNew(key, value))
oomUnsafe.crash("Failed to add an entry in the script name map.");
}
}
}
void

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

@ -2966,7 +2966,6 @@ GenerateLcovInfo(JSContext* cx, JSCompartment* comp, GenericPrinter& out)
coverage::LCovCompartment compCover;
for (JSScript* topLevel: topScripts) {
RootedScript topScript(cx, topLevel);
compCover.collectSourceFile(comp, &topScript->scriptSourceUnwrap());
// We found the top-level script, visit all the functions reachable
// from the top-level function, and delazify them.
@ -2978,7 +2977,10 @@ GenerateLcovInfo(JSContext* cx, JSCompartment* comp, GenericPrinter& out)
RootedFunction fun(cx);
do {
script = queue.popCopy();
compCover.collectCodeCoverageInfo(comp, script->sourceObject(), script);
if (!script->initScriptName(cx))
return false;
if (script->hasScriptName())
compCover.collectCodeCoverageInfo(comp, script);
// Iterate from the last to the first object in order to have
// the functions them visited in the opposite order when popping

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

@ -1159,6 +1159,15 @@ static inline ScriptCountsMap::Ptr GetScriptCountsMapEntry(JSScript* script)
return p;
}
static inline ScriptNameMap::Ptr
GetScriptNameMapEntry(JSScript* script)
{
ScriptNameMap* map = script->compartment()->scriptNameMap;
auto p = map->lookup(script);
MOZ_ASSERT(p);
return p;
}
ScriptCounts&
JSScript::getScriptCounts()
{
@ -1166,6 +1175,13 @@ JSScript::getScriptCounts()
return *p->value();
}
const char*
JSScript::getScriptName()
{
auto p = GetScriptNameMapEntry(this);
return p->value();
}
js::PCCounts*
ScriptCounts::maybeGetPCCounts(size_t offset) {
PCCounts searched = PCCounts(offset);
@ -1347,6 +1363,24 @@ JSScript::destroyScriptCounts(FreeOp* fop)
}
}
void
JSScript::destroyScriptName()
{
auto p = GetScriptNameMapEntry(this);
js_delete(p->value());
compartment()->scriptNameMap->remove(p);
}
bool
JSScript::hasScriptName()
{
if (!compartment()->scriptNameMap)
return false;
auto p = compartment()->scriptNameMap->lookup(this);
return p.found();
}
void
ScriptSourceObject::trace(JSTracer* trc, JSObject* obj)
{
@ -1367,12 +1401,6 @@ ScriptSourceObject::finalize(FreeOp* fop, JSObject* obj)
{
MOZ_ASSERT(fop->onActiveCooperatingThread());
ScriptSourceObject* sso = &obj->as<ScriptSourceObject>();
// If code coverage is enabled, record the filename associated with this
// source object.
if (fop->runtime()->lcovOutput().isEnabled())
sso->compartment()->lcovOutput.collectSourceFile(sso->compartment(), sso);
sso->source()->decref();
sso->setReservedSlot(SOURCE_SLOT, PrivateValue(nullptr));
}
@ -2666,6 +2694,8 @@ JSScript::Create(JSContext* cx, const ReadOnlyCompileOptions& options,
MOZ_ASSERT(script->getVersion() == options.version); // assert that no overflow occurred
script->setSourceObject(sourceObject);
if (cx->runtime()->lcovOutput().isEnabled() && !script->initScriptName(cx))
return nullptr;
script->sourceStart_ = bufStart;
script->sourceEnd_ = bufEnd;
script->toStringStart_ = toStringStart;
@ -2678,6 +2708,48 @@ JSScript::Create(JSContext* cx, const ReadOnlyCompileOptions& options,
return script;
}
bool
JSScript::initScriptName(JSContext* cx)
{
MOZ_ASSERT(!hasScriptName());
if (!filename())
return true;
// Create compartment's scriptNameMap if necessary.
ScriptNameMap* map = compartment()->scriptNameMap;
if (!map) {
map = cx->new_<ScriptNameMap>();
if (!map) {
ReportOutOfMemory(cx);
return false;
}
if (!map->init()) {
js_delete(map);
ReportOutOfMemory(cx);
return false;
}
compartment()->scriptNameMap = map;
}
char* name = js_strdup(filename());
if (!name) {
ReportOutOfMemory(cx);
return false;
}
// Register the script name in the compartment's map.
if (!map->putNew(this, name)) {
js_delete(name);
ReportOutOfMemory(cx);
return false;
}
return true;
}
static inline uint8_t*
AllocScriptData(JS::Zone* zone, size_t size)
{
@ -3090,8 +3162,10 @@ JSScript::finalize(FreeOp* fop)
// Collect code coverage information for this script and all its inner
// scripts, and store the aggregated information on the compartment.
if (fop->runtime()->lcovOutput().isEnabled())
compartment()->lcovOutput.collectCodeCoverageInfo(compartment(), sourceObject(), this);
if (fop->runtime()->lcovOutput().isEnabled() && hasScriptName()) {
compartment()->lcovOutput.collectCodeCoverageInfo(compartment(), this);
destroyScriptName();
}
fop->runtime()->geckoProfiler().onScriptFinalized(this);

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

@ -240,6 +240,10 @@ typedef HashMap<JSScript*,
ScriptCounts*,
DefaultHasher<JSScript*>,
SystemAllocPolicy> ScriptCountsMap;
typedef HashMap<JSScript*,
const char*,
DefaultHasher<JSScript*>,
SystemAllocPolicy> ScriptNameMap;
class DebugScript
{
@ -1419,6 +1423,7 @@ class JSScript : public js::gc::TenuredCell
void setIsDefaultClassConstructor() { isDefaultClassConstructor_ = true; }
bool hasScriptCounts() const { return hasScriptCounts_; }
bool hasScriptName();
bool hasFreezeConstraints() const { return hasFreezeConstraints_; }
void setHasFreezeConstraints() { hasFreezeConstraints_ = true; }
@ -1783,7 +1788,9 @@ class JSScript : public js::gc::TenuredCell
public:
bool initScriptCounts(JSContext* cx);
bool initScriptName(JSContext* cx);
js::ScriptCounts& getScriptCounts();
const char* getScriptName();
js::PCCounts* maybeGetPCCounts(jsbytecode* pc);
const js::PCCounts* maybeGetThrowCounts(jsbytecode* pc);
js::PCCounts* getThrowCounts(jsbytecode* pc);
@ -1793,6 +1800,7 @@ class JSScript : public js::gc::TenuredCell
js::jit::IonScriptCounts* getIonCounts();
void releaseScriptCounts(js::ScriptCounts* counts);
void destroyScriptCounts(js::FreeOp* fop);
void destroyScriptName();
// The entry should be removed after using this function.
void takeOverScriptCountsMapEntry(js::ScriptCounts* entryValue);

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

@ -63,9 +63,8 @@
namespace js {
namespace coverage {
LCovSource::LCovSource(LifoAlloc* alloc, JSObject* sso)
: source_(sso),
outSF_(alloc),
LCovSource::LCovSource(LifoAlloc* alloc, const char* name)
: name_(name),
outFN_(alloc),
outFNDA_(alloc),
numFunctionsFound_(0),
@ -76,19 +75,40 @@ LCovSource::LCovSource(LifoAlloc* alloc, JSObject* sso)
outDA_(alloc),
numLinesInstrumented_(0),
numLinesHit_(0),
hasFilename_(false),
hasTopLevelScript_(false)
{
}
LCovSource::LCovSource(LCovSource&& src)
: name_(src.name_),
outFN_(src.outFN_),
outFNDA_(src.outFNDA_),
numFunctionsFound_(src.numFunctionsFound_),
numFunctionsHit_(src.numFunctionsHit_),
outBRDA_(src.outBRDA_),
numBranchesFound_(src.numBranchesFound_),
numBranchesHit_(src.numBranchesHit_),
outDA_(src.outDA_),
numLinesInstrumented_(src.numLinesInstrumented_),
numLinesHit_(src.numLinesHit_),
hasTopLevelScript_(src.hasTopLevelScript_)
{
src.name_ = nullptr;
}
LCovSource::~LCovSource()
{
js_delete(name_);
}
void
LCovSource::exportInto(GenericPrinter& out) const
{
// Only write if everything got recorded.
if (!hasFilename_ || !hasTopLevelScript_)
if (!hasTopLevelScript_)
return;
outSF_.exportInto(out);
out.printf("SF:%s\n", name_);
outFN_.exportInto(out);
outFNDA_.exportInto(out);
@ -106,17 +126,6 @@ LCovSource::exportInto(GenericPrinter& out) const
out.put("end_of_record\n");
}
bool
LCovSource::writeSourceFilename(ScriptSourceObject* sso)
{
outSF_.printf("SF:%s\n", sso->source()->filename());
if (outSF_.hadOutOfMemory())
return false;
hasFilename_ = true;
return true;
}
bool
LCovSource::writeScriptName(LSprinter& out, JSScript* script)
{
@ -404,8 +413,7 @@ LCovCompartment::LCovCompartment()
}
void
LCovCompartment::collectCodeCoverageInfo(JSCompartment* comp, JSObject* sso,
JSScript* script)
LCovCompartment::collectCodeCoverageInfo(JSCompartment* comp, JSScript* script)
{
// Skip any operation if we already some out-of memory issues.
if (outTN_.hadOutOfMemory())
@ -415,7 +423,7 @@ LCovCompartment::collectCodeCoverageInfo(JSCompartment* comp, JSObject* sso,
return;
// Get the existing source LCov summary, or create a new one.
LCovSource* source = lookupOrAdd(comp, sso);
LCovSource* source = lookupOrAdd(comp, script->getScriptName());
if (!source)
return;
@ -426,31 +434,8 @@ LCovCompartment::collectCodeCoverageInfo(JSCompartment* comp, JSObject* sso,
}
}
void
LCovCompartment::collectSourceFile(JSCompartment* comp, ScriptSourceObject* sso)
{
// Do not add sources if there is no file name associated to it.
if (!sso->source()->filename())
return;
// Skip any operation if we already some out-of memory issues.
if (outTN_.hadOutOfMemory())
return;
// Get the existing source LCov summary, or create a new one.
LCovSource* source = lookupOrAdd(comp, sso);
if (!source)
return;
// Write source filename into the LCovSource.
if (!source->writeSourceFilename(sso)) {
outTN_.reportOutOfMemory();
return;
}
}
LCovSource*
LCovCompartment::lookupOrAdd(JSCompartment* comp, JSObject* sso)
LCovCompartment::lookupOrAdd(JSCompartment* comp, const char* name)
{
// On the first call, write the compartment name, and allocate a LCovSource
// vector in the LifoAlloc.
@ -468,13 +453,19 @@ LCovCompartment::lookupOrAdd(JSCompartment* comp, JSObject* sso)
} else {
// Find the first matching source.
for (LCovSource& source : *sources_) {
if (source.match(sso))
if (source.match(name))
return &source;
}
}
char* source_name = js_strdup(name);
if (!source_name) {
outTN_.reportOutOfMemory();
return nullptr;
}
// Allocate a new LCovSource for the current top-level.
if (!sources_->append(Move(LCovSource(&alloc_, sso)))) {
if (!sources_->append(Move(LCovSource(&alloc_, source_name)))) {
outTN_.reportOutOfMemory();
return nullptr;
}

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

@ -28,16 +28,18 @@ class LCovCompartment;
class LCovSource
{
public:
explicit LCovSource(LifoAlloc* alloc, JSObject* sso);
explicit LCovSource(LifoAlloc* alloc, const char* name);
LCovSource(LCovSource&& src);
~LCovSource();
// Whether the given script source object matches this LCovSource.
bool match(JSObject* sso) const {
return sso == source_;
// Whether the given script name matches this LCovSource.
bool match(const char* name) const {
return strcmp(name_, name) == 0;
}
// Whether the current source is complete and if it can be flushed.
bool isComplete() const {
return hasFilename_ && hasTopLevelScript_;
return hasTopLevelScript_;
}
// Iterate over the bytecode and collect the lcov output based on the
@ -48,19 +50,13 @@ class LCovSource
// the runtime code coverage trace file.
void exportInto(GenericPrinter& out) const;
// Write the script name in out.
bool writeSourceFilename(ScriptSourceObject* sso);
private:
// Write the script name in out.
bool writeScriptName(LSprinter& out, JSScript* script);
private:
// Weak pointer of the Script Source Object used by the current source.
JSObject *source_;
// LifoAlloc string which hold the filename of the source.
LSprinter outSF_;
// Name of the source file.
const char* name_;
// LifoAlloc strings which hold the filename of each function as
// well as the number of hits for each function.
@ -80,7 +76,6 @@ class LCovSource
size_t numLinesHit_;
// Status flags.
bool hasFilename_ : 1;
bool hasTopLevelScript_ : 1;
};
@ -90,10 +85,7 @@ class LCovCompartment
LCovCompartment();
// Collect code coverage information for the given source.
void collectCodeCoverageInfo(JSCompartment* comp, JSObject* sso, JSScript* topLevel);
// Create an ebtry for the current ScriptSourceObject.
void collectSourceFile(JSCompartment* comp, ScriptSourceObject* sso);
void collectCodeCoverageInfo(JSCompartment* comp, JSScript* topLevel);
// Write the Lcov output in a buffer, such as the one associated with
// the runtime code coverage trace file.
@ -104,7 +96,7 @@ class LCovCompartment
bool writeCompartmentName(JSCompartment* comp);
// Return the LCovSource entry which matches the given ScriptSourceObject.
LCovSource* lookupOrAdd(JSCompartment* comp, JSObject* sso);
LCovSource* lookupOrAdd(JSCompartment* comp, const char* name);
private:
typedef mozilla::Vector<LCovSource, 16, LifoAllocPolicy<Fallible>> LCovSourceVector;

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

@ -628,6 +628,8 @@ public class BrowserApp extends GeckoApp
final SafeIntent intent = new SafeIntent(getIntent());
final boolean isInAutomation = IntentUtils.getIsInAutomationFromEnvironment(intent);
GeckoProfile.setIntentArgs(intent.getStringExtra("args"));
if (!isInAutomation && AppConstants.MOZ_ANDROID_DOWNLOAD_CONTENT_SERVICE) {
// Kick off download of app content as early as possible so that in the best case it's
// available before the user starts using the browser.

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

@ -80,6 +80,7 @@ public final class GeckoProfile {
new ConcurrentHashMap<String, GeckoProfile>(
/* capacity */ 4, /* load factor */ 0.75f, /* concurrency */ 2);
private static String sDefaultProfileName;
private static String sIntentArgs;
private final String mName;
private final File mMozillaDir;
@ -108,6 +109,10 @@ public final class GeckoProfile {
GeckoSharedPrefs.forApp(context).edit().putBoolean(GUEST_MODE_PREF, false).commit();
}
public static void setIntentArgs(final String intentArgs) {
sIntentArgs = intentArgs;
}
public static GeckoProfile initFromArgs(final Context context, final String args) {
if (shouldUseGuestMode(context)) {
final GeckoProfile guestProfile = getGuestProfile(context);
@ -214,15 +219,7 @@ public final class GeckoProfile {
return profile;
}
final String args;
if (context instanceof Activity) {
args = IntentUtils.getStringExtraSafe(((Activity) context).getIntent(), "args");
} else {
args = null;
}
return GeckoProfile.initFromArgs(context, args);
return GeckoProfile.initFromArgs(context, sIntentArgs);
} else if (profileName == null) {
// If only profile dir was passed in, use custom (anonymous) profile.
profileName = CUSTOM_PROFILE;

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

@ -4699,7 +4699,7 @@ pref("network.tcp.keepalive.retry_interval", 1); // seconds
pref("network.tcp.keepalive.probe_count", 4);
#endif
pref("network.tcp.tcp_fastopen_enable", false);
pref("network.tcp.tcp_fastopen_enable", true);
pref("network.tcp.tcp_fastopen_consecutive_failure_limit", 5);
// Whether to disable acceleration for all widgets.

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

@ -400,8 +400,8 @@ TCPFastOpenFinish(PRFileDesc *fd, PRErrorCode &err,
// We have some data ready in the buffer we will send it with the syn
// packet.
PRInt32 rv = (tfoFd->lower->methods->sendto)(tfoFd->lower,
secret->mFirstPacketBuf,
secret->mFirstPacketBufLen,
nullptr,
0,
0, //flags
&secret->mAddr,
PR_INTERVAL_NO_WAIT);

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

@ -4030,6 +4030,7 @@ nsHalfOpenSocket::OnOutputStreamReady(nsIAsyncOutputStream *out)
mFastOpenInProgress = false;
mConnectionNegotiatingFastOpen = nullptr;
}
MOZ_DIAGNOSTIC_ASSERT(mEnt);
nsresult rv = SetupConn(out, false);
if (mEnt) {
mEnt->mDoNotDestroy = false;
@ -4043,6 +4044,8 @@ nsHalfOpenSocket::FastOpenEnabled()
{
LOG(("nsHalfOpenSocket::FastOpenEnabled [this=%p]\n", this));
MOZ_DIAGNOSTIC_ASSERT(mEnt);
if (!mEnt) {
return false;
}
@ -4161,7 +4164,9 @@ nsHalfOpenSocket::StartFastOpen()
SetupBackupTimer();
}
}
mEnt->mDoNotDestroy = false;
if (mEnt) {
mEnt->mDoNotDestroy = false;
}
return rv;
}
@ -4256,17 +4261,14 @@ nsHalfOpenSocket::SetFastOpenConnected(nsresult aError, bool aWillRetry)
mStreamOut = nullptr;
mStreamIn = nullptr;
// If backup transport ha already started put this HalfOpen back to
// mEnt list.
if (mBackupTransport) {
mEnt->mHalfOpens.AppendElement(this);
gHttpHandler->ConnMgr()->mNumHalfOpenConns++;
}
Abandon();
}
mFastOpenInProgress = false;
mConnectionNegotiatingFastOpen = nullptr;
mEnt->mDoNotDestroy = false;
if (mEnt) {
mEnt->mDoNotDestroy = false;
}
}
void
@ -4539,6 +4541,7 @@ nsHttpConnectionMgr::nsHalfOpenSocket::OnTransportStatus(nsITransport *trans,
{
MOZ_ASSERT(OnSocketThread(), "not on socket thread");
MOZ_DIAGNOSTIC_ASSERT(mEnt);
if (mTransaction) {
RefPtr<PendingTransactionInfo> info = FindTransactionHelper(false);
if ((trans == mSocketTransport) ||

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

@ -244,9 +244,10 @@ private:
// contains list of active and idle connections as well as the list of
// pending transactions.
//
class nsConnectionEntry
class nsConnectionEntry : public SupportsWeakPtr<nsConnectionEntry>
{
public:
MOZ_DECLARE_WEAKREFERENCE_TYPENAME(nsConnectionEntry)
explicit nsConnectionEntry(nsHttpConnectionInfo *ci);
~nsConnectionEntry();
@ -415,7 +416,7 @@ private:
already_AddRefed<PendingTransactionInfo>
FindTransactionHelper(bool removeWhenFound);
nsConnectionEntry *mEnt;
WeakPtr<nsConnectionEntry> mEnt;
RefPtr<nsAHttpTransaction> mTransaction;
bool mDispatchedMTransaction;
nsCOMPtr<nsISocketTransport> mSocketTransport;

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

@ -1 +1 @@
a1a6eb781dd4
825e5d444e99

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

@ -22,6 +22,7 @@ blacklist=(
"./lib/sqlite" \
"./gtests/google_test" \
"./.hg" \
"./out" \
)
top="$(dirname $0)/../.."

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

@ -13,6 +13,7 @@ apt_packages+=('curl')
apt_packages+=('xz-utils')
apt_packages+=('mercurial')
apt_packages+=('git')
apt_packages+=('locales')
apt-get install -y --no-install-recommends ${apt_packages[@]}
# Download clang.

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

@ -25,10 +25,18 @@ function fromNow(hours) {
}
function parseRoutes(routes) {
return [
let rv = [
`tc-treeherder.v2.${process.env.TC_PROJECT}.${process.env.NSS_HEAD_REVISION}.${process.env.NSS_PUSHLOG_ID}`,
...routes
];
// Notify about failures (except on try).
if (process.env.TC_PROJECT != "nss-try") {
rv.push(`notify.email.${process.env.TC_OWNER}.on-failed`,
`notify.email.${process.env.TC_OWNER}.on-exception`);
}
return rv;
}
function parseFeatures(list) {

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

@ -17,14 +17,6 @@
#include <conio.h>
#endif
#if defined(__sun) && !defined(SVR4)
extern int fclose(FILE *);
extern int fprintf(FILE *, char *, ...);
extern int isatty(int);
extern char *sys_errlist[];
#define strerror(errno) sys_errlist[errno]
#endif
#include "nspr.h"
#include "prtypes.h"
#include "prtime.h"

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

@ -233,6 +233,9 @@ BufToHex(SECItem *outbuf)
unsigned int i;
string = PORT_Alloc(len);
if (!string) {
return NULL;
}
ptr = string;
for (i = 0; i < outbuf->len; i++) {

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

@ -10,4 +10,3 @@
*/
#error "Do not include this header file."

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

@ -19,6 +19,10 @@ extern const struct PRIOMethods DummyMethodsForward;
ScopedPRFileDesc DummyIOLayerMethods::CreateFD(PRDescIdentity id,
DummyIOLayerMethods *methods) {
ScopedPRFileDesc fd(PR_CreateIOLayerStub(id, &DummyMethodsForward));
assert(fd);
if (!fd) {
return nullptr;
}
fd->secret = reinterpret_cast<PRFilePrivate *>(methods);
return fd;
}

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

@ -213,7 +213,7 @@ CERT_CheckCertUsage(CERTCertificate *cert, unsigned char usage)
if (rv == SECFailure) {
rv = (PORT_GetError() == SEC_ERROR_EXTENSION_NOT_FOUND) ? SECSuccess
: SECFailure;
} else if (!(keyUsage.data[0] & usage)) {
} else if (!keyUsage.data || !(keyUsage.data[0] & usage)) {
PORT_SetError(SEC_ERROR_CERT_USAGES_INVALID);
rv = SECFailure;
}

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

@ -85,6 +85,11 @@ DH_GenParam(int primeLen, DHParams **params)
CHECK_MPI_OK(mp_div_2(&psub1, &q));
/* construct a generator from the prime. */
ab = PORT_Alloc(primeLen);
if (!ab) {
PORT_SetError(SEC_ERROR_NO_MEMORY);
rv = SECFailure;
goto cleanup;
}
/* generate a candidate number a in p's field */
CHECK_SEC_OK(RNG_GenerateGlobalRandomBytes(ab, primeLen));
CHECK_MPI_OK(mp_read_unsigned_octets(&a, ab, primeLen));
@ -114,14 +119,16 @@ cleanup:
mp_clear(&h);
mp_clear(&psub1);
mp_clear(&test);
if (ab)
if (ab) {
PORT_ZFree(ab, primeLen);
}
if (err) {
MP_TO_SEC_ERROR(err);
rv = SECFailure;
}
if (rv)
if (rv != SECSuccess) {
PORT_FreeArena(arena, PR_TRUE);
}
return rv;
}

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

@ -321,7 +321,6 @@ RSA_NewKey(int keySizeInBits, SECItem *publicExponent)
kiter = 0;
max_attempts = 5 * (keySizeInBits / 2); /* FIPS 186-4 B.3.3 steps 4.7 and 5.8 */
do {
prerr = 0;
PORT_SetError(0);
CHECK_SEC_OK(generate_prime(&p, primeLen));
CHECK_SEC_OK(generate_prime(&q, primeLen));
@ -348,8 +347,7 @@ RSA_NewKey(int keySizeInBits, SECItem *publicExponent)
kiter++;
/* loop until have primes */
} while (prerr == SEC_ERROR_NEED_RANDOM && kiter < max_attempts);
if (prerr)
goto cleanup;
cleanup:
mp_clear(&p);
mp_clear(&q);

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

@ -290,10 +290,12 @@ MGF1(HASH_HashType hashAlg,
const SECHashObject *hash;
void *hashContext;
unsigned char C[4];
SECStatus rv = SECSuccess;
hash = HASH_GetRawHashObject(hashAlg);
if (hash == NULL)
if (hash == NULL) {
return SECFailure;
}
hashContext = (*hash->create)();
rounds = (maskLen + hash->length - 1) / hash->length;
@ -314,14 +316,19 @@ MGF1(HASH_HashType hashAlg,
(*hash->end)(hashContext, tempHash, &digestLen, hash->length);
} else { /* we're in the last round and need to cut the hash */
temp = (unsigned char *)PORT_Alloc(hash->length);
if (!temp) {
rv = SECFailure;
goto done;
}
(*hash->end)(hashContext, temp, &digestLen, hash->length);
PORT_Memcpy(tempHash, temp, maskLen - counter * hash->length);
PORT_Free(temp);
}
}
(*hash->destroy)(hashContext, PR_TRUE);
return SECSuccess;
done:
(*hash->destroy)(hashContext, PR_TRUE);
return rv;
}
/* XXX Doesn't set error code */

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

@ -12,6 +12,7 @@
#include "prio.h"
#include "blapi.h"
#include "seccomon.h"
#include "secerr.h"
#include "stdio.h"
#include "prmem.h"
#include "hasht.h"
@ -233,8 +234,12 @@ static char *
mkCheckFileName(const char *libName)
{
int ln_len = PORT_Strlen(libName);
char *output = PORT_Alloc(ln_len + sizeof(SGN_SUFFIX));
int index = ln_len + 1 - sizeof("." SHLIB_SUFFIX);
char *output = PORT_Alloc(ln_len + sizeof(SGN_SUFFIX));
if (!output) {
PORT_SetError(SEC_ERROR_NO_MEMORY);
return NULL;
}
if ((index > 0) &&
(PORT_Strncmp(&libName[index],

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

@ -704,9 +704,11 @@ PRBool
PK11_NeedPWInit()
{
PK11SlotInfo *slot = PK11_GetInternalKeySlot();
PRBool ret = PK11_NeedPWInitForSlot(slot);
PK11_FreeSlot(slot);
PRBool ret = PR_FALSE;
if (slot) {
ret = PK11_NeedPWInitForSlot(slot);
PK11_FreeSlot(slot);
}
return ret;
}

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

@ -2028,6 +2028,9 @@ PK11_FindObjectsFromNickname(char *nickname, PK11SlotInfo **slotptr,
if ((delimit = PORT_Strchr(nickname, ':')) != NULL) {
int len = delimit - nickname;
tokenName = (char *)PORT_Alloc(len + 1);
if (!tokenName) {
return CK_INVALID_HANDLE;
}
PORT_Memcpy(tokenName, nickname, len);
tokenName[len] = 0;

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

@ -2484,7 +2484,11 @@ PK11_RandomUpdate(void *data, size_t bytes)
if (!bestIsInternal) {
/* do internal slot, too. */
slot = PK11_GetInternalSlot(); /* can't fail */
slot = PK11_GetInternalSlot();
PORT_Assert(slot);
if (!slot) {
return SECFailure;
}
status = PK11_SeedRandom(slot, data, bytes);
PK11_FreeSlot(slot);
}

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

@ -36,7 +36,7 @@
#ifdef LINUX
#include <pthread.h>
#include <dlfcn.h>
#define LIBAUDIT_NAME "libaudit.so.0"
#define LIBAUDIT_NAME "libaudit.so.1"
#ifndef AUDIT_CRYPTO_TEST_USER
#define AUDIT_CRYPTO_TEST_USER 2400 /* Crypto test results */
#define AUDIT_CRYPTO_PARAM_CHANGE_USER 2401 /* Crypto attribute change */

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

@ -394,7 +394,7 @@ SSL_IMPORT SECStatus SSL_SignaturePrefGet(
** can be set or retrieved using SSL_SignatureSchemePrefSet or
** SSL_SignatureSchemePrefGet.
*/
SSL_IMPORT unsigned int SSL_SignatureMaxCount();
SSL_IMPORT unsigned int SSL_SignatureMaxCount(void);
/*
** Define custom priorities for EC and FF groups used in DH key exchange and EC

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

@ -13107,7 +13107,7 @@ SSL_SignaturePrefGet(PRFileDesc *fd, SSLSignatureAndHashAlg *algorithms,
}
unsigned int
SSL_SignatureMaxCount()
SSL_SignatureMaxCount(void)
{
return MAX_SIGNATURE_SCHEMES;
}

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

@ -408,6 +408,10 @@ DecodePointer(void* dest,
{
const SEC_ASN1Template* ptrTemplate =
SEC_ASN1GetSubtemplate(templateEntry, dest, PR_FALSE);
if (!ptrTemplate) {
PORT_SetError(SEC_ERROR_INVALID_ARGS);
return SECFailure;
}
void* subdata = PORT_ArenaZAlloc(arena, ptrTemplate->size);
*(void**)((char*)dest + templateEntry->offset) = subdata;
if (subdata) {

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

@ -699,6 +699,9 @@ NSS_PutEnv(const char *envVarName, const char *envValue)
#endif
encoded = (char *)PORT_ZAlloc(strlen(envVarName) + 2 + strlen(envValue));
if (!encoded) {
return SECFailure;
}
strcpy(encoded, envVarName);
strcat(encoded, "=");
strcat(encoded, envValue);

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

@ -60,7 +60,7 @@ var t = async_test("Dynamic name")
var t2 = async_test("Ghost name")
t.step(function() {
var iframe = document.getElementsByTagName("iframe")[0];
iframe.setAttribute("src", "data:text/html,<script>window.name='foo'<\/script>");
iframe.setAttribute("srcdoc", "<script>window.name='foo'<\/script>");
iframe.onload = function() {
t.step(function() {
assert_true("foo" in window, "foo not in window");