Closed Bug 1249318 Opened 8 years ago Closed 3 years ago

Homescreen shortcut opens new tab whether Firefox is/isn't currently running

Categories

(Firefox for Android Graveyard :: Web Apps (PWAs), defect, P5)

defect

Tracking

(firefox47 affected, firefox62 affected, firefox63 affected, firefox64 affected, firefox65 affected, firefox66 affected)

RESOLVED INCOMPLETE
Tracking Status
firefox47 --- affected
firefox62 --- affected
firefox63 --- affected
firefox64 --- affected
firefox65 --- affected
firefox66 --- affected

People

(Reporter: ahunt, Unassigned)

References

Details

Bug 1245516 was a regression causing homescreen shortcuts to always open in a new tab.

We still open a new tab if Firefox isn't running when selecting the homescreen shortcut, instead we should try and reuse existing tabs all the time. I suspect this has something to do with appOrigin not being stored when Firefox is killed.

Fixing this will probably require figuring out what we're actually doing with appOrigin, and where it is set / stored, all in browser.js:
http://mxr.mozilla.org/mozilla-central/source/mobile/android/chrome/content/browser.js

We also need tests for this to ensure we don't regress again, I'm not sure how easy this will be to implement?
Assignee: nobody → ahunt
Depends on: 1245516
Priority: -- → P3
This doesn't seem like a simple fix, and I'm worried about possible regressions when playing with session restore. Unassigning for now.
Assignee: ahunt → nobody
Priority: P3 → --
In theory this ought to work even now, because from the Java side
1. first we're opening all previous tabs from the session store file [1]
2. then we send the fixed up session stored data to Gecko for further processing [2]
3. when restoring has finished, we open any other tabs that might need opening, such as if we've been launched from a homescreen shortcut [3][4]
4. However on the Gecko side somehow 3.) manages to overtake 2.), because when we open the additional tab to handle the shortcut intent and check whether any existing tab has a matching appOrigin [5], the session store data transmitted to Gecko in 2.) isn't yet available.

Presumably this is somehow related to the fact that some of these message are dispatched to Gecko via the WindowEventDispatcher while others use the AppEventDispatcher, although I haven't looked more closely at this yet.

[1] https://dxr.mozilla.org/mozilla-central/source/mobile/android/base/java/org/mozilla/gecko/GeckoApp.java#1264
[2] https://dxr.mozilla.org/mozilla-central/source/mobile/android/base/java/org/mozilla/gecko/GeckoApp.java#1313
[3] https://dxr.mozilla.org/mozilla-central/source/mobile/android/base/java/org/mozilla/gecko/GeckoApp.java#1596
[4] To absolutely enforce this, the act of releasing the session restore countdown latch and the sending of the restore message to Gecko in [2] need to be swapped around to make sure that 3.) really happens after 2.), but in practice this is usually the case anyway unless the session store file is particularly large
[5] https://dxr.mozilla.org/mozilla-central/rev/a97fb1c39d51a7337b46957bde4273bd308b796a/mobile/android/chrome/content/browser.js#3399
Re-triaging per https://bugzilla.mozilla.org/show_bug.cgi?id=1473195

Needinfo :susheel if you think this bug should be re-triaged.
Priority: -- → P5
Hi,

I was able to reproduce the issue.

Tested with:
Browser / Version: Firefox Mobile Nightly 64.0a1 (2018-09-18)
Operating System: Huawei MediaPad M2 (Android 5.1.1)

Thank you!
Environment:
Device: Samsung Galaxy Note 8 (Android 8)
Build: Nightly 65.0a1 (2018-10-30)

I reproduced the issue even when Firefox is currently running, so I will edit the Summary.

Thanks!
Summary: homescreen shortcut opens new tab if Firefox isn't currently running → Homescreen shortcut opens new tab whether Firefox is/isn't currently running
We have completed our launch of our new Firefox on Android. The development of the new versions use GitHub for issue tracking. If the bug report still reproduces in a current version of [Firefox on Android nightly](https://play.google.com/store/apps/details?id=org.mozilla.fenix) an issue can be reported at the [Fenix GitHub project](https://github.com/mozilla-mobile/fenix/). If you want to discuss your report please use [Mozilla's chat](https://wiki.mozilla.org/Matrix#Connect_to_Matrix) server https://chat.mozilla.org and join the [#fenix](https://chat.mozilla.org/#/room/#fenix:mozilla.org) channel.
Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → INCOMPLETE
Product: Firefox for Android → Firefox for Android Graveyard
You need to log in before you can comment on or make changes to this bug.