Closed marcoscaceres closed 3 years ago
Maybe I'm missing the issue this change is attempting to fix but what happens after the following sequence of events,
As written it seems like when a significant change in position occurs while the document is not fully active it will cause the watch to be canceled. Is this intentional? More likely it seems like we want to explicitly cancel all pending requests on transition to being not fully active. We definitely don't want to deliver a position update while not fully active but we may want to preserve active watches and check on transition back to fully active whether a significant change in position has occurred.
Yeah, I agree. We might need some kind of independent watcher that checks before the callbacks happen.
@rakina @reillyeon, I've reworked this a bit so now:
I'll put together some tests for what I can.
I think it might not be possible to test this with WPT. The limitation that we have is that I can't spin up a tab, then switch back to the original test's tab, which would cause the background tab to be "hidden".
Similarly, with an iframe: removing the iframe makes it "hidden", but it simultaneously trashes the iframe's window
object, hence you can't call geolocation on it (unless you steal a reference to geolocation before it is GC'ed, but at that point you are dealing with dead objects).
Similarly, with an iframe: removing the iframe makes it "hidden", but it simultaneously trashes the iframe's window object, hence you can't call geolocation on it (unless you steal a reference to geolocation before it is GC'ed, but at that point you are dealing with dead objects).
Is this still true for the window on a nested iframe too? (so you detach the parent iframe but watch on the nested iframe). Also what about testing the "watch position -> detach, update position -> attach again, see no location update is sent"?
If that's not possible, I guess the only way to test this is through BFCache. Currently @hiroshige-g is setting up the foundations for BFCache WPTs at https://github.com/web-platform-tests/wpt/pull/28950. I think he's planning to write a Geolocation WPT eventually, but if you want to try writing one now you're more than welcome to! (also it's great to have a feedback on the WPT foundations from a non-BFCache person :) )
Is this still true for the window on a nested iframe too? (so you detach the parent iframe but watch on the nested iframe). Also what about testing the "watch position -> detach, update position -> attach again, see no location update is sent"?
I holds true there too. Once the iframe
is removed, the whole document
and the window
object is GC'd. Reattaching it creates a both a new Window
and a new Document
(i.e., so position updates are not sent).
Currently @hiroshige-g is setting up the foundations for BFCache WPTs at web-platform-tests/wpt#28950. I think he's planning to write a Geolocation WPT eventually, but if you want to try writing one now you're more than welcome to! (also it's great to have a feedback on the WPT foundations from a non-BFCache person :) )
@hiroshige-g I've be happy to help review those, as it would be an opportunity for me to learn about BFCache.
I'm going to go ahead and merge this, as at least it gets all the browsers aligned on behavior and it's a great privacy improvement.
Closes #78
The following tasks have been completed:
Modified Web platform tests- unfortunately, we don't have the capability to test this with WPT.Implementation commitment:
cc @rakina
Preview | Diff