Bug 1608336 - Disable Touch Bar for non-chrome windows. r=mikedeboer a=pascalc
authorHarry Twyford <htwyford@mozilla.com>
Tue, 11 Feb 2020 09:49:11 +0000
changeset 575762 24c0f5e578cbf3acb8daf064de320918c730481c
parent 575761 d93d2163815f7055eb008cf124a025496d223a94
child 575763 178d86c0541a04c52faf0821c969742e8e2f81f5
push id12726
push usernerli@mozilla.com
push dateTue, 18 Feb 2020 16:28:04 +0000
treeherdermozilla-beta@2c80293c156e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmikedeboer, pascalc
bugs1608336
milestone74.0
Bug 1608336 - Disable Touch Bar for non-chrome windows. r=mikedeboer a=pascalc Differential Revision: https://phabricator.services.mozilla.com/D62259
browser/components/touchbar/MacTouchBar.js
--- a/browser/components/touchbar/MacTouchBar.js
+++ b/browser/components/touchbar/MacTouchBar.js
@@ -289,16 +289,26 @@ class TouchBarHelper {
     return activeTitle;
   }
 
   get allItems() {
     let layoutItems = Cc["@mozilla.org/array;1"].createInstance(
       Ci.nsIMutableArray
     );
 
+    let window = TouchBarHelper.window;
+    if (
+      !window ||
+      !window.isChromeWindow ||
+      window.document.documentElement.getAttribute("windowtype") !=
+        "navigator:browser"
+    ) {
+      return layoutItems;
+    }
+
     // Every input must be updated at least once so that all assets (titles,
     // icons) are loaded. We keep track of which inputs haven't updated and
     // run an update on them ASAP.
     this._inputsNotUpdated.clear();
 
     for (let inputName of Object.keys(gBuiltInInputs)) {
       let input = this.getTouchBarInput(inputName);
       if (!input) {