Commit ad82e519 authored by henry's avatar henry Committed by Pier Angelo Vendrame
Browse files

Bug 42347: Add a notification for dropped OS version support.

parent 6fb3d5b4
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -123,6 +123,7 @@
  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/languageNotification.js", this);
  Services.scriptloader.loadSubScript("chrome://browser/content/droppedSupportNotification.js", this);

  window.onload = gBrowserInit.onLoad.bind(gBrowserInit);
  window.onunload = gBrowserInit.onUnload.bind(gBrowserInit);
+69 −0
Original line number Diff line number Diff line
"use strict";

// Show a prompt that a user's system will no longer be supported.
window.addEventListener("load", () => {
  let labelId;
  // Expire date is 2024-10-01 (1st October 2024).
  const isExpired = Date.now() > Date.UTC(2024, 9, 1);

  if (
    AppConstants.platform === "macosx" &&
    Services.vc.compare(
      Services.sysinfo.getProperty("version"),
      "19.0" // MacOS 10.15 begins with Darwin 19.0
    ) < 0
  ) {
    labelId = isExpired
      ? "dropped-support-notification-macos-version-less-than-10-15-expired"
      : "dropped-support-notification-macos-version-less-than-10-15";
  } else if (
    AppConstants.platform === "win" &&
    Services.vc.compare(Services.sysinfo.getProperty("version"), "10.0") < 0
  ) {
    labelId = isExpired
      ? "dropped-support-notification-win-os-version-less-than-10-expired"
      : "dropped-support-notification-win-os-version-less-than-10";
  }

  const dismissedPref =
    "browser.dropped_support_notification_v14.dismiss_version";

  if (!labelId) {
    // Avoid setting any preferences for supported versions, and clean up any
    // old values if the user ported their profile.
    Services.prefs.clearUserPref(dismissedPref);
    return;
  }

  if (
    !isExpired &&
    Services.prefs.getStringPref(dismissedPref, "") ===
      AppConstants.BASE_BROWSER_VERSION
  ) {
    // Already dismissed since the last update.
    return;
  }

  const buttons = isExpired
    ? undefined
    : [
        {
          "l10n-id": "dropped-support-notification-dismiss-button",
          callback: () => {
            Services.prefs.setStringPref(
              dismissedPref,
              AppConstants.BASE_BROWSER_VERSION
            );
          },
        },
      ];

  gNotificationBox.appendNotification(
    "dropped-support-notification",
    {
      label: { "l10n-id": labelId },
      priority: gNotificationBox.PRIORITY_WARNING_HIGH,
    },
    buttons
  );
});
+1 −0
Original line number Diff line number Diff line
@@ -105,4 +105,5 @@ browser.jar:
        content/browser/spotlight.js                  (content/spotlight.js)
*       content/browser/default-bookmarks.html        (content/default-bookmarks.html)

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