Skip to content
Snippets Groups Projects
Commit 760db0c8 authored by Luca Greco's avatar Luca Greco
Browse files

Bug 1775898 - Fix browser_doorhanger_install.js intermittent failures. r=mixedpuppy a=test-only

The failures triggered after the changes introduced in this test from Bug 1784292 and tracked by orangefactor
are all triggered from the test case named `test_blockedInstallDomain_with_unified_extensions`:

- in that test case we are using a new chrome window (because the test case covers the behaviors expected when
  the unified extension button have been enabled by flipping the related pref) and the new chrome
  window is closed shortly after calling BrowserTestUtils.openNewForegroundTab.

- By opening and quickly closing a new chrome window, of all the tests in that test file,
  `test_blockedInstallDomain_with_unified_extensions` is the only one that have a pretty
  good chance to trigger this kind of failure.

- the failure is triggered when the chrome window has been already closed by the time all the promises that
  BrowserTestUtils.openNewForegroundTab is internally waiting on (see the lines linked below) are settled,
  and that triggers the failure due to an uncaught rejection triggered as a side-effect of trying to access
  tabbrowser.ownerGlobal.windowGlobalChild for a chrome window that is already gone:
  - https://searchfox.org/mozilla-central/rev/380fc5571b039fd453b45bbb64ed13146fe9b066/testing/mochitest/BrowserTestUtils/BrowserTestUtils.jsm#278-279

The attached patch just adds an await on the call to BrowserTestUtils.openNewForegroundTab, which prevents
the intermittent failure from being triggered.

As a side note (either as an alternative approach to the one currently in this patch or indipendently from
fixing this specific intermittent):

it seems worth confirming if we could be changing BrowserTestUtils.openNewForegroundTab to expect
the possibility that the chrome window have been closed and just omit the innerWindowId in the
profile marker if collected too late to be able to retrieve the innerWindowId.

Differential Revision: https://phabricator.services.mozilla.com/D155876
parent 51120df2
No related branches found
No related tags found
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment