Open Bug 1527587 Opened 11 months ago Updated 11 months ago

Fix exception when Bookmarks sidebar is shown and quickly hidden before it finishes loading

Categories

(Firefox :: Bookmarks & History, defect, P3)

defect

Tracking

()

People

(Reporter: Jamie, Unassigned)

References

Details

In bug 1436086, I added testSidebarsButtonPress to browser/base/content/test/keyboard/browser_toolbarButtonKeyPress.js which tests showing and hiding the Bookmarks sidebar. The original version of the test intermittently failed with this error:

TEST-UNEXPECTED-FAIL | browser/base/content/test/keyboard/browser_toolbarButtonKeyPress.js | uncaught exception - ReferenceError: PlacesUIUtils is not defined at onunload@chrome://browser/content/places/bookmarksSidebar.xul:1:1
hide@chrome://browser/content/browser-sidebar.js:503:5
toggle@chrome://browser/content/browser-sidebar.js:369:7
onCommand@resource:///modules/CustomizableWidgets.jsm:193:7
handleWidgetCommand@resource:///modules/CustomizableUI.jsm:1639:11
synthesizeKey@chrome://mochikit/content/tests/SimpleTest/EventUtils.js:879:7
testSidebarsButtonPress@chrome://mochitests/content/browser/browser/base/content/test/keyboard/browser_toolbarButtonKeyPress.js:198:3
...

bookmarksSidebar.xul tries to call into PlacesUIUtils:
https://searchfox.org/mozilla-central/source/browser/components/places/content/bookmarksSidebar.xul#25
However, PlacesUIUtils is loaded in bookmarksSidebar.js. That suggests that when the unload event was fired, bookmarksSidebar.js wasn't loaded yet, so PlacesUIUtils doesn't exist yet either.

I worked around this in the test by waiting for PlacesUIUtils to be present in the sidebar's content window. That's pretty ugly, though, and browserSidebar.xul would ideally be more resilient.

Priority: -- → P3
You need to log in before you can comment on or make changes to this bug.