Closed Bug 1962205 Opened 8 months ago Closed 8 months ago

Overriding geolocation via webdriver lets two services active in parallel

Categories

(Core :: DOM: Geolocation, defect, P3)

defect
Points:
3

Tracking

()

RESOLVED FIXED
140 Branch
Tracking Status
firefox139 --- fixed
firefox140 --- fixed

People

(Reporter: saschanaz, Assigned: Sasha)

References

Details

(Whiteboard: [webdriver:m16])

Attachments

(2 files)

(Context: https://bugzilla.mozilla.org/show_bug.cgi?id=1960651#c7)

I think we have a hidden webdriver-related bug we missed in bug 1951962.

The core problem is that we get two active backing services here: https://searchfox.org/mozilla-central/rev/8867630d67bfe76f6065df08d60381d45d73c439/dom/geolocation/Geolocation.cpp#1086-1092

  if (mService) {
    mService->AddLocator(this);
  }

  if (mServiceOverride) {
    mServiceOverride->AddLocator(this);
  }

Both are free to ping the locator, meaning even if watchPosition() is called after SetGeolocationServiceOverride(), a few seconds later the update from the "real" service will ping the locator again, resulting mishmash of signals from different services.

This has been hidden because of the timer, and removing the timer made it more apparent.

Sasha, care to take another look?

Flags: needinfo?(aborovova)
See Also: → 1951962

Yes, so I had a problem which this test illustrates: https://searchfox.org/mozilla-central/source/dom/geolocation/test/browser/browser_geolocation_override.js#245-358, that if we would add an override, reload the tab and then reset the override, a new service wouldn't have a locator. So the solution I came up with was to always have an original service as well, but as you said, it doesn't work with your patch. I found a different approach now: to move locators when we reset an override service. It seems to be working with your patch as well (all the tests pass).

Flags: needinfo?(aborovova)
Assignee: nobody → aborovova
Status: NEW → ASSIGNED

(Not only it doesn't work with my patch, the webdriver users would also get confusing geolocation signals that they did not make)

Severity: -- → S3
Priority: -- → P3
Blocks: 1959516
Pushed by aborovova@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/0c0be287c3ba Move locators insted of running two geolocation services at a time. r=saschanaz
Points: --- → 3
Whiteboard: [webdriver:m16]
Status: ASSIGNED → RESOLVED
Closed: 8 months ago
Resolution: --- → FIXED
Target Milestone: --- → 140 Branch
Regressions: 1964063
Attachment #9485292 - Flags: approval-mozilla-beta?

firefox-beta Uplift Approval Request

  • User impact if declined: The geolocation API might sent the original coordinates togerher with the override
  • Code covered by automated testing: yes
  • Fix verified in Nightly: yes
  • Needs manual QE test: no
  • Steps to reproduce for manual QE testing: None
  • Risk associated with taking this patch: Low
  • Explanation of risk level: It only affects test automation scenario
  • String changes made/needed: None
  • Is Android affected?: yes
Attachment #9485292 - Flags: approval-mozilla-beta? → approval-mozilla-beta+
Flags: in-testsuite+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: