Bug 1811567: Remove unnecessary restrictions on APIs when RFP is enabled r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D167444
This commit is contained in:
@@ -165,12 +165,6 @@ JSObject* Performance::WrapObject(JSContext* aCx,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Performance::GetEntries(nsTArray<RefPtr<PerformanceEntry>>& aRetval) {
|
void Performance::GetEntries(nsTArray<RefPtr<PerformanceEntry>>& aRetval) {
|
||||||
// We return an empty list when 'privacy.resistFingerprinting' is on.
|
|
||||||
if (nsContentUtils::ShouldResistFingerprinting()) {
|
|
||||||
aRetval.Clear();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
aRetval = mResourceEntries.Clone();
|
aRetval = mResourceEntries.Clone();
|
||||||
aRetval.AppendElements(mUserEntries);
|
aRetval.AppendElements(mUserEntries);
|
||||||
aRetval.Sort(PerformanceEntryComparator());
|
aRetval.Sort(PerformanceEntryComparator());
|
||||||
@@ -178,12 +172,6 @@ void Performance::GetEntries(nsTArray<RefPtr<PerformanceEntry>>& aRetval) {
|
|||||||
|
|
||||||
void Performance::GetEntriesByType(
|
void Performance::GetEntriesByType(
|
||||||
const nsAString& aEntryType, nsTArray<RefPtr<PerformanceEntry>>& aRetval) {
|
const nsAString& aEntryType, nsTArray<RefPtr<PerformanceEntry>>& aRetval) {
|
||||||
// We return an empty list when 'privacy.resistFingerprinting' is on.
|
|
||||||
if (nsContentUtils::ShouldResistFingerprinting()) {
|
|
||||||
aRetval.Clear();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (aEntryType.EqualsLiteral("resource")) {
|
if (aEntryType.EqualsLiteral("resource")) {
|
||||||
aRetval = mResourceEntries.Clone();
|
aRetval = mResourceEntries.Clone();
|
||||||
return;
|
return;
|
||||||
@@ -206,11 +194,6 @@ void Performance::GetEntriesByName(
|
|||||||
nsTArray<RefPtr<PerformanceEntry>>& aRetval) {
|
nsTArray<RefPtr<PerformanceEntry>>& aRetval) {
|
||||||
aRetval.Clear();
|
aRetval.Clear();
|
||||||
|
|
||||||
// We return an empty list when 'privacy.resistFingerprinting' is on.
|
|
||||||
if (nsContentUtils::ShouldResistFingerprinting()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
RefPtr<nsAtom> name = NS_Atomize(aName);
|
RefPtr<nsAtom> name = NS_Atomize(aName);
|
||||||
RefPtr<nsAtom> entryType =
|
RefPtr<nsAtom> entryType =
|
||||||
aEntryType.WasPassed() ? NS_Atomize(aEntryType.Value()) : nullptr;
|
aEntryType.WasPassed() ? NS_Atomize(aEntryType.Value()) : nullptr;
|
||||||
@@ -367,17 +350,7 @@ already_AddRefed<PerformanceMark> Performance::Mark(
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
// To avoid fingerprinting in User Timing L2, we didn't add marks to the
|
InsertUserEntry(performanceMark);
|
||||||
// buffer so the user could not get timing data (which can be used to
|
|
||||||
// fingerprint) from the API. This may no longer be necessary (since
|
|
||||||
// performance.now() has reduced precision to protect against fingerprinting
|
|
||||||
// and performance.mark's primary fingerprinting issue is probably this timing
|
|
||||||
// data) but we need to do a more thorough reanalysis before we remove the
|
|
||||||
// fingerprinting protection. For now, we preserve the User Timing L2 behavior
|
|
||||||
// while supporting User Timing L3.
|
|
||||||
if (!nsContentUtils::ShouldResistFingerprinting()) {
|
|
||||||
InsertUserEntry(performanceMark);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (profiler_thread_is_being_profiled_for_markers()) {
|
if (profiler_thread_is_being_profiled_for_markers()) {
|
||||||
Maybe<uint64_t> innerWindowId;
|
Maybe<uint64_t> innerWindowId;
|
||||||
@@ -597,19 +570,6 @@ already_AddRefed<PerformanceMeasure> Performance::Measure(
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
// When resisting fingerprinting, we don't add marks to the buffer. Since
|
|
||||||
// measure relies on relationships between marks in the buffer, this method
|
|
||||||
// will throw if we look for user-entered marks so we return a dummy measure
|
|
||||||
// instead of continuing. We could instead return real values for performance
|
|
||||||
// timing attributes and dummy values for user-entered marks but this adds
|
|
||||||
// complexity that doesn't seem worth the effort because these fingerprinting
|
|
||||||
// protections may not longer be necessary (since performance.now() already
|
|
||||||
// has reduced precision).
|
|
||||||
if (nsContentUtils::ShouldResistFingerprinting()) {
|
|
||||||
return do_AddRef(new PerformanceMeasure(GetParentObject(), aName, 0, 0,
|
|
||||||
JS::NullHandleValue));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Maybe is more readable than using the union type directly.
|
// Maybe is more readable than using the union type directly.
|
||||||
Maybe<const PerformanceMeasureOptions&> options;
|
Maybe<const PerformanceMeasureOptions&> options;
|
||||||
if (aStartOrMeasureOptions.IsPerformanceMeasureOptions()) {
|
if (aStartOrMeasureOptions.IsPerformanceMeasureOptions()) {
|
||||||
@@ -852,10 +812,6 @@ MOZ_ALWAYS_INLINE bool Performance::CanAddResourceTimingEntry() {
|
|||||||
void Performance::InsertResourceEntry(PerformanceEntry* aEntry) {
|
void Performance::InsertResourceEntry(PerformanceEntry* aEntry) {
|
||||||
MOZ_ASSERT(aEntry);
|
MOZ_ASSERT(aEntry);
|
||||||
|
|
||||||
if (nsContentUtils::ShouldResistFingerprinting()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
QueueEntry(aEntry);
|
QueueEntry(aEntry);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -411,8 +411,7 @@ DOMHighResTimeStamp PerformanceMainThread::CreationTime() const {
|
|||||||
void PerformanceMainThread::CreateNavigationTimingEntry() {
|
void PerformanceMainThread::CreateNavigationTimingEntry() {
|
||||||
MOZ_ASSERT(!mDocEntry, "mDocEntry should be null.");
|
MOZ_ASSERT(!mDocEntry, "mDocEntry should be null.");
|
||||||
|
|
||||||
if (!StaticPrefs::dom_enable_performance_navigation_timing() ||
|
if (!StaticPrefs::dom_enable_performance_navigation_timing()) {
|
||||||
StaticPrefs::privacy_resistFingerprinting()) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -463,12 +462,6 @@ EventCounts* PerformanceMainThread::EventCounts() {
|
|||||||
|
|
||||||
void PerformanceMainThread::GetEntries(
|
void PerformanceMainThread::GetEntries(
|
||||||
nsTArray<RefPtr<PerformanceEntry>>& aRetval) {
|
nsTArray<RefPtr<PerformanceEntry>>& aRetval) {
|
||||||
// We return an empty list when 'privacy.resistFingerprinting' is on.
|
|
||||||
if (nsContentUtils::ShouldResistFingerprinting()) {
|
|
||||||
aRetval.Clear();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
aRetval = mResourceEntries.Clone();
|
aRetval = mResourceEntries.Clone();
|
||||||
aRetval.AppendElements(mUserEntries);
|
aRetval.AppendElements(mUserEntries);
|
||||||
|
|
||||||
@@ -484,12 +477,6 @@ void PerformanceMainThread::GetEntries(
|
|||||||
|
|
||||||
void PerformanceMainThread::GetEntriesByType(
|
void PerformanceMainThread::GetEntriesByType(
|
||||||
const nsAString& aEntryType, nsTArray<RefPtr<PerformanceEntry>>& aRetval) {
|
const nsAString& aEntryType, nsTArray<RefPtr<PerformanceEntry>>& aRetval) {
|
||||||
// We return an empty list when 'privacy.resistFingerprinting' is on.
|
|
||||||
if (nsContentUtils::ShouldResistFingerprinting()) {
|
|
||||||
aRetval.Clear();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
RefPtr<nsAtom> type = NS_Atomize(aEntryType);
|
RefPtr<nsAtom> type = NS_Atomize(aEntryType);
|
||||||
if (type == nsGkAtoms::navigation) {
|
if (type == nsGkAtoms::navigation) {
|
||||||
aRetval.Clear();
|
aRetval.Clear();
|
||||||
@@ -526,12 +513,6 @@ void PerformanceMainThread::GetEntriesByTypeForObserver(
|
|||||||
void PerformanceMainThread::GetEntriesByName(
|
void PerformanceMainThread::GetEntriesByName(
|
||||||
const nsAString& aName, const Optional<nsAString>& aEntryType,
|
const nsAString& aName, const Optional<nsAString>& aEntryType,
|
||||||
nsTArray<RefPtr<PerformanceEntry>>& aRetval) {
|
nsTArray<RefPtr<PerformanceEntry>>& aRetval) {
|
||||||
// We return an empty list when 'privacy.resistFingerprinting' is on.
|
|
||||||
if (nsContentUtils::ShouldResistFingerprinting()) {
|
|
||||||
aRetval.Clear();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Performance::GetEntriesByName(aName, aEntryType, aRetval);
|
Performance::GetEntriesByName(aName, aEntryType, aRetval);
|
||||||
|
|
||||||
if (mFCPTiming && mFCPTiming->GetName()->Equals(aName) &&
|
if (mFCPTiming && mFCPTiming->GetName()->Equals(aName) &&
|
||||||
|
|||||||
@@ -152,6 +152,5 @@ void PerformanceNavigationTiming::UpdatePropertiesFromHttpChannel(
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool PerformanceNavigationTiming::Enabled(JSContext* aCx, JSObject* aGlobal) {
|
bool PerformanceNavigationTiming::Enabled(JSContext* aCx, JSObject* aGlobal) {
|
||||||
return (StaticPrefs::dom_enable_performance_navigation_timing() &&
|
return StaticPrefs::dom_enable_performance_navigation_timing();
|
||||||
!StaticPrefs::privacy_resistFingerprinting());
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -112,8 +112,7 @@ PerformanceTimingData::PerformanceTimingData(nsITimedChannel* aChannel,
|
|||||||
mInitialized = !!aChannel;
|
mInitialized = !!aChannel;
|
||||||
mZeroTime = aZeroTime;
|
mZeroTime = aZeroTime;
|
||||||
|
|
||||||
if (!StaticPrefs::dom_enable_performance() ||
|
if (!StaticPrefs::dom_enable_performance()) {
|
||||||
nsContentUtils::ShouldResistFingerprinting()) {
|
|
||||||
mZeroTime = 0;
|
mZeroTime = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -338,8 +337,7 @@ bool PerformanceTimingData::CheckAllowedOrigin(nsIHttpChannel* aResourceChannel,
|
|||||||
}
|
}
|
||||||
|
|
||||||
uint8_t PerformanceTimingData::GetRedirectCount() const {
|
uint8_t PerformanceTimingData::GetRedirectCount() const {
|
||||||
if (!StaticPrefs::dom_enable_performance() || !IsInitialized() ||
|
if (!StaticPrefs::dom_enable_performance() || !IsInitialized()) {
|
||||||
nsContentUtils::ShouldResistFingerprinting()) {
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (!mAllRedirectsSameOrigin) {
|
if (!mAllRedirectsSameOrigin) {
|
||||||
@@ -350,8 +348,7 @@ uint8_t PerformanceTimingData::GetRedirectCount() const {
|
|||||||
|
|
||||||
bool PerformanceTimingData::ShouldReportCrossOriginRedirect(
|
bool PerformanceTimingData::ShouldReportCrossOriginRedirect(
|
||||||
bool aEnsureSameOriginAndIgnoreTAO) const {
|
bool aEnsureSameOriginAndIgnoreTAO) const {
|
||||||
if (!StaticPrefs::dom_enable_performance() || !IsInitialized() ||
|
if (!StaticPrefs::dom_enable_performance() || !IsInitialized()) {
|
||||||
nsContentUtils::ShouldResistFingerprinting()) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user