Closed Bug 1735112 Opened 3 years ago Closed 3 years ago

MacTouchBar.js causes PlacesUtils.jsm to be loaded before first paint

Categories

(Core :: Widget: Cocoa, defect)

defect

Tracking

()

RESOLVED FIXED
95 Branch
Tracking Status
firefox95 --- fixed

People

(Reporter: standard8, Assigned: standard8)

Details

(Whiteboard: [fxperf])

Attachments

(1 file)

Running the browser/base/content/test/performance/browser_startup.js on my Mac with a touchbar, I'm seeing:

  FAIL resource://gre/modules/PlacesUtils.jsm is not allowed before first paint - 
Stack trace:
0 get image() ["file:///Users/mark/dev/gecko/objdir-ff/dist/Nightly.app/Contents/Resources/browser/components/MacTouchBar.js":574:4]

This is causing PlacesUtils and Sqlite, maybe other things to be loaded earlier in startup than necessary, potentially slowing startup down slightly.

Looking at the code, it is unclear that MacTouchBar needs to call PlacesUtils:

https://searchfox.org/mozilla-central/rev/2c4b830b924f42283632b70f39a60fd36433dd4d/browser/components/touchbar/MacTouchBar.js#574

  get image() {
    return this._image ? PlacesUtils.toURI(this._image) : null;
  }

The documentation for TouchBarInput says that it is a string: A URL pointing to an SVG internal to Firefox..

toURI is converting to an nsIURI

Therefore, I think we can probably just use Services.io.newURI or NetUtils.newURI directly as it shouldn't be an URL object.

Assignee: nobody → standard8
Status: NEW → ASSIGNED
Pushed by mbanner@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/e931a1080ef9
Avoid loading PlacesUtils.jsm in early startup from MacTouchBar.js. r=harry
Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 95 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: