Closed Bug 1715482 Opened 4 years ago Closed 4 years ago

Geolocation should gracefully handle Documents that are not fully active

Categories

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

defect

Tracking

()

RESOLVED FIXED
92 Branch
Tracking Status
firefox92 --- fixed

People

(Reporter: marcos, Assigned: marcos)

References

Details

Attachments

(1 file)

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.1.1 Safari/605.1.15

Steps to reproduce:

When a document becomes no longer fully active (i.e., iframe is removed), a reference to Geolocation API shouldn't throw when its methods are called.

See http://marcoscaceres.github.io/playground/geo_test.html
And spec bug: https://github.com/w3c/geolocation-api/issues/78

Actual results:

It throws an ERROR_UNEXPECTED exception.

Expected results:

Should gracefully return -1 and shut down the geolocation service for document.

The Bugbug bot thinks this bug should belong to the 'Core::DOM: Core & HTML' component, and is moving the bug to that component. Please revert this change in case you think the bot is wrong.

Component: Untriaged → DOM: Core & HTML
Product: Firefox → Core
Status: UNCONFIRMED → NEW
Component: DOM: Core & HTML → DOM: Geolocation
Ever confirmed: true

Kagami, would you be comfortable reviewing this?

Flags: needinfo?(krosylight)

I'm not super confident about the "shutting down the geolocation service" part... It's a bit of an edge case: but I can imagine someone removes an iframe - stuff happens + user moves around - and then re-attaches the iframe again.

Maybe safer if I don't call Shutdown()? 🤔

Once you remove an iframe its associated browsing context is destroyed. If you append it again a new one is created. I don't know what the service is associated with though. I would kinda expect that to be a global service the API calls into, but I'm not familiar with the details.

The example never throws anything so I'm not sure I see the issue? It only shows green messages here.

Flags: needinfo?(krosylight)

(In reply to Kagami :saschanaz from comment #6)

The example never throws anything so I'm not sure I see the issue? It only shows green messages here.

The example is just testing what happens. It should gracefully return -1 and never throws.

(In reply to Anne (:annevk) from comment #5)

Once you remove an iframe its associated browsing context is destroyed. If you append it again a new one is created. I don't know what the service is associated with though. I would kinda expect that to be a global service the API calls into, but I'm not familiar with the details.

So, Safari (iOS) stops the geo service, even if you re-attach and call from the fresh context.

Chrome on Android resumes the service after one re-attaches the iframe.

If we are creating a new context on re-attachment, Chrome's behavior might be more correct.

(In reply to marcos from comment #7)

(In reply to Kagami :saschanaz from comment #6)

The example never throws anything so I'm not sure I see the issue? It only shows green messages here.

The example is just testing what happens. It should gracefully return -1 and never throws.

Okay then, could you provide a test that Firefox fails? 👀

What I see from the current example is:

loading iframe
0
1
2
watchPosition, 3
getCurrentPosition,
reattach
done
Hello from re-attached frame
[object GeolocationPosition]

Yes, will do! Sorry, I thought I'd attached one to the patch! 😅

Severity: -- → S3
Priority: -- → P3
Assignee: nobody → marcos
Status: NEW → ASSIGNED
Pushed by krosylight@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/aa23b80472a7 Geolocation should gracefully handle Documents that are not fully active r=saschanaz
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → 92 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: