Closed Bug 1369705 Opened 6 years ago Closed 6 years ago

avoid search UI overhead before first paint (search-one-offs_XBL_Constructor, search service load, searchbar context menu)


(Firefox :: Address Bar, enhancement, P2)




Firefox 55
Tracking Status
firefox55 --- fixed


(Reporter: florian, Assigned: florian)


(Blocks 1 open bug)


(Whiteboard: [fxsearch])


(1 file, 1 obsolete file)

urlbar_XBL_Constructor is triggered before first paint, and spends 40% of its time in _enableOrDisableOneOffSearches (which apparently calls search-one-offs_XBL_Constructor, so I guess it causes the search one off binding to be attached synchronously). From the name of this method, it looks like it could wait until the first time we open the awesomebar panel.

See this profile captured on a slow netbook to have more detailed data.
Priority: -- → P2
Whiteboard: [fxsearch]
Attached patch Patch (obsolete) — Splinter Review
This patch delays:
- loading the search service until after first paint (and this is covered by test),
- running the one-off-buttons constructor until the relevant panels are showing,
- initializing the searchbar context menu until it's first showing.

All these things were visible in this startup profile:
Attachment #8875784 - Flags: review?(adw)
Assignee: nobody → florian
Comment on attachment 8875784 [details] [diff] [review]

Review of attachment 8875784 [details] [diff] [review]:

::: browser/components/search/content/search.xml
@@ +593,5 @@
>                                                "anonid", "textbox-input-box");
>          var cxmenu = document.getAnonymousElementByAttribute(textBox,
>                                            "anonid", "input-box-contextmenu");
> +        cxmenu.addEventListener("popupshowing", () => {
> +          let stringBundle = document.getBindingParent(this)._stringBundle;

While you're touching this, could you please pull out all the code that builds the context menu into its own method and call it here?
Attachment #8875784 - Flags: review?(adw) → review+
Attached patch Patch v2Splinter Review
- Moved the context menu initialization to its own method per comment 2.
- Moved the this._textbox.placeholder = this._stringBundle.getString("searchPlaceholder"); line to the searchbar constructor to avoid the placeholder flickering.
- Fixed the browser_426329.js test which was testing the controller but never opening the context menu.
Attachment #8875784 - Attachment is obsolete: true
Pushed by
avoid starting the search service or calling the search-one-offs XBL constructor before first paint, r=adw.
Updating the summary to reflect what the patch did.
Summary: urlbar_XBL_Constructor shows up in startup profiles → avoid search UI overhead before first paint (search-one-offs_XBL_Constructor, search service load, searchbar context menu)
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 55
You need to log in before you can comment on or make changes to this bug.