Skip to content

Investigate improvement to JavaScript alert dequeueing #24088

@data-sync-user

Description

@data-sync-user

As discussed in https://github.com/mozilla-mobile/firefox-ios/pull/23757#discussion_r1904514229 and https://docs.google.com/document/d/1g4xn4CSDBqS5zfb7PdDIJES6iO8pQ_uKscTCxx_tvDE/edit?tab=t.0

✅ Ticket Action Items

Remove JS alert dequeue called from BVC viewDidLayoutSubviews and move it elsewhere

  1. This UI func is not a good place to be performing an alert dequeue
  2. It was added there as a way to dequeue the alert. It’s a way to smash that dequeue alert function until one of them is called at the right time and place, since we don’t have a reliable way to detect when BVC is shown if we, for example, select a tab from the tab tray and an alert should be shown.
  3. We cannot rely at the moment on viewDidAppear and viewWillAppear methods in BVC to know when the BVC is shown to the user. Example is when the tab tray is shown on iPhone, those lifecycle methods are not called since the tab tray is not shown full screen.
  4. tabManager(:didSelectedTabChange) is too early and we cannot show the alert since the tab tray is still on screen when the alert is attempted to be shown, which result in this error: Attempt to present <Client.NewJSPromptAlertController: 0x12c808e00> on <Client.RootNavigationController: 0x10e809c00> (from <Client.BrowserViewController: 0x10d82ce00>) which is already presenting <Client.DismissableNavigationViewController: 0x10d940800>

┆Issue is synchronized with this Jira Task

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions