From 2c5248df9389b142085bd85f9811b0ef0847d1c8 Mon Sep 17 00:00:00 2001 From: Kathy Brade Date: Thu, 3 Oct 2019 10:05:33 -0400 Subject: [PATCH] Bug 31955: On macOS avoid throwing inside nonBrowserWindowStartup() Inside nonBrowserWindowStartup(), do not assume that XUL elements that are only part of the Mac hidden window are available in all non-browser windows. --- browser/base/content/nonbrowser-mac.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/browser/base/content/nonbrowser-mac.js b/browser/base/content/nonbrowser-mac.js index 44f5cfd03127c..a7174a9295d08 100644 --- a/browser/base/content/nonbrowser-mac.js +++ b/browser/base/content/nonbrowser-mac.js @@ -102,10 +102,17 @@ function nonBrowserWindowStartup() { } if (PrivateBrowsingUtils.permanentPrivateBrowsing) { - document.getElementById("macDockMenuNewWindow").hidden = true; + element = document.getElementById("macDockMenuNewWindow"); + if (element) { + element.hidden = true; + } } + if (!PrivateBrowsingUtils.enabled) { - document.getElementById("macDockMenuNewPrivateWindow").hidden = true; + element = document.getElementById("macDockMenuNewPrivateWindow"); + if (element) { + element.hidden = true; + } } delayedStartupTimeoutId = setTimeout(nonBrowserWindowDelayedStartup, 0); -- GitLab