Closed Bug 1522994 Opened 6 years ago Closed 6 years ago

Using a context-specific Touch Bar button crashes the browser

Categories

(Core :: Widget: Cocoa, defect)

Desktop
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla66
Tracking Status
firefox66 --- fixed

People

(Reporter: bugzilla, Assigned: bugzilla)

References

(Regression)

Details

(Keywords: regression)

Attachments

(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 mdeboer@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/747303cab27a Resolves crash when using Touch Bar inputs out-of-context. r=mikedeboer
Status: NEW → RESOLVED
Closed: 6 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.

Attachment

General

Creator:
Created:
Updated:
Size: