Bug 1320801 part 2. Switch from ShouldResistFingerprinting to ResistFingerprinting (use the caller type, not the document principal) in nsGlobalWindow's screenX/screenY getters. r=bkelly

This commit is contained in:
Boris Zbarsky 2016-12-22 11:05:54 -08:00
Родитель 454eaf81d5
Коммит 97b0a23beb
2 изменённых файлов: 14 добавлений и 13 удалений

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

@ -5430,12 +5430,12 @@ nsGlobalWindow::SetOuterHeight(JSContext* aCx, JS::Handle<JS::Value> aValue,
} }
CSSIntPoint CSSIntPoint
nsGlobalWindow::GetScreenXY(ErrorResult& aError) nsGlobalWindow::GetScreenXY(CallerType aCallerType, ErrorResult& aError)
{ {
MOZ_ASSERT(IsOuterWindow()); MOZ_ASSERT(IsOuterWindow());
// When resisting fingerprinting, always return (0,0) // When resisting fingerprinting, always return (0,0)
if (nsContentUtils::ShouldResistFingerprinting(mDocShell)) { if (nsContentUtils::ResistFingerprinting(aCallerType)) {
return CSSIntPoint(0, 0); return CSSIntPoint(0, 0);
} }
@ -5478,18 +5478,17 @@ nsGlobalWindow::GetScreenXY(ErrorResult& aError)
} }
int32_t int32_t
nsGlobalWindow::GetScreenXOuter(ErrorResult& aError) nsGlobalWindow::GetScreenXOuter(CallerType aCallerType, ErrorResult& aError)
{ {
MOZ_RELEASE_ASSERT(IsOuterWindow()); MOZ_RELEASE_ASSERT(IsOuterWindow());
return GetScreenXY(aError).x; return GetScreenXY(aCallerType, aError).x;
} }
int32_t int32_t
nsGlobalWindow::GetScreenX(CallerType aCallerType, ErrorResult& aError) nsGlobalWindow::GetScreenX(CallerType aCallerType, ErrorResult& aError)
{ {
// Need to actually use aCallerType here. Next changeset. FORWARD_TO_OUTER_OR_THROW(GetScreenXOuter, (aCallerType, aError), aError, 0);
FORWARD_TO_OUTER_OR_THROW(GetScreenXOuter, (aError), aError, 0);
} }
void void
@ -5731,18 +5730,17 @@ nsGlobalWindow::SetScreenX(JSContext* aCx, JS::Handle<JS::Value> aValue,
} }
int32_t int32_t
nsGlobalWindow::GetScreenYOuter(ErrorResult& aError) nsGlobalWindow::GetScreenYOuter(CallerType aCallerType, ErrorResult& aError)
{ {
MOZ_RELEASE_ASSERT(IsOuterWindow()); MOZ_RELEASE_ASSERT(IsOuterWindow());
return GetScreenXY(aError).y; return GetScreenXY(aCallerType, aError).y;
} }
int32_t int32_t
nsGlobalWindow::GetScreenY(CallerType aCallerType, ErrorResult& aError) nsGlobalWindow::GetScreenY(CallerType aCallerType, ErrorResult& aError)
{ {
// Need to actually use aCallerType here. Next changeset. FORWARD_TO_OUTER_OR_THROW(GetScreenYOuter, (aCallerType, aError), aError, 0);
FORWARD_TO_OUTER_OR_THROW(GetScreenYOuter, (aError), aError, 0);
} }
void void

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

@ -1310,12 +1310,14 @@ protected:
nsresult GetInnerHeight(int32_t* aHeight) override; nsresult GetInnerHeight(int32_t* aHeight) override;
void SetInnerHeightOuter(int32_t aInnerHeight, mozilla::ErrorResult& aError, bool aCallerIsChrome); void SetInnerHeightOuter(int32_t aInnerHeight, mozilla::ErrorResult& aError, bool aCallerIsChrome);
void SetInnerHeight(int32_t aInnerHeight, mozilla::ErrorResult& aError); void SetInnerHeight(int32_t aInnerHeight, mozilla::ErrorResult& aError);
int32_t GetScreenXOuter(mozilla::ErrorResult& aError); int32_t GetScreenXOuter(mozilla::dom::CallerType aCallerType,
mozilla::ErrorResult& aError);
int32_t GetScreenX(mozilla::dom::CallerType aCallerType, int32_t GetScreenX(mozilla::dom::CallerType aCallerType,
mozilla::ErrorResult& aError); mozilla::ErrorResult& aError);
void SetScreenXOuter(int32_t aScreenX, mozilla::ErrorResult& aError, bool aCallerIsChrome); void SetScreenXOuter(int32_t aScreenX, mozilla::ErrorResult& aError, bool aCallerIsChrome);
void SetScreenX(int32_t aScreenX, mozilla::ErrorResult& aError); void SetScreenX(int32_t aScreenX, mozilla::ErrorResult& aError);
int32_t GetScreenYOuter(mozilla::ErrorResult& aError); int32_t GetScreenYOuter(mozilla::dom::CallerType aCallerType,
mozilla::ErrorResult& aError);
int32_t GetScreenY(mozilla::dom::CallerType aCallerType, int32_t GetScreenY(mozilla::dom::CallerType aCallerType,
mozilla::ErrorResult& aError); mozilla::ErrorResult& aError);
void SetScreenYOuter(int32_t aScreenY, mozilla::ErrorResult& aError, bool aCallerIsChrome); void SetScreenYOuter(int32_t aScreenY, mozilla::ErrorResult& aError, bool aCallerIsChrome);
@ -1656,7 +1658,8 @@ protected:
void PreloadLocalStorage(); void PreloadLocalStorage();
// Returns CSS pixels based on primary screen. Outer windows only. // Returns CSS pixels based on primary screen. Outer windows only.
mozilla::CSSIntPoint GetScreenXY(mozilla::ErrorResult& aError); mozilla::CSSIntPoint GetScreenXY(mozilla::dom::CallerType aCallerType,
mozilla::ErrorResult& aError);
nsGlobalWindow* InnerForSetTimeoutOrInterval(mozilla::ErrorResult& aError); nsGlobalWindow* InnerForSetTimeoutOrInterval(mozilla::ErrorResult& aError);