diff --git a/mozilla/toolkit/components/passwordmgr/resources/content/contents.rdf b/mozilla/toolkit/components/passwordmgr/resources/content/contents.rdf
new file mode 100644
index 00000000000..e21e80a5f57
--- /dev/null
+++ b/mozilla/toolkit/components/passwordmgr/resources/content/contents.rdf
@@ -0,0 +1,18 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/mozilla/toolkit/components/passwordmgr/resources/content/passwordManager.js b/mozilla/toolkit/components/passwordmgr/resources/content/passwordManager.js
new file mode 100644
index 00000000000..803f9211482
--- /dev/null
+++ b/mozilla/toolkit/components/passwordmgr/resources/content/passwordManager.js
@@ -0,0 +1,511 @@
+# -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+#
+# The contents of this file are subject to the Netscape Public
+# License Version 1.1 (the "License"); you may not use this file
+# except in compliance with the License. You may obtain a copy of
+# the License at http://www.mozilla.org/NPL/
+#
+# Software distributed under the License is distributed on an "AS
+# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+# implied. See the License for the specific language governing
+# rights and limitations under the License.
+#
+# The Original Code is Mozilla Communicator client code, released March
+# 31, 1998.
+#
+# The Initial Developer of the Original Code is Netscape Communications
+# Corporation. Portions created by Netscape are
+# Copyright (C) 1998 Netscape Communications Corporation. All
+# Rights Reserved.
+#
+# Contributor(s):
+# Ben "Count XULula" Goodger
+# Brian Ryner
+
+/*** =================== INITIALISATION CODE =================== ***/
+
+var kObserverService;
+var kSignonBundle;
+var gSelectUserInUse = false;
+
+// interface variables
+var passwordmanager = null;
+
+// password-manager lists
+var signons = [];
+var rejects = [];
+var deletedSignons = [];
+var deletedRejects = [];
+
+function Startup() {
+ // xpconnect to password manager interfaces
+ passwordmanager = Components.classes["@mozilla.org/passwordmanager;1"].getService(Components.interfaces.nsIPasswordManager);
+
+ kSignonBundle = document.getElementById("signonBundle");
+
+ // be prepared to reload the display if anything changes
+ kObserverService = Components.classes["@mozilla.org/observer-service;1"].getService(Components.interfaces.nsIObserverService);
+ kObserverService.addObserver(signonReloadDisplay, "signonChanged", false);
+
+ // be prepared to disable the buttons when selectuser dialog is in use
+ kObserverService.addObserver(signonReloadDisplay, "signonSelectUser", false);
+
+ signonsTree = document.getElementById("signonsTree");
+ rejectsTree = document.getElementById("rejectsTree");
+
+ // set initial password-manager tab
+ var tabBox = document.getElementById("tabbox");
+ tabBox.selectedTab = document.getElementById("signonsTab");
+
+ // load password manager items
+ if (!LoadSignons()) {
+ return; /* user failed to unlock the database */
+ }
+ LoadRejects();
+
+
+ // label the close button
+ document.documentElement.getButton("accept").label = kSignonBundle.getString("close");
+}
+
+function Shutdown() {
+ if (isPasswordManager) {
+ kObserverService.removeObserver(signonReloadDisplay, "signonChanged");
+ kObserverService.removeObserver(signonReloadDisplay, "signonSelectUser");
+ }
+}
+
+var signonReloadDisplay = {
+ observe: function(subject, topic, state) {
+ if (topic == "signonChanged") {
+ if (state == "signons") {
+ signons.length = 0;
+ if (lastSignonSortColumn == "host") {
+ lastSignonSortAscending = !lastSignonSortAscending; // prevents sort from being reversed
+ }
+ LoadSignons();
+ } else if (state == "rejects") {
+ rejects.length = 0;
+ if (lastRejectSortColumn == "host") {
+ lastRejectSortAscending = !lastRejectSortAscending; // prevents sort from being reversed
+ }
+ LoadRejects();
+ }
+ } else if (topic == "signonSelectUser") {
+ if (state == "suspend") {
+ gSelectUserInUse = true;
+ document.getElementById("removeSignon").disabled = true;
+ document.getElementById("removeAllSignons").disabled = true;
+ } else if (state == "resume") {
+ gSelectUserInUse = false;
+ var selections = GetTreeSelections(signonsTree);
+ if (selections.length > 0) {
+ document.getElementById("removeSignon").disabled = false;
+ }
+ if (signons.length > 0) {
+ document.getElementById("removeAllSignons").disabled = false;
+ }
+ } else if (state == "inUse") {
+ gSelectUserInUse = true;
+ }
+ }
+ }
+}
+
+/*** =================== SAVED SIGNONS CODE =================== ***/
+
+var signonsTreeView = {
+ rowCount : 0,
+ setTree : function(tree){},
+ getImageSrc : function(row,column) {},
+ getProgressMode : function(row,column) {},
+ getCellValue : function(row,column) {},
+ getCellText : function(row,column){
+ var rv="";
+ if (column=="siteCol") {
+ rv = signons[row].host;
+ } else if (column=="userCol") {
+ rv = signons[row].user;
+ }
+ return rv;
+ },
+ isSeparator : function(index) {return false;},
+ isSorted: function() { return false; },
+ isContainer : function(index) {return false;},
+ cycleHeader : function(aColId, aElt) {},
+ getRowProperties : function(row,column,prop){},
+ getColumnProperties : function(column,columnElement,prop){},
+ getCellProperties : function(row,prop){}
+ };
+var signonsTree;
+
+function Signon(number, host, user, rawuser) {
+ this.number = number;
+ this.host = host;
+ this.user = user;
+ this.rawuser = rawuser;
+}
+
+function LoadSignons() {
+ // loads signons into table
+ var enumerator = passwordmanager.enumerator;
+ var count = 0;
+
+ while (enumerator.hasMoreElements()) {
+ var nextPassword;
+ try {
+ nextPassword = enumerator.getNext();
+ } catch(e) {
+ /* user supplied invalid database key */
+ window.close();
+ return false;
+ }
+ nextPassword = nextPassword.QueryInterface(Components.interfaces.nsIPassword);
+ var host = nextPassword.host;
+ var user = nextPassword.user;
+ var rawuser = user;
+
+ // if no username supplied, try to parse it out of the url
+ if (user == "") {
+ var unused = { };
+ var ioService = Components.classes["@mozilla.org/network/io-service;1"]
+ .getService(Components.interfaces.nsIIOService);
+ var username;
+ try {
+ username = ioService.newURI(host, null, null).username;
+ } catch(e) {
+ username = "";
+ }
+ if (username != "") {
+ user = username;
+ } else {
+ user = "<>";
+ }
+ }
+
+ signons[count] = new Signon(count++, host, user, rawuser);
+ }
+ signonsTreeView.rowCount = signons.length;
+
+ // sort and display the table
+ signonsTree.treeBoxObject.view = signonsTreeView;
+ SignonColumnSort('host');
+
+ // disable "remove all signons" button if there are no signons
+ var element = document.getElementById("removeAllSignons");
+ if (signons.length == 0 || gSelectUserInUse) {
+ element.setAttribute("disabled","true");
+ } else {
+ element.removeAttribute("disabled");
+ }
+
+ return true;
+}
+
+function SignonSelected() {
+ var selections = GetTreeSelections(signonsTree);
+ if (selections.length && !gSelectUserInUse) {
+ document.getElementById("removeSignon").removeAttribute("disabled");
+ }
+}
+
+function DeleteSignon() {
+ DeleteSelectedItemFromTree(signonsTree, signonsTreeView,
+ signons, deletedSignons,
+ "removeSignon", "removeAllSignons");
+ FinalizeSignonDeletions();
+}
+
+function DeleteAllSignons() {
+ DeleteAllFromTree(signonsTree, signonsTreeView,
+ signons, deletedSignons,
+ "removeSignon", "removeAllSignons");
+ FinalizeSignonDeletions();
+}
+
+function FinalizeSignonDeletions() {
+ for (var s=0; s= 0; s--) {
+ var i = selections[s];
+ deletedTable[deletedTable.length] = table[i];
+ table[i] = null;
+ }
+
+ // collapse list by removing all the null entries
+ for (var j=0; j (table.length-1) ) {
+ firstRow = table.length-1;
+ }
+ view.rowCount = table.length;
+ box.rowCountChanged(0, table.length);
+ box.scrollToRow(firstRow)
+
+ // update selection and/or buttons
+ if (table.length) {
+
+ // update selection
+ // note: we need to deselect before reselecting in order to trigger ...Selected method
+ var nextSelection = (selections[0] < table.length) ? selections[0] : table.length-1;
+ tree.treeBoxObject.view.selection.select(-1);
+ tree.treeBoxObject.view.selection.select(nextSelection);
+
+ } else {
+
+ // disable buttons
+ document.getElementById(removeButton).setAttribute("disabled", "true")
+ document.getElementById(removeAllButton).setAttribute("disabled","true");
+
+ // clear out selections
+ tree.treeBoxObject.view.selection.select(-1);
+ }
+}
+
+function GetTreeSelections(tree) {
+ var selections = [];
+ var select = tree.treeBoxObject.selection;
+ if (select) {
+ var count = select.getRangeCount();
+ var min = new Object();
+ var max = new Object();
+ for (var i=0; i second[column])
+ return 1;
+ return 0;
+ }
+ } else {
+ compareFunc = function compare(first, second) {
+ if (first[column] < second[column])
+ return 1;
+ if (first[column] > second[column])
+ return -1;
+ return 0;
+ }
+ }
+ table.sort(compareFunc);
+
+ // restore the selection
+ var selectedRow = -1;
+ if (selectedNumber>=0 && updateSelection) {
+ for (var s=0; s= 0) {
+ tree.treeBoxObject.ensureRowIsVisible(selectedRow)
+ }
+
+ return ascending;
+}
diff --git a/mozilla/toolkit/components/passwordmgr/resources/content/passwordManager.xul b/mozilla/toolkit/components/passwordmgr/resources/content/passwordManager.xul
new file mode 100644
index 00000000000..baac73adde9
--- /dev/null
+++ b/mozilla/toolkit/components/passwordmgr/resources/content/passwordManager.xul
@@ -0,0 +1,99 @@
+
+# The contents of this file are subject to the Netscape Public
+# License Version 1.1 (the "License"); you may not use this file
+# except in compliance with the License. You may obtain a copy of
+# the License at http://www.mozilla.org/NPL/
+#
+# Software distributed under the License is distributed on an "AS
+# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+# implied. See the License for the specific language governing
+# rights and limitations under the License.
+#
+# The Original Code is Mozilla Communicator client code, released
+# March 31, 1998.
+#
+# The Initial Developer of the Original Code is Netscape
+# Communications Corporation. Portions created by Netscape are
+# Copyright (C) 1998-1999 Netscape Communications Corporation. All
+# Rights Reserved.
+#
+# Contributor(s):
+# Ben Goodger
+# Brian Ryner
+
+
+
+
+
+
diff --git a/mozilla/toolkit/components/passwordmgr/resources/jar.mn b/mozilla/toolkit/components/passwordmgr/resources/jar.mn
index 3bf51b0a292..79bb14fd982 100644
--- a/mozilla/toolkit/components/passwordmgr/resources/jar.mn
+++ b/mozilla/toolkit/components/passwordmgr/resources/jar.mn
@@ -1,8 +1,9 @@
toolkit.jar:
-* content/passwordmgr/passwordManager.xul
-* content/passwordmgr/passwordManager.js
-* content/passwordmgr/passwordManager.css
+ content/passwordmgr/contents.rdf (content/contents.rdf)
+* content/passwordmgr/passwordManager.xul (content/passwordManager.xul)
+* content/passwordmgr/passwordManager.js (content/passwordManager.js)
en-US.jar:
-* locale/en-US/passwordmgr/passwordmgr.properties
-* locale/en-US/passwordmgr/passwordManager.dtd
+ locale/en-US/passwordmgr/contents.rdf (locale/contents.rdf)
+* locale/en-US/passwordmgr/passwordmgr.properties (locale/passwordmgr.properties)
+* locale/en-US/passwordmgr/passwordManager.dtd (locale/passwordManager.dtd)
diff --git a/mozilla/toolkit/components/passwordmgr/resources/locale/contents.rdf b/mozilla/toolkit/components/passwordmgr/resources/locale/contents.rdf
new file mode 100644
index 00000000000..d9e61b08089
--- /dev/null
+++ b/mozilla/toolkit/components/passwordmgr/resources/locale/contents.rdf
@@ -0,0 +1,26 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/mozilla/toolkit/components/passwordmgr/resources/passwordManager.css b/mozilla/toolkit/components/passwordmgr/resources/locale/passwordManager.dtd
similarity index 71%
rename from mozilla/toolkit/components/passwordmgr/resources/passwordManager.css
rename to mozilla/toolkit/components/passwordmgr/resources/locale/passwordManager.dtd
index 7e96ad50c82..54ed1797ff6 100644
--- a/mozilla/toolkit/components/passwordmgr/resources/passwordManager.css
+++ b/mozilla/toolkit/components/passwordmgr/resources/locale/passwordManager.dtd
@@ -35,4 +35,14 @@
#
# ***** END LICENSE BLOCK *****
-@import url("chrome://global/skin");
+
+
+
+
+
+
+
+
+
+
+
diff --git a/mozilla/toolkit/components/passwordmgr/resources/passwordmgr.properties b/mozilla/toolkit/components/passwordmgr/resources/locale/passwordmgr.properties
similarity index 99%
rename from mozilla/toolkit/components/passwordmgr/resources/passwordmgr.properties
rename to mozilla/toolkit/components/passwordmgr/resources/locale/passwordmgr.properties
index 643564cb1cb..638d04712df 100644
--- a/mozilla/toolkit/components/passwordmgr/resources/passwordmgr.properties
+++ b/mozilla/toolkit/components/passwordmgr/resources/locale/passwordmgr.properties
@@ -40,3 +40,4 @@ rememberPassword = Use Password Manager to remember this password.
savePasswordTitle = Confirm
savePasswordText = Password Manager can remember this logon and enter it automatically the next time you return to this website.\nDo you want Password Manager to remember this logon?
neverForSite = Never for this site
+close = Close
diff --git a/mozilla/toolkit/components/passwordmgr/resources/passwordManager.dtd b/mozilla/toolkit/components/passwordmgr/resources/passwordManager.dtd
deleted file mode 100644
index 62a9fc719e7..00000000000
--- a/mozilla/toolkit/components/passwordmgr/resources/passwordManager.dtd
+++ /dev/null
@@ -1,46 +0,0 @@
-# ***** BEGIN LICENSE BLOCK *****
-# Version: MPL 1.1/GPL 2.0/LGPL 2.1
-#
-# The contents of this file are subject to the Mozilla Public License Version
-# 1.1 (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-# http://www.mozilla.org/MPL/
-#
-# Software distributed under the License is distributed on an "AS IS" basis,
-# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
-# for the specific language governing rights and limitations under the
-# License.
-#
-# The Original Code is Mozilla Password Manager.
-#
-# The Initial Developer of the Original Code is
-# Brian Ryner.
-# Portions created by the Initial Developer are Copyright (C) 2003
-# the Initial Developer. All Rights Reserved.
-#
-# Contributor(s):
-# Brian Ryner
-#
-# Alternatively, the contents of this file may be used under the terms of
-# either the GNU General Public License Version 2 or later (the "GPL"), or
-# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
-# in which case the provisions of the GPL or the LGPL are applicable instead
-# of those above. If you wish to allow use of your version of this file only
-# under the terms of either the GPL or the LGPL, and not to allow others to
-# use your version of this file under the terms of the MPL, indicate your
-# decision by deleting the provisions above and replace them with the notice
-# and other provisions required by the LGPL or the GPL. If you do not delete
-# the provisions above, a recipient may use your version of this file under
-# the terms of any one of the MPL, the GPL or the LGPL.
-#
-# ***** END LICENSE BLOCK *****
-
-
-
-
-
-
-
-
-
-
diff --git a/mozilla/toolkit/components/passwordmgr/resources/passwordManager.js b/mozilla/toolkit/components/passwordmgr/resources/passwordManager.js
deleted file mode 100644
index b36e6283d13..00000000000
--- a/mozilla/toolkit/components/passwordmgr/resources/passwordManager.js
+++ /dev/null
@@ -1,91 +0,0 @@
-# -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
-# ***** BEGIN LICENSE BLOCK *****
-# Version: MPL 1.1/GPL 2.0/LGPL 2.1
-#
-# The contents of this file are subject to the Mozilla Public License Version
-# 1.1 (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-# http://www.mozilla.org/MPL/
-#
-# Software distributed under the License is distributed on an "AS IS" basis,
-# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
-# for the specific language governing rights and limitations under the
-# License.
-#
-# The Original Code is Mozilla Password Manager.
-#
-# The Initial Developer of the Original Code is
-# Brian Ryner.
-# Portions created by the Initial Developer are Copyright (C) 2003
-# the Initial Developer. All Rights Reserved.
-#
-# Contributor(s):
-# Brian Ryner
-#
-# Alternatively, the contents of this file may be used under the terms of
-# either the GNU General Public License Version 2 or later (the "GPL"), or
-# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
-# in which case the provisions of the GPL or the LGPL are applicable instead
-# of those above. If you wish to allow use of your version of this file only
-# under the terms of either the GPL or the LGPL, and not to allow others to
-# use your version of this file under the terms of the MPL, indicate your
-# decision by deleting the provisions above and replace them with the notice
-# and other provisions required by the GPL or the LGPL. If you do not delete
-# the provisions above, a recipient may use your version of this file under
-# the terms of any one of the MPL, the GPL or the LGPL.
-#
-# ***** END LICENSE BLOCK *****
-
-var passwordManager;
-
-const nsIPasswordManager = Components.interfaces.nsIPasswordManager;
-const nsPasswordManager_CONTRACTID = "@mozilla.org/passwordmanager;1";
-const nsIPassword = Components.interfaces.nsIPassword;
-
-function Startup()
-{
- passwordManager = Components.classes[nsPasswordManager_CONTRACTID].getService(nsIPasswordManager);
- updateSignonList();
- updateButtons();
-}
-
-
-function updateSignonList()
-{
- var signonTree = document.getElementById('signonsTree');
- // xxx quick hack: insert rows one at a time
- var treeChildren = signonTree.getElementsByTagName('treechildren')[0];
-
- var enumerator = passwordManager.enumerator;
- while (enumerator.hasMoreElements()) {
- var nextPassword = enumerator.getNext().QueryInterface(nsIPassword);
- var treeItem = document.createElement('treeitem');
- var treeRow = document.createElement('treerow');
- var hostCell = document.createElement('treecell');
- var userCell = document.createElement('treecell');
-
- hostCell.setAttribute('label', nextPassword.host);
- userCell.setAttribute('label', nextPassword.user);
-
- treeRow.appendChild(hostCell);
- treeRow.appendChild(userCell);
- treeItem.appendChild(treeRow);
- treeChildren.appendChild(treeItem);
- }
-}
-
-function updateButtons()
-{
- // update remove signon button enabled state
-}
-
-function deleteSignon()
-{
- var tree = document.getElementById('signonsTree');
- var index = tree.currentIndex;
-
- var host = tree.boxObject.view.getCellText(index, 'hostColumn');
- var user = tree.boxObject.view.getCellText(index, 'userColumn');
-
- passwordManager.removeUser(host, user);
-}
diff --git a/mozilla/toolkit/components/passwordmgr/resources/passwordManager.xul b/mozilla/toolkit/components/passwordmgr/resources/passwordManager.xul
deleted file mode 100644
index 6aa869c5248..00000000000
--- a/mozilla/toolkit/components/passwordmgr/resources/passwordManager.xul
+++ /dev/null
@@ -1,101 +0,0 @@
-
-# ***** BEGIN LICENSE BLOCK *****
-# Version: MPL 1.1/GPL 2.0/LGPL 2.1
-#
-# The contents of this file are subject to the Mozilla Public License Version
-# 1.1 (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-# http://www.mozilla.org/MPL/
-#
-# Software distributed under the License is distributed on an "AS IS" basis,
-# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
-# for the specific language governing rights and limitations under the
-# License.
-#
-# The Original Code is Mozilla Password Manager.
-#
-# The Initial Developer of the Original Code is
-# Brian Ryner.
-# Portions created by the Initial Developer are Copyright (C) 2003
-# the Initial Developer. All Rights Reserved.
-#
-# Contributor(s):
-# Brian Ryner
-#
-# Alternatively, the contents of this file may be used under the terms of
-# either the GNU General Public License Version 2 or later (the "GPL"), or
-# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
-# in which case the provisions of the GPL or the LGPL are applicable instead
-# of those above. If you wish to allow use of your version of this file only
-# under the terms of either the GPL or the LGPL, and not to allow others to
-# use your version of this file under the terms of the MPL, indicate your
-# decision by deleting the provisions above and replace them with the notice
-# and other provisions required by the GPL or the LGPL. If you do not delete
-# the provisions above, a recipient may use your version of this file under
-# the terms of any one of the MPL, the GPL or the LGPL.
-#
-# ***** END LICENSE BLOCK *****
-
-
-
-
-
-