mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-07 18:04:46 +00:00
Bug 1325016 part 2. Switch ScreenOrientation's deviceType getter to use the caller-type version of ResistFingerprinting. r=bkelly
This commit is contained in:
parent
224a0a59a6
commit
1ba3c2ac4b
@ -410,10 +410,10 @@ ScreenOrientation::UnlockDeviceOrientation()
|
||||
}
|
||||
|
||||
OrientationType
|
||||
ScreenOrientation::DeviceType() const
|
||||
ScreenOrientation::DeviceType(CallerType aCallerType) const
|
||||
{
|
||||
return ShouldResistFingerprinting() ? OrientationType::Landscape_primary
|
||||
: mType;
|
||||
return nsContentUtils::ResistFingerprinting(aCallerType) ?
|
||||
OrientationType::Landscape_primary : mType;
|
||||
}
|
||||
|
||||
uint16_t
|
||||
@ -627,8 +627,9 @@ ScreenOrientation::VisibleEventListener::HandleEvent(nsIDOMEvent* aEvent)
|
||||
return rv.StealNSResult();
|
||||
}
|
||||
|
||||
if (doc->CurrentOrientationType() != orientation->DeviceType()) {
|
||||
doc->SetCurrentOrientation(orientation->DeviceType(), orientation->DeviceAngle());
|
||||
if (doc->CurrentOrientationType() != orientation->DeviceType(CallerType::System)) {
|
||||
doc->SetCurrentOrientation(orientation->DeviceType(CallerType::System),
|
||||
orientation->DeviceAngle());
|
||||
|
||||
Promise* pendingPromise = doc->GetOrientationPendingPromise();
|
||||
if (pendingPromise) {
|
||||
|
@ -8,6 +8,7 @@
|
||||
#define mozilla_dom_ScreenOrientation_h
|
||||
|
||||
#include "mozilla/DOMEventTargetHelper.h"
|
||||
#include "mozilla/dom/BindingDeclarations.h"
|
||||
#include "mozilla/dom/ScreenOrientationBinding.h"
|
||||
#include "mozilla/HalScreenConfiguration.h"
|
||||
|
||||
@ -51,7 +52,7 @@ public:
|
||||
void Unlock(ErrorResult& aRv);
|
||||
|
||||
// DeviceType and DeviceAngle gets the current type and angle of the device.
|
||||
OrientationType DeviceType() const;
|
||||
OrientationType DeviceType(CallerType aCallerType) const;
|
||||
uint16_t DeviceAngle() const;
|
||||
|
||||
// GetType and GetAngle gets the type and angle of the responsible document
|
||||
|
@ -185,9 +185,10 @@ nsScreen::Orientation() const
|
||||
}
|
||||
|
||||
void
|
||||
nsScreen::GetMozOrientation(nsString& aOrientation) const
|
||||
nsScreen::GetMozOrientation(nsString& aOrientation,
|
||||
CallerType aCallerType) const
|
||||
{
|
||||
switch (mScreenOrientation->DeviceType()) {
|
||||
switch (mScreenOrientation->DeviceType(aCallerType)) {
|
||||
case OrientationType::Portrait_primary:
|
||||
aOrientation.AssignLiteral("portrait-primary");
|
||||
break;
|
||||
|
@ -115,7 +115,8 @@ public:
|
||||
}
|
||||
|
||||
// Deprecated
|
||||
void GetMozOrientation(nsString& aOrientation) const;
|
||||
void GetMozOrientation(nsString& aOrientation,
|
||||
mozilla::dom::CallerType aCallerType) const;
|
||||
|
||||
IMPL_EVENT_HANDLER(mozorientationchange)
|
||||
|
||||
|
@ -34,6 +34,7 @@ interface Screen : EventTarget {
|
||||
* Can be: landscape-primary, landscape-secondary,
|
||||
* portrait-primary or portrait-secondary.
|
||||
*/
|
||||
[NeedsCallerType]
|
||||
readonly attribute DOMString mozOrientation;
|
||||
|
||||
attribute EventHandler onmozorientationchange;
|
||||
|
Loading…
Reference in New Issue
Block a user