Closed Bug 1522994 Opened 4 years ago Closed 4 years ago

Using a context-specific Touch Bar button crashes the browser


(Core :: Widget: Cocoa, defect)

Not set



Tracking Status
firefox66 --- fixed


(Reporter: bugzilla, Assigned: bugzilla)




(Keywords: regression)


(1 file)

Touch Bar inputs in kImplemententedInputs in MacTouchBar.js have an optional context() property that determines if an input should appear in the current context. context() is a function that returns the name of the input that should appear in a specified context. Usually, an input will return it's own name if it should appear in a particular context and undefined otherwise.

The issue is that the current code that sets the Touch Bar layout does not handle undefined, causing a browser crash. The browser can't be reopened until the ui.touchbar.layout pref is updated to remove the input whose context property returns undefined.

As an example, kImplementedInputs currently has an input Focus:

  Focus: {
    title: "close-window",
    image: "private-browsing.pdf",
    type: "mainButton",
    callback: () => execCommand("cmd_closeWindow", "Focus"),
    color: "#8000D7",
    context: () => {
      let name;
      if (PrivateBrowsingUtils.isWindowPrivate(BrowserWindowTracker.getTopWindow())) {
        name = "Focus";
      return name;

context() returns "Focus" when in PBM, meaning that the Focus input should appear in PBM. However, if a user adds the Focus input to their Touch Bar and has a non-Private browser window open, the browser will crash since name returns as undefined.

This is a serious crash but a quick fix. I will submit the fix as soon as this bug is up.

spohl, I've tagged you for review since I believe it's quite late in Mike's timezone right now. This is a big crash with a quick fix, so it'd be great to get it out overnight!

Attachment #9039243 - Attachment description: Bug 1522994 - Resolves crash when using Touch Bar inputs out-of-context. r?spohl → Bug 1522994 - Resolves crash when using Touch Bar inputs out-of-context. r?mikedeboer!
Pushed by
Resolves crash when using Touch Bar inputs out-of-context. r=mikedeboer
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla66
No longer blocks: 1313429
Regressed by: 1313429
Keywords: regression
Has Regression Range: --- → yes
You need to log in before you can comment on or make changes to this bug.