Bug 1332610 - Don't eagerly create Intl.DateTimeFormat in LoginManagerContextMenu.jsm. r=johannh
authorMatthew Noorenberghe <mozilla@noorenberghe.ca>
Mon, 23 Jan 2017 11:27:10 -0800
changeset 342248 5df20eaa8ef4c3eff723c1d597a439e141395881
parent 342247 691c5021002dbbf88adcad784c95b3bb9aad0531
child 342249 59c0ce731318d210b56b349f1762cf6aeba5c686
push id31346
push userkwierso@gmail.com
push dateFri, 10 Feb 2017 22:33:24 +0000
treeherdermozilla-central@7b9d9e4a82a6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjohannh
bugs1332610
milestone54.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 1332610 - Don't eagerly create Intl.DateTimeFormat in LoginManagerContextMenu.jsm. r=johannh MozReview-Commit-ID: IuXdWyy4C7b
toolkit/components/passwordmgr/LoginManagerContextMenu.jsm
--- a/toolkit/components/passwordmgr/LoginManagerContextMenu.jsm
+++ b/toolkit/components/passwordmgr/LoginManagerContextMenu.jsm
@@ -14,33 +14,30 @@ XPCOMUtils.defineLazyModuleGetter(this, 
                                   "resource://gre/modules/LoginHelper.jsm");
 XPCOMUtils.defineLazyModuleGetter(this, "LoginManagerParent",
                                   "resource://gre/modules/LoginManagerParent.jsm");
 
 /*
  * Password manager object for the browser contextual menu.
  */
 var LoginManagerContextMenu = {
-  dateAndTimeFormatter: new Intl.DateTimeFormat(undefined,
-                        { day: "numeric", month: "short", year: "numeric" }),
   /**
    * Look for login items and add them to the contextual menu.
    *
    * @param {HTMLInputElement} inputElement
    *        The target input element of the context menu click.
    * @param {xul:browser} browser
    *        The browser for the document the context menu was open on.
    * @param {nsIURI} documentURI
    *        The URI of the document that the context menu was activated from.
    *        This isn't the same as the browser's top-level document URI
    *        when subframes are involved.
    * @returns {DocumentFragment} a document fragment with all the login items.
    */
   addLoginsToMenu(inputElement, browser, documentURI) {
-
     let foundLogins = this._findLogins(documentURI);
 
     if (!foundLogins.length) {
       return null;
     }
 
     let fragment = browser.ownerDocument.createDocumentFragment();
     let duplicateUsernames = this._findDuplicates(foundLogins);
@@ -187,8 +184,16 @@ var LoginManagerContextMenu = {
     return this._stringBundle.GetStringFromName(key);
   },
 };
 
 XPCOMUtils.defineLazyGetter(LoginManagerContextMenu, "_stringBundle", function() {
   return Services.strings.
          createBundle("chrome://passwordmgr/locale/passwordmgr.properties");
 });
+
+XPCOMUtils.defineLazyGetter(LoginManagerContextMenu, "dateAndTimeFormatter", function() {
+  return new Intl.DateTimeFormat(undefined, {
+    day: "numeric",
+    month: "short",
+    year: "numeric",
+  });
+});