Bug 1188478 - Add an Import button to the password manager to open the browser migrator. r=dolske
authorMatthew Noorenberghe <mozilla@noorenberghe.ca>
Fri, 07 Aug 2015 13:06:16 -0700
changeset 256862 a4836b5699def75b78d6668d9929cde146f33170
parent 256861 d0a1ddd01c1e2b6e67bce8272b0a512d43667293
child 256863 8d0287d9c8e4e05e0245d9fcc7f5e03cbd58fe0b
push id29191
push userkwierso@gmail.com
push dateSat, 08 Aug 2015 00:10:29 +0000
treeherdermozilla-central@a5bde89f6829 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdolske
bugs1188478
milestone42.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 1188478 - Add an Import button to the password manager to open the browser migrator. r=dolske Windows-only for now since we can't yet import passwords on other platforms.
toolkit/components/passwordmgr/content/passwordManager.js
toolkit/components/passwordmgr/content/passwordManager.xul
toolkit/components/passwordmgr/content/passwordManagerCommon.js
toolkit/components/passwordmgr/moz.build
toolkit/locales/en-US/chrome/passwordmgr/passwordManager.dtd
--- a/toolkit/components/passwordmgr/content/passwordManager.js
+++ b/toolkit/components/passwordmgr/content/passwordManager.js
@@ -449,8 +449,13 @@ function masterPasswordLogin(noPasswordC
 
 function escapeKeyHandler() {
   // If editing is currently performed, don't do anything.
   if (signonsTree.getAttribute("editing")) {
     return;
   }
   window.close();
 }
+
+function OpenMigrator() {
+  const { MigrationUtils } = Cu.import("resource:///modules/MigrationUtils.jsm", {});
+  MigrationUtils.showMigrationWizard(window);
+}
--- a/toolkit/components/passwordmgr/content/passwordManager.xul
+++ b/toolkit/components/passwordmgr/content/passwordManager.xul
@@ -98,16 +98,21 @@
     <hbox id="SignonViewerButtons">
       <button id="removeSignon" disabled="true" icon="remove"
               label="&remove.label;" accesskey="&remove.accesskey;"
               oncommand="DeleteSignon();"/>
       <button id="removeAllSignons" icon="clear"
               label="&removeall.label;" accesskey="&removeall.accesskey;"
               oncommand="DeleteAllSignons();"/>
       <spacer flex="1"/>
+#if defined(MOZ_BUILD_APP_IS_BROWSER) && defined(XP_WIN)
+      <button accesskey="&import.accesskey;"
+              label="&import.label;"
+              oncommand="OpenMigrator();"/>
+#endif
       <button id="togglePasswords"
               oncommand="TogglePasswordVisible();"/>
     </hbox>
   </vbox>
   <hbox align="end">
     <hbox class="actionButtons" flex="1">
       <spacer flex="1"/>
 #ifndef XP_MACOSX
--- a/toolkit/components/passwordmgr/content/passwordManagerCommon.js
+++ b/toolkit/components/passwordmgr/content/passwordManagerCommon.js
@@ -1,14 +1,16 @@
 /* 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/. */
 
 /*** =================== INITIALISATION CODE =================== ***/
 
+const { classes: Cc, interfaces: Ci, results: Cr, utils: Cu } = Components;
+
 Components.utils.import("resource://gre/modules/Services.jsm");
 
 var kObserverService;
 
 // interface variables
 var passwordmanager     = null;
 
 // password-manager lists
--- a/toolkit/components/passwordmgr/moz.build
+++ b/toolkit/components/passwordmgr/moz.build
@@ -1,14 +1,17 @@
 # -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # 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/.
 
+if CONFIG['MOZ_BUILD_APP'] == 'browser':
+    DEFINES['MOZ_BUILD_APP_IS_BROWSER'] = True
+
 MOCHITEST_MANIFESTS += ['test/mochitest.ini']
 MOCHITEST_CHROME_MANIFESTS += ['test/chrome.ini']
 BROWSER_CHROME_MANIFESTS += ['test/browser/browser.ini']
 XPCSHELL_TESTS_MANIFESTS += ['test/unit/xpcshell.ini']
 
 TESTING_JS_MODULES += [
     'test/LoginTestUtils.jsm',
 ]
--- a/toolkit/locales/en-US/chrome/passwordmgr/passwordManager.dtd
+++ b/toolkit/locales/en-US/chrome/passwordmgr/passwordManager.dtd
@@ -17,16 +17,19 @@
 <!ENTITY      treehead.timePasswordChanged.label "Last Changed">
 <!ENTITY      treehead.timesUsed.label           "Times Used">
 
 <!ENTITY      remove.label                    "Remove">
 <!ENTITY      remove.accesskey                "R">
 <!ENTITY      removeall.label                 "Remove All">
 <!ENTITY      removeall.accesskey             "A">
 
+<!ENTITY      import.label                    "Import…">
+<!ENTITY      import.accesskey                "I">
+
 <!ENTITY      filter.label                    "Search:">
 <!ENTITY      filter.accesskey                "S">
 
 <!ENTITY      windowClose.key                 "w">
 <!ENTITY      focusSearch1.key                "f">
 <!ENTITY      focusSearch2.key                "k">
 
 <!ENTITY      copyPasswordCmd.label           "Copy Password">