Using a context-specific Touch Bar button crashes the browser

RESOLVED FIXED in Firefox 66

Status

()

defect
RESOLVED FIXED
5 months ago
2 months ago

People

(Reporter: harry, Assigned: harry)

Tracking

(Regression)

unspecified
mozilla66
Desktop
macOS
Points:
---

Firefox Tracking Flags

(firefox66 fixed)

Details

Attachments

(1 attachment)

Assignee

Description

5 months ago

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.

Assignee

Comment 2

5 months ago

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!

Comment 3

5 months ago
Pushed by mdeboer@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/747303cab27a
Resolves crash when using Touch Bar inputs out-of-context. r=mikedeboer

Comment 4

5 months ago
bugherder
Status: NEW → RESOLVED
Closed: 5 months ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla66
No longer blocks: touchbar
Regressed by: touchbar
You need to log in before you can comment on or make changes to this bug.