Closed Bug 2085960 Opened 1 month ago Closed 1 month ago

Always wait for load in InfoBar._showWhenLoaded and test it with loading windows

Categories

(Firefox :: Messaging System, task)

task

Tracking

()

RESOLVED DUPLICATE of bug 2083975

People

(Reporter: mkaply, Unassigned)

References

Details

InfoBar._showWhenLoaded shows the infobar right away when the window's readyState is complete, and otherwise waits for load. Neither caller reaches the immediate branch with a window that is actually ready:

  • showNotificationAllWindows only calls it when readyState is not complete.
  • observe calls it at domwindowopened, before the browser document has loaded.

Only tests reach that branch with a loaded window. In browser_asrouter_universal_infobar.js:

  • observe_domwindowopened passes the already-loaded top window to observe().
  • universalInfobar_persists_original_window_closure passes a fake window whose readyState is complete.

These tests exercise a state that never happens with real windows, which is how bug 2083975 got past them.

Proposed:

  • Drop the immediate branch so _showWhenLoaded always waits for load.
  • Rewrite the two tests to use a loading window, as observe_domwindowopened_withLoadEvent does, or a real window from BrowserTestUtils.openNewBrowserWindow.

I'm going to dupe this back to the user bug and fix it there instead of as a followup.

Status: NEW → RESOLVED
Closed: 1 month ago
Duplicate of bug: 2083975
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.