зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1809774: Simplify PointerEvent.webidl because RFP doesn't need the callertype r=edgar
Differential Revision: https://phabricator.services.mozilla.com/D166625
This commit is contained in:
Родитель
357a4ffe21
Коммит
41db83c9f3
|
@ -138,14 +138,13 @@ NS_INTERFACE_MAP_END_INHERITING(MouseEvent)
|
||||||
NS_IMPL_ADDREF_INHERITED(PointerEvent, MouseEvent)
|
NS_IMPL_ADDREF_INHERITED(PointerEvent, MouseEvent)
|
||||||
NS_IMPL_RELEASE_INHERITED(PointerEvent, MouseEvent)
|
NS_IMPL_RELEASE_INHERITED(PointerEvent, MouseEvent)
|
||||||
|
|
||||||
void PointerEvent::GetPointerType(nsAString& aPointerType,
|
void PointerEvent::GetPointerType(nsAString& aPointerType) {
|
||||||
CallerType aCallerType) {
|
|
||||||
if (mPointerType.isSome()) {
|
if (mPointerType.isSome()) {
|
||||||
aPointerType = mPointerType.value();
|
aPointerType = mPointerType.value();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ShouldResistFingerprinting(aCallerType)) {
|
if (ShouldResistFingerprinting()) {
|
||||||
aPointerType.AssignLiteral("mouse");
|
aPointerType.AssignLiteral("mouse");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -154,27 +153,22 @@ void PointerEvent::GetPointerType(nsAString& aPointerType,
|
||||||
aPointerType);
|
aPointerType);
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t PointerEvent::PointerId(CallerType aCallerType) {
|
int32_t PointerEvent::PointerId() {
|
||||||
return ShouldResistFingerprinting(aCallerType)
|
return ShouldResistFingerprinting()
|
||||||
? PointerEventHandler::GetSpoofedPointerIdForRFP()
|
? PointerEventHandler::GetSpoofedPointerIdForRFP()
|
||||||
: mEvent->AsPointerEvent()->pointerId;
|
: mEvent->AsPointerEvent()->pointerId;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t PointerEvent::Width(CallerType aCallerType) {
|
int32_t PointerEvent::Width() {
|
||||||
return ShouldResistFingerprinting(aCallerType)
|
return ShouldResistFingerprinting() ? 1 : mEvent->AsPointerEvent()->mWidth;
|
||||||
? 1
|
|
||||||
: mEvent->AsPointerEvent()->mWidth;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t PointerEvent::Height(CallerType aCallerType) {
|
int32_t PointerEvent::Height() {
|
||||||
return ShouldResistFingerprinting(aCallerType)
|
return ShouldResistFingerprinting() ? 1 : mEvent->AsPointerEvent()->mHeight;
|
||||||
? 1
|
|
||||||
: mEvent->AsPointerEvent()->mHeight;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
float PointerEvent::Pressure(CallerType aCallerType) {
|
float PointerEvent::Pressure() {
|
||||||
if (mEvent->mMessage == ePointerUp ||
|
if (mEvent->mMessage == ePointerUp || !ShouldResistFingerprinting()) {
|
||||||
!ShouldResistFingerprinting(aCallerType)) {
|
|
||||||
return mEvent->AsPointerEvent()->mPressure;
|
return mEvent->AsPointerEvent()->mPressure;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -191,28 +185,22 @@ float PointerEvent::Pressure(CallerType aCallerType) {
|
||||||
return spoofedPressure;
|
return spoofedPressure;
|
||||||
}
|
}
|
||||||
|
|
||||||
float PointerEvent::TangentialPressure(CallerType aCallerType) {
|
float PointerEvent::TangentialPressure() {
|
||||||
return ShouldResistFingerprinting(aCallerType)
|
return ShouldResistFingerprinting()
|
||||||
? 0
|
? 0
|
||||||
: mEvent->AsPointerEvent()->tangentialPressure;
|
: mEvent->AsPointerEvent()->tangentialPressure;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t PointerEvent::TiltX(CallerType aCallerType) {
|
int32_t PointerEvent::TiltX() {
|
||||||
return ShouldResistFingerprinting(aCallerType)
|
return ShouldResistFingerprinting() ? 0 : mEvent->AsPointerEvent()->tiltX;
|
||||||
? 0
|
|
||||||
: mEvent->AsPointerEvent()->tiltX;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t PointerEvent::TiltY(CallerType aCallerType) {
|
int32_t PointerEvent::TiltY() {
|
||||||
return ShouldResistFingerprinting(aCallerType)
|
return ShouldResistFingerprinting() ? 0 : mEvent->AsPointerEvent()->tiltY;
|
||||||
? 0
|
|
||||||
: mEvent->AsPointerEvent()->tiltY;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t PointerEvent::Twist(CallerType aCallerType) {
|
int32_t PointerEvent::Twist() {
|
||||||
return ShouldResistFingerprinting(aCallerType)
|
return ShouldResistFingerprinting() ? 0 : mEvent->AsPointerEvent()->twist;
|
||||||
? 0
|
|
||||||
: mEvent->AsPointerEvent()->twist;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PointerEvent::IsPrimary() { return mEvent->AsPointerEvent()->mIsPrimary; }
|
bool PointerEvent::IsPrimary() { return mEvent->AsPointerEvent()->mIsPrimary; }
|
||||||
|
@ -275,17 +263,17 @@ void PointerEvent::GetPredictedEvents(
|
||||||
aPointerEvents.AppendElements(mPredictedEvents);
|
aPointerEvents.AppendElements(mPredictedEvents);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PointerEvent::ShouldResistFingerprinting(CallerType aCallerType) {
|
bool PointerEvent::ShouldResistFingerprinting() {
|
||||||
// There are four situations we don't need to spoof this pointer event.
|
// There are three simple situations we don't need to spoof this pointer
|
||||||
|
// event.
|
||||||
// 1. The pref privcy.resistFingerprinting' is false, we fast return here
|
// 1. The pref privcy.resistFingerprinting' is false, we fast return here
|
||||||
// since we don't need to do any QI of following codes.
|
// since we don't need to do any QI of following codes.
|
||||||
// 2. This event is generated by scripts.
|
// 2. This event is generated by scripts.
|
||||||
// 3. This event is a mouse pointer event.
|
// 3. This event is a mouse pointer event.
|
||||||
// 4. The caller type is system.
|
|
||||||
// We don't need to check for the system group since pointer events won't be
|
// We don't need to check for the system group since pointer events won't be
|
||||||
// dispatched to the system group.
|
// dispatched to the system group.
|
||||||
if (!nsContentUtils::ShouldResistFingerprinting() || !mEvent->IsTrusted() ||
|
if (!nsContentUtils::ShouldResistFingerprinting("Efficiency Check") ||
|
||||||
aCallerType == CallerType::System ||
|
!mEvent->IsTrusted() ||
|
||||||
mEvent->AsPointerEvent()->mInputSource ==
|
mEvent->AsPointerEvent()->mInputSource ==
|
||||||
MouseEvent_Binding::MOZ_SOURCE_MOUSE) {
|
MouseEvent_Binding::MOZ_SOURCE_MOUSE) {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -38,16 +38,16 @@ class PointerEvent : public MouseEvent {
|
||||||
EventTarget* aOwner, const nsAString& aType,
|
EventTarget* aOwner, const nsAString& aType,
|
||||||
const PointerEventInit& aParam);
|
const PointerEventInit& aParam);
|
||||||
|
|
||||||
int32_t PointerId(CallerType aCallerType);
|
int32_t PointerId();
|
||||||
int32_t Width(CallerType aCallerType);
|
int32_t Width();
|
||||||
int32_t Height(CallerType aCallerType);
|
int32_t Height();
|
||||||
float Pressure(CallerType aCallerType);
|
float Pressure();
|
||||||
float TangentialPressure(CallerType aCallerType);
|
float TangentialPressure();
|
||||||
int32_t TiltX(CallerType aCallerType);
|
int32_t TiltX();
|
||||||
int32_t TiltY(CallerType aCallerType);
|
int32_t TiltY();
|
||||||
int32_t Twist(CallerType aCallerType);
|
int32_t Twist();
|
||||||
bool IsPrimary();
|
bool IsPrimary();
|
||||||
void GetPointerType(nsAString& aPointerType, CallerType aCallerType);
|
void GetPointerType(nsAString& aPointerType);
|
||||||
void GetCoalescedEvents(nsTArray<RefPtr<PointerEvent>>& aPointerEvents);
|
void GetCoalescedEvents(nsTArray<RefPtr<PointerEvent>>& aPointerEvents);
|
||||||
void GetPredictedEvents(nsTArray<RefPtr<PointerEvent>>& aPointerEvents);
|
void GetPredictedEvents(nsTArray<RefPtr<PointerEvent>>& aPointerEvents);
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@ class PointerEvent : public MouseEvent {
|
||||||
private:
|
private:
|
||||||
// This method returns the boolean to indicate whether spoofing pointer
|
// This method returns the boolean to indicate whether spoofing pointer
|
||||||
// event for fingerprinting resistance.
|
// event for fingerprinting resistance.
|
||||||
bool ShouldResistFingerprinting(CallerType aCallerType);
|
bool ShouldResistFingerprinting();
|
||||||
|
|
||||||
nsTArray<RefPtr<PointerEvent>> mCoalescedEvents;
|
nsTArray<RefPtr<PointerEvent>> mCoalescedEvents;
|
||||||
nsTArray<RefPtr<PointerEvent>> mPredictedEvents;
|
nsTArray<RefPtr<PointerEvent>> mPredictedEvents;
|
||||||
|
|
|
@ -14,25 +14,16 @@ interface PointerEvent : MouseEvent
|
||||||
{
|
{
|
||||||
constructor(DOMString type, optional PointerEventInit eventInitDict = {});
|
constructor(DOMString type, optional PointerEventInit eventInitDict = {});
|
||||||
|
|
||||||
[NeedsCallerType]
|
|
||||||
readonly attribute long pointerId;
|
readonly attribute long pointerId;
|
||||||
|
|
||||||
[NeedsCallerType]
|
|
||||||
readonly attribute long width;
|
readonly attribute long width;
|
||||||
[NeedsCallerType]
|
|
||||||
readonly attribute long height;
|
readonly attribute long height;
|
||||||
[NeedsCallerType]
|
|
||||||
readonly attribute float pressure;
|
readonly attribute float pressure;
|
||||||
[NeedsCallerType]
|
|
||||||
readonly attribute float tangentialPressure;
|
readonly attribute float tangentialPressure;
|
||||||
[NeedsCallerType]
|
|
||||||
readonly attribute long tiltX;
|
readonly attribute long tiltX;
|
||||||
[NeedsCallerType]
|
|
||||||
readonly attribute long tiltY;
|
readonly attribute long tiltY;
|
||||||
[NeedsCallerType]
|
|
||||||
readonly attribute long twist;
|
readonly attribute long twist;
|
||||||
|
|
||||||
[NeedsCallerType]
|
|
||||||
readonly attribute DOMString pointerType;
|
readonly attribute DOMString pointerType;
|
||||||
readonly attribute boolean isPrimary;
|
readonly attribute boolean isPrimary;
|
||||||
sequence<PointerEvent> getCoalescedEvents();
|
sequence<PointerEvent> getCoalescedEvents();
|
||||||
|
|
Загрузка…
Ссылка в новой задаче