mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-23 12:51:06 +00:00
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:
parent
b9d529957a
commit
df00f0130c
@ -165,12 +165,6 @@ JSObject* Performance::WrapObject(JSContext* aCx,
|
||||
}
|
||||
|
||||
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.AppendElements(mUserEntries);
|
||||
aRetval.Sort(PerformanceEntryComparator());
|
||||
@ -178,12 +172,6 @@ void Performance::GetEntries(nsTArray<RefPtr<PerformanceEntry>>& aRetval) {
|
||||
|
||||
void Performance::GetEntriesByType(
|
||||
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")) {
|
||||
aRetval = mResourceEntries.Clone();
|
||||
return;
|
||||
@ -206,11 +194,6 @@ void Performance::GetEntriesByName(
|
||||
nsTArray<RefPtr<PerformanceEntry>>& aRetval) {
|
||||
aRetval.Clear();
|
||||
|
||||
// We return an empty list when 'privacy.resistFingerprinting' is on.
|
||||
if (nsContentUtils::ShouldResistFingerprinting()) {
|
||||
return;
|
||||
}
|
||||
|
||||
RefPtr<nsAtom> name = NS_Atomize(aName);
|
||||
RefPtr<nsAtom> entryType =
|
||||
aEntryType.WasPassed() ? NS_Atomize(aEntryType.Value()) : nullptr;
|
||||
@ -367,17 +350,7 @@ already_AddRefed<PerformanceMark> Performance::Mark(
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// To avoid fingerprinting in User Timing L2, we didn't add marks to the
|
||||
// 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);
|
||||
}
|
||||
InsertUserEntry(performanceMark);
|
||||
|
||||
if (profiler_thread_is_being_profiled_for_markers()) {
|
||||
Maybe<uint64_t> innerWindowId;
|
||||
@ -597,19 +570,6 @@ already_AddRefed<PerformanceMeasure> Performance::Measure(
|
||||
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<const PerformanceMeasureOptions&> options;
|
||||
if (aStartOrMeasureOptions.IsPerformanceMeasureOptions()) {
|
||||
@ -852,10 +812,6 @@ MOZ_ALWAYS_INLINE bool Performance::CanAddResourceTimingEntry() {
|
||||
void Performance::InsertResourceEntry(PerformanceEntry* aEntry) {
|
||||
MOZ_ASSERT(aEntry);
|
||||
|
||||
if (nsContentUtils::ShouldResistFingerprinting()) {
|
||||
return;
|
||||
}
|
||||
|
||||
QueueEntry(aEntry);
|
||||
|
||||
/*
|
||||
|
@ -411,8 +411,7 @@ DOMHighResTimeStamp PerformanceMainThread::CreationTime() const {
|
||||
void PerformanceMainThread::CreateNavigationTimingEntry() {
|
||||
MOZ_ASSERT(!mDocEntry, "mDocEntry should be null.");
|
||||
|
||||
if (!StaticPrefs::dom_enable_performance_navigation_timing() ||
|
||||
StaticPrefs::privacy_resistFingerprinting()) {
|
||||
if (!StaticPrefs::dom_enable_performance_navigation_timing()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -463,12 +462,6 @@ EventCounts* PerformanceMainThread::EventCounts() {
|
||||
|
||||
void PerformanceMainThread::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.AppendElements(mUserEntries);
|
||||
|
||||
@ -484,12 +477,6 @@ void PerformanceMainThread::GetEntries(
|
||||
|
||||
void PerformanceMainThread::GetEntriesByType(
|
||||
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);
|
||||
if (type == nsGkAtoms::navigation) {
|
||||
aRetval.Clear();
|
||||
@ -526,12 +513,6 @@ void PerformanceMainThread::GetEntriesByTypeForObserver(
|
||||
void PerformanceMainThread::GetEntriesByName(
|
||||
const nsAString& aName, const Optional<nsAString>& aEntryType,
|
||||
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);
|
||||
|
||||
if (mFCPTiming && mFCPTiming->GetName()->Equals(aName) &&
|
||||
|
@ -152,6 +152,5 @@ void PerformanceNavigationTiming::UpdatePropertiesFromHttpChannel(
|
||||
}
|
||||
|
||||
bool PerformanceNavigationTiming::Enabled(JSContext* aCx, JSObject* aGlobal) {
|
||||
return (StaticPrefs::dom_enable_performance_navigation_timing() &&
|
||||
!StaticPrefs::privacy_resistFingerprinting());
|
||||
return StaticPrefs::dom_enable_performance_navigation_timing();
|
||||
}
|
||||
|
@ -112,8 +112,7 @@ PerformanceTimingData::PerformanceTimingData(nsITimedChannel* aChannel,
|
||||
mInitialized = !!aChannel;
|
||||
mZeroTime = aZeroTime;
|
||||
|
||||
if (!StaticPrefs::dom_enable_performance() ||
|
||||
nsContentUtils::ShouldResistFingerprinting()) {
|
||||
if (!StaticPrefs::dom_enable_performance()) {
|
||||
mZeroTime = 0;
|
||||
}
|
||||
|
||||
@ -338,8 +337,7 @@ bool PerformanceTimingData::CheckAllowedOrigin(nsIHttpChannel* aResourceChannel,
|
||||
}
|
||||
|
||||
uint8_t PerformanceTimingData::GetRedirectCount() const {
|
||||
if (!StaticPrefs::dom_enable_performance() || !IsInitialized() ||
|
||||
nsContentUtils::ShouldResistFingerprinting()) {
|
||||
if (!StaticPrefs::dom_enable_performance() || !IsInitialized()) {
|
||||
return 0;
|
||||
}
|
||||
if (!mAllRedirectsSameOrigin) {
|
||||
@ -350,8 +348,7 @@ uint8_t PerformanceTimingData::GetRedirectCount() const {
|
||||
|
||||
bool PerformanceTimingData::ShouldReportCrossOriginRedirect(
|
||||
bool aEnsureSameOriginAndIgnoreTAO) const {
|
||||
if (!StaticPrefs::dom_enable_performance() || !IsInitialized() ||
|
||||
nsContentUtils::ShouldResistFingerprinting()) {
|
||||
if (!StaticPrefs::dom_enable_performance() || !IsInitialized()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user