Commit c486879a authored by Henry Wilkes's avatar Henry Wilkes Committed by Pier Angelo Vendrame
Browse files

MB 538: Mullvad DoH discontinued notification.

parent ba816c83
Loading
Loading
Loading
Loading
+1 −0
Changes for browser/base/content/browser-main.js: 1 added line, 0 removed lines.
Original line number Diff line number Diff line
@@ -30,6 +30,7 @@
  Services.scriptloader.loadSubScript("chrome://browser/content/places/places-menupopup.js", this);
  Services.scriptloader.loadSubScript("chrome://browser/content/search/autocomplete-popup.js", this);
  Services.scriptloader.loadSubScript("chrome://browser/content/search/searchbar.js", this);
  Services.scriptloader.loadSubScript("chrome://browser/content/mullvadDoHNotification.js", this);
  Services.scriptloader.loadSubScript("chrome://browser/content/languageNotification.js", this);
  if (AIWindow.isOpeningAIWindow(window)) {
    ChromeUtils.importESModule("chrome://browser/content/urlbar/SmartbarInput.mjs", { global: "current" });
+62 −0
Changes for browser/base/content/mullvadDoHNotification.js: 62 added lines, 0 removed lines.
Original line number Diff line number Diff line
"use strict";

window.addEventListener("load", () => {
  // A notification to let users known that their DNS over HTTPS settings have
  // changed because the mullvad DoH services has been discontinued and
  // replaced. tor-browser#538.
  const notification = {
    // ProfileDataUpgrader.upgradeMB migration will set the `showPref`
    // preference conditionally on whether the user is effected. We wait for
    // this preference for confirmation.
    showPref: "mullvadbrowser.migration.show_doh_notification",
    shown: false,

    init() {
      Services.prefs.addObserver(this.showPref, this);
      this.maybeShow();
    },

    observe() {
      this.maybeShow();
    },

    async maybeShow() {
      if (this.shown || !Services.prefs.getBoolPref(this.showPref, false)) {
        return;
      }
      this.shown = true;
      Services.prefs.removeObserver(this.showPref, this);

      gNotificationBox.appendNotification(
        "mullvad-doh-notification",
        {
          label: { "l10n-id": "mullvad-doh-notification-body" },
          priority: gNotificationBox.PRIORITY_INFO_HIGH,
          eventCallback: name => {
            if (name === "dismissed") {
              Services.prefs.clearUserPref(this.showPref);
            }
          },
        },
        [
          {
            "l10n-id": "moz-support-link-text",
            link: "https://mullvad.net/en/blog/shutting-down-our-public-encrypted-dns-servers-and-sponsoring-quad9-instead",
          },
          {
            "l10n-id": "mullvad-doh-notification-settings-button",
            primary: true,
            callback: () => {
              window.openPreferences("dnsOverHttps");
              Services.prefs.clearUserPref(this.showPref);
              // Keep the notification open in case the user wants to click
              // "Learn more".
              return true;
            },
          },
        ]
      );
    },
  };
  notification.init();
});
+1 −0
Changes for browser/base/jar.mn: 1 added line, 0 removed lines.
Original line number Diff line number Diff line
@@ -101,4 +101,5 @@ browser.jar:
        content/browser/spotlight.js                  (content/spotlight.js)
*       content/browser/default-bookmarks.html        (content/default-bookmarks.html)

        content/browser/mullvadDoHNotification.js     (content/mullvadDoHNotification.js)
        content/browser/languageNotification.js       (content/languageNotification.js)