Bug 1778510: Cut over a bunch of performance time precision calls to use the new calling convention r=sefeng

Depends on D151306

Differential Revision: https://phabricator.services.mozilla.com/D151307
This commit is contained in:
Tom Ritter 2022-11-29 13:34:19 +00:00
parent 702f5027e4
commit 3f482941b5
7 changed files with 40 additions and 61 deletions

View File

@ -118,14 +118,12 @@ Performance::~Performance() = default;
DOMHighResTimeStamp Performance::TimeStampToDOMHighResForRendering(
TimeStamp aTimeStamp) const {
DOMHighResTimeStamp stamp = GetDOMTiming()->TimeStampToDOMHighRes(aTimeStamp);
if (!IsSystemPrincipal()) {
// 0 is an inappropriate mixin for this this area; however CSS Animations
// needs to have it's Time Reduction Logic refactored, so it's currently
// only clamping for RFP mode. RFP mode gives a much lower time precision,
// so we accept the security leak here for now.
return nsRFPService::ReduceTimePrecisionAsMSecsRFPOnly(stamp, 0);
}
return stamp;
// 0 is an inappropriate mixin for this this area; however CSS Animations
// needs to have it's Time Reduction Logic refactored, so it's currently
// only clamping for RFP mode. RFP mode gives a much lower time precision,
// so we accept the security leak here for now.
return nsRFPService::ReduceTimePrecisionAsMSecsRFPOnly(stamp, 0,
mRTPCallerType);
}
DOMHighResTimeStamp Performance::Now() {
@ -138,8 +136,7 @@ DOMHighResTimeStamp Performance::Now() {
}
return nsRFPService::ReduceTimePrecisionAsMSecs(
rawTime, GetRandomTimelineSeed(), mSystemPrincipal,
CrossOriginIsolated());
rawTime, GetRandomTimelineSeed(), mRTPCallerType);
}
DOMHighResTimeStamp Performance::NowUnclamped() const {
@ -156,8 +153,8 @@ DOMHighResTimeStamp Performance::TimeOrigin() {
DOMHighResTimeStamp rawTimeOrigin =
mPerformanceService->TimeOrigin(CreationTimeStamp());
// Time Origin is an absolute timestamp, so we supply a 0 context mix-in
return nsRFPService::ReduceTimePrecisionAsMSecs(
rawTimeOrigin, 0, mSystemPrincipal, CrossOriginIsolated());
return nsRFPService::ReduceTimePrecisionAsMSecs(rawTimeOrigin, 0,
mRTPCallerType);
}
JSObject* Performance::WrapObject(JSContext* aCx,

View File

@ -43,8 +43,7 @@ class PerformanceEventTiming final
if (mCachedProcessingStart.isNothing()) {
mCachedProcessingStart.emplace(nsRFPService::ReduceTimePrecisionAsMSecs(
mProcessingStart, mPerformance->GetRandomTimelineSeed(),
mPerformance->IsSystemPrincipal(),
mPerformance->CrossOriginIsolated()));
mPerformance->GetRTPCallerType()));
}
return mCachedProcessingStart.value();
}
@ -53,8 +52,7 @@ class PerformanceEventTiming final
if (mCachedProcessingEnd.isNothing()) {
mCachedProcessingEnd.emplace(nsRFPService::ReduceTimePrecisionAsMSecs(
mProcessingEnd, mPerformance->GetRandomTimelineSeed(),
mPerformance->IsSystemPrincipal(),
mPerformance->CrossOriginIsolated()));
mPerformance->GetRTPCallerType()));
}
return mCachedProcessingEnd.value();
}
@ -76,8 +74,7 @@ class PerformanceEventTiming final
if (mCachedDuration.isNothing()) {
mCachedDuration.emplace(nsRFPService::ReduceTimePrecisionAsMSecs(
mDuration, mPerformance->GetRandomTimelineSeed(),
mPerformance->IsSystemPrincipal(),
mPerformance->CrossOriginIsolated()));
mPerformance->GetRTPCallerType()));
}
return mCachedDuration.value();
}
@ -90,8 +87,7 @@ class PerformanceEventTiming final
if (mCachedStartTime.isNothing()) {
mCachedStartTime.emplace(nsRFPService::ReduceTimePrecisionAsMSecs(
mStartTime, mPerformance->GetRandomTimelineSeed(),
mPerformance->IsSystemPrincipal(),
mPerformance->CrossOriginIsolated()));
mPerformance->GetRTPCallerType()));
}
return mCachedStartTime.value();
}

View File

@ -361,8 +361,7 @@ DOMHighResTimeStamp PerformanceMainThread::GetPerformanceTimingFromString(
"of sync");
}
return nsRFPService::ReduceTimePrecisionAsMSecs(
retValue, GetRandomTimelineSeed(), /* aIsSystemPrinciapl */ false,
CrossOriginIsolated());
retValue, GetRandomTimelineSeed(), mRTPCallerType);
}
void PerformanceMainThread::InsertUserEntry(PerformanceEntry* aEntry) {

View File

@ -26,7 +26,7 @@ JSObject* PerformanceNavigationTiming::WrapObject(
#define REDUCE_TIME_PRECISION \
return nsRFPService::ReduceTimePrecisionAsMSecs( \
rawValue, mPerformance->GetRandomTimelineSeed(), \
mPerformance->IsSystemPrincipal(), mPerformance->CrossOriginIsolated())
mPerformance->GetRTPCallerType())
DOMHighResTimeStamp PerformanceNavigationTiming::UnloadEventStart() const {
DOMHighResTimeStamp rawValue = 0;

View File

@ -41,8 +41,7 @@ DOMHighResTimeStamp PerformancePaintTiming::StartTime() const {
mPerformance->GetDOMTiming()->TimeStampToDOMHighRes(mRawStartTime);
mCachedStartTime.emplace(nsRFPService::ReduceTimePrecisionAsMSecs(
rawValue, mPerformance->GetRandomTimelineSeed(),
mPerformance->IsSystemPrincipal(),
mPerformance->CrossOriginIsolated()));
mPerformance->GetRTPCallerType()));
}
return mCachedStartTime.value();
}

View File

@ -84,8 +84,7 @@ PerformanceTiming::PerformanceTiming(Performance* aPerformance,
aChannel, aHttpChannel,
nsRFPService::ReduceTimePrecisionAsMSecs(
aZeroTime, aPerformance->GetRandomTimelineSeed(),
aPerformance->IsSystemPrincipal(),
aPerformance->CrossOriginIsolated())));
aPerformance->GetRTPCallerType())));
// Non-null aHttpChannel implies that this PerformanceTiming object is being
// used for subresources, which is irrelevant to this probe.
@ -311,7 +310,7 @@ DOMHighResTimeStamp PerformanceTimingData::FetchStartHighRes(
}
return nsRFPService::ReduceTimePrecisionAsMSecs(
mFetchStart, aPerformance->GetRandomTimelineSeed(),
aPerformance->IsSystemPrincipal(), aPerformance->CrossOriginIsolated());
aPerformance->GetRTPCallerType());
}
DOMTimeMilliSec PerformanceTiming::FetchStart() {
@ -382,7 +381,7 @@ DOMHighResTimeStamp PerformanceTimingData::AsyncOpenHighRes(
TimeStampToDOMHighRes(aPerformance, mAsyncOpen);
return nsRFPService::ReduceTimePrecisionAsMSecs(
rawValue, aPerformance->GetRandomTimelineSeed(),
aPerformance->IsSystemPrincipal(), aPerformance->CrossOriginIsolated());
aPerformance->GetRTPCallerType());
}
DOMHighResTimeStamp PerformanceTimingData::WorkerStartHighRes(
@ -397,7 +396,7 @@ DOMHighResTimeStamp PerformanceTimingData::WorkerStartHighRes(
TimeStampToDOMHighRes(aPerformance, mWorkerStart);
return nsRFPService::ReduceTimePrecisionAsMSecs(
rawValue, aPerformance->GetRandomTimelineSeed(),
aPerformance->IsSystemPrincipal(), aPerformance->CrossOriginIsolated());
aPerformance->GetRTPCallerType());
}
/**
@ -506,7 +505,7 @@ DOMHighResTimeStamp PerformanceTimingData::DomainLookupEndHighRes(
TimeStampToDOMHighRes(aPerformance, mDomainLookupEnd);
return nsRFPService::ReduceTimePrecisionAsMSecs(
rawValue, aPerformance->GetRandomTimelineSeed(),
aPerformance->IsSystemPrincipal(), aPerformance->CrossOriginIsolated());
aPerformance->GetRTPCallerType());
}
DOMTimeMilliSec PerformanceTiming::DomainLookupEnd() {
@ -528,7 +527,7 @@ DOMHighResTimeStamp PerformanceTimingData::ConnectStartHighRes(
TimeStampToDOMHighRes(aPerformance, mConnectStart);
return nsRFPService::ReduceTimePrecisionAsMSecs(
rawValue, aPerformance->GetRandomTimelineSeed(),
aPerformance->IsSystemPrincipal(), aPerformance->CrossOriginIsolated());
aPerformance->GetRTPCallerType());
}
DOMTimeMilliSec PerformanceTiming::ConnectStart() {
@ -553,7 +552,7 @@ DOMHighResTimeStamp PerformanceTimingData::SecureConnectionStartHighRes(
TimeStampToDOMHighRes(aPerformance, mSecureConnectionStart);
return nsRFPService::ReduceTimePrecisionAsMSecs(
rawValue, aPerformance->GetRandomTimelineSeed(),
aPerformance->IsSystemPrincipal(), aPerformance->CrossOriginIsolated());
aPerformance->GetRTPCallerType());
}
DOMTimeMilliSec PerformanceTiming::SecureConnectionStart() {
@ -576,7 +575,7 @@ DOMHighResTimeStamp PerformanceTimingData::ConnectEndHighRes(
TimeStampToDOMHighRes(aPerformance, mConnectEnd);
return nsRFPService::ReduceTimePrecisionAsMSecs(
rawValue, aPerformance->GetRandomTimelineSeed(),
aPerformance->IsSystemPrincipal(), aPerformance->CrossOriginIsolated());
aPerformance->GetRTPCallerType());
}
DOMTimeMilliSec PerformanceTiming::ConnectEnd() {
@ -647,7 +646,7 @@ DOMHighResTimeStamp PerformanceTimingData::ResponseEndHighRes(
TimeStampToDOMHighRes(aPerformance, mResponseEnd);
return nsRFPService::ReduceTimePrecisionAsMSecs(
rawValue, aPerformance->GetRandomTimelineSeed(),
aPerformance->IsSystemPrincipal(), aPerformance->CrossOriginIsolated());
aPerformance->GetRTPCallerType());
}
DOMTimeMilliSec PerformanceTiming::ResponseEnd() {

View File

@ -84,7 +84,7 @@ class PerformanceTimingData final {
return nsRFPService::ReduceTimePrecisionAsMSecs(
rawTimestamp, aPerformance->GetRandomTimelineSeed(),
aPerformance->IsSystemPrincipal(), aPerformance->CrossOriginIsolated());
aPerformance->GetRTPCallerType());
}
/**
@ -262,8 +262,7 @@ class PerformanceTiming final : public nsWrapperCache {
}
return nsRFPService::ReduceTimePrecisionAsMSecs(
GetDOMTiming()->GetNavigationStart(),
mPerformance->GetRandomTimelineSeed(),
mPerformance->IsSystemPrincipal(), mPerformance->CrossOriginIsolated());
mPerformance->GetRandomTimelineSeed(), mPerformance->GetRTPCallerType());
}
DOMTimeMilliSec UnloadEventStart() {
@ -272,8 +271,7 @@ class PerformanceTiming final : public nsWrapperCache {
}
return nsRFPService::ReduceTimePrecisionAsMSecs(
GetDOMTiming()->GetUnloadEventStart(),
mPerformance->GetRandomTimelineSeed(),
mPerformance->IsSystemPrincipal(), mPerformance->CrossOriginIsolated());
mPerformance->GetRandomTimelineSeed(), mPerformance->GetRTPCallerType());
}
DOMTimeMilliSec UnloadEventEnd() {
@ -282,8 +280,7 @@ class PerformanceTiming final : public nsWrapperCache {
}
return nsRFPService::ReduceTimePrecisionAsMSecs(
GetDOMTiming()->GetUnloadEventEnd(),
mPerformance->GetRandomTimelineSeed(),
mPerformance->IsSystemPrincipal(), mPerformance->CrossOriginIsolated());
mPerformance->GetRandomTimelineSeed(), mPerformance->GetRTPCallerType());
}
// Low resolution (used by navigation timing)
@ -305,7 +302,7 @@ class PerformanceTiming final : public nsWrapperCache {
}
return nsRFPService::ReduceTimePrecisionAsMSecs(
GetDOMTiming()->GetDomLoading(), mPerformance->GetRandomTimelineSeed(),
mPerformance->IsSystemPrincipal(), mPerformance->CrossOriginIsolated());
mPerformance->GetRTPCallerType());
}
DOMTimeMilliSec DomInteractive() const {
@ -314,8 +311,7 @@ class PerformanceTiming final : public nsWrapperCache {
}
return nsRFPService::ReduceTimePrecisionAsMSecs(
GetDOMTiming()->GetDomInteractive(),
mPerformance->GetRandomTimelineSeed(),
mPerformance->IsSystemPrincipal(), mPerformance->CrossOriginIsolated());
mPerformance->GetRandomTimelineSeed(), mPerformance->GetRTPCallerType());
}
DOMTimeMilliSec DomContentLoadedEventStart() const {
@ -324,8 +320,7 @@ class PerformanceTiming final : public nsWrapperCache {
}
return nsRFPService::ReduceTimePrecisionAsMSecs(
GetDOMTiming()->GetDomContentLoadedEventStart(),
mPerformance->GetRandomTimelineSeed(),
mPerformance->IsSystemPrincipal(), mPerformance->CrossOriginIsolated());
mPerformance->GetRandomTimelineSeed(), mPerformance->GetRTPCallerType());
}
DOMTimeMilliSec DomContentLoadedEventEnd() const {
@ -334,8 +329,7 @@ class PerformanceTiming final : public nsWrapperCache {
}
return nsRFPService::ReduceTimePrecisionAsMSecs(
GetDOMTiming()->GetDomContentLoadedEventEnd(),
mPerformance->GetRandomTimelineSeed(),
mPerformance->IsSystemPrincipal(), mPerformance->CrossOriginIsolated());
mPerformance->GetRandomTimelineSeed(), mPerformance->GetRTPCallerType());
}
DOMTimeMilliSec DomComplete() const {
@ -344,7 +338,7 @@ class PerformanceTiming final : public nsWrapperCache {
}
return nsRFPService::ReduceTimePrecisionAsMSecs(
GetDOMTiming()->GetDomComplete(), mPerformance->GetRandomTimelineSeed(),
mPerformance->IsSystemPrincipal(), mPerformance->CrossOriginIsolated());
mPerformance->GetRTPCallerType());
}
DOMTimeMilliSec LoadEventStart() const {
@ -353,8 +347,7 @@ class PerformanceTiming final : public nsWrapperCache {
}
return nsRFPService::ReduceTimePrecisionAsMSecs(
GetDOMTiming()->GetLoadEventStart(),
mPerformance->GetRandomTimelineSeed(),
mPerformance->IsSystemPrincipal(), mPerformance->CrossOriginIsolated());
mPerformance->GetRandomTimelineSeed(), mPerformance->GetRTPCallerType());
}
DOMTimeMilliSec LoadEventEnd() const {
@ -363,8 +356,7 @@ class PerformanceTiming final : public nsWrapperCache {
}
return nsRFPService::ReduceTimePrecisionAsMSecs(
GetDOMTiming()->GetLoadEventEnd(),
mPerformance->GetRandomTimelineSeed(),
mPerformance->IsSystemPrincipal(), mPerformance->CrossOriginIsolated());
mPerformance->GetRandomTimelineSeed(), mPerformance->GetRTPCallerType());
}
DOMTimeMilliSec TimeToNonBlankPaint() const {
@ -373,8 +365,7 @@ class PerformanceTiming final : public nsWrapperCache {
}
return nsRFPService::ReduceTimePrecisionAsMSecs(
GetDOMTiming()->GetTimeToNonBlankPaint(),
mPerformance->GetRandomTimelineSeed(),
mPerformance->IsSystemPrincipal(), mPerformance->CrossOriginIsolated());
mPerformance->GetRandomTimelineSeed(), mPerformance->GetRTPCallerType());
}
DOMTimeMilliSec TimeToContentfulPaint() const {
@ -383,8 +374,7 @@ class PerformanceTiming final : public nsWrapperCache {
}
return nsRFPService::ReduceTimePrecisionAsMSecs(
GetDOMTiming()->GetTimeToContentfulComposite(),
mPerformance->GetRandomTimelineSeed(),
mPerformance->IsSystemPrincipal(), mPerformance->CrossOriginIsolated());
mPerformance->GetRandomTimelineSeed(), mPerformance->GetRTPCallerType());
}
DOMTimeMilliSec TimeToDOMContentFlushed() const {
@ -393,8 +383,7 @@ class PerformanceTiming final : public nsWrapperCache {
}
return nsRFPService::ReduceTimePrecisionAsMSecs(
GetDOMTiming()->GetTimeToDOMContentFlushed(),
mPerformance->GetRandomTimelineSeed(),
mPerformance->IsSystemPrincipal(), mPerformance->CrossOriginIsolated());
mPerformance->GetRandomTimelineSeed(), mPerformance->GetRTPCallerType());
}
DOMTimeMilliSec TimeToFirstInteractive() const {
@ -403,7 +392,7 @@ class PerformanceTiming final : public nsWrapperCache {
}
return nsRFPService::ReduceTimePrecisionAsMSecs(
GetDOMTiming()->GetTimeToTTFI(), mPerformance->GetRandomTimelineSeed(),
mPerformance->IsSystemPrincipal(), mPerformance->CrossOriginIsolated());
mPerformance->GetRTPCallerType());
}
PerformanceTimingData* Data() const { return mTimingData.get(); }