Bug 1590036 - Show users who get a fresh profile instead of reusing the previous default a first run UI (about:newinstall). r=mkmelin a=wsmwk
authorKhushil Mistry <khushil324@gmail.com>
Tue, 25 Feb 2020 10:47:43 +0200
changeset 38186 053fffd2df97af695a4850db1b7b8901cabbef1a
parent 38185 541c7a9fd7f3d6a8a5b69d4a697d0fb8c412bb3c
child 38187 a3c12a0d6d10cd3e7b74ae982cb3048d3448eec1
push id398
push userclokep@gmail.com
push dateMon, 09 Mar 2020 19:10:28 +0000
reviewersmkmelin, wsmwk
bugs1590036
Bug 1590036 - Show users who get a fresh profile instead of reusing the previous default a first run UI (about:newinstall). r=mkmelin a=wsmwk
mail/base/content/msgMail3PaneWindow.js
mail/base/content/newInstall.js
mail/base/content/newInstall.xhtml
mail/base/content/newInstallPage.html
mail/base/jar.mn
mail/components/AboutRedirector.jsm
mail/components/components.conf
mail/locales/en-US/messenger/newInstall.ftl
mail/locales/en-US/messenger/newInstallPage.ftl
mail/themes/shared/jar.inc.mn
mail/themes/shared/mail/icons/information.svg
mail/themes/shared/mail/newInstall.css
mail/themes/shared/mail/newInstallPage.css
--- a/mail/base/content/msgMail3PaneWindow.js
+++ b/mail/base/content/msgMail3PaneWindow.js
@@ -573,35 +573,70 @@ function OnLoadMessenger() {
   }
 
   // This also registers the contentTabType ("contentTab")
   specialTabs.openSpecialTabsOnStartup();
   preferencesTabType.initialize();
   // accountProvisionerTabType is defined in accountProvisionerTab.js
   tabmail.registerTabType(accountProvisionerTabType);
 
-  // verifyAccounts returns true if the callback won't be called
-  // We also don't want the account wizard to open if any sort of account exists
-  if (verifyAccounts(LoadPostAccountWizard, false, AutoConfigWizard)) {
-    LoadPostAccountWizard();
-  }
-
   // Set up the summary frame manager to handle loading pages in the
   // multi-message pane
   gSummaryFrameManager = new SummaryFrameManager(
     document.getElementById("multimessage")
   );
 
   window.addEventListener("AppCommand", HandleAppCommandEvent, true);
 
   // Set up the appmenus. (This has to happen after the DOM has loaded.)
   PanelUI.init();
 
   // Load the periodic filter timer.
   PeriodicFilterManager.setupFiltering();
+
+  let pService = Cc["@mozilla.org/toolkit/profile-service;1"].getService(
+    Ci.nsIToolkitProfileService
+  );
+  if (pService.createdAlternateProfile) {
+    // Show on a timeout so the main window has time to open. Otherwise
+    // the dialog would be confusingly showing out of context.
+    setTimeout(() => _showNewInstallModal());
+  } else if (verifyAccounts(LoadPostAccountWizard, false, AutoConfigWizard)) {
+    // verifyAccounts returns true if the callback won't be called
+    // We also don't want the account wizard to open if any sort of account exists
+    LoadPostAccountWizard();
+  }
+}
+
+function _showNewInstallModal() {
+  Services.ww.openWindow(
+    null,
+    "chrome://messenger/content/newInstall.xhtml",
+    "_blank",
+    "chrome,modal,resizable=no,centerscreen",
+    null
+  );
+
+  let mail3PaneWindow = Services.wm.getMostRecentWindow("mail:3pane");
+  if (mail3PaneWindow) {
+    let tabmail = mail3PaneWindow.document.getElementById("tabmail");
+    let monitor = {
+      onTabTitleChanged() {},
+      onTabSwitched() {},
+      onTabClosing() {
+        AutoConfigWizard();
+        tabmail.unregisterTabMonitor(monitor);
+      },
+    };
+    tabmail.registerTabMonitor(monitor);
+    tabmail.openTab("contentTab", {
+      contentPage: "about:newinstall",
+      clickHandler: "specialTabs.aboutClickHandler(event);",
+    });
+  }
 }
 
 function LoadPostAccountWizard() {
   InitMsgWindow();
   messenger.setWindow(window, msgWindow);
 
   InitPanes();
   MigrateJunkMailSettings();
new file mode 100644
--- /dev/null
+++ b/mail/base/content/newInstall.js
@@ -0,0 +1,9 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+function init() {
+  document.querySelector("button").addEventListener("command", () => {
+    window.close();
+  });
+}
new file mode 100644
--- /dev/null
+++ b/mail/base/content/newInstall.xhtml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- This Source Code Form is subject to the terms of the Mozilla Public
+   - License, v. 2.0. If a copy of the MPL was not distributed with this
+   - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
+
+<!DOCTYPE window>
+
+<?xml-stylesheet href="chrome://messenger/skin/"?>
+<?xml-stylesheet href="chrome://messenger/skin/shared/newInstall.css"?>
+
+<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+        xmlns:html="http://www.w3.org/1999/xhtml"
+        onload="init()"
+        data-l10n-id="connection-window">
+  <html:link rel="localization" href="branding/brand.ftl"/>
+  <html:link rel="localization" href="messenger/newInstall.ftl"/>
+  <script src="chrome://messenger/content/newInstall.js"></script>
+  <hbox align="start" flex="1">
+    <image id="alert" role="presentation"/>
+    <vbox align="end" flex="1">
+      <description class="main-text" data-l10n-id="main-text"/>
+      <button data-l10n-id="continue-button"/>
+    </vbox>
+  </hbox>
+</window>
new file mode 100644
--- /dev/null
+++ b/mail/base/content/newInstallPage.html
@@ -0,0 +1,37 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
+                      "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
+
+<!-- This Source Code Form is subject to the terms of the Mozilla Public
+   - License, v. 2.0. If a copy of the MPL was not distributed with this
+   - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+  <head>
+    <meta http-equiv="Content-Security-Policy" content="connect-src https:; default-src chrome:"/>
+    <link rel="icon" type="image/png" id="favicon" href="chrome://branding/content/icon48.png"/>
+    <link rel="stylesheet" type="text/css" href="chrome://messenger/skin/shared/newInstallPage.css"/>
+    <link rel="localization" href="branding/brand.ftl"/>
+    <link rel="localization" href="messenger/newInstallPage.ftl"/>
+    <title data-l10n-id="title"></title>
+  </head>
+  <body>
+    <div id="main">
+      <div id="content">
+        <div id="info">
+          <h1 data-l10n-id="heading"></h1>
+          <h3 data-l10n-id="changed-title"></h3>
+          <p data-l10n-id="changed-desc-profiles"></p>
+          <p data-l10n-id="changed-desc-dedicated"></p>
+          <p data-l10n-id="lost"></p>
+          <h3 data-l10n-id="options-title"></h3>
+          <p data-l10n-id="options-do-nothing"></p>
+          <h3 data-l10n-id="resources"></h3>
+          <ul>
+            <li><a href="about:profiles" target="_blank" data-l10n-id="about-pofiles-link"></a>
+            <li><a href="https://support.mozilla.org/kb/profile-manager-create-and-remove-thunderbird-profiles" target="_blank" rel="noopener" data-l10n-id="support-link"/></a></li>
+          </ul>
+        </div>
+      </div>
+    </div>
+  </body>
+</html>
--- a/mail/base/jar.mn
+++ b/mail/base/jar.mn
@@ -53,16 +53,17 @@ messenger.jar:
     content/messenger/FilterListDialog.js           (content/FilterListDialog.js)
     content/messenger/specialTabs.js                (content/specialTabs.js)
     content/messenger/aboutAddonsExtra.css          (content/aboutAddonsExtra.css)
     content/messenger/aboutAddonsExtra.js           (content/aboutAddonsExtra.js)
     content/messenger/aboutDialog-appUpdater.js     (content/aboutDialog-appUpdater.js)
 *   content/messenger/aboutDialog.xhtml             (content/aboutDialog.xhtml)
     content/messenger/aboutDialog.js                (content/aboutDialog.js)
 *   content/messenger/aboutRights.xhtml             (content/aboutRights.xhtml)
+    content/messenger/newInstallPage.html           (content/newInstallPage.html)
 *   content/messenger/systemIntegrationDialog.xhtml (content/systemIntegrationDialog.xhtml)
     content/messenger/systemIntegrationDialog.js    (content/systemIntegrationDialog.js)
     content/messenger/folderPane.js                 (content/folderPane.js)
     content/messenger/messenger-customization.js    (content/messenger-customization.js)
     content/messenger/searchBar.js                  (content/searchBar.js)
     content/messenger/phishingDetector.js           (content/phishingDetector.js)
     content/messenger/mail-offline.js               (content/mail-offline.js)
     content/messenger/aboutDialog.css               (content/aboutDialog.css)
@@ -75,16 +76,18 @@ messenger.jar:
     content/messenger/tabbrowser-tab.js             (content/tabbrowser-tab.js)
     content/messenger/tabmail.css                   (content/tabmail.css)
     content/messenger/statuspanel.js                (content/statuspanel.js)
     content/messenger/newTagDialog.xhtml            (content/newTagDialog.xhtml)
     content/messenger/newTagDialog.js               (content/newTagDialog.js)
     content/messenger/composerOverlay.css           (content/composerOverlay.css)
     content/messenger/threadPane.js                 (content/threadPane.js)
     content/messenger/protovis-r2.6-modded.js       (content/protovis-r2.6-modded.js)
+    content/messenger/newInstall.xhtml              (content/newInstall.xhtml)
+    content/messenger/newInstall.js                 (content/newInstall.js)
 #ifdef XP_MACOSX
     content/messenger/macMessengerMenu.js           (content/macMessengerMenu.js)
 #endif
     content/messenger/selectionsummaries.js         (content/selectionsummaries.js)
     content/messenger/multimessageview.css          (content/multimessageview.css)
     content/messenger/multimessageview_print.css    (content/multimessageview_print.css)
     content/messenger/sharedsummary.css             (content/sharedsummary.css)
     content/messenger/multimessageview.xhtml        (content/multimessageview.xhtml)
--- a/mail/components/AboutRedirector.jsm
+++ b/mail/components/AboutRedirector.jsm
@@ -35,16 +35,20 @@ AboutRedirector.prototype = {
     downloads: {
       url: "chrome://messenger/content/downloads/aboutDownloads.xhtml",
       flags: Ci.nsIAboutModule.ALLOW_SCRIPT,
     },
     policies: {
       url: "chrome://messenger/content/policies/aboutPolicies.xhtml",
       flags: Ci.nsIAboutModule.ALLOW_SCRIPT,
     },
+    newinstall: {
+      url: "chrome://messenger/content/newInstallPage.html",
+      flags: Ci.nsIAboutModule.ALLOW_SCRIPT,
+    },
     accountsettings: {
       url: "chrome://messenger/content/AccountManager.xhtml",
       flags: Ci.nsIAboutModule.ALLOW_SCRIPT,
     },
   },
 
   /**
    * Gets the module name from the given URI.
--- a/mail/components/components.conf
+++ b/mail/components/components.conf
@@ -8,16 +8,17 @@ Classes = [
   {
     'cid': '{8cc51368-6aa0-43e8-b762-bde9b9fd828c}',
     'contract_ids': [
       '@mozilla.org/network/protocol/about;1?what=newserror',
       '@mozilla.org/network/protocol/about;1?what=rights',
       '@mozilla.org/network/protocol/about;1?what=preferences',
       '@mozilla.org/network/protocol/about;1?what=downloads',
       '@mozilla.org/network/protocol/about;1?what=policies',
+      '@mozilla.org/network/protocol/about;1?what=newinstall',
       '@mozilla.org/network/protocol/about;1?what=accountsettings'
     ],
     'jsm': 'resource://gre/modules/AboutRedirector.jsm',
     'constructor': 'AboutRedirector',
   },
   {
     'cid': '{eb239c82-fac9-431e-98d7-11cacd0f71b8}',
     'contract_ids': ['@mozilla.org/mail/mailglue;1'],
new file mode 100644
--- /dev/null
+++ b/mail/locales/en-US/messenger/newInstall.ftl
@@ -0,0 +1,9 @@
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+connection-window =
+    .title = Important News
+continue-button =
+    .label = Continue
+main-text = This installation of { -brand-short-name } has a new profile. It does not share email data, passwords, user preferences, and address books with other installations of { -brand-product-name } (including { -brand-product-name }, { -brand-product-name } Beta, and { -brand-product-name } Daily) on this computer.
new file mode 100644
--- /dev/null
+++ b/mail/locales/en-US/messenger/newInstallPage.ftl
@@ -0,0 +1,15 @@
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+title = Important News
+heading = Changes to your { -brand-short-name } profile
+changed-title = What changed?
+changed-desc-profiles = This installation of { -brand-short-name } has a new profile. A profile is the set of files where { -brand-product-name } saves information such as email data, passwords, user preferences, and address books.
+changed-desc-dedicated = In order to make it easier and safer to switch between installations of { -brand-product-name } (including { -brand-product-name }, { -brand-product-name } Beta, and { -brand-product-name } Daily), this installation now has a dedicated profile. It does not automatically share your saved information with other { -brand-product-name } installations.
+lost = <b>You have not lost any personal data or customizations.</b> If you’ve already saved information to { -brand-product-name } on this computer, it is still available in another { -brand-product-name } installation.
+options-title = What are my options?
+options-do-nothing = If you do nothing, your profile data in { -brand-short-name } will be different from profile data in other installations of { -brand-product-name }.
+resources = Resources
+about-pofiles-link = See and Manage Your Profiles
+support-link = Using the Profile Manager - Support Article
--- a/mail/themes/shared/jar.inc.mn
+++ b/mail/themes/shared/jar.inc.mn
@@ -109,30 +109,33 @@
   skin/classic/messenger/icons/timeline.svg                   (../shared/mail/icons/timeline.svg)
   skin/classic/messenger/icons/toolbarbutton-arrow.svg        (../shared/mail/icons/toolbarbutton-arrow.svg)
   skin/classic/messenger/icons/userIcon.svg                   (../shared/mail/icons/userIcon.svg)
   skin/classic/messenger/icons/visible.svg                    (../shared/mail/icons/visible.svg)
   skin/classic/messenger/icons/waiting.svg                    (../shared/mail/icons/waiting.svg)
   skin/classic/messenger/shared/aboutDownloads.css            (../shared/mail/aboutDownloads.css)
   skin/classic/messenger/shared/accountCentral.css            (../shared/mail/accountCentral.css)
   skin/classic/messenger/shared/accountCreation.css           (../shared/mail/accountCreation.css)
+  skin/classic/messenger/shared/newInstallPage.css            (../shared/mail/newInstallPage.css)
   skin/classic/messenger/shared/accountManage.css             (../shared/mail/accountManage.css)
   skin/classic/messenger/shared/accountProvisioner.css        (../shared/mail/accountProvisioner.css)
   skin/classic/messenger/shared/addressbook.css               (../shared/mail/addressbook.css)
   skin/classic/messenger/shared/compacttheme.css              (../shared/mail/compacttheme.css)
   skin/classic/messenger/shared/creationDialog.css            (../shared/mail/creationDialog.css)
   skin/classic/messenger/shared/EditorDialog.css              (../shared/mail/EditorDialog.css)
   skin/classic/messenger/shared/in-content/applications.css   (../shared/mail/incontentprefs/applications.css)
   skin/classic/messenger/shared/in-content/dialog.css         (../shared/mail/incontentprefs/dialog.css)
   skin/classic/messenger/shared/in-content/passwordmgr.css    (../shared/mail/incontentprefs/passwordmgr.css)
   skin/classic/messenger/shared/in-content/preferences.css    (../shared/mail/incontentprefs/preferences.css)
   skin/classic/messenger/shared/in-content/calendar.svg       (../shared/mail/incontentprefs/calendar.svg)
   skin/classic/messenger/shared/in-content/chat.svg           (../shared/mail/incontentprefs/chat.svg)
   skin/classic/messenger/shared/in-content/general.svg        (../shared/mail/incontentprefs/general.svg)
   skin/classic/messenger/shared/in-content/security.svg       (../shared/mail/incontentprefs/security.svg)
+  skin/classic/messenger/shared/newInstall.css                (../shared/mail/newInstall.css)
+  skin/classic/messenger/icons/information.svg                (../shared/mail/icons/information.svg)
   skin/classic/messenger/shared/mailWindow1.css               (../shared/mail/mailWindow1.css)
   skin/classic/messenger/shared/messageHeader.css             (../shared/mail/messageHeader.css)
   skin/classic/messenger/shared/messenger.css                 (../shared/mail/messenger.css)
   skin/classic/messenger/shared/messengercompose.css          (../shared/mail/messengercompose.css)
   skin/classic/messenger/shared/searchBox.css                 (../shared/mail/searchBox.css)
   skin/classic/messenger/shared/searchDialog.css              (../shared/mail/searchDialog.css)
   skin/classic/messenger/shared/tabmail.css                   (../shared/mail/tabmail.css)
   skin/classic/messenger/tagColors.css                        (../shared/mail/tagColors.css)
new file mode 100644
--- /dev/null
+++ b/mail/themes/shared/mail/icons/information.svg
@@ -0,0 +1,11 @@
+<!-- This Source Code Form is subject to the terms of the Mozilla Public
+   - License, v. 2.0. If a copy of the MPL was not distributed with this
+   - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
+<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16">
+  <path fill="context-fill" d="M8 16a8 8 0 1 1 8-8 8.009 8.009 0 0 1-8 8zM8 2a6 6 0 1 0 6 6 6.006 6.006 0 0 0-6-6z">
+  </path>
+  <path fill="context-fill" d="M8 7a1 1 0 0 0-1 1v3a1 1 0 0 0 2 0V8a1 1 0 0 0-1-1z">
+  </path>
+  <circle cx="8" cy="5" r="1.188">
+  </circle>
+</svg>
new file mode 100644
--- /dev/null
+++ b/mail/themes/shared/mail/newInstall.css
@@ -0,0 +1,25 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+window {
+  padding: 20px;
+  width: 490px;
+}
+
+#alert {
+  width: 32px;
+  height: 32px;
+  margin-inline-end: 8px;
+  list-style-image: url("chrome://messenger/skin/icons/information.svg");
+}
+
+description {
+  margin: 0 0 20px 0;
+  padding: 0;
+}
+
+.main-text {
+  font-size: 133%;
+  font-weight: bold;
+}
new file mode 100644
--- /dev/null
+++ b/mail/themes/shared/mail/newInstallPage.css
@@ -0,0 +1,22 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+h1 {
+  margin: 0 0 40px 0;
+}
+
+h3 {
+  font-size: inherit;
+  margin: 0;
+}
+
+p {
+  margin: 0 0 20px 0;
+}
+
+#main {
+  max-width: 830px;
+  margin: 40px auto 0 auto;
+  padding: 0 5px;
+}