зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1425462 Do not use crypto functions if NSS is not initialized. r=nwgh
Doing so caused nearly every xpcshell test to fail, as well as Marionette. This is safe, because we're not going to be doing any web context stuff before NSS is initialized, so anything that winds up here won't be exposed to content so we don't really need to worry about fuzzing its value. MozReview-Commit-ID: KiFSIbjQnN3 --HG-- extra : rebase_source : cb93648d40e75a7a736763e54dfd8c387249989a
This commit is contained in:
Родитель
e7fb93bb60
Коммит
5345bfb157
|
@ -35,6 +35,7 @@
|
|||
#include "nsJSUtils.h"
|
||||
|
||||
#include "prenv.h"
|
||||
#include "nss.h"
|
||||
|
||||
#include "js/Date.h"
|
||||
|
||||
|
@ -478,7 +479,13 @@ nsRFPService::ReduceTimePrecisionImpl(
|
|||
|
||||
long long midpoint = 0,
|
||||
clampedAndJittered = clamped;
|
||||
if (sJitter) {
|
||||
// RandomMidpoint uses crypto functions from NSS. But we wind up in this code _very_ early
|
||||
// on in and we don't want to initialize NSS earlier than it would be initialized naturally.
|
||||
// Doing so caused nearly every xpcshell test to fail, as well as Marionette.
|
||||
// This is safe, because we're not going to be doing any web context stuff before NSS is
|
||||
// initialized, so anything that winds up here won't be exposed to content so we don't
|
||||
// really need to worry about fuzzing its value.
|
||||
if (sJitter && NSS_IsInitialized()) {
|
||||
if(!NS_FAILED(RandomMidpoint(clamped, resolutionAsInt, &midpoint)) &&
|
||||
timeAsInt >= clamped + midpoint) {
|
||||
clampedAndJittered += resolutionAsInt;
|
||||
|
|
Загрузка…
Ссылка в новой задаче