Loading
Bug 1746459 - Wait for Firefox Suggest scenario initialization before trying...
Bug 1746459 - Wait for Firefox Suggest scenario initialization before trying to show the online opt-in dialog. r=daisuke The problem is a race between scenario initialization and `maybeShowOnboardingDialog()` on startup. If `maybeShowOnboardingDialog()` is called before scenario initialization finishes, then the `quickSuggestShouldShowOnboardingDialog` Nimbus variable will retain its false default value, and the dialog will not be shown like it should be. Scenario initialization depends on the Nimbus urlbar feature initialization, which depends on loading the feature JSON from disk, so it's plausible this race is more likely to happen on slow machines, as we've seen with QA's slow Ubuntu machines in other bugs. This revision fixes it by making a promise that's resolved when scenario initialization finishes, and then `maybeShowOnboardingDialog()` awaits the promise before starting. I thought about adding an idle callback for `maybeShowOnboardingDialog()` directly in `UrlbarPrefs.updateFirefoxSuggestScenario()`. However, that would change the timing of the dialog more than I'm comfortable with, since right now scenario initializaton happens before BrowserGlue adds its idle callback for `maybeShowOnboardingDialog()`. We can maybe revisit startup and initialization at some point to make this a little nicer. Differential Revision: https://phabricator.services.mozilla.com/D134553