Index: browser/app/nsBrowserApp.cpp
===================================================================
RCS file: /cvsroot/mozilla/browser/app/nsBrowserApp.cpp,v
retrieving revision 1.18
diff -p -u -8 -r1.18 nsBrowserApp.cpp
--- browser/app/nsBrowserApp.cpp	7 Dec 2004 04:52:57 -0000	1.18
+++ browser/app/nsBrowserApp.cpp	21 Feb 2005 11:20:53 -0000
@@ -40,17 +40,17 @@
 #ifdef XP_WIN
 #include <windows.h>
 #include <stdlib.h>
 #endif
 #include "nsBuildID.h"
 
 static const nsXREAppData kAppData = {
   "Mozilla",
-  "Firefox",
+  "Firefox Debug",
   APP_VERSION,
   BUILD_ID,
   // ec8030f7-c20a-464f-9b0e-13a3a9e97384
   { 0xec8030f7, 0xc20a, 0x464f, { 0x9b, 0x0e, 0x13, 0xa3, 0xa9, 0xe9, 0x73, 0x84 } },
   "Copyright (c) 2004 mozilla.org",
   NS_XRE_ENABLE_PROFILE_MIGRATOR |
   NS_XRE_ENABLE_EXTENSION_MANAGER
 };
Index: browser/app/profile/firefox.js
===================================================================
RCS file: /cvsroot/mozilla/browser/app/profile/firefox.js,v
retrieving revision 1.35
diff -p -u -8 -r1.35 firefox.js
--- browser/app/profile/firefox.js	16 Dec 2004 09:10:23 -0000	1.35
+++ browser/app/profile/firefox.js	21 Feb 2005 11:20:54 -0000
@@ -227,20 +227,32 @@ pref("dom.disable_window_status_change",
 pref("browser.trim_user_and_password",            true);
 
 // popups.policy 1=allow,2=reject
 pref("privacy.popups.policy",               1);
 pref("privacy.popups.usecustom",            true);
 pref("privacy.popups.firstTime",            true);
 pref("privacy.popups.showBrowserMessage",   true);
  
+pref("privacy.item.history",    true);
+pref("privacy.item.formdata",   true);
+pref("privacy.item.passwords",  false);
+pref("privacy.item.downloads",  true);
+pref("privacy.item.cookies",    false);
+pref("privacy.item.cache",      true);
+pref("privacy.item.siteprefs",  false);
+
+pref("privacy.sanitize.sanitizeOnShutdown", false);
+pref("privacy.sanitize.promptOnSanitize", true);
+
 pref("network.proxy.share_proxy_settings",  false); // use the same proxy settings for all protocols
 
 pref("network.cookie.cookieBehavior",       0); // cookies enabled
 pref("network.cookie.enableForCurrentSessionOnly", false);
+pref("network.cookie.denyRemovedCookies", false);
 
 // l12n and i18n
 pref("intl.accept_languages", "chrome://global/locale/intl.properties");
 // collationOption is only set on linux for japanese. see bug 18338 and 62015
 // we need to check if this pref is still useful.
 pref("intl.collationOption",  "chrome://global-platform/locale/intl.properties");
 pref("intl.charsetmenu.browser.static", "chrome://global/locale/intl.properties");
 pref("intl.charsetmenu.browser.more1",  "chrome://global/locale/intl.properties");
@@ -322,8 +334,23 @@ pref("accessibility.typeaheadfind.timeou
 pref("accessibility.typeaheadfind.linksonly", false);
 pref("accessibility.typeaheadfind.flashBar", 1);
 
 // Disable the default plugin for firefox
 pref("plugin.default_plugin_disabled", true);
 
 // plugin finder service
 pref("pfs.datasource.url", "chrome://mozapps/locale/plugins/plugins.properties");
+
+#ifdef XP_WIN
+pref("browser.preferences.instantApply", false);
+#else
+pref("browser.preferences.instantApply", true);
+#endif
+#ifdef XP_MACOSX
+pref("browser.preferences.animateFadeIn", true);
+#else
+pref("browser.preferences.animateFadeIn", false);
+#endif
+pref("browser.display.screen_resolution", 96);
+
+pref("browser.download.show_plugins_in_list", true);
+pref("browser.download.hide_plugins_without_extensions", true);
Index: browser/base/jar.mn
===================================================================
RCS file: /cvsroot/mozilla/browser/base/jar.mn,v
retrieving revision 1.82
diff -p -u -8 -r1.82 jar.mn
--- browser/base/jar.mn	30 Nov 2004 08:22:43 -0000	1.82
+++ browser/base/jar.mn	21 Feb 2005 11:20:54 -0000
@@ -19,15 +19,17 @@ browser.jar:
         content/browser/monitor.png                   (content/monitor.png)
 *       content/browser/openLocation.js               (content/openLocation.js)
 *       content/browser/openLocation.xul              (content/openLocation.xul)
 *       content/browser/pageInfo.js                   (content/pageInfo.js)
 *       content/browser/pageInfo.xul                  (content/pageInfo.xul)
 *       content/browser/pageReport.js                 (content/pageReport.js)
 *       content/browser/pageReport.xul                (content/pageReport.xul)
 *       content/browser/pageReportFirstTime.xul       (content/pageReportFirstTime.xul)   
+*       content/browser/sanitize.js                   (content/sanitize.js)
+*       content/browser/sanitize.xul                  (content/sanitize.xul)
 *       content/browser/search.xml                    (content/search.xml)
 *       content/browser/searchbarBindings.css         (content/searchbarBindings.css)
 *       content/browser/searchconfig.properties       (content/searchconfig.properties)
 *       content/browser/setWallpaper.xul              (content/setWallpaper.xul)
 *       content/browser/utilityOverlay.js             (content/utilityOverlay.js)
 *       content/browser/web-panels.js                 (content/web-panels.js)
 *       content/browser/web-panels.xul                (content/web-panels.xul)
Index: browser/base/content/browser-menubar.inc
===================================================================
RCS file: /cvsroot/mozilla/browser/base/content/browser-menubar.inc,v
retrieving revision 1.42
diff -p -u -8 -r1.42 browser-menubar.inc
--- browser/base/content/browser-menubar.inc	6 Feb 2005 17:42:55 -0000	1.42
+++ browser/base/content/browser-menubar.inc	21 Feb 2005 11:20:54 -0000
@@ -392,17 +392,20 @@
                         oncommand="toJavaScriptConsole();"/>
 #ifdef XP_WIN
               <menuitem accesskey="&pageInfoCmd.accesskey;" label="&pageInfoCmd.label;"   
                         command="View:PageInfo"/>
 #else
               <menuitem accesskey="&pageInfoCmd.accesskey;" label="&pageInfoCmd.label;"   
                         key="key_viewInfo" command="View:PageInfo"/>
 #endif
-
+              <menuseparator id="sanitizeSeparator"/>
+              <menuitem id="sanitizeItem" 
+                        accesskey="&sanitizeCmd.accesskey;" label="&sanitizeCmd.label;"
+                        key="key_sanitize" command="Tools:Sanitize"/>
 #ifndef XP_UNIX
               <menuseparator id="prefSep"/>
               <menuitem id="menu_preferences"
                         label="&preferencesCmd.label;"
                         accesskey="&preferencesCmd.accesskey;"
                         oncommand="openPreferences();"/>
 #else
 #ifdef XP_MACOSX
Index: browser/base/content/browser-scripts.inc
===================================================================
RCS file: /cvsroot/mozilla/browser/base/content/browser-scripts.inc,v
retrieving revision 1.6
diff -p -u -8 -r1.6 browser-scripts.inc
--- browser/base/content/browser-scripts.inc	1 Feb 2005 17:36:48 -0000	1.6
+++ browser/base/content/browser-scripts.inc	21 Feb 2005 11:20:55 -0000
@@ -43,8 +43,9 @@
 <script type="application/x-javascript" src="chrome://global/content/printUtils.js"/>
 <script type="application/x-javascript" src="chrome://browser/content/utilityOverlay.js"/>
 <script type="application/x-javascript" src="chrome://browser/content/bookmarks/bookmarks.js"/>
 <script type="application/x-javascript" src="chrome://browser/content/bookmarks/bookmarksMenu.js"/>
 <script type="application/x-javascript" src="chrome://global/content/viewZoomOverlay.js"/>
 <script type="application/x-javascript" src="chrome://browser/content/contentAreaUtils.js"/>
 <script type="application/x-javascript" src="chrome://browser/content/browser.js"/>
 <script type="application/x-javascript" src="chrome://global/content/XPCNativeWrapper.js"/>
+<script type="application/x-javascript" src="chrome://browser/content/sanitize.js"/>
Index: browser/base/content/browser-sets.inc
===================================================================
RCS file: /cvsroot/mozilla/browser/base/content/browser-sets.inc,v
retrieving revision 1.35
diff -p -u -8 -r1.35 browser-sets.inc
--- browser/base/content/browser-sets.inc	1 Feb 2005 17:36:48 -0000	1.35
+++ browser/base/content/browser-sets.inc	21 Feb 2005 11:20:56 -0000
@@ -42,18 +42,18 @@
 #define XP_GNOME 1
 #endif
 #endif
 
   <stringbundleset id="stringbundleset"> 
     <stringbundle id="bundle_brand" src="chrome://global/locale/brand.properties"/>
     <stringbundle id="bundle_shell" src="chrome://browser/locale/shellservice.properties"/>
     <stringbundle id="bundle_browser" src="chrome://browser/locale/browser.properties"/>
-    <stringbundle id="bundle_findBar" src="chrome://browser/locale/browser.properties"/>
     <stringbundle id="bundle_browser_region" src="chrome://browser-region/locale/region.properties"/>
+    <stringbundle id="bundle_preferences" src="chrome://browser/locale/preferences/preferences.properties"/>
   </stringbundleset>
 
   <commandset commandupdater="true"
               events="focus"
               oncommandupdate="goUpdateGlobalEditMenuItems()"/>
   <commandset commandupdater="true"
               events="select"
               oncommandupdate="goUpdateSelectEditMenuItems()"/>
@@ -156,16 +156,17 @@
     <command id="Browser:OpenLocation" oncommand="openLocation();"/>
 
     <command id="Tools:Search" oncommand="focusSearchBar();"/>    
     <command id="Tools:Downloads" oncommand="toOpenWindowByType('Download:Manager', 
                                                                 'chrome://mozapps/content/downloads/downloads.xul',
                                                                 'chrome,dialog=no,resizable');"/>
     <command id="Tools:Extensions" oncommand="BrowserOpenExtensions('extensions');"/>
     <command id="Tools:Themes" oncommand="BrowserOpenExtensions('themes');"/>
+    <command id="Tools:Sanitize" oncommand="gSanitizeListener.sanitize(window || null);"/>
     
 #ifdef XP_MACOSX
     <command id="minimizeWindow" label="&minimizeWindow.label;" oncommand="window.minimize();" />
     <command id="zoomWindow" label="&zoomWindow.label;" oncommand="zoomWindow();" />
 #endif
   </commandset>
 
   <broadcasterset id="mainBroadcasterSet">
@@ -322,10 +323,11 @@
     <key                          key="&textZoomEnlargeCmd.commandkey2;" command="cmd_textZoomEnlarge" modifiers="accel"/>
     <key id="key_textZoomReset"   key="&textZoomResetCmd.commandkey;"    command="cmd_textZoomReset"   modifiers="accel"/>
     
     <key id="key_switchTextDirection" key="&bidiSwitchTextDirectionItem.commandkey;" command="cmd_switchTextDirection" modifiers="accel,shift" />
 #ifdef XP_MACOSX
     <key id="key_minimizeWindow" command="minimizeWindow" key="&minimizeWindow.key;" modifiers="accel"/>
 #endif
 
+    <key id="key_sanitize" command="Tools:Sanitize" keycode="VK_DELETE" modifiers="accel,shift"/>
   </keyset>
 
Index: browser/base/content/browser.js
===================================================================
RCS file: /cvsroot/mozilla/browser/base/content/browser.js,v
retrieving revision 1.382
diff -p -u -8 -r1.382 browser.js
--- browser/base/content/browser.js	19 Feb 2005 06:16:18 -0000	1.382
+++ browser/base/content/browser.js	21 Feb 2005 11:21:00 -0000
@@ -85,16 +85,18 @@ var appCore = null;
 var gBrowser = null;
 var gSidebarCommand = "";
 
 // Global variable that holds the nsContextMenu instance.
 var gContextMenu = null;
 
 var gChromeState = null; // chrome state before we went into print preview
 
+var gSanitizeListener = null;
+
 var gFormFillPrefListener = null;
 var gFormHistory = null;
 var gFormFillEnabled = true;
 
 var gURLBarAutoFillPrefListener = null;
 var gAutoHideTabbarPrefListener = null;
 
 /**
@@ -196,17 +198,16 @@ const gPopupBlockerObserver = {
   _kIPM: Components.interfaces.nsIPermissionManager,
   
   onUpdatePageReport: function ()
   {
     if (!this._reportButton) 
       this._reportButton = document.getElementById("page-report-button");
     
     if (gBrowser.selectedBrowser.pageReport) {
-    dump("*** intergoat\n");
       this._reportButton.setAttribute("blocked", "true");
       if (gPrefService && gPrefService.getBoolPref("privacy.popups.showBrowserMessage")) {
         var bundle_browser = document.getElementById("bundle_browser");
         var brandBundle = document.getElementById("bundle_brand");
         var brandShortName = brandBundle.getString("brandShortName");
         var message;
         var popupCount = gBrowser.selectedBrowser.pageReport.length;
         if (popupCount > 1) 
@@ -344,31 +345,34 @@ const gPopupBlockerObserver = {
   {
     var host = "";
     try {
       var uri = gBrowser.selectedBrowser.webNavigation.currentURI;
       host = uri.host;
     }
     catch (e) { } 
 
+    var bundlePreferences = document.getElementById("bundle_preferences");
+    var params = { blockVisible   : false, 
+                   sessionVisible : false, 
+                   allowVisible   : true, 
+                   prefilledHost  : host, 
+                   permissionType : "popup",
+                   windowTitle    : bundlePreferences.getString("popuppermissionstitle"),
+                   introText      : bundlePreferences.getString("popuppermissionstext") };
     var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"]
                         .getService(Components.interfaces.nsIWindowMediator);
-    var existingWindow = wm.getMostRecentWindow("exceptions");
+    var existingWindow = wm.getMostRecentWindow("Browser:Permissions");
     if (existingWindow) {
-      existingWindow.setHost(host);
+      existingWindow.initWithParams(params);
       existingWindow.focus();
     }
-    else {
-      var params = { blockVisible: false, 
-                     allowVisible: true, 
-                     prefilledHost: host, 
-                     permissionType: "popup" };
-      window.openDialog("chrome://browser/content/cookieviewer/CookieExceptions.xul?permission=popup",
-                        "_blank", "chrome,modal,resizable=yes", params);
-    }
+    else
+      window.openDialog("chrome://browser/content/preferences/permissions.xul",
+                        "_blank", "resizable,dialog=no,centerscreen", params);
   },
   
   dontShowMessage: function ()
   {
     var showMessage = gPrefService.getBoolPref("privacy.popups.showBrowserMessage");
     var firstTime = gPrefService.getBoolPref("privacy.popups.firstTime");
     
     // If the info message is showing at the top of the window, and the user has never 
@@ -474,32 +478,35 @@ const gXPInstallObserver = {
         openDialog("chrome://browser/content/pref/pref.xul", "PrefWindow",
                    "chrome,titlebar,resizable,modal", "catFeaturesbutton");
       var tabbrowser = getBrowser();
       tabbrowser.hideMessage(tabbrowser.selectedBrowser, "top");
       break;
     case "xpinstall-install-edit-permissions":
       var browser = this._getBrowser(aSubject.QueryInterface(Components.interfaces.nsIDocShell));
       if (browser) {
+        var bundlePreferences = document.getElementById("bundle_preferences");
+        var params = { blockVisible   : false, 
+                       sessionVisible : false, 
+                       allowVisible   : true, 
+                       prefilledHost  : webNav.currentURI.host, 
+                       permissionType : "install",
+                       windowTitle    : bundlePreferences.getString("installpermissionstitle"),
+                       introText      : bundlePreferences.getString("installpermissionstext") };
         var webNav = aSubject.QueryInterface(Components.interfaces.nsIWebNavigation);
         var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"]
                           .getService(Components.interfaces.nsIWindowMediator);
-        var existingWindow = wm.getMostRecentWindow("exceptions");
+        var existingWindow = wm.getMostRecentWindow("Browser:Permissions");
         if (existingWindow) {
-          existingWindow.setHost(webNav.currentURI.host);
+          existingWindow.initWithParams(params);
           existingWindow.focus();
         }
-        else {
-          var params = { blockVisible:    false,
-                         allowVisible:    true,
-                         prefilledHost:   webNav.currentURI.host,
-                         permissionType:  "install" };
-          window.openDialog("chrome://browser/content/cookieviewer/CookieExceptions.xul?permission=install",
-                            "_blank", "chrome,modal,resizable=yes", params);
-        }
+        else
+          window.openDialog("chrome://browser/content/preferences/permissions.xul",
+                            "_blank", "resizable,dialog=no,centerscreen", params);
               
         var tabbrowser = getBrowser();
         tabbrowser.hideMessage(tabbrowser.selectedBrowser, "top");
       }
       break;
     }
   }
 };
@@ -766,16 +773,19 @@ function delayedStartup()
     }
   }
 
   SetPageProxyState("invalid", null);
 
   var toolbox = document.getElementById("navigator-toolbox");
   toolbox.customizeDone = BrowserToolboxCustomizeDone;
 
+  // Set up Sanitize Item
+  gSanitizeListener = new SanitizeListener();
+
   var pbi = gPrefService.QueryInterface(Components.interfaces.nsIPrefBranchInternal);
 
   // Enable/Disable Form Fill
   gFormFillPrefListener = new FormFillPrefListener();
   pbi.addObserver(gFormFillPrefListener.domain, gFormFillPrefListener, false);
   gFormFillPrefListener.toggleFormFill();
 
   // Enable/Disable URL Bar Auto Fill
@@ -784,51 +794,16 @@ function delayedStartup()
 
   // Enable/Disbale auto-hide tabbar
   gAutoHideTabbarPrefListener = new AutoHideTabbarPrefListener();
   pbi.addObserver(gAutoHideTabbarPrefListener.domain, gAutoHideTabbarPrefListener, false);
 
   pbi.addObserver(gHomeButton.prefDomain, gHomeButton, false);
   gHomeButton.updateTooltip();
   
-  // Initialize Plugin Overrides
-  const kOverridePref = "browser.download.pluginOverrideTypes";
-  if (gPrefService.prefHasUserValue(kOverridePref)) {
-    var types = gPrefService.getCharPref(kOverridePref);
-    types = types.split(",");
-    
-    const kPluginOverrideTypesNotHandled = "browser.download.pluginOverrideTypesNotHandled";
-    
-    var catman = Components.classes["@mozilla.org/categorymanager;1"].getService(Components.interfaces.nsICategoryManager);
-    var typesNotHandled = "";
-    for (var i = 0; i < types.length; ++i) {
-      // Keep track of all overrides for plugins that aren't actually installed,
-      // so we know not to show them in the plugin configuration dialog BUT 
-      // don't delete the overrides such that when the user actually installs the 
-      // plugin in this build their preferences are remembered.
-      try {
-        var catEntry = catman.getCategoryEntry("Gecko-Content-Viewers", types[i]);
-      }
-      catch (e) {
-        catEntry = "";
-      }
-      if (catEntry == "")
-        typesNotHandled += types[i] + ",";
-    
-      catman.deleteCategoryEntry("Gecko-Content-Viewers", types[i], false);
-    }
-    
-    if (typesNotHandled) {
-      typesNotHandled = typesNotHandled.substr(0, typesNotHandled.length - 1);
-      gPrefService.setCharPref(kPluginOverrideTypesNotHandled, typesNotHandled);
-    }
-    else if (gPrefService.prefHasUserValue(kPluginOverrideTypesNotHandled))
-      gPrefService.clearUserPref(kPluginOverrideTypesNotHandled);
-  }
-
   gClickSelectsAll = gPrefService.getBoolPref("browser.urlbar.clickSelectsAll");
 
   clearObsoletePrefs();
  
 #ifdef HAVE_SHELL_SERVICE
   // Perform default browser checking (after window opens).
   var shell = getShellService();
   if (shell) {
@@ -1116,16 +1091,90 @@ AutoHideTabbarPrefListener.prototype =
 
     if (gBrowser.tabContainer.childNodes.length == 1) {
       gBrowser.setStripVisibilityTo(aVisible);
       gPrefService.setBoolPref("browser.tabs.forceHide", false);
     }
   }
 }
 
+function SanitizeListener()
+{
+  var pbi = gPrefService.QueryInterface(Components.interfaces.nsIPrefBranchInternal);
+  pbi.addObserver(this.promptDomain, this, false);
+
+  this._setSanitizeItem();
+  
+  if (gPrefService.prefHasUserValue(this.didSanitizeDomain))
+    gPrefService.clearUserPref(this.didSanitizeDomain)
+    
+  this._os = Components.classes["@mozilla.org/observer-service;1"]
+                       .getService(Components.interfaces.nsIObserverService);
+  this._os.addObserver(this, "quit-application-granted", false);
+}
+
+SanitizeListener.prototype =
+{
+  promptDomain      : "privacy.sanitize.promptOnSanitize",
+  shutdownDomain    : "privacy.sanitize.sanitizeOnShutdown",
+  didSanitizeDomain : "privacy.sanitize.didShutdownSanitize",
+  
+  observe: function (aSubject, aTopic, aPrefName)
+  {
+    switch (aTopic) {
+    case "nsPref:changed":
+      if (aPrefName != this.promptDomain)
+        return;
+      this._setSanitizeItem();
+      break;
+    case "quit-application-granted":
+      var pbi = gPrefService.QueryInterface(Components.interfaces.nsIPrefBranchInternal);
+      pbi.removeObserver(this.promptDomain, this);
+
+      this._os.removeObserver(this, "quit-application-granted");
+      
+      if (gPrefService.getBoolPref(this.shutdownDomain) &&
+          !gPrefService.prefHasUserValue(this.didSanitizeDomain)) {
+        this.sanitize(null);
+        gPrefService.setBoolPref(this.didSanitizeDomain, true);
+      }
+      break;
+    }
+  },
+  
+  _setSanitizeItem: function ()
+  {
+    var shouldPrompt = gPrefService.getBoolPref(this.promptDomain);
+    if (shouldPrompt) {
+      var sanitizeItem = document.getElementById("sanitizeItem");
+      var bundleBrowser = document.getElementById("bundle_browser");
+      var bundleBrand = document.getElementById("bundle_brand");
+      var brandShortName = bundleBrand.getString("brandShortName");
+      sanitizeItem.label = bundleBrowser.getFormattedString("sanitizeWithPromptLabel", 
+                                                            [brandShortName]);
+    }
+  },
+  
+  sanitize: function (aParentWindow)
+  {
+    var promptOnSanitize = gPrefService.getBoolPref("privacy.sanitize.promptOnSanitize");
+    if (promptOnSanitize) { 
+      var ww = Components.classes["@mozilla.org/embedcomp/window-watcher;1"]
+                         .getService(Components.interfaces.nsIWindowWatcher);
+      ww.openWindow(aParentWindow, 
+                    "chrome://browser/content/sanitize.xul", 
+                    "Sanitize", 
+                    "chrome,titlebar,centerscreen,modal",
+                    null);
+    }
+    else
+      (new Sanitizer()).sanitize();
+  },
+}
+
 function ctrlNumberTabSelection(event)
 {  
   if (event.altKey && event.keyCode == KeyEvent.DOM_VK_RETURN) {    
     // XXXblake Proper fix is to just check whether focus is in the urlbar. However, focus with the autocomplete widget is all
     // hacky and broken and there's no way to do that right now. So this just patches it to ensure that alt+enter works when focus
     // is on a link.
     if (!document.commandDispatcher.focusedElement || document.commandDispatcher.focusedElement.localName.toLowerCase() != "a") {
       // Don't let winxp beep on ALT+ENTER, since the URL bar uses it.
@@ -3609,18 +3658,27 @@ function asyncFocusSearchBox(event)
   var searchBox = sidebar.contentDocument.getElementById("search-box");
   if (searchBox)
     searchBox.focus();
   sidebar.removeEventListener("load", asyncFocusSearchBox, true);
  }
 
 function openPreferences()
 {
-  openDialog("chrome://browser/content/pref/pref.xul","PrefWindow", 
-             "chrome,titlebar,resizable,modal");
+  var instantApply = gPrefService.getBoolPref("browser.preferences.instantApply");
+  var features = "chrome,titlebar,centerscreen" + (instantApply ? "" : ",modal");
+
+  var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"]
+                     .getService(Components.interfaces.nsIWindowMediator);
+  var win = wm.getMostRecentWindow("Browser:Preferences");
+  if (win)
+    win.focus();
+  else 
+    openDialog("chrome://browser/content/preferences/preferences.xul", 
+               "Preferences", features);
 }
 
 var gHomeButton = {
   prefDomain: "browser.startup.homepage",
   observe: function (aSubject, aTopic, aPrefName)
   {
     if (aTopic != "nsPref:changed" || aPrefName != this.prefDomain)
       return;
Index: browser/base/content/credits.xhtml
===================================================================
RCS file: /cvsroot/mozilla/browser/base/content/credits.xhtml,v
retrieving revision 1.3
diff -p -u -8 -r1.3 credits.xhtml
--- browser/base/content/credits.xhtml	2 Feb 2005 13:21:56 -0000	1.3
+++ browser/base/content/credits.xhtml	21 Feb 2005 11:21:00 -0000
@@ -243,16 +243,17 @@
             <li>Logan Ingalls</li>
             <li>David P. James</li>
             <li>Glen Johnson</li>
             <li>Michael Kaply</li>
             <li>R.J. Keller</li>
             <li>John Keiser</li>
             <li>Jason Kersey</li>
             <li>Marcia Knous</li>
+            <li>Aaron Leventhal</li>
             <li>Will Levine</li>
             <li>Sarah Liberman</li>
             <li>Scott MacGregor</li>
             <li>Daniel Matejka</li>
             <li>Myk Melez</li>
             <li>Bernd Mielke</li>
             <li>Noririty</li>
             <li>Leaf Nunes</li>
Index: browser/base/content/sanitize.js
===================================================================
RCS file: browser/base/content/sanitize.js
diff -N browser/base/content/sanitize.js
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ browser/base/content/sanitize.js	21 Feb 2005 11:21:00 -0000
@@ -0,0 +1,189 @@
+# -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+# 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 the Firefox Sanitizer.
+# 
+# The Initial Developer of the Original Code is Ben Goodger.
+# Portions created by the Initial Developer are Copyright (C) 2005
+# the Initial Developer. All Rights Reserved.
+# 
+# Contributor(s):
+#   Ben Goodger <ben@mozilla.org>
+# 
+# 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 *****
+
+function Sanitizer() {}
+Sanitizer.prototype = {
+  clearItem: function (aItemName)
+  {
+    if (this.items[aItemName].canClear)
+      this.items[aItemName].clear();
+  },
+
+  canClearItem: function (aItemName)
+  {
+    return this.items[aItemName].canClear;
+  },
+  
+  _prefDomain: "privacy.item.",
+  getNameFromPreference: function (aPreferenceName)
+  {
+    dump("*** " + aPreferenceName + ", i = " + this._prefDomain.length + ", sub = " + aPreferenceName.substr(this._prefDomain.length, -1) + "\n");
+    return aPreferenceName.substr(this._prefDomain.length);
+  },
+  
+  sanitize: function ()
+  {
+    dump("*** sanitizing!\n");
+    var psvc = Components.classes["@mozilla.org/preferences-service;1"]
+                         .getService(Components.interfaces.nsIPrefService);
+    var branch = psvc.getBranch(this._prefDomain);
+    for (var itemName in this.items) {
+      var item = this.items[itemName];
+      if ("clear" in item && item.canClear && branch.getBoolPref(itemName)) 
+        item.clear();
+    }
+  },
+  
+  items: {
+    cache: {
+      clear: function ()
+      {
+        var cacheService = Components.classes["@mozilla.org/network/cache-service;1"]
+                                     .getService(Components.interfaces.nsICacheService);
+        cacheService.evictEntries(Components.interfaces.nsICache.STORE_ON_DISK);
+        cacheService.evictEntries(Components.interfaces.nsICache.STORE_IN_MEMORY);
+      },
+      
+      get canClear()
+      {
+        return true;
+      }
+    },
+    
+    cookies: {
+      clear: function ()
+      {
+        var cookieMgr = Components.classes["@mozilla.org/cookiemanager;1"]
+                                  .getService(Components.interfaces.nsICookieManager);
+        var e = cookieMgr.enumerator;
+        var cookies = [];
+        while (e.hasMoreElements()) {
+          var cookie = e.getNext().QueryInterface(Components.interfaces.nsICookie);
+          cookies.push(cookie);
+        }
+
+        for (var i = 0; i < cookies.length; ++i)
+          cookieMgr.remove(cookies[i].host, cookies[i].name, cookies[i].path, false);
+      },
+      
+      get canClear()
+      {
+        var cookieMgr = Components.classes["@mozilla.org/cookiemanager;1"]
+                                  .getService(Components.interfaces.nsICookieManager);
+        return cookieMgr.enumerator.hasMoreElements();
+      },
+    },
+    
+    history: {
+      clear: function ()
+      {
+        var globalHistory = Components.classes["@mozilla.org/browser/global-history;2"]
+                                      .getService(Components.interfaces.nsIBrowserHistory);
+        globalHistory.removeAllPages();
+        
+        try {
+          var os = Components.classes["@mozilla.org/observer-service;1"].getService(Components.interfaces.nsIObserverService);
+          os.notifyObservers(null, "browser:purge-session-history", "");
+        }
+        catch (e) { }
+      },
+      
+      get canClear()
+      {
+        var globalHistory = Components.classes["@mozilla.org/browser/global-history;2"]
+                                      .getService(Components.interfaces.nsIBrowserHistory);
+        return globalHistory.count != 0;
+      },
+    },
+    
+    formdata: {
+      clear: function ()
+      {
+        var formHistory = Components.classes["@mozilla.org/satchel/form-history;1"]
+                                    .getService(Components.interfaces.nsIFormHistory);
+        formHistory.removeAllEntries();
+      },
+      
+      get canClear()
+      {
+        var formHistory = Components.classes["@mozilla.org/satchel/form-history;1"]
+                                    .getService(Components.interfaces.nsIFormHistory);
+        return formHistory.rowCount != 0;
+      },
+    },
+    
+    downloads: {
+      clear: function ()
+      {
+        var dlMgr = Components.classes["@mozilla.org/download-manager;1"]
+                              .getService(Components.interfaces.nsIDownloadManager);
+        dlMgr.cleanUp();
+      },
+
+      get canClear()
+      {
+        var dlMgr = Components.classes["@mozilla.org/download-manager;1"]
+                              .getService(Components.interfaces.nsIDownloadManager);
+        return dlMgr.canCleanUp;
+      },
+    },
+    
+    passwords: {
+      clear: function ()
+      {
+        var pwmgr = Components.classes["@mozilla.org/passwordmanager;1"]
+                              .getService(Components.interfaces.nsIPasswordManager);
+        var e = pwmgr.enumerator;
+        var passwds = [];
+        while (e.hasMoreElements()) {
+          var passwd = e.getNext().QueryInterface(Components.interfaces.nsIPassword);
+          passwds.push(passwd);
+        }
+        
+        for (var i = 0; i < passwds.length; ++i)
+          pwmgr.removeUser(passwds[i].host, passwds[i].user);
+      },
+      
+      get canClear()
+      {
+        var pwmgr = Components.classes["@mozilla.org/passwordmanager;1"]
+                              .getService(Components.interfaces.nsIPasswordManager);
+        return pwmgr.enumerator.hasMoreElements();
+      },
+    },
+  },
+};
+
Index: browser/base/content/sanitize.xul
===================================================================
RCS file: browser/base/content/sanitize.xul
diff -N browser/base/content/sanitize.xul
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ browser/base/content/sanitize.xul	21 Feb 2005 11:21:00 -0000
@@ -0,0 +1,160 @@
+<?xml version="1.0"?>
+
+# -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+# 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 the Firefox Sanitizer.
+# 
+# The Initial Developer of the Original Code is Ben Goodger.
+# Portions created by the Initial Developer are Copyright (C) 2005
+# the Initial Developer. All Rights Reserved.
+# 
+# Contributor(s):
+#   Ben Goodger <ben@mozilla.org>
+# 
+# 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 *****
+
+<?xml-stylesheet href="chrome://global/skin/"?>
+
+<!DOCTYPE dialog [
+  <!ENTITY % brandDTD SYSTEM "chrome://global/locale/brand.dtd">
+  <!ENTITY % sanitizeDTD SYSTEM "chrome://browser/locale/sanitize.dtd">
+  %brandDTD;
+  %sanitizeDTD;
+]>
+
+<prefwindow id="SanitizeDialog" type="child"
+            xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+            dlgbuttons="accept,cancel"
+            title="&sanitizeDialog.title;"
+            style="width: 30em !important;"
+            ondialogaccept="gSanitizePromptDialog.sanitize();">
+
+  <prefpane id="SanitizeDialogPane" onpaneload="gSanitizePromptDialog.init();">
+    <stringbundle id="bundleBrowser" src="chrome://browser/locale/browser.properties"/>
+    
+    <script type="application/x-javascript" src="chrome://browser/content/sanitize.js"/>
+    <script type="application/x-javascript">
+    <![CDATA[
+      var gSanitizePromptDialog = {
+        init: function ()
+        {
+          var s = new Sanitizer();
+          var sanitizePreferences = document.getElementById("sanitizePreferences");
+          for (var i = 0; i < sanitizePreferences.childNodes.length; ++i) {
+            var preference = sanitizePreferences.childNodes[i];
+            var name = s.getNameFromPreference(preference.name);
+            if (!s.canClearItem(name)) 
+              preference.disabled = true;
+          }
+          
+          var bundleBrowser = document.getElementById("bundleBrowser");
+          document.documentElement.getButton("accept").label = bundleBrowser.getString("sanitizeButton");
+        },
+      
+        sanitize: function ()
+        {
+          var s = new Sanitizer();
+          var sanitizePreferences = document.getElementById("sanitizePreferences");
+          for (var i = 0; i < sanitizePreferences.childNodes.length; ++i) {
+            var preference = sanitizePreferences.childNodes[i];
+            var name = s.getNameFromPreference(preference.name);
+            if (s.canClearItem(name) && preference.value) 
+              s.clearItem(name);
+          }
+        },
+        
+        sanitizePasswords: function ()
+        {
+          var preference = document.getElementById("privacy.item.passwords");
+          var promptPref = document.getElementById("privacy.sanitize.promptOnSanitize");
+          if (preference.value)
+            promptPref.value = true;
+          promptPref.disabled = preference.value;
+          
+          return this.onReadGeneric();
+        },
+        
+        onReadSanitizePasswords: function ()
+        {
+          return this.sanitizePasswords();
+        },
+        
+        onReadGeneric: function ()
+        {
+          var preferences = document.getElementById("sanitizePreferences");
+          var found = false;
+          for (var i = 0; i < preferences.childNodes.length; ++i) {
+            var preference = preferences.childNodes[i];
+            if (preference.value && !preference.disabled) {
+              found = true;
+              break;
+            }
+          }
+          try {
+            document.documentElement.getButton("accept").disabled = !found;
+          }
+          catch (e) { }
+          return undefined;
+        }
+      };
+    ]]>
+    </script>
+
+    <preferences id="sanitizePreferences">
+      <preference id="privacy.item.history"               name="privacy.item.history"               type="bool" readonly="true"/>
+      <preference id="privacy.item.formdata"              name="privacy.item.formdata"              type="bool" readonly="true"/>
+      <preference id="privacy.item.passwords"             name="privacy.item.passwords"             type="bool" readonly="true"/>
+      <preference id="privacy.item.downloads"             name="privacy.item.downloads"             type="bool" readonly="true"/>
+      <preference id="privacy.item.cookies"               name="privacy.item.cookies"               type="bool" readonly="true"/>
+      <preference id="privacy.item.cache"                 name="privacy.item.cache"                 type="bool" readonly="true"/>
+    </preferences>
+    <preferences>
+      <preference id="privacy.sanitize.promptOnSanitize"  name="privacy.sanitize.promptOnSanitize"  type="bool" instantApply="true"/>
+    </preferences>
+
+    <groupbox orient="vertical" align="start">
+      <caption label="&sanitizeItems.label;"/>
+      
+      <checkbox label="&itemHistory.label;"   preference="privacy.item.history"
+                onpreferenceread="return gSanitizePromptDialog.onReadGeneric();"/>
+      <checkbox label="&itemFormData.label;"  preference="privacy.item.formdata"
+                onpreferenceread="return gSanitizePromptDialog.onReadGeneric();"/>
+      <checkbox label="&itemPasswords.label;" preference="privacy.item.passwords"
+                onpreferenceread="return gSanitizePromptDialog.onReadSanitizePasswords();"/>
+      <checkbox label="&itemDownloads.label;" preference="privacy.item.downloads"
+                onpreferenceread="return gSanitizePromptDialog.onReadGeneric();"/>
+      <checkbox label="&itemCookies.label;"   preference="privacy.item.cookies"
+                onpreferenceread="return gSanitizePromptDialog.onReadGeneric();"/>
+      <checkbox label="&itemCache.label;"     preference="privacy.item.cache"
+                onpreferenceread="return gSanitizePromptDialog.onReadGeneric();"/>
+    </groupbox>
+    
+    <groupbox orient="vertical" align="start">
+      <checkbox id="promptOnSanitize" label="&promptOnSanitize.label;"
+                preference="privacy.sanitize.promptOnSanitize"/>
+    </groupbox>
+  </prefpane>
+</prefwindow>
Index: browser/components/Makefile.in
===================================================================
RCS file: /cvsroot/mozilla/browser/components/Makefile.in,v
retrieving revision 1.36
diff -p -u -8 -r1.36 Makefile.in
--- browser/components/Makefile.in	17 Jan 2005 18:50:08 -0000	1.36
+++ browser/components/Makefile.in	21 Feb 2005 11:21:00 -0000
@@ -53,16 +53,15 @@ EXTRA_PP_COMPONENTS = \
 	nsBrowserContentHandler.js \
 	$(NULL)
 
 DIRS = \
 	bookmarks \
 	help \
 	migration \
 	history \
-	prefwindow \
+	preferences \
 	shell \
 	sidebar \
-	cookieviewer \
 	build \
 	$(NULL)
 
 include $(topsrcdir)/config/rules.mk
Index: browser/components/cookieviewer/.cvsignore
===================================================================
RCS file: browser/components/cookieviewer/.cvsignore
diff -N browser/components/cookieviewer/.cvsignore
--- browser/components/cookieviewer/.cvsignore	31 Jul 2003 02:21:21 -0000	1.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1 +0,0 @@
-Makefile
Index: browser/components/cookieviewer/Makefile.in
===================================================================
RCS file: browser/components/cookieviewer/Makefile.in
diff -N browser/components/cookieviewer/Makefile.in
--- browser/components/cookieviewer/Makefile.in	29 Sep 2003 06:03:44 -0000	1.2
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,45 +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 the Mozilla Browser code.
-#
-# The Initial Developer of the Original Code is
-# Netscape Communications Corporation.
-# Portions created by the Initial Developer are Copyright (C) 2002
-# the Initial Developer. All Rights Reserved.
-#
-# Contributor(s):
-#  Brian Ryner <bryner@brianryner.com>
-#
-# 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 *****
-
-DEPTH		= ../../..
-topsrcdir	= @top_srcdir@
-srcdir		= @srcdir@
-VPATH		= @srcdir@
-
-include $(DEPTH)/config/autoconf.mk
-
-include $(topsrcdir)/config/rules.mk
Index: browser/components/cookieviewer/jar.mn
===================================================================
RCS file: browser/components/cookieviewer/jar.mn
diff -N browser/components/cookieviewer/jar.mn
--- browser/components/cookieviewer/jar.mn	12 Jul 2004 17:15:03 -0000	1.3
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,6 +0,0 @@
-browser.jar:
-*  content/browser/cookieviewer/CookieViewer.xul     (content/CookieViewer.xul)
-*  content/browser/cookieviewer/CookieViewer.js      (content/CookieViewer.js)
-*  content/browser/cookieviewer/CookieExceptions.xul (content/CookieExceptions.xul)
-*  content/browser/cookieviewer/CookieExceptions.js  (content/CookieExceptions.js)
-*  content/browser/cookieviewer/treeUtils.js         (content/treeUtils.js)
Index: browser/components/cookieviewer/content/CookieExceptions.js
===================================================================
RCS file: browser/components/cookieviewer/content/CookieExceptions.js
diff -N browser/components/cookieviewer/content/CookieExceptions.js
--- browser/components/cookieviewer/content/CookieExceptions.js	28 Jan 2005 23:32:01 -0000	1.12
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,276 +0,0 @@
-const nsIPermissionManager = Components.interfaces.nsIPermissionManager;
-const nsICookiePermission = Components.interfaces.nsICookiePermission;
-
-function Permission(id, host, rawHost, type, capability, perm) 
-{
-  this.id = id;
-  this.host = host;
-  this.rawHost = rawHost;
-  this.type = type;
-  this.capability = capability;
-  this.perm = perm;
-}
-
-var gPermissionManager = {
-  _type                 : "",
-  _addedPermissions     : [],
-  _removedPermissions   : [],
-  _pm                   : Components.classes["@mozilla.org/permissionmanager;1"]
-                                    .getService(Components.interfaces.nsIPermissionManager),
-  _bundle               : null,
-  _tree                 : null,
-  
-  _view: {
-    _rowCount: 0,
-    get rowCount() 
-    { 
-      return this._rowCount; 
-    },
-    getCellText: function (aRow, aColumn)
-    {
-      if (aColumn.id == "siteCol")
-        return gPermissionManager._addedPermissions[aRow].rawHost;
-      else if (aColumn.id == "statusCol")
-        return gPermissionManager._addedPermissions[aRow].capability;
-      return "";
-    },
-
-    isSeparator: function(aIndex) { return false; },
-    isSorted: function() { return false; },
-    isContainer: function(aIndex) { return false; },
-    setTree: function(aTree){},
-    getImageSrc: function(aRow, aColumn) {},
-    getProgressMode: function(aRow, aColumn) {},
-    getCellValue: function(aRow, aColumn) {},
-    cycleHeader: function(column) {},
-    getRowProperties: function(row,prop){},
-    getColumnProperties: function(column,prop){},
-    getCellProperties: function(row,column,prop){}
-  },
-  
-  onOK: function ()
-  {
-    var pm = Components.classes["@mozilla.org/permissionmanager;1"]
-                       .getService(Components.interfaces.nsIPermissionManager);
-    for (var i = 0; i < this._removedPermissions.length; ++i) {
-      var p = this._removedPermissions[i];
-      pm.remove(p.host, p.type);
-    }
-
-    var uri = Components.classes["@mozilla.org/network/standard-url;1"]
-                        .createInstance(Components.interfaces.nsIURI);    
-    for (var i = 0; i < this._addedPermissions.length; ++i) {
-      var p = this._addedPermissions[i];
-      uri.spec = p.host;
-      pm.add(uri, p.type, p.perm);
-    }
-  },
-  
-  addPermission: function (aPermission)
-  {
-    var textbox = document.getElementById("url");
-    var host = textbox.value.replace(/^\s*([-\w]*:\/+)?/, ""); // trim any leading space and scheme
-    try {
-      var ioService = Components.classes["@mozilla.org/network/io-service;1"]
-                                .getService(Components.interfaces.nsIIOService);
-      var uri = ioService.newURI("http://"+host, null, null);
-      host = uri.host;
-
-      // check for garbage
-      if (host == "" || host.replace(/\W/, "") == "")
-        throw("Error: Invalid hostname entered.");
-    } catch(ex) {
-      var promptService = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
-                                    .getService(Components.interfaces.nsIPromptService);
-      var message = this._bundle.getString("invalidURI");
-      var title = this._bundle.getString("invalidURITitle");
-      promptService.alert(window, title, message);
-
-      // clear out the textbox and disable the buttons
-      textbox.value = "";
-      textbox.focus();
-      this.onHostInput(textbox);
-      return;
-    }
-
-    // we need this whether the perm exists or not
-    var stringKey = null;
-    switch (aPermission) {
-      case nsIPermissionManager.ALLOW_ACTION:
-        stringKey = "can";
-        break;
-      case nsIPermissionManager.DENY_ACTION:
-        stringKey = "cannot";
-        break;
-      case nsICookiePermission.ACCESS_SESSION:
-        stringKey = "canSession";
-        break;
-      default:
-        break;
-    } 
-    // check whether the permission already exists, if not, add it
-    var exists = false;
-    for (var i = 0; i < this._addedPermissions.length; ++i) {
-      if (this._addedPermissions[i].rawHost == host) {
-        exists = true;
-        this._addedPermissions[i].capability = this._bundle.getString(stringKey);
-        this._addedPermissions[i].perm = aPermission;
-        break;
-      }
-    }
-    
-    if (!exists) {
-      var p = new Permission(this._addedPermissions.length, 
-                             host, 
-                             (host.charAt(0) == ".") ? host.substring(1,host.length) : host, 
-                             this._type, 
-                             this._bundle.getString(stringKey), 
-                             aPermission);
-      this._addedPermissions.push(p);
-      
-      this._view._rowCount = this._addedPermissions.length;
-      this._tree.treeBoxObject.rowCountChanged(this._addedPermissions.length-1, 1);
-      this._tree.treeBoxObject.ensureRowIsVisible(this._addedPermissions.length-1);
-    }
-    textbox.value = "";
-    textbox.focus();
-
-    // covers a case where the site exists already, so the buttons don't disable
-    this.onHostInput(textbox);
-
-    // enable "remove all" button as needed
-    document.getElementById("removeAllPermissions").disabled = this._addedPermissions.length == 0;
-  },
-  
-  onHostInput: function (aSiteField)
-  {
-    // trim any leading space
-    var site = aSiteField.value.replace(/^\s*([-\w]*:\/+)?/, "");
- 
-    document.getElementById("btnSession").disabled = !site;
-    document.getElementById("btnBlock").disabled = !site;
-    document.getElementById("btnAllow").disabled = !site;
-  },
-  
-  onLoad: function ()
-  {
-    this._type = window.arguments[0].permissionType;
-    this._bundle = document.getElementById("permBundle");
-
-    var permissionsText = document.getElementById("permissionsText");
-    while (permissionsText.hasChildNodes())
-      permissionsText.removeChild(permissionsText.firstChild);
-    
-    var introString = this._bundle.getString(this._type + "permissionstext");
-    permissionsText.appendChild(document.createTextNode(introString));
-
-    var titleString = this._bundle.getString(this._type + "permissionstitle");
-    document.title = titleString;
-    
-    document.getElementById("btnBlock").hidden = !window.arguments[0].blockVisible;
-    document.getElementById("btnSession").hidden = !window.arguments[0].sessionVisible;
-    document.getElementById("btnAllow").hidden = !window.arguments[0].allowVisible;
-    document.getElementById("url").value = window.arguments[0].prefilledHost;
-    this.onHostInput(document.getElementById("url"));
-
-    this._loadPermissions();
-  },
-  
-  onPermissionSelected: function ()
-  {
-    var selections = GetTreeSelections(this._tree);
-    document.getElementById("removePermission").disabled = (selections.length < 1);
-  },
-  
-  onPermissionDeleted: function ()
-  {
-    DeleteSelectedItemFromTree(this._tree, this._view,
-                               this._addedPermissions, this._removedPermissions,
-                               "removePermission", "removeAllPermissions");
-  },
-  
-  onAllPermissionsDeleted: function ()
-  {
-    DeleteAllFromTree(this._tree, this._view,
-                      this._addedPermissions, this._removedPermissions,
-                      "removePermission", "removeAllPermissions");
-  },
-  
-  onPermissionKeyPress: function (aEvent)
-  {
-    if (aEvent.keyCode == 46)
-      this.onPermissionDeleted();
-  },
-  
-  _lastPermissionSortColumn: "",
-  _lastPermissionSortAscending: false,
-  
-  onPermissionSort: function (aColumn, aUpdateSelection)
-  {
-    this._lastPermissionSortAscending = SortTree(this._tree, 
-                                                 this._view, 
-                                                 this._addedPermissions,
-                                                 aColumn, 
-                                                 this._lastPermissionSortColumn, 
-                                                 this._lastPermissionSortAscending, 
-                                                 aUpdateSelection);
-    this._lastPermissionSortColumn = aColumn;
-  },
-  
-  _loadPermissions: function ()
-  {
-    this._tree = document.getElementById("permissionsTree");
-
-    // load permissions into a table
-    var count = 0;
-    var enumerator = this._pm.enumerator;
-    while (enumerator.hasMoreElements()) {
-      var nextPermission = enumerator.getNext().QueryInterface(Components.interfaces.nsIPermission);
-      if (nextPermission.type == this._type) {
-        var host = nextPermission.host;
-        var capability = null;
-        switch (nextPermission.capability) {
-          case nsIPermissionManager.ALLOW_ACTION:
-            capability = "can";
-            break;
-          case nsIPermissionManager.DENY_ACTION:
-            capability = "cannot";
-            break;
-          // we should only ever hit this for cookies
-          case nsICookiePermission.ACCESS_SESSION:
-            capability = "canSession";
-            break;
-          default:
-            break;
-        } 
-        var capabilityString = this._bundle.getString(capability);
-        var p = new Permission(count++, host,
-                               (host.charAt(0) == ".") ? host.substring(1,host.length) : host,
-                               nextPermission.type,
-                               capabilityString, 
-                               nextPermission.capability);
-        this._addedPermissions.push(p);
-      }
-    }
-   
-    this._view._rowCount = this._addedPermissions.length;
-
-    // sort and display the table
-    this._tree.treeBoxObject.view = this._view;
-    this.onPermissionSort("rawHost", false);
-
-    // disable "remove all" button if there are none
-    document.getElementById("removeAllPermissions").disabled = this._addedPermissions.length == 0;
-  },
-  
-  setHost: function (aHost)
-  {
-    document.getElementById("url").value = aHost;
-  }
-};
-
-function setHost(aHost)
-{
-  gPermissionManager.setHost(aHost);
-}
-
Index: browser/components/cookieviewer/content/CookieExceptions.xul
===================================================================
RCS file: browser/components/cookieviewer/content/CookieExceptions.xul
diff -N browser/components/cookieviewer/content/CookieExceptions.xul
--- browser/components/cookieviewer/content/CookieExceptions.xul	1 Feb 2005 17:36:49 -0000	1.8
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,96 +0,0 @@
-<?xml version="1.0"?>
-# -*- Mode: SGML; indent-tabs-mode: nil -*-
-# ***** 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 Communicator client code, released
-# March 31, 1998.
-#
-# The Initial Developer of the Original Code is
-# Netscape Communications Corporation.
-# Portions created by the Initial Developer are Copyright (C) 1998-1999
-# the Initial Developer. All Rights Reserved.
-#
-# Contributor(s):
-#   Blake Ross (original author)
-#
-# 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 *****
-
-<?xml-stylesheet href="chrome://global/skin/" type="text/css"?> 
-
-<!DOCTYPE dialog SYSTEM "chrome://browser/locale/cookieviewer/CookieExceptions.dtd" >
-
-<dialog id="CookieExceptions"
-        buttons="accept,cancel"
-        windowtype="exceptions"
-        title="&window.title;"
-        xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
-        style="width: 30em;"
-        onload="gPermissionManager.onLoad();"
-        ondialogaccept="return gPermissionManager.onOK();"
-        persist="screenX screenY width height">
-
-  <script src="chrome://browser/content/cookieviewer/CookieExceptions.js"/>
-  <script src="chrome://browser/content/cookieviewer/treeUtils.js"/>
-
-  <stringbundle id="permBundle"
-                src="chrome://browser/locale/pref/prefutilities.properties"/>
-           
-  <description id="permissionsText"/>
-  <separator class="thin"/>
-  <label value="&address.label;"/>
-  <hbox align="start">
-    <textbox id="url" flex="1" oninput="gPermissionManager.onHostInput(event.target);"/>
-  </hbox>
-  <hbox pack="end">
-     <button id="btnBlock" disabled="true"
-             label="&block.label;" oncommand="gPermissionManager.addPermission(nsIPermissionManager.DENY_ACTION);"/>
-     <button id="btnSession" disabled="true"
-             label="&session.label;" oncommand="gPermissionManager.addPermission(nsICookiePermission.ACCESS_SESSION);"/>
-     <button id="btnAllow" disabled="true"
-             label="&allow.label;" oncommand="gPermissionManager.addPermission(nsIPermissionManager.ALLOW_ACTION);"/>
-  </hbox>
-  <separator class="thin"/>
-  <tree id="permissionsTree" flex="1" style="height: 18em;"
-        hidecolumnpicker="true"
-        onkeypress="gPermissionManager.onPermissionKeyPress(event)"
-        onselect="gPermissionManager.onPermissionSelected();">
-    <treecols>
-      <treecol id="siteCol" label="&treehead.sitename.label;" flex="3"
-                    onclick="gPermissionManager.onPermissionSort('rawHost', true);" persist="width"/>
-      <splitter class="tree-splitter"/>
-      <treecol id="statusCol" label="&treehead.status.label;" flex="1"
-                    onclick="gPermissionManager.onPermissionSort('capability', true);" persist="width"/>
-    </treecols>
-    <treechildren/>
-  </tree>
-  <separator class="thin"/>
-  <hbox>
-    <button id="removePermission" disabled="true" label="&removepermission.label;" 
-            oncommand="gPermissionManager.onPermissionDeleted();"/>
-    <button id="removeAllPermissions" label="&removeallpermissions.label;" 
-            oncommand="gPermissionManager.onAllPermissionsDeleted();"/>
-  </hbox>
-</dialog>
Index: browser/components/cookieviewer/content/CookieViewer.js
===================================================================
RCS file: browser/components/cookieviewer/content/CookieViewer.js
diff -N browser/components/cookieviewer/content/CookieViewer.js
--- browser/components/cookieviewer/content/CookieViewer.js	1 Feb 2005 17:36:49 -0000	1.7
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,268 +0,0 @@
-# -*- Mode: C++; 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 Communicator client code, released
-# March 31, 1998.
-#
-# The Initial Developer of the Original Code is
-# Netscape Communications Corporation.
-# Portions created by the Initial Developer are Copyright (C) 1998
-# the Initial Developer. All Rights Reserved.
-#
-# Contributor(s):
-#   Ben Goodger
-#
-# 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 *****
-
-// interface variables
-var cookiemanager = Components.classes["@mozilla.org/cookiemanager;1"].getService();
-    cookiemanager = cookiemanager.QueryInterface(Components.interfaces.nsICookieManager);
-var gDateService = null;
-
-// cookies list
-var cookies              = [];
-var deletedCookies       = [];
-
-var cookieBundle;
-var cookiesTree;
-const nsICookie = Components.interfaces.nsICookie;
-
-function Startup() {
-
-  // intialize gDateService
-  if (!gDateService) {
-    const nsScriptableDateFormat_CONTRACTID = "@mozilla.org/intl/scriptabledateformat;1";
-    const nsIScriptableDateFormat = Components.interfaces.nsIScriptableDateFormat;
-    gDateService = Components.classes[nsScriptableDateFormat_CONTRACTID]
-      .getService(nsIScriptableDateFormat);
-  }
-
-  //XXXBlake
-  // I removed the observer stuff, so yes, there are edge cases where
-  // if you're loading a page when you open prefs/cookie manager,
-  // the cookie manager won't display the new cookie added.
-  // I don't think it's a big deal (considering how hard it would be to fix)
-}
-
-function onOK() {
-  window.opener.top.wsm.savePageData(window.location.href, window);
-  window.opener.top.hPrefWindow.registerOKCallbackFunc(window.opener.cookieViewerOnPrefsOK);
-}
-
-function GetFields()
-{
-  var dataObject = {};
-  dataObject.deletedCookies = deletedCookies;
-  dataObject.cookies = cookies;
-  dataObject.cookieBool = document.getElementById("checkbox").checked;
-  return dataObject;
-}
-
-function SetFields(dataObject)
-{
-  if ('cookies' in dataObject)
-    cookies = dataObject.cookies;
-
-  if ('deletedCookies' in dataObject)
-    deletedCookies = dataObject.deletedCookies;
-  
-  if ('cookieBool' in dataObject)
-    document.getElementById("checkbox").checked = dataObject.cookieBool;
-
-  loadCookies();
-}
-
-
-/*** =================== COOKIES CODE =================== ***/
-
-var cookiesTreeView = {
-  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.id=="domainCol") {
-      rv = cookies[row].rawHost;
-    } else if (column.id=="nameCol") {
-      rv = cookies[row].name;
-    }
-    return rv;
-  },
-  isSeparator : function(index) {return false;},
-  isSorted: function() { return false; },
-  isContainer : function(index) {return false;},
-  cycleHeader : function(column) {},
-  getRowProperties : function(row,prop){},
-  getColumnProperties : function(column,prop){},
-  getCellProperties : function(row,column,prop){}
- };
-
-function Cookie(number,name,value,isDomain,host,rawHost,path,isSecure,expires) {
-  this.number = number;
-  this.name = name;
-  this.value = value;
-  this.isDomain = isDomain;
-  this.host = host;
-  this.rawHost = rawHost;
-  this.path = path;
-  this.isSecure = isSecure;
-  this.expires = expires;
-}
-
-function loadCookies() {
-  if (!cookieBundle)
-    cookieBundle = document.getElementById("cookieBundle");
-
-  if (!cookiesTree)
-    cookiesTree = document.getElementById("cookiesTree");
-
-  var dataObject = window.opener.top.hPrefWindow.wsm.dataManager.pageData[window.location.href].userData;
-  if (!('cookies' in dataObject)) {
-    // load cookies into a table
-    var enumerator = cookiemanager.enumerator;
-    var count = 0;
-    while (enumerator.hasMoreElements()) {
-      var nextCookie = enumerator.getNext();
-      if (!nextCookie) break;
-      nextCookie = nextCookie.QueryInterface(Components.interfaces.nsICookie);
-      var host = nextCookie.host;
-      cookies[count] =
-        new Cookie(count++, nextCookie.name, nextCookie.value, nextCookie.isDomain, host,
-                   (host.charAt(0)==".") ? host.substring(1,host.length) : host,
-                   nextCookie.path, nextCookie.isSecure, nextCookie.expires);
-    }
-  }
-
-  cookiesTreeView.rowCount = cookies.length;
-  cookiesTree.treeBoxObject.view = cookiesTreeView;
-
- // sort by host column
-  CookieColumnSort('rawHost');
-
-  // disable "remove all cookies" button if there are no cookies
-  document.getElementById("removeAllCookies").disabled = cookies.length == 0;
-}
-
-function GetExpiresString(expires) {
-  if (expires) {
-    var date = new Date(1000*expires);
-    return gDateService.FormatDateTime("", gDateService.dateFormatLong,
-                                       gDateService.timeFormatSeconds, date.getFullYear(),
-                                       date.getMonth()+1, date.getDate(), date.getHours(),
-                                       date.getMinutes(), date.getSeconds());
-  }
-  return cookieBundle.getString("AtEndOfSession");
-}
-
-function CookieSelected() {
-  var selections = GetTreeSelections(cookiesTree);
-  if (selections.length) {
-    document.getElementById("removeCookie").removeAttribute("disabled");
-  } else {
-    ClearCookieProperties();
-    return true;
-  }
-    
-  var idx = selections[0];
-  if (idx >= cookies.length) {
-    // Something got out of synch.  See bug 119812 for details
-    dump("Tree and viewer state are out of sync! " +
-         "Help us figure out the problem in bug 119812");
-    return;
-  }
-
-  var props = [
-    {id: "ifl_name", value: cookies[idx].name},
-    {id: "ifl_value", value: cookies[idx].value}, 
-    {id: "ifl_isDomain",
-     value: cookies[idx].isDomain ?
-            cookieBundle.getString("domainColon") : cookieBundle.getString("hostColon")},
-    {id: "ifl_host", value: cookies[idx].host},
-    {id: "ifl_path", value: cookies[idx].path},
-    {id: "ifl_isSecure",
-     value: cookies[idx].isSecure ?
-            cookieBundle.getString("forSecureOnly") : 
-            cookieBundle.getString("forAnyConnection")},
-    {id: "ifl_expires", value: GetExpiresString(cookies[idx].expires)},
-  ];
-
-  var value;
-  var field;
-  for (var i = 0; i < props.length; i++)
-  {
-    field = document.getElementById(props[i].id);
-    if ((selections.length > 1) && (props[i].id != "ifl_isDomain")) {
-      value = ""; // clear field if multiple selections
-    } else {
-      value = props[i].value;
-    }
-    field.value = value;
-  }
-  return true;
-}
-
-function ClearCookieProperties() {
-  var properties = 
-    ["ifl_name","ifl_value","ifl_host","ifl_path","ifl_isSecure","ifl_expires"];
-  for (var prop=0; prop<properties.length; prop++) {
-    document.getElementById(properties[prop]).value = "";
-  }
-}
-
-function DeleteCookie() {
-  DeleteSelectedItemFromTree(cookiesTree, cookiesTreeView,
-                                 cookies, deletedCookies,
-                                 "removeCookie", "removeAllCookies");
-  if (!cookies.length) {
-    ClearCookieProperties();
-  }
-}
-
-function DeleteAllCookies() {
-  ClearCookieProperties();
-  DeleteAllFromTree(cookiesTree, cookiesTreeView,
-                        cookies, deletedCookies,
-                        "removeCookie", "removeAllCookies");
-}
-
-function HandleCookieKeyPress(e) {
-  if (e.keyCode == 46) {
-    DeleteCookie();
-  }
-}
-
-var lastCookieSortColumn = "";
-var lastCookieSortAscending = false;
-
-function CookieColumnSort(column) {
-  lastCookieSortAscending =
-    SortTree(cookiesTree, cookiesTreeView, cookies,
-                 column, lastCookieSortColumn, lastCookieSortAscending);
-  lastCookieSortColumn = column;
-}
Index: browser/components/cookieviewer/content/CookieViewer.xul
===================================================================
RCS file: browser/components/cookieviewer/content/CookieViewer.xul
diff -N browser/components/cookieviewer/content/CookieViewer.xul
--- browser/components/cookieviewer/content/CookieViewer.xul	1 Feb 2005 17:36:49 -0000	1.6
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,144 +0,0 @@
-<?xml version="1.0"?>
-# -*- Mode: SGML; indent-tabs-mode: nil -*-
-# ***** 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 Communicator client code, released
-# March 31, 1998.
-#
-# The Initial Developer of the Original Code is
-# Netscape Communications Corporation.
-# Portions created by the Initial Developer are Copyright (C) 1998-1999
-# the Initial Developer. All Rights Reserved.
-#
-# Contributor(s):
-#   Ben Goodger
-#
-# 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 *****
-
-<?xml-stylesheet href="chrome://global/skin/" type="text/css"?> 
-
-<!DOCTYPE dialog SYSTEM "chrome://browser/locale/cookieviewer/CookieViewer.dtd" >
-
-<dialog id="CookieManager"
-        buttons="accept,cancel"
-        title="&window.title;"
-        xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
-        style="width: 30em;"
-        onload="window.opener.top.initPanel(window.location.href, window);"
-        ondialogaccept="return onOK();"
-        persist="screenX screenY width height">
-
-  <script src="chrome://browser/content/cookieviewer/CookieViewer.js"/>
-  <script src="chrome://browser/content/cookieviewer/treeUtils.js"/>
-
-  <stringbundle id="cookieBundle"
-                src="chrome://browser/locale/cookieviewer/CookieViewer.properties"/>
-           
-  <vbox flex="1">
-      <label value="&div.cookiesonsystem.label;"/>
-      <separator class="thin"/>
-      <tree id="cookiesTree" flex="1" style="height: 10em;"
-                onkeypress="HandleCookieKeyPress(event)"
-                onselect="CookieSelected();"
-                hidecolumnpicker="true">
-        <treecols>
-          <treecol id="domainCol" label="&treehead.cookiedomain.label;" flex="2"
-                       onclick="CookieColumnSort('rawHost', true);" persist="width"/>
-          <splitter class="tree-splitter"/>
-          <treecol id="nameCol" label="&treehead.cookiename.label;" flex="1"
-                       onclick="CookieColumnSort('name', true);" persist="width"/>
-        </treecols>
-        <treechildren/>
-      </tree>
-      <groupbox>
-        <caption label="&treehead.infoselected.label;"/>
-        <!-- labels -->
-        <grid flex="1">
-          <columns>
-            <column/>
-            <column flex="1"/>
-          </columns>
-          <rows>
-
-            <row align="center">
-              <hbox align="center" pack="end">
-                <label value="&props.name.label;"/>
-              </hbox>
-              <textbox id="ifl_name" readonly="true" class="plain"/>
-            </row>
-
-            <row align="center">
-              <hbox align="center" pack="end">
-                <label value="&props.value.label;"/>
-              </hbox>
-              <textbox id="ifl_value" readonly="true" class="plain"/>
-            </row>
-
-            <row align="center">
-              <hbox align="center" pack="end">
-                <label id="ifl_isDomain" value="&props.domain.label;"/>
-              </hbox>
-              <textbox id="ifl_host" readonly="true" class="plain"/>
-            </row>
-
-            <row align="center">
-              <hbox align="center" pack="end">
-                <label value="&props.path.label;"/>
-              </hbox>
-              <textbox id="ifl_path" readonly="true" class="plain"/>
-            </row>
-
-            <row align="center">
-              <hbox align="center" pack="end">
-                <label value="&props.secure.label;"/>
-              </hbox>
-              <textbox id="ifl_isSecure" readonly="true" class="plain"/>
-            </row>
-
-            <row align="center">
-              <hbox align="center" pack="end">
-                <label value="&props.expires.label;"/>
-              </hbox>
-              <textbox id="ifl_expires" readonly="true" class="plain"/>
-            </row>
-
-          </rows>
-        </grid>
-      </groupbox>
-      <hbox>
-        <button id="removeCookie" disabled="true"
-                      label="&button.removecookie.label;"
-                      oncommand="DeleteCookie();"/>
-        <button id="removeAllCookies"
-                      label="&button.removeallcookies.label;"
-                      oncommand="DeleteAllCookies();"/>
-      </hbox>
-      <separator class="thin"/>
-      <hbox align="start">
-        <checkbox id="checkbox" label="&checkbox.label;" />
-      </hbox>
-  </vbox>
-</dialog>
Index: browser/components/cookieviewer/content/treeUtils.js
===================================================================
RCS file: browser/components/cookieviewer/content/treeUtils.js
diff -N browser/components/cookieviewer/content/treeUtils.js
--- browser/components/cookieviewer/content/treeUtils.js	1 Feb 2005 17:36:49 -0000	1.9
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,162 +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.org code.
-#
-# The Initial Developer of the Original Code is
-# Netscape Communications Corporation.
-# Portions created by the Initial Developer are Copyright (C) 1998
-# the Initial Developer. All Rights Reserved.
-#
-# Contributor(s):
-#
-# 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 *****
-
-function DeleteAllFromTree
-    (tree, view, table, deletedTable, removeButton, removeAllButton) {
-
-  // remove all items from table and place in deleted table
-  for (var i=0; i<table.length; i++) {
-    deletedTable[deletedTable.length] = table[i];
-  }
-  table.length = 0;
-
-  // redisplay
-  var oldCount = view.rowCount;
-  view.rowCount = 0;
-  tree.treeBoxObject.rowCountChanged(0, -oldCount);
-
-
-  // disable buttons
-  document.getElementById(removeButton).setAttribute("disabled", "true")
-  document.getElementById(removeAllButton).setAttribute("disabled","true");
-}
-
-function DeleteSelectedItemFromTree
-    (tree, view, table, deletedTable, removeButton, removeAllButton) {
-  // Turn off tree selection notifications during the deletion
-  tree.view.selection.selectEventsSuppressed = true;
-
-  // remove selected items from list (by setting them to null) and place in deleted list
-  var selections = GetTreeSelections(tree);
-  for (var s=selections.length-1; 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; j++) {
-    if (table[j] == null) {
-      var k = j;
-      while ((k < table.length) && (table[k] == null)) {
-        k++;
-      }
-      table.splice(j, k-j);
-      view.rowCount -= k - j;
-      tree.treeBoxObject.rowCountChanged(j, j - k);
-    }
-  }
-
-  // update selection and/or buttons
-  if (table.length) {
-
-    // update selection
-    var nextSelection = (selections[0] < table.length) ? selections[0] : table.length-1;
-    tree.view.selection.select(nextSelection);
-    tree.treeBoxObject.ensureRowIsVisible(nextSelection);
-
-  } else {
-
-    // disable buttons
-    document.getElementById(removeButton).setAttribute("disabled", "true")
-    document.getElementById(removeAllButton).setAttribute("disabled","true");
-
-  }
-  tree.view.selection.selectEventsSuppressed = false;
-}
-
-function GetTreeSelections(tree) {
-  var selections = [];
-  var select = tree.view.selection;
-  if (select) {
-    var count = select.getRangeCount();
-    var min = new Object();
-    var max = new Object();
-    for (var i=0; i<count; i++) {
-      select.getRangeAt(i, min, max);
-      for (var k=min.value; k<=max.value; k++) {
-        if (k != -1) {
-          selections[selections.length] = k;
-        }
-      }
-    }
-  }
-  return selections;
-}
-
-function SortTree(tree, view, table, column, lastSortColumn, lastSortAscending, updateSelection) {
-
-  // remember which item was selected so we can restore it after the sort
-  var selections = GetTreeSelections(tree);
-  var selectedNumber = selections.length ? table[selections[0]].id : -1;
-
-  // determine if sort is to be ascending or descending
-  var ascending = (column == lastSortColumn) ? !lastSortAscending : true;
-
-  // do the sort or re-sort
-  var compareFunc = function compare(first, second) {
-    return first[column].toLowerCase().localeCompare(second[column].toLowerCase());
-  }
-  table.sort(compareFunc);
-  if (!ascending)
-    table.reverse();
-
-  // restore the selection
-  var selectedRow = -1;
-  if (selectedNumber>=0 && updateSelection) {
-    for (var s=0; s<table.length; s++) {
-      if (table[s].id == selectedNumber) {
-        // update selection
-        // note: we need to deselect before reselecting in order to trigger ...Selected()
-        tree.view.selection.select(-1);
-        tree.view.selection.select(s);
-        selectedRow = s;
-        break;
-      }
-    }
-  }
-
-  // display the results
-  tree.treeBoxObject.invalidate();
-  if (selectedRow >= 0) {
-    tree.treeBoxObject.ensureRowIsVisible(selectedRow)
-  }
-
-  return ascending;
-}
-
Index: browser/components/preferences/Makefile.in
===================================================================
RCS file: browser/components/preferences/Makefile.in
diff -N browser/components/preferences/Makefile.in
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ browser/components/preferences/Makefile.in	21 Feb 2005 11:21:00 -0000
@@ -0,0 +1,48 @@
+# -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+# 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 the Firefox Preferences System.
+# 
+# The Initial Developer of the Original Code is Ben Goodger.
+# Portions created by the Initial Developer are Copyright (C) 2005
+# the Initial Developer. All Rights Reserved.
+# 
+# Contributor(s):
+#   Ben Goodger <ben@mozilla.org>
+# 
+# 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 *****
+
+DEPTH		= ../../..
+topsrcdir	= @top_srcdir@
+srcdir		= @srcdir@
+VPATH		= @srcdir@
+
+include $(DEPTH)/config/autoconf.mk
+
+include $(topsrcdir)/config/rules.mk
+
+ifneq (,$(filter windows gtk2, $(MOZ_WIDGET_TOOLKIT)))
+DEFINES += -DHAVE_SHELL_SERVICE=1
+endif
Index: browser/components/preferences/actionsshared.js
===================================================================
RCS file: browser/components/preferences/actionsshared.js
diff -N browser/components/preferences/actionsshared.js
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ browser/components/preferences/actionsshared.js	21 Feb 2005 11:21:00 -0000
@@ -0,0 +1,63 @@
+# -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+# 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 the Download Actions Manager.
+# 
+# The Initial Developer of the Original Code is Ben Goodger.
+# Portions created by the Initial Developer are 
+# Copyright (C) 2000, 2001, 2003, 2005
+# the Initial Developer. All Rights Reserved.
+# 
+# Contributor(s):
+#   Ben Goodger <ben@mozilla.org>
+# 
+# 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 *****
+
+const FILEACTION_SAVE_TO_DISK     = 1;
+const FILEACTION_OPEN_INTERNALLY  = 2;
+const FILEACTION_OPEN_DEFAULT     = 3;
+const FILEACTION_OPEN_CUSTOM      = 4;
+const FILEACTION_OPEN_PLUGIN      = 5;
+function FileAction ()
+{
+}
+FileAction.prototype = {
+  type        : "",
+  extension   : "",
+  hasExtension: true,
+  editable    : true,
+  smallIcon   : "",
+  bigIcon     : "",
+  typeName    : "",
+  action      : "",
+  mimeInfo    : null,
+  customHandler       : "",
+  handleMode          : false,
+  pluginAvailable     : false,
+  pluginEnabled       : false,
+  handledOnlyByPlugin : false
+};
+
+
Index: browser/components/preferences/advanced.js
===================================================================
RCS file: browser/components/preferences/advanced.js
diff -N browser/components/preferences/advanced.js
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ browser/components/preferences/advanced.js	21 Feb 2005 11:21:01 -0000
@@ -0,0 +1,132 @@
+# -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+# 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 the Firefox Preferences System.
+# 
+# The Initial Developer of the Original Code is Ben Goodger.
+# Portions created by the Initial Developer are Copyright (C) 2005
+# the Initial Developer. All Rights Reserved.
+# 
+# Contributor(s):
+#   Ben Goodger <ben@mozilla.org>
+# 
+# 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 gAdvancedPane = {
+  _inited: false,
+  init: function ()
+  {
+    this._inited = true;
+    var advancedPrefs = document.getElementById("advancedPrefs");
+    var preference = document.getElementById("browser.preferences.advanced.selectedTabIndex");
+    if (preference.value === null)
+      return;
+    advancedPrefs.selectedIndex = preference.value;
+  },
+  
+  tabSelectionChanged: function ()
+  {
+    if (!this._inited)
+      return;
+    var advancedPrefs = document.getElementById("advancedPrefs");
+    var preference = document.getElementById("browser.preferences.advanced.selectedTabIndex");
+    preference.valueFromPreferences = advancedPrefs.selectedIndex;
+  },
+  
+  updateButtons: function (aButtonID, aPreferenceID)
+  {
+    var button = document.getElementById(aButtonID);
+    var preference = document.getElementById(aPreferenceID);
+    // This is actually before the value changes, so the value is not as you expect. 
+    button.disabled = preference.value == true;
+    return undefined;
+  },
+
+  showCertificates: function ()
+  {
+    document.documentElement.openWindow("mozilla:certmanager",
+                                        "chrome://pippki/content/certManager.xul",
+                                        "width=600,height=400", null);
+  },
+  
+  showCRLs: function ()
+  {
+    document.documentElement.openWindow("Mozilla:CRLManager", 
+                                        "chrome://pippki/content/crlManager.xul",
+                                        "width=600,height=400", null);
+  },
+  
+  showOCSP: function ()
+  {
+    document.documentElement.openSubDialog("chrome://browser/content/preferences/ocsp.xul",
+                                           "", null);
+  },
+  
+  showSecurityDevices: function ()
+  {
+    document.documentElement.openWindow("mozilla:devicemanager",
+                                        "chrome://pippki/content/device_manager.xul",
+                                        "width=600,height=400", null);
+  },
+  
+  updateAppUpdateUI: function ()
+  {
+    var preference = document.getElementById("app.update.autoUpdateEnabled");
+    var ids = ["enableAutoInstall", "autoInstallMode", "updateAnd"];
+    if (!preference.value)
+      for (var i = 0; i < ids.length; ++i)
+        document.getElementById(ids[i]).disabled = true;
+    else {
+      document.getElementById("enableAutoInstall").disabled = false;
+      this.updateAutoInstallUI();
+    }
+    return undefined;
+  },
+  
+  updateAutoInstallUI: function ()
+  {
+    var preference = document.getElementById("app.update.autoInstallEnabled");
+    var ids = ["autoInstallMode", "updateAnd"];
+    for (var i = 0; i < ids.length; ++i)
+      document.getElementById(ids[i]).disabled = !preference.value;
+    return undefined;
+  },
+  
+  checkForUpdates: function (aType)
+  {
+    var updates = Components.classes["@mozilla.org/updates/update-service;1"]
+                            .getService(Components.interfaces.nsIUpdateService);
+    updates.checkForUpdates([], 0, aType, 
+                            Components.interfaces.nsIUpdateService.SOURCE_EVENT_USER,
+                            null);  
+  },
+  
+  showLanguages: function ()
+  {
+    document.documentElement.openSubDialog("chrome://browser/content/preferences/languages.xul",
+                                           "", null);  
+  }
+};
+
Index: browser/components/preferences/advanced.xul
===================================================================
RCS file: browser/components/preferences/advanced.xul
diff -N browser/components/preferences/advanced.xul
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ browser/components/preferences/advanced.xul	21 Feb 2005 11:21:01 -0000
@@ -0,0 +1,256 @@
+<?xml version="1.0"?>
+
+# -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+# 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 the Firefox Preferences System.
+# 
+# The Initial Developer of the Original Code is Ben Goodger.
+# Portions created by the Initial Developer are Copyright (C) 2005
+# the Initial Developer. All Rights Reserved.
+# 
+# Contributor(s):
+#   Ben Goodger <ben@mozilla.org>
+# 
+# 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 *****
+
+<!DOCTYPE overlay [
+<!ENTITY % brandDTD SYSTEM "chrome://global/locale/brand.dtd">
+%brandDTD;
+<!ENTITY % advancedDTD SYSTEM "chrome://browser/locale/preferences/advanced.dtd">
+%advancedDTD;
+]>
+
+<overlay id="AdvancedPaneOverlay"
+         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+
+  <prefpane id="paneAdvanced" onpaneload="gAdvancedPane.init();">
+    <preferences>
+      <preference id="accessibility.browsewithcaret"   name="accessibility.browsewithcaret"   type="bool"/>
+      <preference id="accessibility.typeaheadfind"     name="accessibility.typeaheadfind"     type="bool"/>
+      <preference id="browser.enable_automatic_image_resizing"
+                  name="browser.enable_automatic_image_resizing"
+                  type="bool"/>
+      <preference id="general.autoScroll"              name="general.autoScroll"              type="bool"/>
+      <preference id="general.smoothScroll"            name="general.smoothScroll"            type="bool"/>
+      <preference id="app.update.autoUpdateEnabled"    name="app.update.autoUpdateEnabled"    type="bool"/>
+      <preference id="app.update.autoInstallEnabled"   name="app.update.autoInstallEnabled"   type="bool"/>
+      <preference id="app.update.autoInstallMode"      name="app.update.autoInstallMode"      type="int"/>
+      <preference id="extensions.update.autoUpdateEnabled"
+                  name="extensions.update.autoUpdateEnabled"
+                  type="bool"/>
+      <preference id="security.enable_ssl2"            name="security.enable_ssl2"            type="bool"/>
+      <preference id="security.enable_ssl3"            name="security.enable_ssl3"            type="bool"/>
+      <preference id="security.enable_tls"             name="security.enable_tls"             type="bool"/>
+      <preference id="security.default_personal_cert"  name="security.default_personal_cert"  type="string"/>
+      
+      <preference id="browser.preferences.advanced.selectedTabIndex"
+                  name="browser.preferences.advanced.selectedTabIndex"
+                  type="int"/>
+
+      <preference id="security.disable_button.openCertManager"
+                  name="security.disable_button.openCertManager"
+                  type="bool"/>
+      <preference id="security.OCSP.disable_button.managecrl"
+                  name="security.OCSP.disable_button.managecrl"
+                  type="bool"/>
+      <preference id="security.disable_button.openDeviceManager"
+                  name="security.disable_button.openDeviceManager"
+                  type="bool"/>
+      <preference id="pref.update.disable_button.update_app"
+                  name="pref.update.disable_button.update_app"
+                  type="bool"/>
+      <preference id="pref.update.disable_button.update_addons"
+                  name="pref.update.disable_button.update_addons"
+                  type="bool"/>
+    </preferences>
+    
+    <script type="application/x-javascript" src="chrome://browser/content/preferences/advanced.js"/>
+
+    <tabbox id="advancedPrefs" flex="1"
+            onselect="gAdvancedPane.tabSelectionChanged();">
+      <tabs>
+        <tab label="&generalTab.label;"/>
+        <tab label="&updateTab.label;"/>
+        <tab label="&securityTab.label;"/>
+      </tabs>
+      <tabpanels flex="1">
+        <tabpanel orient="vertical">
+          <groupbox align="start">
+            <caption label="&accessibility.label;"/>
+            <checkbox id="moveSystemCaret" label="&moveSystemCaret.label;" 
+                      accesskey="&moveSystemCaret.accesskey;"
+                      preference="accessibility.browsewithcaret"/>
+            <checkbox id="useTypeAheadFind" label="&useTypeAheadFind.label;"
+                      accesskey="&useTypeAheadFind.accesskey;"
+                      preference="accessibility.typeaheadfind"/>
+          </groupbox>
+          <groupbox align="start">
+            <caption label="&browsing.label;"/>
+            <checkbox id="enableAutoImageResizing"
+                      label="&enableAutoImageResizing.label;"
+                      accesskey="&enableAutoImageResizing.accesskey;"
+                      preference="browser.enable_automatic_image_resizing"/>
+            <checkbox id="useAutoScrolling" label="&useAutoScrolling.label;"
+                      accesskey="&useAutoScrolling.accesskey;"
+                      preference="general.autoScroll"/>
+            <checkbox id="useSmoothScrolling" label="&useSmoothScrolling.label;"
+                      accesskey="&useSmoothScrolling.accesskey;"
+                      preference="general.smoothScroll"/>
+          </groupbox>
+          <groupbox>
+            <caption label="&languages.caption;"/>
+            <hbox align="center">
+              <description flex="1">&languagesInfo.label;</description>
+              <button label="&showLanguages.label;"
+                      accesskey="&showLanguages.accesskey;"
+                      oncommand="gAdvancedPane.showLanguages();"/>
+            </hbox>
+          </groupbox>
+        </tabpanel>
+        <tabpanel orient="vertical">
+          <vbox>
+            <label>&softwareupdateinfo.label;</label>
+            <separator class="thin"/>
+            <vbox align="start">
+              <checkbox id="enableSmartUpdate"
+                        label="&enableSmartUpdate.label;"
+                        accesskey="&enableSmartUpdate.accesskey;"
+                        preference="app.update.autoUpdateEnabled"
+                        onpreferenceread="return gAdvancedPane.updateAppUpdateUI();"/>
+              <vbox class="indent" align="start">
+                <checkbox id="enableAutoInstall"
+                          label="&enableAutoInstall.label;"
+                          accesskey="&enableAutoInstall.accesskey;"
+                          preference="app.update.autoInstallEnabled"
+                          onpreferenceread="return gAdvancedPane.updateAutoInstallUI();"
+                          hidden="true"/>
+                <radiogroup id="autoInstallMode" preference="app.update.autoInstallMode" hidden="true">
+                  <grid class="indent">
+                    <columns>
+                      <column/>
+                      <column flex="1"/>
+                    </columns>
+                    <rows>
+                      <row><label id="updateAnd"
+                                  preference="app.update.autoUpdateEnabled">&updateAnd.label;</label>
+                           <radio label="&autoDownloadAndInstall.label;" 
+                                  accesskey="&autoDownloadAndInstall.accesskey;" value="0"/></row>
+                      <row><hbox/>
+                           <radio label="&autoDownloadAndPrompt.label;" 
+                                  accesskey="&autoDownloadAndPrompt.accesskey;" value="1"/></row>
+                    </rows>
+                  </grid>
+                </radiogroup>
+                <separator class="thin"/>
+                <hbox>
+                  <button label="&checkNow.label;" accesskey="&appCheckNow.accesskey;"
+                          oncommand="gAdvancedPane.checkForUpdates(Components.interfaces.nsIUpdateItem.TYPE_APP);"
+                          preference="pref.update.disable_button.update_app"/>
+                </hbox>
+              </vbox>
+            </vbox>
+            <separator class="thin"/>
+            <separator class="groove"/>
+            <separator class="thin"/>
+            <vbox align="start">
+              <checkbox id="enableExtensionUpdate"
+                        label="&enableExtensionUpdate.label;"
+                        accesskey="&enableExtensionUpdate.accesskey;"
+                        preference="extensions.update.autoUpdateEnabled"/>      
+              <separator class="thin"/>
+              <hbox class="indent">
+                <button label="&checkNow.label;" accesskey="&extensionsCheckNow.accesskey;"
+                        oncommand="gAdvancedPane.checkForUpdates(Components.interfaces.nsIUpdateItem.TYPE_ADDON);"
+                        preference="pref.update.disable_button.update_addons"/>
+              </hbox>
+            </vbox>
+          </vbox>
+        </tabpanel>
+        <tabpanel orient="vertical">
+          <groupbox>
+            <caption label="&protocols.label;"/>
+            <grid>
+              <columns>
+                <column flex="1"/>
+                <column flex="1"/>
+              </columns>
+              <rows>
+                <row>
+                  <hbox>
+                    <checkbox id="useSSL2" label="&useSSL2.label;" 
+                              accesskey="&useSSL2.accesskey;" 
+                              preference="security.enable_ssl2"/>
+                  </hbox>
+                  <hbox>
+                    <checkbox id="useSSL3" label="&useSSL3.label;"
+                              accesskey="&useSSL3.accesskey;"
+                              preference="security.enable_ssl3"/>
+                  </hbox>
+                </row>
+                <row>
+                  <hbox>
+                    <checkbox id="useTLS1" label="&useTLS1.label;"
+                              accesskey="&useTLS1.accesskey;"
+                              preference="security.enable_tls"/>
+                  </hbox>
+                  <hbox/>
+                </row>
+              </rows>
+            </grid>
+          </groupbox>
+          <groupbox>
+            <caption label="&certificates.label;"/>
+            <description>&certselect.description;</description>
+            <radiogroup id="certSelection" orient="horizontal" preftype="string" 
+	                      preference="security.default_personal_cert">
+              <radio label="&certselect.auto;" accesskey="&certselect.auto.accesskey;" 
+                     value="Select Automatically"/>
+              <radio label="&certselect.ask;" accesskey="&certselect.ask.accesskey;" 
+                     value="Ask Every Time"/>
+            </radiogroup>
+            
+            <separator/>
+            
+            <description>
+              <button label="&viewCertificates.label;" accesskey="&viewCertificates.accesskey;" 
+                      oncommand="gAdvancedPane.showCertificates();"
+                      preference="security.disable_button.openCertManager"/>
+              <button label="&viewCRLs.label;" accesskey="&viewCRLs.accesskey;" 
+                      oncommand="gAdvancedPane.showCRLs();"
+                      preference="security.OCSP.disable_button.managecrl"/>
+              <button label="&viewOCSP.label;" accesskey="&viewOCSP.accesskey;" 
+                      oncommand="gAdvancedPane.showOCSP();"/>
+              <button label="&viewSecurityDevices.label;" accesskey="&viewSecurityDevices.accesskey;" 
+                      oncommand="gAdvancedPane.showSecurityDevices();"
+                      preference="security.disable_button.openDeviceManager"/>
+            </description>                              
+          </groupbox>
+        </tabpanel>
+      </tabpanels>
+    </tabbox>   
+  </prefpane>
+
+</overlay>
Index: browser/components/preferences/advancedScript.xul
===================================================================
RCS file: browser/components/preferences/advancedScript.xul
diff -N browser/components/preferences/advancedScript.xul
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ browser/components/preferences/advancedScript.xul	21 Feb 2005 11:21:01 -0000
@@ -0,0 +1,86 @@
+<?xml version="1.0"?>
+
+# -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+# 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 the Firefox Preferences System.
+# 
+# The Initial Developer of the Original Code is Ben Goodger.
+# Portions created by the Initial Developer are Copyright (C) 2005
+# the Initial Developer. All Rights Reserved.
+# 
+# Contributor(s):
+#   Ben Goodger <ben@mozilla.org>
+# 
+# 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 *****
+
+<!DOCTYPE prefwindow SYSTEM "chrome://browser/locale/preferences/advancedScript.dtd">
+
+<?xml-stylesheet href="chrome://global/skin/"?>
+
+<prefwindow id="AdvancedScriptDialog" type="child"
+            xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+            title="&allowScripts.title;"
+            dlgbuttons="accept,cancel">
+
+  <prefpane id="AdvancedScriptDialogPane">  
+    <preferences>
+      <preference id="dom.event.contextmenu.enabled"  name="dom.event.contextmenu.enabled"  type="bool"/>
+      <preference id="dom.disable_window_move_resize" name="dom.disable_window_move_resize" type="bool" inverted="true"/>
+      <preference id="dom.disable_window_flip"        name="dom.disable_window_flip"        type="bool" inverted="true"/>
+      <preference id="dom.disable_image_src_set"      name="dom.disable_image_src_set"      type="bool" inverted="true"/>
+      <preference id="dom.disable_window_open_feature.status"
+                  name="dom.disable_window_open_feature.status"
+                  type="bool" inverted="true"/>
+      <preference id="dom.disable_window_status_change"
+                  name="dom.disable_window_status_change"
+                  type="bool" inverted="true"/>
+    </preferences>
+    
+    <groupbox align="start">
+      <caption label="&allowScripts.label;"/>
+
+      <checkbox id="allowWindowMoveResize" 
+                preference="dom.disable_window_move_resize"
+                label="&allowWindowMoveResize.label;"/>          
+      <checkbox id="allowWindowFlip" 
+                preference="dom.disable_window_flip"
+                label="&allowWindowFlip.label;"/>          
+      <checkbox id="allowControlContextMenu" 
+                preference="dom.event.contextmenu.enabled"
+                label="&allowControlContextMenu.label;"/>
+      <checkbox id="allowHideStatusBar" 
+                preference="dom.disable_window_open_feature.status"
+                label="&allowHideStatusBar.label;"/>          
+      <checkbox id="allowWindowStatusChange" 
+                preference="dom.disable_window_status_change"
+                label="&allowWindowStatusChange.label;"/>   
+      <checkbox id="allowImageSrcChange" 
+                preference="dom.disable_image_src_set"
+                label="&allowWindowImageSrcChange.label;"/>     
+    </groupbox>
+  </prefpane>
+</prefwindow>
+
Index: browser/components/preferences/changeaction.js
===================================================================
RCS file: browser/components/preferences/changeaction.js
diff -N browser/components/preferences/changeaction.js
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ browser/components/preferences/changeaction.js	21 Feb 2005 11:21:01 -0000
@@ -0,0 +1,252 @@
+# -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+# 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 the Download Actions Manager.
+# 
+# The Initial Developer of the Original Code is Ben Goodger.
+# Portions created by the Initial Developer are 
+# Copyright (C) 2000, 2001, 2003, 2005
+# the Initial Developer. All Rights Reserved.
+# 
+# Contributor(s):
+#   Ben Goodger <ben@mozilla.org>
+# 
+# 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 gChangeActionDialog = {
+  _item             : null,
+  _bundle           : null,
+  _lastSelectedMode : null,
+  _lastSelectedSave : null,
+
+  init: function ()
+  {
+    this._item = window.arguments[0];
+    this._bundle = document.getElementById("bundlePreferences");
+    dump("*** ir = " + this._item.toSource() + "\n");
+    
+    var typeField = document.getElementById("typeField");
+    typeField.value = this._item.typeName;
+    
+    var extensionField = document.getElementById("extensionField");
+    var ext = "." + this._item.extension.toLowerCase();
+    var contentType = this._item.type;
+    extensionField.value = this._bundle.getFormattedString("extensionStringFormat", [ext, contentType]);
+    
+    var typeIcon = document.getElementById("typeIcon");
+    typeIcon.src = this._item.bigIcon;
+
+    // Custom App Handler Path - this must be set before we set the selected
+    // radio button because the selection event handler for the radio group
+    // requires the extapp handler field to be non-empty for the extapp radio
+    // button to be selected. 
+    var customApp = document.getElementById("customApp");
+    if (this._item.customHandler)
+      customApp.file = this._item.customHandler;
+    else
+      customApp.file = null;
+
+    var defaultApp = document.getElementById("defaultApp");
+    var defaultAppIcon = null;
+    var fallbackIconURL = "moz-icon://goat?contentType=" + this._item.type + "&size=16";
+    if (this._item.mimeInfo instanceof Components.interfaces.nsIPropertyBag) {
+      defaultAppIcon = this._item.mimeInfo.getProperty("defaultApplicationIconURL");
+      if (defaultAppIcon)
+        defaultAppIcon += "?size=16";
+    }
+    defaultApp.image = defaultAppIcon || fallbackIconURL;
+    defaultApp.label = this._item.mimeInfo.defaultDescription;
+
+    var pluginName = document.getElementById("pluginName");
+    var foundPlugin = false;
+    for (var i = 0; i < navigator.plugins.length; ++i) {
+      var plugin = navigator.plugins[i];
+      for (var j = 0; j < plugin.length; ++j) {
+        if (contentType == plugin[j].type) {
+          pluginName.label = plugin.name;
+          pluginName.image = "moz-icon://goat.goat?contentType=" + contentType + "&size=16";
+          foundPlugin = true;
+        }
+      }
+    }
+    if (!foundPlugin) {
+      pluginName.label = this._bundle.getString("pluginHelperNoneAvailable");
+      document.getElementById("plugin").disabled = true;
+    }
+      
+    // Selected Action Radiogroup
+    var handlerGroup = document.getElementById("handlerGroup");
+    if (this._item.handleMode == FILEACTION_OPEN_PLUGIN && this._item.pluginEnabled)
+      handlerGroup.selectedItem = document.getElementById("plugin");
+    else {
+      if (this._item.handleMode == FILEACTION_OPEN_DEFAULT)
+        handlerGroup.selectedItem = document.getElementById("openDefault");
+      else if (this._item.handleMode == FILEACTION_SAVE_TO_DISK)
+        handlerGroup.selectedItem = document.getElementById("saveToDisk");
+      else
+        handlerGroup.selectedItem = document.getElementById("openApplication");
+    }
+    this._lastSelectedMode = handlerGroup.selectedItem;
+    
+    // Figure out the last selected Save As mode
+    var saveToOptions = document.getElementById("saveToOptions");
+    this._lastSelectedSave = saveToOptions.selectedItem;
+
+    // We don't let users open .exe files or random binary data directly 
+    // from the browser at the moment because of security concerns. 
+    var mimeType = this._item.mimeInfo.MIMEType;
+    if (mimeType == "application/object-stream" ||
+        mimeType == "application/x-msdownload") {
+      document.getElementById("openApplication").disabled = true;
+      document.getElementById("openDefault").disabled = true;
+      handlerGroup.selectedItem = document.getElementById("saveToDisk");
+    }
+  },
+  
+  onAccept: function ()
+  {
+    var contentType = this._item.mimeInfo.MIMEType;
+    var handlerGroup = document.getElementById("handlerGroup");
+    switch (handlerGroup.selectedItem.value) {
+    case "plugin":
+      this._item.handleMode = FILEACTION_OPEN_PLUGIN;
+      var pluginName = document.getElementById("pluginName");
+      this._item.action = this._bundle.getFormattedString("openWith", [pluginName.label]);
+      this._item.pluginEnabled = true;
+      break;
+    case "system":
+      this._item.handledOnlyByPlugin = false;
+      this._item.handleMode = FILEACTION_OPEN_DEFAULT;
+      var defaultDescr = this._item.mimeInfo.defaultDescription;
+      this._item.action = this._bundle.getFormattedString("openWith", [defaultDescr]);
+      break;
+    case "app":
+      this._item.handledOnlyByPlugin = false;
+      this._item.handleMode = FILEACTION_OPEN_CUSTOM;
+      var customApp = document.getElementById("customApp");
+      this._item.action = this._bundle.getFormattedString("openWith", [customApp.label]);        
+      break;  
+    case "save":
+      this._item.handledOnlyByPlugin = false;
+      this._item.handleMode = FILEACTION_SAVE_TO_DISK;
+      this._item.action = this._bundle.getString("saveToDisk");
+      break;  
+    }
+    
+    // The opener uses the modifications to the FileAction item to update the
+    // datasource.
+    return true;
+  },
+  
+  doEnabling: function (aSelectedItem)
+  {
+    var defaultApp            = document.getElementById("defaultApp");
+    var saveToDefault         = document.getElementById("saveToDefault");
+    var saveToCustom          = document.getElementById("saveToCustom");
+    var customDownloadFolder  = document.getElementById("customDownloadFolder");
+    var chooseCustomDownloadFolder = document.getElementById("chooseCustomDownloadFolder");
+    var saveToAskMe           = document.getElementById("saveToAskMe");
+    var pluginName            = document.getElementById("pluginName");
+    var changeApp             = document.getElementById("changeApp");
+    var customApp             = document.getElementById("customApp");
+    
+    switch (aSelectedItem.id) {
+    case "openDefault":
+      changeApp.disabled = customApp.disabled = saveToDefault.disabled = saveToCustom.disabled = customDownloadFolder.disabled = chooseCustomDownloadFolder.disabled = saveToAskMe.disabled = pluginName.disabled = true;
+      defaultApp.disabled = false;
+      break;
+    case "openApplication":
+      defaultApp.disabled = saveToDefault.disabled = saveToCustom.disabled = customDownloadFolder.disabled = chooseCustomDownloadFolder.disabled = saveToAskMe.disabled = pluginName.disabled = true;
+      changeApp.disabled = customApp.disabled = false;
+      if (!customApp.file && !this.changeApp()) {
+        this._lastSelectedMode.click();
+        return;
+      }
+      break;
+    case "saveToDisk":
+      changeApp.disabled = customApp.disabled = defaultApp.disabled = pluginName.disabled = true;
+      var saveToOptions = document.getElementById("saveToOptions");
+      customDownloadFolder.disabled = chooseCustomDownloadFolder.disabled = !(saveToOptions.selectedItem.id == "saveToCustom");
+      saveToDefault.disabled = saveToCustom.disabled = saveToAskMe.disabled = false;
+      break;
+    case "plugin":
+      changeApp.disabled = customApp.disabled = defaultApp.disabled = saveToDefault.disabled = saveToCustom.disabled = customDownloadFolder.disabled = chooseCustomDownloadFolder.disabled = saveToAskMe.disabled = true;
+      pluginName.disabled = false;
+      break;
+    }
+    this._lastSelectedMode = aSelectedItem;
+  },
+  
+  doSaveToDiskEnabling: function (aSelectedItem)
+  {
+    var isSaveToCustom = aSelectedItem.id == "saveToCustom";
+    var customDownloadFolder = document.getElementById("customDownloadFolder");
+    var chooseCustomDownloadFolder = document.getElementById("chooseCustomDownloadFolder");
+    chooseCustomDownloadFolder.disabled = customDownloadFolder.disabled = !isSaveToCustom;
+    
+    if (isSaveToCustom && 
+        !customDownloadFolder.file && !this.changeCustomFolder()) {
+      this._lastSelectedSave.click();
+      return;
+    }
+    this._lastSelectedSave = aSelectedItem;
+  },
+  
+  changeApp: function ()
+  {
+    const nsIFilePicker = Components.interfaces.nsIFilePicker;
+    var fp = Components.classes["@mozilla.org/filepicker;1"]
+                       .createInstance(nsIFilePicker);
+    var winTitle = this._bundle.getString("fpTitleChooseApp");
+    fp.init(window, winTitle, nsIFilePicker.modeOpen);
+    fp.appendFilters(nsIFilePicker.filterApps);
+    if (fp.show() == nsIFilePicker.returnOK && fp.file) {
+      var customApp = document.getElementById("customApp");
+      customApp.file = fp.file;
+      this._item.customHandler = fp.file;      
+      return true;
+    }
+    return false;
+  },
+  
+  changeCustomFolder: function ()
+  {
+    const nsIFilePicker = Components.interfaces.nsIFilePicker;
+    var fp = Components.classes["@mozilla.org/filepicker;1"]
+                       .createInstance(nsIFilePicker);
+
+    // extract the window title
+    var winTitle = this._bundle.getString("fpTitleChooseDL");
+    fp.init(window, winTitle, nsIFilePicker.modeGetFolder);
+    if (fp.show() == nsIFilePicker.returnOK && fp.file) {
+      var customDownloadFolder = document.getElementById("customDownloadFolder");
+      customDownloadFolder.file = fp.file;
+      customDownloadFolder.label = fp.file.path;
+      return true;
+    }
+    return false;
+  },
+};
+
Index: browser/components/preferences/changeaction.xul
===================================================================
RCS file: browser/components/preferences/changeaction.xul
diff -N browser/components/preferences/changeaction.xul
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ browser/components/preferences/changeaction.xul	21 Feb 2005 11:21:01 -0000
@@ -0,0 +1,104 @@
+<?xml version="1.0"?>
+
+# -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+# 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 the Download Actions Manager.
+# 
+# The Initial Developer of the Original Code is Ben Goodger.
+# Portions created by the Initial Developer are 
+# Copyright (C) 2000, 2001, 2003, 2005
+# the Initial Developer. All Rights Reserved.
+# 
+# Contributor(s):
+#   Ben Goodger <ben@mozilla.org>
+# 
+# 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 *****
+
+<?xml-stylesheet href="chrome://global/skin/"?>
+<?xml-stylesheet href="chrome://browser/content/preferences/preferences.css" type="text/css"?>
+<?xml-stylesheet href="chrome://browser/skin/preferences/preferences.css" type="text/css"?>
+
+<!DOCTYPE window SYSTEM "chrome://browser/locale/preferences/changeaction.dtd">
+
+<dialog id="ChangeActionDialog" title="&changeAction.title;"
+        xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+        onload="gChangeActionDialog.init();" 
+        ondialogaccept="return gChangeActionDialog.onAccept();" 
+        style="width: 36em;"
+        persist="screenX screenY">
+
+  <script type="application/x-javascript" src="chrome://browser/content/preferences/actionsshared.js"/>
+  <script type="application/x-javascript" src="chrome://browser/content/preferences/changeaction.js"/>
+  
+  <stringbundle id="bundlePreferences" src="chrome://browser/locale/preferences/preferences.properties"/>
+
+  <hbox id="changeActionHeader" align="center" class="indent">
+    <image id="typeIcon"/>
+    <vbox flex="1">
+      <label id="typeField" crop="right"/>
+      <label id="extensionField" crop="right"/>
+    </vbox>
+  </hbox>
+  <vbox id="changeActionContent" flex="1">
+    <label>&whenDownloading.label;</label>
+    <radiogroup id="handlerGroup" onselect="gChangeActionDialog.doEnabling(this.selectedItem);" flex="1">
+      <separator class="thin"/>
+      <radio id="openDefault" value="system" 
+             label="&openDefault.label;" accesskey="&openDefault.accesskey;"/>
+      <filefield class="indent" id="defaultApp" disabled="true"/>
+      <separator class="thin"/>
+      <radio id="openApplication" value="app" 
+             label="&openApplication.label;" accesskey="&openApplication.accesskey;"/>
+      <hbox align="center">
+        <filefield id="customApp" class="indent" flex="1" disabled="true"/>
+        <button id="changeApp" oncommand="gChangeActionDialog.changeApp();" 
+                label="&changeApp.label;" accesskey="&changeApp.accesskey;"
+                disabled="true"/>
+      </hbox>
+      <separator class="thin"/>
+      <radio id="saveToDisk" value="save" 
+             label="&saveToDisk.label;" accesskey="&saveToDisk.accesskey;"/>
+      <radiogroup id="saveToOptions" class="indent" onselect="gChangeActionDialog.doSaveToDiskEnabling(this.selectedItem);"
+                  hidden="true">
+        <radio id="saveToDefault" value="default" selected="true"
+               label="&saveToDefaultFolder.label;" accesskey="&saveToDefaultFolder.accesskey;"/>
+        <radio id="saveToCustom" value="custom"
+               label="&saveToThisFolder.label;" accesskey="&saveToThisFolder.accesskey;"/>
+        <hbox align="center" class="indent">
+          <filefield id="customDownloadFolder" flex="1"/>
+          <button id="chooseCustomDownloadFolder" oncommand="gChangeActionDialog.changeCustomFolder();"
+                  label="&chooseFolder.label;" accesskey="&chooseFolder.accesskey;"/>
+        </hbox>
+        <radio id="saveToAskMe" value="ask"
+               label="&saveToAskMe.label;" accesskey="&saveToAskMe.accesskey;"/>
+      </radiogroup>
+      <radio id="plugin" value="plugin" 
+             label="&usePlugin.label;" accesskey="&usePlugin.accesskey;"/>
+      <filefield class="indent" id="pluginName" disabled="true"/>
+    </radiogroup>
+  </vbox>
+</dialog>
+
Index: browser/components/preferences/colors.xul
===================================================================
RCS file: browser/components/preferences/colors.xul
diff -N browser/components/preferences/colors.xul
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ browser/components/preferences/colors.xul	21 Feb 2005 11:21:01 -0000
@@ -0,0 +1,110 @@
+<?xml version="1.0"?>
+
+# -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+# 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 the Firefox Preferences System.
+# 
+# The Initial Developer of the Original Code is Ben Goodger.
+# Portions created by the Initial Developer are Copyright (C) 2005
+# the Initial Developer. All Rights Reserved.
+# 
+# Contributor(s):
+#   Ben Goodger <ben@mozilla.org>
+# 
+# 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 *****
+
+<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
+
+<!DOCTYPE prefwindow SYSTEM "chrome://browser/locale/preferences/colors.dtd" >
+
+<prefwindow id="ColorsDialog" type="child"
+            xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+            title="&colorsDialog.title;"
+            dlgbuttons="accept,cancel"
+            style="width: 38em !important;">
+
+  <prefpane id="ColorsDialogPane">
+  
+    <preferences>
+      <preference id="browser.display.use_document_colors"  name="browser.display.use_document_colors"  type="bool"/>
+      <preference id="browser.anchor_color"                 name="browser.anchor_color"                 type="string"/>
+      <preference id="browser.visited_color"                name="browser.visited_color"                type="string"/>
+      <preference id="browser.underline_anchors"            name="browser.underline_anchors"            type="bool"/>
+      <preference id="browser.display.foreground_color"     name="browser.display.foreground_color"     type="string"/>
+      <preference id="browser.display.background_color"     name="browser.display.background_color"     type="string"/>
+      <preference id="browser.display.use_system_colors"    name="browser.display.use_system_colors"    type="bool"/>
+    </preferences>
+    
+    <hbox>
+      <groupbox flex="1">
+        <caption label="&color;"/>
+        <hbox align="center">
+          <label value="&textColor.label;" accesskey="&textColor.accesskey;" control="foregroundtextmenu"/>
+          <spacer flex="1"/>
+          <colorpicker type="button" id="foregroundtextmenu" palettename="standard"
+                       preference="browser.display.foreground_color"/>
+        </hbox>
+        <hbox align="center" style="margin-top: 5px">
+          <label value="&backgroundColor.label;" accesskey="&backgroundColor.accesskey;" control="backgroundmenu"/>
+          <spacer flex="1"/>
+          <colorpicker type="button" id="backgroundmenu" palettename="standard"
+                       preference="browser.display.background_color"/>
+        </hbox>
+        <separator class="thin"/>
+        <hbox align="center">
+          <checkbox id="browserUseSystemColors" label="&useSystemColors.label;" accesskey="&useSystemColors.accesskey;"
+                    preference="browser.display.use_system_colors"/>
+        </hbox>
+      </groupbox>
+        
+      <groupbox flex="1">
+        <caption label="&links;"/>
+        <hbox align="center">
+          <label value="&linkColor.label;" accesskey="&linkColor.accesskey;" control="unvisitedlinkmenu"/>
+          <spacer flex="1"/>
+          <colorpicker type="button" id="unvisitedlinkmenu" palettename="standard"
+                       preference="browser.anchor_color"/>
+        </hbox>
+        <hbox align="center" style="margin-top: 5px">
+          <label value="&visitedLinkColor.label;" accesskey="&visitedLinkColor.accesskey;" control="visitedlinkmenu"/>
+          <spacer flex="1"/>
+          <colorpicker type="button" id="visitedlinkmenu" palettename="standard"
+                       preference="browser.visited_color"/>
+        </hbox>
+        <separator class="thin"/>
+        <hbox align="center">
+          <checkbox id="browserUnderlineAnchors" label="&underlineLinks.label;" accesskey="&underlineLinks.accesskey;"
+                    preference="browser.underline_anchors"/>
+        </hbox>
+      </groupbox>
+    </hbox>
+    <hbox>
+      <checkbox id="useDocumentColors" 
+                label="&allowPagesToUse.label;" accesskey="&allowPagesToUse.accesskey;"
+                preference="browser.display.use_document_colors"/>
+    </hbox>
+  </prefpane>
+</prefwindow>
Index: browser/components/preferences/connection.js
===================================================================
RCS file: browser/components/preferences/connection.js
diff -N browser/components/preferences/connection.js
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ browser/components/preferences/connection.js	21 Feb 2005 11:21:01 -0000
@@ -0,0 +1,177 @@
+# -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+# 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 the Firefox Preferences System.
+# 
+# The Initial Developer of the Original Code is Ben Goodger.
+# Portions created by the Initial Developer are Copyright (C) 2005
+# the Initial Developer. All Rights Reserved.
+# 
+# Contributor(s):
+#   Ben Goodger <ben@mozilla.org>
+# 
+# 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 gConnectionsDialog = {
+  beforeAccept: function ()
+  {
+    var proxyTypePref = document.getElementById("network.proxy.type");
+    if (proxyTypePref.value != 1)
+      return true;
+
+    var httpProxyURLPref = document.getElementById("network.proxy.http");
+    var httpProxyPortPref = document.getElementById("network.proxy.http_port");
+    var shareProxiesPref = document.getElementById("network.proxy.share_proxy_settings");
+    if (shareProxiesPref.value) {
+      var proxyPrefs = ["ssl", "ftp", "socks", "gopher"];
+      for (var i = 0; i < proxyPrefs.length; ++i) {
+        var proxyServerURLPref = document.getElementById("network.proxy." + proxyPrefs[i]);
+        var proxyPortPref = document.getElementById("network.proxy." + proxyPrefs[i] + "_port");
+        var backupServerURLPref = document.getElementById("network.proxy.backup." + proxyPrefs[i]);
+        var backupPortPref = document.getElementById("network.proxy.backup." + proxyPrefs[i] + "_port");
+        backupServerURLPref.value = proxyServerURLPref.value;
+        backupPortPref.value = proxyPortPref.value;
+        proxyServerURLPref.value = httpProxyURLPref.value;
+        proxyPortPref.value = httpProxyPortPref.value;
+      }
+    }
+    return true;
+  },
+  
+  proxyTypeChanged: function ()
+  {
+    var proxyTypePref = document.getElementById("network.proxy.type");
+    
+    // Update http
+    var httpProxyURLPref = document.getElementById("network.proxy.http");
+    httpProxyURLPref.disabled = proxyTypePref.value != 1;
+    var httpProxyPortPref = document.getElementById("network.proxy.http_port");
+    httpProxyPortPref.disabled = proxyTypePref.value != 1;
+
+    // Now update the other protocols
+    this.updateProtocolPrefs();
+
+    var shareProxiesPref = document.getElementById("network.proxy.share_proxy_settings");
+    shareProxiesPref.disabled = proxyTypePref.value != 1;
+    
+    var noProxiesPref = document.getElementById("network.proxy.no_proxies_on");
+    noProxiesPref.disabled = proxyTypePref.value != 1;
+    
+    var autoconfigURLPref = document.getElementById("network.proxy.autoconfig_url");
+    autoconfigURLPref.disabled = proxyTypePref.value != 2;
+    
+    var disableReloadPref = document.getElementById("pref.advanced.proxies.disable_button.reload");
+    disableReloadPref.disabled = proxyTypePref.value != 2;
+  },
+  
+  readProxyType: function ()
+  {
+    this.proxyTypeChanged();
+    return undefined;
+  },
+  
+  updateProtocolPrefs: function ()
+  {
+    var proxyTypePref = document.getElementById("network.proxy.type");
+    var shareProxiesPref = document.getElementById("network.proxy.share_proxy_settings");
+    var proxyPrefs = ["ssl", "ftp", "socks", "gopher"];
+    for (var i = 0; i < proxyPrefs.length; ++i) {
+      var proxyServerURLPref = document.getElementById("network.proxy." + proxyPrefs[i]);
+      var proxyPortPref = document.getElementById("network.proxy." + proxyPrefs[i] + "_port");
+      
+      // Restore previous per-proxy custom settings, if present. 
+      if (!shareProxiesPref.value) {
+        var backupServerURLPref = document.getElementById("network.proxy.backup." + proxyPrefs[i]);
+        var backupPortPref = document.getElementById("network.proxy.backup." + proxyPrefs[i] + "_port");
+        if (backupServerURLPref.hasUserValue) {
+          proxyServerURLPref.value = backupServerURLPref.value;
+          backupServerURLPref.reset();
+        }
+        if (backupPortPref.hasUserValue) {
+          proxyPortPref.value = backupPortPref.value;
+          backupPortPref.reset();
+        }
+      }
+
+      proxyServerURLPref.updateElements();
+      proxyPortPref.updateElements();
+      proxyServerURLPref.disabled = proxyTypePref.value != 1 || shareProxiesPref.value;
+      proxyPortPref.disabled = proxyServerURLPref.disabled;
+    }
+    var socksVersionPref = document.getElementById("network.proxy.socks_version");
+    socksVersionPref.disabled = proxyTypePref.value != 1 || shareProxiesPref.value;
+    
+    return undefined;
+  },
+  
+  readProxyProtocolPref: function (aProtocol, aIsPort)
+  {
+    var shareProxiesPref = document.getElementById("network.proxy.share_proxy_settings");
+    if (shareProxiesPref.value) {
+      var pref = document.getElementById("network.proxy.http" + (aIsPort ? "_port" : ""));    
+      return pref.value;
+    }
+    
+    var backupPref = document.getElementById("network.proxy.backup." + aProtocol + (aIsPort ? "_port" : ""));
+    return backupPref.hasUserValue ? backupPref.value : undefined;
+  },
+
+  reloadPAC: function ()
+  {
+    var autoURL = document.getElementById("networkProxyAutoconfigURL");
+    var pps = Components.classesByID["{e9b301c0-e0e4-11D3-a1a8-0050041caf44}"]
+                        .getService(Components.interfaces.nsIProtocolProxyService);
+    pps.configureFromPAC(autoURL.value);
+  },
+  
+  writeAutoconfigURL: function ()
+  {
+    var autoURL = document.getElementById("networkProxyAutoconfigURL");
+    var URIFixup = Components.classes["@mozilla.org/docshell/urifixup;1"]
+                             .getService(Components.interfaces.nsIURIFixup);
+    try {
+      return URIFixup.createFixupURI(autoURL.value, 0).spec;
+    }
+    catch(ex) {
+    }
+    return undefined;
+  },
+  
+  readHTTPProxyServer: function ()
+  {
+    var shareProxiesPref = document.getElementById("network.proxy.share_proxy_settings");
+    if (shareProxiesPref.value)
+      this.updateProtocolPrefs();
+    return undefined;
+  },
+  
+  readHTTPProxyPort: function ()
+  {
+    var shareProxiesPref = document.getElementById("network.proxy.share_proxy_settings");
+    if (shareProxiesPref.value)
+      this.updateProtocolPrefs();
+    return undefined;
+  },
+};
Index: browser/components/preferences/connection.xul
===================================================================
RCS file: browser/components/preferences/connection.xul
diff -N browser/components/preferences/connection.xul
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ browser/components/preferences/connection.xul	21 Feb 2005 11:21:01 -0000
@@ -0,0 +1,203 @@
+<?xml version="1.0"?>
+
+# -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+# 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 the Firefox Preferences System.
+# 
+# The Initial Developer of the Original Code is Ben Goodger.
+# Portions created by the Initial Developer are Copyright (C) 2005
+# the Initial Developer. All Rights Reserved.
+# 
+# Contributor(s):
+#   Ben Goodger <ben@mozilla.org>
+# 
+# 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 *****
+
+<!DOCTYPE prefwindow SYSTEM "chrome://browser/locale/preferences/connection.dtd">
+
+<?xml-stylesheet href="chrome://global/skin/"?>
+
+<prefwindow id="ConnectionsDialog" type="child"
+            xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+            title="&connectionsDialog.title;"
+            dlgbuttons="accept,cancel"
+            onbeforeaccept="return gConnectionsDialog.beforeAccept();"
+            style="width: 37em !important;">
+
+  <prefpane id="ConnectionsDialogPane">
+    <preferences>
+      <preference id="network.proxy.type"         name="network.proxy.type"         type="int" onchange="gConnectionsDialog.proxyTypeChanged();"/>
+      <preference id="network.proxy.http"         name="network.proxy.http"         type="string"/>
+      <preference id="network.proxy.http_port"    name="network.proxy.http_port"    type="int"/>
+      <preference id="network.proxy.ftp"          name="network.proxy.ftp"          type="string"/>
+      <preference id="network.proxy.ftp_port"     name="network.proxy.ftp_port"     type="int"/>
+      <preference id="network.proxy.ssl"          name="network.proxy.ssl"          type="string"/>
+      <preference id="network.proxy.ssl_port"     name="network.proxy.ssl_port"     type="int"/>
+      <preference id="network.proxy.socks"        name="network.proxy.socks"        type="string"/>
+      <preference id="network.proxy.socks_port"   name="network.proxy.socks_port"   type="int"/>
+      <preference id="network.proxy.gopher"       name="network.proxy.gopher"       type="string"/>
+      <preference id="network.proxy.gopher_port"  name="network.proxy.gopher_port"  type="int"/>
+      <preference id="network.proxy.socks_version"  name="network.proxy.socks_version"  type="int"/>
+      <preference id="network.proxy.no_proxies_on"  name="network.proxy.no_proxies_on"  type="string"/>
+      <preference id="network.proxy.autoconfig_url" name="network.proxy.autoconfig_url" type="string"/>
+      <preference id="network.proxy.share_proxy_settings"
+                  name="network.proxy.share_proxy_settings"
+                  type="bool"/>
+      
+      <preference id="pref.advanced.proxies.disable_button.reload"
+                  name="pref.advanced.proxies.disable_button.reload"
+                  type="bool"/>
+
+      <preference id="network.proxy.backup.ftp"          name="network.proxy.backup.ftp"          type="string"/>
+      <preference id="network.proxy.backup.ftp_port"     name="network.proxy.backup.ftp_port"     type="int"/>
+      <preference id="network.proxy.backup.ssl"          name="network.proxy.backup.ssl"          type="string"/>
+      <preference id="network.proxy.backup.ssl_port"     name="network.proxy.backup.ssl_port"     type="int"/>
+      <preference id="network.proxy.backup.socks"        name="network.proxy.backup.socks"        type="string"/>
+      <preference id="network.proxy.backup.socks_port"   name="network.proxy.backup.socks_port"   type="int"/>
+      <preference id="network.proxy.backup.gopher"       name="network.proxy.backup.gopher"       type="string"/>
+      <preference id="network.proxy.backup.gopher_port"  name="network.proxy.backup.gopher_port"  type="int"/>
+    </preferences>
+    
+    <script type="application/x-javascript" src="chrome://browser/content/preferences/connection.js"/>
+
+    <stringbundle id="preferencesBundle" src="chrome://browser/locale/preferences/preferences.properties"/>
+
+    <groupbox>
+      <caption label="&proxyTitle.label;"/>
+
+      <radiogroup id="networkProxyType" preference="network.proxy.type"
+                  onpreferenceread="return gConnectionsDialog.readProxyType();">
+        <radio value="0" label="&directTypeRadio.label;" accesskey="&directTypeRadio.accesskey;"/>
+        <radio value="4" label="&WPADTypeRadio.label;" accesskey="&WPADTypeRadio.accesskey;"/>
+        <radio value="1" label="&manualTypeRadio.label;" accesskey="&manualTypeRadio.accesskey;"/>
+        <grid class="indent" flex="1">
+          <columns>
+            <column/>
+            <column flex="1"/>
+          </columns>
+          <rows>
+            <row align="center">
+              <hbox pack="end">
+                <label value="&http.label;" accesskey="&http.accesskey;" control="networkProxyHTTP"/>
+              </hbox>
+              <hbox align="center">
+                <textbox id="networkProxyHTTP" flex="1"
+                         preference="network.proxy.http" onpreferenceread="return gConnectionsDialog.readHTTPProxyServer();"/>
+                <label value="&port.label;" accesskey="&HTTPport.accesskey;" control="networkProxyHTTP_Port"/>
+                <textbox id="networkProxyHTTP_Port" size="5"
+                         preference="network.proxy.http_port" onpreferenceread="return gConnectionsDialog.readHTTPProxyPort();"/>
+              </hbox>
+            </row>
+            <row>
+              <hbox/>
+              <hbox>
+                <checkbox id="shareAllProxies" label="&shareproxy.label;" accesskey="&shareproxy.accesskey;"
+                          preference="network.proxy.share_proxy_settings"
+                          onpreferenceread="return gConnectionsDialog.updateProtocolPrefs();"/>
+              </hbox>
+            </row>
+            <row align="center">
+              <hbox pack="end">
+                <label value="&ssl.label;" accesskey="&ssl.accesskey;" control="networkProxySSL"/>
+              </hbox>
+              <hbox align="center">
+                <textbox id="networkProxySSL" flex="1" preference="network.proxy.ssl"
+                         onpreferenceread="return gConnectionsDialog.readProxyProtocolPref('ssl', false);"/>
+                <label value="&port.label;" accesskey="&SSLport.accesskey;" control="networkProxySSL_Port"/>
+                <textbox id="networkProxySSL_Port" size="5" preference="network.proxy.ssl_port"
+                         onpreferenceread="return gConnectionsDialog.readProxyProtocolPref('ssl', true);"/>
+              </hbox>
+            </row>
+            <row align="center">
+              <hbox pack="end">
+                <label value="&ftp.label;" accesskey="&ftp.accesskey;" control="networkProxyFTP"/>
+              </hbox>
+              <hbox align="center">
+                <textbox id="networkProxyFTP" flex="1" preference="network.proxy.ftp"
+                         onpreferenceread="return gConnectionsDialog.readProxyProtocolPref('ftp', false);"/>
+                <label value="&port.label;" accesskey="&FTPport.accesskey;" control="networkProxyFTP_Port"/>
+                <textbox id="networkProxyFTP_Port" size="5" preference="network.proxy.ftp_port"
+                         onpreferenceread="return gConnectionsDialog.readProxyProtocolPref('ftp', true);"/>
+              </hbox>
+            </row>
+            <row align="center">
+              <hbox pack="end">
+                <label value="&gopher.label;" accesskey="&gopher.accesskey;" control="networkProxyGopher"/>
+              </hbox>
+              <hbox align="center">
+                <textbox id="networkProxyGopher" flex="1" preference="network.proxy.gopher"
+                         onpreferenceread="return gConnectionsDialog.readProxyProtocolPref('gopher', false);"/>
+                <label value="&port.label;" accesskey="&gopherPort.accesskey;" control="networkProxyGopher_Port"/>
+                <textbox id="networkProxyGopher_Port" size="5" preference="network.proxy.gopher_port"
+                         onpreferenceread="return gConnectionsDialog.readProxyProtocolPref('gopher', true);"/>
+              </hbox>
+            </row>
+            <row align="center">
+              <hbox pack="end">
+                <label value="&socks.label;" accesskey="&socks.accesskey;" control="networkProxySOCKS"/>
+              </hbox>
+              <hbox align="center">
+                <textbox id="networkProxySOCKS" flex="1" preference="network.proxy.socks"
+                         onpreferenceread="return gConnectionsDialog.readProxyProtocolPref('socks', false);"/>
+                <label value="&port.label;" accesskey="&SOCKSport.accesskey;" control="networkProxySOCKS_Port"/>
+                <textbox id="networkProxySOCKS_Port" size="5" preference="network.proxy.socks_port"
+                         onpreferenceread="return gConnectionsDialog.readProxyProtocolPref('socks', true);"/>
+              </hbox>
+            </row>
+            <row>
+              <spacer/>
+              <radiogroup id="networkProxySOCKSVersion" orient="horizontal"
+                          preference="network.proxy.socks_version">
+                <radio id="networkProxySOCKSVersion4" value="4" label="&socks4.label;" accesskey="&socks4.accesskey;" />
+                <radio id="networkProxySOCKSVersion5" value="5" label="&socks5.label;" accesskey="&socks5.accesskey;" />
+              </radiogroup>
+            </row>
+
+            <row align="center"> 
+              <hbox align="center" pack="end">
+                <label value="&noproxy.label;" accesskey="&noproxy.accesskey;" control="networkProxyNone"/>
+              </hbox>
+              <textbox id="networkProxyNone" preference="network.proxy.no_proxies_on"/>
+            </row>
+            <row>
+              <spacer/>
+              <label value="&noproxyExplain.label;" control="networkProxyNone"/>
+            </row>
+          </rows>
+        </grid>
+        <radio value="2" label="&autoTypeRadio.label;" accesskey="&autoTypeRadio.accesskey;"/>
+        <hbox class="indent" flex="1" align="center">
+          <textbox id="networkProxyAutoconfigURL" flex="1" preference="network.proxy.autoconfig_url"
+                   onpreferencewrite="return gConnectionsDialog.writeAutoconfigURL();"/>
+          <button id="autoReload" label="&reload.label;" accesskey="&reload.accesskey;"
+                  oncommand="gConnectionsDialog.reloadPAC();" 
+                  preference="pref.advanced.proxies.disable_button.reload"/>
+        </hbox>
+      </radiogroup>
+    </groupbox>
+  </prefpane>
+</prefwindow>
+
Index: browser/components/preferences/content.js
===================================================================
RCS file: browser/components/preferences/content.js
diff -N browser/components/preferences/content.js
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ browser/components/preferences/content.js	21 Feb 2005 11:21:02 -0000
@@ -0,0 +1,196 @@
+# -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+# 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.org Code.
+# 
+# The Initial Developer of the Original Code is
+# Doron Rosenberg.
+# Portions created by the Initial Developer are Copyright (C) 2001
+# the Initial Developer. All Rights Reserved.
+# 
+# Contributor(s):
+# 
+# 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 *****
+
+const kFontNameFmtSerif         = "font.name.serif.%LANG%";
+const kFontNameFmtSansSerif     = "font.name.sans-serif.%LANG%";
+const kFontNameListFmtSerif     = "font.name-list.serif.%LANG%";
+const kFontNameListFmtSansSerif = "font.name-list.sans-serif.%LANG%";
+const kFontSizeFmtVariable      = "font.size.variable.%LANG%";
+
+var gContentPane = {
+  _pane: null,
+  
+  init: function ()
+  {
+    this._pane = document.getElementById("paneContent");
+    this._rebuildFonts();
+  },
+  
+  _rebuildFonts: function ()
+  {
+    var langGroupPref = document.getElementById("font.language.group");
+    var isSerifPref = document.getElementById("font.default");
+    this._selectLanguageGroup(langGroupPref.value, isSerifPref.value == "serif");
+  },
+  
+  _selectLanguageGroup: function (aLanguageGroup, aIsSerif)
+  {
+    var prefs = [{ format   : aIsSerif ? kFontNameFmtSerif : kFontNameFmtSansSerif,
+                   type     : "unichar", 
+                   element  : "defaultFont",      
+                   fonttype : aIsSerif ? "serif" : "sans-serif" },
+                 { format   : aIsSerif ? kFontNameListFmtSerif : kFontNameListFmtSansSerif,
+                   type     : "unichar", 
+                   element  : null,               
+                   fonttype : aIsSerif ? "serif" : "sans-serif" },
+                 { format   : kFontSizeFmtVariable,      
+                   type     : "int",     
+                   element  : "defaultFontSize",  
+                   fonttype : null }];
+    var preferences = document.getElementById("contentPreferences");
+    for (var i = 0; i < prefs.length; ++i) {
+      var preference = document.getElementById(prefs[i].format.replace(/%LANG%/, aLanguageGroup));
+      if (!preference) {
+        preference = document.createElement("preference");
+        var name = prefs[i].format.replace(/%LANG%/, aLanguageGroup);
+        preference.id = name;
+        preference.setAttribute("name", name);
+        preference.setAttribute("type", prefs[i].type);
+        preferences.appendChild(preference);
+      }
+      
+      if (!prefs[i].element)
+        continue;
+        
+      var element = document.getElementById(prefs[i].element);
+      if (element) {
+        element.setAttribute("preference", preference.id);
+      
+        if (prefs[i].fonttype)
+          FontBuilder.buildFontList(aLanguageGroup, prefs[i].fonttype, element);
+
+        preference.setElementValue(element);
+      }
+    }
+  },
+
+  writeEnableImagesPref: function ()
+  { 
+    var enableImages = document.getElementById("enableImages");
+    if (enableImages.checked) {
+      var enableRestricted = document.getElementById("enableRestricted");
+      return enableRestricted.checked ? 1 : 0;
+    }
+    return 2;
+  },
+  
+  readEnableImagesPref: function ()
+  {
+    var pref = document.getElementById("permissions.default.image");
+    var enableRestricted = document.getElementById("enableRestricted");    
+    enableRestricted.disabled = pref.value == 2;
+    return (pref.value == 0 || pref.value == 1);
+  },
+  
+  readEnableRestrictedPref: function ()
+  {
+    var pref = document.getElementById("permissions.default.image");
+    return (pref.value == 1);
+  },
+  
+  showAdvancedScript: function ()
+  {
+    openDialog("chrome://browser/content/preferences/advancedScript.xul", 
+               "", "chrome,modal");
+  },
+
+  _exceptionsParams: {
+    install: { blockVisible: false, sessionVisible: false, allowVisible: true, prefilledHost: "", permissionType: "install", },
+    popup:   { blockVisible: false, sessionVisible: false, allowVisible: true, prefilledHost: "", permissionType: "popup"   },
+    image:   { blockVisible: true,  sessionVisible: false, allowVisible: true, prefilledHost: "", permissionType: "image"   },
+  },
+  showExceptions: function (aPermissionType)
+  {
+    var bundlePreferences = document.getElementById("bundlePreferences");
+    var params = this._exceptionsParams[aPermissionType];
+    params.windowTitle = bundlePreferences.getString(aPermissionType + "permissionstitle");
+    params.introText = bundlePreferences.getString(aPermissionType + "permissionstext");
+    document.documentElement.openWindow("Browser:Permissions",
+                                        "chrome://browser/content/preferences/permissions.xul",
+                                        "", params);
+  },
+  
+  updateButtons: function (aButtonID, aPreferenceID)
+  {
+    var button = document.getElementById(aButtonID);
+    var preference = document.getElementById(aPreferenceID);
+    button.disabled = preference.value != true;
+    return undefined;
+  },
+  
+  readAnnoyancesEnabled: function ()
+  {
+    var contextMenuPref = document.getElementById("dom.event.contextmenu.enabled");
+    var windowMovePref = document.getElementById("dom.disable_window_move_resize");
+    var windowFlipPref = document.getElementById("dom.disable_window_flip");
+    var hideStatusPref = document.getElementById("dom.disable_window_open_feature.status");
+    var windowStatusPref = document.getElementById("dom.disable_window_status_change");
+    return !contextMenuPref.value && windowMovePref.value && 
+           windowFlipPref.value && hideStatusPref.value && 
+           windowStatusPref.value;
+  },
+  
+  writeAnnoyancesEnabled: function ()
+  {
+    var contextMenuPref = document.getElementById("dom.event.contextmenu.enabled");
+    var windowMovePref = document.getElementById("dom.disable_window_move_resize");
+    var windowFlipPref = document.getElementById("dom.disable_window_flip");
+    var hideStatusPref = document.getElementById("dom.disable_window_open_feature.status");
+    var windowStatusPref = document.getElementById("dom.disable_window_status_change");
+    
+    var disableImages = document.getElementById("disableAnnoyances");
+    contextMenuPref.value = !(windowMovePref.value = windowFlipPref.value = hideStatusPref.value = windowStatusPref.value = disableImages.checked);
+    return undefined;    
+  },
+  
+  annoyancesPrefChanged: function ()
+  {
+    var jsannoyancesPref = document.getElementById("browser.jsannoyances.disabled");
+    jsannoyancesPref.updateElements();
+  },
+  
+  showFonts: function ()
+  {
+    document.documentElement.openSubDialog("chrome://browser/content/preferences/fonts.xul",
+                                           "", null);  
+  },
+
+  showColors: function ()
+  {
+    document.documentElement.openSubDialog("chrome://browser/content/preferences/colors.xul",
+                                           "", null);  
+  }
+};
Index: browser/components/preferences/content.xul
===================================================================
RCS file: browser/components/preferences/content.xul
diff -N browser/components/preferences/content.xul
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ browser/components/preferences/content.xul	21 Feb 2005 11:21:02 -0000
@@ -0,0 +1,207 @@
+<?xml version="1.0"?>
+
+# -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+# 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 the Firefox Preferences System.
+# 
+# The Initial Developer of the Original Code is Ben Goodger.
+# Portions created by the Initial Developer are Copyright (C) 2005
+# the Initial Developer. All Rights Reserved.
+# 
+# Contributor(s):
+#   Ben Goodger <ben@mozilla.org>
+# 
+# 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 *****
+
+<!DOCTYPE overlay SYSTEM "chrome://browser/locale/preferences/content.dtd">
+
+<overlay id="ContentPaneOverlay"
+         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+
+  <prefpane id="paneContent" onpaneload="gContentPane.init();">
+    <preferences id="contentPreferences">
+      <preference id="dom.disable_open_during_load"   name="dom.disable_open_during_load"   type="bool"/>
+      <preference id="xpinstall.enabled"              name="xpinstall.enabled"              type="bool"/>
+      <preference id="permissions.default.image"      name="permissions.default.image"      type="int"/>
+      <preference id="security.enable_java"           name="security.enable_java"           type="bool"/>
+      <preference id="javascript.enabled"             name="javascript.enabled"             type="bool"/>
+      <preference id="browser.jsannoyances.disabled"  name="browser.jsannoyances.disabled"  type="bool"/>
+      <preference id="dom.event.contextmenu.enabled"  name="dom.event.contextmenu.enabled"  type="bool" 
+                  onchange="gContentPane.annoyancesPrefChanged();"/>
+      <preference id="dom.disable_window_move_resize" name="dom.disable_window_move_resize" type="bool" inverted="true" 
+                  onchange="gContentPane.annoyancesPrefChanged();"/>
+      <preference id="dom.disable_window_flip"        name="dom.disable_window_flip"        type="bool" inverted="true" 
+                  onchange="gContentPane.annoyancesPrefChanged();"/>
+      <preference id="dom.disable_window_open_feature.status"
+                  name="dom.disable_window_open_feature.status"
+                  type="bool" inverted="true"
+                  onchange="gContentPane.annoyancesPrefChanged();"/>
+      <preference id="dom.disable_window_status_change"
+                  name="dom.disable_window_status_change"
+                  type="bool" inverted="true"
+                  onchange="gContentPane.annoyancesPrefChanged();"/>
+      <preference id="font.language.group"            name="font.language.group"            type="wstring"  onchange="gContentPane._rebuildFonts();"/>
+      <preference id="font.default"                   name="font.default"                   type="string"   onchange="gContentPane._rebuildFonts();"/>
+      <preference id="pref.advanced.images.disable_button.view_image"
+                  name="pref.advanced.images.disable_button.view_image"
+                  type="bool"/>
+    </preferences>
+    
+    <script type="application/x-javascript" src="chrome://browser/content/preferences/fontbuilder.js"/>
+    <script type="application/x-javascript" src="chrome://browser/content/preferences/content.js"/>
+
+    <groupbox>
+      <grid>
+        <columns>
+          <column flex="1"/>
+          <column/>
+        </columns>
+        <rows>
+          <row>
+            <vbox align="start">
+              <checkbox id="popupPolicy" preference="dom.disable_open_during_load"
+                        label="&popupReject.label;" accesskey="&popupReject.accesskey;"
+                        onpreferenceread="return gContentPane.updateButtons('popupPolicyButton', 
+                                                                            'dom.disable_open_during_load');"/>
+            </vbox>
+            <button id="popupPolicyButton" label="&allowedSites.label;"
+                    oncommand="gContentPane.showExceptions('popup');"/>
+          </row>
+          <row>
+            <vbox align="start">
+              <checkbox id="enableSoftwareInstall" preference="xpinstall.enabled"
+                        label="&enableXPInstall.label;" accesskey="&enableXPInstall.accesskey;"
+                        onpreferenceread="return gContentPane.updateButtons('enableSoftwareInstallButton', 
+                                                                            'xpinstall.enabled');"/>
+            </vbox>
+            <button id="enableSoftwareInstallButton" label="&allowedSites.label;"
+                    oncommand="gContentPane.showExceptions('install');"/>
+          </row>
+          <row>
+            <vbox align="start">
+              <checkbox id="enableImages" 
+                        label="&enableImages.label;" 
+                        accesskey="&enableImages.accesskey;"
+                        preference="permissions.default.image"
+                        onpreferenceread="return gContentPane.readEnableImagesPref();"
+                        onpreferencewrite="return gContentPane.writeEnableImagesPref();"/>
+              <checkbox id="enableRestricted" class="indent"
+                        label="&forOriginatingSiteOnly.label;" 
+                        accesskey="&forOriginatingSiteOnly.accesskey;"
+                        preference="permissions.default.image"
+                        onpreferenceread="return gContentPane.readEnableRestrictedPref();"
+                        onpreferencewrite="return gContentPane.writeEnableImagesPref();"/>
+            </vbox>
+            <vbox>
+              <button id="manageImages" label="&exceptions.label;"
+                      oncommand="gContentPane.showExceptions('image');"
+                      preference="pref.advanced.images.disable_button.view_image"/>
+            </vbox>
+          </row>
+          <separator class="thin"/>
+          <row>
+            <vbox align="start">
+              <checkbox id="advancedJavaAllow" label="&enbJavaCheck.label;" accesskey="&enbJavaCheck.accesskey;"
+                        preference="security.enable_java"/>
+            </vbox>
+          </row>
+          <row>
+            <vbox align="start">
+              <checkbox id="enableJavaScript" preference="javascript.enabled"
+                        label="&enableJavaScript.label;" accesskey="&enableJavaScript.accesskey;"
+                        onpreferenceread="return gContentPane.updateButtons('disableAnnoyances', 
+                                                                            'javascript.enabled');"/>
+              <checkbox id="disableAnnoyances" class="indent" 
+                        preference="browser.jsannoyances.disabled"
+                        label="&disableAnnoyances.label;" accesskey="&disableAnnoyances.accesskey;"
+                        onpreferenceread="return gContentPane.readAnnoyancesEnabled();"
+                        onpreferencewrite="return gContentPane.writeAnnoyancesEnabled();"/>
+            </vbox>
+          </row>
+        </rows>
+      </grid>
+    </groupbox>  
+
+    <groupbox>
+      <caption label="&fonts.caption;"/>
+      
+      <grid>
+        <columns>
+          <column flex="1"/>
+          <column/>
+        </columns>
+        <rows>
+          <row>
+            <hbox align="center">
+              <label control="defaultFont" accesskey="&defaultFont.accesskey;">&defaultFont.label;</label>
+              <menulist id="defaultFont" flex="1"/>
+              <label control="defaultFontSize" accesskey="&defaultFontSize.accesskey;">&defaultFontSize.label;</label>
+              <menulist id="defaultFontSize">
+                <menupopup>
+                  <menuitem value="9" label="9"/>
+                  <menuitem value="10" label="10"/>
+                  <menuitem value="11" label="11"/>
+                  <menuitem value="12" label="12"/>
+                  <menuitem value="13" label="13"/>
+                  <menuitem value="14" label="14"/>
+                  <menuitem value="15" label="15"/>
+                  <menuitem value="16" label="16"/>
+                  <menuitem value="17" label="17"/>
+                  <menuitem value="18" label="18"/>
+                  <menuitem value="20" label="20"/>
+                  <menuitem value="22" label="22"/>
+                  <menuitem value="24" label="24"/>
+                  <menuitem value="26" label="26"/>
+                  <menuitem value="28" label="28"/>
+                  <menuitem value="30" label="30"/>
+                  <menuitem value="32" label="32"/>
+                  <menuitem value="34" label="34"/>
+                  <menuitem value="36" label="36"/>
+                  <menuitem value="40" label="40"/>
+                  <menuitem value="44" label="44"/>
+                  <menuitem value="48" label="48"/>
+                  <menuitem value="56" label="56"/>
+                  <menuitem value="64" label="64"/>
+                  <menuitem value="72" label="72"/>
+                </menupopup>
+              </menulist>
+            </hbox>
+            <button label="&advancedFonts.label;" 
+                    accesskey="&advancedFonts.accesskey;" 
+                    oncommand="gContentPane.showFonts();"/>
+          </row>
+          <row>
+            <hbox/>
+            <button label="&colors.label;" 
+                    accesskey="&colors.accesskey;" 
+                    oncommand="gContentPane.showColors();"/>
+          </row>
+        </rows>
+      </grid>
+    </groupbox>
+  </prefpane>
+
+</overlay>
Index: browser/components/preferences/cookies.js
===================================================================
RCS file: browser/components/preferences/cookies.js
diff -N browser/components/preferences/cookies.js
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ browser/components/preferences/cookies.js	21 Feb 2005 11:21:03 -0000
@@ -0,0 +1,863 @@
+# -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+# 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 the Firefox Preferences System.
+# 
+# The Initial Developer of the Original Code is Ben Goodger.
+# Portions created by the Initial Developer are Copyright (C) 2005
+# the Initial Developer. All Rights Reserved.
+# 
+# Contributor(s):
+#   Ben Goodger <ben@mozilla.org>
+# 
+# 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 *****
+
+const nsICookie = Components.interfaces.nsICookie;
+
+var gCookiesWindow = {
+  _cm               : Components.classes["@mozilla.org/cookiemanager;1"]
+                                .getService(Components.interfaces.nsICookieManager),
+  _ds               : Components.classes["@mozilla.org/intl/scriptabledateformat;1"]
+                                .getService(Components.interfaces.nsIScriptableDateFormat),
+  _hosts            : {},
+  _hostOrder        : [],
+  _tree             : null,
+  _bundle           : null,
+
+  init: function ()
+  {
+    var os = Components.classes["@mozilla.org/observer-service;1"]
+                       .getService(Components.interfaces.nsIObserverService);
+    os.addObserver(this, "cookie-changed", false);
+    os.addObserver(this, "perm-changed", false);
+    
+    this._bundle = document.getElementById("bundlePreferences");
+    this._tree = document.getElementById("cookiesList");
+    
+    this._loadCookies();
+    this._tree.treeBoxObject.view = this._view;
+    // this.sort("rawHost");
+    if (this._view.rowCount > 0) 
+      this._tree.view.selection.select(0);
+      
+    document.getElementById("filter").focus();
+  },
+  
+  uninit: function ()
+  {
+    var os = Components.classes["@mozilla.org/observer-service;1"]
+                       .getService(Components.interfaces.nsIObserverService);
+    os.removeObserver(this, "cookie-changed");
+    os.removeObserver(this, "perm-changed");
+  },
+  
+  _cookieEquals: function (aCookieA, aCookieB, aStrippedHost)
+  {
+    return aCookieA.rawHost == aStrippedHost &&
+           aCookieA.name == aCookieB.name &&
+           aCookieA.path == aCookieB.path;
+  },
+  
+  observe: function (aCookie, aTopic, aData) 
+  {
+    if (aTopic != "cookie-changed" || !aSubject)
+      return;
+    
+    if (aCookie instanceof Components.interfaces.nsICookie) {
+      var strippedHost = this._makeStrippedHost(aCookie.host);
+      if (aData == "changed")
+        this._handleCookieChanged(aCookie, strippedHost);
+      else if (aData == "added")
+        this._handleCookieAdded(aCookie, strippedHost);
+    }
+    
+    // We don't yet handle aData == "deleted" - it's a less common case
+    // and is rather complicated as selection tracking is difficult
+  },
+  
+  _handleCookieChanged: function (changedCookie, strippedHost) 
+  {
+    var rowIndex = 0;
+    var cookieItem = null;
+    if (!this._view._filtered) {
+      for (var i = 0; i < this._hostOrder.length; ++i) { // (var host in this._hosts) {
+        ++rowIndex;
+        var hostItem = this._hosts[this._hostOrder[i]]; // var hostItem = this._hosts[host];
+        if (this._hostOrder[i] == strippedHost) { // host == strippedHost) {
+          // Host matches, look for the cookie within this Host collection
+          // and update its data
+          for (var j = 0; j < hostItem.cookies.length; ++j) {
+            ++rowIndex;
+            var currCookie = hostItem.cookies[j];
+            if (this._cookieEquals(currCookie, changedCookie, strippedHost)) {
+              currCookie.value    = changedCookie.value;
+              currCookie.isSecure = changedCookie.isSecure;
+              currCookie.isDomain = changedCookie.isDomain;
+              currCookie.expires  = changedCookie.expires;
+              cookieItem = currCookie;
+              break;
+            }
+          }
+        }
+        else if (hostItem.open)
+          rowIndex += hostItem.cookies.length;
+      }
+    }
+    else {
+      // Just walk the filter list to find the item. It doesn't matter that
+      // we don't update the main Host collection when we do this, because
+      // when the filter is reset the Host collection is rebuilt anyway.
+      for (rowIndex = 0; rowIndex < this._view._filterSet.length; ++rowIndex) {
+        currCookie = this._view._filterSet[rowIndex];
+        if (this._cookieEquals(currCookie, changedCookie, strippedHost)) {
+          currCookie.value    = changedCookie.value;
+          currCookie.isSecure = changedCookie.isSecure;
+          currCookie.isDomain = changedCookie.isDomain;
+          currCookie.expires  = changedCookie.expires;
+          cookieItem = currCookie;
+          break;
+        }
+      }
+    }
+    
+    // Make sure the tree display is up to date...
+    this._tree.treeBoxObject.invalidateRow(rowIndex);
+    // ... and if the cookie is selected, update the displayed metadata too
+    if (cookieItem != null && this._view.selection.currentIndex == rowIndex)
+      this._updateCookieData(cookieItem);  
+  },
+  
+  _handleCookieAdded: function (changedCookie, strippedHost)
+  {
+    var rowCountImpact = 0;
+    var addedHost = { value: 0 };
+    this._addCookie(strippedHost, changedCookie, addedHost);
+    if (!this._view._filtered) {
+      // The Host collection for this cookie already exists, and it's not open, 
+      // so don't increment the rowCountImpact becaues the user is not going to
+      // see the additional rows as they're hidden. 
+      if (addedHost.value || this._hosts[strippedHost].open)
+        ++rowCountImpact;
+    }
+    else {
+      // We're in search mode, and the cookie being added matches
+      // the search condition, so add it to the list. 
+      var c = this._makeCookieObject(strippedHost, changedCookie);
+      if (this._cookieMatchesFilter(c)) {
+        this._view._filterSet.push(this._makeCookieObject(strippedHost, changedCookie));
+        ++rowCountImpact;
+      }
+    }
+    // Now update the tree display at the end (we could/should re run the sort
+    // if any to get the position correct.)
+    var oldRowCount = this._rowCount;
+    this._view._rowCount += rowCountImpact;
+    this._tree.treeBoxObject.rowCountChanged(oldRowCount - 1, rowCountImpact);
+
+    document.getElementById("removeAllCookies").disabled = this._view._filtered || (this._view.rowCount == 0);
+  },
+  
+  _view: {
+    _filtered   : false,
+    _filterSet  : [],
+    _filterValue: "",
+    _rowCount   : 0,
+    get rowCount() 
+    { 
+      return this._rowCount; 
+    },
+    
+    _getItemAtIndex: function (aIndex)
+    {
+      if (this._filtered)
+        return this._filterSet[aIndex];
+        
+      var count = 0, hostIndex = 0;
+      for (var i = 0; i < gCookiesWindow._hostOrder.length; ++i) { // var host in gCookiesWindow._hosts) {
+        var currHost = gCookiesWindow._hosts[gCookiesWindow._hostOrder[i]]; // gCookiesWindow._hosts[host];
+        if (!currHost) continue;
+        if (count == aIndex)
+          return currHost;
+        hostIndex = count;
+        if (currHost.open) {
+          if (count < aIndex && aIndex <= (count + currHost.cookies.length)) {
+            // We are looking for an entry within this host's children, 
+            // enumerate them looking for the index. 
+            ++count;
+            for (var i = 0; i < currHost.cookies.length; ++i) {
+              if (count == aIndex) {
+                var cookie = currHost.cookies[i];
+                cookie.parentIndex = hostIndex;
+                return cookie;
+              }
+              ++count;
+            }
+          }
+          else {
+            // A host entry was open, but we weren't looking for an index
+            // within that host entry's children, so skip forward over the
+            // entry's children. We need to add one to increment for the
+            // host value too. 
+            count += currHost.cookies.length + 1;
+          }
+        }
+        else
+          ++count;
+      }
+      return null;
+    },
+
+    _removeItemAtIndex: function (aIndex, aCount)
+    {
+      var removeCount = aCount === undefined ? 1 : aCount;
+      if (this._filtered) {
+        this._filterSet.splice(aIndex, removeCount);
+        return;
+      }
+      
+      var item = this._getItemAtIndex(aIndex);
+      if (!item) return;
+      if (item.container)
+        gCookiesWindow._hosts[item.rawHost] = null;
+      else {
+        var parent = this._getItemAtIndex(item.parentIndex);
+        for (var i = 0; i < parent.cookies.length; ++i) {
+          var cookie = parent.cookies[i];
+          if (item.rawHost == cookie.rawHost &&
+              item.name == cookie.name && item.path == cookie.path)
+            parent.cookies.splice(i, removeCount);
+        }
+      }
+    },
+    
+    getCellText: function (aIndex, aColumn)
+    {
+      if (!this._filtered) {
+        var item = this._getItemAtIndex(aIndex);
+        if (!item) 
+          return "";
+        if (aColumn.id == "domainCol")
+          return item.rawHost;
+        else if (aColumn.id == "nameCol")
+          return item.name;
+      }
+      else {
+        if (aColumn.id == "domainCol")
+          return this._filterSet[aIndex].rawHost;
+        else if (aColumn.id == "nameCol")
+          return this._filterSet[aIndex].name;
+      }
+      return "";
+    },
+
+    _selection: null, 
+    get selection () { return this._selection; },
+    set selection (val) { this._selection = val; return val; },
+    getRowProperties: function (aIndex, aProperties) {},
+    getCellProperties: function (aIndex, aColumn, aProperties) {},
+    getColumnProperties: function (aColumn, aProperties) {},
+    isContainer: function (aIndex)
+    {
+      if (!this._filtered) {
+        var item = this._getItemAtIndex(aIndex);
+        if (!item) return false;
+        return item.container;
+      }
+      return false;
+    },
+    isContainerOpen: function (aIndex) 
+    { 
+      if (!this._filtered) {
+        var item = this._getItemAtIndex(aIndex);
+        if (!item) return false;
+        return item.open;
+      }
+      return false;
+    },
+    isContainerEmpty: function (aIndex) 
+    { 
+      if (!this._filtered) {
+        var item = this._getItemAtIndex(aIndex);
+        if (!item) return false;
+        return item.cookies.length == 0;
+      }
+      return false;
+    },
+    isSeparator: function (aIndex) { return false; },    
+    isSorted: function (aIndex) { return false; },    
+    canDrop: function (aIndex, aOrientation) { return false; },    
+    drop: function (aIndex, aOrientation) {},    
+    getParentIndex: function (aIndex) 
+    {
+      if (!this._filtered) {
+        var item = this._getItemAtIndex(aIndex);
+        if (!item) return -1;
+        return item.parentIndex;
+      }
+      return -1;
+    },    
+    hasNextSibling: function (aParentIndex, aIndex) 
+    { 
+      if (!this._filtered) {
+        // |aParentIndex| appears to be bogus, but we can get the real
+        // parent index by getting the entry for |aIndex| and reading the
+        // parentIndex field. 
+        // The index of the last item in this host collection is the 
+        // index of the parent + the size of the host collection, and
+        // aIndex has a next sibling if it is less than this value.
+        var item = this._getItemAtIndex(aIndex);
+        if (item) {
+          if (item.container) {
+            for (var i = aIndex + 1; i < this.rowCount; ++i) {
+              var subsequent = this._getItemAtIndex(i);
+              if (subsequent.container) 
+                return true;
+            }
+            return false;
+          }
+          else {
+            var parent = this._getItemAtIndex(item.parentIndex);
+            if (parent && parent.container)
+              return aIndex < item.parentIndex + parent.cookies.length;
+          }
+        }
+      }
+      return aIndex < this.rowCount - 1;
+    },
+    hasPreviousSibling: function (aIndex)
+    {
+      if (!this._filtered) {
+        var item = this._getItemAtIndex(aIndex);
+        if (!item) return false;
+        var parent = this._getItemAtIndex(item.parentIndex);
+        if (parent && parent.container)
+          return aIndex > item.parentIndex + 1;
+      }
+      return aIndex > 0;
+    },
+    getLevel: function (aIndex) 
+    {
+      if (!this._filtered) {
+        var item = this._getItemAtIndex(aIndex);
+        if (!item) return 0;
+        return item.level;
+      }
+      return 0;
+    },
+    getImageSrc: function (aIndex, aColumn) {},    
+    getProgressMode: function (aIndex, aColumn) {},    
+    getCellValue: function (aIndex, aColumn) {},
+    setTree: function (aTree) {},    
+    toggleOpenState: function (aIndex) 
+    {
+      if (!this._filtered) {
+        var item = this._getItemAtIndex(aIndex);
+        if (!item) return;
+        var multiplier = item.open ? -1 : 1;
+        var delta = multiplier * item.cookies.length;
+        this._rowCount += delta;
+        item.open = !item.open;
+        gCookiesWindow._tree.treeBoxObject.rowCountChanged(aIndex + 1, delta);
+        gCookiesWindow._tree.treeBoxObject.invalidateRow(aIndex);
+      }
+    },    
+    cycleHeader: function (aColumn) {},    
+    selectionChanged: function () {},    
+    cycleCell: function (aIndex, aColumn) {},    
+    isEditable: function (aIndex, aColumn) 
+    { 
+      return false; 
+    },
+    setCellValue: function (aIndex, aColumn, aValue) {},    
+    setCellText: function (aIndex, aColumn, aValue) {},    
+    performAction: function (aAction) {},  
+    performActionOnRow: function (aAction, aIndex) {},    
+    performActionOnCell: function (aAction, aindex, aColumn) {}
+  },
+  
+  _makeStrippedHost: function (aHost)
+  {
+    var formattedHost = aHost.charAt(0) == "." ? aHost.substring(1, aHost.length) : aHost;
+    return formattedHost.substring(0, 4) == "www." ? formattedHost.substring(4, formattedHost.length) : formattedHost;
+  },
+  
+  _addCookie: function (aStrippedHost, aCookie, aHostCount)
+  {
+    if (!(aStrippedHost in this._hosts) || !this._hosts[aStrippedHost]) {
+      this._hosts[aStrippedHost] = { cookies   : [], 
+                                     rawHost   : aStrippedHost,
+                                     level     : 0,
+                                     open      : false,
+                                     container : true };
+      this._hostOrder.push(aStrippedHost);
+      ++aHostCount.value;
+    }
+    
+    var c = this._makeCookieObject(aStrippedHost, aCookie);    
+    this._hosts[aStrippedHost].cookies.push(c);
+  },
+  
+  _makeCookieObject: function (aStrippedHost, aCookie)
+  {
+    var host = aCookie.host;
+    var formattedHost = host.charAt(0) == "." ? host.substring(1, host.length) : host;
+    var c = { name        : aCookie.name,
+              value       : aCookie.value,
+              isDomain    : aCookie.isDomain,
+              host        : aCookie.host,
+              rawHost     : aStrippedHost,
+              path        : aCookie.path,
+              isSecure    : aCookie.isSecure,
+              expires     : aCookie.expires,
+              level       : 1,
+              container   : false };
+    return c;
+  },
+  
+  _loadCookies: function () 
+  {
+    var e = this._cm.enumerator;
+    var hostCount = { value: 0 };
+    this._hosts = {};
+    this._hostOrder = [];
+    while (e.hasMoreElements()) {
+      var cookie = e.getNext();
+      if (cookie && cookie instanceof Components.interfaces.nsICookie) {
+        var strippedHost = this._makeStrippedHost(cookie.host);
+        this._addCookie(strippedHost, cookie, hostCount);
+      }
+      else
+        break;
+    }
+    this._view._rowCount = hostCount.value;
+  },
+  
+  formatExpiresString: function (aExpires) 
+  {
+    if (aExpires) {
+      var date = new Date(1000 * aExpires);
+      return this._ds.FormatDateTime("", this._ds.dateFormatLong,
+                                     this._ds.timeFormatSeconds,
+                                     date.getFullYear(),
+                                     date.getMonth() + 1,
+                                     date.getDate(),
+                                     date.getHours(),
+                                     date.getMinutes(),
+                                     date.getSeconds());
+    }
+    return this._bundle.getString("AtEndOfSession");
+  },
+  
+  _updateCookieData: function (aItem)
+  {
+    var seln = this._view.selection;
+    var ids = ["nameLabel", "name", "valueLabel", "value", "isDomain", "host", 
+               "pathLabel", "path", "isSecureLabel", "isSecure", "expiresLabel", 
+               "expires"];
+    if (aItem && !aItem.container && seln.count > 0) {
+      properties = { name: aItem.name, value: aItem.value, host: aItem.host,
+                     path: aItem.path, expires: aItem.expires, 
+                     isDomain: aItem.isDomain ? this._bundle.getString("domainColon")
+                                              : this._bundle.getString("hostColon"),
+                     isSecure: aItem.isSecure ? this._bundle.getString("forSecureOnly")
+                                              : this._bundle.getString("forAnyConnection") };
+      for (var i = 0; i < ids.length; ++i)
+        document.getElementById(ids[i]).disabled = false;
+    }
+    else {
+      var noneSelected = this._bundle.getString("noCookieSelected");
+      properties = { name: noneSelected, value: noneSelected, host: noneSelected,
+                     path: noneSelected, expires: noneSelected, 
+                     isSecure: noneSelected };
+      for (i = 0; i < ids.length; ++i)
+        document.getElementById(ids[i]).disabled = true;
+    }
+    for (var property in properties)
+      document.getElementById(property).value = properties[property];
+  },
+  
+  onCookieSelected: function () 
+  {
+    var properties, item;
+    var seln = this._tree.view.selection;
+    if (!this._view._filtered) 
+      item = this._view._getItemAtIndex(seln.currentIndex);
+    else
+      item = this._view._filterSet[seln.currentIndex];
+      
+    this._updateCookieData(item);
+    
+    var rangeCount = seln.getRangeCount();
+    var selectedCookieCount = 0;
+    for (i = 0; i < rangeCount; ++i) {
+      var min = {}; var max = {};
+      seln.getRangeAt(i, min, max);
+      for (var j = min.value; j <= max.value; ++j) {
+        item = this._view._getItemAtIndex(j);
+        if (!item) continue;
+        if (item.container && !item.open)
+          selectedCookieCount += item.cookies.length;
+        else if (!item.container)
+          ++selectedCookieCount;
+      }
+    }
+    var item = this._view._getItemAtIndex(seln.currentIndex);
+    if (item && seln.count == 1 && item.container && item.open)
+      selectedCookieCount += 2;
+      
+    var stringKey = selectedCookieCount == 1 ? "removeCookie" : "removeCookies";
+    document.getElementById("removeCookie").label = this._bundle.getString(stringKey);
+    
+    document.getElementById("removeAllCookies").disabled = this._view._filtered || (this._view.rowCount == 0);
+    document.getElementById("removeCookie").disabled = !(seln.count > 0);
+  },
+  
+  deleteCookie: function () 
+  { 
+#   // Selection Notes
+#   // - Selection always moves to *NEXT* adjacent item unless item
+#   //   is last child at a given level in which case it moves to *PREVIOUS*
+#   //   item
+#   //
+#   // Selection Cases (Somewhat Complicated)
+#   // 
+#   // 1) Single cookie selected, host has single child
+#   //    v cnn.com
+#   //    //// cnn.com ///////////// goksdjf@ ////
+#   //    > atwola.com
+#   //
+#   //    Before SelectedIndex: 1   Before RowCount: 3
+#   //    After  SelectedIndex: 0   After  RowCount: 1
+#   //
+#   // 2) Host selected, host open
+#   //    v goats.com ////////////////////////////
+#   //         goats.com             sldkkfjl
+#   //         goat.scom             flksj133
+#   //    > atwola.com
+#   //
+#   //    Before SelectedIndex: 0   Before RowCount: 4
+#   //    After  SelectedIndex: 0   After  RowCount: 1
+#   //
+#   // 3) Host selected, host closed
+#   //    > goats.com ////////////////////////////
+#   //    > atwola.com
+#   //
+#   //    Before SelectedIndex: 0   Before RowCount: 2
+#   //    After  SelectedIndex: 0   After  RowCount: 1
+#   //
+#   // 4) Single cookie selected, host has many children
+#   //    v goats.com
+#   //         goats.com             sldkkfjl
+#   //    //// goats.com /////////// flksjl33 ////
+#   //    > atwola.com
+#   //
+#   //    Before SelectedIndex: 2   Before RowCount: 4
+#   //    After  SelectedIndex: 1   After  RowCount: 3
+#   //
+#   // 5) Single cookie selected, host has many children
+#   //    v goats.com
+#   //    //// goats.com /////////// flksjl33 ////
+#   //         goats.com             sldkkfjl
+#   //    > atwola.com
+#   //
+#   //    Before SelectedIndex: 1   Before RowCount: 4
+#   //    After  SelectedIndex: 1   After  RowCount: 3
+    var seln = this._view.selection;
+    var tbo = this._tree.treeBoxObject;
+    
+    if (seln.count < 1) return;
+    
+    var nextSelected = 0;
+    var rowCountImpact = 0;
+    var deleteItems = [];
+    if (!this._view._filtered) {
+      var ci = seln.currentIndex;
+      nextSelected = ci;
+      var invalidateRow = -1;
+      var item = this._view._getItemAtIndex(ci);
+      if (item.container) {
+        rowCountImpact -= (item.open ? item.cookies.length : 0) + 1;
+        deleteItems = deleteItems.concat(item.cookies);
+        if (!this._view.hasNextSibling(-1, ci)) 
+          --nextSelected;
+        this._view._removeItemAtIndex(ci);
+      }
+      else {
+        var parent = this._view._getItemAtIndex(item.parentIndex);
+        --rowCountImpact;
+        if (parent.cookies.length == 1) {
+          --rowCountImpact;
+          deleteItems.push(item);
+          if (!this._view.hasNextSibling(-1, ci))
+            --nextSelected;
+          if (!this._view.hasNextSibling(-1, item.parentIndex)) 
+            --nextSelected;
+          this._view._removeItemAtIndex(item.parentIndex);
+          invalidateRow = item.parentIndex;
+        }
+        else {
+          deleteItems.push(item);
+          if (!this._view.hasNextSibling(-1, ci)) 
+            --nextSelected;
+          this._view._removeItemAtIndex(ci);
+        }
+      }
+      this._view._rowCount += rowCountImpact;
+      tbo.rowCountChanged(ci, rowCountImpact);
+      if (invalidateRow != -1)
+        tbo.invalidateRow(invalidateRow);
+    }
+    else {
+      var rangeCount = seln.getRangeCount();
+      for (var i = 0; i < rangeCount; ++i) {
+        var min = {}; var max = {};
+        seln.getRangeAt(i, min, max);
+        nextSelected = min.value;        
+        for (var j = min.value; j <= max.value; ++j) {
+          deleteItems.push(this._view._getItemAtIndex(j));
+          if (!this._view.hasNextSibling(-1, max.value))
+            --nextSelected;
+        }
+        var delta = max.value - min.value + 1;
+        this._view._removeItemAtIndex(min.value, delta);
+        rowCountImpact = -1 * delta;
+        this._view._rowCount += rowCountImpact;
+        tbo.rowCountChanged(min.value, rowCountImpact);
+      }
+    }
+    
+    var psvc = Components.classes["@mozilla.org/preferences-service;1"]
+                         .getService(Components.interfaces.nsIPrefBranch);
+    var blockFutureCookies = false;
+    if (psvc.prefHasUserValue("network.cookie.blockFutureCookies"))
+      blockFutureCookies = psvc.getBoolPref("network.cookie.blockFutureCookies");
+    for (i = 0; i < deleteItems.length; ++i) {
+      var item = deleteItems[i];
+      this._cm.remove(item.host, item.name, item.path, blockFutureCookies);
+    }
+    
+    if (nextSelected < 0)
+      seln.clearSelection();
+    else {
+      seln.select(nextSelected);
+      this._tree.focus();
+    }
+  },
+  
+  deleteAllCookies: function ()
+  {
+    this._cm.removeAll();
+    this._hosts = {};
+    this._hostOrder = [];
+    
+    var oldRowCount = this._view._rowCount;
+    this._view._rowCount = 0;
+    this._tree.treeBoxObject.rowCountChanged(0, -oldRowCount);
+    this._view.selection.clearSelection();
+    
+    this._tree.focus();
+  },
+  
+  onCookieKeyPress: function (aEvent)
+  {
+    if (aEvent.keyCode == 46)
+      this.deleteCookie();
+  },
+  
+  _lastSortProperty : "",
+  _lastSortAscending: false,
+  sort: function (aProperty) 
+  {
+    var ascending = (aProperty == this._lastSortProperty) ? !this._lastSortAscending : true;
+    // Sort the Non-Filtered Host Collections
+    if (aProperty == "rawHost") {
+      function sortByHost(a, b)
+      {
+        return a.toLowerCase().localeCompare(b.toLowerCase());
+      }
+      this._hostOrder.sort(sortByHost);
+      if (!ascending)
+        this._hostOrder.reverse();
+    }
+        
+    function sortByProperty(a, b) 
+    {
+      return a[aProperty].toLowerCase().localeCompare(b[aProperty].toLowerCase());
+    }
+    for (var host in this._hosts) {
+      var cookies = this._hosts[host].cookies;
+      cookies.sort(sortByProperty);
+      if (!ascending)
+        cookies.reverse();
+    }
+    // Sort the Filtered List, if in Filtered mode
+    if (this._view._filtered) { 
+      this._view._filterSet.sort(sortByProperty);
+      if (!ascending)
+        this._view._filterSet.reverse();
+    }
+
+    this._view.selection.clearSelection();
+    this._view.selection.select(0);
+    this._tree.treeBoxObject.invalidate();
+    this._tree.treeBoxObject.ensureRowIsVisible(0);
+
+    this._lastSortAscending = ascending;
+    this._lastSortProperty = aProperty;
+  },
+  
+  clearFilter: function ()
+  {
+    // Revert to single-select in the tree
+    this._tree.setAttribute("seltype", "single");
+    
+    // Clear the Filter and the Tree Display
+    document.getElementById("filter").value = "";
+    this._view._filtered = false;
+    this._view._rowCount = 0;
+    this._tree.treeBoxObject.rowCountChanged(0, -this._view._filterSet.length);
+    this._view._filterSet = [];
+
+    // Just reload the list to make sure deletions are respected
+    this._loadCookies();
+    this._tree.treeBoxObject.view = this._view;
+
+    // Restore open state
+    for (var i = 0; i < this._openIndices.length; ++i)
+      this._view.toggleOpenState(this._openIndices[i]);
+    this._openIndices = [];
+    
+    // Restore selection
+    this._view.selection.clearSelection();
+    for (i = 0; i < this._lastSelectedRanges.length; ++i) {
+      var range = this._lastSelectedRanges[i];
+      this._view.selection.rangedSelect(range.min, range.max, true);
+    }
+    this._lastSelectedRanges = [];
+
+    document.getElementById("cookiesIntro").value = this._bundle.getString("cookiesAll");
+    document.getElementById("clearFilter").disabled = true;
+  },
+  
+  _cookieMatchesFilter: function (aCookie)
+  {
+    return aCookie.rawHost.indexOf(this._view._filterValue) != -1 ||
+           aCookie.name.indexOf(this._view._filterValue) != -1 || 
+           aCookie.value.indexOf(this._view._filterValue) != -1;
+  },
+  
+  _filterCookies: function (aFilterValue)
+  {
+    this._view._filterValue = aFilterValue;
+    var cookies = [];
+    for (var i = 0; i < gCookiesWindow._hostOrder.length; ++i) { //var host in gCookiesWindow._hosts) {
+      var currHost = gCookiesWindow._hosts[gCookiesWindow._hostOrder[i]]; // gCookiesWindow._hosts[host];
+      if (!currHost) continue;
+      for (var j = 0; j < currHost.cookies.length; ++j) {
+        var cookie = currHost.cookies[j];
+        if (this._cookieMatchesFilter(cookie))
+          cookies.push(cookie);
+      }
+    }
+    return cookies;
+  },
+  
+  _lastSelectedRanges: [],
+  _openIndices: [],
+  _saveState: function ()
+  {
+    // Save selection
+    var seln = this._view.selection;
+    this._lastSelectedRanges = [];
+    var rangeCount = seln.getRangeCount();
+    for (var i = 0; i < rangeCount; ++i) {
+      var min = {}; var max = {};
+      seln.getRangeAt(i, min, max);
+      this._lastSelectedRanges.push({ min: min.value, max: max.value });
+    }
+  
+    // Save open states
+    this._openIndices = [];
+    for (i = 0; i < this._view.rowCount; ++i) {
+      var item = this._view._getItemAtIndex(i);
+      if (item && item.container && item.open)
+        this._openIndices.push(i);
+    }
+  },
+  
+  _filterTimeout: -1,
+  onFilterInput: function ()
+  {
+    if (this._filterTimeout != -1)
+      clearTimeout(this._filterTimeout);
+   
+    function filterCookies()
+    {
+      var filter = document.getElementById("filter").value;
+      if (filter == "") {
+        gCookiesWindow.clearFilter();
+        return;
+      }        
+      var view = gCookiesWindow._view;
+      view._filterSet = gCookiesWindow._filterCookies(filter);
+      if (!view._filtered) {
+        // Save Display Info for the Non-Filtered mode when we first
+        // enter Filtered mode. 
+        gCookiesWindow._saveState();
+        view._filtered = true;
+      }
+      // Move to multi-select in the tree
+      gCookiesWindow._tree.setAttribute("seltype", "multiple");
+      
+      // Clear the display
+      var oldCount = view._rowCount;
+      view._rowCount = 0;
+      gCookiesWindow._tree.treeBoxObject.rowCountChanged(0, -oldCount);
+      // Set up the filtered display
+      view._rowCount = view._filterSet.length;
+      gCookiesWindow._tree.treeBoxObject.rowCountChanged(0, view.rowCount);
+      
+      view.selection.select(0);
+      document.getElementById("cookiesIntro").value = gCookiesWindow._bundle.getString("cookiesFiltered");
+      document.getElementById("clearFilter").disabled = false;
+    }
+    window.filterCookies = filterCookies;
+    this._filterTimeout = setTimeout("filterCookies();", 500);
+  },
+  
+  onFilterKeyPress: function (aEvent)
+  {
+    if (aEvent.keyCode == 27) // ESC key
+      this.clearFilter();
+  },
+  
+  focusFilterBox: function ()
+  { 
+    var filter = document.getElementById("filter");
+    filter.focus();
+    filter.select();
+  }
+};
+
Index: browser/components/preferences/cookies.xul
===================================================================
RCS file: browser/components/preferences/cookies.xul
diff -N browser/components/preferences/cookies.xul
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ browser/components/preferences/cookies.xul	21 Feb 2005 11:21:03 -0000
@@ -0,0 +1,143 @@
+<?xml version="1.0"?>
+
+# -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+# 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 the Firefox Preferences System.
+# 
+# The Initial Developer of the Original Code is Ben Goodger.
+# Portions created by the Initial Developer are Copyright (C) 2005
+# the Initial Developer. All Rights Reserved.
+# 
+# Contributor(s):
+#   Ben Goodger <ben@mozilla.org>
+# 
+# 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 *****
+
+<?xml-stylesheet href="chrome://global/skin/" type="text/css"?> 
+<?xml-stylesheet href="chrome://browser/skin/preferences/preferences.css" type="text/css"?> 
+
+<!DOCTYPE dialog SYSTEM "chrome://browser/locale/preferences/cookies.dtd" >
+
+<window id="CookiesDialog" windowtype="Browser:Cookies"
+        class="windowDialog" title="&window.title;"
+        xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+        style="width: 36em;"
+        onload="gCookiesWindow.init();"
+        onunload="gCookiesWindow.uninit();"
+        persist="screenX screenY width height">
+
+  <script src="chrome://browser/content/preferences/permissionsutils.js"/>
+  <script src="chrome://browser/content/preferences/cookies.js"/>
+
+  <stringbundle id="bundlePreferences"
+                src="chrome://browser/locale/preferences/preferences.properties"/>
+
+  <keyset>
+    <key key="&windowClose.key;" modifiers="accel" oncommand="window.close();"/>
+    <key key="&focusSearch1.key;" modifiers="accel" oncommand="gCookiesWindow.focusFilterBox();"/>
+    <key key="&focusSearch2.key;" modifiers="accel" oncommand="gCookiesWindow.focusFilterBox();"/>
+  </keyset>
+           
+  <vbox flex="1" class="contentPane">
+    <hbox align="center">
+      <label accesskey="&filter.accesskey;" control="filter">&filter.label;</label>
+      <textbox id="filter" flex="1" oninput="gCookiesWindow.onFilterInput();" 
+               onkeypress="gCookiesWindow.onFilterKeyPress(event);"/>
+      <button id="clearFilter" label="&clear.label;" accesskey="&clear.accesskey;" 
+              oncommand="gCookiesWindow.clearFilter();" disabled="true"/>
+    </hbox>
+    <separator class="thin"/>
+    <label id="cookiesIntro" value="&cookiesonsystem.label;"/>
+    <separator class="thin"/>
+    <tree id="cookiesList" flex="1" style="height: 10em;"
+          onkeypress="gCookiesWindow.onCookieKeyPress(event)"
+          onselect="gCookiesWindow.onCookieSelected();"
+          hidecolumnpicker="true" seltype="single">
+      <treecols>
+        <treecol id="domainCol" label="&cookiedomain.label;" flex="2" primary="true"
+                 class="sortDirectionIndicator" persist="width" onclick="gCookiesWindow.sort('rawHost');" />
+        <splitter class="tree-splitter"/>
+        <treecol id="nameCol" label="&cookiename.label;" flex="1"
+                 class="sortDirectionIndicator" persist="width" 
+                 onclick="gCookiesWindow.sort('name');"/>
+      </treecols>
+      <treechildren id="cookiesChildren"/>
+    </tree>
+    <hbox id="cookieInfoBox">
+      <stack flex="1">
+        <hbox id="backgroundBox" flex="1"/>
+        <grid flex="1">
+          <columns>
+            <column/>
+            <column flex="1"/>
+          </columns>
+          <rows>
+            <row align="center">
+              <hbox pack="end"><label id="nameLabel" value="&props.name.label;"/></hbox>
+              <textbox id="name" readonly="true" class="plain"/>
+            </row>
+            <row align="center">
+              <hbox pack="end"><label id="valueLabel" value="&props.value.label;"/></hbox>
+              <textbox id="value" readonly="true" class="plain"/>
+            </row>
+            <row align="center">
+              <hbox pack="end"><label id="isDomain" value="&props.domain.label;"/></hbox>
+              <textbox id="host" readonly="true" class="plain"/>
+            </row>
+            <row align="center">
+              <hbox pack="end"><label id="pathLabel" value="&props.path.label;"/></hbox>
+              <textbox id="path" readonly="true" class="plain"/>
+            </row>
+            <row align="center">
+              <hbox pack="end"><label id="isSecureLabel" value="&props.secure.label;"/></hbox>
+              <textbox id="isSecure" readonly="true" class="plain"/>
+            </row>
+            <row align="center">
+              <hbox pack="end"><label id="expiresLabel" value="&props.expires.label;"/></hbox>
+              <textbox id="expires" readonly="true" class="plain"/>
+            </row>
+          </rows>
+        </grid>
+      </stack>
+    </hbox>
+  </vbox>
+  <hbox align="end">
+    <hbox class="actionButtons" flex="1">
+      <button id="removeCookie" disabled="true" 
+              label="&button.removecookie.label;" accesskey="&button.removecookie.accesskey;"
+              oncommand="gCookiesWindow.deleteCookie();"/>
+      <button id="removeAllCookies" disabled="true" 
+              label="&button.removeallcookies.label;" accesskey="&button.removeallcookies.accesskey;"
+              oncommand="gCookiesWindow.deleteAllCookies();"/>
+      <spacer flex="1"/>
+#ifndef XP_MACOSX
+      <button oncommand="close();"
+              label="&button.close.label;" accesskey="&button.close.accesskey;"/>
+#endif
+    </hbox>
+    <resizer dir="bottomright"/>
+  </hbox>
+</window>
Index: browser/components/preferences/downloadactions.js
===================================================================
RCS file: browser/components/preferences/downloadactions.js
diff -N browser/components/preferences/downloadactions.js
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ browser/components/preferences/downloadactions.js	21 Feb 2005 11:21:03 -0000
@@ -0,0 +1,866 @@
+# -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+# 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 the Download Actions Manager.
+# 
+# The Initial Developer of the Original Code is Ben Goodger.
+# Portions created by the Initial Developer are 
+# Copyright (C) 2000, 2001, 2003, 2005
+# the Initial Developer. All Rights Reserved.
+# 
+# Contributor(s):
+#   Ben Goodger <ben@mozilla.org>
+# 
+# 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 *****
+
+const kPluginHandlerContractID = "@mozilla.org/content/plugin/document-loader-factory;1";
+const kDisabledPluginTypesPref = "plugin.disable_full_page_plugin_for_types";
+const kShowPluginsInList = "browser.download.show_plugins_in_list";
+const kHideTypesWithoutExtensions = "browser.download.hide_plugins_without_extensions";
+const kRootTypePrefix = "urn:mimetype:";
+
+///////////////////////////////////////////////////////////////////////////////
+// MIME Types Datasource RDF Utils
+function NC_URI(aProperty)
+{
+  return "http://home.netscape.com/NC-rdf#" + aProperty;
+}
+
+function MIME_URI(aType)
+{
+  return "urn:mimetype:" + aType;
+}
+
+function HANDLER_URI(aHandler)
+{
+  return "urn:mimetype:handler:" + aHandler;
+}
+
+function APP_URI(aType)
+{
+  return "urn:mimetype:externalApplication:" + aType;
+}
+
+var gDownloadActionsWindow = {  
+  _tree         : null,
+  _editButton   : null,
+  _removeButton : null,
+  _actions      : [],
+  _plugins      : {},
+  _bundle       : null,
+  _pref         : Components.classes["@mozilla.org/preferences-service;1"]
+                            .getService(Components.interfaces.nsIPrefBranch),
+  _mimeSvc      : Components.classes["@mozilla.org/uriloader/external-helper-app-service;1"]
+                            .getService(Components.interfaces.nsIMIMEService),
+  _excludingPlugins           : false,
+  _excludingMissingExtensions : false,
+  
+  init: function ()
+  {
+    (this._editButton = document.getElementById("editFileHandler")).disabled = true;
+    (this._removeButton = document.getElementById("removeFileHandler")).disabled = true;    
+
+    if (this._pref instanceof Components.interfaces.nsIPrefBranchInternal) {
+      this._pref.addObserver(kShowPluginsInList, this, false);
+      this._pref.addObserver(kHideTypesWithoutExtensions, this, false);
+    }
+    
+    // Initialize the File Type list
+    this._bundle = document.getElementById("bundlePreferences");
+    this._tree = document.getElementById("fileHandlersList");
+    this._loadView();
+    this._tree.treeBoxObject.view = this._view;  
+    // Determine any exclusions being applied - e.g. don't show types for which
+    // only a plugin handler exists, don't show types lacking extensions, etc. 
+    // This must be called *after* the view is attached, otherwise the tree code
+    // will throw assertions about the row count being out of sync, because it
+    // has no view to ask about it!
+    this._updateExclusions();    
+
+    var indexToSelect = parseInt(this._tree.getAttribute("lastSelected"));
+    if (indexToSelect < this._tree.view.rowCount)
+      this._tree.view.selection.select(indexToSelect);
+    this._tree.focus();    
+  },
+  
+  _loadView: function ()
+  {
+    // Reset ALL the collections and state flags, because we can call this after
+    // the window has initially displayed by resetting the filter. 
+    this._actions = [];
+    this._plugins = {};
+    this._view._filtered = false;
+    this._view._filterSet = [];
+    this._view._usingExclusionSet = false;
+    this._view._exclusionSet = [];
+    this._view._filterValue = "";
+
+    this._loadPluginData();
+    this._loadMIMERegistryData();
+    this._view._rowCount = this._actions.length;
+  },
+  
+  uninit: function ()
+  {
+    if (this._pref instanceof Components.interfaces.nsIPrefBranchInternal) {
+      this._pref.removeObserver(kShowPluginsInList, this);
+      this._pref.removeObserver(kHideTypesWithoutExtensions, this);
+    }
+  },
+  
+  observe: function (aSubject, aTopic, aData)
+  {
+    if (aTopic == "nsPref:changed" &&
+        (aData == kShowPluginsInList || aData == kHideTypesWithoutExtensions)) {
+      this._updateExclusions();
+      this._tree.treeBoxObject.invalidate();    
+    }
+  },
+  
+  _updateExclusions: function ()
+  {
+    this._excludingPlugins = !this._pref.getBoolPref(kShowPluginsInList);
+    this._excludingMissingExtensions = this._pref.getBoolPref(kHideTypesWithoutExtensions);    
+    this._view._exclusionSet = [].concat(this._actions);
+    var usingExclusionSet = false;
+    if (this._excludingMissingExtensions) {
+      usingExclusionSet = true;
+      for (var i = 0; i < this._view._exclusionSet.length;) {
+        if (!this._view._exclusionSet[i].hasExtension)
+          this._view._exclusionSet.splice(i, 1);
+        else
+          ++i;
+      }
+    }
+    if (this._excludingPlugins) {
+      usingExclusionSet = true;
+      for (i = 0; i < this._view._exclusionSet.length;) {
+        if (this._view._exclusionSet[i].handledOnlyByPlugin)
+          this._view._exclusionSet.splice(i, 1);
+        else
+          ++i        
+      }      
+    }
+    var oldRowCount = this._view._rowCount;
+    this._view._rowCount = 0;
+    this._tree.treeBoxObject.rowCountChanged(0, -oldRowCount);
+    if (usingExclusionSet) {
+      this._view._usingExclusionSet = true;
+      this._view._rowCount = this._view._exclusionSet.length;
+    }
+    else {
+      this._view._usingExclusionSet = false;
+      this._view._rowCount = this._view._filtered ? this._view._filterSet.length 
+                                                  : this._actions.length;
+    }
+    this._tree.treeBoxObject.rowCountChanged(0, this._view._rowCount);
+  },
+  
+  _loadPluginData: function ()
+  {
+    // Read enabled plugin type information from the category manager
+    var disabled = "";
+    if (this._pref.prefHasUserValue(kDisabledPluginTypesPref)) 
+      disabled = this._pref.getCharPref(kDisabledPluginTypesPref);
+    
+    for (var i = 0; i < navigator.plugins.length; ++i) {
+      var plugin = navigator.plugins[i];
+      for (var j = 0; j < plugin.length; ++j) {
+        var actionName = this._bundle.getFormattedString("openWith", [plugin.name])
+        var type = plugin[j].type;
+        this._createAction(type, actionName, true, FILEACTION_OPEN_PLUGIN, 
+                           null, true, disabled.indexOf(type) == -1, true);
+      }
+    }
+  },
+
+  _createAction: function (aMIMEType, aActionName, 
+                           aIsEditable, aHandleMode, aCustomHandler,
+                           aPluginAvailable, aPluginEnabled, 
+                           aHandledOnlyByPlugin)
+  {
+    var newAction = !(aMIMEType in this._plugins);
+    var action = newAction ? new FileAction() : this._plugins[aMIMEType];
+    action.type = aMIMEType;
+    var info = this._mimeSvc.getFromTypeAndExtension(action.type, null);
+    
+    // File Extension
+    try {
+      action.extension = info.primaryExtension;
+    }
+    catch (e) {
+      action.extension = this._bundle.getString("extensionNone");
+      action.hasExtension = false;
+    }
+    
+    // Large and Small Icon
+    try {
+      action.smallIcon = "moz-icon://goat." + info.primaryExtension + "?size=16";
+      action.bigIcon = "moz-icon://goat." + info.primaryExtension + "?size=32";
+    }
+    catch (e) {
+      action.smallIcon = "moz-icon://goat?size=16&contentType=" + info.MIMEType;
+      action.bigIcon = "moz-icon://goat?contentType=" + info.MIMEType + "&size=32";
+    }
+
+    // Pretty Type Name
+    if (info.description == "") {
+      try {
+        action.typeName = this._bundle.getFormattedString("fileEnding", [info.primaryExtension.toUpperCase()]);
+      }
+      catch (e) { 
+        // Wow, this sucks, just show the MIME type as a last ditch effort to display
+        // the type of file that this is. 
+        action.typeName = info.MIMEType;
+      }
+    }
+    else
+      action.typeName = info.description;
+
+    // Pretty Action Name
+    if (aActionName)
+      action.action         = aActionName;
+    action.pluginAvailable  = aPluginAvailable;
+    action.pluginEnabled    = aPluginEnabled;
+    action.editable         = aIsEditable;
+    action.handleMode       = aHandleMode;
+    action.customHandler    = aCustomHandler;
+    action.mimeInfo         = info;
+    action.handledOnlyByPlugin  = aHandledOnlyByPlugin
+    
+    if (newAction && !(action.handledOnlyByPlugin && !action.pluginEnabled)) {
+      this._actions.push(action);
+      this._plugins[action.type] = action;
+    }      
+    return action;
+  },
+  
+  _loadMIMEDS: function ()
+  {
+    var fileLocator = Components.classes["@mozilla.org/file/directory_service;1"]
+                                .getService(Components.interfaces.nsIProperties);
+    
+    var file = fileLocator.get("UMimTyp", Components.interfaces.nsIFile);
+
+    var ioService = Components.classes["@mozilla.org/network/io-service;1"]
+                              .getService(Components.interfaces.nsIIOService);
+    var fileHandler = ioService.getProtocolHandler("file")
+                               .QueryInterface(Components.interfaces.nsIFileProtocolHandler);
+    this._mimeDS = this._rdf.GetDataSourceBlocking(fileHandler.getURLSpecFromFile(file));
+  },
+  
+  _getLiteralValue: function (aResource, aProperty)
+  {
+    var property = this._rdf.GetResource(NC_URI(aProperty));
+    var value = this._mimeDS.GetTarget(aResource, property, true);
+    if (value)
+      return value.QueryInterface(Components.interfaces.nsIRDFLiteral).Value;
+    return "";
+  },
+  
+  _getChildResource: function (aResource, aProperty)
+  {
+    var property = this._rdf.GetResource(NC_URI(aProperty));
+    return this._mimeDS.GetTarget(aResource, property, true);
+  },
+  
+  _getDisplayNameForFile: function (aFile)
+  {
+#ifdef XP_WIN
+    if (aFile instanceof Components.interfaces.nsILocalFileWin)
+      return aFile.getVersionInfoField("FileDescription"); 
+#else
+    // XXXben - Read the bundle name on OS X.
+    var ios = Components.classes["@mozilla.org/network/io-service;1"]
+                        .getService(Components.interfaces.nsIIOService);
+    var url = ios.newFileURI(aFile).QueryInterface(Components.interfaces.nsIURL);
+    return url.fileName;
+#endif
+  },  
+  
+  _loadMIMERegistryData: function ()
+  {
+    this._rdf = Components.classes["@mozilla.org/rdf/rdf-service;1"]
+                          .getService(Components.interfaces.nsIRDFService);
+    this._loadMIMEDS();                          
+                          
+    var root = this._rdf.GetResource("urn:mimetypes:root");
+    var container = Components.classes["@mozilla.org/rdf/container;1"]
+                              .createInstance(Components.interfaces.nsIRDFContainer);
+    container.Init(this._mimeDS, root);
+    
+    var elements = container.GetElements();
+    while (elements.hasMoreElements()) {
+      var type = elements.getNext();
+      if (!(type instanceof Components.interfaces.nsIRDFResource))
+        break;
+      var editable = this._getLiteralValue(type, "editable") == "true";
+      if (!editable)
+        continue;
+      
+      var handler = this._getChildResource(type, "handlerProp");
+      var alwaysAsk = this._getLiteralValue(handler, "alwaysAsk") == "true";
+      if (alwaysAsk)
+        continue;
+      var saveToDisk        = this._getLiteralValue(handler, "saveToDisk") == "true";
+      var useSystemDefault  = this._getLiteralValue(handler, "useSystemDefault") == "true";
+      var editable          = this._getLiteralValue(type, "editable") == "true";
+      var handledInternally = this._getLiteralValue(handler, "handleInternal") == "true";
+      var externalApp       = this._getChildResource(handler, "externalApplication");
+      var externalAppPath   = this._getLiteralValue(externalApp, "path");
+      try {
+        var customHandler = Components.classes["@mozilla.org/file/local;1"]
+                                      .createInstance(Components.interfaces.nsILocalFile);
+        customHandler.initWithPath(externalAppPath);
+      }
+      catch (e) {
+        customHandler = null;
+      }      
+      var mimeType = this._getLiteralValue(type, "value");
+      var typeInfo = this._mimeSvc.getFromTypeAndExtension(mimeType, null);
+
+      // Determine the pretty name of the associated action.
+      var actionName = "";
+      var handleMode = 0;
+      if (saveToDisk) {
+        // Save the file to disk
+        actionName = this._bundle.getString("saveToDisk");
+        handleMode = FILEACTION_SAVE_TO_DISK;
+      }
+      else if (useSystemDefault) {
+        // Use the System Default handler
+        actionName = this._bundle.getFormattedString("openWith", 
+                                                     [typeInfo.defaultDescription]);
+        handleMode = FILEACTION_OPEN_DEFAULT;
+      }
+      else {
+        // Custom Handler
+        if (customHandler) {
+          actionName = this._bundle.getFormattedString("openWith", 
+                                                       [this._getDisplayNameForFile(customHandler)]);
+          handleMode = FILEACTION_OPEN_CUSTOM;
+        }
+        else {
+          // Corrupt datasource, invalid custom handler path. Revert to default.
+          actionName = this._bundle.getFormattedString("openWith", 
+                                                       [typeInfo.defaultDescription]);
+          handleMode = FILEACTION_OPEN_DEFAULT;
+        }
+      }
+
+      if (handledInternally)
+        handleMode = FILEACTION_OPEN_INTERNALLY;
+      
+      var pluginAvailable = mimeType in this._plugins && this._plugins[mimeType].pluginAvailable;
+      var pluginEnabled = pluginAvailable && this._plugins[mimeType].pluginEnabled;
+      if (pluginEnabled) {
+        handleMode = FILEACTION_OPEN_PLUGIN;
+        actionName = null;
+      }
+      var action = this._createAction(mimeType, actionName, editable, handleMode, 
+                                      customHandler, pluginAvailable, pluginEnabled,
+                                      false);
+    }
+  },
+  
+  _view: {
+    _filtered           : false,
+    _filterSet          : [],
+    _usingExclusionSet  : false,
+    _exclusionSet       : [],
+    _filterValue        : "",
+
+    _rowCount: 0,
+    get rowCount() 
+    { 
+      return this._rowCount; 
+    },
+    
+    get activeCollection ()
+    {
+      return this._filtered ? this._filterSet 
+                            : this._usingExclusionSet ? this._exclusionSet 
+                                                      : gDownloadActionsWindow._actions;
+    },
+
+    getItemAtIndex: function (aIndex)
+    {
+      return this.activeCollection[aIndex];
+    },
+    
+    getCellText: function (aIndex, aColumn)
+    {
+      switch (aColumn.id) {
+      case "fileExtension":
+        return this.getItemAtIndex(aIndex).extension.toUpperCase();
+      case "fileType":
+        return this.getItemAtIndex(aIndex).typeName;
+      case "fileMIMEType":
+        return this.getItemAtIndex(aIndex).type;
+      case "fileHandler":
+        return this.getItemAtIndex(aIndex).action;
+      }
+      return "";
+    },
+    getImageSrc: function (aIndex, aColumn) 
+    {
+      if (aColumn.id == "fileExtension") 
+        return this.getItemAtIndex(aIndex).smallIcon;
+      return "";
+    },
+    _selection: null, 
+    get selection () { return this._selection; },
+    set selection (val) { this._selection = val; return val; },
+    getRowProperties: function (aIndex, aProperties) {},
+    getCellProperties: function (aIndex, aColumn, aProperties) {},
+    getColumnProperties: function (aColumn, aProperties) {},
+    isContainer: function (aIndex) { return false; },
+    isContainerOpen: function (aIndex) { return false; },
+    isContainerEmpty: function (aIndex) { return false; },
+    isSeparator: function (aIndex) { return false; },
+    isSorted: function (aIndex) { return false; },
+    canDrop: function (aIndex, aOrientation) { return false; },
+    drop: function (aIndex, aOrientation) {},
+    getParentIndex: function (aIndex) { return -1; },
+    hasNextSibling: function (aParentIndex, aIndex) { return false; },
+    getLevel: function (aIndex) { return 0; },
+    getProgressMode: function (aIndex, aColumn) {},    
+    getCellValue: function (aIndex, aColumn) {},
+    setTree: function (aTree) {},    
+    toggleOpenState: function (aIndex) { },
+    cycleHeader: function (aColumn) {},    
+    selectionChanged: function () {},    
+    cycleCell: function (aIndex, aColumn) {},    
+    isEditable: function (aIndex, aColumn) { return false; },
+    setCellValue: function (aIndex, aColumn, aValue) {},    
+    setCellText: function (aIndex, aColumn, aValue) {},    
+    performAction: function (aAction) {},  
+    performActionOnRow: function (aAction, aIndex) {},    
+    performActionOnCell: function (aAction, aindex, aColumn) {}
+  },
+
+  removeFileHandler: function ()
+  {
+    var selection = this._tree.view.selection; 
+    if (selection.count < 1)
+      return;
+      
+    var promptService = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
+                                  .getService(Components.interfaces.nsIPromptService);
+    var flags = promptService.BUTTON_TITLE_IS_STRING * promptService.BUTTON_POS_0;
+    flags += promptService.BUTTON_TITLE_CANCEL * promptService.BUTTON_POS_1;
+
+    var title = this._bundle.getString("removeTitle" + (selection.count > 1 ? "Multiple" : "Single"));
+    var message = this._bundle.getString("removeMessage" + (selection.count > 1 ? "Multiple" : "Single"));
+    var button = this._bundle.getString("removeButton" + (selection.count > 1 ? "Multiple" : "Single"));
+    rv = promptService.confirmEx(window, title, message, flags, button, 
+                                 null, null, null, { value: 0 });
+    if (rv != 0)
+      return;     
+
+    var rangeCount = selection.getRangeCount();
+    var lastSelected = 0;
+    var mimeDSDirty = false;
+    for (var i = 0; i < rangeCount; ++i) {
+      var min = { }; var max = { };
+      selection.getRangeAt(i, min, max);
+      for (var j = min.value; j <= max.value; ++j) {
+        var item = this._view.getItemAtIndex(j);
+        if (!item.handledOnlyByPlugin) {
+          // There is data for this type in the MIME registry, so make sure we
+          // remove it from the MIME registry. We don't disable the plugin here because
+          // if we do there's currently no way through the UI to re-enable it. We may
+          // come up with some sort of solution for that at a later date. 
+          var typeRes = this._rdf.GetResource(MIME_URI(item.type));
+          var handlerRes = this._getChildResource(typeRes, "handlerProp");
+          var extAppRes = this._getChildResource(handlerRes, "externalApplication");
+          this._cleanResource(extAppRes);
+          this._cleanResource(handlerRes);
+          this._cleanResource(typeRes); 
+          mimeDSDirty = true;         
+        }
+        lastSelected = (j + 1) >= this._view.rowCount ? j-1 : j;
+      }
+    }
+    if (mimeDSDirty && 
+        this._mimeDS instanceof Components.interfaces.nsIRDFRemoteDataSource)
+      this._mimeDS.Flush();
+        
+    var oldCount = this._view.rowCount;
+    this._view._rowCount = 0;
+    this._tree.treeBoxObject.rowCountChanged(0, -oldCount);
+
+    // Just reload the list to make sure deletions are respected
+    this._loadView();
+    this._updateExclusions();    
+    this._tree.treeBoxObject.rowCountChanged(0, this._view.rowCount);
+
+    selection.select(lastSelected);
+  },
+  
+  _cleanResource: function (aResource)
+  {
+    var labels = this._mimeDS.ArcLabelsOut(aResource);
+    while (labels.hasMoreElements()) {
+      var arc = labels.getNext();
+      if (!(arc instanceof Components.interfaces.nsIRDFResource))
+        break;
+      var target = this._mimeDS.GetTarget(aResource, arc, true);
+      this._mimeDS.Unassert(aResource, arc, target);
+    }
+  },
+  
+  _disablePluginForItem: function (aItem)
+  {
+    if (aItem.pluginAvailable) {
+      // Since we're disabling the full page plugin for this content type, 
+      // we must add it to the disabled list if it's not in there already.
+      var prefs = Components.classes["@mozilla.org/preferences-service;1"]
+                            .getService(Components.interfaces.nsIPrefBranch);
+      var disabled = aItem.type;
+      if (prefs.prefHasUserValue(kDisabledPluginTypesPref)) {
+        disabled = prefs.getCharPref(kDisabledPluginTypesPref);
+        if (disabled.indexOf(aItem.type) == -1) 
+          disabled += "," + aItem.type;
+      }
+      prefs.setCharPref(kDisabledPluginTypesPref, disabled);   
+      
+      // Also, we update the category manager so that existing browser windows
+      // update.
+      var catman = Components.classes["@mozilla.org/categorymanager;1"]
+                             .getService(Components.interfaces.nsICategoryManager);
+      catman.deleteCategoryEntry("Gecko-Content-Viewers", aItem.type, false);     
+    }    
+  },
+  
+  _enablePluginForItem: function (aItem)
+  {
+    var prefs = Components.classes["@mozilla.org/preferences-service;1"]
+                          .getService(Components.interfaces.nsIPrefBranch);
+    // Since we're enabling the full page plugin for this content type, we must
+    // look at the disabled types list and ensure that this type isn't in it.
+    if (prefs.prefHasUserValue(kDisabledPluginTypesPref)) {
+      var disabledList = prefs.getCharPref(kDisabledPluginTypesPref);
+      if (disabledList == aItem.type)
+        prefs.clearUserPref(kDisabledPluginTypesPref);
+      else {
+        var disabledTypes = disabledList.split(",");
+        var disabled = "";
+        for (var i = 0; i < disabledTypes.length; ++i) {
+          if (aItem.type != disabledTypes[i])
+            disabled += disabledTypes[i] + (i == disabledTypes.length - 1 ? "" : ",");
+        }
+        prefs.setCharPref(kDisabledPluginTypesPref, disabled);
+      }
+    }
+
+    // Also, we update the category manager so that existing browser windows
+    // update.
+    var catman = Components.classes["@mozilla.org/categorymanager;1"]
+                           .getService(Components.interfaces.nsICategoryManager);
+    catman.addCategoryEntry("Gecko-Content-Viewers", aItem.type,
+                            kPluginHandlerContractID, false, true);
+  },
+  
+  _ensureMIMERegistryEntry: function (aItem)
+  {
+    var root = this._rdf.GetResource("urn:mimetypes:root");
+    var container = Components.classes["@mozilla.org/rdf/container;1"]
+                              .createInstance(Components.interfaces.nsIRDFContainer);
+    container.Init(this._mimeDS, root);
+    
+    var itemResource = this._rdf.GetResource(MIME_URI(aItem.type));
+    var handlerResource = null;
+    if (container.IndexOf(itemResource) == -1) {
+      container.AppendElement(itemResource);
+      this._setLiteralValue(itemResource, "editable", "true");
+      this._setLiteralValue(itemResource, "value", aItem.type);
+      
+      handlerResource = this._rdf.GetResource(HANDLER_URI(aItem.type));
+      this._setLiteralValue(handlerResource, "alwaysAsk", "false");
+      var handlerProp = this._rdf.GetResource(NC_URI("handlerProp"));
+      this._mimeDS.Assert(itemResource, handlerProp, handlerResource, true);
+      
+      var extAppResource = this._rdf.GetResource(APP_URI(aItem.type));
+      this._setLiteralValue(extAppResource, "path", "");
+      var extAppProp = this._rdf.GetResource(NC_URI("externalApplication"));
+      this._mimeDS.Assert(handlerResource, extAppProp, extAppResource, true);
+    }
+    else
+      handlerResource = this._getChildResource(itemResource, "handlerProp");
+        
+    return handlerResource;
+  },
+  
+  _setLiteralValue: function (aResource, aProperty, aValue)
+  {
+    var property = this._rdf.GetResource(NC_URI(aProperty));
+    var newValue = this._rdf.GetLiteral(aValue);
+    var oldValue = this._mimeDS.GetTarget(aResource, property, true);
+    if (oldValue)
+      this._mimeDS.Change(aResource, property, oldValue, newValue);
+    else
+      this._mimeDS.Assert(aResource, property, newValue, true);
+  },
+  
+  editFileHandler: function ()
+  {
+    var selection = this._tree.view.selection; 
+    if (selection.count != 1)
+      return;
+
+    var item = this._view.getItemAtIndex(selection.currentIndex);
+    openDialog("chrome://browser/content/preferences/changeaction.xul", 
+               "_blank", "modal,centerscreen", item);
+    
+    // Update the database
+    switch (item.handleMode) {
+    case FILEACTION_OPEN_PLUGIN:
+      this._enablePluginForItem(item);
+      // We don't need to adjust the database because plugin settings always
+      // supercede whatever is in the db, leaving it untouched allows the last
+      // user setting(s) to be preserved if they ever revert.
+      break;
+    case FILEACTION_OPEN_DEFAULT:
+      this._disablePluginForItem(item);
+      var handlerRes = this._ensureMIMERegistryEntry(item);
+      this._setLiteralValue(handlerRes, "useSystemDefault", "true");
+      this._setLiteralValue(handlerRes, "saveToDisk", "false");
+      break;
+    case FILEACTION_OPEN_CUSTOM:
+      this._disablePluginForItem(item);
+      var handlerRes = this._ensureMIMERegistryEntry(item);
+      this._setLiteralValue(handlerRes, "useSystemDefault", "false");
+      this._setLiteralValue(handlerRes, "saveToDisk", "false");
+      var extAppRes = this._getChildResource(handlerRes, "externalApplication");
+      this._setLiteralValue(extAppRes, "path", item.customHandler.path);
+      break;
+    case FILEACTION_SAVE_TO_DISK:
+      this._disablePluginForItem(item);
+      var handlerRes = this._ensureMIMERegistryEntry(item);
+      this._setLiteralValue(handlerRes, "useSystemDefault", "false");
+      this._setLiteralValue(handlerRes, "saveToDisk", "true");
+      break;
+    }
+    
+    if (this._mimeDS instanceof Components.interfaces.nsIRDFRemoteDataSource)
+      this._mimeDS.Flush();
+    
+    // Update the view
+    this._tree.treeBoxObject.invalidateRow(selection.currentIndex);    
+  },
+  
+  onSelectionChanged: function ()
+  {
+    if (this._tree.view.rowCount == 0)
+      return;
+      
+    var selection = this._tree.view.selection; 
+    var selected = selection.count;
+    this._removeButton.disabled = selected == 0;
+    this._editButton.disabled = selected != 1;
+    var stringKey = selected > 1 ? "removeButtonMultiple" : "removeButtonSingle";
+    this._removeButton.label = this._bundle.getString(stringKey);
+    
+    var canRemove = true;
+    var canEdit = true;
+    
+    var rangeCount = selection.getRangeCount();
+    var min = { }, max = { };
+    var setLastSelected = false;
+    for (var i = 0; i < rangeCount; ++i) {
+      selection.getRangeAt(i, min, max);
+      
+      for (var j = min.value; j <= max.value; ++j) {
+        if (!setLastSelected) {
+          // Set the last selected index to the first item in the selection
+          this._tree.setAttribute("lastSelected", j);
+          setLastSelected = true;
+        }
+
+        var item = this._view.getItemAtIndex(j);
+        if (item && 
+            (!item.editable || item.handleMode == FILEACTION_OPEN_INTERNALLY))
+          canEdit = false;
+        
+        if (item && 
+            (!item.editable || item.handleMode == FILEACTION_OPEN_INTERNALLY ||
+             item.handledOnlyByPlugin))
+          canRemove = false;
+      }
+    }
+    
+    if (!canRemove)
+      this._removeButton.disabled = true;
+    if (!canEdit)
+      this._editButton.disabled = true;
+  },
+  
+  _lastSortProperty : "",
+  _lastSortAscending: false,
+  sort: function (aProperty) 
+  {
+    var ascending = (aProperty == this._lastSortProperty) ? !this._lastSortAscending : true;
+    function sortByProperty(a, b) 
+    {
+      return a[aProperty].toLowerCase().localeCompare(b[aProperty].toLowerCase());
+    }
+    function sortByExtension(a, b)
+    {
+      if (!a.hasExtension && b.hasExtension)
+        return 1;
+      if (!b.hasExtension && a.hasExtension)
+        return -1;
+      return a.extension.toLowerCase().localeCompare(b.extension.toLowerCase());
+    }
+    // Sort the Filtered List, if in Filtered mode
+    if (!this._view._filtered) { 
+      this._view.activeCollection.sort(aProperty == "extension" ? sortByExtension : sortByProperty);
+      if (!ascending)
+        this._view.activeCollection.reverse();
+    }
+
+    this._view.selection.clearSelection();
+    this._view.selection.select(0);
+    this._tree.treeBoxObject.invalidate();
+    this._tree.treeBoxObject.ensureRowIsVisible(0);
+
+    this._lastSortAscending = ascending;
+    this._lastSortProperty = aProperty;
+  },
+  
+  clearFilter: function ()
+  {    
+    // Clear the Filter and the Tree Display
+    document.getElementById("filter").value = "";
+    this._view._filtered = false;
+    this._view._rowCount = 0;
+    this._tree.treeBoxObject.rowCountChanged(0, -this._view._filterSet.length);
+    this._view._filterSet = [];
+
+    // Just reload the list to make sure deletions are respected
+    this._loadView();
+    this._updateExclusions();
+    this._tree.treeBoxObject.rowCountChanged(0, this._view.rowCount);
+
+    // Restore selection
+    this._view.selection.clearSelection();
+    for (i = 0; i < this._lastSelectedRanges.length; ++i) {
+      var range = this._lastSelectedRanges[i];
+      this._view.selection.rangedSelect(range.min, range.max, true);
+    }
+    this._lastSelectedRanges = [];
+
+    document.getElementById("actionsIntro").value = this._bundle.getString("actionsAll");
+    document.getElementById("clearFilter").disabled = true;
+  },
+  
+  _actionMatchesFilter: function (aAction)
+  {
+    return aAction.extension.toLowerCase().indexOf(this._view._filterValue) != -1 ||
+           aAction.typeName.toLowerCase().indexOf(this._view._filterValue) != -1 || 
+           aAction.type.toLowerCase().indexOf(this._view._filterValue) != -1 ||
+           aAction.action.toLowerCase().indexOf(this._view._filterValue) != -1;
+  },
+  
+  _filterActions: function (aFilterValue)
+  {
+    this._view._filterValue = aFilterValue;
+    var actions = [];
+    var collection = this._view._usingExclusionSet ? this._view._exclusionSet : this._actions;
+    for (var i = 0; i < collection.length; ++i) {
+      var action = collection[i];
+      if (this._actionMatchesFilter(action)) 
+        actions.push(action);
+    }
+    return actions;
+  },
+  
+  _lastSelectedRanges: [],
+  _saveState: function ()
+  {
+    // Save selection
+    var seln = this._view.selection;
+    this._lastSelectedRanges = [];
+    var rangeCount = seln.getRangeCount();
+    for (var i = 0; i < rangeCount; ++i) {
+      var min = {}; var max = {};
+      seln.getRangeAt(i, min, max);
+      this._lastSelectedRanges.push({ min: min.value, max: max.value });
+    }
+  },
+  
+  _filterTimeout: -1,
+  onFilterInput: function ()
+  {
+    if (this._filterTimeout != -1)
+      clearTimeout(this._filterTimeout);
+   
+    function filterActions()
+    {
+      var filter = document.getElementById("filter").value;
+      if (filter == "") {
+        gDownloadActionsWindow.clearFilter();
+        return;
+      }        
+      var view = gDownloadActionsWindow._view;
+      view._filterSet = gDownloadActionsWindow._filterActions(filter);
+      if (!view._filtered) {
+        // Save Display Info for the Non-Filtered mode when we first
+        // enter Filtered mode. 
+        gDownloadActionsWindow._saveState();
+        view._filtered = true;
+      }
+
+      // Clear the display
+      var oldCount = view._rowCount;
+      view._rowCount = 0;
+      gDownloadActionsWindow._tree.treeBoxObject.rowCountChanged(0, -oldCount);
+      // Set up the filtered display
+      view._rowCount = view._filterSet.length;
+      gDownloadActionsWindow._tree.treeBoxObject.rowCountChanged(0, view.rowCount);
+      
+      view.selection.select(0);
+      document.getElementById("actionsIntro").value = gDownloadActionsWindow._bundle.getString("actionsFiltered");
+      document.getElementById("clearFilter").disabled = false;
+    }
+    window.filterActions = filterActions;
+    this._filterTimeout = setTimeout("filterActions();", 500);
+  },
+  
+  onFilterKeyPress: function (aEvent)
+  {
+    if (aEvent.keyCode == 27) // ESC key
+      this.clearFilter();
+  },
+  
+  focusFilterBox: function ()
+  { 
+    var filter = document.getElementById("filter");
+    filter.focus();
+    filter.select();
+  }  
+};
+
Index: browser/components/preferences/downloadactions.xul
===================================================================
RCS file: browser/components/preferences/downloadactions.xul
diff -N browser/components/preferences/downloadactions.xul
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ browser/components/preferences/downloadactions.xul	21 Feb 2005 11:21:03 -0000
@@ -0,0 +1,124 @@
+<?xml version="1.0"?>
+
+# -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+# 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 the Firefox Preferences System.
+# 
+# The Initial Developer of the Original Code is Ben Goodger.
+# Portions created by the Initial Developer are Copyright (C) 2005
+# the Initial Developer. All Rights Reserved.
+# 
+# Contributor(s):
+#   Ben Goodger <ben@mozilla.org>
+# 
+# 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 *****
+
+<?xml-stylesheet href="chrome://global/skin/"?>
+<?xml-stylesheet href="chrome://browser/skin/preferences/preferences.css"?>
+
+<!DOCTYPE prefwindow [
+  <!ENTITY % brandDTD SYSTEM "chrome://global/locale/brand.dtd">
+  <!ENTITY % downloadactionsDTD SYSTEM "chrome://browser/locale/preferences/downloadactions.dtd">
+  %brandDTD;
+  %downloadactionsDTD;
+]>
+
+<window id="DownloadActionsWindow" class="windowDialog"
+        windowtype="Preferences:DownloadActions"
+        xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+        onload="gDownloadActionsWindow.init();"
+        onunload="gDownloadActionsWindow.uninit();"
+        title="&downloadactionsWindow.title;"
+        width="480" height="310" persist="width height screenX screenY">
+
+  <script type="application/x-javascript" src="chrome://browser/content/preferences/actionsshared.js"/>
+  <script type="application/x-javascript" src="chrome://browser/content/preferences/downloadactions.js"/>
+
+  <stringbundle id="bundlePreferences" src="chrome://browser/locale/preferences/preferences.properties"/>
+
+  <keyset>
+    <key key="&windowClose.key;" modifiers="accel" oncommand="window.close();"/>
+    <key key="&focusSearch1.key;" modifiers="accel" oncommand="gDownloadActionsWindow.focusFilterBox();"/>
+    <key key="&focusSearch2.key;" modifiers="accel" oncommand="gDownloadActionsWindow.focusFilterBox();"/>
+  </keyset>
+           
+  <vbox flex="1" class="contentPane">
+    <hbox align="center">
+      <label accesskey="&filter.accesskey;" control="filter">&filter.label;</label>
+      <textbox id="filter" flex="1" oninput="gDownloadActionsWindow.onFilterInput();" 
+              onkeypress="gDownloadActionsWindow.onFilterKeyPress(event);"/>
+      <button id="clearFilter" label="&clear.label;" accesskey="&clear.accesskey;" 
+              oncommand="gDownloadActionsWindow.clearFilter();" disabled="true"/>
+    </hbox>
+    <separator class="thin"/>
+    <label id="actionsIntro">&fileTypesDescription.label;</label>
+    <separator class="thin"/>
+    <tree id="fileHandlersList" flex="1"
+          lastSelected="0" persist="lastSelected"
+          onselect="gDownloadActionsWindow.onSelectionChanged();"
+          ondblclick="gDownloadActionsWindow.editFileHandler();">
+      <treechildren id="extensionChildren"/>
+      <treecols>
+        <treecol id="fileExtension" ignoreincolumnpicker="true" fiex="true"
+                  class="sortDirectionIndicator" persist="width"
+                  label="&fileExtensionColumn.label;" accesskey="&fileExtensionColumn.accesskey;"
+                  onclick="gDownloadActionsWindow.sort('extension');"/>
+        <treecol id="fileType" flex="1"
+                  class="sortDirectionIndicator" persist="width"
+                  label="&fileTypeColumn.label;" accesskey="&fileTypeColumn.accesskey;"
+                  onclick="gDownloadActionsWindow.sort('typeName');"/>
+        <splitter class="tree-splitter" />
+        <treecol id="fileMIMEType" flex="1" hidden="true"
+                  class="sortDirectionIndicator" persist="width"
+                  label="&fileMIMETypeColumn.label;" accesskey="&fileMIMETypeColumn.accesskey;"
+                  onclick="gDownloadActionsWindow.sort('type');"/>
+        <splitter class="tree-splitter" />
+        <treecol id="fileHandler" flex="1"
+                  class="sortDirectionIndicator" persist="width"
+                  label="&fileHandlerColumn.label;" accesskey="&fileHandlerColumn.accesskey;"
+                  onclick="gDownloadActionsWindow.sort('action');"/>                
+      </treecols>
+    </tree>
+  </vbox>
+  <separator class="thin"/>
+  <hbox>
+    <hbox flex="1" class="actionButtons">
+      <button id="removeFileHandler"
+              label="&remove.label;" accesskey="&remove.accesskey;"
+              oncommand="gDownloadActionsWindow.removeFileHandler();"/>
+      <button id="editFileHandler"
+              label="&edit.label;" accesskey="&edit.accesskey;"
+              oncommand="gDownloadActionsWindow.editFileHandler();"/>
+      <spacer flex="1"/>
+#ifndef XP_MACOSX
+      <button oncommand="close();"
+              label="&button.close.label;" accesskey="&button.close.accesskey;"/>
+#endif
+    </hbox>
+    <resizer dir="bottomright"/>
+  </hbox>
+</window>
+
Index: browser/components/preferences/downloads.js
===================================================================
RCS file: browser/components/preferences/downloads.js
diff -N browser/components/preferences/downloads.js
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ browser/components/preferences/downloads.js	21 Feb 2005 11:21:04 -0000
@@ -0,0 +1,172 @@
+# -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+# 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 the Firefox Preferences System.
+# 
+# The Initial Developer of the Original Code is Ben Goodger.
+# Portions created by the Initial Developer are Copyright (C) 2005
+# the Initial Developer. All Rights Reserved.
+# 
+# Contributor(s):
+#   Ben Goodger <ben@mozilla.org>
+#   Dan Mosedale <dmose@mozilla.org>
+# 
+# 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 gDownloadsPane = {
+  chooseFolder: function ()
+  {
+    const nsIFilePicker = Components.interfaces.nsIFilePicker;
+    var fp = Components.classes["@mozilla.org/filepicker;1"]
+                       .createInstance(nsIFilePicker);
+    fp.init(window, "Choose Download Folder", nsIFilePicker.modeGetFolder);
+    
+    const nsILocalFile = Components.interfaces.nsILocalFile;
+    var customDirPref = document.getElementById("browser.download.dir");
+    if (customDirPref.value)
+      fp.displayDirectory = customDirPref.value;
+    fp.appendFilters(nsIFilePicker.filterAll);
+    if (fp.show() == nsIFilePicker.returnOK) {
+      var file = fp.file.QueryInterface(nsILocalFile);
+      var currentDirPref = document.getElementById("browser.download.downloadDir");
+      customDirPref.value = currentDirPref.value = file;
+      var folderListPref = document.getElementById("browser.download.folderList");
+      folderListPref.value = this._fileToIndex(file);
+    }
+  },
+  
+  onReadUseDownloadDir: function ()
+  {
+    var downloadFolder = document.getElementById("downloadFolder");
+    var chooseFolder = document.getElementById("chooseFolder");
+    var preference = document.getElementById("browser.download.useDownloadDir");
+    downloadFolder.disabled = !preference.value;
+    chooseFolder.disabled = !preference.value;      
+    return undefined;
+  },
+  
+  _fileToIndex: function (aFile)
+  { 
+    if (!aFile || aFile.equals(this._getDownloadsFolder("Desktop")))
+      return 0;
+    else if (aFile.equals(this._getDownloadsFolder("Downloads")))
+      return 1;
+    return 2;
+  },
+  
+  _indexToFile: function (aIndex)
+  {
+    switch (aIndex) {
+    case 0: 
+      return this._getDownloadsFolder("Desktop");
+    case 1:
+      return this._getDownloadsFolder("Downloads");
+    }
+    var customDirPref = document.getElementById("browser.download.dir");
+    return customDirPref.value;
+  },
+  
+  _getSpecialFolderKey: function (aFolderType)
+  {
+#ifdef XP_WIN
+    return aFolderType == "Desktop" ? "DeskP" : "Pers";
+#endif
+#ifdef XP_MACOSX
+    return aFolderType == "Desktop" ? "UsrDsk" : "UsrDocs";
+#endif
+#ifdef XP_OS2
+    return aFolderType == "Desktop" ? "Desk" : "Home";
+#endif
+    return "Home";
+  },
+
+  _getDownloadsFolder: function (aFolder)
+  {
+    var fileLocator = Components.classes["@mozilla.org/file/directory_service;1"]
+                                .getService(Components.interfaces.nsIProperties);
+    var dir = fileLocator.get(this._getSpecialFolderKey(aFolder), 
+                              Components.interfaces.nsILocalFile);
+    if (aFolder != "Desktop")
+      dir.append("My Downloads");
+      
+    return dir;
+  },
+  
+  _getDisplayNameOfFile: function (aFolder)
+  {
+    // TODO: would like to add support for 'Downloads on Macintosh HD' 
+    //       for OS X users.
+    return aFolder ? aFolder.path : "";
+  },
+  
+  readDownloadDirPref: function ()
+  {
+    var folderListPref = document.getElementById("browser.download.folderList");
+    var bundlePreferences = document.getElementById("bundlePreferences");
+    var downloadFolder = document.getElementById("downloadFolder");
+
+    var customDirPref = document.getElementById("browser.download.dir");
+    var customIndex = customDirPref.value ? this._fileToIndex(customDirPref.value) : 0;
+    
+    if (folderListPref.value == 0 || customIndex == 0)
+      downloadFolder.label = bundlePreferences.getString("desktopFolderName");
+    else if (folderListPref.value == 1 || customIndex == 1) 
+      downloadFolder.label = bundlePreferences.getString("myDownloadsFolderName");
+    else
+      downloadFolder.label = this._getDisplayNameOfFile(customDirPref.value);
+    
+    var ios = Components.classes["@mozilla.org/network/io-service;1"]
+                        .getService(Components.interfaces.nsIIOService);
+    var fph = ios.getProtocolHandler("file")
+                 .QueryInterface(Components.interfaces.nsIFileProtocolHandler);
+    var currentDirPref = document.getElementById("browser.download.downloadDir");
+    var downloadDir = currentDirPref.value || this._indexToFile(folderListPref.value);
+    var urlspec = fph.getURLSpecFromFile(downloadDir);
+    downloadFolder.image = "moz-icon://" + urlspec + "?size=16";
+    
+    return undefined;
+  },
+  
+  showWhenStartingPrefChanged: function ()
+  {
+    var showWhenStartingPref = document.getElementById("browser.download.manager.showWhenStarting");
+    var closeWhenDonePref = document.getElementById("browser.download.manager.closeWhenDone");
+    closeWhenDonePref.disabled = !showWhenStartingPref.value;
+  },
+  
+  readShowWhenStartingPref: function ()
+  {
+    this.showWhenStartingPrefChanged();
+    return undefined;
+  },
+  
+  showFileTypeActions: function ()
+  {
+    document.documentElement.openWindow("Preferences:DownloadActions",
+                                        "chrome://browser/content/preferences/downloadactions.xul",
+                                        "", null);
+  },
+};
+
Index: browser/components/preferences/downloads.xul
===================================================================
RCS file: browser/components/preferences/downloads.xul
diff -N browser/components/preferences/downloads.xul
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ browser/components/preferences/downloads.xul	21 Feb 2005 11:21:04 -0000
@@ -0,0 +1,120 @@
+<?xml version="1.0"?>
+
+# -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+# 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 the Firefox Preferences System.
+# 
+# The Initial Developer of the Original Code is Ben Goodger.
+# Portions created by the Initial Developer are Copyright (C) 2005
+# the Initial Developer. All Rights Reserved.
+# 
+# Contributor(s):
+#   Ben Goodger <ben@mozilla.org>
+# 
+# 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 *****
+
+<!DOCTYPE overlay [
+<!ENTITY % brandDTD SYSTEM "chrome://global/locale/brand.dtd">
+<!ENTITY % downloadsDTD SYSTEM "chrome://browser/locale/preferences/downloads.dtd">
+%brandDTD;
+%downloadsDTD;
+]>
+
+<overlay id="DownloadsPaneOverlay"
+         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+
+  <prefpane id="paneDownloads">
+    <preferences>
+      <preference id="browser.download.useDownloadDir"    name="browser.download.useDownloadDir"    type="bool"/>
+      <preference id="browser.download.folderList"        name="browser.download.folderList"        type="int"/>
+      <preference id="browser.download.downloadDir"       name="browser.download.downloadDir"       type="file"/>
+      <preference id="browser.download.dir"               name="browser.download.dir"               type="file"/>
+      <preference id="browser.download.manager.showWhenStarting"
+                  name="browser.download.manager.showWhenStarting" 
+                  type="bool"
+                  onchange="gDownloadsPane.showWhenStartingPrefChanged();"/>
+      <preference id="browser.download.manager.closeWhenDone"
+                  name="browser.download.manager.closeWhenDone"
+                  type="bool"/>
+      <preference id="pref.downloads.disable_button.edit_actions"
+                  name="pref.downloads.disable_button.edit_actions"
+                  type="bool"/>
+    </preferences>
+    
+    <script type="application/x-javascript" src="chrome://browser/content/preferences/downloads.js"/>
+    
+    <stringbundle id="bundlePreferences" src="chrome://browser/locale/preferences/preferences.properties"/>
+
+    <groupbox>
+      <caption label="&askOnSave.label;"/>
+      
+      <radiogroup id="askOnSave" flex="1"
+                  preference="browser.download.useDownloadDir"
+                  onpreferenceread="return gDownloadsPane.onReadUseDownloadDir();">
+        <radio id="alwaysAsk" label="&alwaysAsk.label;" value="false"/>
+        <vbox flex="1">
+          <radio id="neverAsk" label="&neverAsk.label;" value="true"/>
+          <hbox class="indent" align="center">
+            <filefield id="downloadFolder" flex="1"
+                       preference="browser.download.folderList"
+                       preference-editable="true"
+                       onpreferenceread="return gDownloadsPane.readDownloadDirPref();"/>
+            <button id="chooseFolder" oncommand="gDownloadsPane.chooseFolder();"
+                    preference="browser.download.folderList"
+#ifdef XP_MACSOX
+                    label="&chooseFolderMac.label;"/>
+#else
+                    label="&chooseFolderWin.label;"/>
+#endif
+          </hbox>
+        </vbox>
+      </radiogroup>
+    </groupbox>
+
+    <groupbox align="start">
+      <caption label="&downloadManagerWindow.label;"/>
+      
+      <checkbox id="showWhenStarting" label="&showWhenStarting.label;" 
+                preference="browser.download.manager.showWhenStarting"
+                onpreferenceread="return gDownloadsPane.readShowWhenStartingPref();"/>
+      <checkbox id="closeWhenDone" label="&closeWhenDone.label;" class="indent"
+                preference="browser.download.manager.closeWhenDone"/>
+    </groupbox>
+    
+    <groupbox>
+      <caption label="&fileTypes.label;"/>
+      
+      <description>&fileTypesDescription.label;</description>
+      <separator class="thin"/>
+      <hbox>
+        <button label="&configureActions.label;" accesskey="&configureActions.accesskey;"
+                oncommand="gDownloadsPane.showFileTypeActions();"
+                preference="pref.downloads.disable_button.edit_actions"/>
+      </hbox>
+    </groupbox>
+  </prefpane>
+
+</overlay>
Index: browser/components/preferences/fontbuilder.js
===================================================================
RCS file: browser/components/preferences/fontbuilder.js
diff -N browser/components/preferences/fontbuilder.js
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ browser/components/preferences/fontbuilder.js	21 Feb 2005 11:21:04 -0000
@@ -0,0 +1,116 @@
+# -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+# 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.org Code.
+# 
+# The Initial Developer of the Original Code is
+# Doron Rosenberg.
+# Portions created by the Initial Developer are Copyright (C) 2001
+# the Initial Developer. All Rights Reserved.
+# 
+# Contributor(s):
+# 
+# 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 FontBuilder = {
+  _enumerator: null,
+  get enumerator ()
+  {
+    if (!this._enumerator) {
+      this._enumerator = Components.classes["@mozilla.org/gfx/fontenumerator;1"]
+                                   .createInstance(Components.interfaces.nsIFontEnumerator);
+    }
+    return this._enumerator;
+  },
+
+  _allFonts: null,
+  buildFontList: function (aLanguage, aFontType, aMenuList) 
+  {
+    // Reset the list
+    while (aMenuList.hasChildNodes())
+      aMenuList.removeChild(aMenuList.firstChild);
+    
+    var defaultFont = null;
+    // Load Font Lists
+    var fonts = this.enumerator.EnumerateFonts(aLanguage, aFontType, { } );
+    if (fonts.length > 0)
+      defaultFont = this.enumerator.getDefaultFont(aLanguage, aFontType);
+    else {
+      fonts = this.enumerator.EnumerateFonts(aLanguage, "", { });
+      if (fonts.length > 0)
+        defaultFont = this.enumerator.getDefaultFont(aLanguage, "");
+    }
+    
+    if (!this._allFonts)
+      this._allFonts = this.enumerator.EnumerateAllFonts({});
+    
+    // Build the UI for the Default Font and Fonts for this CSS type.
+    var popup = document.createElement("menupopup");
+    var separator;
+    if (fonts.length > 0) {
+      if (defaultFont) {
+        var bundlePreferences = document.getElementById("bundlePreferences");
+        var label = bundlePreferences.getFormattedString("labelDefaultFont", [defaultFont]);
+        var menuitem = document.createElement("menuitem");
+        menuitem.setAttribute("label", label);
+        menuitem.setAttribute("value", ""); // Default Font has a blank value
+        popup.appendChild(menuitem);
+        
+        separator = document.createElement("menuseparator");
+        popup.appendChild(separator);
+      }
+      
+      for (var i = 0; i < fonts.length; ++i) {
+        menuitem = document.createElement("menuitem");
+        menuitem.setAttribute("value", fonts[i]);
+        menuitem.setAttribute("label", fonts[i]);
+        popup.appendChild(menuitem);
+      }
+    }
+    
+    // Build the UI for the remaining fonts. 
+    if (this._allFonts.length > fonts.length) {
+      // Both lists are sorted, and the Fonts-By-Type list is a subset of the
+      // All-Fonts list, so walk both lists side-by-side, skipping values we've
+      // already created menu items for. 
+      var builtItem = separator ? separator.nextSibling : popup.firstChild;
+      
+      separator = document.createElement("menuseparator");
+      popup.appendChild(separator);
+      
+      for (i = 0; i < this._allFonts.length; ++i) {
+        if (this._allFonts[i] != builtItem.getAttribute("value")) {
+          menuitem = document.createElement("menuitem");
+          menuitem.setAttribute("value", this._allFonts[i]);
+          menuitem.setAttribute("label", this._allFonts[i]);
+          popup.appendChild(menuitem);
+        }
+        else
+          builtItem = builtItem.nextSibling;
+      }
+    }
+    aMenuList.appendChild(popup);    
+  },
+};
Index: browser/components/preferences/fonts.js
===================================================================
RCS file: browser/components/preferences/fonts.js
diff -N browser/components/preferences/fonts.js
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ browser/components/preferences/fonts.js	21 Feb 2005 11:21:04 -0000
@@ -0,0 +1,232 @@
+# -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+# 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 the Firefox Preferences System.
+# 
+# The Initial Developer of the Original Code is Ben Goodger.
+# Portions created by the Initial Developer are Copyright (C) 2005
+# the Initial Developer. All Rights Reserved.
+# 
+# Contributor(s):
+#   Ben Goodger <ben@mozilla.org>
+# 
+# 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 *****
+
+# browser.display.languageList LOCK ALL when LOCKED
+
+const kFontNameFmtSerif         = "font.name.serif.%LANG%";
+const kFontNameFmtSansSerif     = "font.name.sans-serif.%LANG%";
+const kFontNameFmtMonospace     = "font.name.monospace.%LANG%";
+const kFontNameListFmtSerif     = "font.name-list.serif.%LANG%";
+const kFontNameListFmtSansSerif = "font.name-list.sans-serif.%LANG%";
+const kFontNameListFmtMonospace = "font.name-list.monospace.%LANG%";
+const kFontSizeFmtVariable      = "font.size.variable.%LANG%";
+const kFontSizeFmtFixed         = "font.size.fixed.%LANG%";
+const kFontMinSizeFmt           = "font.minimum-size.%LANG%";
+
+var gFontsDialog = {
+  _selectLanguageGroup: function (aLanguageGroup)
+  {
+    var prefs = [{ format: kFontNameFmtSerif,         type: "unichar", element: "serif",      fonttype: "serif"       },
+                 { format: kFontNameFmtSansSerif,     type: "unichar", element: "sans-serif", fonttype: "sans-serif"  },
+                 { format: kFontNameFmtMonospace,     type: "unichar", element: "monospace",  fonttype: "monospace"   },
+                 { format: kFontNameListFmtSerif,     type: "unichar", element: null,         fonttype: "serif"       },
+                 { format: kFontNameListFmtSansSerif, type: "unichar", element: null,         fonttype: "sans-serif"  },
+                 { format: kFontNameListFmtMonospace, type: "unichar", element: null,         fonttype: "monospace"   },
+                 { format: kFontSizeFmtVariable,      type: "int",     element: "sizeVar",    fonttype: null          },
+                 { format: kFontSizeFmtFixed,         type: "int",     element: "sizeMono",   fonttype: null          },
+                 { format: kFontMinSizeFmt,           type: "int",     element: "minSize",    fonttype: null          }];
+    var preferences = document.getElementById("fontPreferences");
+    for (var i = 0; i < prefs.length; ++i) {
+      var preference = document.getElementById(prefs[i].format.replace(/%LANG%/, aLanguageGroup));
+      if (!preference) {
+        preference = document.createElement("preference");
+        var name = prefs[i].format.replace(/%LANG%/, aLanguageGroup);
+        preference.id = name;
+        preferences.appendChild(preference);
+        preference.name = name;
+        preference.type = prefs[i].type;
+      }
+      
+      if (!prefs[i].element)
+        continue;
+        
+      var element = document.getElementById(prefs[i].element);
+      if (element) {
+        element.setAttribute("preference", preference.id);
+      
+        if (prefs[i].fonttype)
+          FontBuilder.buildFontList(aLanguageGroup, prefs[i].fonttype, element);
+
+        preference.setElementValue(element);
+      }
+    }
+  },
+  
+  readFontLanguageGroup: function ()
+  {
+    var languagePref = document.getElementById("font.language.group");
+    this._selectLanguageGroup(languagePref.value);
+    return undefined;
+  },
+  
+  readFontSelection: function (aElement)
+  {
+    // Determine the appropriate value to select, for the following cases:
+    // - there is no setting 
+    // - the font selected by the user is no longer present (e.g. deleted from
+    //   fonts folder)
+    var preference = document.getElementById(aElement.getAttribute("preference"));
+    if (preference.value) {
+      var fontItems = aElement.getElementsByAttribute("value", preference.value);
+    
+      // There is a setting that actually is in the list. Respect it.
+      if (fontItems.length > 0)
+        return undefined;
+    }
+    
+    var defaultValue = aElement.firstChild.firstChild.getAttribute("value");
+    var languagePref = document.getElementById("font.language.group");
+    preference = document.getElementById("font.name-list." + aElement.id + "." + languagePref.value);
+    if (!preference || !preference.hasUserValue)
+      return defaultValue;
+    
+    var fontNames = preference.value.split(",");
+    var stripWhitespace = /^\s*(.*)\s*$/;
+    
+    for (var i = 0; i < fontNames.length; ++i) {
+      var fontName = fontNames[i].replace(stripWhitespace, "$1");
+      fontItems = aElement.getElementsByAttribute("value", fontName);
+      if (fontItems.length)
+        break;
+    }
+    if (fontItems.length)
+      return fontItems[0].getAttribute("value");
+    return defaultValue;
+  },
+  
+  _charsetMenuInitialized: false,
+  readDefaultCharset: function ()
+  {
+    if (!this._charsetMenuInitialized) {
+      var os = Components.classes["@mozilla.org/observer-service;1"]
+                         .getService(Components.interfaces.nsIObserverService);
+      os.notifyObservers(null, "charsetmenu-selected", "other");
+      this._charsetMenuInitialized = true;
+    }
+    return undefined;
+  },
+  
+  readUseDocumentFonts: function ()
+  {
+    var preference = document.getElementById("browser.display.use_document_fonts");
+    return preference.value == 1;
+  },
+  
+  writeUseDocumentFonts: function ()
+  {
+    var useDocumentFonts = document.getElementById("useDocumentFonts");
+    return useDocumentFonts.checked ? 1 : 0;
+  },
+  
+  readScreenResolution: function ()
+  {
+    // Initialize the display names of the default values the first time
+    // the preference is read. We can NOT do this in the init function since
+    // that is called after preference loading. 
+    var defaultResolution = document.getElementById("defaultResolution");
+    if (defaultResolution.label == "") {
+      var bundlePreferences = document.getElementById("bundlePreferences");
+      var otherResolution = document.getElementById("otherResolution");
+      otherResolution.label = bundlePreferences.getFormattedString("fontScalingResolutionFormat",
+                                                                  [otherResolution.getAttribute("value")]);
+      defaultResolution.label = bundlePreferences.getFormattedString("fontScalingResolutionFormat",
+                                                                    [defaultResolution.getAttribute("value")]);
+    }
+    return undefined;
+  },
+  
+  changeScreenResolution: function (aMenulist)
+  {
+    var userResolution = document.getElementById("userResolution");
+    var screenResolution = document.getElementById("screenResolution");
+    var lastSelected = screenResolution.getElementsByAttribute("lastSelected", "true")
+    if (lastSelected.length > 0) 
+      lastSelected = lastSelected[0];
+    else {
+      var preference = document.getElementById("browser.display.screen_resolution");
+      lastSelected = screenResolution.getElementsByAttribute("value", preference.value);
+      if (lastSelected.length > 0)
+        lastSelected = lastSelected[0];
+      else
+        lastSelected = document.getElementById("defaultResolution");
+    }
+
+    if (aMenulist.selectedItem.value == "choose") {
+      var rv = { newdpi: -1 };
+      document.documentElement.openSubDialog("chrome://browser/content/preferences/fontscaling.xul",
+                                             "", rv);
+      if (rv.newdpi != -1) {
+        this._setResolution(rv.newdpi);
+        lastSelected.removeAttribute("lastSelected");
+        screenResolution.selectedItem.setAttribute("lastSelected", "true");
+      }
+      else
+        screenResolution.selectedItem = lastSelected;
+    }
+    else if (!(screenResolution.value == userResolution.value)) {
+      // User has selected one of the hard-coded resolutions
+      userResolution.hidden = true;
+      lastSelected.removeAttribute("lastSelected");
+      screenResolution.selectedItem.setAttribute("lastSelected", "true");
+    }
+  },
+  
+  _setResolution: function (aResolution)
+  {
+    // Given a number, if it's equal to a hard-coded resolution we use that,
+    // otherwise we set the userResolution field.
+    var screenResolution = document.getElementById("screenResolution");
+    var userResolution = document.getElementById("userResolution");
+
+    var items = screenResolution.getElementsByAttribute("value", aResolution);
+    if (items[0]) {
+      // If it's one of the hard-coded values, we'll select it directly 
+      screenResolution.selectedItem = items[0];
+      userResolution.hidden = true;
+    }   
+    else {
+      // Otherwise we need to set up the userResolution field
+      var bundlePreferences = document.getElementById("bundlePreferences");
+      var label = bundlePreferences.getFormattedString("fontScalingResolutionFormat", 
+                                                       [aResolution]);
+      userResolution.value = aResolution;
+      userResolution.label = label;
+      userResolution.hidden = false;
+      screenResolution.selectedItem = userResolution;
+    }
+  }  
+};
+
Index: browser/components/preferences/fonts.xul
===================================================================
RCS file: browser/components/preferences/fonts.xul
diff -N browser/components/preferences/fonts.xul
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ browser/components/preferences/fonts.xul	21 Feb 2005 11:21:04 -0000
@@ -0,0 +1,287 @@
+<?xml version="1.0"?>
+
+# -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+# 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 the Firefox Preferences System.
+# 
+# The Initial Developer of the Original Code is Ben Goodger.
+# Portions created by the Initial Developer are Copyright (C) 2005
+# the Initial Developer. All Rights Reserved.
+# 
+# Contributor(s):
+#   Ben Goodger <ben@mozilla.org>
+#   Gervase Markham <gerv@gerv.net>
+#   Tuukka Tolvanen <tt@lament.cjb.net>
+# 
+# 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 *****
+
+<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
+
+<!DOCTYPE prefwindow SYSTEM "chrome://browser/locale/preferences/fonts.dtd" >
+
+<prefwindow id="FontsDialog" type="child"
+            xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+            title="&fontsDialog.title;"
+            dlgbuttons="accept,cancel"
+            style="width: 39em !important;">
+
+  <prefpane id="FontsDialogPane">
+  
+    <preferences id="fontPreferences">
+      <preference id="font.language.group"  name="font.language.group"  type="wstring"/>
+      <preference id="font.default"         name="font.default"         type="string"/>
+      <preference id="browser.display.screen_resolution"
+                  name="browser.display.screen_resolution"
+                  type="int"/>
+      <preference id="browser.display.use_document_fonts"
+                  name="browser.display.use_document_fonts"
+                  type="int"/>
+      <preference id="intl.charset.default" name="intl.charset.default" type="wstring"/>
+    </preferences>
+    
+    <stringbundle id="bundlePreferences" src="chrome://browser/locale/preferences/preferences.properties"/>
+    <script type="application/x-javascript" src="chrome://browser/content/preferences/fontbuilder.js"/>
+    <script type="application/x-javascript" src="chrome://browser/content/preferences/fonts.js"/>
+   
+    <groupbox>
+      <caption>
+        <hbox align="center">
+          <label accesskey="&language.accesskey;" control="selectLangs">&language.label;</label>
+        </hbox>
+        <menulist id="selectLangs" preference="font.language.group"
+                  onpreferenceread="return gFontsDialog.readFontLanguageGroup();">
+          <menupopup>
+            <menuitem value="x-western"       label="&font.langGroup.latin1;"/>
+            <menuitem value="x-central-euro"  label="&font.langGroup.latin2;"/>
+            <menuitem value="ja"              label="&font.langGroup.japanese;"/>
+            <menuitem value="zh-TW"           label="&font.langGroup.trad-chinese;"/>
+            <menuitem value="zh-CN"           label="&font.langGroup.simpl-chinese;"/>
+            <menuitem value="zh-HK"           label="&font.langGroup.trad-chinese-hk;"/>
+            <menuitem value="ko"              label="&font.langGroup.korean;"/>
+            <menuitem value="x-cyrillic"      label="&font.langGroup.cyrillic;"/>
+            <menuitem value="x-baltic"        label="&font.langGroup.baltic;"/>
+            <menuitem value="el"              label="&font.langGroup.el;"/>
+            <menuitem value="tr"              label="&font.langGroup.turkish;"/>
+            <menuitem value="x-unicode"       label="&font.langGroup.unicode;"/>
+            <menuitem value="x-user-def"      label="&font.langGroup.user-def;"/>
+            <menuitem value="th"              label="&font.langGroup.thai;"/>
+            <menuitem value="he"              label="&font.langGroup.hebrew;"/>
+            <menuitem value="ar"              label="&font.langGroup.arabic;"/>
+            <menuitem value="x-devanagari"    label="&font.langGroup.devanagari;"/>
+            <menuitem value="x-tamil"         label="&font.langGroup.tamil;"/>
+          </menupopup>
+        </menulist>
+      </caption>
+      
+      <grid>
+        <columns>
+          <column/>
+          <column flex="1"/>
+          <column/>
+          <column/>
+        </columns>
+        
+        <rows>
+          <row>
+            <separator class="thin"/>
+          </row>
+
+          <row align="center">
+            <hbox align="center" pack="end">
+              <label accesskey="&proportional.accesskey;" control="proportionalFont">&proportional.label;</label>
+            </hbox>
+            <menulist id="proportionalFont" flex="1" style="width: 0px;" 
+                      preference="font.default">
+              <menupopup>
+                <menuitem value="serif" label="&useDefaultFontSerif.label;"/>
+                <menuitem value="sans-serif" label="&useDefaultFontSansSerif.label;"/>
+              </menupopup>
+            </menulist>
+            <hbox align="center" pack="end">
+              <label>&sizes.label;</label>
+            </hbox>  
+            <menulist id="sizeVar" class="small-margin">
+              <menupopup>
+                <menuitem value="9" label="9"/>
+                <menuitem value="10" label="10"/>
+                <menuitem value="11" label="11"/>
+                <menuitem value="12" label="12"/>
+                <menuitem value="13" label="13"/>
+                <menuitem value="14" label="14"/>
+                <menuitem value="15" label="15"/>
+                <menuitem value="16" label="16"/>
+                <menuitem value="17" label="17"/>
+                <menuitem value="18" label="18"/>
+                <menuitem value="20" label="20"/>
+                <menuitem value="22" label="22"/>
+                <menuitem value="24" label="24"/>
+                <menuitem value="26" label="26"/>
+                <menuitem value="28" label="28"/>
+                <menuitem value="30" label="30"/>
+                <menuitem value="32" label="32"/>
+                <menuitem value="34" label="34"/>
+                <menuitem value="36" label="36"/>
+                <menuitem value="40" label="40"/>
+                <menuitem value="44" label="44"/>
+                <menuitem value="48" label="48"/>
+                <menuitem value="56" label="56"/>
+                <menuitem value="64" label="64"/>
+                <menuitem value="72" label="72"/>
+              </menupopup>
+            </menulist>
+          </row>
+          <row align="center">
+            <hbox align="center" pack="end">
+              <label accesskey="&serif.accesskey;" control="serif">&serif.label;</label>
+            </hbox>
+            <menulist id="serif" flex="1" style="width: 0px;"
+                      onpreferenceread="return gFontsDialog.readFontSelection(document.getElementById('serif'));"/>
+            <spacer/>
+          </row>
+          <row align="center">
+            <hbox align="center" pack="end">
+              <label accesskey="&sans-serif.accesskey;" control="sans-serif">&sans-serif.label;</label>
+            </hbox>
+            <menulist id="sans-serif" flex="1" style="width: 0px;"
+                      onpreferenceread="return gFontsDialog.readFontSelection(document.getElementById('sans-serif'));"/>
+            <spacer/>
+          </row>
+          <row align="center">
+            <hbox align="center" pack="end">
+              <label accesskey="&monospace.accesskey;" control="monospace">&monospace.label;</label>
+            </hbox>
+            <menulist id="monospace" flex="1" style="width: 0px;" crop="right"
+                      onpreferenceread="return gFontsDialog.readFontSelection(document.getElementById('monospace'));"/>
+            <hbox align="center" pack="end">
+              <label>&sizes.label;</label>
+            </hbox>  
+            <menulist id="sizeMono">
+              <menupopup>
+                <menuitem value="9" label="9"/>
+                <menuitem value="10" label="10"/>
+                <menuitem value="11" label="11"/>
+                <menuitem value="12" label="12"/>
+                <menuitem value="13" label="13"/>
+                <menuitem value="14" label="14"/>
+                <menuitem value="15" label="15"/>
+                <menuitem value="16" label="16"/>
+                <menuitem value="17" label="17"/>
+                <menuitem value="18" label="18"/>
+                <menuitem value="20" label="20"/>
+                <menuitem value="22" label="22"/>
+                <menuitem value="24" label="24"/>
+                <menuitem value="26" label="26"/>
+                <menuitem value="28" label="28"/>
+                <menuitem value="30" label="30"/>
+                <menuitem value="32" label="32"/>
+                <menuitem value="34" label="34"/>
+                <menuitem value="36" label="36"/>
+                <menuitem value="40" label="40"/>
+                <menuitem value="44" label="44"/>
+                <menuitem value="48" label="48"/>
+                <menuitem value="56" label="56"/>
+                <menuitem value="64" label="64"/>
+                <menuitem value="72" label="72"/>
+              </menupopup>
+            </menulist>
+          </row>
+        </rows>
+      </grid>
+      <separator class="thin"/>
+      <hbox flex="1">
+        <hbox align="center" pack="end">
+          <label accesskey="&resolution.accesskey;" control="screenResolution">&resolution.label;</label>
+          <menulist id="screenResolution" 
+                    oncommand="gFontsDialog.changeScreenResolution(this)"
+                    preference="browser.display.screen_resolution"
+                    onpreferenceread="return gFontsDialog.readScreenResolution();">
+            <menupopup>
+              <menuitem id="otherResolution" value="72"/>
+              <menuitem id="defaultResolution" value="96"/>
+#ifdef XP_UNIX
+#ifndef XP_MACOSX
+              <menuitem id="systemResolution" value="0" label="&resolution.system.label;"/>
+#endif
+#endif
+              <menuseparator id="resolutionSeparator"/>
+              <menuitem id="userResolution" hidden="true"/>
+              <menuitem id="chooseUserResolution" value="choose" label="&resolution.other;"/>
+            </menupopup>
+          </menulist>
+        </hbox>
+        <spacer flex="1"/>
+        <hbox align="center" pack="end">
+          <label accesskey="&minSize.accesskey;" control="minSize">&minSize.label;</label>
+          <menulist id="minSize">
+            <menupopup>
+              <menuitem value="0" label="&minSize.none;"/>
+              <menuitem value="9" label="9"/>
+              <menuitem value="10" label="10"/>
+              <menuitem value="11" label="11"/>
+              <menuitem value="12" label="12"/>
+              <menuitem value="13" label="13"/>
+              <menuitem value="14" label="14"/>
+              <menuitem value="15" label="15"/>
+              <menuitem value="16" label="16"/>
+              <menuitem value="17" label="17"/>
+              <menuitem value="18" label="18"/>
+              <menuitem value="20" label="20"/>
+              <menuitem value="22" label="22"/>
+              <menuitem value="24" label="24"/>
+            </menupopup>
+          </menulist>
+        </hbox>
+      </hbox>
+      <separator/>
+      <separator class="groove"/>
+      <hbox>
+        <checkbox id="useDocumentFonts" 
+                  label="&allowPagesToUse.label;" accesskey="&allowPagesToUse.accesskey;"
+                  preference="browser.display.use_document_fonts"
+                  onpreferenceread="return gFontsDialog.readUseDocumentFonts();"
+                  onpreferencewrite="return gFontsDialog.writeUseDocumentFonts();"/>
+      </hbox>
+    </groupbox>
+    
+    <groupbox>
+      <caption label="&languages.customize.Charset.grouplabel;"/>
+      <hbox align="center">
+        <label value="&languages.customize.DefaultCharset.label;"
+               accesskey="&languages.customize.DefaultCharset.accesskey;"
+               control="DefaultCharsetList"/>
+        <menulist id="DefaultCharsetList" ref="NC:DecodersRoot" datasources="rdf:charset-menu"
+                  preference="intl.charset.default" 
+                  onpreferenceread="return gFontsDialog.readDefaultCharset();">
+          <template>
+            <menupopup>
+              <menuitem label="rdf:http://home.netscape.com/NC-rdf#Name" value="..." uri="..."/>
+            </menupopup>
+          </template>
+        </menulist>
+      </hbox>
+    </groupbox>
+  </prefpane>
+</prefwindow>
Index: browser/components/preferences/fontscaling.js
===================================================================
RCS file: browser/components/preferences/fontscaling.js
diff -N browser/components/preferences/fontscaling.js
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ browser/components/preferences/fontscaling.js	21 Feb 2005 11:21:04 -0000
@@ -0,0 +1,72 @@
+# -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+# 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 the Firefox Preferences System.
+# 
+# The Initial Developer of the Original Code is Ben Goodger.
+# Portions created by the Initial Developer are Copyright (C) 2005
+# the Initial Developer. All Rights Reserved.
+# 
+# Contributor(s):
+#   Gervase Markham <gerv@gerv.net> (Logic)
+#   Ben Goodger <ben@mozilla.org>
+# 
+# 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 gFontScalingDialog = {
+  init: function ()
+  {
+    sizeToContent();
+  },
+  
+  onAccept: function ()
+  {
+    // Get value from the dialog to work out dpi
+    var horizSize = parseFloat(document.getElementById("horizSize").value);
+    var units = document.getElementById("units").value;
+  
+    if (!horizSize || horizSize < 0) {
+      // We can't calculate anything without a proper value
+      window.arguments[0].newdpi = -1;
+      return true;
+    }
+      
+    // Convert centimetres to inches.
+    // The magic number is allowed because it's a fundamental constant :-)
+    if (units == "centimetres")
+      horizSize /= 2.54;
+  
+    // These shouldn't change, but you can't be too careful.
+    var horizBarLengthPx = document.getElementById("horizRuler").boxObject.width;
+    var horizDPI = parseInt(horizBarLengthPx) / horizSize;
+  
+    // Average the two <shrug>.
+    window.arguments[0].newdpi = Math.round(horizDPI);
+    dump("*** intergoat = " + window.arguments[0].toSource() + "\n");
+  
+    return true;
+  }
+};
+
Index: browser/components/preferences/fontscaling.xul
===================================================================
RCS file: browser/components/preferences/fontscaling.xul
diff -N browser/components/preferences/fontscaling.xul
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ browser/components/preferences/fontscaling.xul	21 Feb 2005 11:21:04 -0000
@@ -0,0 +1,55 @@
+<?xml version="1.0"?> 
+# 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 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-2000 Netscape Communications Corporation. All
+# Rights Reserved.
+# 
+# Contributor(s): 
+  
+<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
+
+<!DOCTYPE dialog SYSTEM "chrome://browser/locale/preferences/fontscaling.dtd" >
+
+<dialog id="FontScalingDialog"
+        xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+        title="&calibrateDialog.title;"
+        onload="gFontScalingDialog.init();"
+        ondialogaccept="gFontScalingDialog.onAccept();">
+
+  <script type="application/x-javascript" src="chrome://browser/content/preferences/fontscaling.js"/>
+
+  <vbox id="horizRuler" width="300" height="30" style="margin: 10px; margin-bottom: 0px">
+    <hbox height="10px" style="border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid black;"/>
+    <hbox height="10px" style="border-top: 1px solid black; border-left: 1px solid black; border-right: 1px solid black;"/>
+  </vbox>
+
+  <vbox align="center">
+    <description>&calibrate.instructions;</description>
+    <separator class="thin"/>
+    <hbox align="center">
+      <textbox id="horizSize" size="5"/>
+      <menulist id="units" persist="value">
+        <menupopup>
+          <menuitem value="inches" label="&units.inches;"/>
+          <menuitem value="centimetres" label="&units.centimetres;"/>
+        </menupopup>
+      </menulist>              
+    </hbox>
+  </vbox>
+    
+  <separator/>
+
+</dialog>
Index: browser/components/preferences/general.js
===================================================================
RCS file: browser/components/preferences/general.js
diff -N browser/components/preferences/general.js
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ browser/components/preferences/general.js	21 Feb 2005 11:21:04 -0000
@@ -0,0 +1,172 @@
+# -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+# 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 the Firefox Preferences System.
+# 
+# The Initial Developer of the Original Code is Ben Goodger.
+# Portions created by the Initial Developer are Copyright (C) 2005
+# the Initial Developer. All Rights Reserved.
+# 
+# Contributor(s):
+#   Ben Goodger <ben@mozilla.org>
+# 
+# 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 gGeneralPane = {
+  _pane: null,
+
+  setHomePageToCurrentPage: function ()
+  {
+    var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"]
+                      .getService(Components.interfaces.nsIWindowMediator);
+    var win = wm.getMostRecentWindow("navigator:browser");
+    if (win) {
+      var homePageField = document.getElementById("browserStartupHomepage");
+      var newVal = "";
+
+      var tabbrowser = win.document.getElementById("content");
+      var l = tabbrowser.browsers.length;
+      for (var i = 0; i < l; i++) {
+        if (i)
+          newVal += "|";
+        newVal += tabbrowser.getBrowserAtIndex(i).webNavigation.currentURI.spec;
+      }
+      
+      homePageField.value = newVal;
+      this._pane.userChangedValue(homePageField);
+    }
+  },
+  
+  setHomePageToBookmark: function ()
+  {
+    var rv = { url: null };
+    document.documentElement.openSubDialog("chrome://browser/content/bookmarks/selectBookmark.xul",
+                                           "resizable", rv);  
+    if (rv.url) {
+      var homePageField = document.getElementById("browserStartupHomepage");
+      homePageField.value = rv.url;
+      this._pane.userChangedValue(homePageField);
+    }
+  },
+  
+  setHomePageToDefaultPage: function ()
+  {
+    var prefService = Components.classes["@mozilla.org/preferences-service;1"]
+                                .getService(Components.interfaces.nsIPrefService);
+    var pref = prefService.getDefaultBranch(null);
+    var url = pref.getComplexValue("browser.startup.homepage",
+                                   Components.interfaces.nsIPrefLocalizedString).data;
+    var homePageField = document.getElementById("browserStartupHomepage");
+    homePageField.value = url;
+    
+    this._pane.userChangedValue(homePageField);
+  },
+  
+  setHomePageToBlankPage: function ()
+  {
+    var homePageField = document.getElementById("browserStartupHomepage");
+    homePageField.value = "about:blank";
+    
+    this._pane.userChangedValue(homePageField);
+  },
+  
+  // Update the Home Button tooltip on all open browser windows.
+  homepageChanged: function (aEvent)
+  {
+    var homepage = aEvent.target.value;
+    // Replace pipes with commas to look nicer.
+    homepage = homepage.replace(/\|/g,', ');
+    
+    var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"]
+                      .getService(Components.interfaces.nsIWindowMediator);
+    var e = wm.getEnumerator("navigator:browser");
+    while (e.hasMoreElements()) {
+      var win = e.getNext();
+      if (!(win instanceof Components.interfaces.nsIDOMWindow))
+        break;
+      var homeButton = win.document.getElementById("home-button");
+      if (homeButton)
+        homeButton.setAttribute("tooltiptext", homepage);
+    }
+  },
+  
+  init: function ()
+  {
+    this._pane = document.getElementById("paneGeneral");
+    
+    var useButton = document.getElementById("browserUseCurrent");
+    
+    var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"]
+                       .getService(Components.interfaces.nsIWindowMediator);
+    var win = wm.getMostRecentWindow("navigator:browser");
+    if (win) {
+      var tabbrowser = win.document.getElementById("content");  
+      if (tabbrowser.browsers.length > 1)
+        useButton.label = useButton.getAttribute("label2");
+    }
+    else {
+      // prefwindow wasn't opened from a browser window, so no current page
+      useButton.disabled = true;
+    }
+  },
+  
+  showConnections: function ()
+  {
+    document.documentElement.openSubDialog("chrome://browser/content/preferences/connection.xul",
+                                           "", null);
+  },
+
+#ifdef HAVE_SHELL_SERVICE
+  checkNow: function ()
+  {
+    var shellSvc = Components.classes["@mozilla.org/browser/shell-service;1"]
+                             .getService(Components.interfaces.nsIShellService);
+    var brandBundle = document.getElementById("bundleBrand");
+    var shellBundle = document.getElementById("bundleShell");
+    var brandShortName = brandBundle.getString("brandShortName");
+    var promptTitle = shellBundle.getString("setDefaultBrowserTitle");
+    var promptMessage;
+    const IPS = Components.interfaces.nsIPromptService;
+    var psvc = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
+                         .getService(IPS);
+    if (!shellSvc.isDefaultBrowser(false)) {
+      promptMessage = shellBundle.getFormattedString("setDefaultBrowserMessage", 
+                                                     [brandShortName]);
+      var rv = psvc.confirmEx(window, promptTitle, promptMessage, 
+                              (IPS.BUTTON_TITLE_YES * IPS.BUTTON_POS_0) + 
+                              (IPS.BUTTON_TITLE_NO * IPS.BUTTON_POS_1),
+                              null, null, null, null, { });
+      if (rv == 0)
+        shellSvc.setDefaultBrowser(true, false);
+    }
+    else {
+      promptMessage = shellBundle.getFormattedString("alreadyDefaultBrowser",
+                                                     [brandShortName]);
+      psvc.alert(window, promptTitle, promptMessage);
+    }
+  }
+#endif
+};
+
Index: browser/components/preferences/general.xul
===================================================================
RCS file: browser/components/preferences/general.xul
diff -N browser/components/preferences/general.xul
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ browser/components/preferences/general.xul	21 Feb 2005 11:21:04 -0000
@@ -0,0 +1,91 @@
+<?xml version="1.0"?>
+
+<!DOCTYPE overlay [
+<!ENTITY % brandDTD SYSTEM "chrome://global/locale/brand.dtd" >
+%brandDTD;
+<!ENTITY % generalDTD SYSTEM "chrome://browser/locale/preferences/general.dtd" >
+%generalDTD;
+]>
+
+<overlay id="GeneralPaneOverlay"
+         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+           
+  <prefpane id="paneGeneral" onpaneload="gGeneralPane.init();">
+    <script type="application/x-javascript" src="chrome://browser/content/preferences/general.js"/>
+
+    <preferences>
+      <preference id="browser.startup.homepage"
+                  name="browser.startup.homepage"
+                  type="wstring" onchange="gGeneralPane.homepageChanged(event);"/>
+      <preference id="browser.shell.checkDefaultBrowser"
+                  name="browser.shell.checkDefaultBrowser"
+                  type="bool"/>
+      <preference id="pref.browser.homepage.disable_button.current_page"
+                  name="pref.browser.homepage.disable_button.current_page"
+                  type="bool"/>
+      <preference id="pref.browser.homepage.disable_button.bookmark_page"
+                  name="pref.browser.homepage.disable_button.bookmark_page"
+                  type="bool"/>
+      <preference id="pref.browser.homepage.disable_button.blank_page"
+                  name="pref.browser.homepage.disable_button.blank_page"
+                  type="bool"/>
+      <preference id="pref.general.disable_button.default_browser"
+                  name="pref.general.disable_button.default_browser"
+                  type="bool"/>
+    </preferences>
+    
+    <stringbundle id="bundleBrand" src="chrome://global/locale/brand.properties"/>
+    <stringbundle id="bundleShell" src="chrome://browser/locale/shellservice.properties"/>
+
+    <groupbox>
+      <caption label="&header2.label;"/>
+      <hbox align="center" flex="1">
+        <label value="&location.label;" accesskey="&location.accesskey;" control="browserStartupHomepage"/>
+        <textbox id="browserStartupHomepage" class="padded" flex="1" 
+                 type="autocomplete" autocompletesearch="history"
+                 preference="browser.startup.homepage"/>
+      </hbox>
+      <hbox align="center" pack="end">
+        <button label="&useCurrent.label;" accesskey="&useCurrent.accesskey;"
+                label2="&useCurrentMultiple.label;"
+                oncommand="gGeneralPane.setHomePageToCurrentPage();"
+                id="browserUseCurrent"
+                prefstring="pref.browser.homepage.disable_button.current_page"/>
+        <button label="&useBookmark.label;" accesskey="&useBookmark.accesskey;"
+                oncommand="gGeneralPane.setHomePageToBookmark();"
+                id="browserUseBookmark"
+                prefstring="pref.browser.homepage.disable_button.bookmark_page"/>
+        <button label="&useBlank.label;" accesskey="&useBlank.accesskey;"
+                oncommand="gGeneralPane.setHomePageToBlankPage();"
+                id="browserUseBlank"
+                prefstring="pref.browser.homepage.disable_button.blank_page"/>
+      </hbox>
+    </groupbox>
+
+#ifdef HAVE_SHELL_SERVICE
+    <groupbox orient="horizontal">
+      <caption label="&defaultBrowserGroup.label;"/>
+      <hbox align="center" flex="1">      
+        <checkbox id="checkForDefault" preference="browser.shell.checkDefaultBrowser"
+                  label="&checkForDefault.label;" accesskey="&checkForDefault.accesskey;"
+                  flex="1"/>
+        <button label="&checkNow.label;" accesskey="&checkNow.accesskey;"
+                oncommand="gGeneralPane.checkNow()"
+                preference="pref.general.disable_button.default_browser"/>
+      </hbox>
+    </groupbox>
+#endif
+
+    <groupbox>
+      <caption label="&connectionsInfo.caption;"/>
+      <hbox align="center">
+        <description flex="1">&proxiesInfo.label;</description>
+        <button id="catProxiesButton" label="&showConnections.label;" 
+                accesskey="&showConnections.accesskey;" 
+                oncommand="gGeneralPane.showConnections();"/>
+      </hbox>
+    </groupbox>
+    <separator/>
+  </prefpane>
+
+</overlay>
Index: browser/components/preferences/helperapplications.js
===================================================================
RCS file: browser/components/preferences/helperapplications.js
diff -N browser/components/preferences/helperapplications.js
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ browser/components/preferences/helperapplications.js	21 Feb 2005 11:21:05 -0000
@@ -0,0 +1,819 @@
+# -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+# 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.org Code.
+# 
+# The Initial Developer of the Original Code is
+# Ben Goodger.
+# Portions created by the Initial Developer are Copyright (C) 2001
+# the Initial Developer. All Rights Reserved.
+# 
+# Contributor(s):
+#   Ben Goodger <ben@bengoodger.com>
+# 
+# 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 gRDF;
+
+const kPluginHandlerContractID = "@mozilla.org/content/plugin/document-loader-factory;1";
+const kDisabledPluginTypesPref = "plugin.disable_full_page_plugin_for_types";
+const kRootTypePrefix = "urn:mimetype:";
+
+///////////////////////////////////////////////////////////////////////////////
+// MIME Types DataSource Wrapper
+
+function NC_URI(aProperty)
+{
+  return "http://home.netscape.com/NC-rdf#" + aProperty;
+}
+
+function MIME_URI(aType)
+{
+  return "urn:mimetype:" + aType;
+}
+
+function HANDLER_URI(aHandler)
+{
+  return "urn:mimetype:handler:" + aHandler;
+}
+
+function APP_URI(aType)
+{
+  return "urn:mimetype:externalApplication:" + aType;
+}
+
+function ArrayEnumerator(aItems)
+{
+  this._index = 0;
+  
+  if (aItems) {
+    for (var i = 0; i < aItems.length; ++i) {    
+      if (!aItems[i])
+        aItems.splice(i, 1);      
+    }
+  }
+  
+  this._contents = aItems || [];
+
+  this.push = function (aElement) 
+  {
+    if (aElement)
+      this._contents.push(aElement);
+  };
+  
+  this.hasMoreElements = function ()
+  {
+    return this._index < this._contents.length;
+  };
+  
+  this.getNext = function ()
+  {
+    return this._contents[this._index++];      
+  };
+};
+
+function HelperApps()
+{
+  if (!gRDF) {
+    gRDF = Components.classes["@mozilla.org/rdf/rdf-service;1"]
+                     .getService(Components.interfaces.nsIRDFService);
+  }
+  
+  const mimeTypes = "UMimTyp";
+  var fileLocator = Components.classes["@mozilla.org/file/directory_service;1"]
+                              .getService(Components.interfaces.nsIProperties);
+  
+  var file = fileLocator.get(mimeTypes, Components.interfaces.nsIFile);
+
+  var ioService = Components.classes["@mozilla.org/network/io-service;1"]
+                            .getService(Components.interfaces.nsIIOService);
+  var fileHandler = ioService.getProtocolHandler("file")
+                             .QueryInterface(Components.interfaces.nsIFileProtocolHandler);
+  this._inner = gRDF.GetDataSourceBlocking(fileHandler.getURLSpecFromFile(file));
+  this._inner.AddObserver(this);
+
+  this._fileTypeArc         = gRDF.GetResource(NC_URI("FileType"));
+  this._fileMimeTypeArc     = gRDF.GetResource(NC_URI("FileMIMEType"));
+  this._fileHandlerArc      = gRDF.GetResource(NC_URI("FileHandler"));
+  this._filePluginAvailable = gRDF.GetResource(NC_URI("FilePluginAvailable"));
+  this._fileHandledByPlugin = gRDF.GetResource(NC_URI("FileHandledByPlugin"));
+  this._fileIconArc         = gRDF.GetResource(NC_URI("FileIcon"));
+  this._largeFileIconArc    = gRDF.GetResource(NC_URI("LargeFileIcon"));
+  this._fileExtensionArc    = gRDF.GetResource(NC_URI("FileExtension"));
+  this._fileExtensionsArc   = gRDF.GetResource(NC_URI("FileExtensions"));
+  this._handleAutoArc       = gRDF.GetResource(NC_URI("FileHandleAuto"));
+  this._valueArc            = gRDF.GetResource(NC_URI("value"));
+  this._handlerPropArc      = gRDF.GetResource(NC_URI("handlerProp"));
+  this._externalAppArc      = gRDF.GetResource(NC_URI("externalApplication"));
+  this._childArc            = gRDF.GetResource(NC_URI("child"));
+  this._mimeTypes           = gRDF.GetResource("urn:mimetypes");
+  this._mimeTypesRoot       = gRDF.GetResource("urn:mimetypes:root");
+  
+  // Read enabled plugin type information from the category manager
+  var prefs = Components.classes["@mozilla.org/preferences-service;1"]
+                        .getService(Components.interfaces.nsIPrefBranch);
+  var disabled = "";
+  if (prefs.prefHasUserValue(kDisabledPluginTypesPref)) 
+    disabled = prefs.getCharPref(kDisabledPluginTypesPref);
+
+  for (var i = 0; i < navigator.plugins.length; ++i) {
+    var plugin = navigator.plugins[i];
+    for (var j = 0; j < plugin.length; ++j) {
+      var currType = plugin[j].type;
+      this._availableTypes[currType] = { mimeURI: MIME_URI(currType),
+                                         pluginAvailable: true,
+                                         pluginEnabled: disabled.indexOf(currType) == -1 };
+    }
+  }
+}
+
+HelperApps.prototype = {
+  _availableTypes: { },
+
+  mimeHandlerExists: function (aMIMEType)
+  {
+    var valueProperty = gRDF.GetUnicodeResource(NC_URI("value"));
+    var mimeSource = gRDF.GetUnicodeResource(MIME_URI(aMIMEType));
+    var mimeLiteral = gRDF.GetLiteral(aMIMEType);
+    return this._inner.HasAssertion(mimeSource, valueProperty, mimeLiteral, true);
+  },
+
+  updateTypeInfo: function (aMIMEInfo) 
+  {
+    var mimeType = aMIMEInfo.MIMEType;
+    var isNewMIMEType = this.mimeHandlerExists(mimeType);
+    var entry = new HandlerOverride(MIME_URI(mimeType), this._inner);
+    entry.mimeType    = mimeType;
+    entry.isEditable  = true;
+    entry.alwaysAsk = aMIMEInfo.alwaysAskBeforeHandling;
+    
+    // If not updating (i.e., a newly encountered mime type),
+    // then update extension list and description.
+    if (!isNewMIMEType) {
+      var extEnumerator = aMIMEInfo.getFileExtensions();
+      while (extEnumerator.hasMore()) {
+          entry.addExtension(extEnumerator.getNext());
+      }
+      entry.description = aMIMEInfo.description;
+      entry.appDisplayName = "";
+    }
+    
+    const nsIMIMEInfo = Components.interfaces.nsIMIMEInfo;
+    if (aMIMEInfo.preferredAction == nsIMIMEInfo.saveToDisk) {
+      entry.saveToDisk = true;
+      if (!isNewMIMEType) {
+        // Creating a new entry, set path.
+        entry.appPath = "";
+      }
+    } 
+    else if (aMIMEInfo.preferredAction == nsIMIMEInfo.useSystemDefault ||
+             aMIMEInfo.preferredApplicationHandler == null) {
+      entry.useSystemDefault = true;
+      if (!isNewMIMEType) {
+        // Creating a new entry, set path.
+        entry.appPath = "";
+      }
+    } 
+    else {
+      entry.saveToDisk       = false;
+      entry.useSystemDefault = false;
+      entry.handleInternal   = false;
+      entry.appPath = aMIMEInfo.preferredApplicationHandler.path;
+      entry.appDisplayName = aMIMEInfo.applicationDescription;
+    }
+    
+    // Do RDF magic.
+    entry.buildLinks();
+    this.flush();
+  },
+
+  getLiteralValue: function (aResource, aProperty)
+  {
+    var res = gRDF.GetResource(aResource);
+    var prop = gRDF.GetResource(NC_URI(aProperty));
+    var val = this.GetTarget(res, prop, true);
+    if (val) {
+      val = val.QueryInterface(Components.interfaces.nsIRDFLiteral);
+      return val.Value;
+    }
+    return "";
+  },
+  
+  enableFullPagePluginForType: function (aContentType, aEnabled)
+  {
+    this._availableTypes[aContentType].pluginEnabled = aEnabled;
+  },
+
+  /* nsIRDFDataSource */
+  get URI() {
+    return this._inner.URI;
+  },
+  
+  GetSource: function (aProperty, aTarget, aTruthValue) {
+    return this._inner.GetSource(aProperty, aTarget, aTruthValue);
+  },
+  GetSources: function (aProperty, aTarget, aTruthValue) {
+    return this._inner.GetSources(aProperty, aTarget, aTruthValue);
+  },         
+  
+  _isRootTypeResource: function (aResource) {
+    aResource = aResource.QueryInterface(Components.interfaces.nsIRDFResource);  
+    return (aResource.Value.substr(0, kRootTypePrefix.length) == kRootTypePrefix);
+  },
+  
+  _getTypeFromResource: function (aResource) {
+    var value = aResource.Value;
+    return value.substr(kRootTypePrefix.length, value.length);
+  },
+  
+  getMIMEInfo: function (aResource) {
+    var types = this._inner.GetTarget(aResource, this._valueArc, true);
+    var mimeSvc = Components.classes["@mozilla.org/uriloader/external-helper-app-service;1"]
+                            .getService(Components.interfaces.nsIMIMEService);
+    if (types) {
+      types = types.QueryInterface(Components.interfaces.nsIRDFLiteral);
+      types = types.Value.split(", ");
+      
+      // We're using helper app service as our MIME Service here because the helper app service
+      // talks to OS Specific hooks that on some platforms (MacOS X) are required to get a 
+      // fully populated MIME Info object. Thus it is this object that we return. 
+      return mimeSvc.getFromTypeAndExtension(types[0], null);
+    }
+    else {
+      var type = this._getTypeFromResource(aResource);
+      if (type in this._availableTypes && this._availableTypes[type].pluginAvailable)
+        return mimeSvc.getFromTypeAndExtension(type, null);
+    }
+    
+    return null;
+  },
+   
+  GetTarget: function (aSource, aProperty, aTruthValue) {
+    if (this._isRootTypeResource(aSource)) {
+      var typeInfo = this.getMIMEInfo(aSource);
+      if (typeInfo) {
+        dump("*** " + aSource.Value + " p = " + aProperty.Value + "\n");
+        var bundleUCT = document.getElementById("bundleUCT");
+        if (aProperty.EqualsNode(this._handleAutoArc)) {
+          var handler = this.GetTarget(aSource, this._handlerPropArc, true);
+          if (handler) {
+            dump("*** hashandler\n");
+            handler = handler.QueryInterface(Components.interfaces.nsIRDFResource);
+            return gRDF.GetLiteral(!(this.getLiteralValue(handler.Value, "alwaysAsk") == "true"));
+          }
+          dump("*** nohandler\n");
+          return gRDF.GetLiteral("true");
+        }
+        else if (aProperty.EqualsNode(this._fileTypeArc)) {
+          if (typeInfo.description == "") {
+            try {
+              var literal = bundleUCT.getFormattedString("fileEnding", [typeInfo.primaryExtension.toUpperCase()]);
+              return gRDF.GetLiteral(literal);
+            }
+            catch (e) { 
+              // Wow, this sucks, just show the MIME type as a last ditch effort to display
+              // the type of file that this is. 
+              return gRDF.GetLiteral(typeInfo.MIMEType);
+            }
+          }
+          return gRDF.GetLiteral(typeInfo.description);
+        }
+        else if (aProperty.EqualsNode(this._fileMimeTypeArc))
+          return gRDF.GetLiteral(typeInfo.MIMEType);
+        else if (aProperty.EqualsNode(this._fileHandlerArc)) {
+          // Look for a plugin handler first
+          if (this._availableTypes[typeInfo.MIMEType].pluginAvailable && 
+              this._availableTypes[typeInfo.MIMEType].pluginEnabled) {
+            for (var i = 0; i < navigator.plugins.length; ++i) {
+              var plugin = navigator.plugins[i];
+              for (var j = 0; j < plugin.length; ++j) {
+                if (typeInfo.MIMEType == plugin[j].type)
+                  return gRDF.GetLiteral(bundleUCT.getFormattedString("openWith", [plugin.name]));
+              }
+            }
+          }
+          
+          var handler = this.GetTarget(aSource, this._handlerPropArc, true);
+          if (handler) {
+            handler = handler.QueryInterface(Components.interfaces.nsIRDFResource);
+            if (this.getLiteralValue(handler.Value, "saveToDisk") == "true") {
+              var saveToDisk = bundleUCT.getString("saveToDisk");
+              return gRDF.GetLiteral(saveToDisk);
+            }
+            else if (this.getLiteralValue(handler.Value, "useSystemDefault") == "false") {
+              var extApp = this.GetTarget(handler, this._externalAppArc, true);
+              if (extApp) {
+                extApp = extApp.QueryInterface(Components.interfaces.nsIRDFResource);
+                var openWith = bundleUCT.getFormattedString("openWith", [this.getLiteralValue(extApp.Value, "prettyName")]);
+                return gRDF.GetLiteral(openWith);
+              }
+            }
+          }     
+          var openWith2 = bundleUCT.getFormattedString("openWith", [typeInfo.defaultDescription]);
+          return gRDF.GetLiteral(openWith2);
+        }
+        else if (aProperty.EqualsNode(this._filePluginAvailable)) {
+          var pluginAvailable = this._availableTypes[typeInfo.MIMEType].pluginAvailable;
+          return gRDF.GetLiteral(pluginAvailable ? "true" : "false");
+        }
+        else if (aProperty.EqualsNode(this._fileHandledByPlugin)) {
+          var handledByPlugin = (this._availableTypes[typeInfo.MIMEType].pluginAvailable && 
+                                 this._availableTypes[typeInfo.MIMEType].pluginEnabled);
+          return gRDF.GetLiteral(handledByPlugin ? "true" : "false");
+        }
+        else if (aProperty.EqualsNode(this._fileIconArc)) {
+          try {
+            return gRDF.GetLiteral("moz-icon://goat." + typeInfo.primaryExtension + "?size=16");
+          }
+          catch (e) { }
+          return gRDF.GetLiteral("moz-icon://goat?size=16&contentType=" + typeInfo.MIMEType);
+        }
+        else if (aProperty.EqualsNode(this._largeFileIconArc)) {
+          try {
+            return gRDF.GetLiteral("moz-icon://goat." + typeInfo.primaryExtension + "?size=32");
+          }
+          catch (e) { }
+          return gRDF.GetLiteral("moz-icon://goat?size=32&contentType=" + typeInfo.MIMEType);
+        }
+        else if (aProperty.EqualsNode(this._fileExtensionArc)) {
+          try {
+            return gRDF.GetLiteral(typeInfo.primaryExtension.toUpperCase());
+          }
+          catch (e) { }
+          return gRDF.GetLiteral(bundleUCT.getString("extensionNone"));
+        }
+        else if (aProperty.EqualsNode(this._fileExtensionsArc)) {
+          var extns = typeInfo.getFileExtensions();
+          
+          // Prevent duplicates.
+          var hash = { };
+          while (extns.hasMore())
+            hash[extns.getNext().toUpperCase()] = 0;
+          
+          var str = "";
+          for (var extn in hash)
+            str += extn + ",";
+          str = str.substring(0, str.length - 1);
+
+          return gRDF.GetLiteral(str);
+        }
+      }
+    }
+
+    return this._inner.GetTarget(aSource, aProperty, aTruthValue);
+  },      
+  
+  GetTargets: function (aSource, aProperty, aTruthValue) {
+    if (this._isRootTypeResource(aSource)) { 
+      return new ArrayEnumerator([this.GetTarget(aSource, aProperty, aTruthValue)]);
+    }
+    
+    if (aSource.EqualsNode(this._mimeTypes)) {
+      if (aProperty.EqualsNode(this._childArc)) {
+        var ctr = Components.classes["@mozilla.org/rdf/container;1"]
+                            .createInstance(Components.interfaces.nsIRDFContainer);
+        ctr.Init(this._inner, this._mimeTypesRoot);
+        var elements = ctr.GetElements();
+        while (elements.hasMoreElements()) {
+          var type = elements.getNext().QueryInterface(Components.interfaces.nsIRDFResource);
+          var mi = this.getMIMEInfo(type);
+          if (!(mi.MIMEType in this._availableTypes)) {
+            this._availableTypes[mi.MIMEType] = { mimeURI: MIME_URI(mi.MIMEType),
+                                                  pluginAvailable: false,
+                                                  pluginEnabled: false };
+          }
+        }
+        var types = [];
+        for (var type in this._availableTypes)
+          types.push(gRDF.GetResource(this._availableTypes[type].mimeURI));
+        return new ArrayEnumerator(types);
+      }
+      return new ArrayEnumerator([]);
+    }
+    
+    return this._inner.GetTargets(aSource, aProperty, aTruthValue);
+  }, 
+  Assert: function (aSource, aProperty, aTarget, aTruthValue) {
+    return this._inner.Assert(aSource, aProperty, aTarget, aTruthValue);
+  },
+  Unassert: function (aSource, aProperty, aTarget) {
+    return this._inner.Unassert(aSource, aProperty, aTarget);
+  },
+  Change: function (aSource, aProperty, aOldTarget, aNewTarget) {
+    if (aOldTarget)
+      var ot = aOldTarget.QueryInterface(Components.interfaces.nsIRDFLiteral);
+    if (aNewTarget)
+      var nt = aNewTarget.QueryInterface(Components.interfaces.nsIRDFLiteral);
+
+    return this._inner.Change(aSource, aProperty, aOldTarget, aNewTarget);
+  },
+  Move: function (aOldSource, aNewSource, aProperty, aTarget) {
+    return this._inner.Assert(aOldSource, aNewSource, aProperty, aTarget);
+  },
+  HasAssertion: function (aSource, aProperty, aTarget, aTruthValue) {
+    if (this._isRootTypeResource(aSource)) {
+      // Don't show entries in the list for types that we DO NOT handle
+      // automatically. i.e. this list is a means of editing and removing
+      // automatic overrides only. 
+      if (aProperty.EqualsNode(this._handleAutoArc)) {
+        var handler = this.GetTarget(aSource, this._handlerPropArc, true);
+        if (handler) {
+          handler = handler.QueryInterface(Components.interfaces.nsIRDFResource);
+          return !(this.getLiteralValue(handler.Value, "alwaysAsk") == "true");
+        }
+        else {
+          // If there is no handler, at check to see if this type is handled
+          // by a full-page plugin, and that that full page plugin mode is
+          // enabled...
+          var type = this._getTypeFromResource(aSource);
+          if (type in this._availableTypes && 
+              this._availableTypes[type].pluginAvailable && 
+              type != "*" && type != "none")
+            return true;
+        } 
+      }
+    }
+    return this._inner.HasAssertion(aSource, aProperty, aTarget, aTruthValue);
+  },
+  AddObserver: function (aObserver) {
+    this._inner.AddObserver(aObserver);
+  },
+  RemoveObserver: function (aObserver) {
+    this._inner.RemoveObserver(aObserver);
+  },
+  ArcLabelsIn: function (aNode) {
+    return this._inner.ArcLabelsIn(aNode);
+  },
+  ArcLabelsOut: function (aNode) {
+    return this._inner.ArcLabelsOut(aNode);
+  },
+  GetAllResources: function () {
+    return this._inner.GetAllResources();
+  },
+  hasArcIn: function (aNode, aArc) {
+    return this._inner.hasArcIn(aNode, aArc);
+  },
+  hasArcOut: function (aNode, aArc) {
+    return this._inner.hasArcOut(aNode, aArc);
+  },
+  
+  _observers: [],
+  AddObserver: function (aObserver) {
+    this._observers.push(aObserver);
+  },
+  
+  RemoveObserver: function (aObserver) {
+    for (var i = 0; i < this._observers.length; ++i) {
+      if (this._observers[i] == aObserver) {
+        this._observers.splice(i, 1);
+        break;
+      }
+    }
+  },
+  
+  onAssert: function (aDataSource, aSource, aProperty, aTarget) {
+    for (var i = 0; i < this._observers.length; ++i)
+      this._observers[i].onAssert(aDataSource, aSource, aProperty, aTarget);
+  },
+
+  onUnassert: function (aDataSource, aSource, aProperty, aTarget) {
+    for (var i = 0; i < this._observers.length; ++i)
+      this._observers[i].onUnassert(aDataSource, aSource, aProperty, aTarget);
+  },
+  
+  onChange: function (aDataSource, aSource, aProperty, aOldTarget, aNewTarget) {
+    for (var i = 0; i < this._observers.length; ++i)
+      this._observers[i].onChange(aDataSource, aSource, aProperty, aOldTarget, aNewTarget);
+  },
+  
+  onMove: function (aDataSource, aOldSource, aNewSource, aProperty, aTarget) {
+    for (var i = 0; i < this._observers.length; ++i)
+      this._observers[i].onMove(aDataSource, aOldSource, aNewSource, aProperty, aTarget);
+  },
+  
+  beginUpdateBatch: function (aDataSource) {
+    for (var i = 0; i < this._observers.length; ++i)
+      this._observers[i].beginUpdateBatch(aDataSource);
+  },
+  
+  endUpdateBatch: function (aDataSource) {
+    for (var i = 0; i < this._observers.length; ++i)
+      this._observers[i].endUpdateBatch(aDataSource);
+  },
+
+  flush: function () {
+    var rds = this._inner.QueryInterface(Components.interfaces.nsIRDFRemoteDataSource);
+    if (rds) 
+      rds.Flush();
+  },
+  
+  destroy: function () {
+    this._inner.RemoveObserver(this);
+  },
+  
+  QueryInterface: function nsExtensionManager_QueryInterface (aIID) 
+  {
+    if (!aIID.equals(Components.interfaces.nsIRDFRemoteDataSource) &&
+        !aIID.equals(Components.interfaces.nsIRDFDataSource) &&
+        !aIID.equals(Components.interfaces.nsIRDFObserver) &&
+        !aIID.equals(Components.interfaces.nsISupports))
+      throw Components.results.NS_ERROR_NO_INTERFACE;
+    return this;
+  }  
+};
+
+/**
+ * Handler Override class
+ **/
+function HandlerOverride(aURI, aDatasource)
+{
+  this.URI = aURI;
+  this._DS = aDatasource;
+}
+
+HandlerOverride.prototype = {
+  // general information
+  get mimeType()
+  {
+    return this.getLiteralForContentType(this.URI, "value");
+  },
+  
+  set mimeType(aMIMETypeString)
+  {
+    this.changeMIMEStuff(MIME_URI(aMIMETypeString), "value", aMIMETypeString.toLowerCase());
+    return aMIMETypeString;
+  },
+  
+  get description()
+  {
+    return this.getLiteralForContentType(this.URI, "description");
+  },  
+  
+  set description(aDescriptionString)
+  {
+    this.changeMIMEStuff(MIME_URI(this.mimeType), "description", aDescriptionString);
+    return aDescriptionString;
+  },
+  
+  get isEditable()
+  {
+    return this.getLiteralForContentType(this.URI, "editable");
+  },
+  
+  set isEditable(aIsEditableString)
+  {
+    this.changeMIMEStuff(MIME_URI(this.mimeType), "editable", aIsEditableString);
+    return aIsEditableString;
+  },
+
+  get extensions()
+  {
+    var extensionResource = gRDF.GetUnicodeResource(NC_URI("fileExtensions"));
+    var contentTypeResource = gRDF.GetUnicodeResource(MIME_URI(this.mimeType));
+    var extensionTargets = this._DS.GetTargets(contentTypeResource, extensionResource, true);
+    var extString = "";
+    if (extensionTargets) {
+      while (extensionTargets.hasMoreElements()) {
+        var currentExtension = extensionTargets.getNext();
+        if (currentExtension) {
+          currentExtension = currentExtension.QueryInterface(Components.interfaces.nsIRDFLiteral);
+          if (extString != "") {
+            extString += " ";
+          }
+          extString += currentExtension.Value.toLowerCase();
+        }
+      }
+    }
+    return extString;
+  },
+  
+  addExtension: function (aExtensionString)
+  {
+    this.assertMIMEStuff(MIME_URI(this.mimeType), "fileExtensions", aExtensionString.toLowerCase());
+  },
+  
+  removeExtension: function (aExtensionString)
+  {
+    this.unassertMIMEStuff(MIME_URI(this.mimeType), "fileExtensions", aExtensionString.toLowerCase());
+  },
+
+  clearExtensions: function ()
+  {
+    var extArray = this.extensions.split(" ");
+    for (i = extArray.length - 1; i >= 0; --i) {
+      this.removeExtension(extArray[i]);
+    }
+  },
+  
+  // content handling
+  get saveToDisk()
+  {
+    return this.getHandlerInfoForType(this.URI, "saveToDisk");
+  },
+  
+  set saveToDisk(aSavedToDisk)
+  {
+    this.changeMIMEStuff(HANDLER_URI(this.mimeType), "saveToDisk", aSavedToDisk);
+    this.setHandlerProcedure("handleInternal", "false");
+    this.setHandlerProcedure("useSystemDefault", "false");
+    return aSavedToDisk;
+ },
+
+  get useSystemDefault()
+  {
+    return this.getHandlerInfoForType(this.URI, "useSystemDefault");
+  },
+
+  set useSystemDefault(aUseSystemDefault)
+  {
+    this.changeMIMEStuff(HANDLER_URI(this.mimeType), "useSystemDefault", aUseSystemDefault);
+    this.setHandlerProcedure("handleInternal", "false");
+    this.setHandlerProcedure("saveToDisk", "false");
+    return aUseSystemDefault;
+  },
+  
+  get handleInternal()
+  {
+    return this.getHandlerInfoForType(this.URI, "handleInternal");
+  },
+  
+  set handleInternal(aHandledInternally)
+  {
+    this.changeMIMEStuff(HANDLER_URI(this.mimeType), "handleInternal", aHandledInternally);
+    this.setHandlerProcedure("saveToDisk", "false");
+    this.setHandlerProcedure("useSystemDefault", "false");
+    return aHandledInternally;
+  },
+
+  setHandlerProcedure: function (aHandlerProcedure, aValue)
+  {
+    var handlerSource = gRDF.GetUnicodeResource(HANDLER_URI(this.mimeType));
+    var handlerProperty = gRDF.GetUnicodeResource(NC_URI(aHandlerProcedure));
+    var oppositeValue = aValue == "false" ? "true" : "false";
+    var trueLiteral = gRDF.GetLiteral(oppositeValue);
+    var hasCounterpart = this._DS.HasAssertion(handlerSource, handlerProperty, trueLiteral, true);
+    if (hasCounterpart) {
+      var falseLiteral = gRDF.GetLiteral(aValue);
+      this._DS.Change(handlerSource, handlerProperty, trueLiteral, falseLiteral);
+    }
+  },
+  
+  get alwaysAsk()
+  {
+    return this.getHandlerInfoForType(this.URI, "alwaysAsk");
+  },
+  
+  set alwaysAsk(aAlwaysAsk)
+  {
+    this.changeMIMEStuff(HANDLER_URI(this.mimeType), "alwaysAsk", aAlwaysAsk);
+    return aAlwaysAsk;
+  },
+  
+  // helper application
+  get appDisplayName()
+  {
+    return getHelperAppInfoForType(this.URI, "prettyName");
+  },
+  
+  set appDisplayName(aDisplayName)
+  {
+    this.changeMIMEStuff(APP_URI(this.mimeType), "prettyName", aDisplayName);
+    return aDisplayName;
+  },
+  
+  get appPath()
+  {
+    return this.getHelperAppInfoForType(this.URI, "path");
+  },
+  
+  set appPath(aAppPath)
+  {
+    this.changeMIMEStuff(APP_URI(this.mimeType), "path", aAppPath);
+    return aAppPath;
+  },
+
+  /**
+   * After setting the various properties on this override, we need to
+   * build the links between the mime type resource, the handler for that
+   * resource, and the helper app (if any) associated with the resource.
+   * We also need to add this mime type to the RDF seq (list) of types.
+   **/
+  buildLinks: function()
+  {
+    // assert the handler resource
+    var mimeSource = gRDF.GetUnicodeResource(MIME_URI(this.mimeType));
+    var handlerProperty = gRDF.GetUnicodeResource(NC_URI("handlerProp"));
+    var handlerResource = gRDF.GetUnicodeResource(HANDLER_URI(this.mimeType));
+    this._DS.Assert(mimeSource, handlerProperty, handlerResource, true);
+    // assert the helper app resource
+    var helperAppProperty = gRDF.GetUnicodeResource(NC_URI("externalApplication"));
+    var helperAppResource = gRDF.GetUnicodeResource(APP_URI(this.mimeType));
+    this._DS.Assert(handlerResource, helperAppProperty, helperAppResource, true);
+    // add the mime type to the MIME types seq
+    var container = Components.classes["@mozilla.org/rdf/container;1"].createInstance();
+    if (container) {
+      container = container.QueryInterface(Components.interfaces.nsIRDFContainer);
+      if (container) {
+        var containerRes = gRDF.GetUnicodeResource("urn:mimetypes:root");
+        container.Init(this._DS, containerRes);
+        var element = gRDF.GetUnicodeResource(MIME_URI(this.mimeType));
+        if (container.IndexOf(element) == -1)
+          container.AppendElement(element);
+      }
+    }
+  }, 
+  
+  // Implementation helper methods
+  
+  getLiteralForContentType: function (aURI, aProperty)
+  {
+    var contentTypeResource = gRDF.GetUnicodeResource(aURI);
+    var propertyResource = gRDF.GetUnicodeResource(NC_URI(aProperty));
+    return this.getLiteral(contentTypeResource, propertyResource);
+  },
+
+  getLiteral: function (aSource, aProperty)
+  {
+    var node = this._DS.GetTarget(aSource, aProperty, true);
+    if (node) {
+      node = node.QueryInterface(Components.interfaces.nsIRDFLiteral);
+      return node.Value;
+    }
+    return "";
+  },
+
+  getHandlerInfoForType: function (aURI, aPropertyString)
+  {
+    // get current selected type
+    var handler = HANDLER_URI(this.getLiteralForContentType(aURI, "value"));
+    var source = gRDF.GetUnicodeResource(handler);
+    var property = gRDF.GetUnicodeResource(NC_URI(aPropertyString));
+    var target = this._DS.GetTarget(source, property, true);
+    if (target) {
+      target = target.QueryInterface(Components.interfaces.nsIRDFLiteral);
+      return target.Value;
+    }
+    return "";
+  },
+
+  getHelperAppInfoForType: function (aURI, aPropertyString)
+  {
+    var appURI      = APP_URI(this.getLiteralForContentType(aURI, "value"));
+    var appRes      = gRDF.GetUnicodeResource(appURI);
+    var appProperty = gRDF.GetUnicodeResource(NC_URI(aPropertyString));
+    return getLiteral(appRes, appProperty);
+  },
+
+  // write to the ds
+  assertMIMEStuff: function (aMIMEString, aPropertyString, aValueString)
+  {
+    var mimeSource = gRDF.GetUnicodeResource(aMIMEString);
+    var valueProperty = gRDF.GetUnicodeResource(NC_URI(aPropertyString));
+    var mimeLiteral = gRDF.GetLiteral(aValueString);
+    this._DS.Assert(mimeSource, valueProperty, mimeLiteral, true);
+  },
+
+  changeMIMEStuff: function(aMIMEString, aPropertyString, aValueString)
+  {
+    var mimeSource = gRDF.GetUnicodeResource(aMIMEString);
+    var valueProperty = gRDF.GetUnicodeResource(NC_URI(aPropertyString));
+    var mimeLiteral = gRDF.GetLiteral(aValueString);
+    var currentValue = this._DS.GetTarget(mimeSource, valueProperty, true);
+    if (currentValue) {
+      this._DS.Change(mimeSource, valueProperty, currentValue, mimeLiteral);
+    } else {
+      this._DS.Assert(mimeSource, valueProperty, mimeLiteral, true);
+    } 
+  },
+
+  unassertMIMEStuff: function(aMIMEString, aPropertyString, aValueString)
+  {
+    var mimeSource = gRDF.GetUnicodeResource(aMIMEString);
+    var valueProperty = gRDF.GetUnicodeResource(NC_URI(aPropertyString));
+    var mimeLiteral = gRDF.GetLiteral(aValueString);
+    this._DS.Unassert(mimeSource, valueProperty, mimeLiteral, true);
+  }
+};
+
Index: browser/components/preferences/jar.mn
===================================================================
RCS file: browser/components/preferences/jar.mn
diff -N browser/components/preferences/jar.mn
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ browser/components/preferences/jar.mn	21 Feb 2005 11:21:05 -0000
@@ -0,0 +1,41 @@
+browser.jar:
+*   content/browser/preferences/actionsshared.js
+*   content/browser/preferences/advanced.xul
+*   content/browser/preferences/advanced.js
+*   content/browser/preferences/changeaction.xul
+*   content/browser/preferences/changeaction.js
+*   content/browser/preferences/colors.xul
+*   content/browser/preferences/cookies.xul
+*   content/browser/preferences/cookies.js
+*   content/browser/preferences/content.xul
+*   content/browser/preferences/content.js
+*   content/browser/preferences/connection.xul
+*   content/browser/preferences/connection.js
+*   content/browser/preferences/downloads.xul
+*   content/browser/preferences/downloads.js
+*   content/browser/preferences/downloadactions.xul
+*   content/browser/preferences/downloadactions.js
+*   content/browser/preferences/fontbuilder.js
+*   content/browser/preferences/fonts.xul
+*   content/browser/preferences/fonts.js
+*   content/browser/preferences/fontscaling.xul
+*   content/browser/preferences/fontscaling.js
+*   content/browser/preferences/general.xul
+*   content/browser/preferences/general.js
+*   content/browser/preferences/helperapplications.js
+*   content/browser/preferences/languages.xul
+*   content/browser/preferences/languages.js
+*   content/browser/preferences/ocsp.xul
+*   content/browser/preferences/ocsp.js
+*   content/browser/preferences/permissions.xul
+*   content/browser/preferences/permissions.js
+*   content/browser/preferences/permissionsutils.js
+*   content/browser/preferences/preferences.xul
+*   content/browser/preferences/preferences.xml
+*   content/browser/preferences/preferences.css
+*   content/browser/preferences/privacy.xul
+*   content/browser/preferences/privacy.js
+*   content/browser/preferences/sanitize.xul
+*   content/browser/preferences/sanitize.js
+*   content/browser/preferences/tabs.xul
+*   content/browser/preferences/tabs.js
Index: browser/components/preferences/languages.js
===================================================================
RCS file: browser/components/preferences/languages.js
diff -N browser/components/preferences/languages.js
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ browser/components/preferences/languages.js	21 Feb 2005 11:21:05 -0000
@@ -0,0 +1,328 @@
+
+var gLanguagesDialog = {
+
+  _availableLanguagesList : [],
+  _acceptLanguages        : { },
+  
+  _selectedItemID         : null,
+  
+  init: function ()
+  {
+    if (!this._availableLanguagesList.length)
+      this._loadAvailableLanguages();
+  },
+  
+  get _activeLanguages()
+  {
+    return document.getElementById("activeLanguages");
+  },
+  
+  get _availableLanguages()
+  {
+    return document.getElementById("availableLanguages");
+  },
+  
+  _loadAvailableLanguages: function ()
+  {
+    // This is a parser for: resource://gre/res/language.properties
+    // The file is formatted like so:
+    // ab[-cd].accept=true|false
+    //  ab = language
+    //  cd = region
+    var bundleAccepted    = document.getElementById("bundleAccepted");
+    var bundleRegions     = document.getElementById("bundleRegions");
+    var bundleLanguages   = document.getElementById("bundleLanguages");
+    var bundlePreferences = document.getElementById("bundlePreferences");
+
+    function LanguageInfo(aName, aABCD, aIsVisible)
+    {
+      this.name = aName;
+      this.abcd = aABCD;
+      this.isVisible = aIsVisible;
+    }
+
+    // 1) Read the available languages out of language.properties
+    var strings = bundleAccepted.strings;
+    while (strings.hasMoreElements()) {
+      var currString = strings.getNext();
+      if (!(currString instanceof Components.interfaces.nsIPropertyElement))
+        break;
+      
+      var property = currString.key.split("."); // ab[-cd].accept
+      if (property[1] == "accept") {
+        var abCD = property[0];
+        var abCDPairs = abCD.split("-");      // ab[-cd]
+        if (abCDPairs[0]) {
+          var language = region = "";
+          try {
+            language = bundleLanguages.getString(abCDPairs[0]);
+          } 
+          catch (e) { };
+          
+          var useABCDFormat = abCDPairs.length > 1;
+          if (useABCDFormat) {
+            try {
+              region = bundleRegions.getString(abCDPairs[1]);
+            }
+            catch (e) { }
+          }
+          
+          var name = "";
+          if (useABCDFormat)
+            name = bundlePreferences.getFormattedString("languageRegionCodeFormat", 
+                                                        [language, region, abCD]);
+          else
+            name = bundlePreferences.getFormattedString("languageCodeFormat", 
+                                                        [language, abCD]);
+          
+          if (name && abCD) {
+            var isVisible = currString.value == "true" && 
+                            (!(abCD in this._acceptLanguages) || !this._acceptLanguages[abCD]);
+            var li = new LanguageInfo(name, abCD, isVisible);
+            this._availableLanguagesList.push(li);
+          }
+        }
+      }
+    }
+    this._buildAvailableLanguageList();
+  },
+  
+  _buildAvailableLanguageList: function ()
+  {
+    var availableLanguagesPopup = document.getElementById("availableLanguagesPopup");
+    while (availableLanguagesPopup.hasChildNodes())
+      availableLanguagesPopup.removeChild(availableLanguagesPopup.firstChild);
+      
+    // Sort the list of languages by name
+    this._availableLanguagesList.sort(function (a, b) {
+                                        if (a.name < b.name) return -1;
+                                        if (a.name > b.name) return 1;
+                                        return 0;
+                                      });
+                                  
+    // Load the UI with the data
+    for (var i = 0; i < this._availableLanguagesList.length; ++i) {
+      var abCD = this._availableLanguagesList[i].abcd;
+      if (this._availableLanguagesList[i].isVisible && 
+          (!(abCD in this._acceptLanguages) || !this._acceptLanguages[abCD])) {
+        var menuitem = document.createElement("menuitem");
+        menuitem.id = this._availableLanguagesList[i].abcd;
+        availableLanguagesPopup.appendChild(menuitem);
+        menuitem.setAttribute("label", this._availableLanguagesList[i].name);
+      }
+    }
+  },
+  
+  readAcceptLanguages: function ()
+  {
+    while (this._activeLanguages.hasChildNodes())
+      this._activeLanguages.removeChild(this._activeLanguages.firstChild);
+    
+    var selectedIndex = 0;
+    var preference = document.getElementById("intl.accept_languages");
+    var languages = preference.value.split(/\s*,\s*/);
+    for (var i = 0; i < languages.length; ++i) {
+      var name = this._getLanguageName(languages[i]);
+      if (!name)
+        name = "[" + languages[i] + "]";
+      var listitem = document.createElement("listitem");
+      listitem.id = languages[i];
+      if (languages[i] == this._selectedItemID)
+        selectedIndex = i;
+      this._activeLanguages.appendChild(listitem);
+      listitem.label = name;
+
+      // Hash this language as an "Active" language so we don't
+      // show it in the list that can be added. 
+      this._acceptLanguages[languages[i]] = true;
+    }
+
+    if (this._activeLanguages.childNodes.length > 0) 
+      this._activeLanguages.selectedIndex = selectedIndex;
+    
+    return undefined;
+  },
+  
+  writeAcceptLanguages: function ()
+  {
+    return undefined;
+  },
+  
+  onAvailableLanguageSelect: function ()
+  {
+    var addButton = document.getElementById("addButton");
+    addButton.disabled = false;
+    
+    this._availableLanguages.removeAttribute("accesskey");
+  },
+  
+  addLanguage: function ()
+  {
+    var selectedID = this._availableLanguages.selectedItem.id;
+    var preference = document.getElementById("intl.accept_languages");
+    if (preference.value.indexOf(selectedID) >= 0)
+      return;
+      
+    this._selectedItemID = selectedID;
+    
+    if (preference.value == "") 
+      preference.value = selectedID;
+    else
+      preference.value += "," + selectedID;
+  
+    this._acceptLanguages[selectedID] = true;
+    this._availableLanguages.selectedItem = null;
+    
+    // Reuild the available list with the added item removed...
+    this._buildAvailableLanguageList(); 
+    
+    this._availableLanguages.setAttribute("label", this._availableLanguages.getAttribute("label2"));
+    this._availableLanguages.setAttribute("accesskey", this._availableLanguages.getAttribute("accesskey2"));
+  },
+  
+  removeLanguage: function ()
+  {
+    // Build the new preference value string.
+    var string = "";
+    for (var i = 0; i < this._activeLanguages.childNodes.length; ++i) {
+      var item = this._activeLanguages.childNodes[i];
+      if (!item.selected) 
+        string += (i == 0 ? "" : ",") + item.id;
+      else  
+        this._acceptLanguages[item.id] = false;
+    }
+
+    // Get the item to select after the remove operation completes.     
+    var selection = this._activeLanguages.selectedItems;
+    var lastSelected = selection[selection.length-1];
+    var selectItem = lastSelected.nextSibling || lastSelected.previousSibling;
+    selectItem = selectItem ? selectItem.id : null;
+    
+    this._selectedItemID = selectItem;
+
+    // Update the preference and force a UI rebuild
+    var preference = document.getElementById("intl.accept_languages");
+    preference.value = string;
+
+    this._buildAvailableLanguageList(); 
+  },
+  
+  _getLanguageName: function (aABCD)
+  {
+    if (!this._availableLanguagesList.length)
+      this._loadAvailableLanguages();
+    for (var i = 0; i < this._availableLanguagesList.length; ++i) {
+      if (aABCD == this._availableLanguagesList[i].abcd) 
+        return this._availableLanguagesList[i].name;
+    }
+    return "";
+  },
+  
+  moveUp: function ()
+  {
+    var selectedItem = this._activeLanguages.selectedItems[0];
+    var previousItem = selectedItem.previousSibling;
+    
+    var string = "";
+    for (var i = 0; i < this._activeLanguages.childNodes.length; ++i) {
+      var item = this._activeLanguages.childNodes[i];
+      string += (i == 0 ? "" : ",");
+      if (item.id == previousItem.id) 
+        string += selectedItem.id;
+      else if (item.id == selectedItem.id)
+        string += previousItem.id;
+      else
+        string += item.id;
+    }
+    
+    this._selectedItemID = selectedItem.id;
+
+    // Update the preference and force a UI rebuild
+    var preference = document.getElementById("intl.accept_languages");
+    preference.value = string;
+  },
+  
+  moveDown: function ()
+  {
+    var selectedItem = this._activeLanguages.selectedItems[0];
+    var nextItem = selectedItem.nextSibling;
+    
+    var string = "";
+    for (var i = 0; i < this._activeLanguages.childNodes.length; ++i) {
+      var item = this._activeLanguages.childNodes[i];
+      string += (i == 0 ? "" : ",");
+      if (item.id == nextItem.id) 
+        string += selectedItem.id;
+      else if (item.id == selectedItem.id)
+        string += nextItem.id;
+      else
+        string += item.id;
+    }
+    
+    this._selectedItemID = selectedItem.id;
+
+    // Update the preference and force a UI rebuild
+    var preference = document.getElementById("intl.accept_languages");
+    preference.value = string;
+  },
+  
+  onLanguageSelect: function ()
+  {
+    var upButton = document.getElementById("up");
+    var downButton = document.getElementById("down");
+    var removeButton = document.getElementById("remove");
+    switch (this._activeLanguages.selectedCount) {
+    case 0:
+      upButton.disabled = downButton.disabled = removeButton.disabled = true;
+      break;
+    case 1:
+      upButton.disabled = this._activeLanguages.selectedIndex == 0;
+      downButton.disabled = this._activeLanguages.selectedIndex == this._activeLanguages.childNodes.length - 1;
+      removeButton.disabled = false;
+      break;
+    default:
+      upButton.disabled = true;
+      downButton.disabled = true;
+      removeButton.disabled = false;
+    }
+  },
+};
+
+# -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+# 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 the Firefox Preferences System.
+# 
+# The Initial Developer of the Original Code is Ben Goodger.
+# Portions created by the Initial Developer are Copyright (C) 2005
+# the Initial Developer. All Rights Reserved.
+# 
+# Contributor(s):
+#   Ben Goodger <ben@mozilla.org>
+#   Adrian Havill <havill@redhat.com>
+#   Steffen Wilberg <steffen.wilberg@web.de>
+# 
+# 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 *****
+
Index: browser/components/preferences/languages.xul
===================================================================
RCS file: browser/components/preferences/languages.xul
diff -N browser/components/preferences/languages.xul
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ browser/components/preferences/languages.xul	21 Feb 2005 11:21:05 -0000
@@ -0,0 +1,123 @@
+<?xml version="1.0"?>
+
+# -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+# 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 the Firefox Preferences System.
+# 
+# The Initial Developer of the Original Code is Ben Goodger.
+# Portions created by the Initial Developer are Copyright (C) 2005
+# the Initial Developer. All Rights Reserved.
+# 
+# Contributor(s):
+#   Ben Goodger <ben@mozilla.org>
+#   Steffen Wilberg <steffen.wilberg@web.de>
+# 
+# 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 *****
+
+<!DOCTYPE prefwindow SYSTEM "chrome://browser/locale/preferences/languages.dtd">
+
+<?xml-stylesheet href="chrome://global/skin/"?>
+
+<prefwindow id="LanguagesDialog" type="child"
+            xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+            title="&languages.customize.Header;"
+            dlgbuttons="accept,cancel"
+            style="width: 30em;">
+
+  <prefpane id="LanguagesDialogPane" onpaneload="gLanguagesDialog.init();">   
+    <preferences>
+      <preference id="intl.accept_languages" name="intl.accept_languages" type="wstring"/>
+      <preference id="pref.browser.language.disable_button.up"
+                  name="pref.browser.language.disable_button.up"
+                  type="bool"/>
+      <preference id="pref.browser.language.disable_button.down"
+                  name="pref.browser.language.disable_button.down"
+                  type="bool"/>
+      <preference id="pref.browser.language.disable_button.remove"
+                  name="pref.browser.language.disable_button.remove"
+                  type="bool"/>
+    </preferences>
+
+    <script type="application/x-javascript" src="chrome://browser/content/preferences/languages.js"/>
+
+    <stringbundleset id="languageSet">
+      <stringbundle id="bundleRegions"      src="chrome://global/locale/regionNames.properties"/>
+      <stringbundle id="bundleLanguages"    src="chrome://global/locale/languageNames.properties"/>
+      <stringbundle id="bundlePreferences"  src="chrome://browser/locale/preferences/preferences.properties"/>
+      <stringbundle id="bundleAccepted"     src="resource://gre/res/language.properties"/>
+    </stringbundleset>
+
+    <description>&languages.customize.prefLangDescript;</description>
+    <label>&languages.customize.active.label;</label>
+    <grid flex="1">
+      <columns>
+        <column flex="1"/>
+        <column/>
+      </columns>
+      <rows>
+        <row flex="1">
+          <listbox id="activeLanguages" flex="1" rows="6"
+                    seltype="multiple" onselect="gLanguagesDialog.onLanguageSelect();"
+                    preference="intl.accept_languages"
+                    onpreferenceread="return gLanguagesDialog.readAcceptLanguages();"
+                    onpreferencewrite="return gLanguagesDialog.writeAcceptLanguages();"/>
+          <vbox>
+            <button id="up" class="up" oncommand="gLanguagesDialog.moveUp();" disabled="true"
+                    label="&languages.customize.moveUp.label;"
+                    accesskey="&languages.customize.moveUp.accesskey;"
+                    preference="pref.browser.language.disable_button.up"/>
+            <button id="down" class="down" oncommand="gLanguagesDialog.moveDown();" disabled="true"
+                    label="&languages.customize.moveDown.label;"
+                    accesskey="&languages.customize.moveDown.accesskey;"
+                    preference="pref.browser.language.disable_button.down"/>
+            <button id="remove" oncommand="gLanguagesDialog.removeLanguage();" disabled="true"
+                    label="&languages.customize.deleteButton.label;"
+                    accesskey="&languages.customize.deleteButton.accesskey;"
+                    preference="pref.browser.language.disable_button.remove"/>
+          </vbox>
+        </row>
+        <row>
+          <separator class="thin"/>
+        </row>
+        <row>
+          <menulist id="availableLanguages" oncommand="gLanguagesDialog.onAvailableLanguageSelect();"
+                    label="&languages.customize.selectLanguage.label;"
+                    label2="&languages.customize.selectLanguage.label;"
+                    accesskey="&languages.customize.selectLanguage.accesskey;"
+                    accesskey2="&languages.customize.selectLanguage.accesskey;">
+            <menupopup id="availableLanguagesPopup"/>
+          </menulist>
+          <button id="addButton" oncommand="gLanguagesDialog.addLanguage();" disabled="true"
+                  label="&languages.customize.addButton.label;"
+                  accesskey="&languages.customize.addButton.accesskey;"/>
+        </row>
+      </rows>
+    </grid>
+    <separator/>
+    <separator/>
+  </prefpane>
+</prefwindow>
+
Index: browser/components/preferences/ocsp.js
===================================================================
RCS file: browser/components/preferences/ocsp.js
diff -N browser/components/preferences/ocsp.js
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ browser/components/preferences/ocsp.js	21 Feb 2005 11:21:05 -0000
@@ -0,0 +1,91 @@
+# -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+# 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 the Firefox Preferences System.
+# 
+# The Initial Developer of the Original Code is Ben Goodger.
+# Portions created by the Initial Developer are Copyright (C) 2005
+# the Initial Developer. All Rights Reserved.
+# 
+# Contributor(s):
+#   Ben Goodger <ben@mozilla.org>
+# 
+# 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 gOCSPDialog = {
+  _certDB         : null,
+  _OCSPResponders : null,
+
+  init: function ()
+  {
+    this._certDB = Components.classes["@mozilla.org/security/x509certdb;1"]
+                             .getService(Components.interfaces.nsIX509CertDB);
+    this._OCSPResponders = this._certDB.getOCSPResponders();
+
+    var signingCA = document.getElementById("signingCA");
+    const nsIOCSPResponder = Components.interfaces.nsIOCSPResponder;
+    for (var i = 0; i < this._OCSPResponders.length; ++i) {
+      var ocspEntry = this._OCSPResponders.queryElementAt(i, nsIOCSPResponder);
+      var menuitem = document.createElement("menuitem");
+      menuitem.setAttribute("value", ocspEntry.responseSigner);
+      menuitem.setAttribute("label", ocspEntry.responseSigner);
+      signingCA.firstChild.appendChild(menuitem);
+    }
+    
+    var signingCAPref = document.getElementById("security.OCSP.signingCA");
+    if (!signingCAPref.hasUserValue) {
+      signingCA.selectedIndex = 0;
+      this.chooseServiceURL();
+    }
+  },
+  
+  _updateUI: function ()
+  {
+    var signingCA = document.getElementById("security.OCSP.signingCA");
+    var serviceURL = document.getElementById("security.OCSP.URL");
+    var securityOCSPEnabled = document.getElementById("security.OCSP.enabled");
+
+    var OCSPEnabled = parseInt(securityOCSPEnabled.value);
+    signingCA.disabled = serviceURL.disabled = OCSPEnabled == 0 || OCSPEnabled == 1;
+    return undefined;
+  },
+  
+  chooseServiceURL: function ()
+  {
+    var signingCA = document.getElementById("signingCA");
+    var serviceURL = document.getElementById("serviceURL");
+    var CA = signingCA.value;
+    
+    const nsIOCSPResponder = Components.interfaces.nsIOCSPResponder;
+    for (var i = 0; i < this._OCSPResponders.length; ++i) {
+      var ocspEntry = this._OCSPResponders.queryElementAt(i, nsIOCSPResponder);
+      if (CA == ocspEntry.responseSigner) {
+        serviceURL.value = ocspEntry.serviceURL;
+        break;
+      }
+    }
+  },
+};
+
Index: browser/components/preferences/ocsp.xul
===================================================================
RCS file: browser/components/preferences/ocsp.xul
diff -N browser/components/preferences/ocsp.xul
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ browser/components/preferences/ocsp.xul	21 Feb 2005 11:21:06 -0000
@@ -0,0 +1,97 @@
+<?xml version="1.0"?>
+
+# -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+# 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 the Firefox Preferences System.
+# 
+# The Initial Developer of the Original Code is Ben Goodger.
+# Portions created by the Initial Developer are Copyright (C) 2005
+# the Initial Developer. All Rights Reserved.
+# 
+# Contributor(s):
+#   Ben Goodger <ben@mozilla.org>
+# 
+# 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 *****
+
+<?xml-stylesheet href="chrome://global/skin/"?>
+
+<!DOCTYPE prefwindow [
+  <!ENTITY % brandDTD SYSTEM "chrome://global/locale/brand.dtd">
+  <!ENTITY % ocspDTD SYSTEM "chrome://browser/locale/preferences/ocsp.dtd">
+  %brandDTD;
+  %ocspDTD;
+]>
+
+<prefwindow id="OCSPDialog" type="child"
+            xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+            dlgbuttons="accept,cancel"
+            onload="gOCSPDialog.init();"
+            title="&ocspDialog.title;"
+            style="width: 38em !important;">
+
+  <prefpane id="OCSPDialogPane">  
+    <script type="application/x-javascript" src="chrome://browser/content/preferences/ocsp.js"/>
+
+    <preferences>
+      <preference id="security.OCSP.enabled"    name="security.OCSP.enabled"   type="int"/>
+      <preference id="security.OCSP.signingCA"  name="security.OCSP.signingCA" type="string"/>
+      <preference id="security.OCSP.URL"        name="security.OCSP.URL"       type="string"/>
+    </preferences>
+    
+    <description>&validation.ocsp.description;</description>
+    <radiogroup id="securityOCSPEnabled" preference="security.OCSP.enabled"
+                onpreferenceread="return gOCSPDialog._updateUI();">
+      <radio value="0" label="&disableOCSP.label;"/>
+      <radio value="1" label="&certOCSP.label;"/>
+      <radio value="2" label="&proxyOCSP.label;"/>
+
+      <grid class="indent" flex="1">
+        <columns>
+          <column/>
+          <column flex="1"/>
+        </columns>
+          
+        <rows>
+          <row align="center">
+            <label value="&signingCA.label;" accesskey="&signingCA.accesskey;" control="signingCA"/>
+            <hbox id="signingCABox" flex="1">
+              <menulist id="signingCA" flex="1"
+                        preference="security.OCSP.signingCA"
+                        oncommand="gOCSPDialog.chooseServiceURL()">
+                <menupopup/>
+              </menulist>
+            </hbox>            
+          </row>
+          <row align="center">
+            <label value="&serviceURL.label;" accesskey="&serviceURL.accesskey;" control="serviceURL"/>
+            <textbox id="serviceURL" preference="security.OCSP.URL"/>
+          </row>
+        </rows>
+      </grid>
+    </radiogroup>
+    <separator/>
+  </prefpane>
+</prefwindow>
Index: browser/components/preferences/permissions.js
===================================================================
RCS file: browser/components/preferences/permissions.js
diff -N browser/components/preferences/permissions.js
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ browser/components/preferences/permissions.js	21 Feb 2005 11:21:06 -0000
@@ -0,0 +1,359 @@
+# -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+# 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 the Firefox Preferences System.
+# 
+# The Initial Developer of the Original Code is Ben Goodger.
+# Portions created by the Initial Developer are Copyright (C) 2005
+# the Initial Developer. All Rights Reserved.
+# 
+# Contributor(s):
+#   Ben Goodger <ben@mozilla.org>
+#   Blake Ross <firefox@blakeross.com>
+# 
+# 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 *****
+
+const nsIPermissionManager = Components.interfaces.nsIPermissionManager;
+const nsICookiePermission = Components.interfaces.nsICookiePermission;
+
+function Permission(host, rawHost, type, capability, perm) 
+{
+  this.host = host;
+  this.rawHost = rawHost;
+  this.type = type;
+  this.capability = capability;
+  this.perm = perm;
+}
+
+var gPermissionManager = {
+  _type         : "",
+  _permissions  : [],
+  _pm           : Components.classes["@mozilla.org/permissionmanager;1"]
+                            .getService(Components.interfaces.nsIPermissionManager),
+  _bundle       : null,
+  _tree         : null,
+  
+  _view: {
+    _rowCount: 0,
+    get rowCount() 
+    { 
+      return this._rowCount; 
+    },
+    getCellText: function (aRow, aColumn)
+    {
+      if (aColumn.id == "siteCol")
+        return gPermissionManager._permissions[aRow].rawHost;
+      else if (aColumn.id == "statusCol")
+        return gPermissionManager._permissions[aRow].capability;
+      return "";
+    },
+
+    isSeparator: function(aIndex) { return false; },
+    isSorted: function() { return false; },
+    isContainer: function(aIndex) { return false; },
+    setTree: function(aTree){},
+    getImageSrc: function(aRow, aColumn) {},
+    getProgressMode: function(aRow, aColumn) {},
+    getCellValue: function(aRow, aColumn) {},
+    cycleHeader: function(column) {},
+    getRowProperties: function(row,prop){},
+    getColumnProperties: function(column,prop){},
+    getCellProperties: function(row,column,prop){}
+  },
+  
+  _getCapabilityString: function (aPermission)
+  {
+    var stringKey = null;
+    switch (aPermission.capability) {
+    case nsIPermissionManager.ALLOW_ACTION:
+      stringKey = "can";
+      break;
+    case nsIPermissionManager.DENY_ACTION:
+      stringKey = "cannot";
+      break;
+    case nsICookiePermission.ACCESS_SESSION:
+      stringKey = "canSession";
+      break;
+    }
+    return this._bundle.getString(stringKey);
+  },
+  
+  addPermission: function (aPermission)
+  {
+    var textbox = document.getElementById("url");
+    var host = textbox.value.replace(/^\s*([-\w]*:\/+)?/, ""); // trim any leading space and scheme
+    try {
+      var ioService = Components.classes["@mozilla.org/network/io-service;1"]
+                                .getService(Components.interfaces.nsIIOService);
+      var uri = ioService.newURI("http://"+host, null, null);
+      host = uri.host;
+    } catch(ex) {
+      var promptService = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
+                                    .getService(Components.interfaces.nsIPromptService);
+      var message = stringBundle.getString("invalidURI");
+      var title = stringBundle.getString("invalidURITitle");
+      promptservice.alert(window,title,message);
+    }
+
+    var capabilityString = this._getCapabilityString(aPermission);
+
+    // check whether the permission already exists, if not, add it
+    var exists = false;
+    for (var i = 0; i < this._permissions.length; ++i) {
+      if (this._permissions[i].rawHost == host) {
+        exists = true;
+        this._permissions[i].capability = capabilityString;
+        this._permissions[i].perm = aPermission;
+        break;
+      }
+    }
+    
+    if (!exists) {
+      var p = new Permission(host, 
+                             (host.charAt(0) == ".") ? host.substring(1,host.length) : host, 
+                             this._type, 
+                             capabilityString,
+                             aPermission);
+      this._permissions.push(p);
+      
+      this._view._rowCount = this._permissions.length;
+      this._tree.treeBoxObject.rowCountChanged(this._permissions.length-1, 1);
+      this._tree.treeBoxObject.ensureRowIsVisible(this._permissions.length-1);
+      
+      uri.spec = p.host;
+      this._pm.add(uri, p.type, p.perm);
+    }
+    textbox.value = "";
+    textbox.focus();
+
+    // covers a case where the site exists already, so the buttons don't disable
+    this.onHostInput(textbox);
+
+    // enable "remove all" button as needed
+    document.getElementById("removeAllPermissions").disabled = this._permissions.length == 0;
+  },
+  
+  onHostInput: function (aSiteField)
+  {
+    document.getElementById("btnSession").disabled = !aSiteField.value;
+    document.getElementById("btnBlock").disabled = !aSiteField.value;
+    document.getElementById("btnAllow").disabled = !aSiteField.value;
+  },
+  
+  onHostKeyPress: function (aEvent)
+  {
+    if (aEvent.keyCode == 13)
+      gPermissionManager.addPermission(nsIPermissionManager.ALLOW_ACTION);
+  },
+  
+  onLoad: function ()
+  {
+    this._bundle = document.getElementById("bundlePreferences");
+    var params = window.arguments[0];
+    this.init(params);
+  },
+  
+  init: function (aParams)
+  {
+    this._type = aParams.permissionType;
+    
+    var permissionsText = document.getElementById("permissionsText");
+    while (permissionsText.hasChildNodes())
+      permissionsText.removeChild(permissionsText.firstChild);
+    permissionsText.appendChild(document.createTextNode(aParams.introText));
+
+    document.title = aParams.windowTitle;
+    
+    document.getElementById("btnBlock").hidden    = !aParams.blockVisible;
+    document.getElementById("btnSession").hidden  = !aParams.sessionVisible;
+    document.getElementById("btnAllow").hidden    = !aParams.allowVisible;
+    
+    var urlField = document.getElementById("url");
+    urlField.value = aParams.prefilledHost;
+    
+    this.onHostInput(urlField);
+    
+    var os = Components.classes["@mozilla.org/observer-service;1"]
+                       .getService(Components.interfaces.nsIObserverService);
+    os.addObserver(this, "perm-changed", false);
+
+    this._loadPermissions();
+    
+    urlField.focus();
+  },
+  
+  uninit: function ()
+  {
+    var os = Components.classes["@mozilla.org/observer-service;1"]
+                       .getService(Components.interfaces.nsIObserverService);
+    os.removeObserver(this, "perm-changed");
+  },
+  
+  observe: function (aSubject, aTopic, aData)
+  {
+    if (aTopic == "perm-changed") {
+      var permission = aSubject.QueryInterface(Components.interfaces.nsIPermission);
+      if (aData == "added") {
+        this._addPermissionToList(permission);
+        ++this._view._rowCount;
+        this._tree.treeBoxObject.rowCountChanged(this._view.rowCount - 1, 1);        
+        // Re-do the sort, since we inserted this new item at the end. 
+        gTreeUtils.sort(this._tree, this._view, this._permissions, 
+                        this._lastPermissionSortColumn, 
+                        this._lastPermissionSortAscending);        
+      }
+      else if (aData == "changed") {
+        for (var i = 0; i < this._permissions.length; ++i) {
+          if (this._permissions[i].host == permission.host) {
+            this._permissions[i].capability = this._getCapabilityString(permission);
+            break;
+          }
+        }
+        // Re-do the sort, if the status changed from Block to Allow
+        // or vice versa, since if we're sorted on status, we may no
+        // longer be in order. 
+        if (this._lastPermissionSortColumn.id == "statusCol") {
+          gTreeUtils.sort(this._tree, this._view, this._permissions, 
+                          this._lastPermissionSortColumn, 
+                          this._lastPermissionSortAscending);
+        }
+        this._tree.treeBoxObject.invalidate();
+      }
+      // No UI other than this window causes this method to be sent a "deleted"
+      // notification, so we don't need to implement it since Delete is handled
+      // directly by the Permission Removal handlers. If that ever changes, those
+      // implementations will have to move into here. 
+    }
+  },
+  
+  onPermissionSelected: function ()
+  {
+    var hasSelection = this._tree.view.selection.count > 0;
+    var hasRows = this._tree.view.rowCount > 0;
+    document.getElementById("removePermission").disabled = !hasRows || !hasSelection;
+    document.getElementById("removeAllPermissions").disabled = !hasRows;
+  },
+  
+  onPermissionDeleted: function ()
+  {
+    if (!this._view.rowCount)
+      return;
+    var removedPermissions = [];
+    gTreeUtils.deleteSelectedItems(this._tree, this._view, this._permissions, removedPermissions);
+    for (var i = 0; i < removedPermissions.length; ++i) {
+      var p = removedPermissions[i];
+      this._pm.remove(p.host, p.type);
+    }    
+    document.getElementById("removePermission").disabled = !this._permissions.length;
+    document.getElementById("removeAllPermissions").disabled = !this._permissions.length;
+  },
+  
+  onAllPermissionsDeleted: function ()
+  {
+    if (!this._view.rowCount)
+      return;
+    var removedPermissions = [];
+    gTreeUtils.deleteAll(this._tree, this._view, this._permissions, removedPermissions);
+    for (var i = 0; i < removedPermissions.length; ++i) {
+      var p = removedPermissions[i];
+      this._pm.remove(p.host, p.type);
+    }    
+    document.getElementById("removePermission").disabled = true;
+    document.getElementById("removeAllPermissions").disabled = true;
+  },
+  
+  onPermissionKeyPress: function (aEvent)
+  {
+    if (aEvent.keyCode == 46)
+      this.onPermissionDeleted();
+  },
+  
+  _lastPermissionSortColumn: "",
+  _lastPermissionSortAscending: false,
+  
+  onPermissionSort: function (aColumn)
+  {
+    this._lastPermissionSortAscending = gTreeUtils.sort(this._tree, 
+                                                        this._view, 
+                                                        this._permissions,
+                                                        aColumn, 
+                                                        this._lastPermissionSortColumn, 
+                                                        this._lastPermissionSortAscending);
+    this._lastPermissionSortColumn = aColumn;
+  },
+  
+  _loadPermissions: function ()
+  {
+    this._tree = document.getElementById("permissionsTree");
+    this._permissions = [];
+
+    // load permissions into a table
+    var count = 0;
+    var enumerator = this._pm.enumerator;
+    while (enumerator.hasMoreElements()) {
+      var nextPermission = enumerator.getNext().QueryInterface(Components.interfaces.nsIPermission);
+      this._addPermissionToList(nextPermission);
+    }
+   
+    this._view._rowCount = this._permissions.length;
+
+    // sort and display the table
+    this._tree.treeBoxObject.view = this._view;
+    this.onPermissionSort("rawHost", false);
+
+    // disable "remove all" button if there are none
+    document.getElementById("removeAllPermissions").disabled = this._permissions.length == 0;
+  },
+  
+  _addPermissionToList: function (aPermission)
+  {
+    if (aPermission.type == this._type) {
+      var host = aPermission.host;
+      var capabilityString = this._getCapabilityString(aPermission);
+      var p = new Permission(host,
+                             (host.charAt(0) == ".") ? host.substring(1,host.length) : host,
+                             aPermission.type,
+                             capabilityString, 
+                             aPermission.capability);
+      this._permissions.push(p);
+    }  
+  },
+  
+  setHost: function (aHost)
+  {
+    document.getElementById("url").value = aHost;
+  }
+};
+
+function setHost(aHost)
+{
+  gPermissionManager.setHost(aHost);
+}
+
+function initWithParams(aParams)
+{
+  gPermissionManager.init(aParams);
+}
+
Index: browser/components/preferences/permissions.xul
===================================================================
RCS file: browser/components/preferences/permissions.xul
diff -N browser/components/preferences/permissions.xul
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ browser/components/preferences/permissions.xul	21 Feb 2005 11:21:06 -0000
@@ -0,0 +1,109 @@
+<?xml version="1.0"?>
+
+# -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+# 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.org code.
+# 
+# The Initial Developer of the Original Code is Blake Ross.
+# Portions created by the Initial Developer are Copyright (C) 2003
+# the Initial Developer. All Rights Reserved.
+# 
+# Contributor(s):
+#   Blake Ross <firefox@blakeross.com>
+#   Ben Goodger <ben@mozilla.org>
+# 
+# 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 *****
+
+<?xml-stylesheet href="chrome://global/skin/" type="text/css"?> 
+<?xml-stylesheet href="chrome://browser/skin/preferences/preferences.css" type="text/css"?> 
+
+<!DOCTYPE dialog SYSTEM "chrome://browser/locale/preferences/permissions.dtd" >
+
+<window id="PermissionsDialog" class="windowDialog"
+        windowtype="Browser:Permissions"
+        title="&window.title;"
+        xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+        style="width: 36em;"
+        onload="gPermissionManager.onLoad();"
+        onunload="gPermissionManager.uninit();"
+        persist="screenX screenY width height">
+
+  <script src="chrome://browser/content/preferences/permissionsutils.js"/>
+  <script src="chrome://browser/content/preferences/permissions.js"/>
+
+  <stringbundle id="bundlePreferences"
+                src="chrome://browser/locale/preferences/preferences.properties"/>
+
+  <keyset>
+    <key key="&windowClose.key;" modifiers="accel" oncommand="window.close();"/>
+  </keyset>
+  
+  <vbox class="contentPane" flex="1">
+    <description id="permissionsText"/>
+    <separator class="thin"/>
+    <label value="&address.label;"/>
+    <hbox align="start">
+      <textbox id="url" flex="1" 
+               oninput="gPermissionManager.onHostInput(event.target);"
+               onkeypress="gPermissionManager.onHostKeyPress(event);"/>
+    </hbox>+    <hbox pack="end">      <button id="btnBlock" disabled="true" label="&block.label;" 
+              oncommand="gPermissionManager.addPermission(nsIPermissionManager.DENY_ACTION);"/>
+      <button id="btnSession" disabled="true" label="&session.label;" 
+              oncommand="gPermissionManager.addPermission(nsICookiePermission.ACCESS_SESSION);"/>
+      <button id="btnAllow" disabled="true" label="&allow.label;" default="true"
+              oncommand="gPermissionManager.addPermission(nsIPermissionManager.ALLOW_ACTION);"/>
+    </hbox>
+    <separator class="thin"/>
+    <tree id="permissionsTree" flex="1" style="height: 18em;"
+          hidecolumnpicker="true"
+          onkeypress="gPermissionManager.onPermissionKeyPress(event)"
+          onselect="gPermissionManager.onPermissionSelected();">
+      <treecols>
+        <treecol id="siteCol" label="&treehead.sitename.label;" flex="3"
+                onclick="gPermissionManager.onPermissionSort('rawHost');" persist="width"/>
+        <splitter class="tree-splitter"/>
+        <treecol id="statusCol" label="&treehead.status.label;" flex="1"
+                onclick="gPermissionManager.onPermissionSort('capability');" persist="width"/>
+      </treecols>
+      <treechildren/>
+    </tree>
+  </vbox>
+  <hbox align="end">
+    <hbox class="actionButtons" flex="1">
+      <button id="removePermission" disabled="true" label="&removepermission.label;" 
+              oncommand="gPermissionManager.onPermissionDeleted();"/>
+      <button id="removeAllPermissions" label="&removeallpermissions.label;" 
+              oncommand="gPermissionManager.onAllPermissionsDeleted();"/>
+      <spacer flex="1"/>
+#ifndef XP_MACOSX
+      <button oncommand="close();"
+              label="&button.close.label;" accesskey="&button.close.accesskey;"/>
+#endif
+    </hbox>
+    <resizer dir="bottomright"/>
+  </hbox>
+</window>
Index: browser/components/preferences/permissionsutils.js
===================================================================
RCS file: browser/components/preferences/permissionsutils.js
diff -N browser/components/preferences/permissionsutils.js
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ browser/components/preferences/permissionsutils.js	21 Feb 2005 11:21:06 -0000
@@ -0,0 +1,100 @@
+# -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+# 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 the Firefox Preferences System.
+# 
+# The Initial Developer of the Original Code is Ben Goodger.
+# Portions created by the Initial Developer are Copyright (C) 2005
+# the Initial Developer. All Rights Reserved.
+# 
+# Contributor(s):
+#   Ben Goodger <ben@mozilla.org>
+# 
+# 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 gTreeUtils = {
+  deleteAll: function (aTree, aView, aItems, aDeletedItems)
+  {
+    for (var i = 0; i < aItems.length; ++i)
+      aDeletedItems.push(aItems[i]);
+    aItems = [];
+    var oldCount = aView.rowCount;
+    aView._rowCount = 0;
+    aTree.treeBoxObject.rowCountChanged(0, -oldCount);
+  },
+  
+  deleteSelectedItems: function (aTree, aView, aItems, aDeletedItems)
+  {
+    var selection = aTree.view.selection;
+    selection.selectEventsSuppressed = true;
+    
+    var rc = selection.getRangeCount();
+    for (var i = 0; i < rc; ++i) {
+      var min = { }; var max = { };
+      selection.getRangeAt(i, min, max);
+      for (var j = min.value; j <= max.value; ++j) {
+        aDeletedItems.push(aItems[j]);
+        aItems[j] = null;
+      }
+    }
+    
+    var nextSelection = 0;
+    for (i = 0; i < aItems.length; ++i) {
+      if (!aItems[i]) {
+        var j = i;
+        while (j < aItems.length && !aItems[j])
+          ++j;
+        aItems.splice(i, j - i);
+        nextSelection = j < aView.rowCount ? j - 1 : j - 2;
+        aView._rowCount -= j - i;
+        aTree.treeBoxObject.rowCountChanged(i, i - j);
+      }
+    }
+
+    if (aItems.length) {
+      selection.select(nextSelection);
+      aTree.treeBoxObject.ensureRowIsVisible(nextSelection);
+      aTree.focus();
+    }
+    selection.selectEventsSuppressed = false;
+  },
+  
+  sort: function (aTree, aView, aDataSet, aColumn, 
+                  aLastSortColumn, aLastSortAscending) 
+  {
+    var ascending = (aColumn == aLastSortColumn) ? !aLastSortAscending : true;
+    aDataSet.sort(function (a, b) { return a[aColumn].toLowerCase().localeCompare(b[aColumn].toLowerCase()); });
+    if (!ascending)
+      aDataSet.reverse();
+    
+    aTree.view.selection.select(-1);
+    aTree.view.selection.select(0);
+    aTree.treeBoxObject.invalidate();
+    aTree.treeBoxObject.ensureRowIsVisible(0);
+    
+    return ascending;
+  },
+};
+
Index: browser/components/preferences/preferences.css
===================================================================
RCS file: browser/components/preferences/preferences.css
diff -N browser/components/preferences/preferences.css
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ browser/components/preferences/preferences.css	21 Feb 2005 11:21:06 -0000
@@ -0,0 +1,5 @@
+
+filefield {
+  -moz-binding: url("chrome://browser/content/preferences/preferences.xml#fileField");
+}
+
Index: browser/components/preferences/preferences.xml
===================================================================
RCS file: browser/components/preferences/preferences.xml
diff -N browser/components/preferences/preferences.xml
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ browser/components/preferences/preferences.xml	21 Feb 2005 11:21:06 -0000
@@ -0,0 +1,81 @@
+<?xml version="1.0"?>
+
+<bindings id="PreferencesSkinBindings"
+          xmlns="http://www.mozilla.org/xbl"
+          xmlns:xbl="http://www.mozilla.org/xbl"
+          xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+
+  <binding id="fileField">
+    <content>
+      <xul:stringbundle anonid="bundle" src="chrome://browser/locale/preferences/preferences.properties"/>
+      <xul:hbox class="fileFieldContentBox" align="center" flex="1">
+        <xul:image class="fileFieldIcon" xbl:inherits="src=image"/>
+        <xul:textbox class="fileFieldLabel" xbl:inherits="value=label,disabled" flex="1" readonly="true"/>
+      </xul:hbox>
+    </content>
+    <implementation>
+      <property name="image" onget="return this.getAttribute('image');"
+                             onset="this.setAttribute('image', val); return val;"/>
+      <property name="label" onget="return this.getAttribute('label');">
+        <setter>
+          this.setAttribute('label', val); 
+          var elt = document.getAnonymousElementByAttribute(this, "class", "fileFieldLabel");
+          return (elt.value = val);
+        </setter>
+      </property>
+      
+      <field name="_file">null</field>
+      <property name="file"  onget="return this._file">
+        <setter>
+        <![CDATA[
+          this._file = val; 
+          if (val) {
+            this.image = this._getIconURLForFile(val);
+            this.label = this._getDisplayNameForFile(val);
+          }
+          else {
+            this.removeAttribute("image");
+            var bundle = document.getAnonymousElementByAttribute(this, "anonid", "bundle");
+            this.label = bundle.getString("downloadHelperNoneSelected");
+          }            
+          return val;
+        ]]>
+        </setter>
+      </property>      
+      <property name="disabled" onget="return this.getAttribute('disabled');"
+                                onset="this.setAttribute('disabled', val); return val;"/>
+      
+      <method name="_getDisplayNameForFile">
+        <parameter name="aFile"/>
+        <body>
+        <![CDATA[
+#ifdef XP_WIN
+          var lfw = aFile.QueryInterface(Components.interfaces.nsILocalFileWin);
+          return lfw.getVersionInfoField("FileDescription"); 
+#else
+          // XXXben - Read the bundle name on OS X.
+          var ios = Components.classes["@mozilla.org/network/io-service;1"]
+                              .getService(Components.interfaces.nsIIOService);
+          var url = ios.newFileURI(aFile).QueryInterface(Components.interfaces.nsIURL);
+          return url.fileName;
+#endif
+        ]]>
+        </body>
+      </method>
+      
+      <method name="_getIconURLForFile">
+        <parameter name="aFile"/>
+        <body>
+        <![CDATA[
+          var ios = Components.classes["@mozilla.org/network/io-service;1"]
+                              .getService(Components.interfaces.nsIIOService);
+          var fph = ios.getProtocolHandler("file")
+                       .QueryInterface(Components.interfaces.nsIFileProtocolHandler);
+          var urlspec = fph.getURLSpecFromFile(aFile);
+          return "moz-icon://" + urlspec + "?size=16";  
+        ]]>
+        </body>
+      </method>
+    </implementation>
+  </binding>
+</bindings>
Index: browser/components/preferences/preferences.xul
===================================================================
RCS file: browser/components/preferences/preferences.xul
diff -N browser/components/preferences/preferences.xul
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ browser/components/preferences/preferences.xul	21 Feb 2005 11:21:06 -0000
@@ -0,0 +1,90 @@
+<?xml version="1.0"?>
+
+# -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+# 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 the Firefox Preferences System. 
+# 
+# The Initial Developer of the Original Code is Ben Goodger.
+# Portions created by the Initial Developer are Copyright (C) 2005
+# the Initial Developer. All Rights Reserved.
+# 
+# Contributor(s):
+#   Ben Goodger <ben@mozilla.org>
+# 
+# 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 *****
+
+<?xml-stylesheet href="chrome://global/skin/global.css"?>
+<?xml-stylesheet href="chrome://browser/content/preferences/preferences.css"?>
+<?xml-stylesheet href="chrome://browser/skin/preferences/preferences.css"?>
+
+<!DOCTYPE prefwindow [
+<!ENTITY % brandDTD SYSTEM "chrome://global/locale/brand.dtd">
+<!ENTITY % preferencesDTD SYSTEM "chrome://browser/locale/preferences/preferences.dtd">
+%brandDTD;
+%preferencesDTD;
+]>
+
+<prefwindow type="prefwindow"
+            id="BrowserPreferences"
+            windowtype="Browser:Preferences"
+#ifdef XP_WIN
+            title="&prefWindow.titleWin;"
+#else
+#ifdef XP_UNIX
+#ifndef XP_MACOSX
+            title="&prefWindow.titleGNOME;"
+#endif
+#endif
+#endif
+            xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+#ifdef XP_WIN
+            style="&prefWindow.styleWin;">
+#else
+#ifdef XP_MACOSX
+            style="&prefWindow.styleMac;">
+#else
+            style="&prefWindow.styleUnix;">
+#endif
+#endif
+  
+    <stringbundle id="bundlePreferences"
+                  src="chrome://browser/locale/preferences/preferences.properties"/>
+
+    <prefpane id="paneGeneral" label="&paneGeneral.title;"
+              src="chrome://browser/content/preferences/general.xul"/>
+    <prefpane id="panePrivacy" label="&panePrivacy.title;"
+              src="chrome://browser/content/preferences/privacy.xul"/>
+    <prefpane id="paneContent" label="&paneContent.title;"
+              src="chrome://browser/content/preferences/content.xul"/>
+    <prefpane id="paneTabs" label="&paneTabs.title;"
+              src="chrome://browser/content/preferences/tabs.xul"/>
+    <prefpane id="paneDownloads" label="&paneDownloads.title;"
+              src="chrome://browser/content/preferences/downloads.xul"/>
+    <prefpane id="paneAdvanced" label="&paneAdvanced.title;"
+              src="chrome://browser/content/preferences/advanced.xul"/>
+
+</prefwindow>
+
Index: browser/components/preferences/privacy.js
===================================================================
RCS file: browser/components/preferences/privacy.js
diff -N browser/components/preferences/privacy.js
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ browser/components/preferences/privacy.js	21 Feb 2005 11:21:06 -0000
@@ -0,0 +1,216 @@
+# -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+# 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 the Firefox Preferences System.
+# 
+# The Initial Developer of the Original Code is Ben Goodger.
+# Portions created by the Initial Developer are Copyright (C) 2005
+# the Initial Developer. All Rights Reserved.
+# 
+# Contributor(s):
+#   Ben Goodger <ben@mozilla.org>
+# 
+# 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 gPrivacyPane = {
+  _inited: false,
+  tabSelectionChanged: function (event)
+  {
+    if (event.target.localName != "tabpanels" || !this._inited)
+      return;
+    var privacyPrefs = document.getElementById("privacyPrefs");
+    var preference = document.getElementById("browser.preferences.privacy.selectedTabIndex");
+    preference.valueFromPreferences = privacyPrefs.selectedIndex;
+  },
+  
+  _sanitizer: null,
+  init: function ()
+  {
+    this._inited = true;
+    var privacyPrefs = document.getElementById("privacyPrefs");
+    var preference = document.getElementById("browser.preferences.privacy.selectedTabIndex");
+    if (preference.value !== null)
+      privacyPrefs.selectedIndex = preference.value;
+    
+    // Update the clear buttons
+    if (!this._sanitizer)
+      this._sanitizer = new Sanitizer();
+    this._updateClearButtons();
+    
+    window.addEventListener("unload", this.uninit, false);
+    
+    // Update the MP buttons
+    this.updateMasterPasswordButton();
+  },
+  
+  uninit: function ()
+  {
+    if (this._updateInterval != -1)
+      clearInterval(this._updateInterval);
+  },
+  
+  _updateInterval: -1,
+  _updateClearButtons: function ()
+  {
+    var buttons = document.getElementsByAttribute("item", "*");
+    var buttonCount = buttons.length;
+    for (var i = 0; i < buttonCount; ++i)
+      buttons[i].disabled = !this._sanitizer.canClearItem(buttons[i].getAttribute("item"));
+  },
+
+#if 0
+  onItemSelect: function ()
+  {
+    var itemList = document.getElementById("itemList");
+    var itemPreferences = document.getElementById("itemPreferences");
+    itemPreferences.setAttribute("selectedIndex", itemList.selectedIndex);
+    itemList.setAttribute("lastSelected", itemList.selectedIndex);
+    document.persist("itemList", "lastSelected");
+  },
+#endif
+  showSanitizeSettings: function ()
+  {
+    document.documentElement.openSubDialog("chrome://browser/content/preferences/sanitize.xul",
+                                           "", null);
+  },
+
+  _enableRestrictedWasChecked: false,
+  writeEnableCookiesPref: function ()
+  { 
+    var enableCookies = document.getElementById("enableCookies");
+    if (enableCookies.checked) {
+      var enableRestricted = document.getElementById("enableCookiesForOriginating");
+      this._enableRestrictedWasChecked = enableRestricted.checked;
+      return this._enableRestrictedWasChecked ? 1 : 0;
+    }
+    return 2;
+  },
+
+  readEnableCookiesPref: function ()
+  {
+    var pref = document.getElementById("network.cookie.cookieBehavior");
+    var enableRestricted = document.getElementById("enableCookiesForOriginating");    
+    enableRestricted.disabled = pref.value == 2;
+    this.enableCookiesChanged();
+    return (pref.value == 0 || pref.value == 1);
+  },
+  
+  readEnableRestrictedPref: function ()
+  {
+    var pref = document.getElementById("network.cookie.cookieBehavior");
+    return pref.value != 2 ? pref.value : this._enableRestrictedWasChecked;
+  },
+
+  enableCookiesChanged: function ()
+  {
+    var preference = document.getElementById("network.cookie.cookieBehavior");
+    var blockFutureCookies = document.getElementById("network.cookie.blockFutureCookies");
+    blockFutureCookies.disabled = preference.value == 2;
+    var lifetimePref = document.getElementById("network.cookie.lifetimePolicy");
+    lifetimePref.disabled = preference.value == 2;
+  },
+  
+  readCacheSizePref: function ()
+  {
+    var preference = document.getElementById("browser.cache.disk.capacity");
+    return preference.value / 1000;
+  },
+  
+  writeCacheSizePref: function ()
+  {
+    var cacheSize = document.getElementById("cacheSize");
+    return cacheSize * 1000;
+  },
+  
+  _sanitizer: null,
+  clear: function (aButton) 
+  {
+    var category = aButton.getAttribute("item");
+    this._sanitizer.clearItem(category);
+    aButton.disabled = !this._sanitizer.canClearItem(category);
+    if (this._updateInterval == -1)
+      this._updateInterval = setInterval("gPrivacyPane._updateClearButtons()", 10000);
+  },
+  
+  viewCookies: function (aCategory) 
+  {
+    document.documentElement.openWindow("Browser:Cookies",
+                                        "chrome://browser/content/preferences/cookies.xul",
+                                        "", null);
+  },
+  viewDownloads: function (aCategory) 
+  {
+    document.documentElement.openWindow("Download:Manager", 
+                                        "chrome://mozapps/content/downloads/downloads.xul",
+                                        "", null);
+  },
+  viewPasswords: function (aCategory) 
+  {
+    document.documentElement.openWindow("Toolkit:PasswordManager",
+                                        "chrome://passwordmgr/content/passwordManager.xul",
+                                        "", "8");
+  },
+  
+  viewCookieExceptions: function ()
+  {
+    var bundlePreferences = document.getElementById("bundlePreferences");
+    var params = { blockVisible   : true, 
+                   sessionVisible : true, 
+                   allowVisible   : true, 
+                   prefilledHost  : "", 
+                   permissionType : "cookie",
+                   windowTitle    : bundlePreferences.getString("cookiepermissionstitle"),
+                   introText      : bundlePreferences.getString("cookiepermissionstext") };
+    document.documentElement.openWindow("Browser:Permissions",
+                                        "chrome://browser/content/preferences/permissions.xul",
+                                        "", params);
+  },
+  
+  changeMasterPassword: function ()
+  {
+    document.documentElement.openSubDialog("chrome://browser/content/pref/pref-masterpass.xul",
+                                           "", null);
+    this.updateMasterPasswordButton();
+  },
+  
+  updateMasterPasswordButton: function ()
+  {
+    // See if there's a master password and set the button label accordingly
+    var secmodDB = Components.classes["@mozilla.org/security/pkcs11moduledb;1"]
+                             .getService(Components.interfaces.nsIPKCS11ModuleDB);
+    var slot = secmodDB.findSlotByName("");
+    if (slot) {
+      const nsIPKCS11Slot = Components.interfaces.nsIPKCS11Slot;
+      var status = slot.status;
+      var noMP = status == nsIPKCS11Slot.SLOT_UNINITIALIZED || 
+                 status == nsIPKCS11Slot.SLOT_READY;
+
+      var bundle = document.getElementById("bundlePreferences");
+      var button = document.getElementById("setMasterPassword");
+      button.label = bundle.getString(noMP ? "setMasterPassword" : "changeMasterPassword");
+    }
+  },
+};
+
Index: browser/components/preferences/privacy.xul
===================================================================
RCS file: browser/components/preferences/privacy.xul
diff -N browser/components/preferences/privacy.xul
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ browser/components/preferences/privacy.xul	21 Feb 2005 11:21:07 -0000
@@ -0,0 +1,411 @@
+<?xml version="1.0"?>
+
+# -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+# 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 the Firefox Preferences System.
+# 
+# The Initial Developer of the Original Code is Ben Goodger.
+# Portions created by the Initial Developer are Copyright (C) 2005
+# the Initial Developer. All Rights Reserved.
+# 
+# Contributor(s):
+#   Ben Goodger <ben@mozilla.org>
+# 
+# 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 *****
+
+<!DOCTYPE overlay [
+<!ENTITY % brandDTD SYSTEM "chrome://global/locale/brand.dtd">
+<!ENTITY % privacyDTD SYSTEM "chrome://browser/locale/preferences/privacy.dtd">
+%brandDTD;
+%privacyDTD;
+]>
+
+<overlay id="PrivacyPaneOverlay"
+         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+
+  <prefpane id="panePrivacy" onpaneload="gPrivacyPane.init();">
+    <preferences id="privacyPreferences">
+      <preference id="browser.history_expire_days"        name="browser.history_expire_days"        type="int"/>
+      <preference id="browser.formfill.enable"            name="browser.formfill.enable"            type="bool"/>
+      <preference id="signon.rememberSignons"             name="signon.rememberSignons"             type="bool"/>
+      <preference id="browser.download.manager.retention" name="browser.download.manager.retention" type="int"/>
+      <preference id="network.cookie.cookieBehavior"      name="network.cookie.cookieBehavior"      type="int" onchange="gPrivacyPane.enableCookiesChanged();"/>
+      <preference id="network.cookie.blockFutureCookies"  name="network.cookie.blockFutureCookies"  type="bool"/>
+      <preference id="network.cookie.lifetimePolicy"      name="network.cookie.lifetimePolicy"      type="int"/>
+      <preference id="browser.cache.disk.capacity"        name="browser.cache.disk.capacity"        type="int"/>
+      <preference id="browser.preferences.privacy.selectedTabIndex"
+                  name="browser.preferences.privacy.selectedTabIndex"
+                  type="int"/>
+      <preference id="pref.privacy.disable_button.clear_history"
+                  name="pref.privacy.disable_button.clear_history"
+                  type="bool"/>
+      <preference id="pref.privacy.disable_button.clear_formdata"
+                  name="pref.privacy.disable_button.clear_formdata"
+                  type="bool"/>
+      <preference id="pref.privacy.disable_button.cookie_exceptions"
+                  name="pref.privacy.disable_button.cookie_exceptions"
+                  type="bool"/>
+      <preference id="pref.privacy.disable_button.view_cookies"
+                  name="pref.privacy.disable_button.view_cookies"
+                  type="bool"/>
+      <preference id="pref.privacy.disable_button.clear_cookies"
+                  name="pref.privacy.disable_button.clear_cookies"
+                  type="bool"/>
+      <preference id="pref.privacy.disable_button.clear_cache"
+                  name="pref.privacy.disable_button.clear_cache"
+                  type="bool"/>
+      <preference id="pref.privacy.disable_button.view_passwords"
+                  name="pref.privacy.disable_button.view_passwords"
+                  type="bool"/>
+      <preference id="pref.privacy.disable_button.set_master_password"
+                  name="pref.privacy.disable_button.set_master_password"
+                  type="bool"/>
+    </preferences>
+    
+    <stringbundle id="bundlePreferences" src="chrome://browser/locale/preferences/preferences.properties"/>
+    
+    <script type="application/x-javascript" src="chrome://browser/content/sanitize.js"/>
+    <script type="application/x-javascript" src="chrome://browser/content/preferences/privacy.js"/>
+
+    <description>&privacy.intro;</description>
+    <separator class="thin"/>
+    <tabbox id="privacyPrefs" flex="1"
+            onselect="gPrivacyPane.tabSelectionChanged(event);">
+      <tabs>
+        <tab label="&itemHistory.label;"/>
+        <tab label="&itemFormData.label;"/>
+        <tab label="&itemPasswords.label;"/>
+        <tab label="&itemDownloads.label;"/>
+        <tab label="&itemCookies.label;"/>
+        <tab label="&itemCache.label;"/>
+      </tabs>
+      <tabpanels flex="1">
+        <tabpanel orient="vertical">
+          <hbox align="center">
+            <label control="historyDays" accesskey="&rememberPages.accesskey;">&rememberPages.label;</label>
+            <textbox id="historyDays" size="2" preference="browser.history_expire_days"/>
+            <label>&rememberDays.label;</label>
+          </hbox>
+          <separator flex="1"/>
+          <hbox pack="end">
+            <button label="&clearHistory.label;" accesskey="&clearHistory.accesskey;"
+                    oncommand="gPrivacyPane.clear(this);" item="history"
+                    preference="pref.privacy.disable_button.clear_history"/>
+          </hbox>
+        </tabpanel>
+        <tabpanel orient="vertical">
+          <description>&savedFormData.intro;</description>
+          <vbox align="start">
+            <checkbox id="saveFormHistory" preference="browser.formfill.enable"
+                      label="&enableFormFill.label;" accesskey="&enableFormFill.accesskey;"/>
+          </vbox>
+          <separator flex="1"/>
+          <hbox pack="end">
+            <button label="&clearFormData.label;" accesskey="&clearFormData.accesskey;"
+                    oncommand="gPrivacyPane.clear(this);" item="formdata"
+                    preference="pref.privacy.disable_button.clear_formdata"/>
+          </hbox>
+        </tabpanel>
+        <tabpanel orient="vertical">
+          <description>&savedPasswords.intro;</description>
+          <hbox>
+            <checkbox id="savePasswords" 
+                      label="&enablePasswords.label;" accesskey="&enablePasswords.accesskey;"
+                      preference="signon.rememberSignons"/>
+          </hbox>
+          <separator/>
+          <hbox align="center">
+            <description flex="1">&masterPassword.intro;</description>
+            <!-- XXXben - check for keychain access use -->
+            <button id="setMasterPassword" 
+                    label="&setMasterPassword.label;" accesskey="&setMasterPassword.accesskey;"
+                    oncommand="gPrivacyPane.changeMasterPassword();"
+                    preference="pref.privacy.disable_button.set_master_password"/>
+          </hbox>
+          <separator flex="1"/>
+          <hbox>
+            <button label="&viewPasswords.label;" accesskey="&viewPasswords.accesskey;"
+                    oncommand="gPrivacyPane.viewPasswords();"
+                    preference="pref.privacy.disable_button.view_passwords"/>
+          </hbox>
+        </tabpanel>
+        <tabpanel orient="vertical">
+          <description>&downloadManager.intro;</description>
+          <separator class="thin"/>
+          <hbox align="center">
+            <label accesskey="&downloadsRetentionPolicy.accesskey;" 
+                   control="downloadsRetentionPolicy">&downloadsRetentionPolicy.label;</label> 
+            <menulist id="downloadsRetentionPolicy" 
+                      preference="browser.download.manager.retention">
+              <menupopup>
+                <menuitem value="0" label="&downloadsRemoveImmediately.label;"/>
+                <menuitem value="1" label="&downloadsRemoveExit.label;"/>
+                <menuitem value="2" label="&downloadsRemoveManually.label;"/>
+              </menupopup>
+            </menulist>
+          </hbox>
+          <separator flex="1"/>
+          <hbox>
+            <button label="&viewDownloads.label;" accesskey="&viewDownloads.accesskey;"
+                    oncommand="gPrivacyPane.viewDownloads();"/>
+            <spring flex="1"/>
+            <button label="&clearDownloads.label;" accesskey="&clearDownloads.accesskey;"
+                    oncommand="gPrivacyPane.clear(this);" item="downloads"/>
+          </hbox>
+        </tabpanel>
+        <tabpanel orient="vertical">
+          <!-- Cookies are considered a distinct "privacy" item because they are 
+              created without user interaction, unlike Software Installation, 
+              Popup and Image whitelists -->
+          <vbox>
+            <description>&cookies.intro;</description>
+            <hbox>
+              <checkbox id="enableCookies" preference="network.cookie.cookieBehavior"
+                        label="&enableCookies.label;" accesskey="&enableCookies.accesskey;"
+                        onpreferenceread="return gPrivacyPane.readEnableCookiesPref();"
+                        onpreferencewrite="return gPrivacyPane.writeEnableCookiesPref();"/>
+              <button id="cookieExceptions" oncommand="gPrivacyPane.viewCookieExceptions();"
+                      label="&exceptions.label;" accesskey="&cookieExceptions.accesskey;"
+                      preference="pref.privacy.disable_button.cookie_exceptions"/>
+            </hbox>
+            <vbox align="start">
+              <checkbox id="enableCookiesForOriginating" class="indent"
+                        label="&enableCookiesForOriginating.label;"
+                        accesskey="&enableCookiesForOriginating.accesskey;"
+                        preference="network.cookie.cookieBehavior"
+                        onpreferenceread="return gPrivacyPane.readEnableRestrictedPref();"
+                        onpreferencewrite="return gPrivacyPane.writeEnableCookiesPref();"/>
+              <checkbox id="enableCookiesNotRemoved" class="indent"
+                        label="&enableCookiesNotRemoved.label;"
+                        accesskey="&enableCookiesNotRemoved.accesskey;"
+                        preference="network.cookie.blockFutureCookies"/>
+              <separator class="thin"/>
+              <hbox align="center" class="indent">
+                <label control="networkCookieLifetime" 
+                       accesskey="&keepCookies.accesskey;">&keepCookies.label;</label>
+                <menulist id="networkCookieLifetime" 
+                          preference="network.cookie.lifetimePolicy">
+                  <menupopup>
+                    <menuitem value="0" label="&acceptNormally.label;"/>
+                    <menuitem value="2" label="&acceptForSession.label;"/>
+                    <menuitem value="1" label="&askAboutCookies.label;"/>
+                  </menupopup>
+                </menulist>
+              </hbox>
+            </vbox>
+          </vbox>
+          <separator flex="1"/>
+          <separator/>
+          <hbox>
+            <button label="&viewCookies.label;" accesskey="&viewCookies.accesskey;"
+                    oncommand="gPrivacyPane.viewCookies();"
+                    preference="pref.privacy.disable_button.view_cookies"/>
+            <spring flex="1"/>
+            <button label="&clearCookies.label;" accesskey="&clearCookies.accesskey;"
+                    oncommand="gPrivacyPane.clear(this);" item="cookies"
+                    preference="pref.privacy.disable_button.clear_cookies"/>
+          </hbox>
+        </tabpanel>
+        <tabpanel orient="vertical">
+          <description>&cache.intro;</description>
+          <hbox align="center">
+            <label accesskey="&cacheUseUpTo.accesskey;" control="cacheSize">&cacheUseUpTo.label;</label>
+            <textbox id="cacheSize" size="2" preference="browser.cache.disk.capacity"
+                     onpreferenceread="return gPrivacyPane.readCacheSizePref();"
+                     onpreferencewrite="return gPrivacyPane.writeCacheSizePref();"/>
+            <label>&cacheSize.label;</label>
+          </hbox>
+          <separator flex="1"/>
+          <hbox pack="end">
+            <button label="&clearCache.label;" accesskey="&clearCache.accesskey;"
+                    oncommand="gPrivacyPane.clear(this);" item="cache"
+                    preference="pref.privacy.disable_button.clear_cache"/>
+          </hbox>
+        </tabpanel>
+      </tabpanels>
+    </tabbox>    
+#if 0
+    <hbox>
+      <listbox id="itemList" seltype="single"
+               onselect="gPrivacyPane.onItemSelect();"
+               style="width: 10em;">
+        <listitem label="&itemHistory.label;"/>
+        <listitem label="&itemFormData.label;"/>
+        <listitem label="&itemPasswords.label;"/>
+        <listitem label="&itemDownloads.label;"/>
+        <listitem label="&itemCookies.label;"/>
+        <listitem label="&itemCache.label;"/>
+      </listbox>
+      <deck id="itemPreferences" flex="1">
+        <groupbox orient="vertical" flex="1">
+          <caption label="&itemHistory.label;"/>
+          <hbox align="center">
+            <label control="historyDays" accesskey="&rememberPages.accesskey;">&rememberPages.label;</label>
+            <textbox id="historyDays" size="2" preference="browser.history_expire_days"/>
+            <label>&rememberDays.label;</label>
+          </hbox>
+          <separator flex="1"/>
+          <hbox pack="end">
+            <button label="&clearHistory.label;" accesskey="&clearHistory.accesskey;"
+                    oncommand="gPrivacyPane.clear(this);" item="history"/>
+          </hbox>
+        </groupbox>
+        <groupbox orient="vertical" flex="1">
+          <caption label="&itemFormData.label;"/>
+          <description>&savedFormData.intro;</description>
+          <vbox align="start">
+            <checkbox id="saveFormHistory" preference="browser.formfill.enable"
+                      label="&enableFormFill.label;" accesskey="&enableFormFill.accesskey;"/>
+          </vbox>
+          <separator flex="1"/>
+          <hbox pack="end">
+            <button label="&clearFormData.label;" accesskey="&clearFormData.accesskey;"
+                    oncommand="gPrivacyPane.clear(this);" item="formdata"/>
+          </hbox>
+        </groupbox>
+        <groupbox orient="vertical" flex="1">
+          <caption label="&itemPasswords.label;"/>
+          <description>&savedPasswords.intro;</description>
+          <hbox align="center">
+            <checkbox id="savePasswords" 
+                      label="&enablePasswords.label;" accesskey="&enablePasswords.accesskey;"
+                      preference="signon.rememberSignons" flex="1"/>
+            <!-- XXXben - check for keychain access use -->
+            <button id="setMasterPassword" 
+                    label="&setMasterPassword.label;" accesskey="&setMasterPassword.accesskey;"
+                    oncommand="gPrivacyPane.changeMasterPassword();"/>
+          </hbox>
+          <separator flex="1"/>
+          <hbox>
+            <button label="&viewPasswords.label;" accesskey="&viewPasswords.accesskey;"
+                    oncommand="gPrivacyPane.viewPasswords();"/>
+          </hbox>
+        </groupbox>
+        <groupbox orient="vertical" flex="1">
+          <caption label="&itemDownloads.label;"/>
+          <description>&downloadManager.intro;</description>
+          <label accesskey="&downloadsRetentionPolicy.accesskey;" 
+                 control="downloadsRetentionPolicy">&downloadsRetentionPolicy.label;</label> 
+          <hbox>
+            <menulist id="downloadsRetentionPolicy" 
+                      preference="browser.download.manager.retention">
+              <menupopup>
+                <menuitem value="0" label="&downloadsRemoveImmediately.label;"/>
+                <menuitem value="1" label="&downloadsRemoveExit.label;"/>
+                <menuitem value="2" label="&downloadsRemoveManually.label;"/>
+              </menupopup>
+            </menulist>
+          </hbox>
+          <separator flex="1"/>
+          <hbox>
+            <button label="&viewDownloads.label;" accesskey="&viewDownloads.accesskey;"
+                    oncommand="gPrivacyPane.viewDownloads();"/>
+            <spring flex="1"/>
+            <button label="&clearDownloads.label;" accesskey="&clearDownloads.accesskey;"
+                    oncommand="gPrivacyPane.clear(this);" item="downloads"/>
+          </hbox>
+        </groupbox>
+        <groupbox orient="vertical" flex="1">
+          <!-- Cookies are considered a distinct "privacy" item because they are 
+              created without user interaction, unlike Software Installation, 
+              Popup and Image whitelists -->
+          <caption label="&itemCookies.label;"/>
+          <vbox>
+            <description>&cookies.intro;</description>
+            <hbox>
+              <checkbox id="enableCookies" preference="network.cookie.cookieBehavior"
+                        label="&enableCookies.label;" accesskey="&enableCookies.accesskey;"
+                        onpreferenceread="return gPrivacyPane.readEnableCookiesPref();"
+                        onpreferencewrite="return gPrivacyPane.writeEnableCookiesPref();"/>
+              <spring flex="1"/>
+              <button id="cookieExceptions" oncommand="gPrivacyPane.viewCookieExceptions();"
+                      label="&exceptions.label;" accesskey="&cookieExceptions.accesskey;"/>
+            </hbox>
+            <vbox align="start">
+              <checkbox id="enableCookiesForOriginating" class="indent"
+                        label="&enableCookiesForOriginating.label;"
+                        accesskey="&enableCookiesForOriginating.accesskey;"
+                        preference="network.cookie.cookieBehavior"
+                        onpreferenceread="return gPrivacyPane.readEnableRestrictedPref();"
+                        onpreferencewrite="return gPrivacyPane.writeEnableCookiesPref();"/>
+              <checkbox id="enableCookiesNotRemoved" class="indent"
+                        label="&enableCookiesNotRemoved.label;"
+                        accesskey="&enableCookiesNotRemoved.accesskey;"
+                        preference="network.cookie.blockFutureCookies"/>
+              <separator class="thin"/>
+              <hbox align="center" class="indent">
+                <label control="networkCookieLifetime" 
+                       accesskey="&keepCookies.accesskey;">&keepCookies.label;</label>
+                <menulist id="networkCookieLifetime" 
+                          preference="network.cookie.lifetimePolicy">
+                  <menupopup>
+                    <menuitem value="0" label="&acceptNormally.label;"/>
+                    <menuitem value="2" label="&acceptForSession.label;"/>
+                    <menuitem value="1" label="&askAboutCookies.label;"/>
+                  </menupopup>
+                </menulist>
+              </hbox>
+            </vbox>
+          </vbox>
+          <separator flex="1"/>
+          <separator/>
+          <hbox>
+            <button label="&viewCookies.label;" accesskey="&viewCookies.accesskey;"
+                    oncommand="gPrivacyPane.viewCookies();"/>
+            <spring flex="1"/>
+            <button label="&clearCookies.label;" accesskey="&clearCookies.accesskey;"
+                    oncommand="gPrivacyPane.clear(this);" item="cookies"/>
+          </hbox>
+        </groupbox>
+        <groupbox orient="vertical" flex="1">
+          <caption label="&itemCache.label;"/>
+          <description>&cache.intro;</description>
+          <hbox align="center">
+            <label accesskey="&cacheUseUpTo.accesskey;" control="cacheSize">&cacheUseUpTo.label;</label>
+            <textbox id="cacheSize" size="2" preference="browser.cache.disk.capacity"
+                     onpreferenceread="return gPrivacyPane.readCacheSizePref();"
+                     onpreferencewrite="return gPrivacyPane.writeCacheSizePref();"/>
+            <label>&cacheSize.label;</label>
+          </hbox>
+          <separator flex="1"/>
+          <hbox pack="end">
+            <button label="&clearCache.label;" accesskey="&clearCache.accesskey;"
+                    oncommand="gPrivacyPane.clear(this);" item="cache"/>
+          </hbox>
+        </groupbox>
+      </deck>
+    </hbox>
+#endif
+    <separator class="thin"/>
+    <hbox align="center">
+      <button label="&sanitizeSettings.label;" accesskey="&sanitizeSettings.accesskey;"
+              oncommand="gPrivacyPane.showSanitizeSettings();"/>
+      <description flex="1">&sanitize.intro;</description>
+    </hbox>
+    <separator/>
+  </prefpane>
+
+</overlay>
Index: browser/components/preferences/sanitize.js
===================================================================
RCS file: browser/components/preferences/sanitize.js
diff -N browser/components/preferences/sanitize.js
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ browser/components/preferences/sanitize.js	21 Feb 2005 11:21:07 -0000
@@ -0,0 +1,54 @@
+# -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+# 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 the Firefox Preferences System.
+# 
+# The Initial Developer of the Original Code is Ben Goodger.
+# Portions created by the Initial Developer are Copyright (C) 2005
+# the Initial Developer. All Rights Reserved.
+# 
+# Contributor(s):
+#   Ben Goodger <ben@mozilla.org>
+# 
+# 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 gSanitizeDialog = {
+  sanitizePasswords: function ()
+  {
+    var preference = document.getElementById("privacy.item.passwords");
+    var promptPref = document.getElementById("privacy.sanitize.promptOnSanitize");
+    if (preference.value)
+      promptPref.value = true;
+    promptPref.disabled = preference.value;
+    return undefined;
+  },
+  
+  onReadSanitizePasswords: function ()
+  {
+    this.sanitizePasswords();
+    return undefined;
+  },
+};
+
Index: browser/components/preferences/sanitize.xul
===================================================================
RCS file: browser/components/preferences/sanitize.xul
diff -N browser/components/preferences/sanitize.xul
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ browser/components/preferences/sanitize.xul	21 Feb 2005 11:21:07 -0000
@@ -0,0 +1,90 @@
+<?xml version="1.0"?>
+
+# -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+# 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 the Firefox Preferences System.
+# 
+# The Initial Developer of the Original Code is Ben Goodger.
+# Portions created by the Initial Developer are Copyright (C) 2005
+# the Initial Developer. All Rights Reserved.
+# 
+# Contributor(s):
+#   Ben Goodger <ben@mozilla.org>
+# 
+# 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 *****
+
+<?xml-stylesheet href="chrome://global/skin/"?>
+
+<!DOCTYPE dialog [
+  <!ENTITY % brandDTD SYSTEM "chrome://global/locale/brand.dtd">
+  <!ENTITY % sanitizeDTD SYSTEM "chrome://browser/locale/preferences/sanitize.dtd">
+  %brandDTD;
+  %sanitizeDTD;
+]>
+
+<prefwindow id="SanitizeDialog" type="child"
+            xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+            dlgbuttons="accept,cancel"
+            title="&sanitizeDialog.title;"
+            style="width: 30em !important;">
+
+  <prefpane id="SanitizeDialogPane">  
+    <script type="application/x-javascript" src="chrome://browser/content/preferences/sanitize.js"/>
+
+    <preferences>
+      <preference id="privacy.item.history"               name="privacy.item.history"               type="bool"/>
+      <preference id="privacy.item.formdata"              name="privacy.item.formdata"              type="bool"/>
+      <preference id="privacy.item.passwords"             name="privacy.item.passwords"             type="bool" onchange="gSanitizeDialog.sanitizePasswords();"/>
+      <preference id="privacy.item.downloads"             name="privacy.item.downloads"             type="bool"/>
+      <preference id="privacy.item.cookies"               name="privacy.item.cookies"               type="bool"/>
+      <preference id="privacy.item.cache"                 name="privacy.item.cache"                 type="bool"/>
+
+      <preference id="privacy.sanitize.sanitizeOnShutdown" name="privacy.sanitize.sanitizeOnShutdown" type="bool"/>
+      <preference id="privacy.sanitize.promptOnSanitize"   name="privacy.sanitize.promptOnSanitize"   type="bool"/>
+    </preferences>
+
+    <groupbox orient="vertical" align="start">
+      <caption label="&items.label;"/>
+      
+      <label>&sanitizeItems.label;</label>
+      <checkbox label="&itemHistory.label;"   preference="privacy.item.history"/>
+      <checkbox label="&itemFormData.label;"  preference="privacy.item.formdata"/>
+      <checkbox label="&itemPasswords.label;" preference="privacy.item.passwords"
+                onpreferenceread="return gSanitizeDialog.onReadSanitizePasswords();"/>
+      <checkbox label="&itemDownloads.label;" preference="privacy.item.downloads"/>
+      <checkbox label="&itemCookies.label;"   preference="privacy.item.cookies"/>
+      <checkbox label="&itemCache.label;"     preference="privacy.item.cache"/>
+    </groupbox>
+    
+    <groupbox orient="vertical" align="start">
+      <caption label="&settings.label;"/>
+      <checkbox label="&sanitizeOnShutDown.label;"
+                preference="privacy.sanitize.sanitizeOnShutdown"/>
+      <checkbox id="promptOnSanitize" label="&promptOnSanitize.label;"
+                preference="privacy.sanitize.promptOnSanitize"/>
+    </groupbox>
+  </prefpane>
+</prefwindow>
Index: browser/components/preferences/tabs.js
===================================================================
RCS file: browser/components/preferences/tabs.js
diff -N browser/components/preferences/tabs.js
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ browser/components/preferences/tabs.js	21 Feb 2005 11:21:07 -0000
@@ -0,0 +1,71 @@
+# -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+# 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 the Firefox Preferences System.
+# 
+# The Initial Developer of the Original Code is Ben Goodger.
+# Portions created by the Initial Developer are Copyright (C) 2005
+# the Initial Developer. All Rights Reserved.
+# 
+# Contributor(s):
+#   Ben Goodger <ben@mozilla.org>
+# 
+# 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 gTabsPane = {
+  _lastForceLinksMode: 3,
+  writeWindowLinksBehavior: function ()
+  {
+    var tabbedOpenForce = document.getElementById("tabbedOpenForce");
+    if (!tabbedOpenForce.checked) 
+      return 2;
+    
+    var tabbedWindowLinks = document.getElementById("tabbedWindowLinks");
+    this._lastForceLinksMode = parseInt(tabbedWindowLinks.value)
+    return this._lastForceLinksMode;
+  },
+  
+  readForceLinks: function ()
+  {
+    var preference = document.getElementById("browser.link.open_newwindow");
+    var tabbedWindowLinks = document.getElementById("tabbedWindowLinks");
+    tabbedWindowLinks.disabled = preference.value == 2;
+    return preference.value != 2;
+  },
+  
+  readForceLinksMode: function ()
+  {
+    var preference = document.getElementById("browser.link.open_newwindow");
+    return preference.value != 2 ? preference.value : this._lastForceLinksMode;
+  },
+  
+  updateWindowLinksBehavior: function ()
+  {
+    var preference = document.getElementById("app.update.autoInstallEnabled");
+    
+    return undefined;
+  }
+};
+
Index: browser/components/preferences/tabs.xul
===================================================================
RCS file: browser/components/preferences/tabs.xul
diff -N browser/components/preferences/tabs.xul
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ browser/components/preferences/tabs.xul	21 Feb 2005 11:21:07 -0000
@@ -0,0 +1,90 @@
+<?xml version="1.0"?>
+
+# -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+# 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 the Firefox Preferences System.
+# 
+# The Initial Developer of the Original Code is Ben Goodger.
+# Portions created by the Initial Developer are Copyright (C) 2005
+# the Initial Developer. All Rights Reserved.
+# 
+# Contributor(s):
+#   Ben Goodger <ben@mozilla.org>
+# 
+# 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 *****
+
+<!DOCTYPE overlay [
+<!ENTITY % brandDTD SYSTEM "chrome://global/locale/brand.dtd">
+%brandDTD;
+<!ENTITY % tabsDTD SYSTEM "chrome://browser/locale/preferences/tabs.dtd">
+%tabsDTD;
+]>
+
+<overlay id="TabsPaneOverlay"
+         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+
+  <prefpane id="paneTabs">
+    <preferences>
+      <preference id="browser.link.open_external"      name="browser.link.open_external"      type="int"/>
+      <preference id="browser.link.open_newwindow"     name="browser.link.open_newwindow"     type="int"/>
+      <preference id="browser.tabs.autoHide"           name="browser.tabs.autoHide"           type="bool"/>
+      <preference id="browser.tabs.loadInBackground"   name="browser.tabs.loadInBackground"   type="bool"/>
+      <preference id="browser.tabs.warnOnClose"        name="browser.tabs.warnOnClose"        type="bool"/>
+    </preferences>
+    
+    <script type="application/x-javascript" src="chrome://browser/content/preferences/tabs.js"/>
+
+    <groupbox align="start">
+      <caption label="&openExternalLinksIn.label;"/>
+      <radiogroup id="tabbedExternalLinks"
+                  preference="browser.link.open_external">
+        <radio label="&newWindow.label;" value="2"/>
+        <radio label="&newTabInRecentWindow.label;" value="3"/>
+        <radio label="&recentWindowOrTab.label;" value="1"/>
+      </radiogroup>
+    </groupbox>
+    <vbox align="start">
+      <checkbox id="tabbedOpenForce" label="&forceNewWindowLinks.label;"
+                preference="browser.link.open_newwindow"
+                onpreferencewrite="return gTabsPane.writeWindowLinksBehavior();"
+                onpreferenceread="return gTabsPane.readForceLinks();"/>
+      <radiogroup id="tabbedWindowLinks" class="indent"
+                  preference="browser.link.open_newwindow"
+                  onpreferencewrite="return gTabsPane.writeWindowLinksBehavior();"
+                  onpreferenceread="return gTabsPane.readForceLinksMode();">
+        <radio label="&sameTabOrWindow.label;" value="1"/>
+        <radio label="&newTab.label;" value="3"/>
+      </radiogroup>
+      <checkbox id="hideTabBar" label="&hideTabBar.label;"
+                preference="browser.tabs.autoHide"/>
+      <checkbox id="loadInBackground" label="&loadInBackground.label;"
+                preference="browser.tabs.loadInBackground" reversed="true"/>
+      <checkbox id="warnOnClose" label="&warnOnClose.label;"
+                preference="browser.tabs.warnOnClose"/>
+    </vbox>
+  </prefpane>
+
+</overlay>
Index: browser/components/prefwindow/.cvsignore
===================================================================
RCS file: browser/components/prefwindow/.cvsignore
diff -N browser/components/prefwindow/.cvsignore
--- browser/components/prefwindow/.cvsignore	7 Apr 2002 06:21:20 -0000	1.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1 +0,0 @@
-Makefile
Index: browser/components/prefwindow/Makefile.in
===================================================================
RCS file: browser/components/prefwindow/Makefile.in
diff -N browser/components/prefwindow/Makefile.in
--- browser/components/prefwindow/Makefile.in	1 Feb 2005 17:36:51 -0000	1.7
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,45 +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.org code.
-#
-# The Initial Developer of the Original Code is
-# Netscape Communications Corporation.
-# Portions created by the Initial Developer are Copyright (C) 1998
-# the Initial Developer. All Rights Reserved.
-#
-# Contributor(s):
-#
-# 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 *****
-
-DEPTH		= ../../..
-topsrcdir	= @top_srcdir@
-srcdir		= @srcdir@
-VPATH		= @srcdir@
-
-include $(DEPTH)/config/autoconf.mk
-
-include $(topsrcdir)/config/rules.mk
Index: browser/components/prefwindow/jar.mn
===================================================================
RCS file: browser/components/prefwindow/jar.mn
diff -N browser/components/prefwindow/jar.mn
--- browser/components/prefwindow/jar.mn	30 Nov 2004 08:22:46 -0000	1.46
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,29 +0,0 @@
-browser.jar:
-*   content/browser/pref/nsPrefWindow.js                   (content/nsPrefWindow.js)
-*   content/browser/pref/pref.xul                          (content/pref.xul)
-*   content/browser/pref/pref-advanced.js                  (content/pref-advanced.js)
-*   content/browser/pref/pref-advanced.xul                 (content/pref-advanced.xul)
-*   content/browser/pref/pref-advancedscripts.xul          (content/pref-advancedscripts.xul)
-*   content/browser/pref/pref-connection.js                (content/pref-connection.js)
-*   content/browser/pref/pref-connection.xul               (content/pref-connection.xul)
-*   content/browser/pref/pref-extensions.xul               (content/pref-extensions.xul)
-*   content/browser/pref/pref-extensions.js                (content/pref-extensions.js)
-*   content/browser/pref/pref-features.xul                 (content/pref-features.xul)
-*   content/browser/pref/pref-features.js                  (content/pref-features.js)
-*   content/browser/pref/pref-fonts.xul                    (content/pref-fonts.xul)
-*   content/browser/pref/pref-fonts.js                     (content/pref-fonts.js)
-*   content/browser/pref/pref-languages.xul                (content/pref-languages.xul)
-*   content/browser/pref/pref-languages.js                 (content/pref-languages.js)
-*   content/browser/pref/pref-navigator.js                 (content/pref-navigator.js)
-*   content/browser/pref/pref-calibrate-screen.xul         (content/pref-calibrate-screen.xul)
-*   content/browser/pref/pref-masterpass.xul               (content/pref-masterpass.xul)
-*   content/browser/pref/pref-masterpass.js                (content/pref-masterpass.js)
-*   content/browser/pref/pref-navigator.xul                (content/pref-navigator.xul)
-*   content/browser/pref/pref-privacy.xul                  (content/pref-privacy.xul)
-*   content/browser/pref/pref-privacy.js                   (content/pref-privacy.js)
-*   content/browser/pref/pref-features-images.xul          (content/pref-features-images.xul)
-*   content/browser/pref/pref-features-images.js           (content/pref-features-images.js)
-*   content/browser/pref/pref-themes.xul                   (content/pref-themes.xul)
-*   content/browser/pref/pref-themes.js                    (content/pref-themes.js)
-*   content/browser/pref/plugins.xul                       (content/plugins.xul)
-*   content/browser/pref/plugins.js                        (content/plugins.js)
Index: browser/components/prefwindow/content/nsPrefWindow.js
===================================================================
RCS file: browser/components/prefwindow/content/nsPrefWindow.js
diff -N browser/components/prefwindow/content/nsPrefWindow.js
--- browser/components/prefwindow/content/nsPrefWindow.js	1 Feb 2005 17:36:51 -0000	1.12
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,379 +0,0 @@
-# -*- Mode: Java; tab-width: 4; c-basic-offset: 4; -*-
-# 
-# ***** 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.org Code.
-#
-# The Initial Developer of the Original Code is
-# Netscape Communications Corporation.
-# Portions created by the Initial Developer are Copyright (C) 1998
-# the Initial Developer. All Rights Reserved.
-#
-# Contributor(s):
-#   Ben "Count XULula" Goodger <ben@netscape.com>
-#
-# 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 *****
-
-const _DEBUG = false; 
- 
-/** PrefWindow IV
- *  =============
- *  This is a general page switcher and pref loader.
- *  =>> CHANGES MUST BE REVIEWED BY ben@netscape.com!! <<=
- **/ 
-
-var queuedTag; 
-var queuedWindow;
-function initPanel ( aPrefTag, aWindow )
-  {
-    if( hPrefWindow )
-      hPrefWindow.onpageload( aPrefTag, aWindow )
-    else {
-      queuedTag = aPrefTag;
-      queuedWindow = aWindow;
-    }
-  } 
- 
-window.doneLoading = false; 
- 
-function nsPrefWindow( frame_id )
-{
-  if ( !frame_id )
-    throw "Error: frame_id not supplied!";
-
-  this.contentFrame   = frame_id;
-  this.wsm            = new nsWidgetStateManager( frame_id );
-  this.wsm.attributes = ["preftype", "prefstring", "prefattribute", "disabled"];
-  this.pref           = null;
-  
-  this.cancelHandlers = [];
-  this.okHandlers     = [];  
-    
-  // set up window
-  this.onload();
-}
-
-nsPrefWindow.prototype =
-  {
-    onload:
-      function ()
-        {
-          try 
-            {
-              this.pref = Components.classes["@mozilla.org/preferences;1"].getService(Components.interfaces.nsIPref);
-            }
-          catch(e) 
-            {
-              dump("*** Failed to create prefs object\n");
-              return;
-            }
-        },
-
-      init: 
-        function ()
-          {        
-            if( window.queuedTag )
-              {
-                this.onpageload( window.queuedTag, window.queuedWindow );
-              }
-          },
-                  
-      onOK:
-        function ()
-          {
-            var tag = document.getElementById( hPrefWindow.contentFrame ).getAttribute("tag");
-            if( tag == "" )
-              {
-                tag = document.getElementById( hPrefWindow.contentFrame ).getAttribute("src");
-              }
-            hPrefWindow.wsm.savePageData( tag, null );
-            for( var i = 0; i < hPrefWindow.okHandlers.length; i++ )
-              {
-                hPrefWindow.okHandlers[i]();
-              }
-            hPrefWindow.savePrefs();
-          },
-        
-      onCancel:
-        function ()
-          {
-            for( var i = 0; i < hPrefWindow.cancelHandlers.length; i++ )
-              {
-                hPrefWindow.cancelHandlers[i]();
-              }
-          },
-
-      registerOKCallbackFunc:
-        function ( aFunctionReference )
-          { 
-            this.okHandlers[this.okHandlers.length] = aFunctionReference;
-          },
-
-      registerCancelCallbackFunc:
-        function ( aFunctionReference )
-          {
-            this.cancelHandlers[this.cancelHandlers.length] = aFunctionReference;
-          },
-          
-      getPrefIsLocked:
-        function ( aPrefString )
-          {
-            return hPrefWindow.pref.PrefIsLocked(aPrefString);
-          },
-      getPref:
-        function ( aPrefType, aPrefString, aDefaultFlag )
-          {
-            var pref = hPrefWindow.pref;
-            try
-              {
-                switch ( aPrefType )
-                  {
-                    case "bool":
-                      return !aDefaultFlag ? pref.GetBoolPref( aPrefString ) : pref.GetDefaultBoolPref( aPrefString );
-                    case "int":
-                      return !aDefaultFlag ? pref.GetIntPref( aPrefString ) : pref.GetDefaultIntPref( aPrefString );
-                    case "localizedstring":
-                      return pref.getLocalizedUnicharPref( aPrefString );
-                    case "color":
-                    case "string":
-                    default:
-                         return !aDefaultFlag ? pref.CopyUnicharPref( aPrefString ) : pref.CopyDefaultUnicharPref( aPrefString );
-                  }
-              }
-            catch (e)
-              {
-                if( _DEBUG ) 
-                  {
-                    dump("*** no default pref for " + aPrefType + " pref: " + aPrefString + "\n");
-                    dump(e + "\n");
-                  }
-              }
-            return "!/!ERROR_UNDEFINED_PREF!/!";
-          }    ,
-
-      setPref:
-        function ( aPrefType, aPrefString, aValue )
-          {
-            try
-              {
-                switch ( aPrefType )
-                  {
-                    case "bool":
-                      hPrefWindow.pref.SetBoolPref( aPrefString, aValue );
-                      break;
-                    case "int":
-                      hPrefWindow.pref.SetIntPref( aPrefString, aValue );
-                      break;
-                    case "color":
-                    case "string":
-                    case "localizedstring":
-                    default:
-                      hPrefWindow.pref.SetUnicharPref( aPrefString, aValue );
-                      break;
-                  }
-              }
-            catch (e)
-              {
-                dump(e + "\n");
-              }
-          },
-          
-      savePrefs:
-        function ()
-          {
-            for( var pageTag in this.wsm.dataManager.pageData )
-              {
-                var pageData = this.wsm.dataManager.getPageData( pageTag );
-                if ("initialized" in pageData && pageData.initialized && "elementIDs" in pageData)
-                  {
-                for( var elementID in pageData.elementIDs )
-                  {
-                    var itemObject = pageData.elementIDs[elementID];
-                    if ( "prefstring" in itemObject && itemObject.prefstring )
-                      {
-                        var elt = itemObject.localname;
-                        var prefattribute = itemObject.prefattribute;
-                        if (!prefattribute) {
-                          if (elt == "checkbox")
-                            prefattribute = "checked";
-                          else if (elt == "button")
-                            prefattribute = "disabled";
-                          else
-                            prefattribute = "value";
-                        }
-                        
-                        var value = itemObject[prefattribute];
-                        var preftype = itemObject.preftype;
-                        if (!preftype) {
-                          if (elt == "textbox")
-                            preftype = "string";
-                          else if (elt == "checkbox" || elt == "button")
-                            preftype = "bool";
-                          else if (elt == "radiogroup" || elt == "menulist")
-                            preftype = "int";
-                        }
-                        switch( preftype )
-                          {
-                            case "bool":
-                              if( value == "true" && typeof(value) == "string" )
-                                value = true;
-                              else if( value == "false" && typeof(value) == "string" )
-                                value = false;
-                              break;
-                            case "int":
-                              value = parseInt(value);                              
-                              break;
-                            case "color":
-                              if( toString(value) == "" )
-                                {
-                                  dump("*** ERROR CASE: illegal attempt to set an empty color pref. ignoring.\n");
-                                  break;
-                                }
-                            case "string":
-                            case "localizedstring":
-                            default:
-                              if( typeof(value) != "string" )
-                                {
-                                  value = toString(value);
-                                }
-                              break;
-                          }
-
-                        if( value != this.getPref( preftype, itemObject.prefstring ) )
-                          {
-                            this.setPref( preftype, itemObject.prefstring, value );
-                          }
-                      }
-                  }
-              }
-              }
-              try 
-                {
-                  this.pref.savePrefFile(null);
-                }
-              catch (e)
-                {
-                  try
-                    {
-                      var prefUtilBundle = document.getElementById("bundle_prefutilities");
-                      var alertText = prefUtilBundle.getString("prefSaveFailedAlert");
-                      var titleText = prefUtilBundle.getString("prefSaveFailedTitle");
-                      var promptService = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
-                                                    .getService(Components.interfaces.nsIPromptService);
-                      promptService.alert(window, titleText, alertText);
-                    }
-                  catch (e)
-                    {
-                      dump(e + "\n");
-                    }
-                }
-          },                        
-
-      switchPage:
-        function (aNewURL, aNewTag)
-          {
-            var oldURL = document.getElementById( this.contentFrame ).getAttribute("tag");
-            if( !oldURL )
-              {
-                oldURL = document.getElementById( this.contentFrame ).getAttribute("src");
-              }
-            this.wsm.savePageData( oldURL, null );      // save data from the current page. 
-            if( aNewURL != oldURL )
-              {
-                document.getElementById( this.contentFrame ).setAttribute( "src", aNewURL );
-                if( !aNewTag )
-                  document.getElementById( this.contentFrame ).removeAttribute( "tag" );
-                else
-                  document.getElementById( this.contentFrame ).setAttribute( "tag", aNewTag );
-              }
-          },
-              
-      onpageload: 
-        function ( aPageTag, aWindow )
-          {
-            if (!aWindow)
-              aWindow = window.frames[this.contentFrame];
-            
-            // Only update the header title for panels that are loaded in the main dialog, 
-            // not sub-dialogs. (Removing this check will cause the header display area to
-            // be cleared whenever you open a sub-dialog that uses WSM)
-            if (aWindow == window.frames[this.contentFrame]) {
-              var header = document.getElementById("header");
-              header.setAttribute("title",
-                                  aWindow.document.documentElement.getAttribute("headertitle"));
-            }
-            
-            var pageData = this.wsm.dataManager.getPageData(aPageTag);
-            if(!('initialized' in pageData))
-              {
-                var prefElements = aWindow.document.getElementsByAttribute( "prefstring", "*" );
-                
-                for( var i = 0; i < prefElements.length; i++ )
-                  {
-                    var prefstring    = prefElements[i].getAttribute( "prefstring" );
-                    var prefid        = prefElements[i].getAttribute( "id" );
-                    var preftype      = prefElements[i].getAttribute( "preftype" );
-                    var elt = prefElements[i].localName;
-                    if (!preftype) {
-                      if (elt == "textbox")
-                        preftype = "string";
-                      else if (elt == "checkbox" || elt == "button")
-                        preftype = "bool";
-                      else if (elt == "radiogroup" || elt == "menulist")
-                        preftype = "int";
-                    }
-                    var prefdefval    = prefElements[i].getAttribute( "prefdefval" );
-                    var prefattribute = prefElements[i].getAttribute( "prefattribute" );
-                    if (!prefattribute) {
-                      if (elt == "checkbox")
-                        prefattribute = "checked";
-                      else if (elt == "button")
-                        prefattribute = "disabled";
-                      else
-                        prefattribute = "value";
-                    }
-                    var prefvalue = this.getPref( preftype, prefstring );
-                    if( prefvalue == "!/!ERROR_UNDEFINED_PREF!/!" )
-                      {
-                        prefvalue = prefdefval;
-                      }
-                    var root = this.wsm.dataManager.getItemData( aPageTag, prefid ); 
-                    root[prefattribute] = prefvalue;              
-                    var isPrefLocked = this.getPrefIsLocked(prefstring);
-                    if (isPrefLocked)
-                      root.disabled = "true";
-                    root.localname = prefElements[i].localName;
-                  }
-              }      
-            this.wsm.setPageData( aPageTag, aWindow );  // do not set extra elements, accept hard coded defaults
-            if( 'Startup' in aWindow)
-              {
-                aWindow.Startup();
-              }
-            this.wsm.dataManager.pageData[aPageTag].initialized = true;
-          }
-  };
-
Index: browser/components/prefwindow/content/permissions.js
===================================================================
RCS file: browser/components/prefwindow/content/permissions.js
diff -N browser/components/prefwindow/content/permissions.js
Index: browser/components/prefwindow/content/plugins.js
===================================================================
RCS file: browser/components/prefwindow/content/plugins.js
diff -N browser/components/prefwindow/content/plugins.js
--- browser/components/prefwindow/content/plugins.js	1 Feb 2005 17:36:51 -0000	1.11
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,327 +0,0 @@
-# -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
-# ***** 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.org Code.
-#
-# The Initial Developer of the Original Code is
-# Doron Rosenberg.
-# Portions created by the Initial Developer are Copyright (C) 2001
-# the Initial Developer. All Rights Reserved.
-#
-# Contributor(s):
-#   Ben Goodger <ben@bengoodger.com>
-#
-# 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 gPluginTypes = null;
-var gPluginTypesList = null;
-
-var gPrefs = null;
-
-const kDisabledPluginTypesPref = "browser.download.pluginOverrideTypes";
-const kPluginHandlerContractID = "@mozilla.org/content/plugin/document-loader-factory;1";
-const kPluginOverrideTypesNotHandled = "browser.download.pluginOverrideTypesNotHandled";
-
-function init()
-{
-  gPrefs = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch);
-  
-  gPluginTypes = new PluginTypes();
-
-  // Initialize the File Type list
-  gPluginTypesList = document.getElementById("pluginTypesList");
-  gPluginTypesList.treeBoxObject.view = gPluginTypes;
-  
-  var x = document.documentElement.getAttribute("screenX");
-  if (x == "")
-    setTimeout(centerOverParent, 0);  
-}
-
-// This should actually go into some sort of pref fe utilities file. 
-function centerOverParent()
-{
-  var parent = window.opener;
-  
-  x = parent.screenX + (parent.outerWidth / 2) - (window.outerWidth / 2);
-  y = parent.screenY + (parent.outerHeight / 2) - (window.outerHeight / 2);
-  window.moveTo(x, y);
-}
-
-function onAccept()
-{
-  var catman = Components.classes["@mozilla.org/categorymanager;1"].getService(Components.interfaces.nsICategoryManager);
-
-  // Update the disabled plugin types pref and the category manager.
-  var disabled = "";
-  for (var i = 0; i < gPluginTypes._pluginTypes.length; ++i) {
-    var currType = gPluginTypes._pluginTypes[i];
-
-    if (!currType.pluginEnabled) {
-      for (var j = 0; j < currType.MIMETypes.length; ++j) {
-        disabled += currType.MIMETypes[j] + ",";
-        catman.deleteCategoryEntry("Gecko-Content-Viewers", currType.MIMETypes[j], false);
-      }
-    }
-    else {
-      // We could have re-activated a deactivated Plugin handler, add all the handlers back again, 
-      // replacing the existing ones. 
-      for (j = 0; j < currType.MIMETypes.length; ++j)
-        catman.addCategoryEntry("Gecko-Content-Viewers", currType.MIMETypes[j], 
-                                kPluginHandlerContractID, false, true);
-    }
-  }
-  
-  if (disabled != "") {  
-    disabled = disabled.substr(0, disabled.length - 1);
-    
-    gPrefs.setCharPref(kDisabledPluginTypesPref, disabled);
-  }
-  else if (gPrefs.prefHasUserValue(kDisabledPluginTypesPref)) {
-    // Clear the pref if we've restored plugin functionality to all
-    // listed types. 
-    gPrefs.clearUserPref(kDisabledPluginTypesPref); 
-  }
-}
-
-function PluginType (aPluginEnabled, aMIMEInfo) 
-{
-  this.pluginEnabled = aPluginEnabled;
-  this.MIMEInfo = aMIMEInfo;
-  this.MIMETypes = [this.MIMEInfo.MIMEType];
-}
-
-function PluginTypes()
-{
-  var atomSvc = Components.classes["@mozilla.org/atom-service;1"].getService(Components.interfaces.nsIAtomService);
-  this._enabledAtom = atomSvc.getAtom("enabled");
-
-  this._pluginTypes = [];
-  this._pluginTypeHash = { };
-
-  // Read enabled plugin type information from the category manager
-  var catman = Components.classes["@mozilla.org/categorymanager;1"].getService(Components.interfaces.nsICategoryManager);
-  var types = catman.enumerateCategory("Gecko-Content-Viewers");
-  while (types.hasMoreElements()) {
-    var currType = types.getNext().QueryInterface(Components.interfaces.nsISupportsCString).data;
-    var contractid = catman.getCategoryEntry("Gecko-Content-Viewers", currType);
-    if (contractid == kPluginHandlerContractID)
-      this.addType(currType, true);
-  }
-  
-  // Read disabled plugin type information from preferences
-  try {
-    var types = gPrefs.getCharPref(kDisabledPluginTypesPref);
-    var disabledTypes = types.split(",");
-    
-    // Don't show types for which there is no plugin configured, even if that type
-    // is listed in the override list. This may be because the user is running a different
-    // build with a profile that was used in another build that had other plugins installed.
-    // We don't want to clobber the override list and we also don't want to display the
-    // entries for the plugins that aren't configured. 
-    var validOverrides = { };
-    if (gPrefs.prefHasUserValue(kPluginOverrideTypesNotHandled)) {
-      var notHandledTypes = gPrefs.getCharPref(kPluginOverrideTypesNotHandled);
-      notHandledTypes = notHandledTypes.split(",");
-      
-      for (var i = 0; i < notHandledTypes.length; ++i)
-        validOverrides[notHandledTypes[i]] = notHandledTypes[i];
-    }
-    
-    for (i = 0; i < disabledTypes.length; ++i) {
-      if (!(disabledTypes[i] in validOverrides)) 
-        this.addType(disabledTypes[i], false);
-    }
-  }
-  catch (e) { }
-  
-  this._pluginTypes.sort(this.sortCallback);
-}
-
-PluginTypes.prototype = {
-  addType: function (aMIMEType, aPluginEnabled)
-  {
-    var mimeInfo = this.getMIMEInfoForType(aMIMEType);
-    if (mimeInfo) {
-      // We only want to show one entry per extension, even if several MIME
-      // types map to that extension, e.g. audio/wav, audio/x-wav. Hash the
-      // primary extension for the type to prevent duplicates. If we encounter
-      // a duplicate, record the additional MIME type so we know to deactivate
-      // support for it too if the user deactivates support for the extension.
-      try {
-        var primExt = mimeInfo.primaryExtension;
-      } catch (e) { }
-
-      if (primExt) {
-        // If there's no extension, there's nothing to do here.
-        if (!(primExt in this._pluginTypeHash)) {
-          var pluginType = new PluginType(aPluginEnabled, mimeInfo);
-          this._pluginTypeHash[primExt] = pluginType;
-          this._pluginTypes.push(pluginType);
-        }
-        // We check that the primary extension has already been hashed
-        // by a plugin that is installed in this build before adding a disable
-        // override to the list. Otherwise we might end up showing disabled
-        // plugin entries for plugins that actually aren't installed and configured
-        // in this build, but were for another build that was using this profile.
-        else {
-          // Append this MIME type to the list of MIME types for the extension.
-          var pluginType = this._pluginTypeHash[primExt];
-          pluginType.MIMETypes.push(mimeInfo.MIMEType);
-        }
-      }
-    }
-  },
-
-  sortCallback: function (a, b)
-  {
-    try {
-      var ac = a.MIMEInfo.primaryExtension.toLowerCase();
-      var bc = b.MIMEInfo.primaryExtension.toLowerCase();
-    } catch (e) { }
-    
-    if (ac < bc) 
-      return -1;
-    else if (ac > bc) 
-      return 1;
-    return 0;
-  },
-#if 0
-  sortAscending: true,
-  sortCallback: function (a, b)
-  {
-    var ac = gPluginTypes.getSortProperty(a);
-    var bc = gPluginTypes.getSortProperty(b);
-    
-    if (ac < bc) 
-      return gPluginTypes.sortAscending ? -1 : 1;
-    else if (ac > bc) 
-      return gPluginTypes.sortAscending ? 1 : -1;
-    return 0;
-  },
-  
-  sortProperty: "fileExtension",
-  getSortProperty: function (aObject)
-  {
-    switch (sortProperty) {
-    case "fileExtension":
-      return aObject.MIMEInfo.primaryExtension.toLowerCase();
-    case "fileType":
-      var desc = aObject.MIMEInfo.description;
-      // XXXben localize
-      return desc || aObject.MIMEInfo.primaryExtension.toUpperCase() + " file";
-    case "pluginEnabled":
-      return aObject.pluginEnabled;
-    }
-    return null;
-  },
-#endif
-
-  getMIMEInfoForType: function (aType)
-  {
-    try {
-      var mimeSvc = Components.classes["@mozilla.org/mime;1"].getService(Components.interfaces.nsIMIMEService);
-      return mimeSvc.getFromTypeAndExtension(aType, "");
-    }
-    catch (e) { }
-    
-    return null;
-  },
-
-  // nsITreeView
-  get rowCount() 
-  { 
-    return this._pluginTypes.length; 
-  },
-
-  getCellProperties: function (aRow, aCol, aProperties) 
-  { 
-    if (aCol.id == "pluginEnabled") {
-      if (this._pluginTypes[aRow].pluginEnabled) 
-        aProperties.AppendElement(this._enabledAtom);
-    }
-  },
-  
-  getImageSrc: function (aRow, aCol) 
-  { 
-    if (aCol.id == "fileExtension") 
-      return "moz-icon://goat." + this._pluginTypes[aRow].MIMEInfo.primaryExtension + "?size=16";
-    
-    return null;
-  },
-  
-  getCellText: function (aRow, aCol) 
-  { 
-    var mimeInfo = this._pluginTypes[aRow].MIMEInfo;
-    
-    if (aCol.id == "fileType") {
-      var desc = mimeInfo.description;
-      // XXXben localize
-      return desc || mimeInfo.primaryExtension.toUpperCase() + " file";
-    }
-    else if (aCol.id == "fileExtension")
-      return mimeInfo.primaryExtension.toUpperCase();
-
-    return "";    
-  },
-  
-  cycleCell: function (aRow, aCol) 
-  { 
-    if (aCol.id == "pluginEnabled") {
-      this._pluginTypes[aRow].pluginEnabled = !this._pluginTypes[aRow].pluginEnabled;
-      gPluginTypesList.treeBoxObject.invalidateCell(aRow, aCol);
-    }
-  },
-
-  selection: null,
-  
-  // Stuff we don't need...
-  isContainer: function (aRow) { return false; },
-  isContainerOpen: function (aRow) { return false; },
-  isContainerEmpty: function (aRow) { return true; },
-  isSeparator: function (aRow) { return false; },
-  isSorted: function () { return false; },
-  canDrop: function (aRow, aOrientation) { return false; },
-  drop: function (aRow, aOrientation) { },
-  getParentIndex: function (aRow) { },
-  hasNextSibling: function (aRow, aNextIndex) { },
-  getLevel: function (aRow) { },
-  getProgressMode: function (aRow, aCol) { },
-  getCellValue: function (aRow, aCol) { },
-  setTree: function (aTree) { },
-  toggleOpenState: function (aRow) { },
-  cycleHeader: function (aCol) { },
-  selectionChanged: function () { },
-  isEditable: function (aRow, aCol) { },
-  setCellValue: function (aRow, aCol, aValue) { },
-  setCellText: function (aRow, aCol, aValue) { },
-  performAction: function (aAction) { },
-  performActionOnRow: function (aAction, aRow) { },
-  performActionOnCell: function (aAction, aRow, aCol) { },
-  getRowProperties: function (aRow, aProperties) { },
-  getColumnProperties: function (aCol, aProperties) { }
-
-};
-
Index: browser/components/prefwindow/content/plugins.xul
===================================================================
RCS file: browser/components/prefwindow/content/plugins.xul
diff -N browser/components/prefwindow/content/plugins.xul
--- browser/components/prefwindow/content/plugins.xul	1 Feb 2005 17:36:51 -0000	1.6
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,76 +0,0 @@
-<?xml version="1.0"?>
-
-# -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
-# ***** 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.org Code.
-#
-# The Initial Developer of the Original Code is
-# Doron Rosenberg.
-# Portions created by the Initial Developer are Copyright (C) 2001
-# the Initial Developer. All Rights Reserved.
-#
-# Contributor(s):
-#   Ben Goodger <ben@bengoodger.com>
-#
-# 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 *****
-
-<?xml-stylesheet href="chrome://global/skin/"?>
-<?xml-stylesheet href="chrome://mozapps/skin/pref/pref.css" type="text/css"?>
-<?xml-stylesheet href="chrome://browser/skin/pref/pref.css" type="text/css"?>
-
-<!DOCTYPE window SYSTEM "chrome://browser/locale/pref/plugins.dtd">
-
-<dialog id="plugins" title="&plugins.title;"
-        xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
-        onload="init();" ondialogaccept="onAccept();" style="width: 30em;"
-        persist="screenX screenY width height">
-
-  <script type="application/x-javascript" src="chrome://browser/content/pref/plugins.js"/>
-
-  <description>&pluginInfo.label;</description>
-  <separator class="thin"/>
-  <tree id="pluginTypesList" flex="1" hidecolumnpicker="true" rows="10" seltype="single">
-    <treecols>
-      <treecol id="fileExtension"
-               class="sortDirectionIndicator pluginsList" persist="width"
-               label="&extensionsHeader.label;" />
-      <treecol id="fileType" flex="1"
-               class="sortDirectionIndicator" persist="width"
-               label="&typeHeader.label;"/>
-      <splitter class="tree-splitter" />
-      <treecol id="pluginEnabled" cycler="true"
-               class="sortDirectionIndicator" persist="width"
-               label="&enabledHeader.label;"/>
-    </treecols>
-    <treechildren class="pluginTypesChildren"/>
-  </tree>
-  <separator class="thin"/>
-  <description>&pluginInfo2.label;</description>
-
-  <separator/>
-
-</dialog>
Index: browser/components/prefwindow/content/pref-advanced.js
===================================================================
RCS file: browser/components/prefwindow/content/pref-advanced.js
diff -N browser/components/prefwindow/content/pref-advanced.js
--- browser/components/prefwindow/content/pref-advanced.js	1 Feb 2005 17:36:51 -0000	1.11
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,205 +0,0 @@
-# -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
-# ***** 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.org Code.
-#
-# The Initial Developer of the Original Code is
-# Netscape Communications Corporation.
-# Portions created by the Initial Developer are Copyright (C) 2004
-# the Initial Developer. All Rights Reserved.
-#
-# Contributor(s):
-#
-# 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 *****
-
-#define PROVISIONAL_SECURITY_UI
-
-var _elementIDs = ["moveSystemCaret", "hideTabBar", "loadInBackground",
-                    "loadBookmarksInBackground", "warnOnClose", "useAutoScrolling",
-                    "useSmoothScrolling", "enableAutoImageResizing",
-                    "useSSL2", "useSSL3", "useTLS1", "useTypeAheadFind",
-#ifdef PROVISIONAL_SECURITY_UI
-                    "certSelection", "securityOCSPEnabled", "serviceURL", "signingCA",
-#endif
-                    "tabbedExternalLinks", "tabbedWindowLinks",
-                    "enableSoftwareInstall", "enableSmartUpdate", 
-                    "enableExtensionUpdate"];
-
-#ifdef PROVISIONAL_SECURITY_UI
-const nsIX509CertDB = Components.interfaces.nsIX509CertDB;
-const nsX509CertDB = "@mozilla.org/security/x509certdb;1";
-const nsIOCSPResponder = Components.interfaces.nsIOCSPResponder;
-const nsISupportsArray = Components.interfaces.nsISupportsArray;
-
-var certdb;
-var ocspResponders;
-#endif
-
-function onOK()
-{
-  // the .ui pref is only the saved state of the prefs dialog's radio buttons.
-  // the other pref is the real one.
-  try {
-    var prefVal = document.getElementById("tabbedOpenForce").checked ?
-                    document.getElementById("tabbedWindowLinks").value : 2;
-    parent.hPrefWindow.setPref("int", "browser.link.open_newwindow", prefVal);
-  } catch(e) {
-    // never loaded |advanced| pane
-  }
-}
-
-function Startup() {
-  var prefVal = parent.hPrefWindow.getPref("int", "browser.link.open_newwindow",
-                                           false);
-  document.getElementById("tabbedOpenForce").checked = prefVal != 2;
-  updateWindowLinksBehavior();
-  parent.hPrefWindow.registerOKCallbackFunc(onOK);
-
-#ifdef PROVISIONAL_SECURITY_UI
-  var ocspEntry;
-  var i;
-
-  certdb = Components.classes[nsX509CertDB].getService(nsIX509CertDB);
-  ocspResponders = certdb.getOCSPResponders();
-
-  var signersMenu = document.getElementById("signingCA");
-  var signersURL = document.getElementById("serviceURL");
-  for (i=0; i<ocspResponders.length; i++) {
-    ocspEntry = ocspResponders.queryElementAt(i, nsIOCSPResponder);
-    var menuItemNode = document.createElement("menuitem");
-    menuItemNode.setAttribute("value", ocspEntry.responseSigner);
-    menuItemNode.setAttribute("label", ocspEntry.responseSigner);
-    signersMenu.firstChild.appendChild(menuItemNode);
-  }
-
-  doSecurityEnabling();
-  
-  // XXXben menulists suck, see explanation in pref-privacy.js
-  // style resolution problem inside scrollable areas. 
-  var scb = document.getElementById("signingCABox");
-  var sca = document.getElementById("signingCA");
-  sca.removeAttribute("hidden");
-  sca.parentNode.removeChild(sca);
-  scb.appendChild(sca);
-#endif
-}
-
-#ifdef PROVISIONAL_SECURITY_UI
-function doSecurityEnabling()
-{
-  var signersMenu = document.getElementById("signingCA");
-  var signersURL = document.getElementById("serviceURL");
-  var radiogroup = document.getElementById("securityOCSPEnabled");
-  
-  switch ( radiogroup.value ) {
-  case "0":
-  case "1":
-    signersMenu.setAttribute("disabled", true);
-    signersURL.setAttribute("disabled", true);
-    break;
-  case "2":
-  default:
-    if (!parent.hPrefWindow.getPrefIsLocked("security.OCSP.signingCA"))
-      signersMenu.removeAttribute("disabled");
-    if (!parent.hPrefWindow.getPrefIsLocked("security.OCSP.URL"))
-      signersURL.removeAttribute("disabled");
-  }
-}
-
-function changeURL()
-{
-  var signersMenu = document.getElementById("signingCA");
-  var signersURL = document.getElementById("serviceURL");
-  var CA = signersMenu.getAttribute("value");
-  var i;
-  var ocspEntry;
-
-  for (i=0; i < ocspResponders.length; i++) {
-    ocspEntry = ocspResponders.queryElementAt(i, nsIOCSPResponder);
-    if (CA == ocspEntry.responseSigner) {
-      signersURL.setAttribute("value", ocspEntry.serviceURL);
-      break;
-    }
-  }
-}
-
-function openCrlManager()
-{
-    window.open('chrome://pippki/content/crlManager.xul',  "",
-                'chrome,width=500,height=400,resizable=1');
-}
-
-function openCertManager()
-{
-  //check for an existing certManager window and focus it; it's not application modal
-  const kWindowMediatorContractID = "@mozilla.org/appshell/window-mediator;1";
-  const kWindowMediatorIID = Components.interfaces.nsIWindowMediator;
-  const kWindowMediator = Components.classes[kWindowMediatorContractID].getService(kWindowMediatorIID);
-  var lastCertManager = kWindowMediator.getMostRecentWindow("mozilla:certmanager");
-  if (lastCertManager)
-    lastCertManager.focus();
-  else {
-    window.open('chrome://pippki/content/certManager.xul',  "",
-                'chrome,centerscreen,resizable=yes,dialog=no');
-  }
-}
-
-function openDeviceManager()
-{
-  //check for an existing deviceManger window and focus it; it's not application modal
-  const kWindowMediatorContractID = "@mozilla.org/appshell/window-mediator;1";
-  const kWindowMediatorIID = Components.interfaces.nsIWindowMediator;
-  const kWindowMediator = Components.classes[kWindowMediatorContractID].getService(kWindowMediatorIID);
-  var lastCertManager = kWindowMediator.getMostRecentWindow("mozilla:devicemanager");
-  if (lastCertManager)
-    lastCertManager.focus();
-  else {
-    window.open('chrome://pippki/content/device_manager.xul',  "devmgr",
-                'chrome,centerscreen,resizable=yes,dialog=no');
-  }
-}
-#endif
-
-function updateWindowLinksBehavior() {
-  var radioNodes = document.getElementById("tabbedWindowLinks").childNodes;
-  var ctr;
-  if (document.getElementById("tabbedOpenForce").checked)
-    for (ctr = 0; ctr < radioNodes.length; ++ctr)
-      radioNodes.item(ctr).removeAttribute("disabled");
-  else
-    for (ctr = 0; ctr < radioNodes.length; ++ctr)
-      radioNodes.item(ctr).setAttribute("disabled", "true");
-}
-
-function checkForUpdates()
-{
-  var updates = Components.classes["@mozilla.org/updates/update-service;1"]
-                          .getService(Components.interfaces.nsIUpdateService);
-  updates.checkForUpdates([], 0, Components.interfaces.nsIUpdateItem.TYPE_ANY, 
-                          Components.interfaces.nsIUpdateService.SOURCE_EVENT_USER,
-                          window);
-}
-
Index: browser/components/prefwindow/content/pref-advanced.xul
===================================================================
RCS file: browser/components/prefwindow/content/pref-advanced.xul
diff -N browser/components/prefwindow/content/pref-advanced.xul
--- browser/components/prefwindow/content/pref-advanced.xul	7 Dec 2004 16:08:38 -0000	1.26
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,184 +0,0 @@
-<?xml version="1.0"?> 
-
-<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
-<?xml-stylesheet href="chrome://mozapps/skin/pref/pref.css" type="text/css"?>
-<?xml-stylesheet href="chrome://browser/skin/pref/pref.css" type="text/css"?>
-
-<!DOCTYPE page [
-  <!ENTITY % brandDTD SYSTEM "chrome://global/locale/brand.dtd">
-  <!ENTITY % advancedDTD SYSTEM "chrome://browser/locale/pref/pref-advanced.dtd">
-  %brandDTD;
-  %advancedDTD;
-]>
-
-<page xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
-      onload="parent.initPanel('chrome://browser/content/pref/pref-advanced.xul');"
-      headertitle="&lHeader;">
-
-  <script type="application/x-javascript" src="chrome://browser/content/pref/pref-advanced.js"/>
-  
-  <stringbundle id="advancedBundle" src="chrome://browser/locale/pref/prefutilities.properties"/>
-
-  <vbox class="listBox settingsBox" flex="1" style="overflow: auto;">
-    <expander id="accessibility" label="&accessibility.label;" open="true" persist="open" clearhidden="true">
-      <checkbox id="moveSystemCaret" label="&moveSystemCaret.label;"
-                prefstring="accessibility.browsewithcaret"/>
-      <checkbox id="useTypeAheadFind" label="&useTypeAheadFind.label;"
-                prefstring="accessibility.typeaheadfind"/>
-    </expander>
-    <expander id="browsing" label="&browsing.label;" open="true" persist="open"
-              clearhidden="true">
-      <checkbox id="enableAutoImageResizing"
-                label="&enableAutoImageResizing.label;"
-                prefstring="browser.enable_automatic_image_resizing"/>
-      <checkbox id="useAutoScrolling" label="&useAutoScrolling.label;"
-                prefstring="general.autoScroll"/>
-      <checkbox id="useSmoothScrolling" label="&useSmoothScrolling.label;"
-                prefstring="general.smoothScroll"/>
-    </expander>
-
-    <!-- tabbed browsing -->
-    <expander id="tabbedBrowsing" label="&tabbedBrowsing.label;"
-              open="true" persist="open" clearhidden="true">
-      <groupbox align="start">
-        <caption label="&openExternalLinksIn.label;"/>
-        <radiogroup id="tabbedExternalLinks"
-                    prefstring="browser.link.open_external">
-          <radio label="&newWindow.label;" value="2"/>
-          <radio label="&newTabInRecentWindow.label;" value="3"/>
-          <radio label="&recentWindowOrTab.label;" value="1"/>
-        </radiogroup>
-      </groupbox>
-      <checkbox id="tabbedOpenForce" label="&forceNewWindowLinks.label;"
-                oncommand="updateWindowLinksBehavior()"/>
-      <radiogroup id="tabbedWindowLinks"
-                  prefstring="browser.link.open_newwindow.ui"
-                  style="margin-left: 23px">
-        <radio label="&sameTabOrWindow.label;" value="1"/>
-        <radio label="&newTab.label;" value="3"/>
-      </radiogroup>
-      <checkbox id="hideTabBar" label="&hideTabBar.label;"
-                prefstring="browser.tabs.autoHide"/>
-      <checkbox id="loadInBackground" label="&loadInBackground.label;"
-                prefstring="browser.tabs.loadInBackground" reversed="true"/>
-      <checkbox id="loadBookmarksInBackground" label="&loadBookmarksInBackground.label;"
-                prefstring="browser.tabs.loadBookmarksInBackground" reversed="true"/>
-      <checkbox id="warnOnClose" label="&warnOnClose.label;"
-                prefstring="browser.tabs.warnOnClose"/>
-    </expander>
-
-    <expander id="softwareupdate" label="&softwareupdate.label;" 
-              open="true" persist="open" clearhidden="true" align="left">
-      <label>&softwareupdateinfo.label;</label>
-      <vbox class="indent" align="left">
-        <checkbox id="enableSmartUpdate"
-                  label="&enableSmartUpdate.label;" accesskey="&enableSmartUpdate.accesskey;"
-                  prefstring="app.update.autoUpdateEnabled"/>
-        <checkbox id="enableExtensionUpdate"
-                  label="&enableExtensionUpdate.label;" accesskey="&enableExtensionUpdate.accesskey;"
-                  prefstring="extensions.update.autoUpdateEnabled"/>      
-        <separator class="thin"/>
-        <button label="&checkNow.label;" accesskey="&checkNow.accesskey;"
-                oncommand="checkForUpdates();"/>
-      </vbox>
-    </expander>
-
-    <expander id="security" label="&security.label;" open="true" persist="open" clearhidden="true">
-      <checkbox id="useSSL2" label="&useSSL2.label;"
-                prefstring="security.enable_ssl2"/>
-      <checkbox id="useSSL3" label="&useSSL3.label;"
-                prefstring="security.enable_ssl3"/>
-      <checkbox id="useTLS1" label="&useTLS1.label;"
-                prefstring="security.enable_tls"/>
-    </expander>
-    
-    <expander id="certs" label="&certs.label;" open="false" persist="open" clearhidden="true">      
-      <groupbox align="start">
-        <caption label="&SSLClientAuthMethod;"/>
-        <description>&certselect.description;</description>
-        <!-- Prefs -->
-        <radiogroup id="certSelection" orient="horizontal" preftype="string" 
-	            prefstring="security.default_personal_cert">
-          <radio label="&certselect.auto;" value="Select Automatically"/>
-          <radio label="&certselect.ask;" value="Ask Every Time"/>
-        </radiogroup>
-      </groupbox>
-
-      <!-- Certificate manager -->
-      <groupbox>
-        <caption label="&managecerts.label;"/>
-        <description>&managecerts.text;</description>
-        <hbox align="center">
-          <button label="&managecerts.button;"
-                  oncommand="openCertManager();" 
-                  id="openCertManagerButton"
-                  accesskey="&managecerts.accesskey;"
-                  prefstring="security.disable_button.openCertManager"/>
-        </hbox>
-      </groupbox>
-
-      <!-- Device manager -->
-      <groupbox>
-        <caption label="&managedevices.label;"/>
-        <description>&managedevices.text;</description>
-        <hbox align="center">
-          <button label="&managedevices.button;"
-                  oncommand="openDeviceManager();"
-                  id="openDeviceManagerButton"
-                  accesskey="&managedevices.accesskey;"
-                  prefstring="security.disable_button.openDeviceManager"/>
-        </hbox>
-      </groupbox>
-    </expander>
-    
-    <expander id="validation" label="&validation.label;" open="false" persist="open" clearhidden="true">      
-      <groupbox>
-        <caption label="&validation.crl.label;"/>
-        <description>&validation.crl.description;</description>
-        <hbox align="center">
-          <button label="&validation.managecrls.button;"
-                  oncommand="openCrlManager();"
-                  id="managecrlbutton"
-                  accesskey="&validation.managecrls.accesskey;"
-                  prefstring="security.OCSP.disable_button.managecrl"/>
-        </hbox>
-      </groupbox>
-
-      <groupbox align="start">
-        <caption label="&validation.ocsp.label;"/>
-        <description>&validation.ocsp.description;</description>
-        <!-- Prefs -->
-        <radiogroup id="securityOCSPEnabled"
-                    prefstring="security.OCSP.enabled">
-            <radio value="0" label="&disableOCSP.label;" oncommand="doSecurityEnabling();"/>
-            <radio value="1" label="&certOCSP.label;" oncommand="doSecurityEnabling();"/>
-            <radio value="2" label="&proxyOCSP.label;" oncommand="doSecurityEnabling();"/>
-
-            <grid class="indent" flex="1">
-              <columns>
-              <column/>
-              <column flex="1"/>
-              </columns>
-              
-              <rows>
-                <row align="center">
-                  <label value="&signingCA.label;" accesskey="&signingCA.accesskey;" control="signingCA"/>
-                  <hbox id="signingCABox" flex="1"/>
-                </row>
-                <row align="center">
-                  <label value="&serviceURL.label;" accesskey="&serviceURL.accesskey;" control="serviceURL"/>
-                  <textbox id="serviceURL" prefstring="security.OCSP.URL"/>
-                </row>
-            </rows>
-          </grid>
-        </radiogroup>
-      </groupbox>
-    </expander>    
-
-    <menulist id="signingCA" preftype="string" prefstring="security.OCSP.signingCA"
-              flex="1" oncommand="changeURL()" hidden="true">
-      <menupopup/>
-    </menulist>
-  </vbox>
-</page>
-
Index: browser/components/prefwindow/content/pref-advancedscripts.xul
===================================================================
RCS file: browser/components/prefwindow/content/pref-advancedscripts.xul
diff -N browser/components/prefwindow/content/pref-advancedscripts.xul
--- browser/components/prefwindow/content/pref-advancedscripts.xul	1 Feb 2005 17:36:51 -0000	1.4
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,85 +0,0 @@
-<?xml version="1.0"?>
-# -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
-# ***** 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.org Code.
-#
-# The Initial Developer of the Original Code is
-# Doron Rosenberg.
-# Portions created by the Initial Developer are Copyright (C) 2001
-# the Initial Developer. All Rights Reserved.
-#
-# Contributor(s):
-#   Ben Goodger <ben@netscape.com>
-#
-# 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 *****
-
-<?xml-stylesheet href="chrome://global/skin/"?>
-
-<!DOCTYPE window SYSTEM "chrome://browser/locale/pref/pref-advancedscripts.dtd">
-
-<dialog id="advancedScripts"
-        xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
-        title="&allowScripts.title;"
-        onload="onDialogLoad();" ondialogaccept="onDialogAccept();">
-
-    <script type="application/x-javascript">
-    <![CDATA[
-      var elements = ["allowWindowMoveResize", "allowWindowFlip", "allowControlContextMenu", 
-                      "allowHideStatusBar", "allowWindowStatusChange", "allowImageSrcChange"];
-
-      function onDialogLoad()
-      {
-        for (var i = 0; i < elements.length; ++i) {
-          var prefElt = window.opener.document.getElementById(elements[i]);
-          var checkbox = document.getElementById(elements[i]);
-          checkbox.checked = prefElt.checked;
-        }
-      }
-    
-      function onDialogAccept()
-      {
-        for (var i = 0; i < elements.length; ++i) {
-          var prefElt = window.opener.document.getElementById(elements[i]);
-          var checkbox = document.getElementById(elements[i]);
-          prefElt.checked = checkbox.checked;
-        }
-      }
-    ]]>
-    </script>
-
-    <label value="&allowScripts.label;"/>
-
-    <listbox flex="1" rows="6">
-      <listitem type="checkbox" id="allowWindowMoveResize" label="&allowWindowMoveResize.label;"/>          
-      <listitem type="checkbox" id="allowWindowFlip" label="&allowWindowFlip.label;"/>          
-      <listitem type="checkbox" id="allowControlContextMenu" label="&allowControlContextMenu.label;"/>
-      <listitem type="checkbox" id="allowHideStatusBar" label="&allowHideStatusBar.label;"/>          
-      <listitem type="checkbox" id="allowWindowStatusChange" label="&allowWindowStatusChange.label;"/>   
-      <listitem type="checkbox" id="allowImageSrcChange" label="&allowWindowImageSrcChange.label;"/>     
-    </listbox>
-        
-</dialog>
Index: browser/components/prefwindow/content/pref-calibrate-screen.xul
===================================================================
RCS file: browser/components/prefwindow/content/pref-calibrate-screen.xul
diff -N browser/components/prefwindow/content/pref-calibrate-screen.xul
--- browser/components/prefwindow/content/pref-calibrate-screen.xul	1 Feb 2005 17:36:51 -0000	1.4
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,85 +0,0 @@
-<?xml version="1.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 Communicator client code, released
-# March 31, 1998.
-#
-# The Initial Developer of the Original Code is
-# Netscape Communications Corporation.
-# Portions created by the Initial Developer are Copyright (C) 1998-2000
-# the Initial Developer. All Rights Reserved.
-#
-# Contributor(s):
-#
-# 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 *****
-  
-<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
-<?xul-overlay href="chrome://global/content/dialogOverlay.xul"?>
-
-<!DOCTYPE window SYSTEM "chrome://browser/locale/pref/pref-fonts.dtd" >
-
-<window id="calibrateScreen"
-        xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
-        title="&calibrateDialog.title;"
-        class="dialog" 
-        onload="Init();"
-        persist="screenX screenY">
-
-  <script type="application/x-javascript"
-          src="chrome://browser/content/pref/pref-fonts.js"/>
-
-  <vbox align="center">
-
-    <vbox id="horizRuler" width="300" height="30" style="margin: 10px; margin-bottom: 0px">
-      <hbox height="10px" style="border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid black;"/>
-      <hbox height="10px" style="border-top: 1px solid black; border-left: 1px solid black; border-right: 1px solid black;"/>
-    </vbox>
-
-    <hbox align="center">
-      <label value="&calibrate.instructions;"/>
-    </hbox>
-      
-    <separator class="thin"/>
-      
-    <hbox align="center">
-      <textbox id="horizSize" size="5"/>
-      <menulist id="units" persist="value">
-        <menupopup>
-          <menuitem value="centimetres" label="&units.centimetres;"/>
-          <menuitem value="inches" label="&units.inches;"/>
-        </menupopup>
-      </menulist>              
-
-    </hbox>
-    
-    <separator/>
-
-    <keyset id="dialogKeys"/>
-    <hbox id="okCancelButtonsRight"/>
-
-  </vbox>
-  
-</window>
Index: browser/components/prefwindow/content/pref-connection.js
===================================================================
RCS file: browser/components/prefwindow/content/pref-connection.js
diff -N browser/components/prefwindow/content/pref-connection.js
--- browser/components/prefwindow/content/pref-connection.js	1 Feb 2005 17:36:51 -0000	1.5
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,232 +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 Communicator client code, released
-# March 31, 1998.
-#
-# The Initial Developer of the Original Code is
-# Netscape Communications Corporation.
-# Portions created by the Initial Developer are Copyright (C) 1998-1999
-# the Initial Developer. All Rights Reserved.
-#
-# Contributor(s):
-#
-# 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 _elementIDs = ["networkProxyType",
-                    "networkProxyFTP", "networkProxyFTP_Port",
-                    "networkProxyGopher", "networkProxyGopher_Port",
-                    "networkProxyHTTP", "networkProxyHTTP_Port", 
-                    "networkProxySOCKS", "networkProxySOCKS_Port",
-                    "networkProxySOCKSVersion",
-                    "networkProxySSL", "networkProxySSL_Port", 
-                    "networkProxyNone", "networkProxyAutoconfigURL", "shareAllProxies"];
-
-function Startup()
-{
-  DoEnabling();
-}
-
-function DoEnabling()
-{
-  var i;
-  var ftp = document.getElementById("networkProxyFTP");
-  var ftpPort = document.getElementById("networkProxyFTP_Port");
-  var gopher = document.getElementById("networkProxyGopher");
-  var gopherPort = document.getElementById("networkProxyGopher_Port");
-  var http = document.getElementById("networkProxyHTTP");
-  var httpPort = document.getElementById("networkProxyHTTP_Port");
-  var socks = document.getElementById("networkProxySOCKS");
-  var socksPort = document.getElementById("networkProxySOCKS_Port");
-  var socksVersion = document.getElementById("networkProxySOCKSVersion");
-  var socksVersion4 = document.getElementById("networkProxySOCKSVersion4");
-  var socksVersion5 = document.getElementById("networkProxySOCKSVersion5");
-  var ssl = document.getElementById("networkProxySSL");
-  var sslPort = document.getElementById("networkProxySSL_Port");
-  var noProxy = document.getElementById("networkProxyNone");
-  var autoURL = document.getElementById("networkProxyAutoconfigURL");
-  var autoReload = document.getElementById("autoReload");
-  var shareAllProxies = document.getElementById("shareAllProxies");
-
-  // convenience arrays
-  var manual = [ftp, ftpPort, gopher, gopherPort, http, httpPort, socks, socksPort, socksVersion, socksVersion4, socksVersion5, ssl, sslPort, noProxy, shareAllProxies];
-  var manual2 = [http, httpPort, noProxy, shareAllProxies];
-  var auto = [autoURL, autoReload];
-
-  // radio buttons
-  var radiogroup = document.getElementById("networkProxyType");
-
-  switch ( radiogroup.value ) {
-    case "0":
-    case "4":
-      for (i = 0; i < manual.length; i++)
-        manual[i].setAttribute( "disabled", "true" );
-      for (i = 0; i < auto.length; i++)
-        auto[i].setAttribute( "disabled", "true" );
-      break;
-    case "1":
-      for (i = 0; i < auto.length; i++)
-        auto[i].setAttribute( "disabled", "true" );
-      if (!radiogroup.disabled && !shareAllProxies.checked) {
-        for (i = 0; i < manual.length; i++) {
-           prefstring = manual[i].getAttribute( "prefstring" );
-           if (!window.opener.top.hPrefWindow.getPrefIsLocked(prefstring))
-             manual[i].removeAttribute( "disabled" );
-        }
-      } else {
-        for (i = 0; i < manual.length; i++)
-          manual[i].setAttribute("disabled", "true");
-        for (i = 0; i < manual2.length; i++) {
-           prefstring = manual2[i].getAttribute( "prefstring" );
-           if (!window.opener.top.hPrefWindow.getPrefIsLocked(prefstring))
-             manual2[i].removeAttribute( "disabled" );
-        }
-      }
-      break;
-    case "2":
-    default:
-      for (i = 0; i < manual.length; i++)
-        manual[i].setAttribute("disabled", "true");
-      if (!radiogroup.disabled)
-        for (i = 0; i < auto.length; i++)
-          auto[i].removeAttribute("disabled");
-      break;
-  }
-}
-
-const nsIProtocolProxyService = Components.interfaces.nsIProtocolProxyService;
-const kPROTPROX_CID = '{e9b301c0-e0e4-11D3-a1a8-0050041caf44}';
-
-function ReloadPAC() 
-{
-  var autoURL = document.getElementById("networkProxyAutoconfigURL");
-  var pps = Components.classesByID[kPROTPROX_CID]
-                       .getService(nsIProtocolProxyService);
-  pps.configureFromPAC(autoURL.value);
-}   
-
-function onConnectionsDialogOK()
-{
-  var autoURL = document.getElementById("networkProxyAutoconfigURL");
-  var URIFixup = Components.classes["@mozilla.org/docshell/urifixup;1"]
-                           .getService(Components.interfaces.nsIURIFixup);
-  try {
-    var fixedUpURI = URIFixup.createFixupURI(autoURL.value, 0);
-    autoURL.value = fixedUpURI.spec;
-  }
-  catch(ex) {
-  }
-
-  window.opener.top.hPrefWindow.wsm.savePageData(window.location.href, window);
-  
-  return true;
-}
-
-var oldUrls = ["","",""];
-var oldPorts = ["0","0","0"];
-
-function toggleProxySettings()
-{
-  var http = document.getElementById("networkProxyHTTP");
-  var httpPort = document.getElementById("networkProxyHTTP_Port");
-  var ftp = document.getElementById("networkProxyFTP");
-  var ftpPort = document.getElementById("networkProxyFTP_Port");
-  var gopher = document.getElementById("networkProxyGopher");
-  var gopherPort = document.getElementById("networkProxyGopher_Port");
-  var ssl = document.getElementById("networkProxySSL");
-  var sslPort = document.getElementById("networkProxySSL_Port");
-  var socks = document.getElementById("networkProxySOCKS");
-  var socksPort = document.getElementById("networkProxySOCKS_Port");
-  var socksVersion = document.getElementById("networkProxySOCKSVersion");
-  var socksVersion4 = document.getElementById("networkProxySOCKSVersion4");
-  var socksVersion5 = document.getElementById("networkProxySOCKSVersion5");
-  
-  // arrays
-  var urls = [ftp,gopher,ssl];
-  var ports = [ftpPort,gopherPort,sslPort];
-  var allFields = [ftp,gopher,ssl,ftpPort,gopherPort,sslPort,socks,socksPort,socksVersion,socksVersion4,socksVersion5];
-
-  if (document.getElementById("shareAllProxies").checked) {
-    for (i = 0; i < allFields.length; i++)
-      allFields[i].setAttribute("disabled", "true");
-    for (i = 0; i < urls.length; i++) {
-      oldUrls[i] = urls[i].value;
-      prefstring = urls[i].getAttribute("prefstring");
-      if (!window.opener.top.hPrefWindow.getPrefIsLocked(prefstring))
-        urls[i].value = http.value;
-    }
-    for (i = 0; i < ports.length; i++) {
-      oldPorts[i] = ports[i].value;
-      prefstring = ports[i].getAttribute("prefstring");
-      if (!window.opener.top.hPrefWindow.getPrefIsLocked(prefstring))
-        ports[i].value = httpPort.value;
-    }
-  } else {
-    for (i = 0; i < allFields.length; i++) {
-      prefstring = allFields[i].getAttribute("prefstring");
-      if (!window.opener.top.hPrefWindow.getPrefIsLocked(prefstring))
-        allFields[i].removeAttribute("disabled");
-    }
-    for (i = 0; i < urls.length; i++) {
-      prefstring = urls[i].getAttribute("prefstring");
-      if (!window.opener.top.hPrefWindow.getPrefIsLocked(prefstring))
-        urls[i].value = oldUrls[i];
-    }
-    for (i = 0; i < ports.length; i++) {
-      prefstring = ports[i].getAttribute("prefstring");
-      if (!window.opener.top.hPrefWindow.getPrefIsLocked(prefstring))
-        ports[i].value = oldPorts[i];
-    }
-  }
-}
-
-function copyProxySettings()
-{
-  if (!document.getElementById("shareAllProxies").checked)
-    return;
-  
-  var http = document.getElementById("networkProxyHTTP");
-  var httpPort = document.getElementById("networkProxyHTTP_Port");
-  var ftp = document.getElementById("networkProxyFTP");
-  var ftpPort = document.getElementById("networkProxyFTP_Port");
-  var gopher = document.getElementById("networkProxyGopher");
-  var gopherPort = document.getElementById("networkProxyGopher_Port");
-  var ssl = document.getElementById("networkProxySSL");
-  var sslPort = document.getElementById("networkProxySSL_Port");
-  
-  var urls = [ftp,gopher,ssl];
-  var ports = [ftpPort,gopherPort,sslPort];
-  
-  for (i = 0; i < urls.length; i++) {
-    prefstring = urls[i].getAttribute("prefstring");
-    if (!window.opener.top.hPrefWindow.getPrefIsLocked(prefstring))
-      urls[i].value = http.value;
-  }
-  for (i = 0; i < ports.length; i++) {
-    prefstring = ports[i].getAttribute("prefstring");
-    if (!window.opener.top.hPrefWindow.getPrefIsLocked(prefstring))
-      ports[i].value = httpPort.value;
-  }
-}
Index: browser/components/prefwindow/content/pref-connection.xul
===================================================================
RCS file: browser/components/prefwindow/content/pref-connection.xul
diff -N browser/components/prefwindow/content/pref-connection.xul
--- browser/components/prefwindow/content/pref-connection.xul	1 Feb 2005 17:36:51 -0000	1.9
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,168 +0,0 @@
-<?xml version="1.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 Communicator client code, released
-# March 31, 1998.
-#
-# The Initial Developer of the Original Code is
-# Netscape Communications Corporation.
-# Portions created by the Initial Developer are Copyright (C) 1998-1999
-# the Initial Developer. All Rights Reserved.
-#
-# Contributor(s):
-#   Jason Eager <jce2@po.cwru.edu>
-#
-# 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 *****
-
-<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
-
-<!DOCTYPE window SYSTEM "chrome://browser/locale/pref/pref-connection.dtd" >
-<dialog xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
-        onload="window.opener.top.initPanel('chrome://browser/content/pref/pref-connection.xul', window);"
-        buttons="accept,cancel" ondialogaccept="return onConnectionsDialogOK(event);"
-        title="&lHeader;">
-        
-  <stringbundle id="bundle_prefutilities"
-                src="chrome://pref/locale/prefutilities.properties"/>
-  <script type="application/x-javascript" src="chrome://browser/content/pref/pref-connection.js"/>
-  
-  <groupbox>
-    <caption label="&proxyTitle.label;"/>
-
-    <radiogroup id="networkProxyType" prefstring="network.proxy.type">
-        <radio value="0" label="&directTypeRadio.label;" accesskey="&directTypeRadio.accesskey;" oncommand="DoEnabling();"/>
-        <radio value="4" label="&WPADTypeRadio.label;" accesskey="&WPADTypeRadio.accesskey;" oncommand="DoEnabling()"/>
-        <radio value="1" label="&manualTypeRadio.label;" accesskey="&manualTypeRadio.accesskey;" oncommand="DoEnabling();"/>
-      <grid class="indent" flex="1">
-        <columns>
-          <column/>
-          <column flex="1"/>
-        </columns>
-        
-        <rows>
-          <row>
-            <hbox/>
-            <hbox>
-              <checkbox id="shareAllProxies" oncommand="toggleProxySettings();" 
-                        label="&shareproxy.label;" accesskey="&shareproxy.accesskey;"
-                        preftype="bool" prefstring="network.proxy.share_proxy_settings"/>
-            </hbox>
-          </row>
-          <row align="center">
-            <hbox align="center" pack="end">
-              <label value="&http.label;" accesskey="&http.accesskey;" control="networkProxyHTTP"/>
-            </hbox>
-            <hbox align="center">
-              <textbox id="networkProxyHTTP" preftype="string" prefstring="network.proxy.http"
-                       flex="1" onblur="copyProxySettings()"/>
-              <label value="&port.label;" accesskey="&HTTPport.accesskey;" control="networkProxyHTTP_Port"/>
-              <textbox id="networkProxyHTTP_Port" preftype="int" prefstring="network.proxy.http_port"
-                       size="5" onblur="copyProxySettings()"/>
-            </hbox>
-          </row>
-          <row align="center">
-            <hbox align="center" pack="end">
-              <label value="&ssl.label;" accesskey="&ssl.accesskey;" control="networkProxySSL"/>
-            </hbox>
-            <hbox align="center">
-              <textbox id="networkProxySSL" preftype="string" prefstring="network.proxy.ssl"
-                       flex="1"/>
-              <label value="&port.label;" accesskey="&SSLport.accesskey;" control="networkProxySSL_Port"/>
-              <textbox id="networkProxySSL_Port" preftype="int" prefstring="network.proxy.ssl_port"
-                       size="5"/>
-            </hbox>
-          </row>
-          <row align="center">
-            <hbox align="center" pack="end">
-              <label value="&ftp.label;" accesskey="&ftp.accesskey;" control="networkProxyFTP"/>
-            </hbox>
-            <hbox align="center">
-              <textbox id="networkProxyFTP" preftype="string" prefstring="network.proxy.ftp"
-                       flex="1"/>
-              <label value="&port.label;" accesskey="&FTPport.accesskey;" control="networkProxyFTP_Port"/>
-              <textbox id="networkProxyFTP_Port" preftype="int" prefstring="network.proxy.ftp_port"
-                       size="5"/>
-            </hbox>
-          </row>
-          <row align="center">
-            <hbox align="center" pack="end">
-              <label value="&gopher.label;" accesskey="&gopher.accesskey;" control="networkProxyGopher"/>
-            </hbox>
-            <hbox align="center">
-              <textbox id="networkProxyGopher" preftype="string" prefstring="network.proxy.gopher"
-                       flex="1"/>
-              <!-- gopher port doesn't have an accesskey because the window needs a redesign - bbaetz -->
-              <label value="&port.label;" accesskey="&gopherPort.accesskey;" control="networkProxyGopher_Port"/>
-              <textbox id="networkProxyGopher_Port" preftype="int" prefstring="network.proxy.gopher_port"
-                       size="5"/>
-            </hbox>
-          </row>
-          <row align="center">
-            <hbox align="center" pack="end">
-              <label value="&socks.label;" accesskey="&socks.accesskey;" control="networkProxySOCKS"/>
-            </hbox>
-            <hbox align="center">
-              <textbox id="networkProxySOCKS" preftype="string" prefstring="network.proxy.socks"
-                       flex="1"/>
-            <label value="&port.label;" accesskey="&SOCKSport.accesskey;" control="networkProxySOCKS_Port"/>
-              <textbox id="networkProxySOCKS_Port" preftype="int" prefstring="network.proxy.socks_port"
-                       size="5"/>
-            </hbox>
-          </row>
-          <row>
-            <spacer/>
-            <radiogroup id="networkProxySOCKSVersion" orient="horizontal"
-                        prefstring="network.proxy.socks_version">
-                <radio id="networkProxySOCKSVersion4" value="4" label="&socks4.label;" accesskey="&socks4.accesskey;" />
-                <radio id="networkProxySOCKSVersion5" value="5" label="&socks5.label;" accesskey="&socks5.accesskey;" />
-            </radiogroup>
-          </row>
-
-          <row align="center"> 
-            <hbox align="center" pack="end">
-              <label value="&noproxy.label;" accesskey="&noproxy.accesskey;" control="networkProxyNone"/>
-            </hbox>
-            <textbox id="networkProxyNone" preftype="string" prefstring="network.proxy.no_proxies_on"/>
-          </row>
-          <row>
-            <spacer/>
-            <label value="&noproxyExplain.label;" control="networkProxyNone"/>
-          </row>
-        </rows>
-      </grid>
-      <radio value="2" label="&autoTypeRadio.label;" accesskey="&autoTypeRadio.accesskey;" oncommand="DoEnabling();"/>
-      <hbox class="indent" flex="1" align="center">
-        <textbox id="networkProxyAutoconfigURL" flex="1" 
-                 preftype="string" prefstring="network.proxy.autoconfig_url"/>
-        <button id="autoReload" label="&reload.label;" accesskey="&reload.accesskey;"
-                oncommand="ReloadPAC();"
-                prefstring="pref.advanced.proxies.disable_button.reload"/>
-      </hbox>
-    </radiogroup>
-
-  </groupbox>
-</dialog>
-
Index: browser/components/prefwindow/content/pref-extensions.js
===================================================================
RCS file: browser/components/prefwindow/content/pref-extensions.js
diff -N browser/components/prefwindow/content/pref-extensions.js
--- browser/components/prefwindow/content/pref-extensions.js	1 Feb 2005 17:36:51 -0000	1.6
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,142 +0,0 @@
-# -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
-# ***** 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.org Code.
-#
-# The Initial Developer of the Original Code is
-# Doron Rosenberg.
-# Portions created by the Initial Developer are Copyright (C) 2001
-# the Initial Developer. All Rights Reserved.
-#
-# Contributor(s):
-#
-# 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 *****
-
-try {
-  var chromeRegistry = Components.classes["@mozilla.org/chrome/chrome-registry;1"].getService();
-  if (chromeRegistry)
-    chromeRegistry = chromeRegistry.QueryInterface(Components.interfaces.nsIXULChromeRegistry);
-}
-catch(e) {}
-
-function Startup()
-{
-  var extList = document.getElementById("extList");
-  for (var i = 0; i < extList.childNodes.length; ++i) {
-    if (extList.childNodes[i].getAttribute("name")) {
-      extList.selectItem(extList.childNodes[i]);
-      break;
-    }
-  }
-}
-
-function extensionSelect()
-{
-  var list = document.getElementById("extList");
-
-  if (!list)
-    return;
-
-  var selectedItem = list.selectedItems.length ? list.selectedItems[0] : null;
-  if (selectedItem) {
-    var extName = selectedItem.getAttribute("displayName");
-    var nameField = document.getElementById("extDisplayName");
-    var author = document.getElementById("extAuthor");
-    var descText = document.createTextNode(selectedItem.getAttribute("description"));
-    var description = document.getElementById("extDescription");
-    var uninstallButton = document.getElementById("uninstallExtension");
-    var settingsButton = document.getElementById("extensionSettings");
-
-    while (description.hasChildNodes())
-      description.removeChild(description.firstChild);
-
-    nameField.setAttribute("value", extName);
-
-    author.setAttribute("value", selectedItem.getAttribute("author"));
-    var authorURL = selectedItem.getAttribute("authorURL");
-    if (authorURL != "") {
-      author.setAttribute("link", selectedItem.getAttribute("authorURL"));
-      author.className = "themesLink";
-    }
-    else {
-      author.removeAttribute("link");
-      author.className = "";
-    }
-
-    settingsButton.disabled = selectedItem.getAttribute("settingsURL") == "";
-
-    description.appendChild(descText);
-
-    updateDisableExtButton(selectedItem);
-  }
-}
-
-function toggleExtension()
-{
-  var list = document.getElementById("extList");
-
-  if (!list)
-    return;
-
-  var selectedItem = list.selectedItems.length ? list.selectedItems[0] : null;
-  if (selectedItem) {
-    var disabled = (selectedItem.getAttribute("disabledState") == "true");
-    chromeRegistry.setAllowOverlaysForPackage(selectedItem.getAttribute("name"), disabled);
-    updateDisableExtButton(selectedItem);
-  }
-}
-
-function updateDisableExtButton(item)
-{
-  var disableButton = document.getElementById("disableExtension");
-  if (disableButton.disabled)
-    disableButton.disabled = false;
-
-  var prefbundle = document.getElementById("bundle_prefutilities");
-  var enableExtension = prefbundle.getString("enableExtension");
-  var disableExtension = prefbundle.getString("disableExtension");
-
-  if (item.getAttribute("disabledState") == "true")
-    disableButton.setAttribute("label", enableExtension);
-  else
-    disableButton.setAttribute("label", disableExtension);
-}
-
-function showSettings()
-{
-  var list = document.getElementById("extList");
-  var selectedItem = list.selectedItems.length ? list.selectedItems[0] : null;
-  if (selectedItem)
-    window.openDialog(selectedItem.getAttribute("settingsURL"), "", "chrome,dialog,modal");
-}
-
-function onDoubleClick(event)
-{
-  var settingsButton = document.getElementById("extensionSettings");
-
-  if (!settingsButton.disabled)
-    showSettings();
-}
Index: browser/components/prefwindow/content/pref-extensions.xul
===================================================================
RCS file: browser/components/prefwindow/content/pref-extensions.xul
diff -N browser/components/prefwindow/content/pref-extensions.xul
--- browser/components/prefwindow/content/pref-extensions.xul	1 Feb 2005 17:36:51 -0000	1.11
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,96 +0,0 @@
-<?xml version="1.0"?> 
-# -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
-# ***** 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.org Code.
-#
-# The Initial Developer of the Original Code is
-# Doron Rosenberg.
-# Portions created by the Initial Developer are Copyright (C) 2001
-# the Initial Developer. All Rights Reserved.
-#
-# Contributor(s):
-#
-# 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 *****
-
-<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
-<?xml-stylesheet href="chrome://mozapps/skin/pref/pref.css" type="text/css"?>
-<?xml-stylesheet href="chrome://browser/skin/pref/pref.css" type="text/css"?>
-
-<!DOCTYPE page SYSTEM "chrome://browser/locale/pref/pref-extensions.dtd" >
-
-<page xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
-      xmlns:html="http://www.w3.org/1999/xhtml"
-      onload="parent.initPanel('chrome://browser/content/pref/pref-extensions.xul'); Startup()"
-      headertitle="&lHeader;">
-
-  <stringbundle id="bundle_prefutilities" src="chrome://browser/locale/pref/prefutilities.properties"/>
-  <script type="application/x-javascript" src="chrome://browser/content/pref/pref-extensions.js"/>
-  <script type="application/x-javascript" src="chrome://global/content/globalOverlay.js"/>
-
-  <vbox flex="1">
-    <label value="&extensionTitle.label;"/>
-
-    <listbox id="extList" datasources="rdf:chrome" 
-          onselect="extensionSelect();" flex="1"
-          ondblclick="if (isValidLeftClick(event,'listitem')) onDoubleClick(event);"
-          ref="urn:mozilla:package:root" rows="10">
-      <template xmlns:chrome="http://www.mozilla.org/rdf/chrome">
-        <rule chrome:extension="true">
-          <listitem uri="..."
-                    label="rdf:http://www.mozilla.org/rdf/chrome#displayName"
-                    author="rdf:http://www.mozilla.org/rdf/chrome#author"
-                    authorURL="rdf:http://www.mozilla.org/rdf/chrome#authorURL"
-                    settingsURL="rdf:http://www.mozilla.org/rdf/chrome#settingsURL"
-                    displayName="rdf:http://www.mozilla.org/rdf/chrome#displayName"
-                    name="rdf:http://www.mozilla.org/rdf/chrome#name"
-                    description="rdf:http://www.mozilla.org/rdf/chrome#description"
-                    disabledState="rdf:http://www.mozilla.org/rdf/chrome#disabled"/>
-        </rule>
-      </template>
-    </listbox>
-
-    <separator class="thin"/>
-    <vbox flex="1" class="extensionInfoArea listBox" style="overflow:auto;">
-      <label class="header" id="extDisplayName" value=""/>
-      <hbox pack="start">
-        <label id="extAuthor" tooltip="&author.tooltip;" onclick="parent.visitLink(event);"/>
-      </hbox>
-      <description id="extDescription" flex="1"/>
-    </vbox>
-    <separator/>
-    <hbox align="center">
-      <html:a class="themesLink" link="&getnew.url;" onclick="parent.visitLink(event);"
-          style="padding-left:4px; display: block;" tooltip="&getnew.tooltip;">&getNewExtensions.label;</html:a>
-      <spacer flex="1"/>
-      <button disabled="true" id="extensionSettings" label="&extensionSettings.label;" oncommand="showSettings();"/>
-      <button disabled="true" id="disableExtension" label="&disableExtension.label;" oncommand="toggleExtension();"/>
-      <button disabled="true" label="&uninstallExtension.label;" oncommand="uninstallExtension();" hidden="true"/>
-    </hbox>
-  </vbox>
-
-</page>
-
Index: browser/components/prefwindow/content/pref-features-images.js
===================================================================
RCS file: browser/components/prefwindow/content/pref-features-images.js
diff -N browser/components/prefwindow/content/pref-features-images.js
--- browser/components/prefwindow/content/pref-features-images.js	1 Feb 2005 17:36:51 -0000	1.3
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,51 +0,0 @@
-# -*- Mode: C++; 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 Communicator client code, released
-# March 31, 1998.
-#
-# The Initial Developer of the Original Code is
-# Netscape Communications Corporation.
-# Portions created by the Initial Developer are Copyright (C) 1998
-# the Initial Developer. All Rights Reserved.
-#
-# Contributor(s):
-#   Blake Ross (original author)
-#
-# 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 permType = "image";
-
-function Startup()
-{
-  loadPermissions();
-}
-
-function onOK() {
-  window.opener.top.wsm.savePageData(window.location.href, window);
-  window.opener.top.hPrefWindow.registerOKCallbackFunc(window.opener.onImagePrefsOK);
-}
Index: browser/components/prefwindow/content/pref-features-images.xul
===================================================================
RCS file: browser/components/prefwindow/content/pref-features-images.xul
diff -N browser/components/prefwindow/content/pref-features-images.xul
--- browser/components/prefwindow/content/pref-features-images.xul	1 Feb 2005 17:36:51 -0000	1.4
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,81 +0,0 @@
-<?xml version="1.0"?> <!-- -*- Mode: SGML; indent-tabs-mode: nil -*- -->
-# ***** 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 Communicator client code, released
-# March 31, 1998.
-#
-# The Initial Developer of the Original Code is
-# Netscape Communications Corporation.
-# Portions created by the Initial Developer are Copyright (C) 1998-1999
-# the Initial Developer. All Rights Reserved.
-#
-# Contributor(s):
-#   Blake Ross (original author)
-#
-# 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 *****
-
-<?xml-stylesheet href="chrome://global/skin/" type="text/css"?> 
-
-<!DOCTYPE dialog SYSTEM "chrome://browser/locale/pref/pref-features-images.dtd" >
-
-<dialog id="ImagesManager"
-        buttons="accept,cancel"
-        title="&window.title;"
-        xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
-        style="width: 30em;"
-        onload="window.opener.top.initPanel(window.location.href, window);"
-        ondialogaccept="return onOK();"
-        persist="screenX screenY width height">
-
-  <script src="chrome://browser/content/pref/pref-features-images.js"/>
-  <script src="chrome://browser/content/pref/permissions.js"/>
-  <script src="chrome://browser/content/cookieviewer/treeUtils.js"/>
-
-  <stringbundle id="permBundle"
-                src="chrome://browser/locale/pref/prefutilities.properties"/>
-           
-  <tree id="permissionsTree" flex="1" style="height: 18em;"
-        hidecolumnpicker="true"
-        onkeypress="HandlePermissionKeyPress(event)"
-        onselect="PermissionSelected();">
-    <treecols>
-      <treecol id="siteCol" label="&treehead.sitename.label;" flex="5"
-                   onclick="PermissionColumnSort('rawHost', true);"/>
-      <splitter class="tree-splitter"/>
-      <treecol id="statusCol" label="&treehead.status.label;" flex="5"
-                   onclick="PermissionColumnSort('capability', true);"/>
-    </treecols>
-    <treechildren/>
-  </tree>
-  <hbox>
-    <button id="removePermission" disabled="true" 
-                  label="&removepermission.label;" 
-                  oncommand="DeletePermission();"/>
-    <button id="removeAllPermissions"
-                  label="&removeallpermissions.label;" 
-                  oncommand="DeleteAllPermissions();"/>
-  </hbox>
-</dialog>
Index: browser/components/prefwindow/content/pref-features.js
===================================================================
RCS file: browser/components/prefwindow/content/pref-features.js
diff -N browser/components/prefwindow/content/pref-features.js
--- browser/components/prefwindow/content/pref-features.js	1 Feb 2005 17:36:51 -0000	1.24
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,140 +0,0 @@
-# -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
-# ***** 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.org Code.
-#
-# The Initial Developer of the Original Code is
-# Doron Rosenberg.
-# Portions created by the Initial Developer are Copyright (C) 2001
-# the Initial Developer. All Rights Reserved.
-#
-# Contributor(s):
-#
-# 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 _elementIDs = ["advancedJavaAllow", "enableSoftwareInstall", 
-                   "enableJavaScript", "enableImagePref",
-                   "popupPolicy", "allowWindowMoveResize", 
-                   "allowWindowFlip", "allowControlContextMenu", 
-                   "allowHideStatusBar", "allowWindowStatusChange", 
-                   "allowImageSrcChange"];
-var gImagesPref, gImagesEnabled, gImagesRestricted;
-
-function Startup()
-{
-  updateButtons('popup', 'install', 'javascript');
-  
-  gImagesPref = document.getElementById("enableImagePref");
-  gImagesEnabled = document.getElementById("enableImages");
-  gImagesRestricted = document.getElementById("enableRestricted");
-  var prefValue = gImagesPref.getAttribute("value");
-  if (!prefValue)
-    prefValue = "1";
-  switch (prefValue) {
-  case "3": 
-    gImagesRestricted.checked = true;
-  case "1": 
-    gImagesEnabled.checked = true;
-    break;
-  }
-  if (!gImagesEnabled.checked)
-    gImagesRestricted.disabled = true;
-
-  if (parent.hPrefWindow.getPrefIsLocked("permissions.default.image")) {  
-    gImagesRestricted.disabled = true;
-    gImagesEnabled.disabled = true;
-  }
-}
-
-function updateImagePref()
-{
-  if (!parent.hPrefWindow.getPrefIsLocked("permissions.default.image")) {
-    if (!gImagesEnabled.checked) {
-      gImagesPref.setAttribute("value", 2)
-      gImagesRestricted.disabled = true;
-    } else {
-      gImagesPref.setAttribute("value", gImagesRestricted.checked ? 3 : 1)
-      gImagesRestricted.disabled = false;
-    }
-  } else {
-    gImagesRestricted.disabled = true;
-    gImagesEnabled.disabled = true;
-  }
-}
-
-function advancedJavaScript()
-{
-  openDialog("chrome://browser/content/pref/pref-advancedscripts.xul", "", 
-             "chrome,modal");
-}
-
-function updateButtons()
-{
-  var i;
-  var checkbox;
-  var button;
-
-  for (i=0; i < arguments.length; ++i) {
-    switch (arguments[i]) {
-    case "popup":
-      checkbox = document.getElementById("popupPolicy");
-      button   = document.getElementById("popupPolicyButton");
-      break;
-    case "install":
-      checkbox = document.getElementById("enableSoftwareInstall");
-      button   = document.getElementById("enableSoftwareInstallButton");
-      break;
-    case "javascript":
-      checkbox = document.getElementById("enableJavaScript");
-      button   = document.getElementById("advancedJavascript");
-      break;
-    }
-    button.disabled = !checkbox.checked;
-  }
-}
-
-var gExceptionsParams = {
-  install: { blockVisible: false, sessionVisible: false, allowVisible: true, prefilledHost: "", permissionType: "install" },
-  popup:   { blockVisible: false, sessionVisible: false, allowVisible: true, prefilledHost: "", permissionType: "popup"   },
-  image:   { blockVisible: true,  sessionVisible: false, allowVisible: true, prefilledHost: "", permissionType: "image"   },
-};
-
-function showExceptions(aEvent)
-{
-  var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"]
-                     .getService(Components.interfaces.nsIWindowMediator);
-  var existingWindow = wm.getMostRecentWindow("exceptions");
-  if (existingWindow) {
-    existingWindow.setHost("");
-    existingWindow.focus();
-  }
-  else {
-    const kURL = "chrome://browser/content/cookieviewer/CookieExceptions.xul";
-    var params = gExceptionsParams[aEvent.target.getAttribute("permissiontype")];
-    window.openDialog(kURL, "_blank", "chrome,modal,resizable=yes", params);
-  }
-}
-
Index: browser/components/prefwindow/content/pref-features.xul
===================================================================
RCS file: browser/components/prefwindow/content/pref-features.xul
diff -N browser/components/prefwindow/content/pref-features.xul
--- browser/components/prefwindow/content/pref-features.xul	1 Feb 2005 17:36:51 -0000	1.13
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,136 +0,0 @@
-<?xml version="1.0"?> 
-# -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
-# ***** 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.org Code.
-#
-# The Initial Developer of the Original Code is
-# Doron Rosenberg.
-# Portions created by the Initial Developer are Copyright (C) 2001
-# the Initial Developer. All Rights Reserved.
-#
-# Contributor(s):
-#   Ben Goodger <ben@netscape.com>
-#
-# 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 *****
-
-<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
-<?xml-stylesheet href="chrome://mozapps/skin/pref/pref.css" type="text/css"?>
-<?xml-stylesheet href="chrome://browser/skin/pref/pref.css" type="text/css"?>
-
-<!DOCTYPE window SYSTEM "chrome://browser/locale/pref/pref-features.dtd">
-<page xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
-      onload="parent.initPanel('chrome://browser/content/pref/pref-features.xul');"
-      headertitle="&lHeader;">
-
-  <script type="application/x-javascript" src="chrome://browser/content/pref/pref-features.js"/>
-  <script src="chrome://browser/content/cookieviewer/treeUtils.js"/>
-
-  <stringbundle id="stringBundle" src="chrome://browser/locale/pref/addPopup.properties"/>
-
-  <groupbox>
-    <grid>
-      <columns>
-        <column flex="1"/>
-        <column/>
-      </columns>
-      <rows>
-        <row>
-          <vbox align="start">
-            <checkbox id="popupPolicy"
-                      label="&popupReject.label;"
-                      oncommand="updateButtons('popup')"
-                      prefstring="dom.disable_open_during_load"
-                      accesskey="&popupReject.accesskey;"/>
-          </vbox>
-          <button id="popupPolicyButton" label="&allowedSites.label;"
-                  permissiontype="popup" oncommand="showExceptions(event);"/>
-        </row>
-        <row>
-          <vbox align="start">
-            <checkbox id="enableSoftwareInstall" label="&enableSoftwareUpdate.label;"
-                      oncommand="updateButtons('install')"
-                      accesskey="&enableSoftwareUpdate.accesskey;"
-                      prefstring="xpinstall.enabled"/>
-          </vbox>
-          <button id="enableSoftwareInstallButton" label="&allowedSites.label;"
-                  permissiontype="install" oncommand="showExceptions(event);"/>
-        </row>
-        <row>
-          <vbox align="start">
-            <checkbox id="enableImages"
-                      oncommand="updateImagePref()"
-                      label="&enableImages.label;"
-                      accesskey="&enableImages.accesskey;"/>
-            <checkbox id="enableRestricted"
-                      label="&forOriginatingSiteOnly.label;"
-                      accesskey="&forOriginatingSiteOnly.accesskey;"
-                      oncommand="updateImagePref()"
-                      style="margin-left: 23px;"/>
-            <data id="enableImagePref" preftype="int" prefstring="permissions.default.image"/>
-          </vbox>
-          <vbox>
-            <button label="&exceptions.label;"
-                    permissiontype="image" oncommand="showExceptions(event);"
-                    id="manageImages" prefstring="pref.advanced.images.disable_button.view_image"/>
-          </vbox>
-        </row>
-        <separator class="thin"/>
-        <row>
-          <vbox align="start">
-            <checkbox id="advancedJavaAllow" label="&enbJavaCheck.label;" accesskey="&enbJavaCheck.accesskey;"
-                      prefstring="security.enable_java"/>
-          </vbox>
-        </row>
-        <row>
-          <vbox align="start">
-            <checkbox id="enableJavaScript" label="&enableJavaScript.label;" accesskey="&enableJavaScript.accesskey;"
-                      prefstring="javascript.enabled"
-                      oncommand="updateButtons('javascript');"/>
-            <spring flex="1"/>
-            
-            <checkbox id="allowWindowMoveResize" hidden="true"
-                      reversed="true" prefstring="dom.disable_window_move_resize"/>
-            <checkbox id="allowWindowFlip" hidden="true"
-                      reversed="true" prefstring="dom.disable_window_flip"/>
-            <checkbox id="allowControlContextMenu" hidden="true"
-                      prefstring="dom.event.contextmenu.enabled"/>
-            <checkbox id="allowHideStatusBar" hidden="true"
-                      reversed="true" prefstring="dom.disable_window_open_feature.status"/>
-            <checkbox id="allowWindowStatusChange" hidden="true"
-                      reversed="true" prefstring="dom.disable_window_status_change"/>
-            <checkbox id="allowImageSrcChange" hidden="true"
-                      reversed="true" prefstring="dom.disable_image_src_set"/>
-          </vbox>
-          <button id="advancedJavascript" label="&advancedJavaScript.label;" accesskey="&advancedJavaScript.accesskey;"
-                  oncommand="advancedJavaScript();" class="uniWidthButton"/>
-        </row>
-      </rows>
-    </grid>
-  </groupbox>  
-
-</page>
-
Index: browser/components/prefwindow/content/pref-fonts.js
===================================================================
RCS file: browser/components/prefwindow/content/pref-fonts.js
diff -N browser/components/prefwindow/content/pref-fonts.js
--- browser/components/prefwindow/content/pref-fonts.js	1 Feb 2005 17:36:51 -0000	1.20
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,668 +0,0 @@
-# -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
-# ***** 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.org code.
-#
-# The Initial Developer of the Original Code is
-# Netscape Communications Corporation.
-# Portions created by the Initial Developer are Copyright (C) 1998
-# the Initial Developer. All Rights Reserved.
-#
-# Contributor(s):
-#   Gervase Markham <gerv@gerv.net>
-#   Tuukka Tolvanen <tt@lament.cjb.net>
-#
-# 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 *****
-
-try
-  {
-    var pref = Components.classes["@mozilla.org/preferences;1"].getService( Components.interfaces.nsIPref );
-  }
-catch(e)
-  {
-    dump("failed to get font list or pref object: "+e+" in pref-fonts.js\n");
-  }
-
-var fontEnumerator = null;
-var globalFonts = null;
-var fontTypes   = ["serif", "sans-serif", "monospace"];
-var defaultFont, variableSize, fixedSize, minSize, languageList;
-var languageData = [];
-var currentLanguage;
-var gPrefutilitiesBundle;
-var gPrefWindow = window.opener.parent.hPrefWindow;
-
-// manual data retrieval function for PrefWindow
-function GetFields()
-  {
-    var dataObject = { };
-
-    // store data for language independent widgets
-    if( !( "dataEls" in dataObject ) )
-      dataObject.dataEls = new Object;
-    dataObject.dataEls[ "selectLangs" ] = new Object;
-    dataObject.dataEls[ "selectLangs" ].value = document.getElementById( "selectLangs" ).value;
-
-    dataObject.fontDPI = document.getElementById( "screenResolution" ).value;
-    dataObject.useMyFonts = document.getElementById( "useMyFonts" ).checked ? 1 : 0;
-
-    var items = ["foregroundText", "background", "unvisitedLinks", "visitedLinks", "browserUseSystemColors", "browserUnderlineAnchors", "useMyColors", "useMyFonts"];
-    for (i = 0; i < items.length; ++i)
-      dataObject.dataEls[items[i]] = new Object;
-    dataObject.dataEls["foregroundText"].value = document.getElementById("foregroundtextmenu").color;
-    dataObject.dataEls["background"].value = document.getElementById("backgroundmenu").color;
-    dataObject.dataEls["unvisitedLinks"].value = document.getElementById("unvisitedlinkmenu").color;
-    dataObject.dataEls["visitedLinks"].value = document.getElementById("visitedlinkmenu").color;
-
-    dataObject.dataEls["browserUseSystemColors"].checked = document.getElementById("browserUseSystemColors").checked;
-    dataObject.dataEls["browserUnderlineAnchors"].checked = document.getElementById("browserUnderlineAnchors").checked;
-    dataObject.dataEls["useMyColors"].checked = document.getElementById("useMyColors").checked;
-    dataObject.dataEls["useMyFonts"].checked = document.getElementById("useMyFonts").checked;
-
-    // save current state for language dependent fields and store
-    saveState();
-    dataObject.languageData = languageData;
-
-    return dataObject;
-  }
-
-// manual data setting function for PrefWindow
-function SetFields(aDataObject)
-  {
-    languageData = "languageData" in aDataObject ? aDataObject.languageData : languageData ;
-    currentLanguage = "currentLanguage" in aDataObject ? aDataObject.currentLanguage : null ;
-
-    var element = document.getElementById( "selectLangs" );
-    if( "dataEls" in aDataObject )
-      {
-        element.selectedItem = element.getElementsByAttribute( "value", aDataObject.dataEls[ "selectLangs" ].value )[0];
-      }
-    else
-      {
-        var prefstring = element.getAttribute( "prefstring" );
-        var preftype = element.getAttribute( "preftype" );
-        if( prefstring && preftype )
-          {
-            var prefvalue = gPrefWindow.getPref( preftype, prefstring );
-            element.selectedItem = element.getElementsByAttribute( "value", prefvalue )[0];
-          }
-      }
-
-    var screenResolution = document.getElementById( "screenResolution" );
-    var resolution;
-    if( "fontDPI" in aDataObject )
-      {
-        resolution = aDataObject.fontDPI;
-      }
-    else
-      {
-        prefvalue = gPrefWindow.getPref( "int", "browser.display.screen_resolution" );
-        if( prefvalue != "!/!ERROR_UNDEFINED_PREF!/!" )
-            resolution = prefvalue;
-        else
-            resolution = 96; // If it all goes horribly wrong, fall back on 96.
-      }
-    
-    setResolution( resolution );
-    
-    if ( gPrefWindow.getPrefIsLocked( "browser.display.screen_resolution" ) ) {
-        screenResolution.disabled = true;
-    }
-
-    if ( gPrefWindow.getPrefIsLocked( "browser.display.use_document_fonts" ) ) {
-        useMyFontsCheckbox.disabled = true;
-    }
-   if ("dataEls" in aDataObject) {
-     document.getElementById("foregroundtextmenu").color = aDataObject.dataEls["foregroundText"].value
-     document.getElementById("backgroundmenu").color = aDataObject.dataEls["background"].value;
-     document.getElementById("unvisitedlinkmenu").color = aDataObject.dataEls["unvisitedLinks"].value;
-     document.getElementById("visitedlinkmenu").color = aDataObject.dataEls["visitedLinks"].value;
- 
-     document.getElementById("browserUseSystemColors").checked = aDataObject.dataEls["browserUseSystemColors"].checked;
-     document.getElementById("browserUnderlineAnchors").checked = aDataObject.dataEls["browserUnderlineAnchors"].checked;
-     document.getElementById("useMyColors").checked = aDataObject.dataEls["useMyColors"].checked;
-     document.getElementById("useMyFonts").checked = aDataObject.dataEls["useMyFonts"].checked;
-   }
-   else {
-     var elt, prefstring;
-     var checkboxes = ["browserUseSystemColors", "browserUnderlineAnchors"];
-     for (i = 0; i < checkboxes.length; ++i) {
-       elt = document.getElementById(checkboxes[i]);
-       prefstring = elt.getAttribute( "prefstring" );
-       if( prefstring  ) {
-         prefvalue = gPrefWindow.getPref( "bool", prefstring );
-         elt.checked = prefvalue;
-       }
-     }
-     var colors = ["foregroundtextmenu", "backgroundmenu", "unvisitedlinkmenu", "visitedlinkmenu"];
-     for (i = 0; i < colors.length; ++i) {
-       elt = document.getElementById(colors[i]);
-       prefstring = elt.nextSibling.getAttribute("prefstring");
-       if (prefstring) {
-         prefvalue = gPrefWindow.getPref("color", prefstring);
-         elt.color = prefvalue;
-       }
-     }
-     var useDocColors = gPrefWindow.getPref("bool", "browser.display.use_document_colors");
-     document.getElementById("useMyColors").checked = !useDocColors;
-     var useDocFonts = gPrefWindow.getPref("int", "browser.display.use_document_fonts");
-     document.getElementById("useMyFonts").checked = !useDocFonts;
-
-   }
-}
-
-function Startup()
-  {
-    // Initialize the sub-dialog  
-    defaultFont  = document.getElementById( "proportionalFont" );
-    variableSize = document.getElementById( "sizeVar" );
-    fixedSize    = document.getElementById( "sizeMono" );
-    minSize      = document.getElementById( "minSize" );
-    languageList = document.getElementById( "selectLangs" );
-
-    gPrefutilitiesBundle = document.getElementById("bundle_prefutilities");
-
-    // eventually we should detect the default language and select it by default
-    selectLanguage();
-    
-    // Allow user to ask the OS for a DPI if we are under X or OS/2
-    if ((navigator.appVersion.indexOf("X11") != -1) || (navigator.appVersion.indexOf("OS/2") != -1))
-      {
-         document.getElementById( "systemResolution" ).removeAttribute( "hidden" ); 
-      }
-    
-    // Set up the labels for the standard issue resolutions
-    var resolution = document.getElementById( "screenResolution" );
-
-    // Set an attribute on the selected resolution item so we can fall back on
-    // it if an invalid selection is made (select "Other...", hit Cancel)
-    resolution.selectedItem.setAttribute("current", "true");
-
-    var defaultResolution;
-    var otherResolution;
-
-    // On OS/2, 120 is the default system resolution.
-    // 96 is valid, but used only for for 640x480.
-    if (navigator.appVersion.indexOf("OS/2") != -1)
-      {
-        defaultResolution = "120";
-        otherResolution = "96";
-        document.getElementById( "arbitraryResolution" ).setAttribute( "hidden", "true" ); 
-        document.getElementById( "resolutionSeparator" ).setAttribute( "hidden", "true" ); 
-      } else {
-        defaultResolution = "96";
-        otherResolution = "72";
-      }
-
-    var dpi = resolution.getAttribute( "dpi" );
-    resolution = document.getElementById( "defaultResolution" );
-    resolution.setAttribute( "value", defaultResolution );
-    resolution.setAttribute( "label", dpi.replace(/\$val/, defaultResolution ) );
-    resolution = document.getElementById( "otherResolution" );
-    resolution.setAttribute( "value", otherResolution );
-    resolution.setAttribute( "label", dpi.replace(/\$val/, otherResolution ) );
-
-    // Get the pref and set up the dialog appropriately. Startup is called
-    // after SetFields so we can't rely on that call to do the business.
-    var prefvalue = gPrefWindow.getPref( "int", "browser.display.screen_resolution" );
-    if( prefvalue != "!/!ERROR_UNDEFINED_PREF!/!" )
-        resolution = prefvalue;
-    else
-        resolution = 96; // If it all goes horribly wrong, fall back on 96.
-    
-    setResolution( resolution );
-
-    // This prefstring is a contrived pref whose sole purpose is to lock some
-    // elements in this panel.  The value of the pref is not used and does not matter.
-    if ( gPrefWindow.getPrefIsLocked( "browser.display.languageList" ) ) {
-      disableAllFontElements();
-    }
-  }
-  
-function onFontsDialogOK()
-  {
-    gPrefWindow.registerOKCallbackFunc(window.opener.saveFontPrefs);
-    gPrefWindow.wsm.savePageData(window.location.href, window);
-    return true;
-  }   
-
-function getFontEnumerator()
-  {
-    if (!fontEnumerator)
-      {
-        fontEnumerator = Components.classes["@mozilla.org/gfx/fontenumerator;1"]
-                        .createInstance()
-                        .QueryInterface(Components.interfaces.nsIFontEnumerator);
-      }
-    return fontEnumerator;
-  }
-
-function listElement( aListID )
-  {
-    this.listElement = document.getElementById( aListID );
-  }
-
-listElement.prototype =
-  {
-    clearList:
-      function ()
-        {
-          // remove the menupopup node child of the menulist.
-          this.listElement.removeChild( this.listElement.firstChild );
-        },
-
-    appendFontNames: 
-      function ( aLanguage, aFontType )
-        {
-          var i;
-          var defaultFont = null;
-          var count = { value: 0 };
-          var fonts = getFontEnumerator().EnumerateFonts( aLanguage, aFontType, count );
-          if (fonts.length > 0)
-            {
-              defaultFont = getFontEnumerator().getDefaultFont( aLanguage, aFontType );
-            }
-          else
-            {
-              // if no specific fonts, relax 'aFontType' and try to get other
-              // fonts for this language so that we can group them on top
-              fonts = getFontEnumerator().EnumerateFonts( aLanguage, "", count );
-              if (fonts.length > 0)
-                {
-                  defaultFont = getFontEnumerator().getDefaultFont( aLanguage, "" );
-                }
-            }
-
-          var itemNode = null;
-          var separatorNode = null;
-          var popupNode = document.createElement( "menupopup" ); 
-          if (fonts.length > 0)
-            {
-              // always put the default font at the front of the list
-              if (defaultFont)
-                {
-                  var label = gPrefutilitiesBundle
-                    .formatStringFromName("labelDefaultFont", defaultFont, 1);
-                  itemNode = document.createElement( "menuitem" );
-                  itemNode.setAttribute( "label", label );
-                  itemNode.setAttribute( "value", "" ); // special blank value
-                  popupNode.appendChild( itemNode );
-
-                  separatorNode = document.createElement( "menuseparator" );
-                  popupNode.appendChild( separatorNode );
-                }
-
-              for (i = 0; i < fonts.length; i++)
-                {
-                  itemNode = document.createElement( "menuitem" );
-                  itemNode.setAttribute( "value", fonts[i] );
-                  itemNode.setAttribute( "label", fonts[i] );
-                  popupNode.appendChild( itemNode );
-                }
-            }
-
-            // get all the fonts to complete the font lists
-            if (!globalFonts)
-              {
-                globalFonts = getFontEnumerator().EnumerateAllFonts( count );
-              }
-
-          // since the lists are sorted, we can get unique entries by just walking
-          // both lists linearly side-by-side, skipping those values already in
-          // the popup list
-          if (globalFonts.length > fonts.length)
-            {
-              var menuItem = separatorNode ? separatorNode.nextSibling : popupNode.firstChild; 
-              var menuValue = menuItem ? menuItem.getAttribute( "value" ) : null;
-
-              separatorNode = document.createElement( "menuseparator" );
-              popupNode.appendChild( separatorNode );
-              for (i = 0; i < globalFonts.length; i++)
-                {
-                  if (globalFonts[i] != menuValue)
-                    {
-                      itemNode = document.createElement( "menuitem" );
-                      itemNode.setAttribute( "value", globalFonts[i] );
-                      itemNode.setAttribute( "label", globalFonts[i] );
-                      popupNode.appendChild( itemNode );
-                    }
-                  else
-                    {
-                      menuItem = menuItem.nextSibling;
-                      menuValue = menuItem ? menuItem.getAttribute( "value" ) : null;
-                    }
-                }
-            }
-
-          this.listElement.appendChild( popupNode ); 
-
-          return popupNode.firstChild;
-        } 
-  };
-
-function lazyAppendFontNames( i )
-  {
-     // schedule the build of the next font list
-     if (i+1 < fontTypes.length)
-       {
-         window.setTimeout(lazyAppendFontNames, 100, i+1);
-       }
-
-     // now build and populate the fonts for the requested font type
-     var defaultItem = null;
-     var selectElement = new listElement( fontTypes[i] );
-     selectElement.clearList();
-     try
-       {
-         defaultItem = selectElement.appendFontNames( languageList.value, fontTypes[i] );
-       }
-     catch(e) {
-         dump("pref-fonts.js: " + e + "\nFailed to build the font list for " + fontTypes[i] + "\n");
-         return;
-       }
-
-     // now set the selected font item for the drop down list
-
-     if (!defaultItem)
-       return; // nothing to select, so no need to bother
-
-     // the item returned by default is our last resort fall-back
-     var selectedItem = defaultItem;
-     if( languageList.value in languageData )
-       {
-         // data exists for this language, pre-select items based on this information
-         var dataVal = languageData[languageList.value].types[fontTypes[i]];
-         if (!dataVal.length) // special blank means the default
-           {
-             selectedItem = defaultItem;
-           }
-         else
-           {
-             var dataEls = selectElement.listElement.getElementsByAttribute( "value", dataVal );
-             selectedItem = dataEls.item(0) ? dataEls[0] : defaultItem;
-           }
-       }
-     else
-       {
-         try
-           {
-             var fontPrefString = "font.name." + fontTypes[i] + "." + languageList.value;
-             var selectVal = gPrefWindow.pref.CopyUnicharPref( fontPrefString );
-             var dataEls = selectElement.listElement.getElementsByAttribute( "value", selectVal );
-
-             // we need to honor name-list in case name is unavailable 
-             if (!dataEls.item(0)) {
-                 var fontListPrefString = "font.name-list." + fontTypes[i] + "." + languageList.value;
-                 var nameList = gPrefWindow.pref.CopyUnicharPref( fontListPrefString );
-                 var fontNames = nameList.split(",");
-                 var stripWhitespace = /^\s*(.*)\s*$/;
-
-                 for (j = 0; j < fontNames.length; j++) {
-                   selectVal = fontNames[j].replace(stripWhitespace, "$1");
-                   dataEls = selectElement.listElement.getElementsByAttribute("value", selectVal);
-                   if (dataEls.item(0))  
-                     break;  // exit loop if we find one
-                 }
-             }
-             selectedItem = dataEls.item(0) ? dataEls[0] : defaultItem;
-           }
-         catch(e) {
-             selectedItem = defaultItem;
-           }
-       }
-
-     selectElement.listElement.selectedItem = selectedItem;
-     selectElement.listElement.removeAttribute( "disabled" );
-  }
-
-function saveState()
-  {
-    for( var i = 0; i < fontTypes.length; i++ )
-      {
-        // preliminary initialisation
-        if( currentLanguage && !( currentLanguage in languageData ) )
-          languageData[currentLanguage] = [];
-        if( currentLanguage && !( "types" in languageData[currentLanguage] ) )
-          languageData[currentLanguage].types = [];
-        // save data for the previous language
-        if( currentLanguage && currentLanguage in languageData &&
-            "types" in languageData[currentLanguage] )
-          languageData[currentLanguage].types[fontTypes[i]] = document.getElementById( fontTypes[i] ).value;
-      }
-
-    if( currentLanguage && currentLanguage in languageData &&
-        "types" in languageData[currentLanguage] )
-      {
-        languageData[currentLanguage].defaultFont = defaultFont.value;
-        languageData[currentLanguage].variableSize = parseInt( variableSize.value );
-        languageData[currentLanguage].fixedSize = parseInt( fixedSize.value );
-        languageData[currentLanguage].minSize = parseInt( minSize.value );
-      }
-  }
-
-// Selects size (or the nearest entry that exists in the list)
-// in the menulist minSize
-function minSizeSelect(size)
-  {
-    var items = minSize.getElementsByAttribute( "value", size );
-    if (items.item(0))
-      minSize.selectedItem = items[0];
-    else if (size < 6)
-      minSizeSelect(6);
-    else if (size > 24)
-      minSizeSelect(24);
-    else
-      minSizeSelect(size - 1);
-  }
-
-function selectLanguage()
-  {
-    // save current state
-    saveState();
-
-    if( currentLanguage == languageList.value )
-      return; // same as before, nothing changed
-    
-    currentLanguage = languageList.value;
-
-    // lazily populate the successive font lists at 100ms intervals.
-    // (Note: the third parameter to setTimeout() is going to be
-    // passed as argument to the callback function.)
-    window.setTimeout(lazyAppendFontNames, 100, 0);
-
-    // in the meantime, disable the menu lists
-    for( var i = 0; i < fontTypes.length; i++ )
-      {
-        var listElement = document.getElementById( fontTypes[i] );
-        listElement.setAttribute( "value", "" );
-        listElement.setAttribute( "label", "" );
-        listElement.setAttribute( "disabled", "true" );
-      }
-
-    // and set the default font type and the font sizes
-    var dataObject = gPrefWindow.wsm.dataManager.pageData["chrome://browser/content/pref/pref-fonts.xul"].userData;
-    var langData = null;
-    try
-      {
-        var defaultFontVal, sizeVarVal, sizeFixedVal;
-        if ('languageData' in dataObject) {
-          langData = dataObject.languageData[currentLanguage];
-          defaultFontVal = langData.defaultFont;
-          sizeVarVal = langData.variableSize;
-          sizeFixedVal = langData.fixedSize;
-        }
-        else {
-          defaultFontVal = gPrefWindow.getPref("string", "font.default." + languageList.value);
-          var variableSizePref = "font.size.variable." + languageList.value;
-          sizeVarVal = gPrefWindow.pref.GetIntPref( variableSizePref );
-          var fixedSizePref = "font.size.fixed." + languageList.value;
-          sizeFixedVal = gPrefWindow.pref.GetIntPref( fixedSizePref );
-        }
-        defaultFont.value = defaultFontVal;
-        variableSize.selectedItem = variableSize.getElementsByAttribute( "value", sizeVarVal )[0];
-        fixedSize.selectedItem = fixedSize.getElementsByAttribute( "value", sizeFixedVal )[0];
-      }
-    catch(e) { } // font size lists can simply default to the first entry
-
-    var minSizeVal = 0;
-    try 
-      {
-        if (langData) {
-          minSizeVal = langData.minSize;
-        }
-        else {        
-          var minSizePref = "font.minimum-size." + languageList.value;
-          minSizeVal = gPrefWindow.pref.GetIntPref( minSizePref );
-        }
-      }
-    catch(e) { }
-    minSizeSelect( minSizeVal );
-  }
-
-function changeScreenResolution()
-  {
-    var screenResolution = document.getElementById("screenResolution");
-    var userResolution = document.getElementById("userResolution");
-
-    var previousSelection = screenResolution.getElementsByAttribute("current", "true")[0];
-
-    if (screenResolution.value == "other")
-      {
-        // If the user selects "Other..." we bring up the calibrate screen dialog
-        var rv = { newdpi : 0 };
-        var calscreen = window.openDialog("chrome://browser/content/pref/pref-calibrate-screen.xul", 
-                                      "_blank", 
-                                      "modal,chrome,centerscreen,resizable=no,titlebar",
-                                      rv);
-        if (rv.newdpi != -1) 
-          {
-            // They have entered values, and we have a DPI value back
-            setResolution ( rv.newdpi );
-            previousSelection.removeAttribute("current");
-            screenResolution.selectedItem.setAttribute("current", "true");
-          }
-        else
-          {
-            // They've cancelled. We can't leave "Other..." selected, so...
-            // we re-select the previously selected item.
-            screenResolution.selectedItem = previousSelection;
-          }
-      }
-    else if (!(screenResolution.value == userResolution.value))
-      {
-        // User has selected one of the hard-coded resolutions
-        userResolution.setAttribute("hidden", "true");
-
-        previousSelection.removeAttribute("current");
-        screenResolution.selectedItem.setAttribute("current", "true");
-      }
-  }
-
-function setResolution( resolution )
-  {
-    // Given a number, if it's equal to a hard-coded resolution we use that,
-    // otherwise we set the userResolution field.
-    var screenResolution = document.getElementById( "screenResolution" );
-    var userResolution = document.getElementById( "userResolution" );
-
-    var items = screenResolution.getElementsByAttribute( "value", resolution );
-    if (items.item(0))
-      {
-        // If it's one of the hard-coded values, we'll select it directly 
-        screenResolution.selectedItem = items[0];
-        userResolution.setAttribute( "hidden", "true" );
-      }   
-    else
-      {
-        // Otherwise we need to set up the userResolution field
-        var dpi = screenResolution.getAttribute( "dpi" );
-        userResolution.setAttribute( "value", resolution );
-        userResolution.setAttribute( "label", dpi.replace(/\$val/, resolution) );
-        userResolution.removeAttribute( "hidden" );
-        screenResolution.selectedItem = userResolution;   
-      }
-  }
-  
-// "Calibrate screen" dialog code
-
-function Init()
-  {
-      sizeToContent();
-      doSetOKCancel(onOK, onCancel);
-      document.getElementById("horizSize").focus();
-  }
-  
-function onOK()
-  {
-    // Get value from the dialog to work out dpi
-    var horizSize = parseFloat(document.getElementById("horizSize").value);
-    var units = document.getElementById("units").value;
-  
-    if (!horizSize || horizSize < 0)
-      {
-        // We can't calculate anything without a proper value
-        window.arguments[0].newdpi = -1;
-        return true;
-      }
-      
-    // Convert centimetres to inches.
-    // The magic number is allowed because it's a fundamental constant :-)
-    if (units === "centimetres")
-      {
-        horizSize /= 2.54;
-      }
-  
-    // These shouldn't change, but you can't be too careful.
-    var horizBarLengthPx = document.getElementById("horizRuler").boxObject.width;
-  
-    var horizDPI = parseInt(horizBarLengthPx) / horizSize;
-  
-    // Average the two <shrug>.
-    window.arguments[0].newdpi = Math.round(horizDPI);
-  
-    return true;
-  }
-
-function onCancel()
-  {
-      // We return -1 to show that no value has been given.
-      window.arguments[0].newdpi = -1;
-      return true;
-  }
-
-// disable font items, but not the useMyFonts checkbox nor the resolution
-// menulist
-function disableAllFontElements()
-  {
-      var doc_ids = [ "selectLangs", "proportionalFont",
-                      "sizeVar", "serif", "sans-serif",
-                      "sizeMono", "minSize" ];
-      for (i=0; i<doc_ids.length; i++) {
-          element = document.getElementById( doc_ids[i] );
-          element.disabled = true;
-      }
-  }
-
Index: browser/components/prefwindow/content/pref-fonts.xul
===================================================================
RCS file: browser/components/prefwindow/content/pref-fonts.xul
diff -N browser/components/prefwindow/content/pref-fonts.xul
--- browser/components/prefwindow/content/pref-fonts.xul	1 Feb 2005 17:36:51 -0000	1.23
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,323 +0,0 @@
-<?xml version="1.0"?> 
-# -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
-# ***** 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.org Code.
-#
-# The Initial Developer of the Original Code is
-# Doron Rosenberg.
-# Portions created by the Initial Developer are Copyright (C) 2001
-# the Initial Developer. All Rights Reserved.
-#
-# Contributor(s):
-#
-# 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 *****
-
-<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
-
-<!DOCTYPE window SYSTEM "chrome://browser/locale/pref/pref-fonts.dtd" >
-
-<dialog id="prefFontsDialog" 
-        xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
-        title="&prefFontsDialog.title;" 
-        style="width: 36em;"
-        buttons="accept,cancel" ondialogaccept="return onFontsDialogOK(event);"
-        onload="window.opener.top.initPanel('chrome://browser/content/pref/pref-fonts.xul', window);"> 
-
-  <stringbundle id="bundle_prefutilities"
-                src="chrome://browser/locale/pref/prefutilities.properties"/>
-  <script type="application/x-javascript" 
-          src="chrome://browser/content/pref/pref-fonts.js"/>
-  <script type="application/x-javascript">
-  <![CDATA[
-    var _elementIDs = ["selectLangs"];
-  ]]>
-  </script>
- 
-  <groupbox>
-    <caption>
-      <hbox align="center">
-        <label value="&language.label;" 
-               accesskey="&language.accesskey;" 
-               control="selectLangs"/>
-      </hbox>
-      <menulist id="selectLangs" oncommand="selectLanguage();"
-                preftype="localizedstring" prefstring="font.language.group">
-        <menupopup>
-          <menuitem value="x-western" label="&font.langGroup.latin1;"/>
-          <menuitem value="x-central-euro" label="&font.langGroup.latin2;"/>
-          <menuitem value="ja" label="&font.langGroup.japanese;"/>
-          <menuitem value="zh-TW" label="&font.langGroup.trad-chinese;"/>
-          <menuitem value="zh-CN" label="&font.langGroup.simpl-chinese;"/>
-          <menuitem value="zh-HK" label="&font.langGroup.trad-chinese-hk;"/>
-          <menuitem value="ko" label="&font.langGroup.korean;"/>
-          <menuitem value="x-cyrillic" label="&font.langGroup.cyrillic;"/>
-          <menuitem value="x-baltic" label="&font.langGroup.baltic;"/>
-          <menuitem value="el" label="&font.langGroup.el;"/>
-          <menuitem value="tr" label="&font.langGroup.turkish;"/>
-          <menuitem value="x-unicode" label="&font.langGroup.unicode;"/>
-          <menuitem value="x-user-def" label="&font.langGroup.user-def;"/>
-          <menuitem value="th" label="&font.langGroup.thai;"/>
-          <menuitem value="he" label="&font.langGroup.hebrew;"/>
-          <menuitem value="ar" label="&font.langGroup.arabic;"/>
-          <menuitem value="x-devanagari" label="&font.langGroup.devanagari;"/>
-          <menuitem value="x-tamil" label="&font.langGroup.tamil;"/>
-        </menupopup>
-      </menulist>
-    </caption>
-    
-    <grid>
-      <columns>
-        <column/>
-        <column flex="1"/>
-        <column/>
-        <column/>
-      </columns>
-      
-      <rows>
-        <row>
-          <separator class="thin"/>
-        </row>
-
-        <row align="center">
-          <hbox align="center" pack="end">
-            <label value="&proportional.label;" 
-                   accesskey="&proportional.accesskey;" 
-                   control="proportionalFont"/>
-          </hbox>
-          <menulist id="proportionalFont" flex="1" style="width: 0px;">
-            <menupopup>
-              <menuitem value="serif" 
-                        label="&useDefaultFontSerif.label;"/>
-              <menuitem value="sans-serif" 
-                        label="&useDefaultFontSansSerif.label;"/>
-            </menupopup>
-          </menulist>
-           <hbox align="center" pack="end">
-             <label value="&sizes.label;"/>
-           </hbox>  
-          <menulist id="sizeVar" class="small-margin">
-            <menupopup>
-              <menuitem value="9" label="9"/>
-              <menuitem value="10" label="10"/>
-              <menuitem value="11" label="11"/>
-              <menuitem value="12" label="12"/>
-              <menuitem value="13" label="13"/>
-              <menuitem value="14" label="14"/>
-              <menuitem value="15" label="15"/>
-              <menuitem value="16" label="16"/>
-              <menuitem value="17" label="17"/>
-              <menuitem value="18" label="18"/>
-              <menuitem value="20" label="20"/>
-              <menuitem value="22" label="22"/>
-              <menuitem value="24" label="24"/>
-              <menuitem value="26" label="26"/>
-              <menuitem value="28" label="28"/>
-              <menuitem value="30" label="30"/>
-              <menuitem value="32" label="32"/>
-              <menuitem value="34" label="34"/>
-              <menuitem value="36" label="36"/>
-              <menuitem value="40" label="40"/>
-              <menuitem value="44" label="44"/>
-              <menuitem value="48" label="48"/>
-              <menuitem value="56" label="56"/>
-              <menuitem value="64" label="64"/>
-              <menuitem value="72" label="72"/>
-            </menupopup>
-          </menulist>
-        </row>
-        <row align="center">
-          <hbox align="center" pack="end">
-            <label value="&serif.label;" 
-                   accesskey="&serif.accesskey;" 
-                   control="serif"/>
-          </hbox>
-          <menulist id="serif" flex="1" style="width: 0px;">
-            <menupopup/>
-          </menulist>
-          <spacer/>
-        </row>
-        <row align="center">
-          <hbox align="center" pack="end">
-            <label value="&sans-serif.label;" 
-                   accesskey="&sans-serif.accesskey;" 
-                   control="sans-serif"/>
-          </hbox>
-          <menulist id="sans-serif" flex="1" style="width: 0px;">
-            <menupopup/>
-          </menulist>
-          <spacer/>
-        </row>
-        <row align="center">
-          <hbox align="center" pack="end">
-            <label value="&monospace.label;" 
-                   accesskey="&monospace.accesskey;" 
-                   control="monospace"/>
-          </hbox>
-          <menulist id="monospace"
-                    flex="1" style="width: 0px;" crop="right">
-            <menupopup/>
-          </menulist>
-          <hbox align="center" pack="end">
-            <label value="&sizes.label;"/>
-          </hbox>  
-          <menulist id="sizeMono">
-            <menupopup>
-              <menuitem value="9" label="9"/>
-              <menuitem value="10" label="10"/>
-              <menuitem value="11" label="11"/>
-              <menuitem value="12" label="12"/>
-              <menuitem value="13" label="13"/>
-              <menuitem value="14" label="14"/>
-              <menuitem value="15" label="15"/>
-              <menuitem value="16" label="16"/>
-              <menuitem value="17" label="17"/>
-              <menuitem value="18" label="18"/>
-              <menuitem value="20" label="20"/>
-              <menuitem value="22" label="22"/>
-              <menuitem value="24" label="24"/>
-              <menuitem value="26" label="26"/>
-              <menuitem value="28" label="28"/>
-              <menuitem value="30" label="30"/>
-              <menuitem value="32" label="32"/>
-              <menuitem value="34" label="34"/>
-              <menuitem value="36" label="36"/>
-              <menuitem value="40" label="40"/>
-              <menuitem value="44" label="44"/>
-              <menuitem value="48" label="48"/>
-              <menuitem value="56" label="56"/>
-              <menuitem value="64" label="64"/>
-              <menuitem value="72" label="72"/>
-            </menupopup>
-          </menulist>
-        </row>
-      </rows>
-    </grid>
-    <hbox flex="1">
-          <hbox align="center" pack="end">
-            <label value="&resolution.label;" 
-                   accesskey="&resolution.accesskey;" 
-                   control="screenResolution"/>
-            <menulist id="screenResolution" 
-                      oncommand="changeScreenResolution()"
-                      dpi="&resolution.dpival;">
-              <menupopup>
-                <menuitem value="" 
-                          label="&resolution.dpival;"
-                          id="otherResolution"/>
-                <menuitem value="" 
-                          label="&resolution.dpival;" 
-                          id="defaultResolution"/>
-                <menuitem value="0"
-                          label="&resolution.system.label;" 
-                          id="systemResolution"
-                          hidden="true"/>
-                <menuseparator id="resolutionSeparator"/>
-                <menuitem id="userResolution" hidden="true"/>
-                <menuitem id="arbitraryResolution" value="other" label="&resolution.other;"/>
-              </menupopup>
-            </menulist>
-          </hbox>
-          <spacer flex="1"/>
-          <hbox align="center" pack="end">
-            <label value="&minSize.label;"
-                   accesskey="&minSize.accesskey;"
-                   control="minSize"/>
-          <menulist id="minSize">
-            <menupopup>
-              <menuitem value="0" label="&minSize.none;"/>
-              <menuitem value="9" label="9"/>
-              <menuitem value="10" label="10"/>
-              <menuitem value="11" label="11"/>
-              <menuitem value="12" label="12"/>
-              <menuitem value="13" label="13"/>
-              <menuitem value="14" label="14"/>
-              <menuitem value="15" label="15"/>
-              <menuitem value="16" label="16"/>
-              <menuitem value="17" label="17"/>
-              <menuitem value="18" label="18"/>
-              <menuitem value="20" label="20"/>
-              <menuitem value="22" label="22"/>
-              <menuitem value="24" label="24"/>
-            </menupopup>
-          </menulist>
-        </hbox>
-      </hbox>
-  </groupbox>
-
-  <hbox>
-    <groupbox flex="1" id="pageColours">
-      <caption label="&color;"/>
-      <hbox align="center">
-        <label value="&textColor.label;" accesskey="&textColor.accesskey;" control="foregroundtextmenu"/>
-        <spacer flex="1"/>
-        <colorpicker type="button" id="foregroundtextmenu" palettename="standard"/> 
-        <data id="foregroundText" preftype="color" prefstring="browser.display.foreground_color"/>
-      </hbox>
-      <hbox align="center" style="margin-top: 5px">
-        <label value="&backgroundColor.label;" accesskey="&backgroundColor.accesskey;" control="backgroundmenu"/>
-        <spacer flex="1"/>
-        <colorpicker type="button" id="backgroundmenu" palettename="standard"/> 
-        <data id="background" preftype="color" prefstring="browser.display.background_color"/>
-      </hbox>
-      <separator class="thin"/>
-      <hbox align="center">
-        <checkbox id="browserUseSystemColors" label="&useSystemColors.label;" accesskey="&useSystemColors.accesskey;"
-                  prefstring="browser.display.use_system_colors"/>
-      </hbox>
-    </groupbox>
-      
-    <groupbox flex="1">
-      <caption label="&links;"/>
-      <hbox align="center">
-        <label value="&linkColor.label;" accesskey="&linkColor.accesskey;" control="unvisitedlinkmenu"/>
-        <spacer flex="1"/>
-        <colorpicker type="button" id="unvisitedlinkmenu" palettename="standard"/> 
-        <data id="unvisitedLinks" preftype="string" prefstring="browser.anchor_color"/>
-      </hbox>
-      <hbox align="center" style="margin-top: 5px">
-        <label value="&visitedLinkColor.label;" accesskey="&visitedLinkColor.accesskey;" control="visitedlinkmenu"/>
-        <spacer flex="1"/>
-        <colorpicker type="button" id="visitedlinkmenu" palettename="standard"/> 
-        <data id="visitedLinks" preftype="string" prefstring="browser.visited_color"/>
-      </hbox>
-      <separator class="thin"/>
-      <hbox align="center">
-        <checkbox id="browserUnderlineAnchors" label="&underlineLinks.label;" accesskey="&underlineLinks.accesskey;"
-                  prefstring="browser.underline_anchors"/>
-      </hbox>
-    </groupbox>
-  </hbox>
-  <hbox align="center">
-    <label value="&alwaysUseMy.label;"/>
-    <!-- Unchecking this removes the ability to select dynamic fonts -->
-    <checkbox id="useMyFonts" 
-              label="&useMyFonts.label;" 
-              accesskey="&useMyFonts.accesskey;"/>
-    <checkbox id="useMyColors" label="&useMyColors.label;"
-              accesskey="&useMyColors.accesskey;"/>
-  </hbox>
-</dialog>
Index: browser/components/prefwindow/content/pref-languages.js
===================================================================
RCS file: browser/components/prefwindow/content/pref-languages.js
diff -N browser/components/prefwindow/content/pref-languages.js
--- browser/components/prefwindow/content/pref-languages.js	22 Dec 2004 12:32:34 -0000	1.6
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,447 +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.org code.
- *
- * The Initial Developer of the Original Code is
- * Netscape Communications Corporation.
- * Portions created by the Initial Developer are Copyright (C) 2000
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *   Adrian Havill <havill@redhat.com>
- *   Steffen Wilberg <steffen.wilberg@web.de>
- *
- * 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 ***** */
-
-//GLOBALS
-
-//locale bundles
-var gRegionsBundle;
-var gLanguagesBundle;
-var gAcceptedBundle;
-var gPrefLangBundle;
-
-//dictionary of all supported locales
-var gAvailLanguageDict;
-
-//XUL listbox handles
-var gAvailableLanguages;
-var gActiveLanguages;
-
-// label and accesskey of the available_languages menulist
-var gSelectLabel;
-var gSelectAccesskey;
-
-//XUL window pref window interface object
-var gPrefString = new String();
-
-//Reg expression for splitting multiple pref values
-var gSeparatorRe = /\s*,\s*/;
-
-// PrefWindow
-var gPrefWindow;
-
-
-function Init()
-{
-  gRegionsBundle   = document.getElementById("bundle_regions");
-  gLanguagesBundle = document.getElementById("bundle_languages");
-  gPrefLangBundle  = document.getElementById("bundle_prefLang");
-  gAcceptedBundle  = document.getElementById("bundle_accepted");
-  ReadAvailableLanguages();
-
-  try {
-    window.opener.top.initPanel(window.location.href, window);
-  }
-  catch(ex) { } //pref service backup
-
-  gActiveLanguages = document.getElementById("active_languages");
-  gPrefString = gActiveLanguages.getAttribute("prefvalue");
-  LoadActiveLanguages();
-
-  gPrefWindow = window.opener.parent.hPrefWindow;
-  gAvailableLanguages = document.getElementById("available_languages");
-  SelectLanguage();
-
-  LoadAvailableLanguages();
-  gSelectLabel = gAvailableLanguages.label;
-  gSelectAccesskey = gAvailableLanguages.getAttribute("accesskey");
-}
-
-
-function onLanguagesDialogOK()
-{
-  gPrefWindow.wsm.savePageData(window.location.href, window);
-  return true;
-}
-
-
-function ReadAvailableLanguages()
-{
-  gAvailLanguageDict   = new Array();
-  var visible = new String();
-  var str = new String();
-  var i =0;
-
-  var gAcceptedBundleEnum = gAcceptedBundle.stringBundle.getSimpleEnumeration();
-
-  var curItem;
-  var stringName;
-  var stringNameProperty;
-
-  while (gAcceptedBundleEnum.hasMoreElements()) {
-
-    //progress through the bundle
-    curItem = gAcceptedBundleEnum.getNext();
-
-    //"unpack" the item, nsIPropertyElement is now partially scriptable
-    curItem = curItem.QueryInterface(Components.interfaces.nsIPropertyElement);
-
-    //dump string name (key)
-    stringName = curItem.key;
-    stringNameProperty = stringName.split(".");
-
-    if (stringNameProperty[1] == "accept") {
-
-      //dump the UI string (value)
-      visible   = curItem.value;
-
-      //if (visible == "true") {
-
-        str = stringNameProperty[0];
-        var stringLangRegion = stringNameProperty[0].split("-");
-
-        if (stringLangRegion[0]) {
-          var tit;
-          var language;
-          var region;
-          var use_region_format = false;
-
-          try {
-            language = gLanguagesBundle.getString(stringLangRegion[0]);
-          }
-          catch (ex) {
-            language = "";
-          }
-
-          if (stringLangRegion.length > 1) {
-
-            try {
-              region = gRegionsBundle.getString(stringLangRegion[1]);
-              use_region_format = true;
-            }
-            catch (ex) { }
-          }
-
-          if (use_region_format) {
-            tit = gPrefLangBundle.stringBundle.formatStringFromName("languageRegionCodeFormat",
-                                                                    [language, region, str], 3);
-          } else {
-            tit = gPrefLangBundle.stringBundle.formatStringFromName("languageCodeFormat",
-                                                                    [language, str], 2);
-          }
-
-        } //if language
-
-        if (str && tit) {
-
-          gAvailLanguageDict[i] = new Array(3);
-          gAvailLanguageDict[i][0] = tit;
-          gAvailLanguageDict[i][1] = str;
-          gAvailLanguageDict[i][2] = visible;
-          i++;
-
-        } // if str && tit
-      //} //if visible
-    } //if accepted
-  } //while
-  gAvailLanguageDict.sort( // sort on first element
-    function (a, b) {
-      if (a[0] < b[0]) return -1;
-      if (a[0] > b[0]) return  1;
-      return 0;
-    });
-} //ReadAvailableLanguages
-
-
-function LoadAvailableLanguages()
-{
-  if (gAvailLanguageDict)
-    for (var i = 0; i < gAvailLanguageDict.length; i++)
-      if (gAvailLanguageDict[i][2] == "true")
-        AddMenuOrListItem(document, gAvailableLanguages.menupopup, "menuitem", gAvailLanguageDict[i][1], gAvailLanguageDict[i][0]);
-}
-
-
-function LoadActiveLanguages()
-{
-  if (gPrefString) {
-    var arrayOfPrefs = gPrefString.split(gSeparatorRe);
-
-    for (var i = 0; i < arrayOfPrefs.length; i++) {
-      var str = arrayOfPrefs[i];
-      var tit = GetLanguageTitle(str);
-
-      if (str) {
-        if (!tit)
-           tit = "[" + str + "]";
-        AddMenuOrListItem(document, gActiveLanguages, "listitem", str, tit);
-      } //if
-    } //for
-  } //if
-}
-
-
-function LangAlreadyActive(langId)
-{
-  var found = false;
-  try {
-    var arrayOfPrefs = gPrefString.split(gSeparatorRe);
-
-    if (arrayOfPrefs)
-      for (var i = 0; i < arrayOfPrefs.length; i++) {
-      if (arrayOfPrefs[i] == langId) {
-        found = true;
-        break;
-      }
-    }
-
-    return found;
-  }
-
-  catch(ex){
-    return false;
-  }
-} //LangAlreadyActive
-
-
-function SelectAvailableLanguage()
-{
-    var selItem  = gAvailableLanguages.selectedItem;
-    var languageId   = selItem.getAttribute("id");
-    var addButton = document.getElementById("add");
-
-    // since we're not displaying "select" anymore, don't underline some random "s"
-    gAvailableLanguages.removeAttribute("accesskey");
-
-    // if the langauge is not already active, activate the "add" button
-    if (!LangAlreadyActive(languageId))
-      addButton.disabled = false;
-    else
-      addButton.disabled = true;
-}
-
-function AddAvailableLanguage()
-{
-  var selItem  = gAvailableLanguages.selectedItem;
-  var languageId   = selItem.getAttribute("id");
-  var languageName = selItem.getAttribute("label");
-  var addButton = document.getElementById("add");
-
-  if (!LangAlreadyActive(languageId))
-    AddMenuOrListItem(document, gActiveLanguages, "listitem", languageId, languageName);
-
-  // restore the "select" label and accesskey, disable the "add" button again
-  gAvailableLanguages.setAttribute("label", gSelectLabel);
-  gAvailableLanguages.setAttribute("accesskey", gSelectAccesskey);
-  addButton.disabled = true;
-
-  // select the item we just added in the active_languages listbox
-  var lastItem = gActiveLanguages.lastChild;
-  gActiveLanguages.selectItem(lastItem);
-  gActiveLanguages.ensureElementIsVisible(lastItem);
-
-  UpdateSavePrefString();
-}
-
-
-function RemoveActiveLanguage()
-{
-  var nextNode = null;
-  var numSelected = gActiveLanguages.selectedItems.length;
-  var deleted_all = false;
-
-  while (gActiveLanguages.selectedItems.length > 0) {
-    var selectedNode = gActiveLanguages.selectedItems[0];
-
-    nextNode = selectedNode.nextSibling;
-    if (!nextNode && selectedNode.previousSibling)
-      nextNode = selectedNode.previousSibling;
-
-    gActiveLanguages.removeChild(selectedNode);
-  } //while
-
-  if (nextNode)
-    gActiveLanguages.selectItem(nextNode)
-
-  UpdateSavePrefString();
-}
-
-
-function GetLanguageTitle(id)
-{
-
-  if (gAvailLanguageDict)
-    for (var j = 0; j < gAvailLanguageDict.length; j++) {
-
-      if ( gAvailLanguageDict[j][1] == id) {
-        //title =
-        return gAvailLanguageDict[j][0];
-      }
-    }
-  return "";
-}
-
-
-function AddMenuOrListItem(doc, listbox, type, langID, langTitle)
-{
-  try {  //let's beef up our error handling for languages without label / title
-
-    // Create a listitem for the new Language
-    var item = doc.createElement(type);
-
-    // Copy over the attributes
-    item.setAttribute("label", langTitle);
-    item.setAttribute("id", langID);
-    listbox.appendChild(item);
-
-  }
-  catch (ex) { }
-}
-
-
-function UpdateSavePrefString()
-{
-  var num_languages = 0;
-  gPrefString = "";
-
-  for (var item = gActiveLanguages.firstChild; item != null; item = item.nextSibling) {
-
-    var languageId = item.getAttribute("id");
-
-    if (languageId.length > 1) {
-      num_languages++;
-
-      //separate >1 languages by commas
-      if (num_languages > 1) {
-        gPrefString = gPrefString + "," + " " + languageId;
-      } else {
-        gPrefString = languageId;
-      } //if
-    } //if
-  }//for
-
-  gActiveLanguages.setAttribute("prefvalue", gPrefString);
-}
-
-
-function MoveUp() {
-
-  if (gActiveLanguages.selectedItems.length == 1) {
-    var selected = gActiveLanguages.selectedItems[0];
-    var before = selected.previousSibling
-    if (before) {
-      before.parentNode.insertBefore(selected, before);
-      gActiveLanguages.selectItem(selected);
-      gActiveLanguages.ensureElementIsVisible(selected);
-    }
-  }
-
-  if (gActiveLanguages.selectedIndex == 0)
-  {
-    // selected item is first
-    var moveUp = document.getElementById("up");
-    moveUp.disabled = true;
-  }
-
-  if (gActiveLanguages.childNodes.length > 1)
-  {
-    // more than one item so we can move selected item back down
-    var moveDown = document.getElementById("down");
-    moveDown.disabled = false;
-  }
-
-  UpdateSavePrefString();
-} //MoveUp
-
-
-function MoveDown() {
-
-  if (gActiveLanguages.selectedItems.length == 1) {
-    var selected = gActiveLanguages.selectedItems[0];
-    if (selected.nextSibling) {
-      if (selected.nextSibling.nextSibling) {
-        gActiveLanguages.insertBefore(selected, selected.nextSibling.nextSibling);
-      }
-      else {
-        gActiveLanguages.appendChild(selected);
-      }
-      gActiveLanguages.selectItem(selected);
-    }
-  }
-
-  if (gActiveLanguages.selectedIndex == gActiveLanguages.childNodes.length - 1)
-  {
-    // selected item is last
-    var moveDown = document.getElementById("down");
-    moveDown.disabled = true;
-  }
-
-  if (gActiveLanguages.childNodes.length > 1)
-  {
-    // more than one item so we can move selected item back up
-    var moveUp = document.getElementById("up");
-    moveUp.disabled = false;
-  }
-
-  UpdateSavePrefString();
-
-} //MoveDown
-
-
-function SelectLanguage() {
-  if (gActiveLanguages.selectedItems.length) {
-    document.getElementById("remove").disabled = false;
-
-    var selected = gActiveLanguages.selectedItems[0];
-    document.getElementById("down").disabled = !selected.nextSibling;
-    document.getElementById("up").disabled = !selected.previousSibling;
-  }
-  else {
-    document.getElementById("remove").disabled = true;
-    document.getElementById("down").disabled = true;
-    document.getElementById("up").disabled = true;
-  }
-
-  if (gPrefWindow.getPrefIsLocked(document.getElementById("up").getAttribute("prefstring")))
-    document.getElementById("up").disabled = true;
-  if (gPrefWindow.getPrefIsLocked(document.getElementById("down").getAttribute("prefstring")))
-    document.getElementById("down").disabled = true;
-  if (gPrefWindow.getPrefIsLocked(document.getElementById("remove").getAttribute("prefstring")))
-    document.getElementById("remove").disabled = true;
-  if (gPrefWindow.getPrefIsLocked(gAvailableLanguages.getAttribute("prefstring")))
-    gAvailableLanguages.disabled = true; // the "add" button just stays disabled
-} // SelectLanguage
Index: browser/components/prefwindow/content/pref-languages.xul
===================================================================
RCS file: browser/components/prefwindow/content/pref-languages.xul
diff -N browser/components/prefwindow/content/pref-languages.xul
--- browser/components/prefwindow/content/pref-languages.xul	19 Jul 2004 22:38:07 -0000	1.4
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,126 +0,0 @@
-<?xml version="1.0"?> <!-- -*- Mode: SGML; indent-tabs-mode: nil; -*- -->
-<!--
-
- ***** 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.org Code.
-
- The Initial Developer of the Original Code is
- Netscape Communications Corporation.
- Portions created by the Initial Developer are Copyright (C) 1999
- the Initial Developer. All Rights Reserved.
-
- Contributor(s):
-   Steffen Wilberg <steffen.wilberg@web.de>
-
- Alternatively, the contents of this file may be used under the terms of
- either of 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 ***** -->
-
-<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
-
-<!DOCTYPE window SYSTEM "chrome://browser/locale/pref/pref-languages.dtd" >
-
-<dialog id="Languages"
-        title="&languages.customize.Header;"
-        xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
-        style="width: 0px; height: 0px;" onload="Init();"
-        ondialogaccept="return onLanguagesDialogOK(event);"
-        persist="screenX screenY width height">
-
-  <script type="application/x-javascript" src="chrome://browser/content/pref/pref-languages.js"/>
-  <script type="application/x-javascript">
-  <![CDATA[
-    var _elementIDs = ["active_languages", "DefaultCharsetList"];
-    var observerService = Components.classes["@mozilla.org/observer-service;1"].getService(Components.interfaces.nsIObserverService);
-    observerService.notifyObservers(null, "charsetmenu-selected", "other");
-  ]]>
-  </script>
-
-  <stringbundleset id="languageSet">
-    <stringbundle id="bundle_regions" src="chrome://global/locale/regionNames.properties"/>
-    <stringbundle id="bundle_languages" src="chrome://global/locale/languageNames.properties"/>
-    <stringbundle id="bundle_prefLang" src="chrome://browser/locale/pref/pref-languages.properties"/>
-    <stringbundle id="bundle_accepted" src="resource://gre/res/language.properties"/>
-  </stringbundleset>
-
-  <groupbox flex="1">
-    <caption label="&languages.customize.label;"/>
-    <description>&languages.customize.prefLangDescript;</description>
-    <description>&languages.customize.active.label;</description>
-    <hbox flex="1">
-      <vbox flex="1">
-        <listbox id="active_languages" flex="1"
-                 preftype="localizedstring" prefstring="intl.accept_languages"
-                 prefvalue="" prefattribute="prefvalue" wsm_attributes="prefvalue"
-                 seltype="multiple" onselect="SelectLanguage();"/>
-        <spacer/>
-        <label accesskey="&languages.customize.selectLanguage.accesskey;" control="available_languages"/>
-        <menulist id="available_languages" oncommand="SelectAvailableLanguage();"
-                  label="&languages.customize.selectLanguage.label;"
-                  accesskey="&languages.customize.selectLanguage.accesskey;"
-                  prefstring="pref.browser.language.disable_addLanguages">
-          <menupopup/>
-        </menulist>
-      </vbox>
-      <vbox>
-        <button id="up" class="up" oncommand="MoveUp();"  disabled="true"
-                label="&languages.customize.moveUp.label;"
-                accesskey="&languages.customize.moveUp.accesskey;"
-                prefstring="pref.browser.language.disable_button.up"/>
-        <button id="down" class="down" oncommand="MoveDown();" disabled="true"
-                label="&languages.customize.moveDown.label;"
-                accesskey="&languages.customize.moveDown.accesskey;"
-                prefstring="pref.browser.language.disable_button.down"/>
-        <button id="remove" oncommand="RemoveActiveLanguage();" disabled="true"
-                label="&languages.customize.deleteButton.label;"
-                accesskey="&languages.customize.deleteButton.accesskey;"
-                prefstring="pref.browser.language.disable_button.remove"/>
-        <spacer flex="1"/>
-        <button id="add" oncommand="AddAvailableLanguage();" disabled="true"
-                label="&languages.customize.addButton.label;"
-                accesskey="&languages.customize.addButton.accesskey;"/>
-      </vbox>
-    </hbox>
-  </groupbox>
-
-  <groupbox align="start">
-    <caption label="&languages.customize.Charset.grouplabel;"/>
-    <hbox align="center">
-      <label value="&languages.customize.DefaultCharset.label;"
-             accesskey="&languages.customize.DefaultCharset.accesskey;"
-             control="DefaultCharsetList"/>
-      <menulist id="DefaultCharsetList" ref="NC:DecodersRoot" datasources="rdf:charset-menu"
-          prefstring="intl.charset.default" preftype="localizedstring"
-          wsm_attributes="value">
-          <template>
-            <menupopup>
-              <menuitem label="rdf:http://home.netscape.com/NC-rdf#Name" value="..." uri="..."/>
-            </menupopup>
-          </template>
-      </menulist>
-    </hbox>
-  </groupbox>
-</dialog>
-
Index: browser/components/prefwindow/content/pref-masterpass.js
===================================================================
RCS file: browser/components/prefwindow/content/pref-masterpass.js
diff -N browser/components/prefwindow/content/pref-masterpass.js
--- browser/components/prefwindow/content/pref-masterpass.js	1 Feb 2005 17:36:51 -0000	1.3
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,269 +0,0 @@
-# -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
-# ***** 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.org Code. The Initial Developer of the Original Code is Netscape Communications Corporation. Portions created by Netscape are Copyright (C) 2001 Netscape Communications Corporation. All Rights Reserved.
-#
-# The Initial Developer of the Original Code is
-# Netscape Communications Corporation.
-# Portions created by the Initial Developer are Copyright (C) 2001
-# the Initial Developer. All Rights Reserved.
-#
-# Contributor(s):
-#   Bob Lord <lord@netscape.com>
-#   Terry Hayes <thayes@netscape.com>
-#
-# 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 *****
-
-const nsPK11TokenDB = "@mozilla.org/security/pk11tokendb;1";
-const nsIPK11TokenDB = Components.interfaces.nsIPK11TokenDB;
-const nsIDialogParamBlock = Components.interfaces.nsIDialogParamBlock;
-const nsPKCS11ModuleDB = "@mozilla.org/security/pkcs11moduledb;1";
-const nsIPKCS11ModuleDB = Components.interfaces.nsIPKCS11ModuleDB;
-const nsIPKCS11Slot = Components.interfaces.nsIPKCS11Slot;
-const nsIPK11Token = Components.interfaces.nsIPK11Token;
-
-
-var params;
-var tokenName="";
-var pw1;
-
-function onLoad()
-{
-  pw1 = document.getElementById("pw1");
-	 	 
-  process();
-}
-
-
-function process()
-{
-   var secmoddb = Components.classes[nsPKCS11ModuleDB].getService(nsIPKCS11ModuleDB);
-   var bundle = document.getElementById("prefBundle");
-
-   // If the token is unitialized, don't use the old password box.
-   // Otherwise, do.
-
-   var slot = secmoddb.findSlotByName(tokenName);
-   if (slot) {
-     var oldpwbox = document.getElementById("oldpw");
-     var msgBox = document.getElementById("message");
-     var status = slot.status;
-     if (status == nsIPKCS11Slot.SLOT_UNINITIALIZED
-         || status == nsIPKCS11Slot.SLOT_READY) {
-      
-       oldpwbox.setAttribute("hidden", "true");
-       msgBox.setAttribute("value", bundle.getString("password_not_set")); 
-       msgBox.setAttribute("hidden", "false");
-
-       if (status == nsIPKCS11Slot.SLOT_READY) {
-         oldpwbox.setAttribute("inited", "empty");
-       } else {
-         oldpwbox.setAttribute("inited", "true");
-       }
-      
-       // Select first password field
-       document.getElementById('pw1').focus();
-    
-     } else {
-       // Select old password field
-       oldpwbox.setAttribute("hidden", "false");
-       msgBox.setAttribute("hidden", "true");
-       oldpwbox.setAttribute("inited", "false");
-       oldpwbox.focus();
-     }
-   }
-
-  if (params) {
-    // Return value 0 means "canceled"
-    params.SetInt(1, 0);
-  }
-  
-  checkPasswords();
-}
-
-function setPassword()
-{
-  var pk11db = Components.classes[nsPK11TokenDB].getService(nsIPK11TokenDB);
-  var promptService = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
-                                .getService(Components.interfaces.nsIPromptService);
-  var token = pk11db.findTokenByName(tokenName);
-
-  var oldpwbox = document.getElementById("oldpw");
-  var initpw = oldpwbox.getAttribute("inited");
-  var bundle = document.getElementById("prefBundle");
-  
-  var success = false;
-  
-  if (initpw == "false" || initpw == "empty") {
-    try {
-      var oldpw = "";
-      var passok = 0;
-      
-      if (initpw == "empty") {
-        passok = 1;
-      } else {
-        oldpw = oldpwbox.value;
-        passok = token.checkPassword(oldpw);
-      }
-      
-      if (passok) {
-        if (initpw == "empty" && pw1.value == "") {
-          // This makes no sense that we arrive here, 
-          // we reached a case that should have been prevented by checkPasswords.
-        } else {
-          if (pw1.value == "") {
-            var secmoddb = Components.classes[nsPKCS11ModuleDB].getService(nsIPKCS11ModuleDB);
-            if (secmoddb.isFIPSEnabled) {
-              // empty passwords are not allowed in FIPS mode
-              promptService.alert(window,
-                                  bundle.getString("pw_change_failed_title"),
-                                  bundle.getString("pw_change2empty_in_fips_mode"));
-              passok = 0;
-            }
-          }
-          if (passok) {
-            token.changePassword(oldpw, pw1.value);
-            if (pw1.value == "") {
-              promptService.alert(window,
-                                  bundle.getString("pw_change_success_title"),
-                                  bundle.getString("pw_erased_ok") 
-                                  + " " + bundle.getString("pw_empty_warning"));
-            } else {
-              promptService.alert(window,
-                                  bundle.getString("pw_change_success_title"),
-                                  bundle.getString("pw_change_ok"));
-            }
-            success = true;
-          }
-        }
-      } else {
-        oldpwbox.focus();
-        oldpwbox.setAttribute("value", "");
-        promptService.alert(window,
-                            bundle.getString("pw_change_failed_title"),
-                            bundle.getString("incorrect_pw"));
-      }
-    } catch (e) {
-      promptService.alert(window,
-                          bundle.getString("pw_change_failed_title"),
-                          bundle.getString("failed_pw_change"));
-    }
-  } else {
-    token.initPassword(pw1.value);
-    if (pw1.value == "") {
-      promptService.alert(window,
-                          bundle.getString("pw_change_success_title"),
-                          bundle.getString("pw_not_wanted")
-                          + " " + bundle.getString("pw_empty_warning"));
-    }
-    success = true;
-  }
-
-  // Terminate dialog
-  if (success)
-    window.close();
-}
-
-function setPasswordStrength()
-{
-// Here is how we weigh the quality of the password
-// number of characters
-// numbers
-// non-alpha-numeric chars
-// upper and lower case characters
-
-  var pw=document.getElementById('pw1').value;
-
-//length of the password
-  var pwlength=(pw.length);
-  if (pwlength>5)
-    pwlength=5;
-
-
-//use of numbers in the password
-  var numnumeric = pw.replace (/[0-9]/g, "");
-  var numeric=(pw.length - numnumeric.length);
-  if (numeric>3)
-    numeric=3;
-
-//use of symbols in the password
-  var symbols = pw.replace (/\W/g, "");
-  var numsymbols=(pw.length - symbols.length);
-  if (numsymbols>3)
-    numsymbols=3;
-
-//use of uppercase in the password
-  var numupper = pw.replace (/[A-Z]/g, "");
-  var upper=(pw.length - numupper.length);
-  if (upper>3)
-    upper=3;
-
-
-  var pwstrength=((pwlength*10)-20) + (numeric*10) + (numsymbols*15) + (upper*10);
-
-  // make sure we're give a value between 0 and 100
-  if ( pwstrength < 0 ) {
-    pwstrength = 0;
-  }
-  
-  if ( pwstrength > 100 ) {
-    pwstrength = 100;
-  }
-
-  var mymeter=document.getElementById('pwmeter');
-  mymeter.setAttribute("value",pwstrength);
-
-  return;
-}
-
-function checkPasswords()
-{
-  var pw1=document.getElementById('pw1').value;
-  var pw2=document.getElementById('pw2').value;
-  var ok=document.documentElement.getButton("accept");
-
-  var oldpwbox = document.getElementById("oldpw");
-  if (oldpwbox) {
-    var initpw = oldpwbox.getAttribute("inited");
-
-    if (initpw == "empty" && pw1 == "") {
-      // The token has already been initialized, therefore this dialog
-      // was called with the intention to change the password.
-      // The token currently uses an empty password.
-      // We will not allow changing the password from empty to empty.
-      ok.setAttribute("disabled","true");
-      return;
-    }
-  }
-
-  if (pw1 == pw2){
-    ok.setAttribute("disabled","false");
-  } else
-  {
-    ok.setAttribute("disabled","true");
-  }
-
-}
Index: browser/components/prefwindow/content/pref-masterpass.xul
===================================================================
RCS file: browser/components/prefwindow/content/pref-masterpass.xul
diff -N browser/components/prefwindow/content/pref-masterpass.xul
--- browser/components/prefwindow/content/pref-masterpass.xul	1 Feb 2005 17:36:51 -0000	1.3
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,112 +0,0 @@
-<?xml version="1.0"?>
-# -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
-# ***** 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.org Code. The Initial Developer of the Original Code is Netscape Communications Corporation. Portions created by Netscape are Copyright (C) 2001 Netscape Communications Corporation. All Rights Reserved.
-#
-# The Initial Developer of the Original Code is
-# Netscape Communications Corporation.
-# Portions created by the Initial Developer are Copyright (C) 2001
-# the Initial Developer. All Rights Reserved.
-#
-# Contributor(s):
-#   Bob Lord <lord@netscape.com>
-#   Terry Hayes <thayes@netscape.com>
-#
-# 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 *****
-
-<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
-
-<!DOCTYPE window [
-<!ENTITY % brandDTD SYSTEM "chrome://global/locale/brand.dtd" >
-%brandDTD;
-<!ENTITY % prefMasterpassDTD SYSTEM "chrome://browser/locale/pref/pref-masterpass.dtd" >
-%prefMasterpassDTD;
-]>
-
-<dialog id="set_password" title="&setPassword.title;"
-  xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" 
-  style="width: 35em;" 
-  ondialogaccept="setPassword();" 
-  onload="onLoad();">
-
-<script type="application/x-javascript" src="chrome://browser/content/pref/pref-masterpass.js"/>
-<script type="application/x-javascript" src="chrome://global/content/strres.js"/>
-<script type="application/x-javascript" src="chrome://help/content/contextHelp.js"/>
-
-<stringbundle id="prefBundle" src="chrome://browser/locale/pref/prefutilities.properties"/>
-
-
-<description>&masterPasswordDescription.label;</description>
-
-<vbox style="margin: 5px;" flex="1">
-<groupbox>
-<grid>
- <columns>
-   <column/>
-   <column/> 
- </columns>
- <rows>
-   <row>
-     <label value="&setPassword.oldPassword.label;"/> 
-     <textbox id="oldpw" type="password"/>
-     <!-- This textbox is inserted as a workaround to the fact that making the 'type' 
-          & 'disabled' property of the 'oldpw' textbox toggle between ['password' & 
-          'false'] and ['text' & 'true'] - as would be necessary if the menu has more 
-          than one tokens, some initialized and some not - does not work properly. So, 
-          either the textbox 'oldpw' or the textbox 'message' would be displayed, 
-          depending on the state of the token selected 
-     -->
-     <textbox id="message" disabled="true" />
-   </row>
-   <row>
-     <label value="&setPassword.newPassword.label;"/> 
-     <textbox id="pw1" type="password" 
-       oninput="setPasswordStrength(); checkPasswords();"/> 
-   </row>
-   <row>
-     <label value="&setPassword.reenterPassword.label;"/> 
-     <textbox id="pw2" type="password" oninput="checkPasswords();"/>  
-   </row>
- </rows>
-</grid>
-</groupbox>
-
-<groupbox>
- <caption label="&setPassword.meter.label;"/>
- <progressmeter id="pwmeter" mode="determined" 
-                  value="0"/>
-</groupbox>
-
-<keyset id="keys">
-  <key id="esc-key"    keycode="VK_ESCAPE" oncommand="window.close();"/>
-</keyset>
-
-</vbox>
-
-<description class="header">&masterPasswordWarning.label;</description>
-
-</dialog>
Index: browser/components/prefwindow/content/pref-navigator.js
===================================================================
RCS file: browser/components/prefwindow/content/pref-navigator.js
diff -N browser/components/prefwindow/content/pref-navigator.js
--- browser/components/prefwindow/content/pref-navigator.js	23 Jan 2005 23:58:29 -0000	1.26
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,253 +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 the Firefox Options Dialog
-#
-# The Initial Developer of the Original Code is mozilla.org.
-# Portions created by the Initial Developer are Copyright (C) 2004
-# the Initial Developer. All Rights Reserved.
-#
-# Contributor(s):
-#
-# 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 ***** -->
-
-var _elementIDs = ["browserStartupHomepage", "checkForDefault"];
-    
-const nsIPrefService         = Components.interfaces.nsIPrefService;
-const nsIPrefLocalizedString = Components.interfaces.nsIPrefLocalizedString;
-
-const PREFSERVICE_CONTRACTID    = "@mozilla.org/preferences-service;1";
-
-function setHomePageToCurrentPage()
-{
-  if (top.opener) {
-    var homePageField = document.getElementById("browserStartupHomepage");
-    var newVal = "";
-
-    var tabbrowser = top.opener.document.getElementById("content");
-    var l = tabbrowser.browsers.length;
-    for (var i = 0; i < l; i++) {
-      if (i)
-        newVal += "|";
-      newVal += tabbrowser.getBrowserAtIndex(i).webNavigation.currentURI.spec;
-    }
-    
-    homePageField.value = newVal;
-  }
-}
-
-function setHomePageToBookmark()
-{
-  var rv = { url: null };
-  openDialog("chrome://browser/content/bookmarks/selectBookmark.xul", "", 
-             "centerscreen,chrome,modal=yes,dialog=yes,resizable=yes", rv);
-  if (rv.url) {
-    var homePageField = document.getElementById("browserStartupHomepage");
-    homePageField.value = rv.url;
-  }
-}
-
-function setHomePageToDefaultPage()
-{
-  var prefService = Components.classes[PREFSERVICE_CONTRACTID]
-                              .getService(nsIPrefService);
-  var pref = prefService.getDefaultBranch(null);
-  var url = pref.getComplexValue("browser.startup.homepage",
-                                  nsIPrefLocalizedString).data;
-  var homePageField = document.getElementById("browserStartupHomepage");
-  homePageField.value = url;
-}
-
-function onOK() 
-{
-  if (!('homepage' in parent)) 
-    return;
-
-  // Replace pipes with commas to look nicer.
-  parent.homepage = parent.homepage.replace(/\|/g,', ');
-  
-  var windowManager = Components.classes['@mozilla.org/appshell/window-mediator;1'].getService();
-  var windowManagerInterface = windowManager.QueryInterface(Components.interfaces.nsIWindowMediator);
-  var eb = windowManagerInterface.getEnumerator("navigator:browser");
-  while (eb.hasMoreElements()) {
-    // Update the home button tooltip.
-    var domWin = eb.getNext().QueryInterface(Components.interfaces.nsIDOMWindow);
-    var homeButton = domWin.document.getElementById("home-button");
-    if (homeButton)
-      homeButton.setAttribute("tooltiptext", parent.homepage);
-  }
-}
-
-function Startup()
-{
-  var useButton = document.getElementById("browserUseCurrent");
-  
-  try {
-    var browser = top.opener.document.getElementById("content");  
-
-    var l = browser.mPanelContainer.childNodes.length;
-    if (l > 1)
-      useButton.label = useButton.getAttribute("label2");
-  } catch (e) { 
-    // prefwindow wasn't opened from a browser window, so no current page
-    useButton.disabled = true;
-  }
-  
-  if (parent.hPrefWindow.getPrefIsLocked("browser.startup.homepage")) {
-    document.getElementById("browserUseCurrent").disabled = true;
-    document.getElementById("browserUseBookmark").disabled = true;
-    document.getElementById("browserUseBlank").disabled = true;
-  }
- 
-  try {
-    var shellSvc = Components.classes["@mozilla.org/browser/shell-service;1"]
-                             .getService(Components.interfaces.nsIShellService);
-  } catch (e) {
-    document.getElementById("defaultBrowserPrefs").hidden = true;
-  }
-
-  parent.hPrefWindow.registerOKCallbackFunc(onOK);
-}
-      
-function showConnections()
-{
-  openDialog("chrome://browser/content/pref/pref-connection.xul", "", "centerscreen,chrome,modal=yes,dialog=yes");
-}
-
-function showFontsAndColors()
-{
-  openDialog("chrome://browser/content/pref/pref-fonts.xul", "", "centerscreen,chrome,modal=yes,dialog=yes");
-}
-
-function saveFontPrefs()
-{
-  var dataObject = top.hPrefWindow.wsm.dataManager.pageData["chrome://browser/content/pref/pref-fonts.xul"].userData;
-  var pref = top.hPrefWindow.pref;
-  for (var language in dataObject.languageData) {
-    for (var type in dataObject.languageData[language].types) {
-      var fontPrefString = "font.name." + type + "." + language;
-      var currValue = "";
-      try {
-        currValue = pref.CopyUnicharPref(fontPrefString);
-      }
-      catch(e) {
-      }
-      if (currValue != dataObject.languageData[language].types[type])
-        pref.SetUnicharPref(fontPrefString, dataObject.languageData[language].types[type]);
-    }
-    var defaultFontPref = "font.default." + language;
-    var variableSizePref = "font.size.variable." + language;
-    var fixedSizePref = "font.size.fixed." + language;
-    var minSizePref = "font.minimum-size." + language;
-    var currDefaultFont = "serif", currVariableSize = 12, currFixedSize = 12, minSizeVal = 0;
-    try {
-      currDefaultFont = pref.CopyUnicharPref(defaultFontPref);
-      currVariableSize = pref.GetIntPref(variableSizePref);
-      currFixedSize = pref.GetIntPref(fixedSizePref );
-      minSizeVal = pref.GetIntPref(minSizePref);
-    }
-    catch(e) {
-    }
-    if (currDefaultFont != dataObject.languageData[language].defaultFont)
-      pref.SetUnicharPref(defaultFontPref, dataObject.languageData[language].defaultFont);
-    if (currVariableSize != dataObject.languageData[language].variableSize)
-      pref.SetIntPref(variableSizePref, dataObject.languageData[language].variableSize);
-    if (currFixedSize != dataObject.languageData[language].fixedSize)
-      pref.SetIntPref(fixedSizePref, dataObject.languageData[language].fixedSize);
-    if (minSizeVal != dataObject.languageData[language].minSize) {
-      pref.SetIntPref(minSizePref, dataObject.languageData[language].minSize);
-    }
-  }
-
-  // font scaling
-  var fontDPI = parseInt(dataObject.fontDPI);
-  var myFonts = dataObject.dataEls["useMyFonts"].checked;
-  var myColors = dataObject.dataEls["useMyColors"].checked;
-  try {
-    var currDPI = pref.GetIntPref("browser.display.screen_resolution");
-    var currFonts = pref.GetIntPref("browser.display.use_document_fonts");
-    var currColors = pref.GetBoolPref("browser.display.use_document_colors");
-    var currDefault = pref.CopyUnicharPref( "font.default" );
-  }
-  catch(e) {
-  }
-
-  if (currDPI != fontDPI)
-    pref.SetIntPref("browser.display.screen_resolution", fontDPI);
-  if (currFonts == myFonts)
-    pref.SetIntPref("browser.display.use_document_fonts", !myFonts);
-  if (currColors == myColors)
-    pref.SetBoolPref("browser.display.use_document_colors", !myColors);
-
-  var items = ["foregroundText", "background", "unvisitedLinks", "visitedLinks"];
-  var prefs = ["browser.display.foreground_color", "browser.display.background_color",
-                "browser.anchor_color", "browser.visited_color"];
-  var prefvalue;
-  for (var i = 0; i < items.length; ++i) {
-    prefvalue = dataObject.dataEls[items[i]].value;
-    pref.SetUnicharPref(prefs[i], prefvalue)
-  }
-  items = ["browserUseSystemColors", "browserUnderlineAnchors"];
-  prefs = ["browser.display.use_system_colors", "browser.underline_anchors"];
-  for (i = 0; i < items.length; ++i) {
-    prefvalue = dataObject.dataEls[items[i]].checked;
-    pref.SetBoolPref(prefs[i], prefvalue)
-  }
-}
-
-# this function is only reached if the shell service is defined
-function checkNow()
-{
-  var shellSvc = Components.classes["@mozilla.org/browser/shell-service;1"]
-                           .getService(Components.interfaces.nsIShellService);
-  var brandBundle = document.getElementById("bundle_brand");
-  var shellBundle = document.getElementById("bundle_shell");
-  var brandShortName = brandBundle.getString("brandShortName");
-  var promptTitle = shellBundle.getString("setDefaultBrowserTitle");
-  var promptMessage;
-  const IPS = Components.interfaces.nsIPromptService;
-  var psvc = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
-                       .getService(IPS);
-  if (!shellSvc.isDefaultBrowser(false)) {
-    promptMessage = shellBundle.getFormattedString("setDefaultBrowserMessage", 
-                                                   [brandShortName]);
-    var rv = psvc.confirmEx(window, promptTitle, promptMessage, 
-                            (IPS.BUTTON_TITLE_YES * IPS.BUTTON_POS_0) + 
-                            (IPS.BUTTON_TITLE_NO * IPS.BUTTON_POS_1),
-                            null, null, null, null, { });
-    if (rv == 0)
-      shellSvc.setDefaultBrowser(true, false);
-  }
-  else {
-    promptMessage = shellBundle.getFormattedString("alreadyDefaultBrowser",
-                                                   [brandShortName]);
-    psvc.alert(window, promptTitle, promptMessage);
-  }
-}
-
-function showLanguages()
-{
-  openDialog("chrome://browser/content/pref/pref-languages.xul", "", "modal,centerscreen,resizable");
-}
Index: browser/components/prefwindow/content/pref-navigator.xul
===================================================================
RCS file: browser/components/prefwindow/content/pref-navigator.xul
diff -N browser/components/prefwindow/content/pref-navigator.xul
--- browser/components/prefwindow/content/pref-navigator.xul	1 Feb 2005 17:36:51 -0000	1.27
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,127 +0,0 @@
-<?xml version="1.0"?> 
-# -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
-# ***** 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.org Code.
-#
-# The Initial Developer of the Original Code is
-# Doron Rosenberg.
-# Portions created by the Initial Developer are Copyright (C) 2001
-# the Initial Developer. All Rights Reserved.
-#
-# Contributor(s):
-#
-# 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 *****
-
-<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
-
-<!DOCTYPE window [
-<!ENTITY % brandDTD SYSTEM "chrome://global/locale/brand.dtd" >
-%brandDTD;
-<!ENTITY % prefNavigatorDTD SYSTEM "chrome://browser/locale/pref/pref-navigator.dtd" >
-%prefNavigatorDTD;
-]>
-
-<page xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
-      id="pref-navigator"      
-      onload="parent.initPanel('chrome://browser/content/pref/pref-navigator.xul');"
-      headertitle="&lHeader;">
-
-  <stringbundle id="bundle_prefutilities" src="chrome://browser/locale/pref/prefutilities.properties"/>
-  <stringbundle id="bundle_brand" src="chrome://global/locale/brand.properties"/>
-  <stringbundle id="bundle_shell" src="chrome://browser/locale/shellservice.properties"/>
-  <script type="application/x-javascript" src="chrome://browser/content/pref/pref-navigator.js"/>
-
-  <!-- homepage specification -->
-  <groupbox>
-    <caption label="&header2.label;"/>
-    <hbox align="center" flex="1">
-      <label value="&location.label;" accesskey="&location.accesskey;" control="browserStartupHomepage"/>
-      <textbox id="browserStartupHomepage" type="autocomplete" class="padded" flex="1" 
-               autocompletesearch="history" oninput="parent.homepage = this.value;"
-               preftype="localizedstring"
-               prefstring="browser.startup.homepage"/>  <!-- we may wish to change this to data
-                                               when we support fancy formatted local filenames -->
-    </hbox>
-    <hbox align="center" pack="end">
-      <button label="&useCurrent.label;" accesskey="&useCurrent.accesskey;"
-              label2="&useCurrentMultiple.label;"
-              oncommand="setHomePageToCurrentPage();"
-              id="browserUseCurrent"
-              prefstring="pref.browser.homepage.disable_button.current_page"/>
-      <button label="&useBookmark.label;" accesskey="&useBookmark.accesskey;"
-              oncommand="setHomePageToBookmark();"
-              id="browserUseBookmark"
-              prefstring="pref.browser.homepage.disable_button.bookmark_page"/>
-      <button label="&useBlank.label;" accesskey="&useBlank.accesskey;"
-              oncommand="document.getElementById('browserStartupHomepage').value = 'about:blank';"
-              id="browserUseBlank"
-              prefstring="pref.browser.homepage.disable_button.blank_page"/>
-    </hbox>
-  </groupbox>
-
-  <groupbox>
-    <caption label="&fonts.caption;"/>
-    <hbox align="center">
-      <description flex="1">&fontsInfo.label;</description>
-      <button label="&showFontsAndColors.label;" 
-              accesskey="&showFontsAndColors.accesskey;" 
-              oncommand="showFontsAndColors();"/>
-    </hbox>
-  </groupbox>
-
- <groupbox>
-    <caption label="&languages.caption;"/>
-    <hbox align="center">
-      <description flex="1">&languagesInfo.label;</description>
-      <button label="&showLanguages.label;"
-              accesskey="&showLanguages.accesskey;"
-              oncommand="showLanguages();"/>
-    </hbox>
-  </groupbox>
-
-  <groupbox orient="horizontal" id="defaultBrowserPrefs">
-    <caption label="&defaultBrowserGroup.label;"/>
-    <hbox align="center" flex="1">      
-      <checkbox id="checkForDefault" prefstring="browser.shell.checkDefaultBrowser"
-                label="&checkForDefault.label;" accesskey="&checkForDefault.accesskey;"
-                flex="1"/>
-      <button label="&checkNow.label;" accesskey="&checkNow.accesskey;"
-              oncommand="checkNow()"/>
-    </hbox>
-  </groupbox>
-
-  <groupbox>
-    <caption label="&connectionsInfo.caption;"/>
-    <hbox align="center">
-      <description flex="1">&proxiesInfo.label;</description>
-      <button id="catProxiesButton" label="&showConnections.label;" 
-              accesskey="&showConnections.accesskey;" 
-              oncommand="showConnections();"/>
-    </hbox>
-  </groupbox>
-</page>
-
Index: browser/components/prefwindow/content/pref-privacy.js
===================================================================
RCS file: browser/components/prefwindow/content/pref-privacy.js
diff -N browser/components/prefwindow/content/pref-privacy.js
--- browser/components/prefwindow/content/pref-privacy.js	1 Feb 2005 17:36:51 -0000	1.19
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,406 +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.org Code.
-#
-# The Initial Developer of the Original Code is
-# Doron Rosenberg.
-# Portions created by the Initial Developer are Copyright (C) 2001
-# the Initial Developer. All Rights Reserved.
-#
-# Contributor(s):
-#   Ben Goodger <ben@netscape.com> (Original Author)
-#   Dan Dwitte <dwitte@stanford.edu>
-#   Pierre Chanial <p_ch@verizon.net>
-#
-# 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 *****
-
-#define DL_RETAIN_WINDOW 0
-
-var _elementIDs = ["histDay", "browserCacheDiskCache", "cookieBehavior", "enableCookies",
-                   "enableCookiesForOriginatingSiteOnly", "networkCookieLifetime",
-                   "enableFormFill", "enablePasswords", 
-                   "downloadsRetentionPolicy"];
-
-function Startup() {
-
-  // Initially disable the clear buttons when needed
-  var globalHistory = Components.classes["@mozilla.org/browser/global-history;2"].getService(Components.interfaces.nsIBrowserHistory);
-  document.getElementById("history").setAttribute("cleardisabled", globalHistory.count == 0);
-  
-  var cookieMgr = Components.classes["@mozilla.org/cookiemanager;1"].getService();
-  cookieMgr = cookieMgr.QueryInterface(Components.interfaces.nsICookieManager);
-  var e = cookieMgr.enumerator;
-  document.getElementById("cookies").setAttribute("cleardisabled", !e.hasMoreElements());
-
-  var passwdMgr = Components.classes["@mozilla.org/passwordmanager;1"].getService();
-  passwdMgr = passwdMgr.QueryInterface(Components.interfaces.nsIPasswordManager);
-  e = passwdMgr.enumerator;
-  document.getElementById("passwords").setAttribute("cleardisabled", !e.hasMoreElements());
-
-  try {
-    e = PrivacyPanel.getDownloads();
-    var hasDownloads = e.hasMoreElements();
-  }
-  catch (e) {
-    hasDownloads = false;
-  }
-  document.getElementById("downloads").setAttribute("cleardisabled", !hasDownloads);
-  
-  var formHistory = Components.classes["@mozilla.org/satchel/form-history;1"]
-                              .getService(Components.interfaces.nsIFormHistory);
-  document.getElementById("formfill").setAttribute("cleardisabled", formHistory.rowCount == 0);
-  
-  // set up the pref checkboxes according to the network.cookie.cookieBehavior pref
-  // 0: enabled
-  // 1: enabled for originating website only
-  // 2: disabled
-  var cookieBehavior = document.getElementById("cookieBehavior").getAttribute("value");
-  document.getElementById("enableCookies").checked = cookieBehavior != 2;
-  document.getElementById("enableCookiesForOriginatingSiteOnly").checked = cookieBehavior == 1;
-  updateCookieBroadcaster();
-
-  var categories = document.getElementById("privacyCategories");
-  categories.addEventListener("clear", PrivacyPanel.clear, false);
-
-  // XXXben - we do this because of a bug with the download retention window menulist. 
-  // The bug is that when the Options dialog opens, or you switch from another panel to
-  // this panel, style is incompletely resolved on the menulist's display area anonymous
-  // content - it is resolved on the all a/c subcomponents *except* menulist-label (the
-  // text nodes)... and (as a result, I think) when style is resolved later as the menulist
-  // goes from visbility: collapse to being visible, the menulist-label has the wrong parent
-  // style context which causes the style context parent checking to complain heartily. The
-  // symptom is that the menulist is not initialized with the currently selected value from
-  // preferences. I suspect this is related to the fact that the menulist is inserted into
-  // an XBL insertion point, as this problem does not occur when the menulist is placed outside
-  // the bound element. dbaron is helping me with this with a reduced test case, but in 
-  // the meantime, I'm working around this bug by placing the menulist outside the bound element
-  // until it is completely initialized and then scooting it in, which is what this code does. 
-  var drb = document.getElementById("downloadsRetentionBox");
-  var drp = document.getElementById("downloadsRetentionPolicy");
-  drp.removeAttribute("hidden");
-  document.documentElement.removeChild(drp);
-  drb.appendChild(drp);
-  
-  setMasterPasswordButtonLabel();
-}
-
-function unload()
-{
-  var categories = document.getElementById("privacyCategories");
-  for (var i = 0; i < categories.childNodes.length; ++i) {
-    var expander = categories.childNodes[i];
-    document.persist(expander.id, "open");
-  }  
-}
-
-function cookieViewerOnPrefsOK()
-{
-  var dataObject = parent.hPrefWindow.wsm.dataManager.pageData["chrome://browser/content/cookieviewer/CookieViewer.xul"].userData;
-  if ('deletedCookies' in dataObject) {
-    var cookiemanager = Components.classes["@mozilla.org/cookiemanager;1"].getService();
-    cookiemanager = cookiemanager.QueryInterface(Components.interfaces.nsICookieManager);
-
-    for (var p = 0; p < dataObject.deletedCookies.length; ++p) {
-      cookiemanager.remove(dataObject.deletedCookies[p].host,
-                           dataObject.deletedCookies[p].name,
-                           dataObject.deletedCookies[p].path,
-                           dataObject.cookieBool);
-    }
-  }
-}
-
-var PrivacyPanel = {
-  confirm: function (aTitle, aMessage, aActionButtonLabel)
-  {
-    var promptService = Components.classes["@mozilla.org/embedcomp/prompt-service;1"].getService(Components.interfaces.nsIPromptService);
-
-    var flags = promptService.BUTTON_TITLE_IS_STRING * promptService.BUTTON_POS_0;
-    flags += promptService.BUTTON_TITLE_CANCEL * promptService.BUTTON_POS_1;
-
-    rv = promptService.confirmEx(window, aTitle, aMessage, flags, aActionButtonLabel, null, null, null, { value: 0 });
-    return rv == 0;
-  },
-
-  clear: function (aEvent) {
-    if (aEvent.target.localName != "expander") 
-      return;
-      
-    var rv = PrivacyPanel.clearData[aEvent.target.id](true);
-    if (rv)
-      aEvent.target.setAttribute("cleardisabled", "true");
-  },
-  
-  clearAll: function () {
-    var privacyBundle = document.getElementById("privacyBundle");
-    var title = privacyBundle.getString("prefRemoveAllTitle");
-    var msg = privacyBundle.getString("prefRemoveAllMsg");
-    var button = privacyBundle.getString("prefRemoveAllRemoveButton");
-    
-    if (PrivacyPanel.confirm(title, msg, button)) {
-      for (var fn in PrivacyPanel.clearData) {
-        PrivacyPanel.clearData[fn](false);
-        document.getElementById(fn).setAttribute("cleardisabled", "true");
-      }
-    }
-  },
-  
-  getDownloads: function() {
-    var dlMgr = Components.classes["@mozilla.org/download-manager;1"].getService(Components.interfaces.nsIDownloadManager);
-    var ds = dlMgr.datasource;
-    
-    var rdfs = Components.classes["@mozilla.org/rdf/rdf-service;1"].getService(Components.interfaces.nsIRDFService);
-    var root = rdfs.GetResource("NC:DownloadsRoot");
-    
-    var rdfc = Components.classes["@mozilla.org/rdf/container;1"].createInstance(Components.interfaces.nsIRDFContainer);
-    rdfc.Init(ds, root);
-  
-    return rdfc.GetElements();
-  },
-  
-  clearData: { 
-    // The names of these functions match the id of the expander in the XUL file that correspond
-    // to them. 
-    history: function ()
-    {
-      var globalHistory = Components.classes["@mozilla.org/browser/global-history;2"]
-                                    .getService(Components.interfaces.nsIBrowserHistory);
-      globalHistory.removeAllPages();
-      
-      var os = Components.classes["@mozilla.org/observer-service;1"].getService(Components.interfaces.nsIObserverService);
-      os.notifyObservers(null, "browser:purge-session-history", "");
-      
-      return true;
-    },
-    
-    cache: function ()
-    {
-      function clearCacheOfType(aType)
-      {
-        var classID = Components.classes["@mozilla.org/network/cache-service;1"];
-        var cacheService = classID.getService(Components.interfaces.nsICacheService);
-        cacheService.evictEntries(aType);
-      }
-    
-      clearCacheOfType(Components.interfaces.nsICache.STORE_ON_DISK);
-      clearCacheOfType(Components.interfaces.nsICache.STORE_IN_MEMORY);
-      
-      return true;
-    },
-    
-    cookies: function ()
-    { 
-      var cookieMgr = Components.classes["@mozilla.org/cookiemanager;1"].getService();
-      cookieMgr = cookieMgr.QueryInterface(Components.interfaces.nsICookieManager);
-
-      var e = cookieMgr.enumerator;
-      var cookies = [];
-      while (e.hasMoreElements()) {
-        var cookie = e.getNext().QueryInterface(Components.interfaces.nsICookie);
-        cookies.push(cookie);
-      }
-
-      for (var i = 0; i < cookies.length; ++i)
-        cookieMgr.remove(cookies[i].host, cookies[i].name, cookies[i].path, false);
-      
-      return true;
-    },
-    
-    formfill: function ()
-    {
-      var formHistory = Components.classes["@mozilla.org/satchel/form-history;1"]
-                                  .getService(Components.interfaces.nsIFormHistory);
-      formHistory.removeAllEntries();
-      
-      return true;
-    },
-    
-    downloads: function ()
-    {
-      var dlMgr = Components.classes["@mozilla.org/download-manager;1"].getService(Components.interfaces.nsIDownloadManager);
-      try {
-        var downloads = PrivacyPanel.getDownloads();
-      }
-      catch (e) {
-        return true;
-      }
-
-      var rdfs = Components.classes["@mozilla.org/rdf/rdf-service;1"].getService(Components.interfaces.nsIRDFService);
-      var state = rdfs.GetResource("http://home.netscape.com/NC-rdf#DownloadState");
-      var ds = dlMgr.datasource;
-      var dls = [];
-      
-      while (downloads.hasMoreElements()) {
-        var download = downloads.getNext().QueryInterface(Components.interfaces.nsIRDFResource);
-        dls.push(download);
-      }
-      dlMgr.startBatchUpdate();
-      for (var i = 0; i < dls.length; ++i) {
-        try {
-          dlMgr.removeDownload(dls[i].Value);
-        }
-        catch (e) {
-        }
-      }
-      dlMgr.endBatchUpdate();  
-      
-      return true;
-    },
-    
-    passwords: function (aShowPrompt)
-    {
-      var privacyBundle = document.getElementById("privacyBundle");
-      var title = privacyBundle.getString("prefRemovePasswdsTitle");
-      var msg = privacyBundle.getString("prefRemovePasswdsMsg");
-      var button = privacyBundle.getString("prefRemovePasswdsRemoveButton");
-      
-      if (!aShowPrompt || PrivacyPanel.confirm(title, msg, button)) {
-        var passwdMgr = Components.classes["@mozilla.org/passwordmanager;1"].getService();
-        passwdMgr = passwdMgr.QueryInterface(Components.interfaces.nsIPasswordManager);
-
-        var e = passwdMgr.enumerator;
-        var passwds = [];
-        while (e.hasMoreElements()) {
-          var passwd = e.getNext().QueryInterface(Components.interfaces.nsIPassword);
-          passwds.push(passwd);
-        }
-        
-        for (var i = 0; i < passwds.length; ++i)
-          passwdMgr.removeUser(passwds[i].host, passwds[i].user);
-
-        return true;
-      }
-      return false;
-    }
-  }  
-}
-
-function viewCookies() 
-{
-  window.openDialog("chrome://browser/content/cookieviewer/CookieViewer.xul","_blank",
-                    "chrome,resizable=yes", "cookieManager");
-}
-
-function viewCookieExceptions()
-{
-  var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"]
-                     .getService(Components.interfaces.nsIWindowMediator);
-  var existingWindow = wm.getMostRecentWindow("exceptions");
-  if (existingWindow) {
-    existingWindow.setHost("");
-    existingWindow.focus();
-  }
-  else {
-    var params = { blockVisible   : true,
-                   sessionVisible : true,
-                   allowVisible   : true,
-                   prefilledHost  : "",
-                   permissionType : "cookie" };
-    window.openDialog("chrome://browser/content/cookieviewer/CookieExceptions.xul",
-                      "_blank", "chrome,modal,resizable=yes", params);
-  }
-}
-
-function viewSignons() 
-{
-  window.openDialog("chrome://passwordmgr/content/passwordManager.xul","_blank",
-                    "chrome,resizable=yes", "8");
-}
-
-function updateCookieBehavior()
-{
-  var cookiesEnabled = document.getElementById("enableCookies").checked;
-  var cookiesOriginating = document.getElementById("enableCookiesForOriginatingSiteOnly").checked;
-  document.getElementById("cookieBehavior").setAttribute("value", cookiesEnabled ? (cookiesOriginating ? 1 : 0) : 2);
-}
-
-function updateCookieBroadcaster()
-{
-  cookieBehaviorIsLocked = parent.hPrefWindow.getPrefIsLocked("network.cookie.cookieBehavior");
-  cookieLifetimeIsLocked = parent.hPrefWindow.getPrefIsLocked("network.cookie.lifetimePolicy");
-
-  var broadcaster = document.getElementById("cookieBroadcaster");
-  var checkbox    = document.getElementById("enableCookies");
-  var radiogroup  = document.getElementById("networkCookieLifetime");
-  if (!checkbox.checked) {
-    broadcaster.setAttribute("disabled", "true");
-    document.getElementById("enableCookiesForOriginatingSiteOnly").checked = false;
-    radiogroup.setAttribute("disabled", "true");
-  }
-  else {
-    broadcaster.removeAttribute("disabled");
-    if (!cookieLifetimeIsLocked)
-      radiogroup.removeAttribute("disabled");
-  }
-  if (cookieBehaviorIsLocked) {
-    checkbox.setAttribute("disabled", "true");
-    broadcaster.setAttribute("disabled", "true");
-  }
-}
-
-function unexpandOld(event)
-{
-  var box = document.getElementById("privacyCategories");
-  var newExpander = event.originalTarget.parentNode.parentNode;
-  for (var i = 0; i < box.childNodes.length; ++i) {
-    if (box.childNodes[i] != newExpander && box.childNodes[i].getAttribute("open"))
-      box.childNodes[i].open = false;
-  }
-}
-
-function changeMasterPassword()
-{
-  window.openDialog("chrome://browser/content/pref/pref-masterpass.xul","",
-                    "chrome,centerscreen,modal,resizable=yes");
-  setMasterPasswordButtonLabel();
-}
-
-function setMasterPasswordButtonLabel()
-{
-  // see if there's a master password and set the button label accordingly
-  const nsPKCS11ModuleDB = "@mozilla.org/security/pkcs11moduledb;1";
-  const nsIPKCS11ModuleDB = Components.interfaces.nsIPKCS11ModuleDB;
-  const nsIPKCS11Slot = Components.interfaces.nsIPKCS11Slot;
-
-  var secmoddb = Components.classes[nsPKCS11ModuleDB].getService(nsIPKCS11ModuleDB);
-  var slot = secmoddb.findSlotByName("");
-
-  if (slot) {
-    var status = slot.status;
-    var masterPasswordBtn = document.getElementById("masterPasswordBtn");
-    var privacyBundle = document.getElementById("privacyBundle");
-    var buttonLabel = "";
-    if (status == nsIPKCS11Slot.SLOT_UNINITIALIZED
-      || status == nsIPKCS11Slot.SLOT_READY) {
-
-      buttonLabel = privacyBundle.getString("setMasterPassword");
-      masterPasswordBtn.setAttribute("label",buttonLabel);
-    } else {
-      buttonLabel = privacyBundle.getString("changeMasterPassword");
-      masterPasswordBtn.setAttribute("label",buttonLabel);
-    }
-  }
-}
Index: browser/components/prefwindow/content/pref-privacy.xul
===================================================================
RCS file: browser/components/prefwindow/content/pref-privacy.xul
diff -N browser/components/prefwindow/content/pref-privacy.xul
--- browser/components/prefwindow/content/pref-privacy.xul	1 Feb 2005 17:36:51 -0000	1.25
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,174 +0,0 @@
-<?xml version="1.0"?> 
-# -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
-# ***** 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.org Code.
-#
-# The Initial Developer of the Original Code is
-# Doron Rosenberg.
-# Portions created by the Initial Developer are Copyright (C) 2001
-# the Initial Developer. All Rights Reserved.
-#
-# Contributor(s):
-#   Ben Goodger <ben@netscape.com> (Original Author)
-#
-# 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 *****
-
-<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
-<?xml-stylesheet href="chrome://mozapps/skin/pref/pref.css" type="text/css"?>
-<?xml-stylesheet href="chrome://browser/skin/pref/pref.css" type="text/css"?>
-
-<!DOCTYPE window [
-<!ENTITY % brandDTD SYSTEM "chrome://global/locale/brand.dtd" >
-%brandDTD;
-<!ENTITY % prefPrivacyDTD SYSTEM "chrome://browser/locale/pref/pref-privacy.dtd" >
-%prefPrivacyDTD;
-]>
-
-<page xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
-      onload="parent.initPanel('chrome://browser/content/pref/pref-privacy.xul');"
-      onunload="unload();" headertitle="&lHeader;">
-
-  <script type="application/x-javascript" src="chrome://browser/content/pref/pref-privacy.js"/>
-
-  <stringbundle id="privacyBundle" src="chrome://browser/locale/pref/prefutilities.properties"/>
-
-  <broadcaster id="cookieBroadcaster"/>
-
-  <description>&privacyDescription.label;</description>
-
-  <vbox id="privacyCategories" class="listBox settingsBox" flex="1" style="overflow: auto;"
-        oncommand="if (event.originalTarget.getAttribute('anonid') == 'disclosure') unexpandOld(event);"
-        onclick="if (event.originalTarget.getAttribute('anonid') == 'label') unexpandOld(event);">
-    <!-- History -->
-    <expander id="history" label="&history.label;" clearlabel="&clearHistory.label;" onclear="clearHistory();"
-              open="true" persist="open">
-      <hbox align="center">
-        <label value="&pageHis.label;" accesskey="&pageHis.accesskey;" control="histDay"/>
-        <textbox id="histDay" size="3"
-                  preftype="int" prefstring="browser.history_expire_days"/>
-        <label value="&days.label;"/>
-      </hbox>
-    </expander>
-    
-    <!-- Automatic Form Fill -->
-    <expander id="formfill" label="&formfill.label;" clearlabel="&clearFormfill.label;" persist="open">
-      <description>&formfillDescription.label;</description>
-      <checkbox id="enableFormFill" label="&formfillEnable.label;" accesskey="&formfillEnable.accesskey;"
-                prefstring="browser.formfill.enable"/>
-    </expander>
-
-    <!-- Passwords -->
-    <expander id="passwords" label="&passwords.label;" clearlabel="&clearPasswords.label;" persist="open">
-      <hbox flex="1">
-        <vbox flex="1">
-          <description>&passwordsDescription.label;</description>
-          <checkbox id="enablePasswords" label="&passwordsEnable.label;" accesskey="&passwordsEnable.accesskey;"
-                    prefstring="signon.rememberSignons"/>
-        </vbox>
-        <vbox>
-          <button label="&viewPasswords.label;" oncommand="viewSignons();"/>
-          <button id="masterPasswordBtn" label="" oncommand="changeMasterPassword();"/>
-        </vbox>
-      </hbox>
-    </expander>
-
-    <!-- Downloaded Files List -->
-    <expander id="downloads" label="&downloads.label;" clearlabel="&clearDownloads.label;" persist="open">
-      <description>&downloadsDescription.label;</description>     
-
-      <hbox align="center" id="downloadsRetentionBox">                          
-        <description>&downloadsRetentionPolicy.label;</description>             
-      </hbox>                                                                         
-    </expander>
-
-    <!-- Cookies -->
-    <expander id="cookies" label="&cookies.label;" clearlabel="&clearCookies.label;" persist="open">
-      <vbox flex="1">
-        <description>&cookieExplanation.label;</description>
-        <separator class="thin"/>
-        <hbox>
-          <vbox flex="1">
-            <data id="cookieBehavior" prefstring="network.cookie.cookieBehavior" preftype="int"/>
-            <checkbox id="enableCookies"
-                      oncommand="updateCookieBehavior();updateCookieBroadcaster();"
-                      label="&enableCookies.label;" accesskey="&enableCookies.accesskey;"/>
-            <checkbox id="enableCookiesForOriginatingSiteOnly" observes="cookieBroadcaster"
-                      label="&forOriginatingSiteOnly.label;" accesskey="&forOriginatingSiteOnly.accesskey;"
-                      style="margin-left: 23px;" oncommand="updateCookieBehavior();"/>
-            <separator class="thin"/>
-            <hbox align="center">
-              <description>&cookieRetention.label;</description>
-              <menulist id="networkCookieLifetime" 
-                        prefstring="network.cookie.lifetimePolicy">
-                <menupopup>
-                  <menuitem value="0" label="&acceptNormally.label;"/>
-                  <menuitem value="2" label="&acceptForSession.label;"/>
-                  <menuitem value="1" label="&askAboutCookies.label;"/>
-                </menupopup>
-              </menulist>
-            </hbox>
-          </vbox>
-          <vbox>
-            <hbox pack="end">
-              <button label="&exceptions.label;" oncommand="viewCookieExceptions();"/>
-              <button label="&viewCookies.label;" oncommand="viewCookies();"/>
-            </hbox>
-          </vbox>
-        </hbox>
-      </vbox>
-    </expander>    
-    
-    <!-- Cache -->
-    <expander id="cache" label="&cache.label;" clearlabel="&clearCache.label;" persist="open">
-      <label value="&cacheExplanation.label;"/>
-      <separator class="thin"/>
-      <hbox align="center">
-        <label value="&diskCache.label;" accesskey="&diskCache.accesskey;" control="browserCacheDiskCache"/>
-        <textbox id="browserCacheDiskCache" size="8" preftype="int"
-                  prefstring="browser.cache.disk.capacity"/>
-        <label value="&kbytes;"/>
-      </hbox>    
-    </expander>
-  </vbox>
-
-  <hbox pack="end" align="center">
-    <label>&clearAllDescription.label;</label>
-    <button label="&clearAll.label;" oncommand="PrivacyPanel.clearAll();"/>
-  </hbox>
-
-
-  <menulist id="downloadsRetentionPolicy" hidden="true"
-            preftype="int" prefstring="browser.download.manager.retention" prefdefval="0">
-    <menupopup>
-      <menuitem value="0" label="&downloadsRemoveImmediately.label;"/>
-      <menuitem value="1" label="&downloadsRemoveExit.label;"/>
-      <menuitem value="2" label="&downloadsRemoveManually.label;"/>
-    </menupopup>
-  </menulist>
-
-</page>
-    
Index: browser/components/prefwindow/content/pref-themes.js
===================================================================
RCS file: browser/components/prefwindow/content/pref-themes.js
diff -N browser/components/prefwindow/content/pref-themes.js
--- browser/components/prefwindow/content/pref-themes.js	1 Feb 2005 17:36:51 -0000	1.17
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,217 +0,0 @@
-# -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
-# ***** 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.org Code.
-#
-# The Initial Developer of the Original Code is
-# Doron Rosenberg.
-# Portions created by the Initial Developer are Copyright (C) 2001
-# the Initial Developer. All Rights Reserved.
-#
-# Contributor(s):
-#   Ben Goodger <ben@netscape.com> (Original Author)
-#   Blake Ross <blaker@netscape.com>
-#
-# 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 gData;
-const kPrefSvcContractID = "@mozilla.org/preferences;1";
-const kPrefSvcIID = Components.interfaces.nsIPref;
-const gPrefSvc = Components.classes[kPrefSvcContractID].getService(kPrefSvcIID);
-
-try {
-  var chromeRegistry = Components.classes["@mozilla.org/chrome/chrome-registry;1"].getService();
-  if (chromeRegistry)
-    chromeRegistry = chromeRegistry.QueryInterface(Components.interfaces.nsIXULChromeRegistry);
-}
-catch(e) {}
-
-function Startup()
-{
-  gData = parent.hPrefWindow.wsm.dataManager.pageData["chrome://browser/content/pref/pref-themes.xul"].userData;
-  var list = document.getElementById( "skinsList" );
-  if ("loaded" in gData && "themeIndex" in gData) {
-    list.selectedIndex = gData.themeIndex;    
-    removeInvalidThemes();
-    return;
-  }
-  gData.loaded = true;
-  parent.hPrefWindow.registerOKCallbackFunc(applyTheme);
-
-  var theme = null;
-  try {
-    theme = gPrefSvc.getComplexValue("general.skins.selectedSkin",
-                                     Components.interfaces.nsISupportsString).data;
-  } catch (e) {
-  }
-  var matches;
-  for (var i = 0; i < list.childNodes.length; ++i) {
-    var child = list.childNodes[i];
-    var name = child.getAttribute("name");
-    if (!theme)
-      matches = chromeRegistry.isSkinSelectedForPackage(name, "browser", true);
-    else
-      matches = name == theme;
-    if (matches) {
-      list.selectItem(child);
-      break;
-    }      
-  }
-  removeInvalidThemes();
-}
-
-function removeInvalidThemes() {
-  var list = document.getElementById( "skinsList" );
-  for (var i = 0; i < list.childNodes.length; ++i) {
-    var child = list.childNodes[i];
-    var name = child.getAttribute("name");
-    if (name) {
-      var oldTheme = !chromeRegistry.checkThemeVersion(name);
-      if (oldTheme) {
-        list.removeItemAt(i);
-        i--;
-      }
-    }
-  }
-}
-
-function applyTheme()
-{
-  var data = parent.hPrefWindow.wsm.dataManager.pageData["chrome://browser/content/pref/pref-themes.xul"].userData;
-  if (data.name == null)
-    return;
-
-  const kPrefSvcContractID = "@mozilla.org/preferences;1";
-  const kPrefSvcIID = Components.interfaces.nsIPref;
-  var prefSvc = Components.classes[kPrefSvcContractID].getService(kPrefSvcIID);
-
-  var theme = null;
-  try {
-    theme = prefSvc.getComplexValue("general.skins.selectedSkin",
-                                     Components.interfaces.nsISupportsString).data;
-  } catch (e) {
-  }
-
-  if (theme == data.name) return;
-
-  try {
-    var reg = Components.classes["@mozilla.org/chrome/chrome-registry;1"].getService();
-    if (reg)
-      reg = reg.QueryInterface(Components.interfaces.nsIXULChromeRegistry);
-  }
-  catch(e) {}
-
-  var inUse = reg.isSkinSelected(data.name, true);
-  if (!theme && inUse == Components.interfaces.nsIChromeRegistry.FULL) return;
-
-  var chromeRegistry = Components.classes["@mozilla.org/chrome/chrome-registry;1"]
-    .getService(Components.interfaces.nsIXULChromeRegistry);
-
-  var str = Components.classes["@mozilla.org/supports-string;1"]
-                      .createInstance(Components.interfaces.nsISupportsString);
-  str.data = data.name;
-  prefSvc.setComplexValue("general.skins.selectedSkin", Components.interfaces.nsISupportsString, str);
-
-
-  chromeRegistry.selectSkin(data.name, true);
-  chromeRegistry.refreshSkins();
-}
-
-
-function uninstallSkin()
-{
-  var list = document.getElementById("skinsList");
-  var selectedSkinItem = list.selectedItems[0];
-  var skinName = selectedSkinItem.getAttribute("name");
-  var inUse = chromeRegistry.isSkinSelected(skinName, true);
-  chromeRegistry.uninstallSkin(skinName, true);
-  if (inUse)
-    chromeRegistry.refreshSkins();
-  list.selectedIndex = 0;
-}
-
-function themeSelect()
-{
-  var list = document.getElementById("skinsList");
-
-  if (!list)
-    return;
-
-  var prefbundle = document.getElementById("bundle_prefutilities");
-
-  var selectedItem = list.selectedItems.length ? list.selectedItems[0] : null;
-  if (selectedItem && selectedItem.getAttribute("skin") == "true") {
-    var themeName = selectedItem.getAttribute("displayName");
-    var skinName = selectedItem.getAttribute("name");
-    gData.name = skinName;
-    gData.themeIndex = list.selectedIndex;
-
-    var nameField = document.getElementById("displayName");
-    var author = document.getElementById("author");
-    var image = document.getElementById("previewImage");
-    var descText = document.createTextNode(selectedItem.getAttribute("description"));
-    var description = document.getElementById("description");
-    var uninstallButton = document.getElementById("uninstallSkin");
-    var uninstallLabel = prefbundle.getString("uninstallThemePrefix");
-
-    while (description.hasChildNodes())
-      description.removeChild(description.firstChild);
-
-    nameField.setAttribute("value", themeName);
-    
-    author.setAttribute("value", selectedItem.getAttribute("author"));
-    var authorURL = selectedItem.getAttribute("authorURL");
-    if (authorURL != "") {
-      author.setAttribute("link", selectedItem.getAttribute("authorURL"));
-      author.className = "themesLink";
-    }
-    else {
-      author.removeAttribute("link");
-      author.className = "";
-    }
-        
-    image.setAttribute("src", selectedItem.getAttribute("image"));
-
-    // XXX - this sucks and should only be temporary.
-    var selectedSkin = "";
-    try {
-      selectedSkin = gPrefSvc.CopyCharPref("general.skins.selectedSkin");
-    }
-    catch (e) {
-    }
-    description.appendChild(descText);
-    
-    var locType = selectedItem.getAttribute("loctype");
-    uninstallButton.disabled = (selectedSkin == skinName) || (locType == "install");
-    
-    uninstallLabel = uninstallLabel.replace(/%theme_name%/, themeName);
-    uninstallButton.label = uninstallLabel;
-  }
-  else {
-    uninstallButton.disabled = true;
-    gData.name = null;
-  }
-}
Index: browser/components/prefwindow/content/pref-themes.xul
===================================================================
RCS file: browser/components/prefwindow/content/pref-themes.xul
diff -N browser/components/prefwindow/content/pref-themes.xul
--- browser/components/prefwindow/content/pref-themes.xul	1 Feb 2005 17:36:51 -0000	1.26
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,107 +0,0 @@
-<?xml version="1.0"?> 
-# -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
-# ***** 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.org Code.
-#
-# The Initial Developer of the Original Code is
-# Doron Rosenberg.
-# Portions created by the Initial Developer are Copyright (C) 2001
-# the Initial Developer. All Rights Reserved.
-#
-# Contributor(s):
-#   Ben Goodger <ben@netscape.com>
-#
-# 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 *****
-
-<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
-<?xml-stylesheet href="chrome://mozapps/skin/pref/pref.css" type="text/css"?>
-<?xml-stylesheet href="chrome://browser/skin/pref/pref.css" type="text/css"?>
-
-<!DOCTYPE window [
-<!ENTITY % themesDTD SYSTEM "chrome://browser/locale/pref/pref-themes.dtd" >
-%themesDTD;
-<!ENTITY % regionDTD SYSTEM "chrome://global-region/locale/region.dtd" >
-%regionDTD;
-]>
-
-<page xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
-      xmlns:html="http://www.w3.org/1999/xhtml"
-      onload="parent.initPanel('chrome://browser/content/pref/pref-themes.xul');"
-      headertitle="&lHeader;">
-
-  <stringbundle id="bundle_prefutilities"
-                src="chrome://browser/locale/pref/prefutilities.properties"/>
-
-  <script type="application/x-javascript" src="chrome://browser/content/pref/pref-themes.js"/>
-
-  <vbox flex="1">
-    <description>&skinIntro.label;</description>
-  
-    <description>&installedThemes.label;</description>
-  
-    <listbox id="skinsList" datasources="rdf:chrome" 
-          onselect="themeSelect();" flex="1"
-          ref="urn:mozilla:skin:root" rows="3">
-      <template>
-        <rule>
-          <listitem uri="..." skin="true"
-                    label="rdf:http://www.mozilla.org/rdf/chrome#displayName"
-                    author="rdf:http://www.mozilla.org/rdf/chrome#author"
-                    authorURL="rdf:http://www.mozilla.org/rdf/chrome#authorURL"
-                    displayName="rdf:http://www.mozilla.org/rdf/chrome#displayName"
-                    name="rdf:http://www.mozilla.org/rdf/chrome#name"
-                    description="rdf:http://www.mozilla.org/rdf/chrome#description"
-                    image="rdf:http://www.mozilla.org/rdf/chrome#image"
-                    loctype="rdf:http://www.mozilla.org/rdf/chrome#locType"/>
-        </rule>
-      </template>
-    </listbox>
-
-    <separator class="thin"/>
-
-    <vbox class="extensionInfoArea listBox" style="overflow: auto;">
-      <label class="header" id="displayName" value=""/>
-      <hbox pack="start">
-        <label id="author" onclick="parent.visitLink(event);" tooltip="&author.tooltip;"/>
-      </hbox>
-
-      <description>
-        <image id="previewImage"/>
-      </description>
-
-      <description id="description" flex="1"/>
-    </vbox>
-    
-    <hbox align="center">
-      <html:a class="themesLink" id="themesLink" link="&getnew.url;" onclick="parent.visitLink(event);"
-          style="padding-left:4px; display: block;" tooltip="&getnew.tooltip;">&getNewThemes.label;</html:a>
-      <spacer flex="1"/>    
-      <button id="uninstallSkin" label="&uninstallSkin.label;" oncommand="uninstallSkin();"/>
-    </hbox>
-  </vbox>
-
-</page>
Index: browser/components/prefwindow/content/pref.xul
===================================================================
RCS file: browser/components/prefwindow/content/pref.xul
diff -N browser/components/prefwindow/content/pref.xul
--- browser/components/prefwindow/content/pref.xul	30 Nov 2004 08:22:46 -0000	1.26
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,134 +0,0 @@
-<?xml version="1.0"?> 
-<?xml-stylesheet href="chrome://global/skin/" type="text/css"?> 
-<?xml-stylesheet href="chrome://mozapps/skin/pref/pref.css"?>
-<?xml-stylesheet href="chrome://browser/skin/pref/pref.css"?>
-
-<!DOCTYPE window SYSTEM "chrome://browser/locale/pref/pref.dtd" >
-
-<dialog id="prefDialog" 
-        xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
-#ifdef XP_UNIX
-        title="&prefWindowUnix.title;"
-#else
-        title="&prefWindow.title;" 
-#endif
-        style="&prefWindow.size;"
-        buttons="accept,cancel" windowtype="Browser:Options"
-        onload="Startup();" onunload="Shutdown();"
-        ondialogaccept="return hPrefWindow.onOK(event);"
-        ondialogcancel="return hPrefWindow.onCancel(event);"
-        persist="screenX screenY"> 
-
-  <script type="application/x-javascript" src="chrome://global/content/globalOverlay.js"/>
-  <script>
-  <![CDATA[
-
-  var hPrefWindow = null;
-  
-  // If we're starting the Options dialog with a specific panel, we should do certain things
-  // like not remember the last panel the user visited. 
-  var gUsingSpecifiedPage = false;
-
-  // General startup routine for preferences dialog. 
-  //  Place all necessary modifications to pref tree here. 
-  function Startup()
-  {
-    hPrefWindow = new nsPrefWindow("panelFrame");  
-    
-    if(!hPrefWindow)
-      throw "failed to create prefwindow";
-
-    hPrefWindow.init();
-    
-    if ("arguments" in window && window.arguments[0]) {
-      switchPage(window.arguments[0]);
-      gUsingSpecifiedPage = true;
-    
-      document.getElementById("prefsCategories").removeAttribute("persist");
-    } 
-    else // focus the correct menu item
-      button.focus();
-  }
-    
-  function Shutdown ()
-  {
-    if (!gUsingSpecifiedPage) {
-      var prefsCategories = document.getElementById("prefsCategories");
-      for (var i = 0; i < prefsCategories.childNodes.length; ++i) {
-        if (prefsCategories.childNodes[i].checked) {
-          var pref = Components.classes["@mozilla.org/preferences-service;1"]
-                              .getService(Components.interfaces.nsIPrefBranch);
-          pref.setIntPref("browser.preferences.lastpanel", i);
-          break;
-        }
-      }
-      
-      document.persist("prefsDialog", "screenX screenY");
-    }
-  } 
-   
-  function switchPage(aButtonID)
-  {
-    var button = document.getElementById(aButtonID);
-    if (button) {
-      var newURL = button.getAttribute("url");
-      if (hPrefWindow)
-        hPrefWindow.switchPage(newURL, "");
-
-      button.checked = true;
-      button.focus();
-    }
-  }    
-
-  ]]>
-  </script>        
-        
-  <stringbundle id="bundle_prefutilities"
-               src="chrome://browser/locale/pref/prefutilities.properties"/>
-  <script type="application/x-javascript" src="chrome://global/content/nsWidgetStateManager.js"/>
-  <script type="application/x-javascript" src="chrome://browser/content/pref/nsPrefWindow.js"/>
-
-  <hbox flex="1">
-    <vbox id="prefsCategories" class="listBox buttonBox" oncommand="switchPage(event.target.id);" orient="vertical" onmouseover="focus();">
-      <button id="catGeneralButton"   orient="vertical" class="buttonBoxButton" type="radio" group="categories" label="&general.label;"   
-              url="chrome://browser/content/pref/pref-navigator.xul"/>
-      <button id="catPrivacyButton"   orient="vertical" class="buttonBoxButton" type="radio" group="categories" label="&privacy.label;"   
-              url="chrome://browser/content/pref/pref-privacy.xul"/>
-      <button id="catFeaturesbutton"  orient="vertical" class="buttonBoxButton" type="radio" group="categories" label="&features.label;"  
-              url="chrome://browser/content/pref/pref-features.xul"/>
-      <button id="catDownloadsButton" orient="vertical" class="buttonBoxButton" type="radio" group="categories" label="&downloads.label;" 
-              url="chrome://mozapps/content/downloads/pref-downloads.xul"/>
-      <button id="catAdvancedButton"  orient="vertical" class="buttonBoxButton" type="radio" group="categories" label="&advanced.label;"
-              url="chrome://browser/content/pref/pref-advanced.xul"/>
-    </vbox>
-    
-    <vbox flex="1">
-      <dialogheader id="header"/>
-      <iframe id="panelFrame" name="panelFrame" style="width: 0px" flex="1"/>
-    </vbox>
-  </hbox>
-
-  <!-- sigh. this dirty little thing is necessary because the load handler of the 
-       preferences dialog causes the window to be shown even though the preferences
-       panel itself hasn't finished loading. -->
-  <script type="application/x-javascript">
-  <![CDATA[
-    var pref = Components.classes["@mozilla.org/preferences-service;1"]
-                        .getService(Components.interfaces.nsIPrefBranch);
-    var lastPanel = 0;
-    try {
-      lastPanel = pref.getIntPref("browser.preferences.lastpanel");
-    }
-    catch (e) {
-    }
-    
-    var prefsCategories = document.getElementById("prefsCategories");
-    var button = prefsCategories.childNodes[lastPanel];
-    document.getElementById("panelFrame").setAttribute("src", button.getAttribute("url"));
-    button.checked = true;
-  ]]>
-  </script>
-  
-  <separator/>
-     
-</dialog>
Index: browser/locales/jar.mn
===================================================================
RCS file: /cvsroot/mozilla/browser/locales/jar.mn,v
retrieving revision 1.6
diff -p -u -8 -r1.6 jar.mn
--- browser/locales/jar.mn	26 Jan 2005 13:33:53 -0000	1.6
+++ browser/locales/jar.mn	21 Feb 2005 11:21:07 -0000
@@ -13,45 +13,48 @@
     locale/browser/metaData.properties             (%chrome/browser/metaData.properties)
     locale/browser/openLocation.dtd                (%chrome/browser/openLocation.dtd)
     locale/browser/openLocation.properties         (%chrome/browser/openLocation.properties)
     locale/browser/page-drawer.dtd                 (%chrome/browser/page-drawer.dtd)
 *   locale/browser/pageInfo.dtd                    (%chrome/browser/pageInfo.dtd)
     locale/browser/pageInfo.properties             (%chrome/browser/pageInfo.properties)
     locale/browser/pageReport.dtd                  (%chrome/browser/pageReport.dtd)
     locale/browser/pageReportFirstTime.dtd         (%chrome/browser/pageReportFirstTime.dtd)
+    locale/browser/sanitize.dtd                    (%chrome/browser/sanitize.dtd)
     locale/browser/searchbar.properties            (%chrome/browser/searchbar.properties)
     locale/browser/setWallpaper.dtd                (%chrome/browser/setWallpaper.dtd)
     locale/browser/shellservice.properties         (%chrome/browser/shellservice.properties)
 *   locale/browser/bookmarks/bookmarks.dtd         (%chrome/browser/bookmarks/bookmarks.dtd)
 *   locale/browser/bookmarks/addBookmark.dtd       (%chrome/browser/bookmarks/addBookmark.dtd)
 *   locale/browser/bookmarks/bookmarks.properties  (%chrome/browser/bookmarks/bookmarks.properties)
 *   locale/browser/bookmarks/bookmarksProperties.dtd (%chrome/browser/bookmarks/bookmarksProperties.dtd)
 *   locale/browser/cookieviewer/CookieExceptions.dtd (%chrome/browser/cookieviewer/CookieExceptions.dtd)
 *   locale/browser/cookieviewer/CookieViewer.dtd   (%chrome/browser/cookieviewer/CookieViewer.dtd)
 *   locale/browser/cookieviewer/CookieViewer.properties (%chrome/browser/cookieviewer/CookieViewer.properties)
     locale/browser/history/history.dtd             (%chrome/browser/history/history.dtd)
     locale/browser/migration/migration.dtd         (%chrome/browser/migration/migration.dtd)
     locale/browser/migration/migration.properties  (%chrome/browser/migration/migration.properties)
-    locale/browser/pref/addPopup.properties        (%chrome/browser/pref/addPopup.properties)
-    locale/browser/pref/plugins.dtd                (%chrome/browser/pref/plugins.dtd)
-    locale/browser/pref/pref.dtd                   (%chrome/browser/pref/pref.dtd)
-    locale/browser/pref/pref-advanced.dtd          (%chrome/browser/pref/pref-advanced.dtd)
-    locale/browser/pref/pref-advancedscripts.dtd   (%chrome/browser/pref/pref-advancedscripts.dtd)
-    locale/browser/pref/pref-connection.dtd        (%chrome/browser/pref/pref-connection.dtd)
-    locale/browser/pref/pref-extensions.dtd        (%chrome/browser/pref/pref-extensions.dtd)
-    locale/browser/pref/pref-features.dtd          (%chrome/browser/pref/pref-features.dtd)
-    locale/browser/pref/pref-features-images.dtd   (%chrome/browser/pref/pref-features-images.dtd)
-    locale/browser/pref/pref-fonts.dtd             (%chrome/browser/pref/pref-fonts.dtd)
-    locale/browser/pref/pref-languages.dtd         (%chrome/browser/pref/pref-languages.dtd)
-    locale/browser/pref/pref-languages.properties  (%chrome/browser/pref/pref-languages.properties)
-    locale/browser/pref/pref-navigator.dtd         (%chrome/browser/pref/pref-navigator.dtd)
-    locale/browser/pref/pref-masterpass.dtd        (%chrome/browser/pref/pref-masterpass.dtd)
-    locale/browser/pref/pref-privacy.dtd           (%chrome/browser/pref/pref-privacy.dtd)
-    locale/browser/pref/pref-themes.dtd            (%chrome/browser/pref/pref-themes.dtd)
-    locale/browser/pref/prefutilities.properties   (%chrome/browser/pref/prefutilities.properties)
+    locale/browser/preferences/advanced.dtd           (%chrome/browser/preferences/advanced.dtd)
+    locale/browser/preferences/changeaction.dtd       (%chrome/browser/preferences/changeaction.dtd)
+    locale/browser/preferences/colors.dtd             (%chrome/browser/preferences/colors.dtd)
+    locale/browser/preferences/cookies.dtd            (%chrome/browser/preferences/cookies.dtd)
+    locale/browser/preferences/content.dtd            (%chrome/browser/preferences/content.dtd)
+    locale/browser/preferences/connection.dtd         (%chrome/browser/preferences/connection.dtd)
+    locale/browser/preferences/downloads.dtd          (%chrome/browser/preferences/downloads.dtd)
+    locale/browser/preferences/downloadactions.dtd    (%chrome/browser/preferences/downloadactions.dtd)
+    locale/browser/preferences/fonts.dtd              (%chrome/browser/preferences/fonts.dtd)
+    locale/browser/preferences/fontscaling.dtd        (%chrome/browser/preferences/fontscaling.dtd)
+    locale/browser/preferences/general.dtd            (%chrome/browser/preferences/general.dtd)
+    locale/browser/preferences/languages.dtd          (%chrome/browser/preferences/languages.dtd)
+    locale/browser/preferences/ocsp.dtd               (%chrome/browser/preferences/ocsp.dtd)
+    locale/browser/preferences/permissions.dtd        (%chrome/browser/preferences/permissions.dtd)
+    locale/browser/preferences/preferences.dtd        (%chrome/browser/preferences/preferences.dtd)
+    locale/browser/preferences/preferences.properties (%chrome/browser/preferences/preferences.properties)
+    locale/browser/preferences/privacy.dtd            (%chrome/browser/preferences/privacy.dtd)
+    locale/browser/preferences/sanitize.dtd           (%chrome/browser/preferences/sanitize.dtd)
+    locale/browser/preferences/tabs.dtd               (%chrome/browser/preferences/tabs.dtd)
     locale/browser/sidebar/sidebar.properties      (%chrome/browser/sidebar/sidebar.properties)
     locale/browser-region/region.properties        (%chrome/browser-region/region.properties)
 *   locale/browser-region/contents.rdf             (generic/chrome/browser-region/contents.rdf)
 *   locale/@AB_CD@/cookie/contents.rdf                     (generic/chrome/cookie/contents.rdf)
     locale/@AB_CD@/cookie/cookieAcceptDialog.dtd           (%chrome/cookie/cookieAcceptDialog.dtd)
     locale/@AB_CD@/cookie/cookieAcceptDialog.properties    (%chrome/cookie/cookieAcceptDialog.properties)
 #includesubst @AB_CD@/extra-jar.mn
Index: browser/locales/en-US/chrome/browser/browser.dtd
===================================================================
RCS file: /cvsroot/mozilla/browser/locales/en-US/chrome/browser/browser.dtd,v
retrieving revision 1.10
diff -p -u -8 -r1.10 browser.dtd
--- browser/locales/en-US/chrome/browser/browser.dtd	28 Jan 2005 16:09:55 -0000	1.10
+++ browser/locales/en-US/chrome/browser/browser.dtd	21 Feb 2005 11:21:07 -0000
@@ -160,16 +160,19 @@
 <!ENTITY selectAllCmd.label         "Select All">  
 <!ENTITY selectAllCmd.key         "A">  
 <!ENTITY selectAllCmd.accesskey       "A"> 
 <!ENTITY preferencesCmd.label       "Options...">
 <!ENTITY preferencesCmd.accesskey     "O"> 
 <!ENTITY preferencesCmdUnix.label       "Preferences">
 <!ENTITY preferencesCmdUnix.accesskey     "n"> 
 
+<!ENTITY sanitizeCmd.label            "Sanitize &brandShortName;">
+<!ENTITY sanitizeCmd.accesskey        "z">
+
 <!ENTITY viewMenu.label         "View"> 
 <!ENTITY viewMenu.accesskey       "V"> 
 <!ENTITY viewToolbarsMenu.label       "Toolbars"> 
 <!ENTITY viewToolbarsMenu.accesskey     "T"> 
 <!ENTITY viewSidebarMenu.label "Sidebar">
 <!ENTITY viewSidebarMenu.accesskey "e">
 <!ENTITY viewCustomizeToolbar.label       "Customize..."> 
 <!ENTITY viewCustomizeToolbar.accesskey     "C"> 
Index: browser/locales/en-US/chrome/browser/browser.properties
===================================================================
RCS file: /cvsroot/mozilla/browser/locales/en-US/chrome/browser/browser.properties,v
retrieving revision 1.8
diff -p -u -8 -r1.8 browser.properties
--- browser/locales/en-US/chrome/browser/browser.properties	30 Nov 2004 08:22:50 -0000	1.8
+++ browser/locales/en-US/chrome/browser/browser.properties	21 Feb 2005 11:21:07 -0000
@@ -88,8 +88,12 @@ saveFormInformationNo=Don't Save
 
 # missing plugin installer
 missingpluginsMessage.title=Additional plugins are required to display all the media on this page.
 missingpluginsMessage.button.label=Install Missing Plugins...
 
 NotFound=Phrase not found
 WrappedToTop=Reached end of page, continued from top
 WrappedToBottom=Reached top of page, continued from bottom
+
+# Sanitize
+sanitizeWithPromptLabel=Sanitize %S...
+sanitizeButton=Sanitize Now
Index: browser/locales/en-US/chrome/browser/sanitize.dtd
===================================================================
RCS file: browser/locales/en-US/chrome/browser/sanitize.dtd
diff -N browser/locales/en-US/chrome/browser/sanitize.dtd
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ browser/locales/en-US/chrome/browser/sanitize.dtd	21 Feb 2005 11:21:07 -0000
@@ -0,0 +1,11 @@
+<!ENTITY sanitizeDialog.title         "Sanitize &brandShortName;">
+
+<!ENTITY sanitizeItems.label          "Clear the following items now:">
+<!ENTITY itemHistory.label            "Browsing History">
+<!ENTITY itemFormData.label           "Saved Form Information">
+<!ENTITY itemPasswords.label          "Saved Passwords">
+<!ENTITY itemCookies.label            "Cookies">
+<!ENTITY itemCache.label              "Cache">
+<!ENTITY itemDownloads.label          "Download History">
+
+<!ENTITY promptOnSanitize.label       "Ask me before Sanitizing &brandShortName;">
Index: browser/locales/en-US/chrome/browser/preferences/advanced.dtd
===================================================================
RCS file: browser/locales/en-US/chrome/browser/preferences/advanced.dtd
diff -N browser/locales/en-US/chrome/browser/preferences/advanced.dtd
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ browser/locales/en-US/chrome/browser/preferences/advanced.dtd	21 Feb 2005 11:21:08 -0000
@@ -0,0 +1,60 @@
+
+<!ENTITY generalTab.label               "General">
+<!ENTITY accessibility.label            "Accessibility">
+<!ENTITY moveSystemCaret.label          "Allow text to be selected with the keyboard">
+<!ENTITY moveSystemCaret.accesskey      "k">
+<!ENTITY useTypeAheadFind.label         "Begin finding when you begin typing">
+<!ENTITY useTypeAheadFind.accesskey     "f">
+<!ENTITY browsing.label                 "Browsing">
+<!ENTITY enableAutoImageResizing.label  "Resize large images to fit in the browser window">
+<!ENTITY enableAutoImageResizing.accesskey "z">
+<!ENTITY useAutoScrolling.label         "Use autoscrolling">
+<!ENTITY useAutoScrolling.accesskey     "s">
+<!ENTITY useSmoothScrolling.label       "Use smooth scrolling">
+<!ENTITY useSmoothScrolling.accesskey   "m">
+
+<!ENTITY updateTab.label                "Update">
+<!ENTITY softwareupdateinfo.label       "Periodically check for updates to:">
+<!ENTITY enableSmartUpdate.label        "&brandShortName;">
+<!ENTITY enableSmartUpdate.accesskey    "F">
+<!ENTITY enableAutoInstall.label        "automatically download updates">
+<!ENTITY enableAutoInstall.accesskey    "d">
+<!ENTITY updateAnd.label                "and:">
+<!ENTITY autoDownloadAndInstall.label   "install them">
+<!ENTITY autoDownloadAndInstall.accesskey "i">
+<!ENTITY autoDownloadAndPrompt.label    "prompt me when ready to install">
+<!ENTITY autoDownloadAndPrompt.accesskey "p">
+<!ENTITY enableExtensionUpdate.label    "My Extensions and Themes">
+<!ENTITY enableExtensionUpdate.accesskey "x">
+<!ENTITY checkNow.label                 "Check Now...">
+<!ENTITY appCheckNow.accesskey          "C">
+<!ENTITY extensionsCheckNow.accesskey   "h">
+
+<!ENTITY securityTab.label              "Security">
+<!ENTITY protocols.label                "Protocols">
+<!ENTITY useSSL2.label                  "Use SSL 2.0">
+<!ENTITY useSSL2.accesskey              "2">
+<!ENTITY useSSL3.label                  "Use SSL 3.0">
+<!ENTITY useSSL3.accesskey              "3">
+<!ENTITY useTLS1.label                  "Use TLS 1.0">
+<!ENTITY useTLS1.accesskey              "1">
+<!ENTITY certificates.label             "Certificates">
+<!ENTITY certselect.description         "When a web site requires a certificate:">
+<!ENTITY certselect.auto                "Select one automatically">
+<!ENTITY certselect.auto.accesskey      "e">
+<!ENTITY certselect.ask                 "Ask me every time">
+<!ENTITY certselect.ask.accesskey       "k">
+<!ENTITY viewCertificates.label         "View Certificates">
+<!ENTITY viewCertificates.accesskey     "C">
+<!ENTITY viewCRLs.label                 "Revocation Lists">
+<!ENTITY viewCRLs.accesskey             "R">
+<!ENTITY viewOCSP.label                 "Verification">
+<!ENTITY viewOCSP.accesskey             "V">
+<!ENTITY viewSecurityDevices.label      "Security Devices">
+<!ENTITY viewSecurityDevices.accesskey  "S">
+
+<!ENTITY languages.caption                  "Languages">
+<!ENTITY languagesInfo.label                "Choose Languages web pages are displayed in.">
+<!ENTITY showLanguages.label                "Edit Languages...">
+<!ENTITY showLanguages.accesskey            "L">
+
Index: browser/locales/en-US/chrome/browser/preferences/advancedScript.dtd
===================================================================
RCS file: browser/locales/en-US/chrome/browser/preferences/advancedScript.dtd
diff -N browser/locales/en-US/chrome/browser/preferences/advancedScript.dtd
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ browser/locales/en-US/chrome/browser/preferences/advancedScript.dtd	21 Feb 2005 11:21:08 -0000
@@ -0,0 +1,10 @@
+
+<!ENTITY allowScripts.title              "Advanced JavaScript Options">
+<!ENTITY allowScripts.label              "Allow scripts to:">
+<!ENTITY allowWindowOpen.label           "Open unrequested windows">
+<!ENTITY allowWindowMoveResize.label     "Move or resize existing windows">
+<!ENTITY allowWindowFlip.label           "Raise or lower windows">
+<!ENTITY allowWindowStatusChange.label   "Change status bar text">
+<!ENTITY allowWindowImageSrcChange.label "Change images">
+<!ENTITY allowControlContextMenu.label   "Disable or replace context menus">
+<!ENTITY allowHideStatusBar.label        "Hide the status bar">
Index: browser/locales/en-US/chrome/browser/preferences/changeaction.dtd
===================================================================
RCS file: browser/locales/en-US/chrome/browser/preferences/changeaction.dtd
diff -N browser/locales/en-US/chrome/browser/preferences/changeaction.dtd
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ browser/locales/en-US/chrome/browser/preferences/changeaction.dtd	21 Feb 2005 11:21:08 -0000
@@ -0,0 +1,22 @@
+<!ENTITY  changeAction.title                  "Change Action">
+
+<!ENTITY  whenDownloading.label               "When downloading files like this:">
+
+<!ENTITY  openDefault.label                   "Open them with the default application:">
+<!ENTITY  openDefault.accesskey               "O">
+<!ENTITY  openApplication.label               "Open them with this application:">
+<!ENTITY  openApplication.accesskey           "e">
+<!ENTITY  changeApp.label                     "Browse...">
+<!ENTITY  changeApp.accesskey                 "B">
+<!ENTITY  saveToDisk.label                    "Save them on my computer">
+<!ENTITY  saveToDisk.accesskey                "S">
+<!ENTITY  saveToDefaultFolder.label           "in the default download folder">
+<!ENTITY  saveToDefaultFolder.accesskey       "d">
+<!ENTITY  saveToThisFolder.label              "in this folder:">
+<!ENTITY  saveToThisFolder.accesskey          "h">
+<!ENTITY  chooseFolder.label                  "Browse...">
+<!ENTITY  chooseFolder.accesskey              "w">
+<!ENTITY  saveToAskMe.label                   "ask me where to save the file">
+<!ENTITY  saveToAskMe.accesskey               "a">
+<!ENTITY  usePlugin.label                     "Use this Plugin:">
+<!ENTITY  usePlugin.accesskey                 "P">
Index: browser/locales/en-US/chrome/browser/preferences/colors.dtd
===================================================================
RCS file: browser/locales/en-US/chrome/browser/preferences/colors.dtd
diff -N browser/locales/en-US/chrome/browser/preferences/colors.dtd
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ browser/locales/en-US/chrome/browser/preferences/colors.dtd	21 Feb 2005 11:21:08 -0000
@@ -0,0 +1,20 @@
+<!ENTITY  colorsDialog.title              "Colors">
+
+<!ENTITY  allowPagesToUse.label           "Allow pages to choose their own colors, instead of my selections above">
+<!ENTITY  allowPagesToUse.accesskey       "h">
+
+<!ENTITY  color                           "Text and Background">
+<!ENTITY  textColor.label                 "Text:">
+<!ENTITY  textColor.accesskey             "t">
+<!ENTITY  backgroundColor.label           "Background:">
+<!ENTITY  backgroundColor.accesskey       "b">
+<!ENTITY  useSystemColors.label           "Use system colors">
+<!ENTITY  useSystemColors.accesskey       "s">
+
+<!ENTITY  underlineLinks.label            "Underline links">
+<!ENTITY  underlineLinks.accesskey        "u">
+<!ENTITY  links                           "Link Colors">
+<!ENTITY  linkColor.label                 "Unvisited Links:">
+<!ENTITY  linkColor.accesskey             "l">
+<!ENTITY  visitedLinkColor.label          "Visited Links:">
+<!ENTITY  visitedLinkColor.accesskey      "v">
Index: browser/locales/en-US/chrome/browser/preferences/connection.dtd
===================================================================
RCS file: browser/locales/en-US/chrome/browser/preferences/connection.dtd
diff -N browser/locales/en-US/chrome/browser/preferences/connection.dtd
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ browser/locales/en-US/chrome/browser/preferences/connection.dtd	21 Feb 2005 11:21:08 -0000
@@ -0,0 +1,41 @@
+
+<!ENTITY  connectionsDialog.title       "Connection Settings">
+<!ENTITY  proxyTitle.label              "Configure Proxies to Access the Internet">
+<!ENTITY  directTypeRadio.label         "Direct connection to the Internet">
+<!ENTITY  directTypeRadio.accesskey     "d">
+<!ENTITY  WPADTypeRadio.label           "Auto-detect proxy settings for this network">
+<!ENTITY  WPADTypeRadio.accesskey       "w">
+<!ENTITY  manualTypeRadio.label         "Manual proxy configuration:">
+<!ENTITY  manualTypeRadio.accesskey     "m">
+<!ENTITY  autoTypeRadio.label           "Automatic proxy configuration URL:">
+<!ENTITY  autoTypeRadio.accesskey       "a">
+<!ENTITY  configAutoconfigText.label    "Configuration location (URL):">
+<!ENTITY  configAutoconfigText.accesskey "u">
+<!ENTITY  reload.label                  "Reload">
+<!ENTITY  reload.accesskey              "l">
+<!ENTITY  ftp.label                     "FTP Proxy:">
+<!ENTITY  ftp.accesskey                 "f">
+<!ENTITY  gopher.label                  "Gopher Proxy:">
+<!ENTITY  gopher.accesskey              "g">
+<!ENTITY  http.label                    "HTTP Proxy:">
+<!ENTITY  http.accesskey                "h">
+<!ENTITY  ssl.label                     "SSL Proxy:">
+<!ENTITY  ssl.accesskey                 "s">
+<!ENTITY  socks.label                   "SOCKS Host:">
+<!ENTITY  socks.accesskey               "c">
+<!ENTITY  socks4.label                  "SOCKS v4">
+<!ENTITY  socks4.accesskey              "k">
+<!ENTITY  socks5.label                  "SOCKS v5">
+<!ENTITY  socks5.accesskey              "v">
+<!ENTITY  port.label                    "Port:">
+<!ENTITY  HTTPport.accesskey            "p">
+<!ENTITY  SSLport.accesskey             "o">
+<!ENTITY  FTPport.accesskey             "r">
+<!-- No accesskey for gopher (':' doesn't go well) - mpt's going to redesign the window -->
+<!ENTITY  gopherPort.accesskey          "">
+<!ENTITY  SOCKSport.accesskey           "t">
+<!ENTITY  noproxy.label                 "No Proxy for:">
+<!ENTITY  noproxy.accesskey             "n">
+<!ENTITY  noproxyExplain.label          "Example: .mozilla.org, .net.nz, 192.168.1.0/24">
+<!ENTITY  shareproxy.label              "Use this proxy server for all protocols">
+<!ENTITY  shareproxy.accesskey          "x">
Index: browser/locales/en-US/chrome/browser/preferences/content.dtd
===================================================================
RCS file: browser/locales/en-US/chrome/browser/preferences/content.dtd
diff -N browser/locales/en-US/chrome/browser/preferences/content.dtd
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ browser/locales/en-US/chrome/browser/preferences/content.dtd	21 Feb 2005 11:21:08 -0000
@@ -0,0 +1,32 @@
+<!ENTITY  lHeader                           "Web Features">
+
+<!ENTITY  enbJavaCheck.label                "Enable Java">
+<!ENTITY  enbJavaCheck.accesskey            "J">
+<!ENTITY  enableJavaScript.label            "Enable JavaScript">
+<!ENTITY  enableJavaScript.accesskey        "S">
+<!ENTITY  disableAnnoyances.label           "but disable common annoyances">
+<!ENTITY  disableAnnoyances.accesskey       "y">
+
+
+<!ENTITY  enableImages.label                "Load Images">
+<!ENTITY  enableImages.accesskey            "I">
+<!ENTITY  forOriginatingSiteOnly.label      "for the originating web site only">
+<!ENTITY  forOriginatingSiteOnly.accesskey  "w">
+<!ENTITY  popupReject.label                 "Block Popup Windows">
+<!ENTITY  popupReject.accesskey             "B">
+<!ENTITY  enableXPInstall.label             "Allow web sites to install software">
+<!ENTITY  enableXPInstall.accesskey         "i">
+
+<!ENTITY  allowedSites.label                "Allowed Sites">
+<!ENTITY  exceptions.label                  "Exceptions">
+
+<!ENTITY  fonts.caption                     "Fonts &amp; Colors">
+<!ENTITY  advancedFonts.label               "Advanced...">
+<!ENTITY  advancedFonts.accesskey           "d">
+<!ENTITY  colors.label                      "Colors...">
+<!ENTITY  colors.accesskey                  "C">
+<!ENTITY  defaultFontSize.label             "Size:">
+<!ENTITY  defaultFontSize.accesskey         "z">
+<!ENTITY  defaultFont.label                 "Default Font:">
+<!ENTITY  defaultFont.accesskey             "F">
+
Index: browser/locales/en-US/chrome/browser/preferences/cookies.dtd
===================================================================
RCS file: browser/locales/en-US/chrome/browser/preferences/cookies.dtd
diff -N browser/locales/en-US/chrome/browser/preferences/cookies.dtd
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ browser/locales/en-US/chrome/browser/preferences/cookies.dtd	21 Feb 2005 11:21:08 -0000
@@ -0,0 +1,28 @@
+<!ENTITY     cookiesonsystem.label          "The following cookies are stored on your computer:">
+<!ENTITY     cookiename.label               "Cookie Name">
+<!ENTITY     cookiedomain.label             "Site"> 
+<!ENTITY     button.removecookie.label      "Remove Cookie">
+<!ENTITY     button.removecookie.accesskey  "R">
+<!ENTITY     button.removeallcookies.label  "Remove All Cookies">
+<!ENTITY     button.removeallcookies.accesskey "A">
+
+<!ENTITY     props.name.label               "Name:">
+<!ENTITY     props.value.label              "Content:">
+<!ENTITY     props.domain.label             "Host:">
+<!ENTITY     props.path.label               "Path:">
+<!ENTITY     props.secure.label             "Send For:">
+<!ENTITY     props.expires.label            "Expires:">
+
+<!ENTITY     window.title                   "Cookies">
+<!ENTITY     windowClose.key                "w">
+<!ENTITY     focusSearch1.key               "f">
+<!ENTITY     focusSearch2.key               "k">
+
+<!ENTITY     filter.label                   "Search:">
+<!ENTITY     filter.accesskey               "S">
+<!ENTITY     clear.label                    "Clear">
+<!ENTITY     clear.accesskey                "l">
+
+<!ENTITY     button.close.label             "Close">
+<!ENTITY     button.close.accesskey         "C">
+
Index: browser/locales/en-US/chrome/browser/preferences/downloadactions.dtd
===================================================================
RCS file: browser/locales/en-US/chrome/browser/preferences/downloadactions.dtd
diff -N browser/locales/en-US/chrome/browser/preferences/downloadactions.dtd
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ browser/locales/en-US/chrome/browser/preferences/downloadactions.dtd	21 Feb 2005 11:21:08 -0000
@@ -0,0 +1,29 @@
+<!ENTITY  downloadactionsWindow.title         "Download Actions">
+<!ENTITY  fileTypesDescription.label          "Automatically perform the associated Action with each of the following file types:">
+
+<!ENTITY  fileHandlerColumn.label             "Action">
+<!ENTITY  fileHandlerColumn.accesskey         "A">
+<!ENTITY  fileTypeColumn.label                "File Type">
+<!ENTITY  fileTypeColumn.accesskey            "T">
+<!ENTITY  fileMIMETypeColumn.label            "MIME Type">
+<!ENTITY  fileMIMETypeColumn.accesskey        "M">
+<!ENTITY  fileExtensionColumn.label           "Extension">
+<!ENTITY  fileExtensionColumn.accesskey       "E">
+
+<!ENTITY  remove.label                        "Remove Action">
+<!ENTITY  remove.accesskey                    "R">
+<!ENTITY  edit.label                          "Change Action...">
+<!ENTITY  edit.accesskey                      "C">
+
+<!ENTITY  windowClose.key                     "w">
+<!ENTITY  focusSearch1.key                    "f">
+<!ENTITY  focusSearch2.key                    "k">
+
+<!ENTITY  filter.label                        "Search:">
+<!ENTITY  filter.accesskey                    "S">
+<!ENTITY  clear.label                         "Clear">
+<!ENTITY  clear.accesskey                     "l">
+
+<!ENTITY  button.close.label                  "Close">
+<!ENTITY  button.close.accesskey              "C">
+
Index: browser/locales/en-US/chrome/browser/preferences/downloads.dtd
===================================================================
RCS file: browser/locales/en-US/chrome/browser/preferences/downloads.dtd
diff -N browser/locales/en-US/chrome/browser/preferences/downloads.dtd
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ browser/locales/en-US/chrome/browser/preferences/downloads.dtd	21 Feb 2005 11:21:08 -0000
@@ -0,0 +1,17 @@
+<!ENTITY askOnSave.label              "Download Folder">
+<!ENTITY alwaysAsk.label              "Ask me where to save every file">
+<!ENTITY neverAsk.label               "Save all files to this folder:">
+<!ENTITY desktop.label                "Desktop">
+<!ENTITY downloads.label              "My Downloads">
+<!ENTITY chooseFolderWin.label        "Browse...">
+<!ENTITY chooseFolderMac.label        "Choose...">
+
+<!ENTITY downloadManagerWindow.label  "Download Manager">
+<!ENTITY showWhenStarting.label       "Show Download Manager when a download begins">
+<!ENTITY closeWhenDone.label          "Close the Download Manager when all downloads are complete">
+
+<!ENTITY fileTypes.label              "Download Actions">
+<!ENTITY configureActions.label       "View &amp; Edit Actions...">
+<!ENTITY configureActions.accesskey   "V">
+<!ENTITY fileTypesDescription.label   "&brandShortName; can automatically download or open files of certain types.">
+
Index: browser/locales/en-US/chrome/browser/preferences/fonts.dtd
===================================================================
RCS file: browser/locales/en-US/chrome/browser/preferences/fonts.dtd
diff -N browser/locales/en-US/chrome/browser/preferences/fonts.dtd
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ browser/locales/en-US/chrome/browser/preferences/fonts.dtd	21 Feb 2005 11:21:08 -0000
@@ -0,0 +1,62 @@
+<!ENTITY  fontsDialog.title                       "Fonts">
+
+<!ENTITY  language.label                          "Fonts for:">
+<!ENTITY  language.accesskey                      "t">
+
+<!ENTITY  sizes.label                             "Size:">
+
+<!ENTITY  proportional.label                      "Proportional:">
+<!ENTITY  proportional.accesskey                  "P">
+
+<!ENTITY  serif.label                             "Serif:">
+<!ENTITY  serif.accesskey                         "S">
+<!ENTITY  sans-serif.label                        "Sans-serif:">
+<!ENTITY  sans-serif.accesskey                    "n">
+<!ENTITY  monospace.label                         "Monospace:">
+<!ENTITY  monospace.accesskey                     "M">
+<!-- LOCALIZATION NOTE (fantasy.label): 'Fantasy' means 'Ornate' -->
+<!ENTITY  fantasy.label                           "Fantasy:">
+<!ENTITY  fantasy.accesskey                       "F">
+<!ENTITY  cursive.label                           "Cursive:">
+<!ENTITY  cursive.accesskey                       "C">
+
+<!ENTITY  fontsize.units                          "pixels">
+
+<!ENTITY  font.langGroup.latin1                   "Western">
+<!ENTITY  font.langGroup.latin2                   "Central European">
+<!ENTITY  font.langGroup.japanese                 "Japanese">
+<!ENTITY  font.langGroup.trad-chinese             "Traditional Chinese (Taiwan)">
+<!ENTITY  font.langGroup.simpl-chinese            "Simplified Chinese">
+<!ENTITY  font.langGroup.trad-chinese-hk          "Traditional Chinese (Hong Kong)">
+<!ENTITY  font.langGroup.korean                   "Korean">
+<!ENTITY  font.langGroup.cyrillic                 "Cyrillic">
+<!ENTITY  font.langGroup.baltic                   "Baltic">
+<!ENTITY  font.langGroup.el                       "Greek">
+<!ENTITY  font.langGroup.turkish                  "Turkish">
+<!ENTITY  font.langGroup.unicode                  "Unicode">
+<!ENTITY  font.langGroup.user-def                 "User Defined">
+<!ENTITY  font.langGroup.thai                     "Thai">
+<!ENTITY  font.langGroup.hebrew                   "Hebrew">
+<!ENTITY  font.langGroup.arabic                   "Arabic">
+<!ENTITY  font.langGroup.devanagari               "Devanagari">
+<!ENTITY  font.langGroup.tamil                    "Tamil">
+<!-- Minimum font size -->
+<!ENTITY minSize.label                            "Minimum font size:">
+<!ENTITY minSize.accesskey                        "z">
+<!ENTITY minSize.none                             "None">
+
+<!-- default font type -->
+<!ENTITY  useDefaultFontSerif.label               "Serif">
+<!ENTITY  useDefaultFontSansSerif.label           "Sans Serif">
+
+<!ENTITY  resolution.label                        "Display resolution:">
+<!ENTITY  resolution.accesskey                    "r">
+<!ENTITY  resolution.system.label                 "System setting">
+<!ENTITY  resolution.other                        "Other...">
+
+<!ENTITY  allowPagesToUse.label                   "Allow pages to choose their own fonts, instead of my selections above">
+<!ENTITY  allowPagesToUse.accesskey               "h">
+
+<!ENTITY languages.customize.Charset.grouplabel         "Character Encoding">
+<!ENTITY languages.customize.DefaultCharset.label       "Default Character Encoding:">
+<!ENTITY languages.customize.DefaultCharset.accesskey   "C">
Index: browser/locales/en-US/chrome/browser/preferences/fontscaling.dtd
===================================================================
RCS file: browser/locales/en-US/chrome/browser/preferences/fontscaling.dtd
diff -N browser/locales/en-US/chrome/browser/preferences/fontscaling.dtd
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ browser/locales/en-US/chrome/browser/preferences/fontscaling.dtd	21 Feb 2005 11:21:08 -0000
@@ -0,0 +1,6 @@
+<!-- screen calibration dialog -->
+<!ENTITY  calibrateDialog.title                   "Calibrate Resolution">
+<!ENTITY  calibrate.instructions                  "The length of the line above is:">
+<!ENTITY  units.inches                            "inches">
+<!ENTITY  units.centimetres                       "centimeters">
+
Index: browser/locales/en-US/chrome/browser/preferences/general.dtd
===================================================================
RCS file: browser/locales/en-US/chrome/browser/preferences/general.dtd
diff -N browser/locales/en-US/chrome/browser/preferences/general.dtd
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ browser/locales/en-US/chrome/browser/preferences/general.dtd	21 Feb 2005 11:21:08 -0000
@@ -0,0 +1,23 @@
+
+<!ENTITY  header2.label             "Home Page">
+<!ENTITY  location.label            "Location(s):">
+<!ENTITY  location.accesskey        "a">
+<!ENTITY  useCurrent.label          "Use Current Page">
+<!ENTITY  useCurrent.accesskey      "C">
+<!ENTITY  useCurrentMultiple.label  "Use Current Pages">
+<!ENTITY  useBookmark.label         "Use Bookmark...">
+<!ENTITY  useBookmark.accesskey     "U">
+<!ENTITY  useBlank.label            "Use Blank Page">
+<!ENTITY  useBlank.accesskey        "B">
+
+<!ENTITY defaultBrowserGroup.label  "Default Browser">
+<!ENTITY checkForDefault.label      "&brandShortName; should check to see if it is the default browser when starting.">
+<!ENTITY checkForDefault.accesskey  "d">
+<!ENTITY checkNow.label             "Check Now">
+<!ENTITY checkNow.accesskey         "N">
+
+<!ENTITY showConnections.label      "Connection Settings...">
+<!ENTITY showConnections.accesskey  "o">
+<!ENTITY proxiesInfo.label          "Determine how &brandShortName; connects to the Internet.">
+<!ENTITY connectionsInfo.caption    "Connection">
+
Index: browser/locales/en-US/chrome/browser/preferences/languages.dtd
===================================================================
RCS file: browser/locales/en-US/chrome/browser/preferences/languages.dtd
diff -N browser/locales/en-US/chrome/browser/preferences/languages.dtd
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ browser/locales/en-US/chrome/browser/preferences/languages.dtd	21 Feb 2005 11:21:08 -0000
@@ -0,0 +1,15 @@
+<!ENTITY languages.customize.Header                     "Languages">
+<!ENTITY languages.customize.label                      "Languages">
+<!ENTITY languages.customize.prefLangDescript           "Web pages are sometimes offered in more than one language. Choose languages for displaying these web pages, in order of preference.">
+<!ENTITY languages.customize.active.label               "Languages in order of preference:">
+<!ENTITY languages.customize.moveUp.label               "Move Up">
+<!ENTITY languages.customize.moveUp.accesskey           "U">
+<!ENTITY languages.customize.moveDown.label             "Move Down">
+<!ENTITY languages.customize.moveDown.accesskey         "D">
+<!ENTITY languages.customize.deleteButton.label         "Remove">
+<!ENTITY languages.customize.deleteButton.accesskey     "R">
+<!ENTITY languages.customize.selectLanguage.label       "Select a language to add...">
+<!ENTITY languages.customize.selectLanguage.accesskey   "S">
+<!ENTITY languages.customize.addButton.label            "Add">
+<!ENTITY languages.customize.addButton.accesskey        "A">
+
Index: browser/locales/en-US/chrome/browser/preferences/ocsp.dtd
===================================================================
RCS file: browser/locales/en-US/chrome/browser/preferences/ocsp.dtd
diff -N browser/locales/en-US/chrome/browser/preferences/ocsp.dtd
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ browser/locales/en-US/chrome/browser/preferences/ocsp.dtd	21 Feb 2005 11:21:08 -0000
@@ -0,0 +1,9 @@
+<!ENTITY ocspDialog.title             "Verification">
+<!ENTITY validation.ocsp.description  "&brandShortName; can use Online Certificate Status Protocol (OCSP) to verify certificates. Set &brandShortName; to use OCSP as follows:">
+<!ENTITY disableOCSP.label            "Do not use OCSP for certificate validation">
+<!ENTITY certOCSP.label               "Use OCSP to validate only certificates that specify an OCSP service URL">
+<!ENTITY proxyOCSP.label              "Use OCSP to validate all certificates using this URL and signer:">
+<!ENTITY serviceURL.label             "Service URL:">
+<!ENTITY serviceURL.accesskey         "S">
+<!ENTITY signingCA.label              "Response Signer:">
+<!ENTITY signingCA.accesskey          "R">
Index: browser/locales/en-US/chrome/browser/preferences/permissions.dtd
===================================================================
RCS file: browser/locales/en-US/chrome/browser/preferences/permissions.dtd
diff -N browser/locales/en-US/chrome/browser/preferences/permissions.dtd
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ browser/locales/en-US/chrome/browser/preferences/permissions.dtd	21 Feb 2005 11:21:08 -0000
@@ -0,0 +1,15 @@
+<!ENTITY window.title                 "Exceptions">
+<!ENTITY treehead.sitename.label      "Site">
+<!ENTITY treehead.status.label        "Status">
+<!ENTITY addpermission.label          "New Site">
+<!ENTITY removepermission.label       "Remove Site">
+<!ENTITY removeallpermissions.label   "Remove All Sites">
+<!ENTITY address.label                "Address of web site:">
+<!ENTITY block.label                  "Block">
+<!ENTITY session.label                "Allow for Session">
+<!ENTITY allow.label                  "Allow">
+<!ENTITY windowClose.key              "w">
+
+<!ENTITY button.close.label           "Close">
+<!ENTITY button.close.accesskey       "C">
+
Index: browser/locales/en-US/chrome/browser/preferences/preferences.dtd
===================================================================
RCS file: browser/locales/en-US/chrome/browser/preferences/preferences.dtd
diff -N browser/locales/en-US/chrome/browser/preferences/preferences.dtd
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ browser/locales/en-US/chrome/browser/preferences/preferences.dtd	21 Feb 2005 11:21:08 -0000
@@ -0,0 +1,13 @@
+
+<!ENTITY  prefWindow.titleWin     "Options">
+<!ENTITY  prefWindow.titleGNOME   "&brandShortName; Preferences">
+<!ENTITY  prefWindow.styleWin     "width: 42em; height: 36em;">
+<!ENTITY  prefWindow.styleMac     "width: 47em;">
+<!ENTITY  prefWindow.styleUnix    "width: 42em;">
+
+<!ENTITY  paneGeneral.title       "General">
+<!ENTITY  panePrivacy.title       "Privacy">
+<!ENTITY  paneDownloads.title     "Downloads">
+<!ENTITY  paneAdvanced.title      "Advanced">
+<!ENTITY  paneContent.title       "Content">
+<!ENTITY  paneTabs.title          "Tabs">
Index: browser/locales/en-US/chrome/browser/preferences/preferences.properties
===================================================================
RCS file: browser/locales/en-US/chrome/browser/preferences/preferences.properties
diff -N browser/locales/en-US/chrome/browser/preferences/preferences.properties
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ browser/locales/en-US/chrome/browser/preferences/preferences.properties	21 Feb 2005 11:21:08 -0000
@@ -0,0 +1,100 @@
+#### General
+
+choosehomepage=Choose Home Page
+choosebookmark=%brand% can set your home page to a site you have already added to your Bookmarks. Select a Bookmark below and click OK.
+choosefile=Choose a file
+
+#### Content
+
+setMasterPassword=Set Master Password...
+changeMasterPassword=Change Master Password...
+
+#### Fonts
+
+labelDefaultFont=Default (%S)
+
+#### Permissions Manager
+
+cookiepermissionstext=You can specify which web sites are always or never allowed to use cookies.  Type the exact address of the site you want to manage and then click Block, Allow for Session, or Allow.
+cookiepermissionstitle=Exceptions - Cookies
+installpermissionstext=You can specify which web sites are allowed to install software. Type the exact address of the site you want to allow and then click Allow.
+installpermissionstitle=Allowed Sites - Software Installation
+popuppermissionstext=You can specify which web sites are allowed to open popup windows. Type the exact address of the site you want to allow and then click Allow.
+popuppermissionstitle=Allowed Sites - Popups
+downloadpermissionstext=You can specify which web sites are allowed to download files to your computer. Type the exact address of the site you want to allow and then click Allow.
+downloadpermissionstitle=Allowed Sites - Downloading Software
+imagepermissionstext=You can specify which web sites are allowed to load images. Type the exact address of the site you want to manage and then click Block or Allow.
+imagepermissionstitle=Exceptions - Images
+invalidURI=Please enter a valid hostname
+invalidURITitle=Invalid Hostname Entered
+
+#### Master Password
+
+password_not_set=(not set)
+failed_pw_change=Unable to change Master Password.
+incorrect_pw=You did not enter the correct current Master Password. Please try again.
+pw_change_ok=Master Password successfully changed.
+pw_erased_ok=Warning! You have deleted your Master Password. 
+pw_not_wanted=Warning! You have decided not to use a Master Password.
+pw_empty_warning=Your stored web and email passwords, form data, and private keys will not be protected.
+pw_change2empty_in_fips_mode=You are currently in FIPS mode. FIPS requires a non-empty Master Password.
+pw_change_success_title=Password Change Succeeded
+pw_change_failed_title=Password Change Failed
+
+#### Fonts
+
+# LOCALIZATION NOTE: Next two strings are for language name representations with
+#   and without the region.
+#   e.g. languageRegionCodeFormat : "French/Canada  [fr-ca]" languageCodeFormat : "French  [fr]"
+#   %1$S = language name, %2$S = region name, %3$S = language-region code
+languageRegionCodeFormat=%1$S/%2$S  [%3$S]
+#   %1$S = language name, %2$S = language-region code
+languageCodeFormat=%1$S  [%2$S]
+
+# LOCALIZATION NOTE: dpi stands for 'dots per inch'
+fontScalingResolutionFormat=%S dpi
+
+#### Downloads
+
+desktopFolderName=Desktop
+myDownloadsFolderName=My Downloads
+
+#### Download Actions
+
+extensionNone=(NONE)
+removeButtonSingle=Remove Action
+removeButtonMultiple=Remove Actions
+removeTitleSingle=Remove Action
+removeTitleMultiple=Remove Actions
+removeMessageSingle=The selected Action will no longer be performed when files of the affected types are downloaded. Are you sure you want to remove this Action?
+removeMessageMultiple=The selected Actions will no longer be performed when files of the affected types are downloaded. Are you sure you want to remove these Actions?
+fileEnding=%S file
+saveToDisk=Save to Disk
+openWith=Open with %S
+actionsFiltered=The following Actions match your search:
+actionsAll=Automatically perform the associated Action with each of the following file types:
+
+
+#### Change Action
+
+extensionStringFormat=%S, %S
+downloadHelperNoneSelected=None Selected
+pluginHelperNoneAvailable=None Available
+fpTitleChooseApp=Select Helper Application
+fpTitleChooseDL=Select Download Folder
+
+#### Cookie Viewer
+
+hostColon=Host:
+domainColon=Domain:
+forSecureOnly=Encrypted connections only
+forAnyConnection=Any type of connection
+AtEndOfSession = at end of session
+can=Allow
+canSession=Allow for Session
+cannot=Block
+noCookieSelected=<no cookie selected>
+cookiesAll=The following cookies are stored on your computer:
+cookiesFiltered=The following cookies match your search:
+removeCookies=Remove Cookies
+removeCookie=Remove Cookie
Index: browser/locales/en-US/chrome/browser/preferences/privacy.dtd
===================================================================
RCS file: browser/locales/en-US/chrome/browser/preferences/privacy.dtd
diff -N browser/locales/en-US/chrome/browser/preferences/privacy.dtd
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ browser/locales/en-US/chrome/browser/preferences/privacy.dtd	21 Feb 2005 11:21:08 -0000
@@ -0,0 +1,82 @@
+
+<!ENTITY  privacy.intro               "As you browse the web, &brandShortName; keeps information about where you have been, what you have done etc. in the following areas:">
+<!ENTITY  clear.label                 "Clear">
+<!ENTITY  view.label                  "View">
+
+<!ENTITY  privacy.label               "Privacy">
+
+<!ENTITY  itemHistory.label           "History">
+<!ENTITY  rememberPages.label         "Remember visited pages for the last">
+<!ENTITY  rememberPages.accesskey     "R">
+<!ENTITY  rememberDays.label          "days">
+<!ENTITY  clearHistory.label          "Clear Browsing History Now">
+<!ENTITY  clearHistory.accesskey      "C">
+
+<!ENTITY  itemFormData.label          "Saved Forms">
+<!ENTITY  savedFormData.intro         "Information entered in forms and the Search Bar is saved to make filling out forms and searching faster.">
+<!ENTITY  enableFormFill.label        "Save information I enter in forms and the Search Bar.">
+<!ENTITY  enableFormFill.accesskey    "S">
+<!ENTITY  clearFormData.label         "Clear Saved Form Data Now">
+<!ENTITY  clearFormData.accesskey     "F">
+
+<!ENTITY  itemPasswords.label         "Passwords">
+<!ENTITY  savedPasswords.intro        "&brandShortName; can remember login information for web pages so that you do not need to re-enter your login details every time you visit.">
+<!ENTITY  enablePasswords.label       "Remember Passwords">
+<!ENTITY  enablePasswords.accesskey   "P">
+<!ENTITY  masterPassword.intro        "When set, the Master Password protects all your passwords - but you must enter it once per session.">
+<!ENTITY  setMasterPassword.label     "Master Password">
+<!ENTITY  setMasterPassword.accesskey "M">
+<!ENTITY  viewPasswords.label         "View Saved Passwords">
+<!ENTITY  viewPasswords.accesskey     "V">
+
+<!ENTITY  itemDownloads.label         "Download History">
+<!ENTITY  downloadManager.intro       "The Downloads window keeps track of recently downloaded files.">
+<!ENTITY  downloadsRetentionPolicy.label      
+                                      "Remove files from the Download Manager:">
+<!ENTITY  downloadsRetentionPolicy.accesskey  
+                                      "e">
+<!ENTITY  downloadsRemoveImmediately.label    
+                                      "Upon successful download">
+<!ENTITY  downloadsRemoveExit.label   "When &brandShortName; exits">
+<!ENTITY  downloadsRemoveManually.label       
+                                      "Manually">
+<!ENTITY  viewDownloads.label         "View Download History">
+<!ENTITY  viewDownloads.accesskey     "y">
+<!ENTITY  clearDownloads.label        "Clear Download History Now">
+<!ENTITY  clearDownloads.accesskey    "a">
+
+<!ENTITY  itemCookies.label           "Cookies">
+<!ENTITY  cookies.intro               "Cookies are pieces of information stored by sites on your computer. They are used to remember login information and other data.">
+<!ENTITY  enableCookies.label         "Allow sites to set Cookies">
+<!ENTITY  enableCookies.accesskey     "l">
+<!ENTITY  exceptions.label            "Exceptions">
+<!ENTITY  cookieExceptions.accesskey  "x">
+<!ENTITY  enableCookiesForOriginating.label 
+                                      "for the originating site only">
+<!ENTITY  enableCookiesForOriginating.accesskey
+                                      "g">
+<!ENTITY  enableCookiesNotRemoved.label     
+                                      "unless I have removed cookies set by the site">
+<!ENTITY  enableCookiesNotRemoved.accesskey
+                                      "u">
+<!ENTITY  keepCookies.label           "Keep Cookies:">
+<!ENTITY  keepCookies.accesskey       "K">
+<!ENTITY  acceptNormally.label        "until they expire">
+<!ENTITY  acceptForSession.label      "until I close &brandShortName;">
+<!ENTITY  askAboutCookies.label       "ask me every time">
+<!ENTITY  viewCookies.label           "View Cookies">
+<!ENTITY  viewCookies.accesskey       "w">
+<!ENTITY  clearCookies.label          "Clear Cookies Now">
+<!ENTITY  clearCookies.accesskey      "o">
+
+<!ENTITY  itemCache.label             "Cache">
+<!ENTITY  cache.intro                 "Pages you view are stored in the cache for faster viewing later on.">
+<!ENTITY  cacheUseUpTo.label          "Use up to:">
+<!ENTITY  cacheUseUpTo.accesskey      ":">
+<!ENTITY  cacheSize.label             "MB of disk space for the cache.">
+<!ENTITY  clearCache.label            "Clear Cache Now">
+<!ENTITY  clearCache.accesskey        "h">
+
+<!ENTITY  sanitizeSettings.label      "Sanitize Settings...">
+<!ENTITY  sanitizeSettings.accesskey  "z">
+<!ENTITY  sanitize.intro              "Sanitize automatically removes privacy information when you use a keyboard shortcut or close &brandShortName;">
Index: browser/locales/en-US/chrome/browser/preferences/sanitize.dtd
===================================================================
RCS file: browser/locales/en-US/chrome/browser/preferences/sanitize.dtd
diff -N browser/locales/en-US/chrome/browser/preferences/sanitize.dtd
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ browser/locales/en-US/chrome/browser/preferences/sanitize.dtd	21 Feb 2005 11:21:08 -0000
@@ -0,0 +1,15 @@
+<!ENTITY sanitizeDialog.title         "Sanitize">
+
+<!ENTITY items.label                  "Santize Items">
+<!ENTITY sanitizeItems.label          "Clear the following items when Sanitizing &brandShortName;:">
+<!ENTITY itemHistory.label            "Browsing History">
+<!ENTITY itemFormData.label           "Saved Form Information">
+<!ENTITY itemPasswords.label          "Saved Passwords">
+<!ENTITY itemCookies.label            "Cookies">
+<!ENTITY itemCache.label              "Cache">
+<!ENTITY itemDownloads.label          "Download History">
+
+<!ENTITY settings.label               "Sanitize Settings">
+<!ENTITY sanitizeOnShutDown.label     "Sanitize &brandShortName; on shutdown">
+<!ENTITY promptOnSanitize.label       "Ask me before Sanitizing &brandShortName;">
+
Index: browser/locales/en-US/chrome/browser/preferences/tabs.dtd
===================================================================
RCS file: browser/locales/en-US/chrome/browser/preferences/tabs.dtd
diff -N browser/locales/en-US/chrome/browser/preferences/tabs.dtd
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ browser/locales/en-US/chrome/browser/preferences/tabs.dtd	21 Feb 2005 11:21:08 -0000
@@ -0,0 +1,14 @@
+
+<!ENTITY tabsTab.label                  "Tabs">
+<!ENTITY openExternalLinksIn.label      "Open links from other applications in:">
+<!ENTITY newWindow.label                "a new window">
+<!ENTITY newTabInRecentWindow.label     "a new tab in the most recent window">
+<!ENTITY recentWindowOrTab.label        "the most recent tab/window">
+<!ENTITY forceNewWindowLinks.label      "Force links that open new windows to open in:">
+<!ENTITY sameTabOrWindow.label          "the same tab/window as the link">
+<!ENTITY newTab.label                   "a new tab">
+<!ENTITY hideTabBar.label               "Hide the tab bar when only one web site is open">
+<!ENTITY loadInBackground.label         "Select new tabs opened from links">
+<!ENTITY loadBookmarksInBackground.label  "Select new tabs opened from bookmarks or history">
+<!ENTITY warnOnClose.label              "Warn when closing multiple tabs">
+
Index: browser/themes/pinstripe/browser/preferences/Options.png
===================================================================
RCS file: browser/themes/pinstripe/browser/preferences/Options.png
diff -N browser/themes/pinstripe/browser/preferences/Options.png
Binary files /dev/null and Options.png differ
Index: browser/themes/pinstripe/browser/preferences/preferences.css
===================================================================
RCS file: browser/themes/pinstripe/browser/preferences/preferences.css
diff -N browser/themes/pinstripe/browser/preferences/preferences.css
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ browser/themes/pinstripe/browser/preferences/preferences.css	21 Feb 2005 11:21:09 -0000
@@ -0,0 +1,175 @@
+/*
+# -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+# 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 the Firefox Preferences System.
+# 
+# The Initial Developer of the Original Code is Ben Goodger.
+# Portions created by the Initial Developer are Copyright (C) 2005
+# the Initial Developer. All Rights Reserved.
+# 
+# Contributor(s):
+#   Ben Goodger <ben@mozilla.org>
+# 
+# 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 *****
+*/
+prefwindow {
+  padding: 0 !important;
+}
+
+prefpane {
+  padding: 12px;
+}
+
+.paneSelector {
+  list-style-image: url("chrome://browser/skin/preferences/Options.png");
+  padding: 0 5px;
+  border-bottom: 1px solid #a3a3a3;
+  background: url("chrome://global/skin/toolbar/toolbar-pinstripe-overlay.png") repeat;
+  margin: 0;
+}
+
+.paneSelector radio {
+  border-right: 1px solid transparent;
+  border-left: 1px transparent;
+  padding: 3px 0 3px 0;
+  margin: 0;
+  -moz-appearance: none !important;
+}
+
+radio[pane][selected="true"] {
+    background-color: #DDDDDD;
+    background-image: none;
+    border-right: 1px solid #b9b9b9;
+    border-left: 1px solid #b9b9b9;
+    color: ButtonText !important;
+}
+
+radio[pane=paneGeneral] {
+	-moz-image-region: rect(0px, 32px,  32px, 0px)
+}
+radio[pane=paneGeneral][selected="true"]  {
+
+}
+
+radio[pane=panePrivacy] {
+	-moz-image-region: rect(0px, 64px,  32px, 32px)
+}
+radio[pane=panePrivacy][selected="true"]  {
+	
+}
+
+radio[pane=paneContent] {
+	-moz-image-region: rect(0px, 96px,  32px, 64px)
+}
+radio[pane=paneContent][selected="true"]  {
+
+}
+
+radio[pane=paneDownloads] {
+	-moz-image-region: rect(0px, 224px, 32px, 192px)
+}
+radio[pane=paneDownloads][selected="true"] {
+
+}
+
+radio[pane=paneAdvanced] {
+	-moz-image-region: rect(0px, 192px, 32px, 160px)
+}
+radio[pane=paneAdvanced][selected="true"] {
+
+}
+
+#browserStartupHomepage {
+  padding: 2px 2px 3px 4px;
+}
+
+#downloadFolderIcon {
+  width: 16px;
+  height: 16px;
+}
+
+#downloadFolderContainer {
+  margin: 2px 4px 2px 27px;
+  -moz-appearance: textfield;
+}
+
+#downloadFolderContainer2 {
+  background-color: -moz-Dialog;
+  color: -moz-DialogText;
+  margin: 1px;
+  padding: 0px 0px 0px 3px;
+}
+
+#downloadFolder {
+  -moz-appearance: none;
+  background-color: transparent;
+  border: none;
+  padding: 1px 0px 0px 0px;
+  margin: none;
+}
+
+prefpane button {
+  -moz-appearance: button-small;
+}
+
+prefpane .groupbox-body {
+  border: none !important;
+  -moz-border-radius: 0px !important;
+  background-image: none !important;
+  padding: 8px 4px 4px 4px;
+  
+}
+
+prefpane .groupbox-title {
+  background: url("chrome://global/skin/50pct_transparent_grey.png") repeat-x bottom left;
+  margin-bottom: 4px;
+}
+
+caption {
+  border-bottom: 1px solid #ECECEC;
+  padding: 4px 4px 0px 0px !important;
+}
+
+#paneContent {
+  padding-top: 8px;
+}
+
+#paneContent row {
+  padding: 0 4px;
+}
+
+#browserUseCurrent, #browserUseBookmark, #browserUseBlank {
+  margin-top: 10px;
+}
+
+#advancedPrefs {
+  margin: 0 8px;
+}
+
+#browserStartupHomepage {
+  padding: 0;
+}
+
Index: browser/themes/winstripe/browser/preferences/preferences.css
===================================================================
RCS file: browser/themes/winstripe/browser/preferences/preferences.css
diff -N browser/themes/winstripe/browser/preferences/preferences.css
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ browser/themes/winstripe/browser/preferences/preferences.css	21 Feb 2005 11:21:09 -0000
@@ -0,0 +1,230 @@
+/*
+# -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+# 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 the Firefox Preferences System.
+# 
+# The Initial Developer of the Original Code is Ben Goodger.
+# Portions created by the Initial Developer are Copyright (C) 2005
+# the Initial Developer. All Rights Reserved.
+# 
+# Contributor(s):
+#   Ben Goodger <ben@mozilla.org>
+# 
+# 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 *****
+*/
+
+/* Global Styles */
+#BrowserPreferences radio[pane] {
+  list-style-image: url("chrome://browser/skin/pref/Options.png"); 
+}
+
+radio[pane=paneGeneral] {
+	-moz-image-region: rect(0px, 32px,  32px, 0px)
+}
+radio[pane=paneGeneral]:hover, radio[pane=paneGeneral][selected="true"]  {
+	-moz-image-region: rect(32px, 32px,  64px, 0px)
+}
+
+radio[pane=panePrivacy] {
+	-moz-image-region: rect(0px, 64px,  32px, 32px)
+}
+radio[pane=panePrivacy]:hover, radio[pane=panePrivacy][selected="true"]  {
+	-moz-image-region: rect(32px, 64px,  64px, 32px)
+}
+
+radio[pane=paneContent] {
+	-moz-image-region: rect(0px, 96px,  32px, 64px)
+}
+radio[pane=paneContent]:hover, radio[pane=paneContent][selected="true"]  {
+	-moz-image-region: rect(32px, 96px,  64px, 64px)
+}
+
+radio[pane=paneDownloads] {
+	-moz-image-region: rect(0px, 128px, 32px, 96px)
+}
+radio[pane=paneDownloads]:hover, radio[pane=paneDownloads][selected="true"] {
+	-moz-image-region: rect(32px, 128px, 64px, 96px)
+}
+
+radio[pane=paneTabs] {
+	-moz-image-region: rect(0px, 128px, 32px, 96px)
+}
+radio[pane=paneTabs]:hover, radio[pane=paneTabs][selected="true"] {
+	-moz-image-region: rect(32px, 128px, 64px, 96px)
+}
+
+radio[pane=paneAdvanced] {
+	-moz-image-region: rect(0px, 160px, 32px, 128px)
+}
+radio[pane=paneAdvanced]:hover, radio[pane=paneAdvanced][selected="true"] {
+	-moz-image-region: rect(32px, 160px, 64px, 128px)
+}
+
+/* General Pane */
+#browserStartupHomepage {
+  padding: 2px 2px 3px 4px;
+}
+
+/* File Field Widget */
+filefield {
+  margin: 2px 4px 2px 4px;
+  -moz-appearance: textfield;
+}
+
+.fileFieldContentBox {
+  background-color: -moz-Dialog;
+  color: -moz-DialogText;
+  margin: 1px;
+}
+
+filefield[disabled="true"] .fileFieldContentBox {
+  -moz-opacity: 0.5;
+}
+
+filefield[disabled="true"] .fileFieldIcon {
+  -moz-opacity: 0.2;
+}
+
+.fileFieldIcon {
+  width: 16px;
+  height: 16px;
+  margin: 2px 4px 2px 2px;
+}
+
+.fileFieldLabel {
+  -moz-appearance: none;
+  background-color: transparent;
+  border: none;
+  padding: 1px 0px 0px 0px;
+  margin: 0px;
+}
+
+/* Modeless Window Dialogs */
+.windowDialog,
+.windowDialog prefpane {
+  padding: 0px;
+}
+
+.contentPane {
+  margin: 9px 8px 5px 8px;
+}
+
+.actionButtons {
+  margin: 0px 3px 6px 3px !important;
+}
+
+/* Cookies Manager */
+#cookiesChildren::-moz-tree-image(domainCol) {
+  width: 16px;
+  height: 16px;
+  margin: 0px 2px;
+  list-style-image: url("chrome://global/skin/icons/folder-item.png") !important;
+  -moz-image-region: rect(0px, 16px, 16px, 0px);
+}
+
+#cookiesChildren::-moz-tree-image(domainCol, container) {
+  -moz-image-region: rect(0px, 32px, 16px, 16px);
+}
+
+#cookiesChildren::-moz-tree-image(domainCol, container, open) {
+  -moz-image-region: rect(16px, 32px, 32px, 16px);
+}
+
+#cookieInfoBox {
+  border: 1px solid ThreeDShadow;
+  -moz-border-radius: 0px;
+  margin: 4px;
+  padding: 0px;
+}
+
+#cookieInfoBox textbox {
+  background-color: transparent;
+}
+
+#backgroundBox {
+  background-color: #FFFFFF; 
+  opacity: 0.5;
+}
+
+/* Download Actions Manager */
+#fileExtension {
+  width: 5em; 
+}
+
+#extensionChildren::-moz-tree-image(fileExtension) {
+  margin: 0px 5px 0px 0px;
+}
+
+#typeField {
+  font-weight: bold; 
+}
+
+/* Change Action Dialog */
+#typeIcon {
+  width: 32px;
+  height: 32px;
+  margin-right: 3px;
+}
+
+#typeField {
+  background-color: transparent;
+  margin: 1px 5px 2px 6px !important;
+}
+
+#extensionField {
+  color: GrayText;
+  font-weight: bold;
+}
++#ChangeActionDialog {  
+  padding: 0px;
+}
++#ChangeActionDialog .dialog-button-box {
+  padding: 8px 10px 10px 8px;+}
++#changeActionHeader {
+  border-bottom: 2px groove ThreeDFace;
+  margin: 0px;
+  padding: 10px;
+  background-color: -moz-Field;
+  color: -moz-FieldText;  
+}
++#changeActionContent {
+  padding: 8px 10px 10px 9px;
+}
++#defaultAppIcon {
+  width: 16px;  height: 16px;
+  margin-left: 2px;
+}+
+#defaultAppName {
+  margin-left: 6px !important; 
+  font-weight: bold;
+}Index: content/xul/document/src/nsXULDocument.cpp
===================================================================
RCS file: /cvsroot/mozilla/content/xul/document/src/nsXULDocument.cpp,v
retrieving revision 1.646
diff -p -u -8 -r1.646 nsXULDocument.cpp
--- content/xul/document/src/nsXULDocument.cpp	18 Feb 2005 21:28:20 -0000	1.646
+++ content/xul/document/src/nsXULDocument.cpp	21 Feb 2005 11:21:24 -0000
@@ -2649,16 +2649,204 @@ nsXULDocument::AddChromeOverlays()
         }
 
         mUnloadedOverlays->AppendElement(uri);
     }
 
     return NS_OK;
 }
 
+NS_IMETHODIMP
+nsXULDocument::LoadOverlay(const nsAString& aURL, nsIObserver* aObserver)
+{
+    nsresult rv;
+
+    nsCOMPtr<nsIURI> uri;
+    rv = NS_NewURI(getter_AddRefs(uri), aURL, nsnull);
+    if (NS_FAILED(rv)) return rv;
+
+    if (aObserver) {
+        nsIObserver* obs = nsnull;
+        if (!mOverlayLoadObservers.IsInitialized())
+            mOverlayLoadObservers.Init();
+        else
+            obs = mOverlayLoadObservers.GetWeak(uri);
+        if (!obs)
+            mOverlayLoadObservers.Put(uri, aObserver);
+        else {
+            // We don't support loading the same overlay twice into the same
+            // document - that doesn't make sense anyway.
+            return NS_ERROR_FAILURE;
+        }
+    }
+    PRBool shouldReturn;
+    return LoadOverlayInternal(uri, PR_TRUE, &shouldReturn);
+}
+
+nsresult
+nsXULDocument::LoadOverlayInternal(nsIURI* aURI, PRBool aIsDynamic, PRBool* aShouldReturn)
+{
+    nsresult rv;
+
+    *aShouldReturn = PR_FALSE;
+
+    nsCOMPtr<nsIScriptSecurityManager> secMan = do_GetService(NS_SCRIPTSECURITYMANAGER_CONTRACTID, &rv);
+    NS_ENSURE_SUCCESS(rv, rv);
+
+#ifdef PR_LOGGING
+    if (PR_LOG_TEST(gXULLog, PR_LOG_DEBUG)) {
+        nsCAutoString urlspec;
+        aURI->GetSpec(urlspec);
+
+        PR_LOG(gXULLog, PR_LOG_DEBUG,
+                ("xul: loading overlay %s", urlspec.get()));
+    }
+#endif
+
+    mResolutionPhase = nsForwardReference::eStart;
+
+    // Chrome documents are allowed to load overlays from anywhere.
+    // Also, any document may load a chrome:// overlay.
+    // In all other cases, the overlay is only allowed to load if
+    // the master document and prototype document have the same origin.
+
+    PRBool overlayIsChrome = IsChromeURI(aURI);
+    if (!IsChromeURI(mDocumentURI) && !overlayIsChrome) {
+        // Make sure we're allowed to load this overlay.
+        rv = secMan->CheckSameOriginURI(mDocumentURI, aURI);
+        if (NS_FAILED(rv)) return rv;
+    }
+
+    // Look in the prototype cache for the prototype document with
+    // the specified overlay URI.
+    if (overlayIsChrome)
+        gXULCache->GetPrototype(aURI, getter_AddRefs(mCurrentPrototype));
+    else
+        mCurrentPrototype = nsnull;
+
+    // Same comment as nsChromeProtocolHandler::NewChannel and
+    // nsXULDocument::StartDocumentLoad
+    // - Ben Goodger
+    //
+    // We don't abort on failure here because there are too many valid
+    // cases that can return failure, and the null-ness of |proto| is
+    // enough to trigger the fail-safe parse-from-disk solution.
+    // Example failure cases (for reference) include:
+    //
+    // NS_ERROR_NOT_AVAILABLE: the URI was not found in the FastLoad file,
+    //                         parse from disk
+    // other: the FastLoad file, XUL.mfl, could not be found, probably
+    //        due to being accessed before a profile has been selected
+    //        (e.g. loading chrome for the profile manager itself).
+    //        The .xul file must be parsed from disk.
+
+    PRBool useXULCache;
+    gXULCache->GetEnabled(&useXULCache);
+    mIsWritingFastLoad = useXULCache;
+
+    if (useXULCache && mCurrentPrototype) {
+        PRBool loaded;
+        rv = mCurrentPrototype->AwaitLoadDone(this, &loaded);
+        if (NS_FAILED(rv)) return rv;
+
+        if (! loaded) {
+            // Return to the main event loop and eagerly await the
+            // prototype overlay load's completion. When the content
+            // sink completes, it will trigger an EndLoad(), which'll
+            // wind us back up here, in ResumeWalk().
+            *aShouldReturn = PR_TRUE;
+            return NS_OK;
+        }
+
+        // Found the overlay's prototype in the cache, fully loaded.
+        rv = AddPrototypeSheets();
+        if (NS_FAILED(rv)) return rv;
+
+        // Now prepare to walk the prototype to create its content
+        rv = PrepareToWalk();
+        if (NS_FAILED(rv)) return rv;
+
+        PR_LOG(gXULLog, PR_LOG_DEBUG, ("xul: overlay was cached"));
+
+        // If this is a dynamic overlay and we have the prototype in the chrome 
+        // cache already, we must manually call ResumeWalk.
+        if (aIsDynamic)
+            return ResumeWalk();
+    }
+    else {
+        // Not there. Initiate a load.
+        PR_LOG(gXULLog, PR_LOG_DEBUG, ("xul: overlay was not cached"));
+
+        nsCOMPtr<nsIParser> parser;
+        rv = PrepareToLoadPrototype(aURI, "view", nsnull, getter_AddRefs(parser));
+        if (NS_FAILED(rv)) return rv;
+
+        // Predicate mIsWritingFastLoad on the XUL cache being enabled,
+        // so we don't have to re-check whether the cache is enabled all
+        // the time.
+        mIsWritingFastLoad = useXULCache;
+
+        nsCOMPtr<nsIStreamListener> listener = do_QueryInterface(parser);
+        if (! listener)
+            return NS_ERROR_UNEXPECTED;
+
+        // Add an observer to the parser; this'll get called when
+        // Necko fires its On[Start|Stop]Request() notifications,
+        // and will let us recover from a missing overlay.
+        ParserObserver* parserObserver = new ParserObserver(this);
+        if (! parserObserver)
+            return NS_ERROR_OUT_OF_MEMORY;
+
+        NS_ADDREF(parserObserver);
+        parser->Parse(aURI, parserObserver);
+        NS_RELEASE(parserObserver);
+
+        nsCOMPtr<nsILoadGroup> group = do_QueryReferent(mDocumentLoadGroup);
+        rv = NS_OpenURI(listener, nsnull, aURI, nsnull, group);
+        if (NS_FAILED(rv)) {
+            // Just move on to the next overlay.  NS_OpenURI could fail
+            // just because a channel could not be opened, which can happen
+            // if a file or chrome package does not exist.
+            ReportMissingOverlay(aURI);
+            return rv;
+        }
+
+        // If it's a 'chrome:' prototype document, then put it into
+        // the prototype cache; other XUL documents will be reloaded
+        // each time.  We must do this after NS_OpenURI and AsyncOpen,
+        // or chrome code will wrongly create a cached chrome channel
+        // instead of a real one.
+        if (useXULCache && overlayIsChrome) {
+            rv = gXULCache->PutPrototype(mCurrentPrototype);
+            if (NS_FAILED(rv)) return rv;
+        }
+
+        // Return to the main event loop and eagerly await the
+        // overlay load's completion. When the content sink
+        // completes, it will trigger an EndLoad(), which'll wind
+        // us back in ResumeWalk().
+        if (!aIsDynamic)
+            *aShouldReturn = PR_TRUE;
+    }
+    return NS_OK;
+}
+
+PR_STATIC_CALLBACK(PLDHashOperator)
+FirePendingMergeNotification(nsIURI* aKey, nsCOMPtr<nsIObserver>& aObserver, void* aClosure)
+{
+    aObserver->Observe(aKey, "xul-overlay-merged", EmptyString().get());
+
+    typedef nsInterfaceHashtable<nsURIHashKey,nsIObserver> table;
+    table* observers = NS_STATIC_CAST(table*, aClosure);
+    if (observers)
+        observers->Remove(aKey);
+
+    return PL_DHASH_REMOVE;
+}
+
 nsresult
 nsXULDocument::ResumeWalk()
 {
     // Walk the prototype and build the delegate content model. The
     // walk is performed in a top-down, left-to-right fashion. That
     // is, a parent is built before any of its children; a node is
     // only built after all of its siblings to the left are fully
     // constructed.
@@ -2965,43 +3153,88 @@ nsXULDocument::ResumeWalk()
     // If we get here, there is nothing left for us to walk. The content
     // model is built and ready for layout.
     rv = ResolveForwardReferences();
     if (NS_FAILED(rv)) return rv;
 
     rv = ApplyPersistentAttributes();
     if (NS_FAILED(rv)) return rv;
 
-    // Everything after this point we only want to do once we're
-    // certain that we've been embedded in a presentation shell.
-
-    nsAutoString title;
-    mRootContent->GetAttr(kNameSpaceID_None, nsHTMLAtoms::title, title);
-    SetTitle(title);
-
-    StartLayout();
-
-    if (mIsWritingFastLoad && IsChromeURI(mDocumentURI))
-        gXULCache->WritePrototype(mMasterPrototype);
-
-    for (PRInt32 i = mObservers.Count() - 1; i >= 0; --i) {
-        nsIDocumentObserver* observer = (nsIDocumentObserver*) mObservers[i];
-        observer->EndLoad(this);
-    }
-    NS_ASSERTION(mPlaceHolderRequest, "Bug 119310, perhaps overlayinfo referenced a overlay that doesn't exist");
-    if (mPlaceHolderRequest) {
-        // Remove the placeholder channel; if we're the last channel in the
-        // load group, this will fire the OnEndDocumentLoad() method in the
-        // docshell, and run the onload handlers, etc.
-        nsCOMPtr<nsILoadGroup> group = do_QueryReferent(mDocumentLoadGroup);
-        if (group) {
-            rv = group->RemoveRequest(mPlaceHolderRequest, nsnull, NS_OK);
-            if (NS_FAILED(rv)) return rv;
+    if (!mInitialLayoutComplete) {
+        // Everything after this point we only want to do once we're
+        // certain that we've been embedded in a presentation shell.
+
+        nsAutoString title;
+        mRootContent->GetAttr(kNameSpaceID_None, nsHTMLAtoms::title, title);
+        SetTitle(title);
+
+        StartLayout();
+
+        if (mIsWritingFastLoad && IsChromeURI(mDocumentURI))
+            gXULCache->WritePrototype(mMasterPrototype);
+
+        for (PRInt32 i = mObservers.Count() - 1; i >= 0; --i) {
+            nsIDocumentObserver* observer = (nsIDocumentObserver*) mObservers[i];
+            observer->EndLoad(this);
+        }
+        NS_ASSERTION(mPlaceHolderRequest, "Bug 119310, perhaps overlayinfo referenced a overlay that doesn't exist");
+        if (mPlaceHolderRequest) {
+            // Remove the placeholder channel; if we're the last channel in the
+            // load group, this will fire the OnEndDocumentLoad() method in the
+            // docshell, and run the onload handlers, etc.
+            nsCOMPtr<nsILoadGroup> group = do_QueryReferent(mDocumentLoadGroup);
+            if (group) {
+                rv = group->RemoveRequest(mPlaceHolderRequest, nsnull, NS_OK);
+                if (NS_FAILED(rv)) return rv;
+            }
+        }
+        mInitialLayoutComplete = PR_TRUE;
 
-            mPlaceHolderRequest = nsnull;
+        // Walk the set of pending load notifications and notify any observers.
+        // See below for detail.
+        if (mPendingOverlayLoadNotifications.IsInitialized())
+            mPendingOverlayLoadNotifications.Enumerate(FirePendingMergeNotification, (void*)&mOverlayLoadObservers);
+    }
+    else {
+        if (mOverlayLoadObservers.IsInitialized()) {
+            nsCOMPtr<nsIURI> overlayURI;
+            mCurrentPrototype->GetURI(getter_AddRefs(overlayURI));
+            nsCOMPtr<nsIObserver> obs;
+            if (mInitialLayoutComplete) {
+                // We have completed initial layout, so just send the notification.
+                mOverlayLoadObservers.Get(overlayURI, getter_AddRefs(obs));
+                NS_ASSERTION(obs, "null overlay load observer?!");
+                obs->Observe(overlayURI, "xul-overlay-merged", EmptyString().get());
+                mOverlayLoadObservers.Remove(overlayURI);
+            }
+            else {
+                // If we have not yet displayed the document for the first time 
+                // (i.e. we came in here as the result of a dynamic overlay load
+                // which was spawned by a binding-attached event caused by 
+                // StartLayout() on the master prototype - we must remember that
+                // this overlay has been merged and tell the listeners after 
+                // StartLayout() is completely finished rather than doing so 
+                // immediately - otherwise we may be executing code that needs to
+                // access XBL Binding implementations on nodes for which frames 
+                // have not yet been constructed because their bindings have not
+                // yet been attached. This can be a race condition because dynamic
+                // overlay loading can take varying amounts of time depending on
+                // whether or not the overlay prototype is in the XUL cache. The
+                // most likely effect of this bug is odd UI initialization due to
+                // methods and properties that do not work.
+                if (!mPendingOverlayLoadNotifications.IsInitialized())
+                    mPendingOverlayLoadNotifications.Init();
+                else
+                    mPendingOverlayLoadNotifications.Get(overlayURI, getter_AddRefs(obs));
+                if (!obs) {
+                    mOverlayLoadObservers.Get(overlayURI, getter_AddRefs(obs));
+                    NS_ASSERTION(obs, "null overlay load observer?");
+                    mPendingOverlayLoadNotifications.Put(overlayURI, obs);
+                }
+            }
         }
     }
 
     return rv;
 }
 
 void
 nsXULDocument::ReportMissingOverlay(nsIURI* aURI)
@@ -3331,17 +3564,17 @@ nsXULDocument::CreateOverlayElement(nsXU
     // element. I'd use an XML element, but it gets its knickers in a
     // knot with DOM ranges when you try to remove its children.
     nsCOMPtr<nsIContent> element;
     rv = nsXULElement::Create(aPrototype, this, PR_FALSE,
                               getter_AddRefs(element));
     if (NS_FAILED(rv)) return rv;
 
     OverlayForwardReference* fwdref =
-        new OverlayForwardReference(this, element);
+        new OverlayForwardReference(this, element, mInitialLayoutComplete);
     if (! fwdref)
         return NS_ERROR_OUT_OF_MEMORY;
 
     // transferring ownership to ya...
     rv = AddForwardReference(fwdref);
     if (NS_FAILED(rv)) return rv;
 
     *aResult = element;
@@ -3561,17 +3794,17 @@ nsXULDocument::OverlayForwardReference::
     nsresult rv;
 
     nsAutoString id;
     rv = mOverlay->GetAttr(kNameSpaceID_None, nsXULAtoms::id, id);
     if (NS_FAILED(rv)) return eResolve_Error;
 
     if (id.IsEmpty()) {
         // overlay had no id, use the root element
-        mDocument->InsertElement(mDocument->mRootContent, mOverlay);
+        mDocument->InsertElement(mDocument->mRootContent, mOverlay, mDidInitialReflow);
         mResolved = PR_TRUE;
         return eResolve_Succeeded;
     }
 
     nsCOMPtr<nsIDOMElement> domtarget;
     rv = mDocument->GetElementById(id, getter_AddRefs(domtarget));
     if (NS_FAILED(rv)) return eResolve_Error;
 
@@ -3580,17 +3813,17 @@ nsXULDocument::OverlayForwardReference::
     if (! domtarget)
         return eResolve_Later;
 
     nsCOMPtr<nsIContent> target = do_QueryInterface(domtarget);
     NS_ASSERTION(target != nsnull, "not an nsIContent");
     if (! target)
         return eResolve_Error;
 
-    rv = Merge(target, mOverlay);
+    rv = Merge(target, mOverlay, mDidInitialReflow);
     if (NS_FAILED(rv)) return eResolve_Error;
 
     // Add child and any descendants to the element map
     rv = mDocument->AddSubtreeToDocument(target);
     if (NS_FAILED(rv)) return eResolve_Error;
 
 #ifdef PR_LOGGING
     if (PR_LOG_TEST(gXULLog, PR_LOG_NOTICE)) {
@@ -3605,23 +3838,32 @@ nsXULDocument::OverlayForwardReference::
     mResolved = PR_TRUE;
     return eResolve_Succeeded;
 }
 
 
 
 nsresult
 nsXULDocument::OverlayForwardReference::Merge(nsIContent* aTargetNode,
-                                              nsIContent* aOverlayNode)
+                                              nsIContent* aOverlayNode, 
+                                              PRBool aNotify)
 {
     // This function is given:
     // aTargetNode:  the node in the document whose 'id' attribute
     //               matches a toplevel node in our overlay.
     // aOverlayNode: the node in the overlay document that matches
     //               a node in the actual document.
+    // aNotify:      whether or not content manipulation methods should
+    //               use the aNotify parameter. After the initial 
+    //               reflow (i.e. in the dynamic overlay merge case),
+    //               we want all the content manipulation methods we
+    //               call to notify so that frames are constructed 
+    //               etc. Otherwise do not, since that's during initial
+    //               document construction before StartLayout has been
+    //               called which will do everything for us.
     //
     // This function merges the tree from the overlay into the tree in
     // the document, overwriting attributes and appending child content
     // nodes appropriately. (See XUL overlay reference for details)
 
     nsresult rv;
 
     // Merge attributes from the overlay content node to that of the
@@ -3647,23 +3889,23 @@ nsXULDocument::OverlayForwardReference::
         nsAutoString tempID;
         rv = aOverlayNode->GetAttr(kNameSpaceID_None, nsXULAtoms::id, tempID);
 
         // Element in the overlay has the 'removeelement' attribute set
         // so remove it from the actual document.
         if (attr == nsXULAtoms::removeelement &&
             value.EqualsLiteral("true")) {
 
-            rv = RemoveElement(aTargetNode->GetParent(), aTargetNode);
+            rv = RemoveElement(aTargetNode->GetParent(), aTargetNode, aNotify);
             if (NS_FAILED(rv)) return rv;
 
             return NS_OK;
         }
 
-        rv = aTargetNode->SetAttr(nameSpaceID, attr, prefix, value, PR_FALSE);
+        rv = aTargetNode->SetAttr(nameSpaceID, attr, prefix, value, aNotify);
         if (NS_FAILED(rv)) return rv;
     }
 
 
     // Walk our child nodes, looking for elements that have the 'id'
     // attribute set. If we find any, we must do a parent check in the
     // actual document to ensure that the structure matches that of
     // the actual document. If it does, we can call ourselves and attempt
@@ -3714,29 +3956,29 @@ nsXULDocument::OverlayForwardReference::
             if (NS_FAILED(rv)) return rv;
             nsCOMPtr<nsIDOMElement> elementParent(do_QueryInterface(nodeParent));
 
             nsAutoString parentID;
             elementParent->GetAttribute(NS_LITERAL_STRING("id"), parentID);
             if (parentID.Equals(documentParentID)) {
                 // The element matches. "Go Deep!"
                 nsCOMPtr<nsIContent> childDocumentContent(do_QueryInterface(nodeInDocument));
-                rv = Merge(childDocumentContent, currContent);
+                rv = Merge(childDocumentContent, currContent, aNotify);
                 if (NS_FAILED(rv)) return rv;
                 rv = aOverlayNode->RemoveChildAt(0, PR_FALSE);
                 if (NS_FAILED(rv)) return rv;
 
                 continue;
             }
         }
 
         rv = aOverlayNode->RemoveChildAt(0, PR_FALSE);
         if (NS_FAILED(rv)) return rv;
 
-        rv = InsertElement(aTargetNode, currContent);
+        rv = InsertElement(aTargetNode, currContent, aNotify);
         if (NS_FAILED(rv)) return rv;
     }
 
     return NS_OK;
 }
 
 
 
@@ -3972,17 +4214,17 @@ nsXULDocument::CheckBroadcasterHookup(ns
 #endif
 
     *aNeedsHookup = PR_FALSE;
     *aDidResolve = PR_TRUE;
     return NS_OK;
 }
 
 nsresult
-nsXULDocument::InsertElement(nsIContent* aParent, nsIContent* aChild)
+nsXULDocument::InsertElement(nsIContent* aParent, nsIContent* aChild, PRBool aNotify)
 {
     // Insert aChild appropriately into aParent, accounting for a
     // 'pos' attribute set on aChild.
     nsresult rv;
 
     nsAutoString posStr;
     PRBool wasInserted = PR_FALSE;
 
@@ -4024,17 +4266,17 @@ nsXULDocument::InsertElement(nsIContent*
             NS_ASSERTION(content != nsnull, "null ptr");
             if (!content)
                 return NS_ERROR_UNEXPECTED;
 
             PRInt32 pos = aParent->IndexOf(content);
 
             if (pos != -1) {
                 pos = isInsertAfter ? pos + 1 : pos;
-                rv = aParent->InsertChildAt(aChild, pos, PR_FALSE, PR_TRUE);
+                rv = aParent->InsertChildAt(aChild, pos, aNotify, PR_TRUE);
                 if (NS_FAILED(rv))
                     return rv;
 
                 wasInserted = PR_TRUE;
             }
         }
     }
 
@@ -4042,41 +4284,41 @@ nsXULDocument::InsertElement(nsIContent*
 
         rv = aChild->GetAttr(kNameSpaceID_None, nsXULAtoms::position, posStr);
         if (NS_FAILED(rv)) return rv;
 
         if (rv == NS_CONTENT_ATTR_HAS_VALUE) {
             // Positions are one-indexed.
             PRInt32 pos = posStr.ToInteger(NS_REINTERPRET_CAST(PRInt32*, &rv));
             if (NS_SUCCEEDED(rv)) {
-                rv = aParent->InsertChildAt(aChild, pos - 1, PR_FALSE,
+                rv = aParent->InsertChildAt(aChild, pos - 1, aNotify,
                                             PR_TRUE);
                 if (NS_SUCCEEDED(rv))
                     wasInserted = PR_TRUE;
                 // If the insertion fails, then we should still
                 // attempt an append.  Thus, rather than returning rv
                 // immediately, we fall through to the final
                 // "catch-all" case that just does an AppendChildTo.
             }
         }
     }
 
     if (! wasInserted) {
-        rv = aParent->AppendChildTo(aChild, PR_FALSE, PR_TRUE);
+        rv = aParent->AppendChildTo(aChild, aNotify, PR_TRUE);
         if (NS_FAILED(rv)) return rv;
     }
     return NS_OK;
 }
 
 nsresult
-nsXULDocument::RemoveElement(nsIContent* aParent, nsIContent* aChild)
+nsXULDocument::RemoveElement(nsIContent* aParent, nsIContent* aChild, PRBool aNotify)
 {
     PRInt32 nodeOffset = aParent->IndexOf(aChild);
 
-    return aParent->RemoveChildAt(nodeOffset, PR_TRUE);
+    return aParent->RemoveChildAt(nodeOffset, aNotify);
 }
 
 //----------------------------------------------------------------------
 //
 // CachedChromeStreamListener
 //
 
 nsXULDocument::CachedChromeStreamListener::CachedChromeStreamListener(nsXULDocument* aDocument, PRBool aProtoLoaded)
Index: content/xul/document/src/nsXULDocument.h
===================================================================
RCS file: /cvsroot/mozilla/content/xul/document/src/nsXULDocument.h,v
retrieving revision 1.168
diff -p -u -8 -r1.168 nsXULDocument.h
--- content/xul/document/src/nsXULDocument.h	18 Feb 2005 21:28:20 -0000	1.168
+++ content/xul/document/src/nsXULDocument.h	21 Feb 2005 11:21:25 -0000
@@ -64,17 +64,19 @@ class nsIFocusController;
 class nsIObjectInputStream;
 class nsIObjectOutputStream;
 class nsIXULPrototypeScript;
 #else
 #include "nsIObjectInputStream.h"
 #include "nsIObjectOutputStream.h"
 #include "nsXULElement.h"
 #endif
-
+#include "nsURIHashKey.h"
+#include "nsInterfaceHashtable.h"
+ 
 struct JSObject;
 struct PRLogModuleInfo;
 
 #include "nsIFastLoadService.h"         // XXXbe temporary?
 
 /**
  * The XUL document class
  */
@@ -200,16 +202,19 @@ protected:
                            nsIParser** aResult);
 
     nsresult
     PrepareToLoadPrototype(nsIURI* aURI,
                            const char* aCommand,
                            nsIPrincipal* aDocumentPrincipal,
                            nsIParser** aResult);
 
+    nsresult 
+    LoadOverlayInternal(nsIURI* aURI, PRBool aIsDynamic, PRBool* aShouldReturn);
+
     nsresult ApplyPersistentAttributes();
     nsresult ApplyPersistentAttributesToElements(nsIRDFResource* aResource,
                                                  nsISupportsArray* aElements);
 
     nsresult
     AddElementToDocumentPre(nsIContent* aElement);
 
     nsresult
@@ -435,22 +440,24 @@ protected:
      * Used to hook up overlays
      */
     class OverlayForwardReference : public nsForwardReference
     {
     protected:
         nsXULDocument* mDocument;      // [WEAK]
         nsCOMPtr<nsIContent> mOverlay; // [OWNER]
         PRBool mResolved;
+        PRBool mDidInitialReflow;
 
-        nsresult Merge(nsIContent* aTargetNode, nsIContent* aOverlayNode);
+        nsresult Merge(nsIContent* aTargetNode, nsIContent* aOverlayNode, PRBool aNotify);
 
     public:
-        OverlayForwardReference(nsXULDocument* aDocument, nsIContent* aOverlay)
-            : mDocument(aDocument), mOverlay(aOverlay), mResolved(PR_FALSE) {}
+        OverlayForwardReference(nsXULDocument* aDocument, nsIContent* aOverlay, PRBool aDidInitialReflow)
+            : mDocument(aDocument), mOverlay(aOverlay), mResolved(PR_FALSE), 
+              mDidInitialReflow(aDidInitialReflow) {}
 
         virtual ~OverlayForwardReference();
 
         virtual Phase GetPhase() { return eConstruction; }
         virtual Result Resolve();
     };
 
     friend class OverlayForwardReference;
@@ -479,21 +486,21 @@ protected:
 
     void
     SynchronizeBroadcastListener(nsIDOMElement   *aBroadcaster,
                                  nsIDOMElement   *aListener,
                                  const nsAString &aAttr);
 
     static
     nsresult
-    InsertElement(nsIContent* aParent, nsIContent* aChild);
+    InsertElement(nsIContent* aParent, nsIContent* aChild, PRBool aNotify);
 
     static 
     nsresult
-    RemoveElement(nsIContent* aParent, nsIContent* aChild);
+    RemoveElement(nsIContent* aParent, nsIContent* aChild, PRBool aNotify);
 
     /**
      * The current prototype that we are walking to construct the
      * content model.
      */
     nsCOMPtr<nsIXULPrototypeDocument> mCurrentPrototype;
 
     /**
@@ -569,14 +576,18 @@ protected:
 
     friend class ParserObserver;
 
     /**
      * A map from a broadcaster element to a list of listener elements.
      */
     PLDHashTable* mBroadcasterMap;
 
+    nsInterfaceHashtable<nsURIHashKey,nsIObserver> mOverlayLoadObservers;
+    nsInterfaceHashtable<nsURIHashKey,nsIObserver> mPendingOverlayLoadNotifications;
+    
+    PRBool mInitialLayoutComplete;
 private:
     // helpers
 
 };
 
 #endif // nsXULDocument_h__
Index: dom/public/idl/xul/nsIDOMXULDocument.idl
===================================================================
RCS file: /cvsroot/mozilla/dom/public/idl/xul/nsIDOMXULDocument.idl,v
retrieving revision 1.6
diff -p -u -8 -r1.6 nsIDOMXULDocument.idl
--- dom/public/idl/xul/nsIDOMXULDocument.idl	17 Apr 2004 21:50:12 -0000	1.6
+++ dom/public/idl/xul/nsIDOMXULDocument.idl	21 Feb 2005 11:21:31 -0000
@@ -35,19 +35,19 @@
  * 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 ***** */
 
 #include "domstubs.idl"
 
 interface nsIDOMXULCommandDispatcher;
+interface nsIObserver;
 
-
-[scriptable, uuid(17ddd8c0-c5f8-11d2-a6ae-00104bde6048)]
+[scriptable, uuid(e64bb081-13ba-430e-ab70-73a9f1d3de58)]
 interface nsIDOMXULDocument : nsISupports
 {
            attribute nsIDOMNode                 popupNode;
            attribute nsIDOMNode                 tooltipNode;
 
   readonly attribute nsIDOMXULCommandDispatcher commandDispatcher;
 
   readonly attribute long                       width;
@@ -60,9 +60,11 @@ interface nsIDOMXULDocument : nsISupport
                                                     in nsIDOMElement observer,
                                                     in DOMString attr);
 
   void                      removeBroadcastListenerFor(in nsIDOMElement broadcaster,
                                                        in nsIDOMElement observer,
                                                        in DOMString attr);
 
   void                      persist(in DOMString id, in DOMString attr);
+
+  void                      loadOverlay(in DOMString url, in nsIObserver aObserver);
 };
Index: netwerk/base/public/nsURIHashKey.h
===================================================================
RCS file: /cvsroot/mozilla/netwerk/base/public/nsURIHashKey.h,v
retrieving revision 1.3
diff -p -u -8 -r1.3 nsURIHashKey.h
--- netwerk/base/public/nsURIHashKey.h	20 Feb 2005 01:47:10 -0000	1.3
+++ netwerk/base/public/nsURIHashKey.h	21 Feb 2005 11:22:37 -0000
@@ -30,16 +30,18 @@
  * 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 ***** */
+#ifndef nsURIHashKey_h__
+#define nsURIHashKey_h__
 
 #include "pldhash.h"
 #include "nsCOMPtr.h"
 #include "nsCRT.h"
 
 /**
  * Hashtable key class to use with nsTHashtable/nsBaseHashtable
  */
@@ -73,8 +75,10 @@ public:
         return nsCRT::HashCode(spec.get());
     }
     
     enum { ALLOW_MEMMOVE = PR_TRUE };
 
 private:
     nsCOMPtr<nsIURI> mKey;
 };
+
+#endif // nsURIHashKey_h__
Index: toolkit/components/passwordmgr/resources/content/passwordManager.xul
===================================================================
RCS file: /cvsroot/mozilla/toolkit/components/passwordmgr/resources/content/passwordManager.xul,v
retrieving revision 1.4
diff -p -u -8 -r1.4 passwordManager.xul
--- toolkit/components/passwordmgr/resources/content/passwordManager.xul	1 Feb 2005 17:07:03 -0000	1.4
+++ toolkit/components/passwordmgr/resources/content/passwordManager.xul	21 Feb 2005 11:22:58 -0000
@@ -37,84 +37,85 @@
 # the terms of any one of the MPL, the GPL or the LGPL.
 #
 # ***** END LICENSE BLOCK *****
 
 <?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
 
 <!DOCTYPE dialog SYSTEM "chrome://passwordmgr/locale/passwordManager.dtd" >
 
-<dialog id="signonviewer"
-        title="&windowtitle.label;"
-        xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
-        buttons="accept"
-        onload="Startup()"
-        onunload="Shutdown()"
-        persist="screenX screenY width height">
+<prefwindow id="SignonViewerDialog" windowtype="Toolkit:PasswordManager"
+            xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+            dlgbuttons="accept"
+            onload="Startup();" onunload="Shutdown();"
+            title="&windowtitle.label;"
+            persist="width height screenX screenY">
 
-  <script src="chrome://passwordmgr/content/passwordManager.js"/>
+  <prefpane id="SignonViewerDialogPane">
+    <script src="chrome://passwordmgr/content/passwordManager.js"/>
 
-  <stringbundle id="signonBundle"
-                src="chrome://passwordmgr/locale/passwordmgr.properties"/>
+    <stringbundle id="signonBundle"
+                  src="chrome://passwordmgr/locale/passwordmgr.properties"/>
 
-  <tabbox id="tabbox" flex="1">
-    <tabs>
-      <tab id="signonsTab" label="&tab.signonsstored.label;"/>
-      <tab id="signonsitesTab" label="&tab.signonsnotstored.label;"/>
-    </tabs>
-    <tabpanels id="panel" flex="1">
-      <!-- saved signons -->
-      <vbox id="savedsignons" flex="1">
-          <description>&spiel.signonsstored.label;</description>
-          <separator class="thin"/>
-          <tree id="signonsTree" flex="1" style="height: 10em;" hidecolumnpicker="true"
-                onkeypress="HandleSignonKeyPress(event)"
-                onselect="SignonSelected();">
-            <treecols>
-              <treecol id="siteCol" label="&treehead.site.label;" flex="5"
-                           onclick="SignonColumnSort('host');" persist="width"/>
-              <splitter class="tree-splitter"/>
-              <treecol id="userCol" label="&treehead.username.label;" flex="2"
-                           onclick="SignonColumnSort('user');" persist="width"/>
-              <splitter class="tree-splitter"/>
-              <treecol id="passwordCol" label="&treehead.password.label;" flex="2"
-                           onclick="SignonColumnSort('password');" persist="width"
-                           hidden="true"/>
-            </treecols>
-            <treechildren/>
-          </tree>
-          <separator class="thin"/>
-          <hbox>
-            <button id="removeSignon" disabled="true"
-                          label="&remove.label;" oncommand="DeleteSignon();"/>
-            <button id="removeAllSignons"
-                          label="&removeall.label;"
-                          oncommand="DeleteAllSignons();"/>
-            <spacer flex="1"/>
-            <button id="togglePasswords"
-                          oncommand="TogglePasswordVisible();"/>
-          </hbox>
-      </vbox>
-      <!-- rejected signon sites -->
-      <vbox id="rejectedsites" flex="1">
-          <description>&spiel.signonsnotstored.label;</description>
-          <separator class="thin"/>
-          <tree id="rejectsTree" flex="1" style="height: 10em;" hidecolumnpicker="true"
-                    onkeypress="HandleRejectKeyPress(event)"
-                    onselect="RejectSelected();">
-            <treecols>
-              <treecol id="rejectCol" label="&treehead.site.label;" flex="5"
-                           onclick="RejectColumnSort('host');"/>
-            </treecols>
-            <treechildren/>
-          </tree>
-          <separator class="thin"/>
-          <hbox>
-            <button id="removeReject" disabled="true"
-                          label="&remove.label;" oncommand="DeleteReject();"/>
-            <button id="removeAllRejects"
-                          label="&removeall.label;"
-                          oncommand="DeleteAllRejects();"/>
-          </hbox>
-      </vbox>
-    </tabpanels>
-  </tabbox>   
-</dialog>
+    <tabbox id="tabbox" flex="1">
+      <tabs>
+        <tab id="signonsTab" label="&tab.signonsstored.label;"/>
+        <tab id="signonsitesTab" label="&tab.signonsnotstored.label;"/>
+      </tabs>
+      <tabpanels id="panel" flex="1">
+        <!-- saved signons -->
+        <vbox id="savedsignons" flex="1">
+            <description>&spiel.signonsstored.label;</description>
+            <separator class="thin"/>
+            <tree id="signonsTree" flex="1" style="height: 20em;" hidecolumnpicker="true"
+                  onkeypress="HandleSignonKeyPress(event)"
+                  onselect="SignonSelected();">
+              <treecols>
+                <treecol id="siteCol" label="&treehead.site.label;" flex="5"
+                         onclick="SignonColumnSort('host');" persist="width"/>
+                <splitter class="tree-splitter"/>
+                <treecol id="userCol" label="&treehead.username.label;" flex="2"
+                         onclick="SignonColumnSort('user');" persist="width"/>
+                <splitter class="tree-splitter"/>
+                <treecol id="passwordCol" label="&treehead.password.label;" flex="2"
+                         onclick="SignonColumnSort('password');" persist="width"
+                         hidden="true"/>
+              </treecols>
+              <treechildren/>
+            </tree>
+            <separator class="thin"/>
+            <hbox>
+              <button id="removeSignon" disabled="true"
+                      label="&remove.label;" oncommand="DeleteSignon();"/>
+              <button id="removeAllSignons"
+                      label="&removeall.label;"
+                      oncommand="DeleteAllSignons();"/>
+              <spacer flex="1"/>
+              <button id="togglePasswords"
+                      oncommand="TogglePasswordVisible();"/>
+            </hbox>
+        </vbox>
+        <!-- rejected signon sites -->
+        <vbox id="rejectedsites" flex="1">
+            <description>&spiel.signonsnotstored.label;</description>
+            <separator class="thin"/>
+            <tree id="rejectsTree" flex="1" style="height: 10em;" hidecolumnpicker="true"
+                  onkeypress="HandleRejectKeyPress(event)"
+                  onselect="RejectSelected();">
+              <treecols>
+                <treecol id="rejectCol" label="&treehead.site.label;" flex="5"
+                          onclick="RejectColumnSort('host');"/>
+              </treecols>
+              <treechildren/>
+            </tree>
+            <separator class="thin"/>
+            <hbox>
+              <button id="removeReject" disabled="true"
+                      label="&remove.label;" oncommand="DeleteReject();"/>
+              <button id="removeAllRejects"
+                      label="&removeall.label;"
+                      oncommand="DeleteAllRejects();"/>
+            </hbox>
+        </vbox>
+      </tabpanels>
+    </tabbox>   
+  </prefpane>
+</prefwindow>
Index: toolkit/components/viewconfig/content/config.js
===================================================================
RCS file: /cvsroot/mozilla/toolkit/components/viewconfig/content/config.js,v
retrieving revision 1.9
diff -p -u -8 -r1.9 config.js
--- toolkit/components/viewconfig/content/config.js	1 Dec 2004 12:26:49 -0000	1.9
+++ toolkit/components/viewconfig/content/config.js	21 Feb 2005 11:22:59 -0000
@@ -459,16 +459,21 @@ function updateContextMenu()
 
   var modifySelected = document.getElementById("modifySelected");
   modifySelected.setAttribute("disabled", lockCol == PREF_IS_LOCKED);
   modifySelected.hidden = canToggle;
 
   var toggleSelected = document.getElementById("toggleSelected");
   toggleSelected.setAttribute("disabled", lockCol == PREF_IS_LOCKED);
   toggleSelected.hidden = !canToggle;
+  
+  var entry = gPrefView[view.selection.currentIndex];
+  var isLocked = gPrefBranch.prefIsLocked(entry.prefCol);
+  document.getElementById("lockSelected").hidden = isLocked;
+  document.getElementById("unlockSelected").hidden = !isLocked;
 }
 
 function copyName()
 {
   gClipboardHelper.copyString(gPrefView[view.selection.currentIndex].prefCol);
 }
 
 function copyValue()
@@ -539,10 +544,26 @@ function ModifyPref(entry)
     if (entry.typeCol == nsIPrefBranch.PREF_INT) {
       gPrefBranch.setIntPref(entry.prefCol, parseInt(result.value, 10));
     } else {
       var supportsString = Components.classes[nsSupportsString_CONTRACTID].createInstance(nsISupportsString);
       supportsString.data = result.value;
       gPrefBranch.setComplexValue(entry.prefCol, nsISupportsString, supportsString);
     }
   }
+  
+  gPrefService.savePrefFile(null);
+  
   return true;
 }
+
+function LockSelected()
+{
+  var entry = gPrefView[view.selection.currentIndex];
+  gPrefBranch.lockPref(entry.prefCol);
+}
+
+function UnlockSelected()
+{
+  var entry = gPrefView[view.selection.currentIndex];
+  gPrefBranch.unlockPref(entry.prefCol);
+}
+
Index: toolkit/components/viewconfig/content/config.xul
===================================================================
RCS file: /cvsroot/mozilla/toolkit/components/viewconfig/content/config.xul,v
retrieving revision 1.4
diff -p -u -8 -r1.4 config.xul
--- toolkit/components/viewconfig/content/config.xul	26 Jul 2004 17:07:11 -0000	1.4
+++ toolkit/components/viewconfig/content/config.xul	21 Feb 2005 11:22:59 -0000
@@ -61,31 +61,33 @@
       <menuitem label="&string.label;" accesskey="&string.accesskey;" oncommand="NewPref(nsIPrefBranch.PREF_STRING);"/>
       <menuitem label="&integer.label;" accesskey="&integer.accesskey;" oncommand="NewPref(nsIPrefBranch.PREF_INT);"/>
       <menuitem label="&boolean.label;" accesskey="&boolean.accesskey;" oncommand="NewPref(nsIPrefBranch.PREF_BOOL);"/>
     </menupopup>
   </menu>
   <menuitem id="toggleSelected" label="&toggle.label;" accesskey="&toggle.accesskey;" oncommand="ModifySelected();"/>
   <menuitem id="modifySelected" label="&modify.label;" accesskey="&modify.accesskey;" oncommand="ModifySelected();"/>
   <menuitem id="resetSelected" label="&reset.label;" accesskey="&reset.accesskey;" oncommand="ResetSelected();"/>
+  <menuitem id="lockSelected" label="&lock.label;" accesskey="&lock.accesskey;" oncommand="LockSelected();"/>
+  <menuitem id="unlockSelected" label="&unlock.label;" accesskey="&unlock.accesskey;" oncommand="UnlockSelected();"/>
 </popup>
 
 <keyset>
   <key keycode="VK_ENTER" oncommand="ModifySelected();"/>
   <key keycode="VK_RETURN" oncommand="ModifySelected();"/>
 </keyset>
 
-<hbox align="center">
+<hbox id="filterRow" align="center">
   <label value="&filterPrefs.label;" accesskey="&filterPrefs.accesskey;" control="textbox"/>
   <textbox id="textbox" flex="1" type="timed" timeout="500" oncommand="FilterPrefs();"/>
   <button id="button" label="&showAll.label;" accesskey="&showAll.accesskey;" oncommand="ClearFilter();" disabled="true"/>
 </hbox>
 
-<tree id="configTree" flex="1" class="plain focusring" seltype="single"
-      enableColumnDrag="true" context="configContext">
+<tree id="configTree" flex="1" seltype="single" enableColumnDrag="true" 
+      context="configContext">
   <treecols>
     <treecol id="prefCol" label="&prefColumn.label;" flex="7"
         class="sortDirectionIndicator"
         ignoreincolumnpicker="true"
         persist="hidden width ordinal sortDirection"/>
     <splitter class="tree-splitter" />
     <treecol id="lockCol" label="&lockColumn.label;" flex="1"
         class="sortDirectionIndicator"
Index: toolkit/content/globalOverlay.js
===================================================================
RCS file: /cvsroot/mozilla/toolkit/content/globalOverlay.js,v
retrieving revision 1.16
diff -p -u -8 -r1.16 globalOverlay.js
--- toolkit/content/globalOverlay.js	20 Feb 2005 23:10:50 -0000	1.16
+++ toolkit/content/globalOverlay.js	21 Feb 2005 11:22:59 -0000
@@ -1,18 +1,18 @@
 function closeWindow(aClose)
 {
   var windowCount = 0;
-  var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"].getService(Components.interfaces.nsIWindowMediator);
+   var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"]
+                      .getService(Components.interfaces.nsIWindowMediator);
   var e = wm.getEnumerator(null);
   
   while (e.hasMoreElements()) {
     var w = e.getNext();
-    ++windowCount;
-    if (windowCount == 2) 
+    if (++windowCount == 2) 
       break;
   }
 
 # Closing the last window doesn't quit the application on OS X.
 #ifndef XP_MACOSX
   // If we're down to the last window and someone tries to shut down, check to make sure we can!
   if (windowCount == 1 && !canQuitApplication())
     return false;
@@ -21,29 +21,31 @@ function closeWindow(aClose)
   if (aClose)    
     window.close();
   
   return true;
 }
 
 function canQuitApplication()
 {
-  var os = Components.classes["@mozilla.org/observer-service;1"].getService(Components.interfaces.nsIObserverService);
-  if (os) {
-    try {
-      var cancelQuit = Components.classes["@mozilla.org/supports-PRBool;1"].createInstance(Components.interfaces.nsISupportsPRBool);
-      os.notifyObservers(cancelQuit, "quit-application-requested", null);
-      
-      // Something aborted the quit process. 
-      if (cancelQuit.data)
-        return false;
-    }
-    catch (ex) {
-    }
+  var os = Components.classes["@mozilla.org/observer-service;1"]
+                     .getService(Components.interfaces.nsIObserverService);
+  if (!os) return true;
+  
+  try {
+    var cancelQuit = Components.classes["@mozilla.org/supports-PRBool;1"]
+                              .createInstance(Components.interfaces.nsISupportsPRBool);
+    os.notifyObservers(cancelQuit, "quit-application-requested", null);
+    
+    // Something aborted the quit process. 
+    if (cancelQuit.data)
+      return false;
   }
+  catch (ex) { }
+  os.notifyObservers(null, "quit-application-granted", null);
   return true;
 }
 
 function goQuitApplication()
 {
   if (!canQuitApplication())
     return;
     
Index: toolkit/content/jar.mn
===================================================================
RCS file: /cvsroot/mozilla/toolkit/content/jar.mn,v
retrieving revision 1.10
diff -p -u -8 -r1.10 jar.mn
--- toolkit/content/jar.mn	20 Feb 2005 22:58:48 -0000	1.10
+++ toolkit/content/jar.mn	21 Feb 2005 11:22:59 -0000
@@ -42,16 +42,17 @@ toolkit.jar:
 *  content/global/bindings/expander.xml        (widgets/expander.xml)
 *+ content/global/bindings/general.xml         (widgets/general.xml)
 *+ content/global/bindings/groupbox.xml        (widgets/groupbox.xml)
 *+ content/global/bindings/listbox.xml         (widgets/listbox.xml)
 *+ content/global/bindings/menu.xml            (widgets/menu.xml)
 *+ content/global/bindings/menulist.xml        (widgets/menulist.xml)
 *+ content/global/bindings/nativescrollbar.xml (widgets/nativescrollbar.xml)
 *+ content/global/bindings/popup.xml           (widgets/popup.xml)
+*+ content/global/bindings/preferences.xml     (widgets/preferences.xml)
 *+ content/global/bindings/progressmeter.xml   (widgets/progressmeter.xml)
 *+ content/global/bindings/radio.xml           (widgets/radio.xml)
 *+ content/global/bindings/scrollbar.xml       (widgets/scrollbar.xml)
 *+ content/global/bindings/scrollbox.xml       (widgets/scrollbox.xml)
 *+ content/global/bindings/splitter.xml        (widgets/splitter.xml)
 *+ content/global/bindings/spinbuttons.xml     (widgets/spinbuttons.xml)
 *+ content/global/bindings/stringbundle.xml    (widgets/stringbundle.xml)
 *+ content/global/bindings/tabbox.xml          (widgets/tabbox.xml)
Index: toolkit/content/xul.css
===================================================================
RCS file: /cvsroot/mozilla/toolkit/content/xul.css,v
retrieving revision 1.52
diff -p -u -8 -r1.52 xul.css
--- toolkit/content/xul.css	5 Dec 2004 21:40:39 -0000	1.52
+++ toolkit/content/xul.css	21 Feb 2005 11:23:00 -0000
@@ -628,17 +628,17 @@ label {
   -moz-binding: url("chrome://global/content/bindings/text.xml#text-label");
 }
 
 label.text-link {
   -moz-binding: url("chrome://global/content/bindings/text.xml#text-link");
   -moz-user-focus: normal;
 }
 
-label[control], label.radio-label, label.checkbox-label {
+description[control], label[control], label.radio-label, label.checkbox-label {
   -moz-binding: url("chrome://global/content/bindings/text.xml#label-control");
 }
 
 html|span.accesskey {
   text-decoration: underline;
 }
 
 /********** textbox **********/
@@ -934,14 +934,67 @@ wizardpage {
 .wizard-header {
   -moz-binding: url("chrome://global/content/bindings/wizard.xml#wizard-header");
 }
 
 .wizard-buttons {
   -moz-binding: url("chrome://global/content/bindings/wizard.xml#wizard-buttons");
 }
 
+/********** preferences ********/
+
+prefwindow {
+  -moz-binding: url("chrome://global/content/bindings/preferences.xml#prefwindow");  
+  -moz-box-orient: vertical;
+}
+
+prefpane {
+  -moz-binding: url("chrome://global/content/bindings/preferences.xml#prefpane");  
+  -moz-box-orient: vertical;
+  opacity: 0.0;
+}
+
+prefpane[selected="true"] {
+  opacity: 0.0;
+}
+
+prefwindow[animate="off"] > prefpane,
+prefwindow[animate="off"] > prefpane[selected="true"],
+prefwindow[type="child"] > prefpane,
+prefwindow[type="child"] > prefpane[selected="true"] {
+  opacity: 1.0;
+}
+
+prefwindow > .paneDeckContainer {
+  overflow: hidden;
+}
+
+prefpane > .content-box {
+  overflow: hidden;
+}
+
+prefwindow[type="child"] > prefpane > .content-box {
+  -moz-box-flex: 1;
+  overflow: -moz-hidden-unscrollable;
+}
+
+preferences {
+  -moz-binding: url("chrome://global/content/bindings/preferences.xml#preferences");
+  visibility: collapse;
+}
+
+preference {
+  -moz-binding: url("chrome://global/content/bindings/preferences.xml#preference");  
+  visibility: collapse;
+}
+
+radio[pane] {
+  -moz-binding: url("chrome://global/content/bindings/preferences.xml#panebutton") !important; 
+  -moz-box-orient: vertical;
+  -moz-appearance: none;
+  -moz-box-align: center;
+}
 /********** expander ********/
 
 expander {
   -moz-binding: url("chrome://global/content/bindings/expander.xml#expander");
   -moz-box-orient: vertical;
 }
Index: toolkit/content/widgets/checkbox.xml
===================================================================
RCS file: /cvsroot/mozilla/toolkit/content/widgets/checkbox.xml,v
retrieving revision 1.6
diff -p -u -8 -r1.6 checkbox.xml
--- toolkit/content/widgets/checkbox.xml	22 Jun 2004 22:10:09 -0000	1.6
+++ toolkit/content/widgets/checkbox.xml	21 Feb 2005 11:23:00 -0000
@@ -45,18 +45,25 @@
             this.dispatchEvent(event);
           }
           return aValue;
         ]]>
         </body>
       </method>
       
       <!-- public implementation -->
+      <property name="value"      onset="return this.checked = val;"
+                                  onget="return this.checked;"/>
       <property name="checked"    onset="return this.setChecked(val);"
                                   onget="return this.getAttribute('checked') == 'true';"/>
+
+      <constructor>
+        // Sync the checked value from the "value" attribute if necessary.
+        this.checked = this.value;
+      </constructor>
     </implementation>
     
     <handlers>
       <!-- While it would seem we could do this by handling oncommand, we need can't
            because any external oncommand handlers might get called before ours, and
            then they would see the incorrect value of checked. -->           
       <handler event="click" button="0" action="if (!this.disabled) this.checked = !this.checked;"/>
       <handler event="keypress" key=" ">
Index: toolkit/content/widgets/colorpicker.xml
===================================================================
RCS file: /cvsroot/mozilla/toolkit/content/widgets/colorpicker.xml,v
retrieving revision 1.7
diff -p -u -8 -r1.7 colorpicker.xml
--- toolkit/content/widgets/colorpicker.xml	5 Dec 2004 21:47:27 -0000	1.7
+++ toolkit/content/widgets/colorpicker.xml	21 Feb 2005 11:23:00 -0000
@@ -99,84 +99,83 @@
         </xul:hbox>
       </xul:vbox>
       <!-- Something to take tab focus
       <button style="border : 0px; width: 0px; height: 0px;"/>
       -->
     </content>
     
     <implementation>
-    
       <property name="color">
         <getter><![CDATA[
           return this.mSelectedCell ? this.mSelectedCell.getAttribute("color") : null;
         ]]></getter>
         <setter><![CDATA[
           if (!val)
-            return null;
-          val = val.toUpperCase();
+            return val;
+          uppercaseVal = val.toUpperCase();
           // Translate standard HTML color strings:
-          if (val[0] != "#") {
+          if (uppercaseVal[0] != "#") {
             switch (val) {
               case "GREEN":
-                val = "#008000";
+                uppercaseVal = "#008000";
                 break;
               case "LIME":
-                val = "#00FF00";
+                uppercaseVal = "#00FF00";
                 break;
               case "OLIVE":
-                val = "#808000";
+                uppercaseVal = "#808000";
                 break;
               case "TEAL":
-                val = "#008080";
+                uppercaseVal = "#008080";
                 break;
               case "YELLOW":
-                val = "#FFFF00";
+                uppercaseVal = "#FFFF00";
                 break;
               case "RED":
-                val = "#FF0000";
+                uppercaseVal = "#FF0000";
                 break;
               case "MAROON":
-                val = "#800000";
+                uppercaseVal = "#800000";
                 break;
               case "PURPLE":
-                val = "#800080";
+                uppercaseVal = "#800080";
                 break;
               case "FUCHSIA":
-                val = "#FF00FF";
+                uppercaseVal = "#FF00FF";
                 break;
               case "NAVY":
-                val = "#000080";
+                uppercaseVal = "#000080";
                 break;
               case "BLUE":
-                val = "#0000FF";
+                uppercaseVal = "#0000FF";
                 break;
               case "AQUA":
-                val = "#00FFFF";
+                uppercaseVal = "#00FFFF";
                 break;
               case "WHITE":
-                val = "#FFFFFF";
+                uppercaseVal = "#FFFFFF";
                 break;
               case "SILVER":
-                val = "#CC0C0C0";
+                uppercaseVal = "#CC0C0C0";
                 break;
               case "GRAY":
-                val = "#808080";
+                uppercaseVal = "#808080";
                 break;
               default: // BLACK
-                val = "#000000";
+                uppercaseVal = "#000000";
                 break;
             }
           }
-          var cells = this.mBox.getElementsByAttribute("color", val);
+          var cells = this.mBox.getElementsByAttribute("color", uppercaseVal);
           if (cells.item(0)) {
             this.selectCell(cells[0]);
             this.hoverCell(this.mSelectedCell);
           }
-	  return null;
+          return val;
         ]]></setter>
       </property>
 
       <method name="initColor">
         <parameter name="aColor"/>
         <body><![CDATA[
           // Use this to initialize color without
           //  triggering the "onselect" handler,
@@ -192,32 +191,48 @@
           this.mSelectedCell = null;
           this.mHoverCell = null;
           this.mBox = document.getAnonymousNodes(this)[0];
           this.mIsPopup = false;
           this.mDoOnSelect = true;
 
           this.hoverCell(this.mBox.childNodes[0].childNodes[0]);
           
-          var onselect = this.getAttribute("onselect");
-          if (onselect) {
-            try {
-              this.onselect = new Function(onselect);
-            } catch (ex) {
-              // watch out for syntax errors in the function code
-            }
-          }
           // used to capture keydown at the document level
           this.mPickerKeyDown = function(aEvent)
           {
             document._focusedPicker.pickerKeyDown(aEvent);
           }
 
         ]]></body>
       </method>
+      
+      <method name="_fireEvent">
+        <parameter name="aTarget"/>
+        <parameter name="aEventName"/>
+        <body>
+        <![CDATA[      
+          try {
+            var event = document.createEvent("Events");
+            event.initEvent(aEventName, false, true);
+            var cancel = !aTarget.dispatchEvent(event);
+            if (aTarget.hasAttribute("on" + aEventName)) {
+              var rv = (new Function ("event", aTarget.getAttribute("on" + aEventName)))(event);
+              if (rv == false)
+                cancel = true;
+            }
+            return !cancel;  
+          }
+          catch (e) { 
+            dump(e);
+          }
+          return false;
+        ]]>
+        </body>
+      </method>
 
       <method name="resetHover">
         <body><![CDATA[
           if (this.mHoverCell)
             this.mHoverCell.removeAttribute("hover");
         ]]></body>
       </method>
 
@@ -316,18 +331,18 @@
         <body><![CDATA[
           if (this.isColorCell(aCell)) {
             if (this.mSelectedCell)
               this.mSelectedCell.removeAttribute("selected");
 
             this.mSelectedCell = aCell;
             aCell.setAttribute("selected", "true");
 
-            if (this.mDoOnSelect && this.onselect)
-              this.onselect();
+            if (this.mDoOnSelect)
+              this._fireEvent(this, "select");
           }
         ]]></body>
       </method>
       
       <method name="addKeyListener">
         <body><![CDATA[
           document._focusedPicker = this;
           document.addEventListener("keydown", this.mPickerKeyDown, true);
@@ -411,23 +426,20 @@
       <stylesheet src="chrome://global/skin/colorpicker.css"/>
     </resources>
     
     <content>
       <xul:hbox class="colorpicker-button-colorbox" anonid="colorbox" flex="1" xbl:inherits="disabled"/>
 
       <xul:popupset>
         <xul:popup class="colorpicker-button-menupopup" anonid="colorpopup"
-          onmousedown="event.stopPropagation()"
-          onpopupshowing="this._colorPicker.onPopupShowing()"
-          onpopuphiding="this._colorPicker.onPopupHiding()">
-
-          <xul:colorpicker xbl:inherits="palettename,disabled" allowevents="true" anonid="colorpicker"
-           onselect="this.parentNode.parentNode.parentNode.pickerChange()"/>
-
+                   onmousedown="event.stopPropagation()"
+                   onpopupshowing="this._colorPicker.onPopupShowing()"
+                   onpopuphiding="this._colorPicker.onPopupHiding()">
+           <xul:colorpicker xbl:inherits="palettename,disabled" allowevents="true" anonid="colorpicker"/>
          </xul:popup>
        </xul:popupset>
     </content>
     
     <implementation implements="nsIAccessibleProvider, nsIDOMXULControlElement">
       <property name="accessible">
         <getter>
           <![CDATA[
@@ -439,49 +451,65 @@
     
       <property name="open" onget="return this.mOpen"/>
 
       <property name="disabled" onset="if (val) this.setAttribute('disabled',true);
                                          else this.removeAttribute('disabled');
                                          return val;"
                                   onget="return this.hasAttribute('disabled');"/>
 
+      <property name="value" onget="return this.color;" onset="return (this.color = val);"/>
       <property name="color">
         <getter><![CDATA[
           return this.getAttribute("color");
         ]]></getter>
         <setter><![CDATA[
           this.mColorBox.setAttribute("style", "background-color: " + val);
-          return this.setAttribute("color", val);
+          this.setAttribute("color", val);
+          return val;
         ]]></setter>
       </property>
       
       <method name="initialize">
         <body><![CDATA[
           this.mOpen = false;
-          this.onchange = null;
                     
           this.mColorBox = document.getAnonymousElementByAttribute(this, "anonid", "colorbox");
         
           var popup = document.getAnonymousElementByAttribute(this, "anonid", "colorpopup")
           popup._colorPicker = this;
           
           this.mPicker = document.getAnonymousElementByAttribute(this, "anonid", "colorpicker")
-
-          var change = this.getAttribute("onchange");
-          if (change) {
-            try {
-              this.onchange = new Function("event", change);
-            } catch (ex) {
-              // watch out for syntax errors in the function code
-            }
-          }
         ]]></body>
       </method>
       
+      <method name="_fireEvent">
+        <parameter name="aTarget"/>
+        <parameter name="aEventName"/>
+        <body>
+        <![CDATA[      
+          try {
+            var event = document.createEvent("Events");
+            event.initEvent(aEventName, false, true);
+            var cancel = !aTarget.dispatchEvent(event);
+            if (aTarget.hasAttribute("on" + aEventName)) {
+              var rv = (new Function ("event", aTarget.getAttribute("on" + aEventName)))(event);
+              if (rv == false)
+                cancel = true;
+            }
+            return !cancel;  
+          }
+          catch (e) { 
+            dump(e);
+          }
+          return false;
+        ]]>
+        </body>
+      </method>
+
       <method name="showPopup">
         <body><![CDATA[
           this.mPicker.parentNode.showPopup(this, -1, -1, "popup", "bottomleft", "topleft");
         ]]></body>
       </method>
       
       <method name="hidePopup">
         <body><![CDATA[
@@ -513,18 +541,17 @@
         ]]></body>
       </method>
 
       <method name="pickerChange">
         <body><![CDATA[
           this.color = this.mPicker.color;
           setTimeout(function(aPopup) { aPopup.hidePopup() }, 1, this.mPicker.parentNode);
           
-          if (this.onchange) 
-            this.onchange();
+          this._fireEvent(this, "change");
         ]]></body>
       </method>
 
       <constructor><![CDATA[
         this.initialize();
       ]]></constructor>
       
     </implementation>
@@ -543,16 +570,20 @@
 
         // Though I would prefer the open the popup using the built-in
         // popup="_child" mechanism, I can't use that because I can't seem to
         // get it to recognize the popupalign and popupanchor attributes that way
         // So, I have to do it manually...
         this.focus();
         this.showPopup();
       ]]></handler>
+      
+      <handler event="select">
+        this.pickerChange();
+      </handler>
     </handlers>
   </binding>
 
   <binding id="colorpickertile">
     <implementation implements="nsIAccessibleProvider" >
       <property name="accessible">
         <getter>
           <![CDATA[
Index: toolkit/content/widgets/listbox.xml
===================================================================
RCS file: /cvsroot/mozilla/toolkit/content/widgets/listbox.xml,v
retrieving revision 1.10
diff -p -u -8 -r1.10 listbox.xml
--- toolkit/content/widgets/listbox.xml	8 Feb 2005 14:32:09 -0000	1.10
+++ toolkit/content/widgets/listbox.xml	21 Feb 2005 11:23:01 -0000
@@ -35,17 +35,16 @@
       <field name="_currentItem">null</field>
       <field name="_selectTimeout">null</field>
       <field name="_lastKeyTime">0</field>
       <field name="_incrementalString">""</field>
 
       <constructor>
       <![CDATA[
         var els = this.getElementsByAttribute("selected", "true");
-        this.selectedItems = [];
         for (var i = 0; i < els.length; ++i)
           this.selectedItems.push(els[i]);
       ]]>
       </constructor>
 
       <!-- ///////////////// nsIAccessibleProvider ///////////////// -->
 
       <property name="accessible">
@@ -137,16 +136,17 @@
         <setter><![CDATA[
           if (val >= 0)
             this.selectItem(this.getItemAtIndex(val));
           else
             this.clearSelection();
         ]]></setter>
       </property>
 
+      <field name="selectedItems">[]</field>
       <property name="selectedItem">
         <getter><![CDATA[
           return this.selectedItems.length > 0 ? this.selectedItems[0] : null;
         ]]></getter>
         <setter><![CDATA[
           this.selectItem(val);
         ]]></setter>
       </property>
Index: toolkit/content/widgets/menulist.xml
===================================================================
RCS file: /cvsroot/mozilla/toolkit/content/widgets/menulist.xml,v
retrieving revision 1.17
diff -p -u -8 -r1.17 menulist.xml
--- toolkit/content/widgets/menulist.xml	7 Feb 2005 23:11:22 -0000	1.17
+++ toolkit/content/widgets/menulist.xml	21 Feb 2005 11:23:01 -0000
@@ -273,17 +273,17 @@
       </property>
     </implementation>  
   </binding>
 
   <binding id="menulist-editable" extends="chrome://global/content/bindings/menulist.xml#menulist">
     <content sizetopopup="pref">
       <xul:hbox class="menulist-editable-box textbox-input-box" xbl:inherits="context" flex="1">
         <html:input class="menulist-editable-input" flex="1" anonid="input" allowevents="true"
-                    xbl:inherits="value=label,disabled"/>
+                    xbl:inherits="value=label,disabled,readonly"/>
       </xul:hbox>
       <xul:dropmarker class="menulist-dropmarker" type="menu"/>
       <children includes="menupopup"/>
     </content>
     
     <implementation>
       <constructor><![CDATA[
         this.setInitialSelection();
Index: toolkit/content/widgets/preferences.xml
===================================================================
RCS file: toolkit/content/widgets/preferences.xml
diff -N toolkit/content/widgets/preferences.xml
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ toolkit/content/widgets/preferences.xml	21 Feb 2005 11:23:02 -0000
@@ -0,0 +1,1014 @@
+<?xml version="1.0"?>
+
+<!DOCTYPE bindings SYSTEM "chrome://global/locale/preferences.dtd">
+
+<bindings id="preferencesBindings"
+          xmlns="http://www.mozilla.org/xbl"
+          xmlns:xbl="http://www.mozilla.org/xbl"
+          xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+
+#
+# = Preferences Window Framework
+#
+#   The syntax for use looks something like:
+#
+#   <prefwindow>
+#     <prefpane id="prefPaneA">
+#       <preferences>
+#         <preference id="preference1" name="app.preference1" type="bool" onchange="foo();"/>
+#         <preference id="preference2" name="app.preference2" type="bool" useDefault="true"/>
+#       </preferences>
+#       <checkbox label="Preference" preference="preference1"/>
+#     </prefpane>
+#   </prefwindow>
+#
+
+  <binding id="preferences">
+    <implementation implements="nsIObserver">
+      <method name="observe">
+        <parameter name="aSubject"/>
+        <parameter name="aTopic"/>
+        <parameter name="aData"/>
+        <body>
+        <![CDATA[
+          for (var i = 0; i < this.childNodes.length; ++i) {
+            var preference = this.childNodes[i];
+            if (preference.name == aData) {
+              preference.value = preference.valueFromPreferences;
+              this.fireChangedEvent(preference);
+            }
+          }
+        ]]>
+        </body>
+      </method>
+      
+      <method name="fireChangedEvent">
+        <parameter name="aPreference"/>
+        <body>
+        <![CDATA[
+          // Value changed, synthesize an event
+          try {
+            var event = document.createEvent("Events");
+            event.initEvent("change", false, true);
+            aPreference.dispatchEvent(event);
+            if (aPreference.hasAttribute("onchange"))
+              (new Function ("event", aPreference.getAttribute("onchange")))(event);
+          }
+          catch (e) {
+            dump(e);
+          }
+        ]]>
+        </body>
+      </method>
+      
+      <field name="service">
+        Components.classes["@mozilla.org/preferences-service;1"]
+                  .getService(Components.interfaces.nsIPrefService);
+      </field>
+      <field name="rootBranch">
+        Components.classes["@mozilla.org/preferences-service;1"]
+                  .getService(Components.interfaces.nsIPrefBranch);
+      </field>
+      <field name="defaultBranch">
+        this.service.getDefaultBranch("");
+      </field>
+      <field name="rootBranchInternal">
+        Components.classes["@mozilla.org/preferences-service;1"]
+                  .getService(Components.interfaces.nsIPrefBranchInternal);
+      </field>
+    </implementation>
+  </binding>
+
+  <binding id="preference">
+    <implementation>
+      <constructor>
+      <![CDATA[
+        this.preferences.rootBranchInternal
+            .addObserver(this.name, this.preferences, false);
+        // In non-instant apply mode, we must try and use the last saved state
+        // from any previous opens of a child dialog instead of the value from
+        // preferences, to pick up any edits a user may have made. 
+        if (document.documentElement.type == "child" && !this.instantApply) {
+          var pdoc = window.opener.document;
+          var lastStatePref = pdoc.getElementById(window.location.href + "#" + this.id);
+          this._setValue(lastStatePref ? lastStatePref.value 
+                                       : this.valueFromPreferences, false);
+        }
+        else
+          this._setValue(this.valueFromPreferences, false);
+      ]]>
+      </constructor>
+      <destructor>
+        this.preferences.rootBranchInternal
+            .removeObserver(this.name, this.preferences);
+      </destructor>
+      
+      <property name="instantApply">
+        <getter>
+          return this.getAttribute("instantApply") == "true" || document.documentElement.instantApply;
+        </getter>
+      </property>
+
+      <property name="preferences" onget="return this.parentNode"/>
+      <property name="name" onget="return this.getAttribute('name');"
+                            onset="this.setAttribute('name', val); return val;"/>
+      <property name="type" onget="return this.getAttribute('type');"
+                            onset="this.setAttribute('type', val); return val;"/>
+      <property name="inverted" onget="return this.getAttribute('inverted') == 'true';"
+                                onset="this.setAttribute('inverted', val); return val;"/>
+      <property name="readonly" onget="return this.getAttribute('readonly') == 'true';"
+                                onset="this.setAttribute('readonly', val); return val;"/>
+
+      <field name="_value">null</field>
+      <method name="_setValue">
+        <parameter name="aValue"/>
+        <parameter name="aUpdate"/>
+        <body>
+        <![CDATA[
+          this._value = aValue;
+          if (this.instantApply && aUpdate)
+            this.valueFromPreferences = aValue;
+          else {
+            // I wonder if we should synthesize a change event handler here. 
+            // As it stands we only fire onpreferenceread when UE calls 
+            // setElementValue. That's enough to reinit the UI element but
+            // may be counter intuitive.
+            this.updateElements();
+          }
+          return aValue;
+        ]]>
+        </body>
+      </method>
+      <property name="value" onget="return this._value" onset="return this._setValue(val, true);"/>
+      
+      <property name="locked">
+        <getter>
+          return this.preferences.rootBranch.prefIsLocked(this.name);
+        </getter>
+      </property>
+      
+      <property name="disabled">
+        <getter>
+          return this.getAttribute("disabled") == "true";
+        </getter>
+        <setter>
+        <![CDATA[
+          if (val) 
+            this.setAttribute("disabled", "true");
+          else
+            this.removeAttribute("disabled");
+
+          var elements = document.getElementsByAttribute("preference", this.id);
+          for (var i = 0; i < elements.length; ++i) {
+            elements[i].disabled = val;
+            
+            var labels = document.getElementsByAttribute("control", elements[i].id);
+            for (var j = 0; j < labels.length; ++j)
+              labels[j].disabled = val;
+          }
+            
+          return val;
+        ]]>
+        </setter>
+      </property>
+      
+      <property name="hasUserValue">
+        <getter>
+          return this.preferences.rootBranch.prefHasUserValue(this.name);
+        </getter>
+      </property>
+      
+      <method name="reset">
+        <body>
+          this.preferences.rootBranch.clearUserPref(this.name);
+        </body>
+      </method>
+
+      <field name="_useDefault">false</field>      
+      <property name="defaultValue">
+        <getter>
+        <![CDATA[
+          this._useDefault = true;
+          var val = this.valueFromPreferences;
+          this._useDefault = false;
+          return val;
+        ]]>
+        </getter>
+      </property>
+      
+      <property name="_branch">
+        <getter>
+          return this._useDefault ? this.preferences.defaultBranch : this.preferences.rootBranch;
+        </getter>
+      </property>
+      
+      <field name="batching">false</field>
+      
+      <property name="valueFromPreferences">
+        <getter>
+        <![CDATA[
+          try {
+            // Force a resync of value with preferences.
+            switch (this.type) {
+            case "int":
+              return this._branch.getIntPref(this.name);
+            case "bool":
+              return this._branch.getBoolPref(this.name);
+            case "string":
+              return this._branch.getCharPref(this.name);
+            case "wstring":
+              return this._branch
+                         .getComplexValue(this.name, Components.interfaces.nsIPrefLocalizedString)
+                         .data;
+            case "unichar":
+              var pref = Components.classes["@mozilla.org/preferences;1"] 
+                                   .getService(Components.interfaces.nsIPref);
+              return pref.CopyUnicharPref(this.name);
+            case "file":
+              var f = this._branch
+                          .getComplexValue(this.name, Components.interfaces.nsILocalFile);
+              return f;
+            }
+          }
+          catch (e) { }
+          return null;
+        ]]>
+        </getter>
+        <setter>
+        <![CDATA[
+          if (this.readonly || this.valueFromPreferences == val)
+            return val;
+            
+          // Force a resync of preferences with value.
+          switch (this.type) {
+          case "int":
+            this.preferences.rootBranch.setIntPref(this.name, val);
+            break;
+          case "bool":
+            this.preferences.rootBranch.setBoolPref(this.name, val);
+            break;
+          case "string":
+            this.preferences.rootBranch.setCharPref(this.name, val);
+            break;
+          case "wstring":
+            var pls = Components.classes["@mozilla.org/pref-localizedstring;1"]
+                                .createInstance(Components.interfaces.nsIPrefLocalizedString);
+            pls.data = val;
+            this.preferences.rootBranch
+                .setComplexValue(this.name, Components.interfaces.nsIPrefLocalizedString, pls);
+            break;
+          case "unichar":
+            var pref = Components.classes["@mozilla.org/preferences;1"] 
+                                 .getService(Components.interfaces.nsIPref);
+            pref.SetUnicharPref(this.name, val);
+            break;
+          case "file":
+            var lf;
+            if (typeof(val) == "string") {
+              lf = Components.classes["@mozilla.org/file/local;1"]
+                             .createInstance(Components.interfaces.nsILocalFile);
+              lf.persistentDescriptor = val;
+              if (!lf.exists())
+                lf.initWithPath(val);
+            }
+            else 
+              lf = val.QueryInterface(Components.interfaces.nsILocalFile);
+            this.preferences.rootBranch
+                .setComplexValue(this.name, Components.interfaces.nsILocalFile, lf);
+            break;
+          }
+          if (!this.batching)
+            this.preferences.service.savePrefFile(null);
+          return val;
+        ]]>
+        </setter>
+      </property>
+      
+      <method name="setElementValue">
+        <parameter name="aElement"/>
+        <body>
+        <![CDATA[
+          if (this.locked)
+            aElement.disabled = true;
+
+          if (!this.isElementEditable(aElement))
+            return;
+          
+          var rv = undefined;
+          if (aElement.hasAttribute("onpreferenceread")) {
+            // Value changed, synthesize an event
+            try {
+              var event = document.createEvent("Events");
+              event.initEvent("preferenceread", false, true);
+              var f = new Function ("event", 
+                                    aElement.getAttribute("onpreferenceread"));
+              rv = f(event);
+            }
+            catch (e) {
+              dump(e);
+            }
+          }
+          var val = rv !== undefined ? rv : (this.instantApply ? this.valueFromPreferences : this.value);
+          if ("value" in aElement) 
+            aElement.value = val;
+          else
+            aElement.setAttribute("value", val);
+        ]]>
+        </body>
+      </method>
+
+      <method name="getElementValue">
+        <parameter name="aElement"/>
+        <body>
+        <![CDATA[
+          if (aElement.hasAttribute("onpreferencewrite")) {
+            // Value changed, synthesize an event
+            try {
+              var event = document.createEvent("Events");
+              event.initEvent("preferencewrite", false, true);
+              var f = new Function ("event", 
+                                    aElement.getAttribute("onpreferencewrite"));
+              var rv = f(event);
+              if (rv !== undefined) 
+                return rv;
+            }
+            catch (e) {
+              dump(e);
+            }
+          }
+          switch (this.type) {
+          case "int":
+            return aElement.value != "" ? parseInt(aElement.value) : 0;
+          case "bool":
+            return typeof(aElement.value) == "boolean" ? aElement.value : aElement.value == "true";
+          }
+          return aElement.value;
+        ]]>
+        </body>
+      </method>
+      
+      <method name="isElementEditable">
+        <parameter name="aElement"/>
+        <body>
+        <![CDATA[
+          switch (aElement.localName) {
+          case "checkbox":
+          case "colorpicker":
+          case "radiogroup":
+          case "textbox":
+          case "listitem":
+          case "listbox":
+          case "menulist":
+            return true;
+          }
+          return aElement.getAttribute("preference-editable") == "true";
+        ]]> 
+        </body>
+      </method>
+      
+      <method name="updateElements">
+        <body>
+        <![CDATA[
+          // This "change" event handler tracks changes made to preferences by 
+          // sources other than the user in this window. 
+          var elements = document.getElementsByAttribute("preference", this.id);
+          for (var i = 0; i < elements.length; ++i) 
+            this.setElementValue(elements[i]);
+        ]]>
+        </body>
+      </method>
+    </implementation>
+    
+    <handlers>
+      <handler event="change">
+        this.updateElements();
+      </handler>
+    </handlers>
+  </binding>
+
+  <binding id="prefwindow"
+           extends="chrome://global/content/bindings/dialog.xml#dialog">
+    <resources>
+      <stylesheet src="chrome://global/skin/preferences.css"/>
+    </resources>
+    <content xul:dlgbuttons="accept,cancel" xul:persist="lastSelected screenX screenY"
+             xul:closebuttonlabel="&preferencesCloseButton.label;"
+             xul:closebuttonaccesskey="&preferencesCloseButton.accesskey;"
+#ifdef XP_WIN
+             xul:title="&preferencesDefaultTitleWin.title;">
+#else
+             xul:title="&preferencesDefaultTitleMac.title;">
+#endif
+      <xul:radiogroup anonid="selector" orient="horizontal" class="paneSelector"/>
+      <xul:hbox flex="1" class="paneDeckContainer">
+        <xul:deck anonid="paneDeck" flex="1">
+          <children includes="prefpane"/>
+        </xul:deck>
+      </xul:hbox>
+      <xul:hbox pack="end" anonid="dlg-buttons" class="prefWindow-dlgbuttons">
+        <xul:button dlgtype="extra2" class="dialog-button" hidden="true"/>
+        <xul:spacer anonid="spacer" flex="1" hidden="true"/>
+        <xul:button dlgtype="accept" class="dialog-button"/>
+        <xul:button dlgtype="extra1" class="dialog-button" hidden="true"/>
+        <xul:button dlgtype="cancel" class="dialog-button"/>
+        <xul:button dlgtype="help" class="dialog-button" hidden="true"/>
+        <xul:button dlgtype="disclosure" class="dialog-button" hidden="true"/>
+      </xul:hbox>
+      <xul:hbox>
+        <children/>
+      </xul:hbox>
+      <xul:keyset>
+        <xul:key anonid="keyClose" key="&windowClose.key;" modifiers="accel" oncommand="window.close();"/>
+      </xul:keyset>
+    </content>
+    <implementation implements="nsITimerCallback">
+      <constructor>
+      <![CDATA[
+        this.setAttribute("animate", !this._shouldAnimate ? "off" : "on");
+        if (this.type != "child") {
+          var psvc = Components.classes["@mozilla.org/preferences-service;1"]
+                               .getService(Components.interfaces.nsIPrefBranch);
+          this.instantApply = psvc.getBoolPref("browser.preferences.instantApply");
+          if (this.instantApply) {
+#ifdef XP_MACOSX
+            var dlgButtons = document.getAnonymousElementByAttribute(this, "anonid", "dlg-buttons");
+            dlgButtons.hidden = true;
+#else
+            var docElt = document.documentElement;
+            var acceptButton = docElt.getButton("accept");
+            acceptButton.hidden = true;
+            var cancelButton  = docElt.getButton("cancel");
+            cancelButton.label = docElt.getAttribute("closebuttonlabel");
+            cancelButton.accesskey = docElt.getAttribute("closebuttonaccesskey");
+#endif
+          }
+          else {
+            // No Cmd+W in non-instant-apply preferences windows
+            var keyClose = document.getAnonymousElementByAttribute(this, "anonid", "keyClose");
+            keyClose.parentNode.removeChild(keyClose);
+          }
+        }
+        else {
+          // No Cmd+W in child dialogs
+          var keyClose = document.getAnonymousElementByAttribute(this, "anonid", "keyClose");
+          keyClose.parentNode.removeChild(keyClose);          
+        }
+        var panes = this.preferencePanes;
+        var lastPane = this.lastSelected ? document.getElementById(this.lastSelected) : panes[0];
+        for (var i = 0; i < panes.length; ++i) {
+          var button = this._makePaneButton(panes[i]);
+          if (lastPane == panes[i])
+            this._selector.selectedItem = button;
+          if (panes[i].loaded) {
+            // Inline pane content, fire load event to force initialization.
+            this._fireEvent("paneload", panes[i]);
+          }
+        }
+        this.showPane(lastPane);
+        
+        if (panes.length == 1)
+          this._selector.setAttribute("collapsed", "true");
+      ]]>
+      </constructor>
+
+      <field name="instantApply">false</field>
+      
+      <property name="preferencePanes"
+                onget="return this.getElementsByTagName('prefpane');"/>
+
+      <property name="type" onget="return this.getAttribute('type');"/>
+      <property name="_paneDeck"
+                onget="return document.getAnonymousElementByAttribute(this, 'anonid', 'paneDeck');"/>
+      <property name="_selector"
+                onget="return document.getAnonymousElementByAttribute(this, 'anonid', 'selector');"/>
+      <property name="lastSelected" 
+                onget="return this.getAttribute('lastSelected');">
+        <setter>
+          this.setAttribute("lastSelected", val); 
+          document.persist(this.id, "lastSelected");
+          return val;
+        </setter>          
+      </property>
+      <field name="currentPane">null</field>
+      
+      <method name="_makePaneButton">
+        <parameter name="aPaneElement"/>
+        <body>
+        <![CDATA[
+          var radio = document.createElement("radio");
+          radio.setAttribute("pane", aPaneElement.id);
+          radio.setAttribute("label", aPaneElement.label);
+          if (aPaneElement.image)
+            radio.setAttribute("src", aPaneElement.image);
+          radio.style.listStyleImage = aPaneElement.style.listStyleImage;
+          this._selector.appendChild(radio);
+          return radio;
+        ]]>
+        </body>
+      </method>
+
+      <method name="showPane">
+        <parameter name="aPaneElement"/>
+        <body>
+        <![CDATA[
+          if (!aPaneElement.loaded) {
+            function OverlayLoadObserver(aPane)
+            {
+              this._pane = aPane;
+            }
+            OverlayLoadObserver.prototype = { 
+              _outer: this,
+              observe: function (aSubject, aTopic, aData) 
+              {
+                this._pane.loaded = true;
+                this._outer._fireEvent("paneload", this._pane);
+                this._outer._selectPane(this._pane);
+              }
+            };
+            
+            var obs = new OverlayLoadObserver(aPaneElement);
+            document.loadOverlay(aPaneElement.src, obs);
+          }
+          else
+            this._selectPane(aPaneElement);
+        ]]>
+        </body>
+      </method>
+      
+      <method name="_fireEvent">
+        <parameter name="aEventName"/>
+        <parameter name="aTarget"/>
+        <body>
+        <![CDATA[
+          // Panel loaded, synthesize a load event. 
+          try {
+            var event = document.createEvent("Events");
+            event.initEvent(aEventName, false, true);
+            var cancel = !aTarget.dispatchEvent(event);
+            if (aTarget.hasAttribute("on" + aEventName)) {
+              var rv = (new Function ("event", aTarget.getAttribute("on" + aEventName)))(event);
+              if (rv == false)
+                cancel = true;
+            }
+            return !cancel;  
+          }
+          catch (e) { 
+            dump(e);
+          }
+          return false;
+        ]]>
+        </body>
+      </method>
+      
+      <field name="_initialized">false</field>
+      <method name="_selectPane">
+        <parameter name="aPaneElement"/>
+        <body>
+        <![CDATA[
+#ifdef XP_MACOSX
+          document.title = aPaneElement.label;
+#endif
+
+          // Find this pane's index in the deck and set the deck's 
+          // selectedIndex to that value to switch to it.
+          var prefpanes = this.preferencePanes;
+          for (var i = 0; i < prefpanes.length; ++i) {
+            if (prefpanes[i] == aPaneElement) {
+              this._paneDeck.setAttribute("selectedIndex", i);
+              
+              if (this.type != "child") {
+                var oldPane = this.lastSelected ? document.getElementById(this.lastSelected) : this.preferencePanes[0];
+                oldPane.selected = !(aPaneElement.selected = true);
+                if (!this._initialized || oldPane.id != aPaneElement.id) {
+                  this.lastSelected = aPaneElement.id;
+                  this.currentPane = aPaneElement;
+                  if (this._shouldAnimate) {
+                    aPaneElement.style.opacity = 0.0;
+                    this.animate(oldPane, aPaneElement);
+                  }
+                  this._initialized = true;
+                }
+              }
+              break;
+            }
+          }
+        ]]>
+        </body>
+      </method>
+      
+      <property name="_shouldAnimate">
+        <getter>
+        <![CDATA[
+          var psvc = Components.classes["@mozilla.org/preferences-service;1"]
+                               .getService(Components.interfaces.nsIPrefBranch);
+          return psvc.getBoolPref("browser.preferences.animateFadeIn");
+        ]]>
+        </getter>
+      </property>
+      
+      <method name="animate">
+        <parameter name="aOldPane"/>
+        <parameter name="aNewPane"/>
+        <body>
+        <![CDATA[
+          this._multiplier = aNewPane.contentHeight > aOldPane.contentHeight ? 1 : -1;
+          var sizeDelta = Math.abs(aOldPane.contentHeight - aNewPane.contentHeight);
+          this._needsSizing = sizeDelta > this._animateIncrement;
+          
+          this._animateRemainder = sizeDelta % this._animateIncrement;
+
+          // Compute the opacity step, using 0.2 as a maximum step size. 
+          this._opacityStepSize = sizeDelta != 0 ? this._animateIncrement / sizeDelta : 1.0;
+          if (this._opacityStepSize > 0.2)
+            this._opacityStepSize = 0.2;
+
+          this._setUpTimer(aOldPane.contentHeight);
+        ]]>
+        </body>
+      </method>
+      
+      <property name="_sizeIncrement">
+        <getter>
+        <![CDATA[
+          var lastSelectedPane = document.getElementById(this.lastSelected);
+          var increment = this._animateIncrement * this._multiplier;
+          var newHeight = this._currentHeight + increment;
+          if ((this._multiplier > 0 && this._currentHeight >= lastSelectedPane.contentHeight) ||
+              (this._multiplier < 0 && this._currentHeight <= lastSelectedPane.contentHeight))
+            return 0;
+          
+          if ((this._multiplier > 0 && newHeight > lastSelectedPane.contentHeight) ||
+              (this._multiplier < 0 && newHeight < lastSelectedPane.contentHeight))
+            increment = this._animateRemainder * this._multiplier;
+          return increment;
+        ]]>
+        </getter>
+      </property>
+      
+      <field name="_animateState">0</field>
+      <method name="notify">
+        <parameter name="aTimer"/>
+        <body>
+        <![CDATA[
+          if (!document)
+            this._timer.cancel();
+            
+          const STATE_START    = 0;
+          const STATE_SIZE     = 1;
+          const STATE_OPACITY  = 2;
+          const STATE_DONE     = STATE_SIZE | STATE_OPACITY;
+          
+          var increment = this._sizeIncrement;
+          if (increment != 0) {
+            window.innerHeight += increment;
+            this._currentHeight += increment;
+          }
+          else 
+            this._animateState |= STATE_SIZE;
+          
+          var lastSelectedPane = document.getElementById(this.lastSelected);
+          if (parseFloat(window.getComputedStyle(lastSelectedPane, "").opacity) < 1.0) {
+            var elt = document.getElementById(this.lastSelected);
+            elt.style.opacity = parseFloat(window.getComputedStyle(elt, "").opacity) + this._opacityStepSize;
+          }
+          else
+            this._animateState |= STATE_OPACITY;
+          
+          if (this._animateState == STATE_DONE)
+            this._timer.cancel();
+        ]]>
+        </body>
+      </method>
+      
+      <method name="_setUpTimer">
+        <parameter name="aStartHeight"/>
+        <body>
+        <![CDATA[
+          if (!this._timer) 
+            this._timer = Components.classes["@mozilla.org/timer;1"]
+                                    .createInstance(Components.interfaces.nsITimer);
+          else
+            this._timer.cancel();
+          this._currentHeight = aStartHeight;
+          this._animateState = 0;
+          
+          this._timer.initWithCallback(this, this._animateDelay, 
+                                       Components.interfaces.nsITimer.TYPE_REPEATING_SLACK);
+        ]]>
+        </body>
+      </method>
+      
+      <field name="_timer">null</field>
+      <field name="_animateDelay">50</field>
+      <field name="_animateIncrement">10</field>
+      <field name="_animateRemainder">0</field>
+      <field name="_currentHeight">0</field>
+      <field name="_multiplier">0</field>
+      <field name="_opacityStepSize">0</field>
+      <field name="_needsSizing">0</field>
+
+      <method name="addPane">
+        <parameter name="aPaneElement"/>
+        <body>
+        <![CDATA[
+          this.appendChild(aPaneElement);
+          
+          // Set up pane button
+          this._makePaneButton(aPaneElement);
+        ]]>
+        </body>
+      </method>
+      
+      <method name="openSubDialog">
+        <parameter name="aURL"/>
+        <parameter name="aFeatures"/>
+        <parameter name="aParams"/>
+        <body>
+          return openDialog(aURL, "", "modal,centerscreen" + (aFeatures != "" ? ("," + aFeatures) : ""), aParams);
+        </body>
+      </method>
+      
+      <method name="openWindow">
+        <parameter name="aWindowType"/>
+        <parameter name="aURL"/>
+        <parameter name="aFeatures"/>
+        <parameter name="aParams"/>
+        <body>
+          var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"]
+                             .getService(Components.interfaces.nsIWindowMediator);
+          var win = aWindowType ? wm.getMostRecentWindow(aWindowType) : null;
+          if (win) {
+            if ("initWithParams" in win)
+              win.initWithParams(aParams);
+            win.focus();
+          }
+          else {
+            var features = "resizable,dialog=no,centerscreen" + (aFeatures != "" ? ("," + aFeatures) : "");
+            var parentWindow = this.instantApply ? window : window.opener;
+            win = parentWindow.openDialog(aURL, "_blank", features, aParams);
+          }
+          return win;
+        </body>
+      </method>
+    </implementation>
+    <handlers>
+      <handler event="dialogaccept">
+      <![CDATA[
+        if (!this._fireEvent("beforeaccept", this)) 
+          return;
+        
+        if (this.type == "child") {
+          var psvc = Components.classes["@mozilla.org/preferences-service;1"]
+                               .getService(Components.interfaces.nsIPrefBranch);
+          var instantApply = psvc.getBoolPref("browser.preferences.instantApply");
+          if (instantApply) {
+            var panes = this.preferencePanes;
+            for (var i = 0; i < panes.length; ++i)
+              panes[i].writePreferences(true);
+          }
+          else {
+            // Clone all the preferences elements from the child document and
+            // insert them into the pane collection of the parent. 
+            var pdoc = window.opener.document;
+            var currentPane = pdoc.documentElement.currentPane;
+            var id = window.location.href + "#childprefs";
+            var childPrefs = pdoc.getElementById(id);
+            if (!childPrefs) {
+              var childPrefs = pdoc.createElement("preferences");
+              currentPane.appendChild(childPrefs);
+              childPrefs.id = id;
+            }
+            var panes = this.preferencePanes;
+            for (var i = 0; i < panes.length; ++i) {
+              var preferences = panes[i].preferences;
+              for (var j = 0; j < preferences.length; ++j) {
+                var prefID = window.location.href + "#" + preferences[j].id;
+                var preference = pdoc.getElementById(prefID);
+                if (!preference) {
+                  var preference = pdoc.createElement("preference");
+                  childPrefs.appendChild(preference);
+                  preference.id       = prefID;
+                  preference.name     = preferences[j].name;
+                  preference.type     = preferences[j].type;
+                  preference.inverted = preferences[j].inverted;
+                  preference.readonly = preferences[j].readonly;
+                  preference.disabled = preferences[j].disabled;
+                }
+                preference.value    = preferences[j].value;
+              }
+            }
+          }
+        }
+        else {
+          var panes = this.preferencePanes;
+          for (var i = 0; i < panes.length; ++i)
+            panes[i].writePreferences(false);
+
+          var psvc = Components.classes["@mozilla.org/preferences-service;1"]
+                               .getService(Components.interfaces.nsIPrefService);
+          psvc.savePrefFile(null);
+        }
+      ]]>
+      </handler>
+      <handler event="command">
+        if (event.originalTarget.hasAttribute("pane")) {
+          var pane = document.getElementById(event.originalTarget.getAttribute("pane"));
+          event.originalTarget.parentNode.parentNode.showPane(pane);
+        }
+      </handler>
+    </handlers>
+  </binding>
+  
+  <binding id="prefpane">
+    <resources>
+      <stylesheet src="chrome://global/skin/preferences.css"/>
+    </resources>
+    <content>
+      <xul:vbox class="content-box" xbl:inherits="flex">
+        <children/>
+      </xul:vbox>
+    </content>
+    <implementation>
+      <method name="writePreferences">
+        <parameter name="aFlushToDisk"/>
+        <body>
+        <![CDATA[
+          // Write all values to preferences.
+          var preferences = this.preferences;
+          for (var i = 0; i < preferences.length; ++i) {
+            var preference = preferences[i];
+            preference.batching = true;
+            preference.valueFromPreferences = preference.value;
+            preference.batching = false;
+          }
+          if (aFlushToDisk) {
+            var psvc = Components.classes["@mozilla.org/preferences-service;1"]
+                                 .getService(Components.interfaces.nsIPrefService);
+            psvc.savePrefFile(null);
+          }
+        ]]>
+        </body>
+      </method>
+      
+      <property name="src" 
+                onget="return this.getAttribute('src');"
+                onset="this.setAttribute('src', val); return val;"/>
+      <property name="selected" 
+                onget="return this.getAttribute('selected') == 'true';"
+                onset="this.setAttribute('selected', val); return val;"/>
+      <property name="image" 
+                onget="return this.getAttribute('image');"
+                onset="this.setAttribute('image', val); return val;"/>
+      <property name="label" 
+                onget="return this.getAttribute('label');"
+                onset="this.setAttribute('label', val); return val;"/>
+      
+      <property name="preferenceElements"
+                onget="return this.getElementsByAttribute('preference', '*');"/>
+      <property name="preferences"
+                onget="return this.getElementsByTagName('preference');"/>
+
+      <field name="_loaded">false</field>
+      <property name="loaded" 
+                onget="return !this.src ? true : this._loaded;"
+                onset="this._loaded = val; return val;"/>
+      
+      <method name="preferenceForElement">
+        <parameter name="aElement"/>
+        <body>
+          return document.getElementById(aElement.getAttribute("preference"));
+        </body>
+      </method>
+      
+      <method name="getPreferenceElement">
+        <parameter name="aStartElement"/>
+        <body>
+        <![CDATA[
+          var temp = aStartElement;
+          while (temp && temp.nodeType == Node.ELEMENT_NODE && 
+                 !temp.hasAttribute("preference"))
+            temp = temp.parentNode;
+          return temp.nodeType == Node.ELEMENT_NODE ? temp : aStartElement;
+        ]]>
+        </body>
+      </method>
+      
+      <method name="userChangedValue">
+        <parameter name="aElement"/>
+        <body>
+        <![CDATA[
+          var element = this.getPreferenceElement(aElement);
+          if (element.hasAttribute("preference")) {
+            var preference = document.getElementById(element.getAttribute("preference"));
+            var prefVal = preference.getElementValue(element);
+            preference.value = prefVal;
+          }
+        ]]>
+        </body>
+      </method>
+      
+      <property name="contentHeight">
+        <getter>
+          var targetHeight = parseInt(window.getComputedStyle(this._content, "").height);
+          targetHeight += parseInt(window.getComputedStyle(this._content, "").marginTop);
+          targetHeight += parseInt(window.getComputedStyle(this._content, "").marginBottom);
+          return targetHeight;
+        </getter>
+      </property>
+      <field name="_content">
+        document.getAnonymousElementByAttribute(this, "class", "content-box");
+      </field>
+    </implementation>
+    <handlers>
+      <handler event="command">
+        // This "command" event handler tracks changes made to preferences by 
+        // the user in this window. 
+        this.userChangedValue(event.target);
+      </handler>
+      <handler event="select">
+        // This "select" event handler tracks changes made to colorpicker 
+        // preferences by the user in this window.
+        if (event.target.localName == "colorpicker") 
+          this.userChangedValue(event.target);
+      </handler>
+      <handler event="change">
+        // This "change" event handler tracks changes made to preferences by 
+        // the user in this window. 
+        this.userChangedValue(event.target);
+      </handler>
+      <handler event="paneload">
+      <![CDATA[
+        // Initialize all values from preferences.
+        var elements = this.preferenceElements;
+        for (var i = 0; i < elements.length; ++i) {
+          try {
+            var preference = this.preferenceForElement(elements[i]);
+            preference.setElementValue(elements[i]);
+          }
+          catch (e) {
+            dump("*** No preference found for " + elements[i].getAttribute("preference") + "\n");
+          }
+        }
+      ]]>      
+      </handler>
+    </handlers>
+  </binding>
+          
+  <binding id="panebutton" extends="chrome://global/content/bindings/radio.xml#radio">
+    <resources>
+      <stylesheet src="chrome://global/skin/preferences.css"/>
+    </resources>
+    <content>
+      <xul:image class="paneButtonIcon" xbl:inherits="image"/>
+      <xul:label class="paneButtonLabel" xbl:inherits="value=label"/>
+    </content>
+  </binding>
+
+</bindings>
+
+# -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+# 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 the Preferences System.
+# 
+# The Initial Developer of the Original Code is Ben Goodger.
+# Portions created by the Initial Developer are Copyright (C) 2005
+# the Initial Developer. All Rights Reserved.
+# 
+# Contributor(s):
+#   Ben Goodger <ben@mozilla.org>
+# 
+# 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 *****
+
+#
+# This is PrefWindow 6. The Code Could Well Be Ready, Are You?
+#
+#    Historical References:
+#    PrefWindow V   (February 1, 2003)
+#    PrefWindow IV  (April 24, 2000)
+#    PrefWindow III (January 6, 2000)
+#    PrefWindow II  (???)
+#    PrefWindow I   (June 4, 1999)
+#
Index: toolkit/content/widgets/stringbundle.xml
===================================================================
RCS file: /cvsroot/mozilla/toolkit/content/widgets/stringbundle.xml,v
retrieving revision 1.6
diff -p -u -8 -r1.6 stringbundle.xml
--- toolkit/content/widgets/stringbundle.xml	1 Dec 2004 16:21:02 -0000	1.6
+++ toolkit/content/widgets/stringbundle.xml	21 Feb 2005 11:23:02 -0000
@@ -83,15 +83,25 @@
               return localeService.getApplicationLocale();
             }
             catch (ex) {
               return null;
             }
           ]]>
         </getter>
       </property>
+      
+      <property name="strings">
+        <getter>
+          <![CDATA[
+            // Note: this is a sucky method name! Should be:
+            //       readonly attribute nsISimpleEnumerator strings;
+            return this.stringBundle.getSimpleEnumeration();
+          ]]>
+        </getter>
+      </property>
 
       <field name="_bundle">null</field>
 
     </implementation>
   </binding>
 
 </bindings>
Index: toolkit/content/widgets/tabbox.xml
===================================================================
RCS file: /cvsroot/mozilla/toolkit/content/widgets/tabbox.xml,v
retrieving revision 1.18
diff -p -u -8 -r1.18 tabbox.xml
--- toolkit/content/widgets/tabbox.xml	2 Dec 2004 21:14:48 -0000	1.18
+++ toolkit/content/widgets/tabbox.xml	21 Feb 2005 11:23:02 -0000
@@ -74,16 +74,17 @@
       </property>
       
       <property name="selectedIndex"
                 onget="return this._tabs ? this._tabs.selectedIndex : null;">
         <setter>
         <![CDATA[
           if (this._tabs)
             this._tabs.selectedIndex = val;
+          this.setAttribute("selectedIndex", val);
           return val;
         ]]>
         </setter>
       </property>
 
       <property name="selectedTab"
                 onget="return this._tabs ? this._tabs.selectedItem : null;">
         <setter>
@@ -109,20 +110,20 @@
         ]]>
         </setter>
       </property>
 
       <field name="_keyEventHandler" readonly="true">
       <![CDATA[({
         tabbox: this,
         handleEvent: function handleEvent(event) {
-	  if (!event.isTrusted) {
-	    // Don't let untrusted events mess with tabs.
-	    return;
-	  }
+          if (!event.isTrusted) {
+            // Don't let untrusted events mess with tabs.
+            return;
+          }
 
           switch (event.keyCode) {
             case event.DOM_VK_TAB:
               if (event.ctrlKey && !event.altKey && !event.metaKey)
                 if (this.tabbox._tabs && this.tabbox.handleCtrlTab) {
                   this.tabbox._tabs.advanceSelectedTab(event.shiftKey ? -1 : 1);
                   event.stopPropagation();
                   event.preventDefault();
@@ -191,17 +192,23 @@
       <constructor>
       <![CDATA[
         // first and last tabs need to be able to have unique styles
         // and also need to select first tab on startup.
         if (this.firstChild)
           this.firstChild.setAttribute("first-tab", "true");
         if (this.lastChild)
           this.lastChild.setAttribute("last-tab", "true");
-        this.selectedIndex = 0;
+        
+        var selectedIndex = -1;
+        for (var parent = this.parentNode; parent; parent = parent.parentNode) {
+          if (parent.localName == "tabbox" && parent.hasAttribute("selectedIndex"))
+            selectedIndex = parseInt(parent.getAttribute("selectedIndex"));
+        }
+        this.selectedIndex = selectedIndex > 0 ? selectedIndex : 0;
         var o = this.getAttribute("orient");
         if (!o)
           this.setAttribute("orient", "horizontal");
       ]]>
       </constructor>
       
       <property name="accessible">
         <getter>
Index: toolkit/locales/jar.mn
===================================================================
RCS file: /cvsroot/mozilla/toolkit/locales/jar.mn,v
retrieving revision 1.11
diff -p -u -8 -r1.11 jar.mn
--- toolkit/locales/jar.mn	20 Feb 2005 21:15:00 -0000	1.11
+++ toolkit/locales/jar.mn	21 Feb 2005 11:23:02 -0000
@@ -22,36 +22,33 @@
 + locale/@AB_CD@/global/finddialog.properties           (%chrome/global/finddialog.properties)
 + locale/@AB_CD@/global/intl.css                        (%chrome/global/intl.css)
 + locale/@AB_CD@/global/intl.properties                 (%chrome/global/intl.properties)
 + locale/@AB_CD@/global/keys.properties                 (%chrome/global/keys.properties)
 + locale/@AB_CD@/global/languageNames.properties        (%chrome/global/languageNames.properties)
   locale/@AB_CD@/global/license.dtd                     (%chrome/global/license.dtd)
   locale/@AB_CD@/global/mozilla.dtd                     (%chrome/global/mozilla.dtd)
 + locale/@AB_CD@/global/nsTreeSorting.properties        (%chrome/global/nsTreeSorting.properties)
+  locale/@AB_CD@/global/preferences.dtd                 (%chrome/global/preferences.dtd)
 + locale/@AB_CD@/global/printdialog.dtd                 (%chrome/global/printdialog.dtd)
 + locale/@AB_CD@/global/printjoboptions.dtd             (%chrome/global/printjoboptions.dtd)
 + locale/@AB_CD@/global/printjoboptions.properties      (%chrome/global/printjoboptions.properties)
 + locale/@AB_CD@/global/printPageSetup.dtd              (%chrome/global/printPageSetup.dtd)
 + locale/@AB_CD@/global/printPreview.dtd                (%chrome/global/printPreview.dtd)
 + locale/@AB_CD@/global/printPreviewProgress.dtd        (%chrome/global/printPreviewProgress.dtd)
 + locale/@AB_CD@/global/printProgress.dtd               (%chrome/global/printProgress.dtd)
 + locale/@AB_CD@/global/regionNames.properties          (%chrome/global/regionNames.properties)
 + locale/@AB_CD@/global/dialog.properties               (%chrome/global/dialog.properties)
 + locale/@AB_CD@/global/tabbrowser.dtd                  (%chrome/global/tabbrowser.dtd)
 + locale/@AB_CD@/global/tabbrowser.properties           (%chrome/global/tabbrowser.properties)
 + locale/@AB_CD@/global/tree.dtd                        (%chrome/global/tree.dtd)
 + locale/@AB_CD@/global/textcontext.dtd                 (%chrome/global/textcontext.dtd)
 + locale/@AB_CD@/global/viewSource.dtd                  (%chrome/global/viewSource.dtd)
 + locale/@AB_CD@/global/viewSource.properties           (%chrome/global/viewSource.properties)
 + locale/@AB_CD@/global/wizard.properties               (%chrome/global/wizard.properties)
-  locale/@AB_CD@/global/nsHelperAppDlg.dtd              (%chrome/global/nsHelperAppDlg.dtd)
-  locale/@AB_CD@/global/nsHelperAppDlg.properties       (%chrome/global/nsHelperAppDlg.properties)
-  locale/@AB_CD@/global/nsProgressDialog.dtd            (%chrome/global/nsProgressDialog.dtd)
-  locale/@AB_CD@/global/nsProgressDialog.properties     (%chrome/global/nsProgressDialog.properties)
   locale/@AB_CD@/global/history/history.properties      (%chrome/global/history/history.properties)
   locale/@AB_CD@/global/xpinstall/xpinstall.properties  (%chrome/global/xpinstall/xpinstall.properties)
 * locale/@AB_CD@/global-region/contents.rdf             (generic/chrome/global-region/contents.rdf)
 + locale/@AB_CD@/global-region/region.dtd               (%chrome/global-region/region.dtd)
 + locale/@AB_CD@/global-region/region.properties        (%chrome/global-region/region.properties)
 + locale/@AB_CD@/global-region/builtinURLs.rdf          (%chrome/global-region/builtinURLs.rdf)
 * locale/@AB_CD@/global-platform/contents.rdf                 (generic/chrome/global-platform/contents.rdf)
   locale/@AB_CD@/global-platform/mac/platformKeys.properties  (%chrome/global-platform/mac/platformKeys.properties)
Index: toolkit/locales/en-US/chrome/global/config.dtd
===================================================================
RCS file: /cvsroot/mozilla/toolkit/locales/en-US/chrome/global/config.dtd,v
retrieving revision 1.2
diff -p -u -8 -r1.2 config.dtd
--- toolkit/locales/en-US/chrome/global/config.dtd	24 Nov 2004 15:55:23 -0000	1.2
+++ toolkit/locales/en-US/chrome/global/config.dtd	21 Feb 2005 11:23:02 -0000
@@ -63,8 +63,13 @@
 <!ENTITY new.label "New">
 <!ENTITY new.accesskey "N">
 <!ENTITY string.label "String">
 <!ENTITY string.accesskey "S">
 <!ENTITY integer.label "Integer">
 <!ENTITY integer.accesskey "I">
 <!ENTITY boolean.label "Boolean">
 <!ENTITY boolean.accesskey "B">
+<!ENTITY lock.label "Lock">
+<!ENTITY lock.accesskey "L">
+<!ENTITY unlock.label "Unlock">
+<!ENTITY unlock.accesskey "U">
+
Index: toolkit/locales/en-US/chrome/global/preferences.dtd
===================================================================
RCS file: toolkit/locales/en-US/chrome/global/preferences.dtd
diff -N toolkit/locales/en-US/chrome/global/preferences.dtd
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ toolkit/locales/en-US/chrome/global/preferences.dtd	21 Feb 2005 11:23:02 -0000
@@ -0,0 +1,5 @@
+<!ENTITY  windowClose.key                         "w">
+<!ENTITY  preferencesDefaultTitleMac.title        "Preferences">
+<!ENTITY  preferencesDefaultTitleWin.title        "Options">
+<!ENTITY  preferencesCloseButton.label            "Close">
+<!ENTITY  preferencesCloseButton.accesskey        "C">
Index: toolkit/locales/en-US/chrome/mozapps/downloads/unknownContentType.properties
===================================================================
RCS file: /cvsroot/mozilla/toolkit/locales/en-US/chrome/mozapps/downloads/unknownContentType.properties,v
retrieving revision 1.3
diff -p -u -8 -r1.3 unknownContentType.properties
--- toolkit/locales/en-US/chrome/mozapps/downloads/unknownContentType.properties	1 Feb 2005 17:07:15 -0000	1.3
+++ toolkit/locales/en-US/chrome/mozapps/downloads/unknownContentType.properties	21 Feb 2005 11:23:03 -0000
@@ -38,14 +38,9 @@
 
 title=Opening %S
 saveDialogTitle=Enter name of file to save to...
 defaultApp=%S (default)
 chooseAppFilePickerTitle=Choose Helper Application
 badApp=The application you chose ("%S") could not be found.  Check the file name or choose another application.
 badApp.title=Application not found
 selectDownloadDir=Select Download Folder
-fileEnding=%S file
-saveToDisk=Save to Disk
-openWith=Open with %S
 myDownloads=My Downloads
-removeActions=Remove Actions
-removeActionsMsg=The selected Actions will no longer be performed when files of the affected types are downloaded. Are you sure you want to remove these Actions?
Index: toolkit/themes/pinstripe/global/config.css
===================================================================
RCS file: /cvsroot/mozilla/toolkit/themes/pinstripe/global/config.css,v
retrieving revision 1.2
diff -p -u -8 -r1.2 config.css
--- toolkit/themes/pinstripe/global/config.css	18 Jun 2004 21:06:38 -0000	1.2
+++ toolkit/themes/pinstripe/global/config.css	21 Feb 2005 11:23:04 -0000
@@ -1,14 +1,25 @@
 
 @import url("chrome://global/skin/");
 @namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
 
 
-treechildren::-moz-tree-cell-text(user)
+#configTreeBody::-moz-tree-cell-text(user)
 {
   font-weight: bold;
 }
 
-treechildren::-moz-tree-cell-text(locked)
+#configTreeBody::-moz-tree-cell-text(locked)
 {
   font-style: italic;
 }
+
+#configTree 
+{  
+  margin-top: 5px !important;
+  margin-bottom: 5px !important;
+}
+
+#filterRow
+{
+  margin-top: 5px;
+}
\ No newline at end of file
Index: toolkit/themes/pinstripe/global/global.css
===================================================================
RCS file: /cvsroot/mozilla/toolkit/themes/pinstripe/global/global.css,v
retrieving revision 1.5
diff -p -u -8 -r1.5 global.css
--- toolkit/themes/pinstripe/global/global.css	1 Feb 2005 17:07:32 -0000	1.5
+++ toolkit/themes/pinstripe/global/global.css	21 Feb 2005 11:23:05 -0000
@@ -76,23 +76,28 @@ menulist > menupopup,
   -moz-binding: url("chrome://global/skin/globalBindings.xml#tabs-closebutton");
 }
 
 /* ::::: root elements ::::: */
 
 window,
 page,
 dialog,
-wizard { 
+wizard,
+prefwindow { 
   -moz-appearance: dialog;
   background-color: #FFFFFF;
   color: -moz-DialogText;
   font: message-box;
 }
 
+prefwindow {
+	  padding: 8px 10px 10px 8px;
+}
+
 /* deprecated */
 window.dialog { 
   padding: 8px 10px 10px 8px;
 }
 
 [wait-cursor] { 
   cursor: wait !important; 
 }
Index: toolkit/themes/winstripe/global/config.css
===================================================================
RCS file: /cvsroot/mozilla/toolkit/themes/winstripe/global/config.css,v
retrieving revision 1.2
diff -p -u -8 -r1.2 config.css
--- toolkit/themes/winstripe/global/config.css	17 Jun 2004 23:00:50 -0000	1.2
+++ toolkit/themes/winstripe/global/config.css	21 Feb 2005 11:23:07 -0000
@@ -1,14 +1,26 @@
 
 @import url("chrome://global/skin/");
 @namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
 
 
-treechildren::-moz-tree-cell-text(user)
+#configTreeBody::-moz-tree-cell-text(user)
 {
   font-weight: bold;
 }
 
-treechildren::-moz-tree-cell-text(locked)
+#configTreeBody::-moz-tree-cell-text(locked)
 {
   font-style: italic;
 }
+
+#configTree 
+{  
+  margin-top: 5px;
+  margin-bottom: 5px;
+}
+
+#filterRow
+{
+  margin-top: 5px;
+}
+
Index: toolkit/themes/winstripe/global/global.css
===================================================================
RCS file: /cvsroot/mozilla/toolkit/themes/winstripe/global/global.css,v
retrieving revision 1.5
diff -p -u -8 -r1.5 global.css
--- toolkit/themes/winstripe/global/global.css	20 Feb 2005 15:49:32 -0000	1.5
+++ toolkit/themes/winstripe/global/global.css	21 Feb 2005 11:23:07 -0000
@@ -61,24 +61,24 @@ menulist > menupopup,
   -moz-binding: url("chrome://global/content/bindings/menulist.xml#menulist-compact");
 }
 
 /* ::::: root elements ::::: */
 
 window,
 page,
 dialog,
-wizard {
+wizard,
+prefwindow {
   -moz-appearance: window;
   background-color: -moz-Dialog;
   color: -moz-DialogText;
   font: message-box;
 }
 
-/* deprecated */
 window.dialog {
   padding: 8px 10px 10px 8px;
 }
 
 [wait-cursor] {
   cursor: wait !important;
 }
 
Index: toolkit/themes/winstripe/global/jar.mn
===================================================================
RCS file: /cvsroot/mozilla/toolkit/themes/winstripe/global/jar.mn,v
retrieving revision 1.5
diff -p -u -8 -r1.5 jar.mn
--- toolkit/themes/winstripe/global/jar.mn	30 Nov 2004 22:54:09 -0000	1.5
+++ toolkit/themes/winstripe/global/jar.mn	21 Feb 2005 11:23:07 -0000
@@ -16,16 +16,17 @@ classic.jar:
         skin/classic/global/global.css
         skin/classic/global/globalBindings.xml
         skin/classic/global/groupbox.css
         skin/classic/global/linkTree.css
         skin/classic/global/listbox.css
         skin/classic/global/menu.css
         skin/classic/global/menulist.css
         skin/classic/global/popup.css
+        skin/classic/global/preferences.css
         skin/classic/global/printing.css
         skin/classic/global/printPageSetup.css
         skin/classic/global/printPreview.css
         skin/classic/global/progressmeter.css
         skin/classic/global/radio.css
         skin/classic/global/scrollbars.css
         skin/classic/global/scrollbox.css
         skin/classic/global/spinbuttons.css
Index: toolkit/themes/winstripe/global/menulist.css
===================================================================
RCS file: /cvsroot/mozilla/toolkit/themes/winstripe/global/menulist.css,v
retrieving revision 1.6
diff -p -u -8 -r1.6 menulist.css
--- toolkit/themes/winstripe/global/menulist.css	20 Feb 2005 15:49:32 -0000	1.6
+++ toolkit/themes/winstripe/global/menulist.css	21 Feb 2005 11:23:07 -0000
@@ -63,16 +63,21 @@ menulist {
   margin: 1px;
 }
 
 .menulist-label-box,
 menulist[open="true"]:focus > .menulist-label-box {
   border: 1px solid transparent;
   background-color: transparent;
   color: inherit;
+  -moz-box-align: center;
+}
+
+.menulist-icon[src] {
+  margin: 0px 2px 0px 2px;
 }
 
 .menulist-label {
   margin: 1px 3px !important;
 }
 
 /* ..... dropmarker ..... */
 
Index: toolkit/themes/winstripe/global/preferences.css
===================================================================
RCS file: toolkit/themes/winstripe/global/preferences.css
diff -N toolkit/themes/winstripe/global/preferences.css
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ toolkit/themes/winstripe/global/preferences.css	21 Feb 2005 11:23:07 -0000
@@ -0,0 +1,101 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: NPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * 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 the Preferences UI System.
+ *
+ * The Initial Developer of the Original Code is Ben Goodger.
+ * Portions created by the Initial Developer are Copyright (C) 2005
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *  Ben Goodger <ben@mozilla.org>
+ *
+ * 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 NPL, 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 NPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/* ===== preferences.css =====================================================
+  == Styles used by the XUL prefwindow element.
+  ======================================================================= */
+
+@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
+
+/* ::::: dialog ::::: */
+
+prefwindow {
+  padding: 0px;
+}
+
+prefpane {
+  padding: 8px 10px 10px 8px;
+}
+
+prefwindow[type="child"] {
+  padding: 8px 10px 10px 8px;
+}
+
+prefwindow[type="child"] > prefpane {
+  padding: 0px;
+}
+
+.prefWindow-dlgbuttons {
+  padding-bottom: 10px;
+  padding-right: 10px;
+}
+
+prefwindow[type="child"] .prefWindow-dlgbuttons {
+  padding: 0px;
+}
+
+radio[pane] {
+  -moz-appearance: none;
+  margin: 0px 1px 0px 1px;
+  padding: 1px 3px 1px 3px;
+  min-width: 4.5em;
+}
+
+.paneSelector {
+  border-bottom: 2px groove ThreeDFace;
+  margin: 0px;
+  padding-left: 10px;
+  background-color: -moz-Field;
+  color: -moz-FieldText;
+}
+
+.paneButtonIcon {
+  width: 32px;
+  height: 32px;
+}
+
+radio[pane]:hover {
+  background-color: #E0E8F6;
+  color: black;
+  -moz-appearance: none;
+}
+
+radio[pane][selected="true"] {
+  background-color: #C1D2EE;
+  color: black; 
+  -moz-appearance: none;
+}
+
Index: toolkit/themes/winstripe/global/textbox.css
===================================================================
RCS file: /cvsroot/mozilla/toolkit/themes/winstripe/global/textbox.css,v
retrieving revision 1.4
diff -p -u -8 -r1.4 textbox.css
--- toolkit/themes/winstripe/global/textbox.css	1 Feb 2005 17:07:34 -0000	1.4
+++ toolkit/themes/winstripe/global/textbox.css	21 Feb 2005 11:23:07 -0000
@@ -50,17 +50,17 @@ textbox 
   -moz-appearance: textfield;
   cursor: text;
   margin: 2px 4px;
   border: 2px solid;
   -moz-border-top-colors: ThreeDShadow ThreeDDarkShadow;
   -moz-border-right-colors: ThreeDHighlight ThreeDLightShadow;
   -moz-border-bottom-colors: ThreeDHighlight ThreeDLightShadow;
   -moz-border-left-colors: ThreeDShadow ThreeDDarkShadow;
-  padding: 1px 0px 1px 2px;
+  padding: 2px 2px 3px 4px;
   background-color: -moz-Field;
   color: -moz-FieldText;
 }
     
 html|*.textbox-input, 
 html|*.textbox-textarea {
   margin: 0px !important;
   border: none !important;
Index: uriloader/exthandler/nsMIMEInfoImpl.cpp
===================================================================
RCS file: /cvsroot/mozilla/uriloader/exthandler/nsMIMEInfoImpl.cpp,v
retrieving revision 1.52
diff -p -u -8 -r1.52 nsMIMEInfoImpl.cpp
--- uriloader/exthandler/nsMIMEInfoImpl.cpp	11 Jun 2004 15:47:56 -0000	1.52
+++ uriloader/exthandler/nsMIMEInfoImpl.cpp	21 Feb 2005 11:23:09 -0000
@@ -38,17 +38,17 @@
 
 #include "nsMIMEInfoImpl.h"
 #include "nsXPIDLString.h"
 #include "nsReadableUtils.h"
 #include "nsStringEnumerator.h"
 #include "nsIProcess.h"
 
 // nsISupports methods
-NS_IMPL_THREADSAFE_ISUPPORTS1(nsMIMEInfoBase, nsIMIMEInfo)
+NS_IMPL_THREADSAFE_ISUPPORTS2(nsMIMEInfoBase, nsIMIMEInfo, nsIPropertyBag)
 
 // nsMIMEInfoImpl methods
 nsMIMEInfoBase::nsMIMEInfoBase(const char *aMIMEType) :
     mMIMEType(aMIMEType),
     mPreferredAction(nsIMIMEInfo::saveToDisk),
     mAlwaysAskBeforeHandling(PR_TRUE)
 {
 }
@@ -62,17 +62,18 @@ nsMIMEInfoBase::nsMIMEInfoBase(const nsA
 
 nsMIMEInfoBase::~nsMIMEInfoBase()
 {
 }
 
 NS_IMETHODIMP
 nsMIMEInfoBase::GetFileExtensions(nsIUTF8StringEnumerator** aResult)
 {
-  return NS_NewUTF8StringEnumerator(aResult, &mExtensions, this);
+  nsIMIMEInfo* mi = NS_STATIC_CAST(nsIMIMEInfo*, this);
+  return NS_NewUTF8StringEnumerator(aResult, &mExtensions, mi);
 }
 
 NS_IMETHODIMP
 nsMIMEInfoBase::ExtensionExists(const nsACString& aExtension, PRBool *_retval)
 {
     NS_ASSERTION(!aExtension.IsEmpty(), "no extension");
     PRBool found = PR_FALSE;
     PRUint32 extCount = mExtensions.Count();
@@ -366,8 +367,21 @@ nsMIMEInfoImpl::LaunchDefaultWithFile(ns
 {
   if (!mDefaultApplication)
     return NS_ERROR_FILE_NOT_FOUND;
 
   return LaunchWithIProcess(mDefaultApplication, aFile);
 }
 
 
+NS_IMETHODIMP
+nsMIMEInfoImpl::GetEnumerator(nsISimpleEnumerator* *_retval)
+{
+  *_retval = nsnull;
+  return NS_OK;
+}
+
+NS_IMETHODIMP
+nsMIMEInfoImpl::GetProperty(const nsAString& aName, nsIVariant* *_retval)
+{
+  *_retval = nsnull;
+  return NS_ERROR_FAILURE;
+}
Index: uriloader/exthandler/nsMIMEInfoImpl.h
===================================================================
RCS file: /cvsroot/mozilla/uriloader/exthandler/nsMIMEInfoImpl.h,v
retrieving revision 1.24
diff -p -u -8 -r1.24 nsMIMEInfoImpl.h
--- uriloader/exthandler/nsMIMEInfoImpl.h	11 Jun 2004 15:47:56 -0000	1.24
+++ uriloader/exthandler/nsMIMEInfoImpl.h	21 Feb 2005 11:23:09 -0000
@@ -34,29 +34,41 @@
  * 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 ***** */
 #ifndef __nsmimeinfoimpl_h___
 #define __nsmimeinfoimpl_h___
 
 #include "nsIMIMEInfo.h"
+#include "nsIPropertyBag.h"
 #include "nsIAtom.h"
 #include "nsString.h"
 #include "nsVoidArray.h"
 #include "nsIFile.h"
 #include "nsCOMPtr.h"
 #include "nsIURI.h"
 
+/** 
+ * UTF8 moz-icon URI string for the default handler application's icon, if 
+ * available.
+ */
+#define PROPERTY_DEFAULT_APP_ICON_URL "defaultApplicationIconURL"
+/** 
+ * UTF8 moz-icon URI string for the user's preferred handler application's 
+ * icon, if available.
+ */
+#define PROPERTY_CUSTOM_APP_ICON_URL "customApplicationIconURL"
+
 /**
  * Basic implementation of nsIMIMEInfo. Incomplete - it is meant to be
  * subclassed, and GetHasDefaultHandler as well as LaunchDefaultWithFile need to
  * be implemented.
  */
-class nsMIMEInfoBase : public nsIMIMEInfo {
+class nsMIMEInfoBase : public nsIMIMEInfo, nsIPropertyBag {
   public:
     NS_DECL_ISUPPORTS
 
     // I'd use NS_DECL_NSIMIMEINFO, but I don't want GetHasDefaultHandler
     NS_IMETHOD GetFileExtensions(nsIUTF8StringEnumerator **_retval);
     NS_IMETHOD SetFileExtensions(const nsACString & aExtensions);
     NS_IMETHOD ExtensionExists(const nsACString & aExtension, PRBool *_retval);
     NS_IMETHOD AppendExtension(const nsACString & aExtension);
@@ -147,16 +159,19 @@ class nsMIMEInfoImpl : public nsMIMEInfo
     nsMIMEInfoImpl(const char *aMIMEType = "") : nsMIMEInfoBase(aMIMEType) {}
     nsMIMEInfoImpl(const nsACString& aMIMEType) : nsMIMEInfoBase(aMIMEType) {}
     virtual ~nsMIMEInfoImpl() {}
 
     // nsIMIMEInfo methods
     NS_IMETHOD GetHasDefaultHandler(PRBool *_retval);
     NS_IMETHOD GetDefaultDescription(nsAString& aDefaultDescription);
 
+    // nsIPropertyBag methods
+    NS_DECL_NSIPROPERTYBAG
+    
     // additional methods
     /**
      * Sets the default application. Supposed to be only called by the OS Helper
      * App Services; the default application is immutable after it is first set.
      */
     void SetDefaultApplication(nsIFile* aApp) { if (!mDefaultApplication) mDefaultApplication = aApp; }
   protected:
     // nsMIMEInfoBase methods
Index: uriloader/exthandler/win/nsMIMEInfoWin.cpp
===================================================================
RCS file: /cvsroot/mozilla/uriloader/exthandler/win/nsMIMEInfoWin.cpp,v
retrieving revision 1.3
diff -p -u -8 -r1.3 nsMIMEInfoWin.cpp
--- uriloader/exthandler/win/nsMIMEInfoWin.cpp	17 Apr 2004 16:52:03 -0000	1.3
+++ uriloader/exthandler/win/nsMIMEInfoWin.cpp	21 Feb 2005 11:23:09 -0000
@@ -33,18 +33,22 @@
  * 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 ***** */
 
+#include "nsArrayEnumerator.h"
+#include "nsCOMArray.h"
 #include "nsILocalFile.h"
+#include "nsIVariant.h"
 #include "nsMIMEInfoWin.h"
+#include "nsNetUtil.h"
 
 nsMIMEInfoWin::~nsMIMEInfoWin()
 {
 }
 
 nsresult
 nsMIMEInfoWin::LaunchDefaultWithFile(nsIFile* aFile)
 {
@@ -65,8 +69,51 @@ NS_IMETHODIMP
 nsMIMEInfoWin::GetHasDefaultHandler(PRBool * _retval)
 {
   // We have a default application if we have a description
   // We can ShellExecute anything; however, callers are probably interested if
   // there is really an application associated with this type of file
   *_retval = !mDefaultAppDescription.IsEmpty();
   return NS_OK;
 }
+
+NS_IMETHODIMP
+nsMIMEInfoWin::GetEnumerator(nsISimpleEnumerator* *_retval)
+{
+  nsCOMArray<nsIVariant> properties;
+
+  nsCOMPtr<nsIVariant> variant;
+  GetProperty(NS_LITERAL_STRING("defaultApplicationIconURL"), getter_AddRefs(variant));
+  if (variant)
+    properties.AppendObject(variant);
+
+  GetProperty(NS_LITERAL_STRING("customApplicationIconURL"), getter_AddRefs(variant));
+  if (variant)
+    properties.AppendObject(variant);
+
+  return NS_NewArrayEnumerator(_retval, properties);
+}
+
+static nsresult GetIconURLVariant(nsIFile* aApplication, nsIVariant* *_retval)
+{
+  nsresult rv = CallCreateInstance("@mozilla.org/variant;1", _retval);
+  if (NS_FAILED(rv))
+    return rv;
+  nsCAutoString fileURLSpec;
+  NS_GetURLSpecFromFile(aApplication, fileURLSpec);
+  nsCAutoString iconURLSpec; iconURLSpec.AssignLiteral("moz-icon://");
+  iconURLSpec += fileURLSpec;
+  nsCOMPtr<nsIWritableVariant> writable(do_QueryInterface(*_retval));
+  writable->SetAsAUTF8String(iconURLSpec);
+  return NS_OK;
+}
+
+NS_IMETHODIMP
+nsMIMEInfoWin::GetProperty(const nsAString& aName, nsIVariant* *_retval)
+{
+  nsresult rv = NS_ERROR_FAILURE;
+  if (mDefaultApplication && aName.EqualsLiteral(PROPERTY_DEFAULT_APP_ICON_URL))
+    rv = GetIconURLVariant(mDefaultApplication, _retval);
+  else if (mPreferredApplication && aName.EqualsLiteral(PROPERTY_CUSTOM_APP_ICON_URL))
+    rv = GetIconURLVariant(mPreferredApplication, _retval);
+  return rv;
+}
+
Index: uriloader/exthandler/win/nsMIMEInfoWin.h
===================================================================
RCS file: /cvsroot/mozilla/uriloader/exthandler/win/nsMIMEInfoWin.h,v
retrieving revision 1.3
diff -p -u -8 -r1.3 nsMIMEInfoWin.h
--- uriloader/exthandler/win/nsMIMEInfoWin.h	11 Jun 2004 15:47:57 -0000	1.3
+++ uriloader/exthandler/win/nsMIMEInfoWin.h	21 Feb 2005 11:23:09 -0000
@@ -41,13 +41,23 @@
 
 class nsMIMEInfoWin : public nsMIMEInfoBase {
   public:
     nsMIMEInfoWin(const char* aType = "") : nsMIMEInfoBase(aType) {}
     nsMIMEInfoWin(const nsACString& aMIMEType) : nsMIMEInfoBase(aMIMEType) {}
     virtual ~nsMIMEInfoWin();
 
     NS_IMETHOD GetHasDefaultHandler(PRBool * _retval);
+
+    NS_DECL_NSIPROPERTYBAG
+
+    void SetDefaultApplicationHandler(nsIFile* aDefaultApplication) 
+    { 
+      mDefaultApplication = aDefaultApplication; 
+    }
   protected:
     virtual nsresult LaunchDefaultWithFile(nsIFile* aFile);
+  
+  private:
+    nsCOMPtr<nsIFile>      mDefaultApplication;
 };
 
 #endif
Index: uriloader/exthandler/win/nsOSHelperAppService.cpp
===================================================================
RCS file: /cvsroot/mozilla/uriloader/exthandler/win/nsOSHelperAppService.cpp,v
retrieving revision 1.60
diff -p -u -8 -r1.60 nsOSHelperAppService.cpp
--- uriloader/exthandler/win/nsOSHelperAppService.cpp	6 Feb 2005 03:52:47 -0000	1.60
+++ uriloader/exthandler/win/nsOSHelperAppService.cpp	21 Feb 2005 11:23:10 -0000
@@ -41,17 +41,17 @@
 #include "nsOSHelperAppService.h"
 #include "nsISupports.h"
 #include "nsString.h"
 #include "nsXPIDLString.h"
 #include "nsIURL.h"
 #include "nsIMIMEInfo.h"
 #include "nsMIMEInfoWin.h"
 #include "nsMimeTypes.h"
-#include "nsILocalFile.h"
+#include "nsILocalFileWin.h"
 #include "nsIProcess.h"
 #include "plstr.h"
 #include "nsAutoPtr.h"
 #include "nsNativeCharsetUtils.h"
 
 // we need windows.h to read out registry information...
 #include <windows.h>
 
@@ -240,17 +240,16 @@ NS_IMETHODIMP nsOSHelperAppService::Exte
 
 // this implementation was pretty much copied verbatime from Tony Robinson's code in nsExternalProtocolWin.cpp
 
 nsresult nsOSHelperAppService::LoadUriInternal(nsIURI * aURL)
 {
 #ifdef WINCE // WinCE doesn't support helper applications yet.
   return NS_ERROR_NOT_IMPLEMENTED;
 #else
-
   nsresult rv = NS_OK;
 
   // 1. Find the default app for this protocol
   // 2. Set up the command line
   // 3. Launch the app.
 
   // For now, we'll just cheat essentially, check for the command line
   // then just call ShellExecute()!
@@ -342,17 +341,17 @@ nsresult nsOSHelperAppService::GetMIMEIn
 // various mime types. 
 ////////////////////////////////////////////////////////////////////////////////////////////////
 
 /// Looks up the type for the extension aExt and compares it to aType
 /* static */ PRBool
 nsOSHelperAppService::typeFromExtEquals(const PRUnichar* aExt, const char *aType)
 {
 #ifdef WINCE  // WinCE doesn't support helper applications yet.
-  return FALSE;
+  return PR_FALSE;
 #else
   if (!aType)
     return PR_FALSE;
   nsAutoString fileExtToUse;
   if (aExt[0] != PRUnichar('.'))
     fileExtToUse = PRUnichar('.');
 
   fileExtToUse.Append(aExt);
@@ -380,22 +379,162 @@ nsOSHelperAppService::typeFromExtEquals(
        delete[] pBytes;
      }
      ::RegCloseKey(hKey);
   }
   return eq;
 #endif
 }
 
+static void RemoveParameters(nsString& aPath)
+{
+  // Command Strings stored in the Windows registry with parameters look like 
+  // this:
+  //
+  // 1) "C:\Program Files\Company Name\product.exe" -foo -bar  (long version)
+  //                      -- OR --
+  // 2) C:\PROGRA~1\COMPAN~2\product.exe -foo -bar             (short version)
+  //
+  // For 1), the path is the first "" quoted string. (quotes are used to 
+  //         prevent parameter parsers from choking)
+  // For 2), the path is the string up until the first space (spaces are 
+  //         illegal in short DOS-style paths)
+  //
+  if (aPath.First() == PRUnichar('"')) {
+    aPath = Substring(aPath, 1, aPath.Length() - 1);
+    PRInt32 nextQuote = aPath.FindChar(PRUnichar('"'));
+    if (nextQuote != kNotFound)
+      aPath.Truncate(nextQuote);
+  }
+  else {
+    PRInt32 firstSpace = aPath.FindChar(PRUnichar(' '));
+    if (firstSpace != kNotFound) 
+      aPath.Truncate(firstSpace);
+  }
+}
+
+//
+// The "real" name of a given helper app (as specified by the path to the 
+// executable file held in various registry keys) is stored n the VERSIONINFO
+// block in the file's resources. We need to find the path to the executable
+// and then retrieve the "FileDescription" field value from the file. 
+//
+// For a given extension, we find the file handler like so:
+//
+// HKCR
+//     \.ext\                           <type key>     <-- default value
+//     \<type key>\   
+//                \shell\open\command\  <path+params>  <-- default value
+//
+// We need to do some parsing on the <path+params> to strip off params and
+// deal with some Windows quirks (like the fact that many Shell "applications"
+// are actually DLLs invoked via rundll32.exe) 
+//
+nsresult
+nsOSHelperAppService::GetDefaultAppInfo(nsAString& aTypeName, nsAString& aDefaultDescription, 
+                                        nsIFile** aDefaultApplication)
+{
+  // If all else fails, use the file type key name, which will be something like "pngfile" for
+  // .pngs, "WMVFile" for .wmvs, etc. 
+  aDefaultDescription = aTypeName;
+  *aDefaultApplication = nsnull;
+
+  nsCAutoString handlerKeyName;
+  NS_CopyUnicodeToNative(aTypeName, handlerKeyName);
+  handlerKeyName += "\\shell\\open\\command";
+  HKEY handlerKey;
+  LONG err = ::RegOpenKeyEx(HKEY_CLASSES_ROOT, handlerKeyName.get(), 0, KEY_QUERY_VALUE, &handlerKey);
+  if (err == ERROR_SUCCESS) {
+    nsAutoString handlerCommand;
+    PRBool found = GetValueString(handlerKey, NULL, handlerCommand);
+    if (found) {
+      nsAutoString handlerFilePath;
+      // First look to see if we're invoking a Windows shell service, such as 
+      // the Picture & Fax Viewer, which are invoked through rundll32.exe, and
+      // so we need to extract the DLL path because that's where the version
+      // info is held - not in rundll32.exe
+      //
+      // The format of rundll32.exe calls is:
+      //
+      // rundll32.exe c:\path\to.dll,Function %args
+      //
+      // What we want is the DLL - since that's where the real application name
+      // is stored, e.g. zipfldr.dll, shimgvw.dll, etc. 
+      // 
+      // Working from the end of the registry value, the path begins at the last
+      // comma in the string (stripping off Function and args) to the position
+      // just after the first space (the space after rundll32.exe).
+      // 
+      NS_NAMED_LITERAL_STRING(rundllSegment, "rundll32.exe ");
+      if (StringBeginsWith(handlerCommand, rundllSegment)) {
+        PRInt32 lastCommaPos = handlerCommand.RFindChar(',');
+        PRUint32 rundllSegmentLength = rundllSegment.Length();
+        if (lastCommaPos != kNotFound)
+          handlerFilePath = Substring(handlerCommand, rundllSegmentLength, 
+                                      lastCommaPos - rundllSegmentLength);
+        else
+          handlerFilePath = Substring(handlerCommand, rundllSegmentLength, 
+                                      handlerCommand.Length() - rundllSegmentLength);
+      }
+      else
+        handlerFilePath = handlerCommand;
+
+      // Trim any command parameters so that we have a native path we can 
+      // initialize a local file with...
+      RemoveParameters(handlerFilePath);
+
+      // Similarly replace embedded environment variables... (this must be done
+      // AFTER |RemoveParameters| since it may introduce spaces into the path string)
+      TCHAR* destination = nsnull;
+      nsCAutoString nativeHandlerFilePath; 
+      NS_CopyUnicodeToNative(handlerFilePath, nativeHandlerFilePath);
+      DWORD required = ::ExpandEnvironmentStrings(nativeHandlerFilePath.get(), destination, 0);
+      destination = new TCHAR[required];
+      if (!destination) {
+        ::RegCloseKey(handlerKey);
+        delete[] destination;
+        destination = nsnull;
+        return NS_ERROR_OUT_OF_MEMORY;
+      }
+      ::ExpandEnvironmentStrings(nativeHandlerFilePath.get(), destination, required);
+      NS_CopyNativeToUnicode(nsDependentCString(destination), handlerFilePath);
+      delete[] destination;
+      destination = nsnull;
+
+      nsCOMPtr<nsILocalFile> lf;
+      NS_NewLocalFile(handlerFilePath, PR_TRUE, getter_AddRefs(lf));
+      if (!lf) {
+        ::RegCloseKey(handlerKey);
+        delete[] destination;
+        destination = nsnull;
+        return NS_ERROR_OUT_OF_MEMORY;
+      }
+
+      nsILocalFileWin* lfw = nsnull;
+      nsresult rv = CallQueryInterface(lf, &lfw);
+      if (NS_SUCCEEDED(rv) && lfw) {
+        // The "FileDescription" field contains the actual name of the application.
+        lfw->GetVersionInfoField(NS_LITERAL_CSTRING("FileDescription"), 
+                                 aDefaultDescription);
+        // QI addref'ed for us.
+        *aDefaultApplication = lfw;
+      }
+
+      ::RegCloseKey(handlerKey);
+    }
+  }
+
+  return NS_OK;
+}
+
 already_AddRefed<nsMIMEInfoWin> nsOSHelperAppService::GetByExtension(const nsAFlatString& aFileExt, const char *aTypeHint)
 {
-#ifdef WINCE  // WinCE doesn't support helper applications yet.
+#ifdef WINCE  // WinCE doesn't support helper applications yet
   return nsnull;
 #else
-
   if (aFileExt.IsEmpty())
     return nsnull;
 
   // windows registry assumes your file extension is going to include the '.'.
   // so make sure it's there...
   nsAutoString fileExtToUse;
   if (aFileExt.First() != PRUnichar('.'))
     fileExtToUse = PRUnichar('.');
Index: uriloader/exthandler/win/nsOSHelperAppService.h
===================================================================
RCS file: /cvsroot/mozilla/uriloader/exthandler/win/nsOSHelperAppService.h,v
retrieving revision 1.22
diff -p -u -8 -r1.22 nsOSHelperAppService.h
--- uriloader/exthandler/win/nsOSHelperAppService.h	25 Oct 2004 07:46:01 -0000	1.22
+++ uriloader/exthandler/win/nsOSHelperAppService.h	21 Feb 2005 11:23:10 -0000
@@ -66,16 +66,17 @@ public:
   already_AddRefed<nsIMIMEInfo> GetMIMEInfoFromOS(const nsACString& aMIMEType, const nsACString& aFileExt, PRBool *aFound);
 
   /** Get the string value of a registry value and store it in result.
    * @return PR_TRUE on success, PR_FALSE on failure
    */
   static PRBool GetValueString(HKEY hKey, const PRUnichar* pValueName, nsAString& result);
 
 protected:
+  nsresult GetDefaultAppInfo(nsAString& aTypeName, nsAString& aDefaultDescription, nsIFile** aDefaultApplication);
   // Lookup a mime info by extension, using an optional type hint
   already_AddRefed<nsMIMEInfoWin> GetByExtension(const nsAFlatString& aFileExt, const char *aTypeHint = nsnull);
   nsresult FindOSMimeInfoForType(const char * aMimeContentType, nsIURI * aURI, char ** aFileExtension, nsIMIMEInfo ** aMIMEInfo);
 
   /** Whether we're running on an OS that supports the *W registry functions */
   static PRBool mIsNT;
   static nsresult GetMIMEInfoFromRegistry(const nsAFlatString& fileType, nsIMIMEInfo *pInfo);
   /// Looks up the type for the extension aExt and compares it to aType
Index: xpcom/build/Makefile.in
===================================================================
RCS file: /cvsroot/mozilla/xpcom/build/Makefile.in,v
retrieving revision 1.83
diff -p -u -8 -r1.83 Makefile.in
--- xpcom/build/Makefile.in	30 Jan 2005 21:33:44 -0000	1.83
+++ xpcom/build/Makefile.in	21 Feb 2005 11:23:13 -0000
@@ -165,16 +165,16 @@ CXXFLAGS	+= $(TK_CFLAGS)
 EXTRA_DSO_LDOPTS += $(TK_LIBS)
 endif
 
 ifeq ($(OS_ARCH),BeOS)
 EXTRA_DSO_LDOPTS += -lbe
 endif
 
 ifeq ($(OS_ARCH),WINNT)
-EXTRA_DSO_LDOPTS += $(call EXPAND_LIBNAME,shell32 ole32 uuid)
+EXTRA_DSO_LDOPTS += $(call EXPAND_LIBNAME,shell32 ole32 uuid Version)
 ifneq (,$(MOZ_DEBUG)$(NS_TRACE_MALLOC))
 EXTRA_DSO_LDOPTS += $(call EXPAND_LIBNAME,imagehlp)
 endif
 endif # WINNT
 
 export:: $(XPCOM_GLUE_SRC_CSRCS)
 	$(INSTALL) $^ .
Index: xpcom/io/Makefile.in
===================================================================
RCS file: /cvsroot/mozilla/xpcom/io/Makefile.in,v
retrieving revision 1.77
diff -p -u -8 -r1.77 Makefile.in
--- xpcom/io/Makefile.in	18 Apr 2004 14:18:14 -0000	1.77
+++ xpcom/io/Makefile.in	21 Feb 2005 11:23:14 -0000
@@ -125,16 +125,17 @@ endif # os2
 
 XPIDLSRCS	= \
 		nsIBinaryInputStream.idl \
 		nsIBinaryOutputStream.idl  \
 		nsIByteArrayInputStream.idl \
 		nsIFastLoadFileControl.idl \
 		nsIFastLoadService.idl \
 		nsIInputStreamTee.idl \
+		nsILocalFileWin.idl \
 		nsILineInputStream.idl \
 		nsIMultiplexInputStream.idl \
 		nsIObjectInputStream.idl \
 		nsIObjectOutputStream.idl \
 		nsIPipe.idl \
 		nsISeekableStream.idl \
 		nsIStorageStream.idl \
 		nsIStringStream.idl \
Index: xpcom/io/nsILocalFileWin.idl
===================================================================
RCS file: xpcom/io/nsILocalFileWin.idl
diff -N xpcom/io/nsILocalFileWin.idl
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ xpcom/io/nsILocalFileWin.idl	21 Feb 2005 11:23:14 -0000
@@ -0,0 +1,53 @@
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ * 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 the Local File Interface (Windows Extensions)
+ * 
+ * The Initial Developer of the Original Code is Google Inc.
+ * Portions created by the Initial Developer are 
+ * Copyright (C) 2005 the Initial Developer. All Rights Reserved.
+ * 
+ * Contributor(s):
+ *   Ben Goodger <ben@mozilla.org> (Original Author)
+ * 
+ * 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 *****
+ */
+
+#include "nsILocalFile.idl"
+
+[scriptable, uuid(dc42f467-4094-437d-9e3e-8912a072aede)]
+interface nsILocalFileWin : nsILocalFile
+{
+   /**
+    * getVersionInfoValue
+    *
+    * Retrieve a metadata field from the file's VERSIONINFO block
+    *
+    * @param   aField         The field to look up.
+    *
+    */
+    AString getVersionInfoField(in ACString aField);
+};
+
Index: xpcom/io/nsLocalFileWin.cpp
===================================================================
RCS file: /cvsroot/mozilla/xpcom/io/nsLocalFileWin.cpp,v
retrieving revision 1.134
diff -p -u -8 -r1.134 nsLocalFileWin.cpp
--- xpcom/io/nsLocalFileWin.cpp	11 Feb 2005 23:13:38 -0000	1.134
+++ xpcom/io/nsLocalFileWin.cpp	21 Feb 2005 11:23:16 -0000
@@ -990,16 +990,97 @@ nsLocalFile::SetNativeLeafName(const nsA
 
 NS_IMETHODIMP
 nsLocalFile::GetNativePath(nsACString &_retval)
 {
     _retval = mWorkingPath;
     return NS_OK;
 }
 
+typedef struct {
+  WORD wLanguage;
+  WORD wCodePage;
+} LANGANDCODEPAGE;
+
+NS_IMETHODIMP
+nsLocalFile::GetVersionInfoField(const nsACString &aField, nsAString& _retval)
+{
+    nsresult rv = ResolveAndStat();
+    if (NS_FAILED(rv))
+        return rv;
+
+    char *pathCopy = ToNewCString(mFollowSymlinks ? mResolvedPath : mWorkingPath);
+    if (!pathCopy)
+        return NS_ERROR_OUT_OF_MEMORY;
+
+    // Per http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/resources/versioninformation/versioninformationreference/versioninformationfunctions/getfileversioninfosize.asp
+    // if the "short" version of this file name is > 125 characters, 
+    // GetFileVersionInfoSize will not work (for Win9x compatibility)
+    char shortPath[MAX_PATH];
+    ::GetShortPathName(pathCopy, shortPath, sizeof(shortPath));
+    if (strlen(shortPath) >= 126) 
+    {
+        nsMemory::Free(pathCopy);
+        pathCopy = nsnull;
+        return NS_ERROR_FAILURE;
+    }
+
+    DWORD dummy;
+    DWORD size = ::GetFileVersionInfoSize(pathCopy, &dummy);
+    if (size) 
+    {
+        void* ver = malloc(size);  
+        if (ver) 
+        {
+            memset(ver, 0, size);
+
+            if (::GetFileVersionInfo(pathCopy, 0, size, ver)) 
+            {
+                LANGANDCODEPAGE* translate;
+                UINT pageCount;
+                BOOL queryResult = ::VerQueryValue(ver, "\\VarFileInfo\\Translation", 
+                                                   (void**)&translate, &pageCount);
+                if (queryResult && translate) 
+                {
+                    for (PRInt32 i = 0; i < 2; ++i) 
+                    { 
+                        nsCAutoString field(aField);
+                        TCHAR subBlock[MAX_PATH];
+                        wsprintf(subBlock, "\\StringFileInfo\\%04x%04x\\%s", 
+                                (i == 0 ? translate[0].wLanguage : ::GetUserDefaultLangID()),
+                                translate[0].wCodePage, field.get());
+
+                        LPVOID value = NULL;
+                        UINT size;
+                        queryResult = ::VerQueryValue(ver, subBlock, &value, &size);
+                        if (queryResult && value)
+                        {
+                            NS_CopyNativeToUnicode(nsDependentCString((const char*)value), _retval);
+                            if (!_retval.IsEmpty())
+                                break;
+                        }
+                    }
+                }
+            }
+            free(ver);
+            ver = nsnull;
+        }
+        else
+            rv = NS_ERROR_OUT_OF_MEMORY;
+    }
+
+    if (pathCopy)
+    {
+        nsMemory::Free(pathCopy);
+        pathCopy = nsnull;
+    }
+
+    return rv;
+}
+ 
 nsresult
 nsLocalFile::CopySingleFile(nsIFile *sourceFile, nsIFile *destParent, const nsACString &newName, 
                             PRBool followSymlinks, PRBool move)
 {
     nsresult rv;
     nsCAutoString filePath;
 
     // get the path that we are going to copy to.
Index: xpcom/io/nsLocalFileWin.h
===================================================================
RCS file: /cvsroot/mozilla/xpcom/io/nsLocalFileWin.h,v
retrieving revision 1.21
diff -p -u -8 -r1.21 nsLocalFileWin.h
--- xpcom/io/nsLocalFileWin.h	17 Jun 2004 16:37:25 -0000	1.21
+++ xpcom/io/nsLocalFileWin.h	21 Feb 2005 11:23:16 -0000
@@ -42,30 +42,31 @@
 #define _nsLocalFileWIN_H_
 
 #include "nscore.h"
 #include "nsError.h"
 #include "nsString.h"
 #include "nsCRT.h"
 #include "nsIFile.h"
 #include "nsIFactory.h"
+#include "nsILocalFileWin.h"
 
 #include "windows.h"
 
 // For older version (<6.0) of the VC Compiler
 #if (_MSC_VER == 1100)
 #include <objbase.h>
 DEFINE_OLEGUID(IID_IPersistFile, 0x0000010BL, 0, 0);
 #endif
 
 #include "shlobj.h"
 
 #include <sys/stat.h>
 
-class nsLocalFile : public nsILocalFile
+class nsLocalFile : public nsILocalFileWin
 {
 public:
     NS_DEFINE_STATIC_CID_ACCESSOR(NS_LOCAL_FILE_CID)
     
     nsLocalFile();
 
     static NS_METHOD nsLocalFileConstructor(nsISupports* outer, const nsIID& aIID, void* *aInstancePtr);
 
@@ -73,16 +74,19 @@ public:
     NS_DECL_ISUPPORTS
     
     // nsIFile interface
     NS_DECL_NSIFILE
     
     // nsILocalFile interface
     NS_DECL_NSILOCALFILE
 
+    // nsILocalFileWin interface
+    NS_DECL_NSILOCALFILEWIN
+
 public:
     static void GlobalInit();
     static void GlobalShutdown();
 
 private:
     nsLocalFile(const nsLocalFile& other);
     ~nsLocalFile() {}
 
