Bug 1616179 - Fix `JavaScript error: chrome://browser/content/sanitizeDialog.js, line 70: TypeError: right-hand side of 'in' should be an object, got null` error when sanitize dialog is opened outside of preferences;r=Gijs
authorBrian Grinstead <bgrinstead@mozilla.com>
Tue, 18 Feb 2020 23:27:30 +0000
changeset 514552 5ea05e514940c783dc4fe8b0ba9cc2003d06cc20
parent 514551 df47b5f850b6d79ae69ffdc668f30650faa7f860
child 514553 844430d0d7513a459116ea068abbb6f466d666f8
push id107638
push userbgrinstead@mozilla.com
push dateTue, 18 Feb 2020 23:33:11 +0000
treeherderautoland@844430d0d751 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersGijs
bugs1616179, 1523696
milestone75.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1616179 - Fix `JavaScript error: chrome://browser/content/sanitizeDialog.js, line 70: TypeError: right-hand side of 'in' should be an object, got null` error when sanitize dialog is opened outside of preferences;r=Gijs This error has been present since the initial landing in Bug 1523696. This is unrelated to the fix in the next patch, just something I noticed when debugging it. Differential Revision: https://phabricator.services.mozilla.com/D63233
browser/base/content/sanitizeDialog.js
--- a/browser/base/content/sanitizeDialog.js
+++ b/browser/base/content/sanitizeDialog.js
@@ -62,17 +62,17 @@ var gSanitizePromptDialog = {
           ).domWindow;
           return rootWin.promiseDocumentFlushed(() => {});
         });
     } else {
       this.warningBox.hidden = true;
     }
 
     // Only apply the following if the dialog is opened outside of the Preferences.
-    if (!("gSubDialog" in window.opener)) {
+    if (!window.opener || !("gSubDialog" in window.opener)) {
       // The style attribute on the dialog may get set after the dialog has been sized.
       // Force the dialog to size again after the style attribute has been applied.
       document.l10n.translateElements([document.documentElement]).then(() => {
         window.sizeToContent();
       });
     }
   },