In #40701 (closed) we deprecated the external filetype dialog, and incorporated the warning into the Downloads wingpanel instead. @henry suggested in MR !595 (comment 2892920) that we could add the same warning to about:downloads too.
NOTE: With this change there will be multiple points of entry for the same pref, so we probably want to switch to using Services.pref.addObserver. See !595 (comment 2894310).
"since we will have multiple entry points for this pref with we might want to make this change using Services.prefs.addObserver instead in preparation."
"For reference for now or the next patch, it would be something like this, where we move all the hiding and focus logic out of the "click" handler and into the preference observer:"
initialize() { /* ... */ this._torWarningPrefObserver = () => { const warningMessage = document.getElementById("downloadsWarning"); if (Services.prefs.getBoolPref(PREF_SHOW_DOWNLOAD_WARNING)) { warningMessage.hidden = false; } else { // Re-assign focus if it is about to be lost. if (warningMessage.contains(document.activeElement)) { this._focusPanel(true); } warningMessage.hidden = true; } }; Services.prefs.addObserver( PREF_SHOW_DOWNLOAD_WARNING, this._torWarningPrefObserver ); // Initialize. this._torWarningPrefObserver(); if (!this._torWarningInitialized) { /* ... */ dismissBtn.addEventListener("click", event => { Services.prefs.setBoolPref(PREF_SHOW_DOWNLOAD_WARNING, false); }); /* ... */ } /* ... */ }, /* ... */ terminate() { /* ... */ Services.prefs.removeObserver( PREF_SHOW_DOWNLOAD_WARNING, this._torWarningPrefObserver ); /* ... */ },