morgan pushed to branch mullvad-browser-140.4.0esr-15.0-1 at The Tor Project / Applications / Mullvad Browser
Commits:
-
4517a0aa
by Pier Angelo Vendrame at 2025-10-15T13:56:10+00:00
-
1a3fdcf6
by Pier Angelo Vendrame at 2025-10-15T13:56:10+00:00
11 changed files:
- browser/app/profile/001-base-profile.js
- dom/base/Element.cpp
- dom/events/PointerEvent.cpp
- dom/events/PointerEvent.h
- dom/events/PointerEventHandler.cpp
- dom/events/TouchEvent.cpp
- dom/webidl/PointerEvent.webidl
- layout/base/PositionedEventTargeting.cpp
- toolkit/components/resistfingerprinting/RFPTargets.inc
- toolkit/components/resistfingerprinting/nsRFPService.cpp
- widget/WidgetEventImpl.cpp
Changes:
... | ... | @@ -497,12 +497,6 @@ pref("dom.webmidi.enabled", false); // Bug 41398: Disable Web MIDI API |
497 | 497 | // randomized IDs when this pref is true).
|
498 | 498 | // Defense-in-depth (already the default value) from Firefox 119 or 120.
|
499 | 499 | pref("media.devices.enumerate.legacy.enabled", false);
|
500 | -// Touch events (tor-browser#10286, tor-browser#42069, tor-browser#44062)
|
|
501 | -#if defined(XP_WIN) || defined(ANDROID)
|
|
502 | -pref("dom.w3c_touch_events.enabled", 1);
|
|
503 | -#else
|
|
504 | -pref("dom.w3c_touch_events.enabled", 0);
|
|
505 | -#endif
|
|
506 | 500 | #ifndef ANDROID
|
507 | 501 | // Bug 42138: Disable touch-based overscroll UX
|
508 | 502 | pref("apz.overscroll.enabled", false);
|
... | ... | @@ -302,11 +302,6 @@ nsDOMAttributeMap* Element::Attributes() { |
302 | 302 | }
|
303 | 303 | |
304 | 304 | void Element::SetPointerCapture(int32_t aPointerId, ErrorResult& aError) {
|
305 | - if (OwnerDoc()->ShouldResistFingerprinting(RFPTarget::PointerId) &&
|
|
306 | - aPointerId != PointerEventHandler::GetSpoofedPointerIdForRFP()) {
|
|
307 | - aError.ThrowNotFoundError("Invalid pointer id");
|
|
308 | - return;
|
|
309 | - }
|
|
310 | 305 | const PointerInfo* pointerInfo =
|
311 | 306 | PointerEventHandler::GetPointerInfo(aPointerId);
|
312 | 307 | if (!pointerInfo) {
|
... | ... | @@ -334,11 +329,6 @@ void Element::SetPointerCapture(int32_t aPointerId, ErrorResult& aError) { |
334 | 329 | }
|
335 | 330 | |
336 | 331 | void Element::ReleasePointerCapture(int32_t aPointerId, ErrorResult& aError) {
|
337 | - if (OwnerDoc()->ShouldResistFingerprinting(RFPTarget::PointerId) &&
|
|
338 | - aPointerId != PointerEventHandler::GetSpoofedPointerIdForRFP()) {
|
|
339 | - aError.ThrowNotFoundError("Invalid pointer id");
|
|
340 | - return;
|
|
341 | - }
|
|
342 | 332 | if (!PointerEventHandler::GetPointerInfo(aPointerId)) {
|
343 | 333 | aError.ThrowNotFoundError("Invalid pointer id");
|
344 | 334 | return;
|
... | ... | @@ -224,39 +224,78 @@ NS_INTERFACE_MAP_END_INHERITING(MouseEvent) |
224 | 224 | NS_IMPL_ADDREF_INHERITED(PointerEvent, MouseEvent)
|
225 | 225 | NS_IMPL_RELEASE_INHERITED(PointerEvent, MouseEvent)
|
226 | 226 | |
227 | -void PointerEvent::GetPointerType(nsAString& aPointerType) {
|
|
227 | +uint16_t PointerEvent::ResistantInputSource(CallerType aCallerType) const {
|
|
228 | + const uint16_t inputSource = mEvent->AsPointerEvent()->mInputSource;
|
|
229 | + if (!ShouldResistFingerprinting(aCallerType)) {
|
|
230 | + return inputSource;
|
|
231 | + }
|
|
232 | + |
|
233 | + MOZ_ASSERT(IsTrusted());
|
|
234 | + |
|
235 | + // Bug 1953665: Pen events are inconsistent between platforms.
|
|
236 | + // They might emit touch events on Windows and Android, but only mouse events
|
|
237 | + // in other platforms. In particular, touch is always disabled on macOS.
|
|
238 | +#if defined(XP_WIN)
|
|
239 | + if (inputSource == MouseEvent_Binding::MOZ_SOURCE_TOUCH ||
|
|
240 | + inputSource == MouseEvent_Binding::MOZ_SOURCE_MOUSE) {
|
|
241 | + return inputSource;
|
|
242 | + }
|
|
243 | + // Similar to nsWindow::DispatchTouchEventFromWMPointer.
|
|
244 | + switch (mEvent->mMessage) {
|
|
245 | + case ePointerMove:
|
|
246 | + return mEvent->AsPointerEvent()->mPressure == 0
|
|
247 | + ? MouseEvent_Binding::MOZ_SOURCE_MOUSE // hover
|
|
248 | + : MouseEvent_Binding::MOZ_SOURCE_TOUCH;
|
|
249 | + case ePointerUp:
|
|
250 | + case ePointerDown:
|
|
251 | + case ePointerCancel:
|
|
252 | + return MouseEvent_Binding::MOZ_SOURCE_TOUCH;
|
|
253 | + default:
|
|
254 | + return MouseEvent_Binding::MOZ_SOURCE_MOUSE;
|
|
255 | + }
|
|
256 | +#elif defined(MOZ_WIDGET_ANDROID)
|
|
257 | + return inputSource == MouseEvent_Binding::MOZ_SOURCE_MOUSE
|
|
258 | + ? MouseEvent_Binding::MOZ_SOURCE_MOUSE
|
|
259 | + : MouseEvent_Binding::MOZ_SOURCE_TOUCH;
|
|
260 | +#elif defined(MOZ_WIDGET_GTK)
|
|
261 | + return inputSource == MouseEvent_Binding::MOZ_SOURCE_TOUCH
|
|
262 | + ? MouseEvent_Binding::MOZ_SOURCE_TOUCH
|
|
263 | + : MouseEvent_Binding::MOZ_SOURCE_MOUSE;
|
|
264 | +#elif defined(MOZ_WIDGET_COCOA)
|
|
265 | + return MouseEvent_Binding::MOZ_SOURCE_MOUSE;
|
|
266 | +#else
|
|
267 | + return inputSource;
|
|
268 | +#endif
|
|
269 | +}
|
|
270 | + |
|
271 | +void PointerEvent::GetPointerType(nsAString& aPointerType,
|
|
272 | + CallerType aCallerType) {
|
|
228 | 273 | if (mPointerType.isSome()) {
|
229 | 274 | aPointerType = mPointerType.value();
|
230 | 275 | return;
|
231 | 276 | }
|
232 | - |
|
233 | -#if SPOOFED_MAX_TOUCH_POINTS <= 0
|
|
234 | - if (ShouldResistFingerprinting()) {
|
|
235 | - aPointerType.AssignLiteral("mouse");
|
|
236 | - return;
|
|
237 | - }
|
|
238 | -#endif
|
|
239 | - |
|
240 | - ConvertPointerTypeToString(mEvent->AsPointerEvent()->mInputSource,
|
|
241 | - aPointerType);
|
|
277 | + ConvertPointerTypeToString(ResistantInputSource(aCallerType), aPointerType);
|
|
242 | 278 | }
|
243 | 279 | |
244 | 280 | int32_t PointerEvent::PointerId() {
|
245 | - return (ShouldResistFingerprinting(true))
|
|
246 | - ? PointerEventHandler::GetSpoofedPointerIdForRFP()
|
|
247 | - : mEvent->AsPointerEvent()->pointerId;
|
|
281 | + return mEvent->AsPointerEvent()->pointerId;
|
|
248 | 282 | }
|
249 | 283 | |
250 | -double PointerEvent::Width() const {
|
|
251 | - return ShouldResistFingerprinting() ? 1.0 : mEvent->AsPointerEvent()->mWidth;
|
|
284 | +double PointerEvent::Width(CallerType aCallerType) const {
|
|
285 | + return ShouldResistFingerprinting(aCallerType)
|
|
286 | + ? 1.0
|
|
287 | + : mEvent->AsPointerEvent()->mWidth;
|
|
252 | 288 | }
|
253 | 289 | |
254 | -double PointerEvent::Height() const {
|
|
255 | - return ShouldResistFingerprinting() ? 1.0 : mEvent->AsPointerEvent()->mHeight;
|
|
290 | +double PointerEvent::Height(CallerType aCallerType) const {
|
|
291 | + return ShouldResistFingerprinting(aCallerType)
|
|
292 | + ? 1.0
|
|
293 | + : mEvent->AsPointerEvent()->mHeight;
|
|
256 | 294 | }
|
257 | 295 | |
258 | -float PointerEvent::Pressure() {
|
|
259 | - if (mEvent->mMessage == ePointerUp || !ShouldResistFingerprinting()) {
|
|
296 | +float PointerEvent::Pressure(CallerType aCallerType) {
|
|
297 | + if (mEvent->mMessage == ePointerUp ||
|
|
298 | + !ShouldResistFingerprinting(aCallerType)) {
|
|
260 | 299 | return mEvent->AsPointerEvent()->mPressure;
|
261 | 300 | }
|
262 | 301 | |
... | ... | @@ -273,14 +312,14 @@ float PointerEvent::Pressure() { |
273 | 312 | return spoofedPressure;
|
274 | 313 | }
|
275 | 314 | |
276 | -float PointerEvent::TangentialPressure() {
|
|
277 | - return ShouldResistFingerprinting()
|
|
315 | +float PointerEvent::TangentialPressure(CallerType aCallerType) {
|
|
316 | + return ShouldResistFingerprinting(aCallerType)
|
|
278 | 317 | ? 0
|
279 | 318 | : mEvent->AsPointerEvent()->tangentialPressure;
|
280 | 319 | }
|
281 | 320 | |
282 | -int32_t PointerEvent::TiltX() {
|
|
283 | - if (ShouldResistFingerprinting()) {
|
|
321 | +int32_t PointerEvent::TiltX(CallerType aCallerType) {
|
|
322 | + if (ShouldResistFingerprinting(aCallerType)) {
|
|
284 | 323 | return 0;
|
285 | 324 | }
|
286 | 325 | if (mTiltX.isSome()) {
|
... | ... | @@ -291,8 +330,8 @@ int32_t PointerEvent::TiltX() { |
291 | 330 | return *mTiltX;
|
292 | 331 | }
|
293 | 332 | |
294 | -int32_t PointerEvent::TiltY() {
|
|
295 | - if (ShouldResistFingerprinting()) {
|
|
333 | +int32_t PointerEvent::TiltY(CallerType aCallerType) {
|
|
334 | + if (ShouldResistFingerprinting(aCallerType)) {
|
|
296 | 335 | return 0;
|
297 | 336 | }
|
298 | 337 | if (mTiltY.isSome()) {
|
... | ... | @@ -303,12 +342,14 @@ int32_t PointerEvent::TiltY() { |
303 | 342 | return *mTiltY;
|
304 | 343 | }
|
305 | 344 | |
306 | -int32_t PointerEvent::Twist() {
|
|
307 | - return ShouldResistFingerprinting() ? 0 : mEvent->AsPointerEvent()->twist;
|
|
345 | +int32_t PointerEvent::Twist(CallerType aCallerType) {
|
|
346 | + return ShouldResistFingerprinting(aCallerType)
|
|
347 | + ? 0
|
|
348 | + : mEvent->AsPointerEvent()->twist;
|
|
308 | 349 | }
|
309 | 350 | |
310 | -double PointerEvent::AltitudeAngle() {
|
|
311 | - if (ShouldResistFingerprinting()) {
|
|
351 | +double PointerEvent::AltitudeAngle(CallerType aCallerType) {
|
|
352 | + if (ShouldResistFingerprinting(aCallerType)) {
|
|
312 | 353 | return WidgetPointerHelper::GetDefaultAltitudeAngle();
|
313 | 354 | }
|
314 | 355 | if (mAltitudeAngle.isSome()) {
|
... | ... | @@ -319,8 +360,8 @@ double PointerEvent::AltitudeAngle() { |
319 | 360 | return *mAltitudeAngle;
|
320 | 361 | }
|
321 | 362 | |
322 | -double PointerEvent::AzimuthAngle() {
|
|
323 | - if (ShouldResistFingerprinting()) {
|
|
363 | +double PointerEvent::AzimuthAngle(CallerType aCallerType) {
|
|
364 | + if (ShouldResistFingerprinting(aCallerType)) {
|
|
324 | 365 | return WidgetPointerHelper::GetDefaultAzimuthAngle();
|
325 | 366 | }
|
326 | 367 | if (mAzimuthAngle.isSome()) {
|
... | ... | @@ -421,22 +462,22 @@ void PointerEvent::GetPredictedEvents( |
421 | 462 | aPointerEvents.AppendElements(mPredictedEvents);
|
422 | 463 | }
|
423 | 464 | |
424 | -bool PointerEvent::ShouldResistFingerprinting(bool aForPointerId) const {
|
|
425 | - // There are three simple situations we don't need to spoof this pointer
|
|
465 | +bool PointerEvent::ShouldResistFingerprinting(CallerType aCallerType) const {
|
|
466 | + // There are a few simple situations we don't need to spoof this pointer
|
|
426 | 467 | // event.
|
427 | - // 1. The pref privcy.resistFingerprinting' is false, we fast return here
|
|
428 | - // since we don't need to do any QI of following codes.
|
|
429 | - // 2. This event is generated by scripts.
|
|
430 | - // 3. This event is a mouse pointer event.
|
|
468 | + // * We are being called by a System caller
|
|
469 | + // * The pref privcy.resistFingerprinting' is false, we fast return here
|
|
470 | + // since we don't need to do any QI of following codes.
|
|
471 | + // * This event is generated by scripts.
|
|
472 | + // * This event is a mouse pointer event.
|
|
431 | 473 | // We don't need to check for the system group since pointer events won't be
|
432 | 474 | // dispatched to the system group.
|
433 | - RFPTarget target =
|
|
434 | - aForPointerId ? RFPTarget::PointerId : RFPTarget::PointerEvents;
|
|
435 | - if (!nsContentUtils::ShouldResistFingerprinting("Efficiency Check", target) ||
|
|
475 | + RFPTarget target = RFPTarget::PointerEvents;
|
|
476 | + if (aCallerType == CallerType::System ||
|
|
477 | + !nsContentUtils::ShouldResistFingerprinting("Efficiency Check", target) ||
|
|
436 | 478 | !mEvent->IsTrusted() ||
|
437 | - (mEvent->AsPointerEvent()->mInputSource ==
|
|
438 | - MouseEvent_Binding::MOZ_SOURCE_MOUSE &&
|
|
439 | - SPOOFED_MAX_TOUCH_POINTS == 0)) {
|
|
479 | + mEvent->AsPointerEvent()->mInputSource ==
|
|
480 | + MouseEvent_Binding::MOZ_SOURCE_MOUSE) {
|
|
440 | 481 | return false;
|
441 | 482 | }
|
442 | 483 |
... | ... | @@ -41,17 +41,19 @@ class PointerEvent : public MouseEvent { |
41 | 41 | PointerEvent* AsPointerEvent() final { return this; }
|
42 | 42 | |
43 | 43 | int32_t PointerId();
|
44 | - double Width() const;
|
|
45 | - double Height() const;
|
|
46 | - float Pressure();
|
|
47 | - float TangentialPressure();
|
|
48 | - int32_t TiltX();
|
|
49 | - int32_t TiltY();
|
|
50 | - int32_t Twist();
|
|
51 | - double AltitudeAngle();
|
|
52 | - double AzimuthAngle();
|
|
44 | + double Width(CallerType aCallerType = CallerType::System) const;
|
|
45 | + double Height(CallerType aCallerType = CallerType::System) const;
|
|
46 | + float Pressure(CallerType aCallerType = CallerType::System);
|
|
47 | + float TangentialPressure(CallerType aCallerType = CallerType::System);
|
|
48 | + int32_t TiltX(CallerType aCallerType = CallerType::System);
|
|
49 | + int32_t TiltY(CallerType aCallerType = CallerType::System);
|
|
50 | + int32_t Twist(CallerType aCallerType = CallerType::System);
|
|
51 | + double AltitudeAngle(CallerType aCallerType = CallerType::System);
|
|
52 | + double AzimuthAngle(CallerType aCallerType = CallerType::System);
|
|
53 | 53 | bool IsPrimary();
|
54 | - void GetPointerType(nsAString& aPointerType);
|
|
54 | + void GetPointerType(
|
|
55 | + nsAString& aPointerType,
|
|
56 | + mozilla::dom::CallerType aCallerType = CallerType::System);
|
|
55 | 57 | static bool EnableGetCoalescedEvents(JSContext* aCx, JSObject* aGlobal);
|
56 | 58 | void GetCoalescedEvents(nsTArray<RefPtr<PointerEvent>>& aPointerEvents);
|
57 | 59 | void GetPredictedEvents(nsTArray<RefPtr<PointerEvent>>& aPointerEvents);
|
... | ... | @@ -62,7 +64,11 @@ class PointerEvent : public MouseEvent { |
62 | 64 | private:
|
63 | 65 | // This method returns the boolean to indicate whether spoofing pointer
|
64 | 66 | // event for fingerprinting resistance.
|
65 | - bool ShouldResistFingerprinting(bool aForPointerId = false) const;
|
|
67 | + bool ShouldResistFingerprinting(
|
|
68 | + CallerType aCallerType = CallerType::System) const;
|
|
69 | + |
|
70 | + uint16_t ResistantInputSource(
|
|
71 | + CallerType aCallerType = CallerType::System) const;
|
|
66 | 72 | |
67 | 73 | // When the instance is a trusted `pointermove` event but the widget event
|
68 | 74 | // does not have proper coalesced events (typically, the event is synthesized
|
... | ... | @@ -421,32 +421,6 @@ void PointerEventHandler::CheckPointerCaptureState(WidgetPointerEvent* aEvent) { |
421 | 421 | |
422 | 422 | PointerCaptureInfo* captureInfo = GetPointerCaptureInfo(aEvent->pointerId);
|
423 | 423 | |
424 | - // When fingerprinting resistance is enabled, we need to map other pointer
|
|
425 | - // ids into the spoofed one. We don't have to do the mapping if the capture
|
|
426 | - // info exists for the non-spoofed pointer id because of we won't allow
|
|
427 | - // content to set pointer capture other than the spoofed one. Thus, it must be
|
|
428 | - // from chrome if the capture info exists in this case. And we don't have to
|
|
429 | - // do anything if the pointer id is the same as the spoofed one.
|
|
430 | - if (nsContentUtils::ShouldResistFingerprinting("Efficiency Check",
|
|
431 | - RFPTarget::PointerId) &&
|
|
432 | - aEvent->pointerId != (uint32_t)GetSpoofedPointerIdForRFP() &&
|
|
433 | - !captureInfo) {
|
|
434 | - PointerCaptureInfo* spoofedCaptureInfo =
|
|
435 | - GetPointerCaptureInfo(GetSpoofedPointerIdForRFP());
|
|
436 | - |
|
437 | - // We need to check the target element's document should resist
|
|
438 | - // fingerprinting. If not, we don't need to send a capture event
|
|
439 | - // since the capture info of the original pointer id doesn't exist
|
|
440 | - // in this case.
|
|
441 | - if (!spoofedCaptureInfo || !spoofedCaptureInfo->mPendingElement ||
|
|
442 | - !spoofedCaptureInfo->mPendingElement->OwnerDoc()
|
|
443 | - ->ShouldResistFingerprinting(RFPTarget::PointerEvents)) {
|
|
444 | - return;
|
|
445 | - }
|
|
446 | - |
|
447 | - captureInfo = spoofedCaptureInfo;
|
|
448 | - }
|
|
449 | - |
|
450 | 424 | if (!captureInfo ||
|
451 | 425 | captureInfo->mPendingElement == captureInfo->mOverrideElement) {
|
452 | 426 | return;
|
... | ... | @@ -225,38 +225,40 @@ bool TouchEvent::PrefEnabled(nsIDocShell* aDocShell) { |
225 | 225 | } else if (touchEventsOverride ==
|
226 | 226 | mozilla::dom::TouchEventsOverride::Disabled) {
|
227 | 227 | enabled = false;
|
228 | + } else if (nsContentUtils::ShouldResistFingerprinting(
|
|
229 | + aDocShell, RFPTarget::PointerEvents)) {
|
|
230 | +#ifdef MOZ_WIDGET_COCOA
|
|
231 | + enabled = false;
|
|
232 | +#else
|
|
233 | + enabled = true;
|
|
234 | +#endif
|
|
228 | 235 | } else {
|
229 | 236 | const int32_t prefValue = StaticPrefs::dom_w3c_touch_events_enabled();
|
230 | 237 | if (prefValue == 2) {
|
231 | - if (nsContentUtils::ShouldResistFingerprinting(
|
|
232 | - aDocShell, RFPTarget::PointerEvents)) {
|
|
233 | - enabled = SPOOFED_MAX_TOUCH_POINTS != 0;
|
|
234 | - } else {
|
|
235 | - enabled = PlatformSupportsTouch();
|
|
236 | - |
|
237 | - static bool firstTime = true;
|
|
238 | - // The touch screen data seems to be inaccurate in the parent process,
|
|
239 | - // and we really need the crash annotation in child processes.
|
|
240 | - if (firstTime && !XRE_IsParentProcess()) {
|
|
241 | - CrashReporter::RecordAnnotationBool(
|
|
242 | - CrashReporter::Annotation::HasDeviceTouchScreen, enabled);
|
|
243 | - firstTime = false;
|
|
244 | - }
|
|
238 | + enabled = PlatformSupportsTouch();
|
|
239 | + |
|
240 | + static bool firstTime = true;
|
|
241 | + // The touch screen data seems to be inaccurate in the parent process,
|
|
242 | + // and we really need the crash annotation in child processes.
|
|
243 | + if (firstTime && !XRE_IsParentProcess()) {
|
|
244 | + CrashReporter::RecordAnnotationBool(
|
|
245 | + CrashReporter::Annotation::HasDeviceTouchScreen, enabled);
|
|
246 | + firstTime = false;
|
|
247 | + }
|
|
245 | 248 | |
246 | 249 | #if defined(XP_WIN) || defined(MOZ_WIDGET_GTK)
|
247 | - if (enabled && aDocShell) {
|
|
248 | - // APZ might be disabled on this particular widget, in which case
|
|
249 | - // TouchEvent support will also be disabled. Try to detect that.
|
|
250 | - RefPtr<nsPresContext> pc = aDocShell->GetPresContext();
|
|
251 | - if (pc) {
|
|
252 | - nsCOMPtr<nsIWidget> widget = pc->GetRootWidget();
|
|
253 | - if (widget) {
|
|
254 | - enabled &= widget->AsyncPanZoomEnabled();
|
|
255 | - }
|
|
250 | + if (enabled && aDocShell) {
|
|
251 | + // APZ might be disabled on this particular widget, in which case
|
|
252 | + // TouchEvent support will also be disabled. Try to detect that.
|
|
253 | + RefPtr<nsPresContext> pc = aDocShell->GetPresContext();
|
|
254 | + if (pc) {
|
|
255 | + nsCOMPtr<nsIWidget> widget = pc->GetRootWidget();
|
|
256 | + if (widget) {
|
|
257 | + enabled &= widget->AsyncPanZoomEnabled();
|
|
256 | 258 | }
|
257 | 259 | }
|
258 | -#endif
|
|
259 | 260 | }
|
261 | +#endif
|
|
260 | 262 | } else {
|
261 | 263 | enabled = !!prefValue;
|
262 | 264 | }
|
... | ... | @@ -14,16 +14,26 @@ interface PointerEvent : MouseEvent |
14 | 14 | |
15 | 15 | readonly attribute long pointerId;
|
16 | 16 | |
17 | + [NeedsCallerType]
|
|
17 | 18 | readonly attribute double width;
|
19 | + [NeedsCallerType]
|
|
18 | 20 | readonly attribute double height;
|
21 | + [NeedsCallerType]
|
|
19 | 22 | readonly attribute float pressure;
|
23 | + [NeedsCallerType]
|
|
20 | 24 | readonly attribute float tangentialPressure;
|
25 | + [NeedsCallerType]
|
|
21 | 26 | readonly attribute long tiltX;
|
27 | + [NeedsCallerType]
|
|
22 | 28 | readonly attribute long tiltY;
|
29 | + [NeedsCallerType]
|
|
23 | 30 | readonly attribute long twist;
|
31 | + [NeedsCallerType]
|
|
24 | 32 | readonly attribute double altitudeAngle;
|
33 | + [NeedsCallerType]
|
|
25 | 34 | readonly attribute double azimuthAngle;
|
26 | 35 | |
36 | + [NeedsCallerType]
|
|
27 | 37 | readonly attribute DOMString pointerType;
|
28 | 38 | readonly attribute boolean isPrimary;
|
29 | 39 |
... | ... | @@ -16,6 +16,7 @@ |
16 | 16 | #include "mozilla/ToString.h"
|
17 | 17 | #include "mozilla/ViewportUtils.h"
|
18 | 18 | #include "mozilla/dom/MouseEventBinding.h"
|
19 | +#include "mozilla/dom/TouchEvent.h"
|
|
19 | 20 | #include "mozilla/gfx/Matrix.h"
|
20 | 21 | #include "mozilla/layers/LayersTypes.h"
|
21 | 22 | #include "nsContainerFrame.h"
|
... | ... | @@ -173,9 +174,7 @@ static bool HasTouchListener(const nsIContent* aContent) { |
173 | 174 | return false;
|
174 | 175 | }
|
175 | 176 | |
176 | - // FIXME: Should this really use the pref rather than TouchEvent::PrefEnabled
|
|
177 | - // or such?
|
|
178 | - if (!StaticPrefs::dom_w3c_touch_events_enabled()) {
|
|
177 | + if (!TouchEvent::PrefEnabled(aContent->OwnerDoc()->GetDocShell())) {
|
|
179 | 178 | return false;
|
180 | 179 | }
|
181 | 180 |
... | ... | @@ -34,7 +34,7 @@ ITEM_VALUE(NavigatorHWConcurrency, 16) |
34 | 34 | ITEM_VALUE(NavigatorOscpu, 17)
|
35 | 35 | ITEM_VALUE(NavigatorPlatform, 18)
|
36 | 36 | ITEM_VALUE(NavigatorUserAgent, 19)
|
37 | -ITEM_VALUE(PointerId, 20)
|
|
37 | +// We no longer use PointerId, it can renamed and reused
|
|
38 | 38 | ITEM_VALUE(StreamVideoFacingMode, 21)
|
39 | 39 | ITEM_VALUE(JSDateTimeUTC, 22)
|
40 | 40 | ITEM_VALUE(JSMathFdlibm, 23)
|
... | ... | @@ -104,6 +104,7 @@ ITEM_VALUE(DiskStorageLimit, 70) |
104 | 104 | ITEM_VALUE(WebCodecs, 71)
|
105 | 105 | ITEM_VALUE(NavigatorHWConcurrencyTiered,74)
|
106 | 106 | |
107 | +// !!! Adding a new target? Rename PointerId and repurpose it.
|
|
107 | 108 | |
108 | 109 | // !!! Don't forget to update kDefaultFingerprintingProtections in nsRFPService.cpp
|
109 | 110 | // if necessary.
|
... | ... | @@ -303,13 +303,6 @@ Maybe<bool> nsRFPService::HandleExeptionalRFPTargets( |
303 | 303 | StaticPrefs::privacy_spoof_english_DoNotUseDirectly() == 2);
|
304 | 304 | }
|
305 | 305 | |
306 | - // We don't spoof the pointerId on multi-touch devices.
|
|
307 | -#if SPOOFED_MAX_TOUCH_POINTS > 0
|
|
308 | - if (aTarget == RFPTarget::PointerId) {
|
|
309 | - return Some(false);
|
|
310 | - }
|
|
311 | -#endif
|
|
312 | - |
|
313 | 306 | return Nothing();
|
314 | 307 | }
|
315 | 308 |
... | ... | @@ -589,23 +589,6 @@ bool WidgetEvent::IsBlockedForFingerprintingResistance() const { |
589 | 589 | keyboardEvent->mKeyNameIndex == KEY_NAME_INDEX_Control ||
|
590 | 590 | keyboardEvent->mKeyNameIndex == KEY_NAME_INDEX_AltGraph);
|
591 | 591 | }
|
592 | - case ePointerEventClass: {
|
|
593 | - if (IsPointerEventMessageOriginallyMouseEventMessage(mMessage)) {
|
|
594 | - return false;
|
|
595 | - }
|
|
596 | - |
|
597 | - if (SPOOFED_MAX_TOUCH_POINTS > 0) {
|
|
598 | - return false;
|
|
599 | - }
|
|
600 | - |
|
601 | - const WidgetPointerEvent* pointerEvent = AsPointerEvent();
|
|
602 | - |
|
603 | - // We suppress the pointer events if it is not primary for fingerprinting
|
|
604 | - // resistance. It is because of that we want to spoof any pointer event
|
|
605 | - // into a mouse pointer event and the mouse pointer event only has
|
|
606 | - // isPrimary as true.
|
|
607 | - return !pointerEvent->mIsPrimary;
|
|
608 | - }
|
|
609 | 592 | default:
|
610 | 593 | return false;
|
611 | 594 | }
|