Merge mozilla-central and mozilla-inbound in the hope to reopen soon a CLOSED TREE
authorMarco Bonardo <mbonardo@mozilla.com>
Fri, 05 Aug 2011 17:09:02 +0200
changeset 73901 c7931e07dd4dcda4916d58753bfdb933372e8148
parent 73900 fff506a4889bb5df486975758acc5373dc32b86c (current diff)
parent 73841 5684f06138f39e6c6b95cb076cdbe449875a1c2d (diff)
child 73902 be090ee1747a378bef88e392164ad01548d912ed
child 73904 b4fb6f334a4fa92421afa8468f815e8fb8e1c759
push id2
push userbsmedberg@mozilla.com
push dateFri, 19 Aug 2011 14:38:13 +0000
milestone8.0a1
Merge mozilla-central and mozilla-inbound in the hope to reopen soon a CLOSED TREE
--- a/browser/base/content/tabview/ui.js
+++ b/browser/base/content/tabview/ui.js
@@ -428,17 +428,18 @@ let UI = {
   // Parameters:
   //
   // options
   //  dontSetActiveTabInGroup bool for not setting active tab in group
   setActive: function UI_setActive(item, options) {
     Utils.assert(item, "item must be given");
 
     if (item.isATabItem) {
-      GroupItems.setActiveGroupItem(item.parent);
+      if (item.parent)
+        GroupItems.setActiveGroupItem(item.parent);
       this._setActiveTab(item);
     } else {
       GroupItems.setActiveGroupItem(item);
       if (!options || !options.dontSetActiveTabInGroup) {
         let activeTab = item.getActiveTab()
         if (activeTab)
           this._setActiveTab(activeTab);
       }
--- a/browser/base/content/test/tabview/browser_tabview_privatebrowsing.js
+++ b/browser/base/content/test/tabview/browser_tabview_privatebrowsing.js
@@ -17,17 +17,17 @@ function test() {
   showTabView(onTabViewLoadedAndShown);
 }
 
 // -----------
 function onTabViewLoadedAndShown() {
   ok(TabView.isVisible(), "Tab View is visible");
 
   // Establish initial state
-  contentWindow = document.getElementById("tab-view").contentWindow;
+  contentWindow = TabView.getContentWindow();
   verifyCleanState("start");
 
   // register a clean up for private browsing just in case
   registerCleanupFunction(function() {
     pb.privateBrowsingEnabled = false;
   });
 
   // create a group
@@ -45,50 +45,47 @@ function onTabViewLoadedAndShown() {
   // collect the group titles
   let count = contentWindow.GroupItems.groupItems.length;
   for (let a = 0; a < count; a++) {
     let gi = contentWindow.GroupItems.groupItems[a];
     groupTitles[a] = gi.getTitle();
   }
 
   // Create a second tab
-  gBrowser.loadOneTab("about:robots", { inBackground: false });
+  gBrowser.addTab("about:robots");
   is(gBrowser.tabs.length, 2, "we now have 2 tabs");
   registerCleanupFunction(function() {
     gBrowser.removeTab(gBrowser.tabs[1]);
   });
 
   afterAllTabsLoaded(function() {
-    showTabView(function() {
-      // Get normal tab urls
-      for (let a = 0; a < gBrowser.tabs.length; a++)
-        normalURLs.push(gBrowser.tabs[a].linkedBrowser.currentURI.spec);
+    // Get normal tab urls
+    for (let a = 0; a < gBrowser.tabs.length; a++)
+      normalURLs.push(gBrowser.tabs[a].linkedBrowser.currentURI.spec);
 
-      // verify that we're all set up for our test
-      verifyNormal();
+    // verify that we're all set up for our test
+    verifyNormal();
 
-      // go into private browsing and make sure Tab View becomes hidden
-      togglePBAndThen(function() {
-        whenTabViewIsHidden(function() {
-          ok(!TabView.isVisible(), "Tab View is no longer visible");
-
-          verifyPB();
+    // go into private browsing and make sure Tab View becomes hidden
+    togglePBAndThen(function() {
+      whenTabViewIsHidden(function() {
+        ok(!TabView.isVisible(), "Tab View is no longer visible");
+        verifyPB();
 
-          // exit private browsing and make sure Tab View is shown again
-          togglePBAndThen(function() {
-            whenTabViewIsShown(function() {
-              ok(TabView.isVisible(), "Tab View is visible again");
-              verifyNormal();
+        // exit private browsing and make sure Tab View is shown again
+        togglePBAndThen(function() {
+          whenTabViewIsShown(function() {
+            ok(TabView.isVisible(), "Tab View is visible again");
+            verifyNormal();
 
-              hideTabView(onTabViewHidden);
-            });
+            hideTabView(onTabViewHidden);
           });
         });
       });
-    }); 
+    });
   });
 }
 
 // -----------
 function onTabViewHidden() {
   ok(!TabView.isVisible(), "Tab View is not visible");
   
   // go into private browsing and make sure Tab View remains hidden
@@ -98,16 +95,18 @@ function onTabViewHidden() {
     
     // turn private browsing back off
     togglePBAndThen(function() {
       verifyNormal();
       
       // end game
       ok(!TabView.isVisible(), "we finish with Tab View not visible");
       registerCleanupFunction(verifyCleanState); // verify after all cleanups
+
+      gBrowser.selectedTab = gBrowser.tabs[0];
       finish();
     });
   });
 }
 
 // ----------
 function verifyCleanState(mode) {
   let prefix = "we " + (mode || "finish") + " with ";
--- a/browser/components/places/src/PlacesUIUtils.jsm
+++ b/browser/components/places/src/PlacesUIUtils.jsm
@@ -807,18 +807,20 @@ var PlacesUIUtils = {
       args.AppendElement(uriList);      
       browserWindow = Services.ww.openWindow(aWindow,
                                              "chrome://browser/content/browser.xul",
                                              null, "chrome,dialog=no,all", args);
       return;
     }
 
     var loadInBackground = where == "tabshifted" ? true : false;
-    var replaceCurrentTab = where == "tab" ? false : true;
-    browserWindow.gBrowser.loadTabs(urls, loadInBackground, replaceCurrentTab);
+    // For consistency, we want all the bookmarks to open in new tabs, instead
+    // of having one of them replace the currently focused tab.  Hence we call
+    // loadTabs with aReplace set to false.
+    browserWindow.gBrowser.loadTabs(urls, loadInBackground, false);
   },
 
   /**
    * Helper method for methods which are forced to take a view/window
    * parameter as an optional parameter.  It will be removed post Fx4.
    */
   _getWindow: function PUIU__getWindow(aView) {
     if (aView) {
--- a/browser/components/preferences/aboutPermissions.js
+++ b/browser/components/preferences/aboutPermissions.js
@@ -87,28 +87,38 @@ Site.prototype = {
   /**
    * Gets the favicon to use for the site. The callback only gets called if
    * a favicon is found for either the http URI or the https URI.
    *
    * @param aCallback
    *        A callback function that takes a favicon image URL as a parameter.
    */
   getFavicon: function Site_getFavicon(aCallback) {
+    let callbackExecuted = false;
     function faviconDataCallback(aURI, aDataLen, aData, aMimeType) {
+      // We don't need a second callback, so we can ignore it to avoid making
+      // a second database query for the favicon data.
+      if (callbackExecuted) {
+        return;
+      }
       try {
-        aCallback(aURI.spec);
+        // Use getFaviconLinkForIcon to get image data from the database instead
+        // of using the favicon URI to fetch image data over the network.
+        aCallback(gFaviconService.getFaviconLinkForIcon(aURI).spec);
+        callbackExecuted = true;
       } catch (e) {
         Cu.reportError("AboutPermissions: " + e);
       }
     }
 
     // Try to find favicion for both URIs. Callback will only be called if a
-    // favicon URI is found, so this means we'll always prefer the https favicon.
+    // favicon URI is found. We'll ignore the second callback if it is called,
+    // so this means we'll always prefer the https favicon.
+    gFaviconService.getFaviconURLForPage(this.httpsURI, faviconDataCallback);
     gFaviconService.getFaviconURLForPage(this.httpURI, faviconDataCallback);
-    gFaviconService.getFaviconURLForPage(this.httpsURI, faviconDataCallback);
   },
 
   /**
    * Gets the number of history visits for the site.
    *
    * @param aCallback
    *        A function that takes the visit count (a number) as a parameter.
    */
--- a/browser/components/privatebrowsing/src/nsPrivateBrowsingService.js
+++ b/browser/components/privatebrowsing/src/nsPrivateBrowsingService.js
@@ -498,51 +498,53 @@ PrivateBrowsingService.prototype = {
     // Allowing observers to set the private browsing status from their
     // notification handlers is not desired, because it will change the
     // status of the service while it's in the process of another transition.
     // So, we detect a reentrant call here and throw an error.
     // This is documented in nsIPrivateBrowsingService.idl.
     if (this._currentStatus != STATE_IDLE)
       throw Cr.NS_ERROR_FAILURE;
 
+    if (val == this._inPrivateBrowsing)
+      return;
+
     try {
+      if (val) {
+        if (!this._canEnterPrivateBrowsingMode())
+          return;
+      }
+      else {
+        if (!this._canLeavePrivateBrowsingMode())
+          return;
+      }
+
+      this._ensureCanCloseWindows();
+
+      // start the transition now that we know that we can
       this._currentStatus = STATE_TRANSITION_STARTED;
 
-      if (val != this._inPrivateBrowsing) {
-        if (val) {
-          if (!this._canEnterPrivateBrowsingMode())
-            return;
-        }
-        else {
-          if (!this._canLeavePrivateBrowsingMode())
-            return;
-        }
+      this._autoStarted = this._prefs.getBoolPref("browser.privatebrowsing.autostart");
+      this._inPrivateBrowsing = val != false;
 
-        this._ensureCanCloseWindows();
+      let data = val ? "enter" : "exit";
 
-        this._autoStarted = this._prefs.getBoolPref("browser.privatebrowsing.autostart");
-        this._inPrivateBrowsing = val != false;
+      let quitting = Cc["@mozilla.org/supports-PRBool;1"].
+                     createInstance(Ci.nsISupportsPRBool);
+      quitting.data = this._quitting;
 
-        let data = val ? "enter" : "exit";
-
-        let quitting = Cc["@mozilla.org/supports-PRBool;1"].
-                       createInstance(Ci.nsISupportsPRBool);
-        quitting.data = this._quitting;
-
-        // notify observers of the pending private browsing mode change
-        this._obs.notifyObservers(quitting, "private-browsing-change-granted", data);
+      // notify observers of the pending private browsing mode change
+      this._obs.notifyObservers(quitting, "private-browsing-change-granted", data);
 
-        // destroy the current session and start initial cleanup
-        this._onBeforePrivateBrowsingModeChange();
+      // destroy the current session and start initial cleanup
+      this._onBeforePrivateBrowsingModeChange();
 
-        this._obs.notifyObservers(quitting, "private-browsing", data);
+      this._obs.notifyObservers(quitting, "private-browsing", data);
 
-        // load the appropriate session
-        this._onAfterPrivateBrowsingModeChange();
-      }
+      // load the appropriate session
+      this._onAfterPrivateBrowsingModeChange();
     } catch (ex) {
       // We aborted the transition to/from private browsing, we must restore the
       // beforeunload handling on all the windows for which we switched it off.
       for (let i = 0; i < this._windowsToClose.length; i++)
         this._windowsToClose[i].docShell.contentViewer.resetCloseWindow();
       // We don't log an error when the transition is canceled from beforeunload
       if (ex != Cr.NS_ERROR_ABORT)
         Cu.reportError("Exception thrown while processing the " +
--- a/browser/components/sessionstore/content/aboutSessionRestore.js
+++ b/browser/components/sessionstore/content/aboutSessionRestore.js
@@ -43,22 +43,18 @@ var gTreeData;
 
 // Page initialization
 
 window.onload = function() {
   // the crashed session state is kept inside a textbox so that SessionStore picks it up
   // (for when the tab is closed or the session crashes right again)
   var sessionData = document.getElementById("sessionData");
   if (!sessionData.value) {
-    var ss = Cc["@mozilla.org/browser/sessionstartup;1"].getService(Ci.nsISessionStartup);
-    sessionData.value = ss.state;
-    if (!sessionData.value) {
-      document.getElementById("errorTryAgain").disabled = true;
-      return;
-    }
+    document.getElementById("errorTryAgain").disabled = true;
+    return;
   }
 
   // remove unneeded braces (added for compatibility with Firefox 2.0 and 3.0)
   if (sessionData.value.charAt(0) == '(')
     sessionData.value = sessionData.value.slice(1, -1);
   try {
     gStateObject = JSON.parse(sessionData.value);
   }
--- a/browser/components/sessionstore/test/browser/browser_588426.js
+++ b/browser/components/sessionstore/test/browser/browser_588426.js
@@ -2,24 +2,40 @@
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
 function test() {
   let state = { windows: [{ tabs: [
       {entries: [{url: "about:mozilla"}], hidden: true},
       {entries: [{url: "about:robots"}], hidden: true}
   ] }] };
 
-  let finalState = { windows: [{ tabs: [
-      {entries: [{url: "about:blank"}]}
-  ] }] };
-
   waitForExplicitFinish();
 
-  waitForBrowserState(state, function () {
-    is(gBrowser.tabs.length, 2, "two tabs were restored");
-    is(gBrowser.visibleTabs.length, 1, "one tab is visible");
+  newWindowWithState(state, function (win) {
+    registerCleanupFunction(function () win.close());
 
-    let tab = gBrowser.visibleTabs[0];
+    is(win.gBrowser.tabs.length, 2, "two tabs were restored");
+    is(win.gBrowser.visibleTabs.length, 1, "one tab is visible");
+
+    let tab = win.gBrowser.visibleTabs[0];
     is(tab.linkedBrowser.currentURI.spec, "about:mozilla", "visible tab is about:mozilla");
 
-    waitForBrowserState(finalState, finish);
+    finish();
   });
 }
+
+function newWindowWithState(state, callback) {
+  let opts = "chrome,all,dialog=no,height=800,width=800";
+  let win = window.openDialog(getBrowserURL(), "_blank", opts);
+
+  win.addEventListener("load", function onLoad() {
+    win.removeEventListener("load", onLoad, false);
+
+    executeSoon(function () {
+      win.addEventListener("SSWindowStateReady", function onReady() {
+        win.removeEventListener("SSWindowStateReady", onReady, false);
+        executeSoon(function () callback(win));
+      }, false);
+
+      ss.setWindowState(win, JSON.stringify(state), true);
+    });
+  }, false);
+}
--- a/browser/components/sessionstore/test/browser/browser_590563.js
+++ b/browser/components/sessionstore/test/browser/browser_590563.js
@@ -1,65 +1,78 @@
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
-let stateBackup = ss.getBrowserState();
-
 function test() {
-  waitForExplicitFinish();
-
   let oldState = {
     windows: [{
       tabs: [
         { entries: [{ url: "about:robots" }], hidden: true },
         { entries: [{ url: "about:blank" }], hidden: false }
       ]
     }]
   };
   let pageData = {
     url: "about:sessionrestore",
     formdata: { "#sessionData": "(" + JSON.stringify(oldState) + ")" }
   };
   let state = { windows: [{ tabs: [{ entries: [pageData] }] }] };
 
-  // The form data will be restored before SSTabRestored, so we want to listen
-  // for that on the currently selected tab (it will be reused)
-  gBrowser.selectedTab.addEventListener("SSTabRestored", onSSTabRestored, true);
+  waitForExplicitFinish();
+
+  newWindowWithState(state, function (win) {
+    registerCleanupFunction(function () win.close());
+
+    is(gBrowser.tabs.length, 1, "The total number of tabs should be 1");
+    is(gBrowser.visibleTabs.length, 1, "The total number of visible tabs should be 1");
 
-  ss.setBrowserState(JSON.stringify(state));
+    executeSoon(function () {
+      waitForFocus(function () {
+        middleClickTest(win);
+        finish();
+      }, win);
+    });
+  });
 }
 
-function onSSTabRestored(aEvent) {
-  gBrowser.selectedTab.removeEventListener("SSTabRestored", onSSTabRestored, true);
-
-  is(gBrowser.tabs.length, 1, "The total number of tabs should be 1");
-  is(gBrowser.visibleTabs.length, 1, "The total number of visible tabs should be 1");
-
-  executeSoon(middleClickTest);
-}
-
-function middleClickTest() {
-  let tree = gBrowser.selectedBrowser.contentDocument.getElementById("tabList");
+function middleClickTest(win) {
+  let browser = win.gBrowser.selectedBrowser;
+  let tree = browser.contentDocument.getElementById("tabList");
   is(tree.view.rowCount, 3, "There should be three items");
 
   let x = {}, y = {}, width = {}, height = {};
 
   // click on the first tab item
   tree.treeBoxObject.getCoordsForCellItem(1, tree.columns[1], "text", x, y, width, height);
   EventUtils.synthesizeMouse(tree.body, x.value, y.value, { button: 1 },
-                             gBrowser.selectedBrowser.contentWindow);
+                             browser.contentWindow);
   // click on the second tab item
   tree.treeBoxObject.getCoordsForCellItem(2, tree.columns[1], "text", x, y, width, height);
   EventUtils.synthesizeMouse(tree.body, x.value, y.value, { button: 1 },
-                             gBrowser.selectedBrowser.contentWindow);
+                             browser.contentWindow);
 
-  is(gBrowser.tabs.length, 3,
+  is(win.gBrowser.tabs.length, 3,
      "The total number of tabs should be 3 after restoring 2 tabs by middle click.");
-  is(gBrowser.visibleTabs.length, 3,
+  is(win.gBrowser.visibleTabs.length, 3,
      "The total number of visible tabs should be 3 after restoring 2 tabs by middle click");
-
-  cleanup();
 }
 
-function cleanup() {
-   ss.setBrowserState(stateBackup);
-   executeSoon(finish);
+function newWindowWithState(state, callback) {
+  let opts = "chrome,all,dialog=no,height=800,width=800";
+  let win = window.openDialog(getBrowserURL(), "_blank", opts);
+
+  win.addEventListener("load", function onLoad() {
+    win.removeEventListener("load", onLoad, false);
+
+    let tab = win.gBrowser.selectedTab;
+
+    // The form data will be restored before SSTabRestored, so we want to listen
+    // for that on the currently selected tab (it will be reused)
+    tab.addEventListener("SSTabRestored", function onRestored() {
+      tab.removeEventListener("SSTabRestored", onRestored, true);
+      callback(win);
+    }, true);
+
+    executeSoon(function () {
+      ss.setWindowState(win, JSON.stringify(state), true);
+    });
+  }, false);
 }
--- a/browser/devtools/scratchpad/scratchpad.xul
+++ b/browser/devtools/scratchpad/scratchpad.xul
@@ -181,22 +181,22 @@
                 accesskey="&closeCmd.accesskey;"
                 command="sp-cmd-close"/>
     </menupopup>
   </menu>
 
   <menu id="sp-edit-menu" label="&editMenu.label;"
         accesskey="&editMenu.accesskey;">
     <menupopup id="sp-menu_editpopup">
-      <menuitem id="sp-menu_undo"
+      <menuitem id="sp-menu-undo"
                 label="&undoCmd.label;"
                 key="key_undo"
                 accesskey="&undoCmd.accesskey;"
                 disabled="true"
-                oncommand="cmd_undo"/>
+                command="cmd_undo"/>
       <menuitem id="sp-menu-redo"
                 label="&redoCmd.label;"
                 key="key_redo"
                 disabled="true"
                 accesskey="&redoCmd.accesskey;"
                 command="cmd_redo"/>
       <menuseparator/>
       <menuitem id="sp-menu-cut"
--- a/browser/locales/en-US/chrome/browser/preferences/advanced.dtd
+++ b/browser/locales/en-US/chrome/browser/preferences/advanced.dtd
@@ -59,17 +59,17 @@
 <!ENTITY updateTab.label                 "Update">
 
 <!ENTITY autoCheck.label                 "Automatically check for updates to:">
 <!ENTITY enableAppUpdate.label           "&brandShortName;">
 <!ENTITY enableAppUpdate.accesskey       "F">
 <!ENTITY enableAddonsUpdate2.label       "Add-ons">
 <!ENTITY enableAddonsUpdate2.accesskey   "n">
 <!ENTITY enableSearchUpdate.label        "Search Engines">
-<!ENTITY enableSearchUpdate.accesskey    "h">
+<!ENTITY enableSearchUpdate.accesskey    "E">
 <!ENTITY whenUpdatesFound.label          "When updates to &brandShortName; are found:">
 <!ENTITY askMe.label                     "Ask me what I want to do">
 <!ENTITY askMe.accesskey                 "k">
 <!ENTITY modeAutomatic.label             "Automatically download and install the update">
 <!ENTITY modeAutomatic.accesskey         "d">
 <!ENTITY modeAutoAddonWarn.label         "Warn me if this will disable any of my add-ons">
 <!ENTITY modeAutoAddonWarn.accesskey     "W">
 <!ENTITY updateHistory.label             "Show Update History">
--- a/browser/themes/winstripe/browser/browser-aero.css
+++ b/browser/themes/winstripe/browser/browser-aero.css
@@ -136,20 +136,20 @@
   #nav-bar + #customToolbars + #PersonalToolbar[collapsed=true] + #TabsToolbar[tabsontop=false]:last-child:not(:-moz-lwtheme) {
     background-color: transparent !important;
     color: black;
     text-shadow: 0 0 .5em white, 0 0 .5em white, 0 1px 0 rgba(255,255,255,.4);
     border-left-style: none !important;
     border-right-style: none !important;
   }
 
-  #toolbar-menubar :-moz-any(@primaryToolbarButtons@):not(#alltabs-button):not(#tabview-button):not(#new-tab-button) > .toolbarbutton-icon:not(:-moz-lwtheme),
-  #TabsToolbar[tabsontop=true] :-moz-any(@primaryToolbarButtons@):not(#alltabs-button):not(#tabview-button):not(#new-tab-button) > .toolbarbutton-icon:not(:-moz-lwtheme),
-  #navigator-toolbox[tabsontop=false] > #nav-bar :-moz-any(@primaryToolbarButtons@):not(#alltabs-button):not(#tabview-button):not(#new-tab-button) > .toolbarbutton-icon:not(:-moz-lwtheme),
-  #nav-bar + #customToolbars + #PersonalToolbar[collapsed=true] + #TabsToolbar[tabsontop=false]:last-child :-moz-any(@primaryToolbarButtons@):not(#alltabs-button):not(#tabview-button):not(#new-tab-button) > .toolbarbutton-icon:not(:-moz-lwtheme) {
+  #toolbar-menubar :-moz-any(@primaryToolbarButtons@):not(:-moz-any(#alltabs-button,#tabview-button,#new-tab-button,#sync-button[status])) > .toolbarbutton-icon:not(:-moz-lwtheme),
+  #TabsToolbar[tabsontop=true] :-moz-any(@primaryToolbarButtons@):not(:-moz-any(#alltabs-button,#tabview-button,#new-tab-button,#sync-button[status])) > .toolbarbutton-icon:not(:-moz-lwtheme),
+  #navigator-toolbox[tabsontop=false] > #nav-bar :-moz-any(@primaryToolbarButtons@):not(:-moz-any(#alltabs-button,#tabview-button,#new-tab-button,#sync-button[status])) > .toolbarbutton-icon:not(:-moz-lwtheme),
+  #nav-bar + #customToolbars + #PersonalToolbar[collapsed=true] + #TabsToolbar[tabsontop=false]:last-child :-moz-any(@primaryToolbarButtons@):not(:-moz-any(#alltabs-button,#tabview-button,#new-tab-button,#sync-button[status])) > .toolbarbutton-icon:not(:-moz-lwtheme) {
     list-style-image: url("chrome://browser/skin/Toolbar-inverted.png");
   }
 
   /* Vertical toolbar border */
   #main-window[sizemode=normal] #navigator-toolbox::after,
   #main-window[sizemode=normal] #navigator-toolbox[tabsontop=true] > toolbar:not(#toolbar-menubar):not(#TabsToolbar),
   #main-window[sizemode=normal] #navigator-toolbox[tabsontop=false] > toolbar:not(#toolbar-menubar):not(#nav-bar) {
     border-left: 1px solid @toolbarShadowColor@;
--- a/browser/themes/winstripe/browser/browser.css
+++ b/browser/themes/winstripe/browser/browser.css
@@ -669,17 +669,17 @@ menuitem.bookmark-item {
   counter-reset: smallicons;
 }
 
 @navbarLargeIcons@ {
   -moz-padding-start: 0;
   -moz-padding-end: 2px;
 }
 
-@navbarLargeIcons@ :-moz-any(@primaryToolbarButtons@):not(#alltabs-button):not(#tabview-button):not(#new-tab-button) > .toolbarbutton-icon {
+@navbarLargeIcons@ :-moz-any(@primaryToolbarButtons@):not(:-moz-any(#alltabs-button,#tabview-button,#new-tab-button,#sync-button[status])) > .toolbarbutton-icon {
   list-style-image: url("chrome://browser/skin/Toolbar.png") !important;
 }
 
 @navbarLargeIcons@ .toolbarbutton-1 > .toolbarbutton-menubutton-button,
 @navbarLargeIcons@ .toolbarbutton-1 > .toolbarbutton-menubutton-dropmarker,
 @navbarLargeIcons@ .toolbarbutton-1 {
   -moz-appearance: none;
   padding: 1px 5px;
--- a/db/sqlite3/src/Makefile.in
+++ b/db/sqlite3/src/Makefile.in
@@ -72,16 +72,22 @@ sqlite-version.h: sqlite-version.py sqli
 $(DEFFILE): sqlite.def
 	@$(PYTHON) $(topsrcdir)/config/Preprocessor.py $(DEFINES) \
 	  $(srcdir)/sqlite.def > $(DEFFILE)
 
 export:: sqlite-version.h
 endif
 endif
 
+# XXX Force -O2 optimisation on Mac because using the default -O3 causes
+# crashes. See bug 676499.
+ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT))
+MODULE_OPTIMIZE_FLAGS = -O2
+endif
+
 EXPORTS = \
   sqlite3.h \
   $(NULL)
 
 CSRCS = \
   sqlite3.c \
   $(NULL)
 
--- a/mobile/chrome/content/content.js
+++ b/mobile/chrome/content/content.js
@@ -1346,18 +1346,18 @@ var SelectionHandler = {
     let json = aMessage.json;
 
     switch (aMessage.name) {
       case "Browser:SelectionStart": {
         // Clear out the text cache
         this.selectedText = "";
 
         // if this is an iframe, dig down to find the document that was clicked
-        let x = json.x;
-        let y = json.y;
+        let x = json.x - scrollOffset.x;
+        let y = json.y - scrollOffset.y;
         let offset = scrollOffset;
         let elem = utils.elementFromPoint(x, y, true, false);
         while (elem && (elem instanceof HTMLIFrameElement || elem instanceof HTMLFrameElement)) {
           // adjust client coordinates' origin to be top left of iframe viewport
           let rect = elem.getBoundingClientRect();
           scrollOffset = ContentScroll.getScrollOffset(elem.ownerDocument.defaultView);
           offset.x += rect.left;
           x -= rect.left;
@@ -1374,18 +1374,18 @@ var SelectionHandler = {
         let currentDocShell = contentWindow.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIWebNavigation).QueryInterface(Ci.nsIDocShell);
 
         // Remove any previous selected or created ranges. Tapping anywhere on a
         // page will create an empty range.
         let selection = contentWindow.getSelection();
         selection.removeAllRanges();
 
         // Position the caret using a fake mouse click
-        utils.sendMouseEventToWindow("mousedown", x - scrollOffset.x, y - scrollOffset.y, 0, 1, 0, true);
-        utils.sendMouseEventToWindow("mouseup", x - scrollOffset.x, y - scrollOffset.y, 0, 1, 0, true);
+        utils.sendMouseEventToWindow("mousedown", x, y, 0, 1, 0, true);
+        utils.sendMouseEventToWindow("mouseup", x, y, 0, 1, 0, true);
 
         // Select the word nearest the caret
         try {
           let selcon = currentDocShell.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsISelectionDisplay).QueryInterface(Ci.nsISelectionController);
           selcon.wordMove(false, false);
           selcon.wordMove(true, true);
         } catch(e) {
           // If we couldn't select the word at the given point, bail
@@ -1418,17 +1418,17 @@ var SelectionHandler = {
 
       case "Browser:SelectionEnd": {
         let tap = { x: json.x - this.cache.offset.x, y: json.y - this.cache.offset.y };
         pointInSelection = (tap.x > this.cache.rect.left && tap.x < this.cache.rect.right) && (tap.y > this.cache.rect.top && tap.y < this.cache.rect.bottom);
 
         try {
           // The selection might already be gone
           if (this.contentWindow)
-            this.contentWindow.getSelection().collapseToStart();
+            this.contentWindow.getSelection().removeAllRanges();
           this.contentWindow = null;
         } catch(e) {}
 
         if (pointInSelection && this.selectedText.length) {
           let clipboard = Cc["@mozilla.org/widget/clipboardhelper;1"].getService(Ci.nsIClipboardHelper);
           clipboard.copyString(this.selectedText);
           sendAsyncMessage("Browser:SelectionCopied", { succeeded: true });
         } else {
@@ -1445,29 +1445,34 @@ var SelectionHandler = {
         let elemUnder = elementFromPoint(json.x - scrollOffset.x, json.y - scrollOffset.y);
         if (elemUnder && elemUnder instanceof Ci.nsIDOMHTMLInputElement || elemUnder instanceof Ci.nsIDOMHTMLTextAreaElement)
           return;
 
         // Limit the selection to the initial content window (don't leave or enter iframes)
         if (elemUnder && elemUnder.ownerDocument.defaultView != this.contentWindow)
           return;
 
+        // Use fake mouse events to update the selection
         if (json.type == "end") {
-          this.cache.end.x = json.x - scrollOffset.x;
-          this.cache.end.y = json.y - scrollOffset.y;
-          utils.sendMouseEventToWindow("mousedown", this.cache.end.x, this.cache.end.y, 0, 1, Ci.nsIDOMNSEvent.SHIFT_MASK, true);
-          utils.sendMouseEventToWindow("mouseup", this.cache.end.x, this.cache.end.y, 0, 1, Ci.nsIDOMNSEvent.SHIFT_MASK, true);
+          // Keep the cache in "client" coordinates, but translate for the mouse event
+          this.cache.end = { x: json.x, y: json.y };
+          let end = { x: this.cache.end.x - scrollOffset.x, y: this.cache.end.y - scrollOffset.y };
+          utils.sendMouseEventToWindow("mousedown", end.x, end.y, 0, 1, Ci.nsIDOMNSEvent.SHIFT_MASK, true);
+          utils.sendMouseEventToWindow("mouseup", end.x, end.y, 0, 1, Ci.nsIDOMNSEvent.SHIFT_MASK, true);
         } else {
-          this.cache.start.x = json.x - scrollOffset.x;
-          this.cache.start.y = json.y - scrollOffset.y;
-          utils.sendMouseEventToWindow("mousedown", this.cache.start.x, this.cache.start.y, 0, 1, 0, true);
-          // Don't cause a click. A mousedown is enough to move the caret
-          //utils.sendMouseEventToWindow("mouseup", this.cache.start.x, this.cache.start.y, 0, 1, 0, true);
-          utils.sendMouseEventToWindow("mousedown", this.cache.end.x, this.cache.end.y, 0, 1, Ci.nsIDOMNSEvent.SHIFT_MASK, true);
-          utils.sendMouseEventToWindow("mouseup", this.cache.end.x, this.cache.end.y, 0, 1, Ci.nsIDOMNSEvent.SHIFT_MASK, true);
+          // Keep the cache in "client" coordinates, but translate for the mouse event
+          this.cache.start = { x: json.x, y: json.y };
+          let start = { x: this.cache.start.x - scrollOffset.x, y: this.cache.start.y - scrollOffset.y };
+          let end = { x: this.cache.end.x - scrollOffset.x, y: this.cache.end.y - scrollOffset.y };
+
+          utils.sendMouseEventToWindow("mousedown", start.x, start.y, 0, 0, 0, true);
+          utils.sendMouseEventToWindow("mouseup", start.x, start.y, 0, 0, 0, true);
+
+          utils.sendMouseEventToWindow("mousedown", end.x, end.y, 0, 1, Ci.nsIDOMNSEvent.SHIFT_MASK, true);
+          utils.sendMouseEventToWindow("mouseup", end.x, end.y, 0, 1, Ci.nsIDOMNSEvent.SHIFT_MASK, true);
         }
 
         // Cache the selected text since the selection might be gone by the time we get the "end" message
         let selection = this.contentWindow.getSelection()
         this.selectedText = selection.toString().trim();
 
         // Update the rect we use to test when finishing the clipboard operation
         let range = selection.getRangeAt(0).QueryInterface(Ci.nsIDOMNSRange);
@@ -1482,16 +1487,22 @@ var SelectionHandler = {
     for (let i=0; i<rects.length; i++) {
       if (i == 0) {
         cache.start.x = rects[i].left + aOffset.x;
         cache.start.y = rects[i].bottom + aOffset.y;
       }
       cache.end.x = rects[i].right + aOffset.x;
       cache.end.y = rects[i].bottom + aOffset.y;
     }
+
+    // Keep the handles from being positioned completely out of the selection range
+    const HANDLE_VERTICAL_MARGIN = 4;
+    cache.start.y -= HANDLE_VERTICAL_MARGIN;
+    cache.end.y -= HANDLE_VERTICAL_MARGIN;
+
     cache.rect = aRange.getBoundingClientRect();
     cache.rect.left += aOffset.x;
     cache.rect.top += aOffset.y;
     cache.rect.right += aOffset.x;
     cache.rect.bottom += aOffset.y;
     cache.offset = aOffset;
 
     return cache;
--- a/toolkit/components/passwordmgr/nsILoginManager.idl
+++ b/toolkit/components/passwordmgr/nsILoginManager.idl
@@ -109,26 +109,26 @@ interface nsILoginManager : nsISupports 
     /**
      * Fetch all logins in the login manager. An array is always returned;
      * if there are no logins the array is empty.
      *
      * @param count
      *        The number of elements in the array. JS callers can simply use
      *        the array's .length property and omit this param.
      * @param logins
-     *        An array of nsILoginInfo objects. 
+     *        An array of nsILoginInfo objects.
      *
      * NOTE: This can be called from JS as:
      *       var logins = pwmgr.getAllLogins();
      *       (|logins| is an array).
      */
     void getAllLogins([optional] out unsigned long count,
                       [retval, array, size_is(count)] out nsILoginInfo logins);
 
-    
+
     /**
      * Obtain a list of all hosts for which password saving is disabled.
      *
      * @param count
      *        The number of elements in the array. JS callers can simply use
      *        the array's .length property and omit this param.
      * @param hostnames
      *        An array of hostname strings, in origin URL format without a
@@ -185,17 +185,17 @@ interface nsILoginManager : nsISupports 
      *        An empty string ("") will match any value (except null).
      * @param aHttpRealm
      *        For protocol logins, this argument should be the HTTP Realm
      *        for which the login applies. This is obtained from the
      *        WWW-Authenticate header. See RFC2617. For form logins,
      *        specify null.
      *        An empty string ("") will match any value (except null).
      * @param logins
-     *        An array of nsILoginInfo objects. 
+     *        An array of nsILoginInfo objects.
      *
      * NOTE: This can be called from JS as:
      *       var logins = pwmgr.findLogins({}, hostname, ...);
      *
      */
     void findLogins(out unsigned long count, in AString aHostname,
                     in AString aActionURL,   in AString aHttpRealm,
                     [retval, array, size_is(count)] out nsILoginInfo logins);
--- a/toolkit/components/passwordmgr/nsILoginManagerPrompter.idl
+++ b/toolkit/components/passwordmgr/nsILoginManagerPrompter.idl
@@ -80,17 +80,17 @@ interface nsILoginManagerPrompter : nsIS
      * login should be changed. If the user consents, modifyLogin() will
      * be called.
      *
      * @param logins
      *        An array of existing logins.
      * @param count
      *        (length of the array)
      * @param aNewLogin
-     *        The new login. 
+     *        The new login.
      *
      * Note: Because the caller does not know the username of the login
      *       to be changed, aNewLogin.username and aNewLogin.usernameField
      *       will be set (using the user's selection) before modifyLogin()
      *       is called.
      */
     void promptToChangePasswordWithUsernames(
             [array, size_is(count)] in nsILoginInfo logins,
--- a/toolkit/components/passwordmgr/nsILoginManagerStorage.idl
+++ b/toolkit/components/passwordmgr/nsILoginManagerStorage.idl
@@ -63,17 +63,17 @@ interface nsILoginManagerStorage : nsISu
      * migration.
      *
      * @param aInputFile
      *        File to read for stored logins.
      * @param aOutputFile
      *        If non-null, file to output logins to.
      *
      */
-    void initWithFile(in nsIFile aInputFile, in nsIFile aOutputFile); 
+    void initWithFile(in nsIFile aInputFile, in nsIFile aOutputFile);
 
 
     /**
      * Store a new login in the storage module.
      *
      * @param aLogin
      *        The login to be added.
      *
@@ -132,17 +132,17 @@ interface nsILoginManagerStorage : nsISu
     /**
      * Fetch all logins in the login manager. An array is always returned;
      * if there are no logins the array is empty.
      *
      * @param count
      *        The number of elements in the array. JS callers can simply use
      *        the array's .length property and omit this param.
      * @param logins
-     *        An array of nsILoginInfo objects. 
+     *        An array of nsILoginInfo objects.
      *
      * NOTE: This can be called from JS as:
      *       var logins = pwmgr.getAllLogins();
      *       (|logins| is an array).
      */
     void getAllLogins([optional] out unsigned long count,
                       [retval, array, size_is(count)] out nsILoginInfo logins);
 
@@ -151,17 +151,17 @@ interface nsILoginManagerStorage : nsISu
     * Fetch all logins in the login manager. An array is always returned;
     * if there are no logins the array is empty. This does not decrypt logins
     * before returning the array
     *
     * @param count
     *        The number of elements in the array. JS callers can simply use
     *        the array's .length property and omit this param.
     * @param logins
-    *        An array of nsILoginInfo objects. 
+    *        An array of nsILoginInfo objects.
     *
     * NOTE: This can be called from JS as:
     *       var logins = pwmgr.getAllEncryptedLogins();
     *       (|logins| is an array).
     */
     void getAllEncryptedLogins([optional] out unsigned long count,
                                [retval, array, size_is(count)] out nsILoginInfo logins);
 
@@ -246,17 +246,17 @@ interface nsILoginManagerStorage : nsISu
      *        For form logins, this argument should be the URL to which the
      *        form will be submitted. For protocol logins, specify null.
      * @param aHttpRealm
      *        For protocol logins, this argument should be the HTTP Realm
      *        for which the login applies. This is obtained from the
      *        WWW-Authenticate header. See RFC2617. For form logins,
      *        specify null.
      * @param logins
-     *        An array of nsILoginInfo objects. 
+     *        An array of nsILoginInfo objects.
      *
      * NOTE: This can be called from JS as:
      *       var logins = pwmgr.findLogins({}, hostname, ...);
      *
      */
     void findLogins(out unsigned long count, in AString aHostname,
                     in AString aActionURL,   in AString aHttpRealm,
                     [retval, array, size_is(count)] out nsILoginInfo logins);
--- a/toolkit/components/passwordmgr/nsLoginInfo.js
+++ b/toolkit/components/passwordmgr/nsLoginInfo.js
@@ -40,17 +40,17 @@ const Ci = Components.interfaces;
 
 Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
 
 function nsLoginInfo() {}
 
 nsLoginInfo.prototype = {
 
     classID : Components.ID("{0f2f347c-1e4f-40cc-8efd-792dea70a85e}"),
-    QueryInterface: XPCOMUtils.generateQI([Ci.nsILoginInfo, Ci.nsILoginMetaInfo]), 
+    QueryInterface: XPCOMUtils.generateQI([Ci.nsILoginInfo, Ci.nsILoginMetaInfo]),
 
     // Allow storage-Legacy.js to get at the JS object so it can
     // slap on a few extra properties for internal use.
     get wrappedJSObject() {
         return this;
     },
 
     //
--- a/toolkit/components/passwordmgr/nsLoginManager.js
+++ b/toolkit/components/passwordmgr/nsLoginManager.js
@@ -201,17 +201,17 @@ LoginManager.prototype = {
      * _observer object
      *
      * Internal utility object, implements the nsIObserver interface.
      * Used to receive notification for: form submission, preference changes.
      */
     _observer : {
         _pwmgr : null,
 
-        QueryInterface : XPCOMUtils.generateQI([Ci.nsIObserver, 
+        QueryInterface : XPCOMUtils.generateQI([Ci.nsIObserver,
                                                 Ci.nsIFormSubmitObserver,
                                                 Ci.nsISupportsWeakReference]),
 
 
         // nsFormSubmitObserver
         notify : function (formElement, aWindow, actionURI) {
             this._pwmgr.log("observer notified for form submission.");
 
@@ -230,17 +230,17 @@ LoginManager.prototype = {
         // nsObserver
         observe : function (subject, topic, data) {
 
             if (topic == "nsPref:changed") {
                 var prefName = data;
                 this._pwmgr.log("got change to " + prefName + " preference");
 
                 if (prefName == "debug") {
-                    this._pwmgr._debug = 
+                    this._pwmgr._debug =
                         this._pwmgr._prefBranch.getBoolPref("debug");
                 } else if (prefName == "rememberSignons") {
                     this._pwmgr._remember =
                         this._pwmgr._prefBranch.getBoolPref("rememberSignons");
                 } else {
                     this._pwmgr.log("Oops! Pref not handled, change ignored.");
                 }
             } else if (topic == "xpcom-shutdown") {
@@ -713,17 +713,17 @@ LoginManager.prototype = {
         var pwFields = this._getPasswordFields(form, isSubmission);
         if (!pwFields)
             return [null, null, null];
 
 
         // Locate the username field in the form by searching backwards
         // from the first passwordfield, assume the first text field is the
         // username. We might not find a username field if the user is
-        // already logged in to the site. 
+        // already logged in to the site.
         for (var i = pwFields[0].index - 1; i >= 0; i--) {
             var element = form.elements[i];
             var fieldType = (element.hasAttribute("type") ?
                              element.getAttribute("type").toLowerCase() :
                              element.type);
             if (fieldType == "text"  ||
                 fieldType == "email" ||
                 fieldType == "url"   ||
@@ -911,17 +911,17 @@ LoginManager.prototype = {
             var same, login = logins[i];
 
             // If one login has a username but the other doesn't, ignore
             // the username when comparing and only match if they have the
             // same password. Otherwise, compare the logins and match even
             // if the passwords differ.
             if (!login.username && formLogin.username) {
                 var restoreMe = formLogin.username;
-                formLogin.username = ""; 
+                formLogin.username = "";
                 same = formLogin.matches(login, false);
                 formLogin.username = restoreMe;
             } else if (!formLogin.username && login.username) {
                 formLogin.username = login.username;
                 same = formLogin.matches(login, false);
                 formLogin.username = ""; // we know it's always blank.
             } else {
                 same = formLogin.matches(login, true);
@@ -1107,17 +1107,17 @@ LoginManager.prototype = {
             usernameField && (usernameField.disabled ||
                               usernameField.readOnly)) {
             this.log("not filling form, login fields disabled");
             return [false, foundLogins];
         }
 
         // Need to get a list of logins if we weren't given them
         if (foundLogins == null) {
-            var formOrigin = 
+            var formOrigin =
                 this._getPasswordOrigin(form.ownerDocument.documentURI);
             var actionOrigin = this._getActionOrigin(form);
             foundLogins = this.findLogins({}, formOrigin, actionOrigin, null);
             this.log("found " + foundLogins.length + " matching logins.");
         } else {
             this.log("reusing logins from last form.");
         }
 
--- a/toolkit/components/satchel/nsFormFillController.cpp
+++ b/toolkit/components/satchel/nsFormFillController.cpp
@@ -78,17 +78,17 @@ NS_IMPL_ISUPPORTS5(nsFormFillController,
                    nsIAutoCompleteSearch,
                    nsIDOMEventListener,
                    nsIMutationObserver)
 
 nsFormFillController::nsFormFillController() :
   mTimeout(50),
   mMinResultsForPopup(1),
   mMaxRows(0),
-  mDisableAutoComplete(PR_FALSE), 
+  mDisableAutoComplete(PR_FALSE),
   mCompleteDefaultIndex(PR_FALSE),
   mCompleteSelectedIndex(PR_FALSE),
   mForceComplete(PR_FALSE),
   mSuppressOnInput(PR_FALSE)
 {
   mController = do_GetService("@mozilla.org/autocomplete/controller;1");
   mDocShells = do_CreateInstance("@mozilla.org/supports-array;1");
   mPopups = do_CreateInstance("@mozilla.org/supports-array;1");
@@ -183,42 +183,42 @@ nsFormFillController::NodeWillBeDestroye
 
 ////////////////////////////////////////////////////////////////////////
 //// nsIFormFillController
 
 NS_IMETHODIMP
 nsFormFillController::AttachToBrowser(nsIDocShell *aDocShell, nsIAutoCompletePopup *aPopup)
 {
   NS_ENSURE_TRUE(aDocShell && aPopup, NS_ERROR_ILLEGAL_VALUE);
-  
+
   mDocShells->AppendElement(aDocShell);
   mPopups->AppendElement(aPopup);
-  
+
   // Listen for focus events on the domWindow of the docShell
   nsCOMPtr<nsIDOMWindow> domWindow = GetWindowForDocShell(aDocShell);
   AddWindowListeners(domWindow);
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsFormFillController::DetachFromBrowser(nsIDocShell *aDocShell)
 {
   PRInt32 index = GetIndexOfDocShell(aDocShell);
   NS_ENSURE_TRUE(index >= 0, NS_ERROR_FAILURE);
-  
+
   // Stop listening for focus events on the domWindow of the docShell
   nsCOMPtr<nsIDocShell> docShell;
   mDocShells->GetElementAt(index, getter_AddRefs(docShell));
   nsCOMPtr<nsIDOMWindow> domWindow = GetWindowForDocShell(docShell);
   RemoveWindowListeners(domWindow);
-    
+
   mDocShells->RemoveElementAt(index);
   mPopups->RemoveElementAt(index);
-  
+
   return NS_OK;
 }
 
 
 NS_IMETHODIMP
 nsFormFillController::MarkAsLoginManagerField(nsIDOMHTMLInputElement *aInput)
 {
   /*
@@ -419,23 +419,23 @@ nsFormFillController::SetSearchParam(con
   return NS_ERROR_NOT_IMPLEMENTED;
 }
 
 NS_IMETHODIMP
 nsFormFillController::GetSearchParam(nsAString &aSearchParam)
 {
   if (!mFocusedInput) {
     NS_WARNING("mFocusedInput is null for some reason! avoiding a crash. should find out why... - ben");
-    return NS_ERROR_FAILURE; // XXX why? fix me. 
+    return NS_ERROR_FAILURE; // XXX why? fix me.
   }
-    
+
   mFocusedInput->GetName(aSearchParam);
   if (aSearchParam.IsEmpty())
     mFocusedInput->GetId(aSearchParam);
-  
+
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsFormFillController::GetSearchCount(PRUint32 *aSearchCount)
 {
   *aSearchCount = 1;
   return NS_OK;
@@ -607,18 +607,18 @@ nsFormFillController::StartSearch(const 
       nsCOMPtr<nsINode> node = do_QueryInterface(list);
       if(node) {
         node->AddMutationObserverUnlessExists(this);
       }
     }
   }
   NS_ENSURE_SUCCESS(rv, rv);
 
-  aListener->OnSearchResult(this, result);  
-  
+  aListener->OnSearchResult(this, result);
+
   return NS_OK;
 }
 
 class UpdateSearchResultRunnable : public nsRunnable
 {
 public:
   UpdateSearchResultRunnable(nsIAutoCompleteObserver* aObserver,
                              nsIAutoCompleteSearch* aSearch,
@@ -722,17 +722,17 @@ nsFormFillController::HandleEvent(nsIDOM
       mFocusedInput->GetOwnerDocument(getter_AddRefs(inputDoc));
       if (domDoc == inputDoc)
         StopControllingInput();
     }
 
     mPwmgrInputs.Enumerate(RemoveForDOMDocumentEnumerator, domDoc);
   }
 
-  return NS_OK; 
+  return NS_OK;
 }
 
 
 /* static */ PLDHashOperator
 nsFormFillController::RemoveForDOMDocumentEnumerator(nsISupports* aKey,
                                                   PRInt32& aEntry,
                                                   void* aUserData)
 {
@@ -746,17 +746,17 @@ nsFormFillController::RemoveForDOMDocume
   return PL_DHASH_NEXT;
 }
 
 nsresult
 nsFormFillController::Focus(nsIDOMEvent* aEvent)
 {
   nsCOMPtr<nsIDOMEventTarget> target;
   aEvent->GetTarget(getter_AddRefs(target));
-  
+
   nsCOMPtr<nsIDOMHTMLInputElement> input = do_QueryInterface(target);
   if (!input)
     return NS_OK;
 
   PRBool isReadOnly = PR_FALSE;
   input->GetReadOnly(&isReadOnly);
 
   nsAutoString autocomplete;
@@ -767,29 +767,29 @@ nsFormFillController::Focus(nsIDOMEvent*
   if (mPwmgrInputs.Get(input, &dummy))
       isPwmgrInput = PR_TRUE;
 
   nsCOMPtr<nsIFormControl> formControl = do_QueryInterface(input);
   if (formControl && formControl->IsSingleLineTextControl(PR_TRUE) &&
       !isReadOnly || isPwmgrInput) {
     StartControllingInput(input);
   }
-    
+
   return NS_OK;
 }
 
-PRBool 
+PRBool
 nsFormFillController::IsInputAutoCompleteOff()
 {
   PRBool autoCompleteOff = PR_FALSE;
 
   if (mFocusedInput) {
-    nsAutoString autocomplete; 
+    nsAutoString autocomplete;
     mFocusedInput->GetAttribute(NS_LITERAL_STRING("autocomplete"), autocomplete);
-    
+
     // Check the input for autocomplete="off", then the form
     if (autocomplete.LowerCaseEqualsLiteral("off")) {
       autoCompleteOff = PR_TRUE;
     } else {
 
       nsCOMPtr<nsIDOMHTMLFormElement> form;
       mFocusedInput->GetForm(getter_AddRefs(form));
       if (form)
@@ -861,21 +861,21 @@ nsFormFillController::KeyPress(nsIDOMEve
   case nsIDOMKeyEvent::DOM_VK_TAB:
     mController->HandleTab();
     cancel = PR_FALSE;
     break;
   case nsIDOMKeyEvent::DOM_VK_RETURN:
     mController->HandleEnter(PR_FALSE, &cancel);
     break;
   }
-  
+
   if (cancel) {
     aEvent->PreventDefault();
   }
-  
+
   return NS_OK;
 }
 
 nsresult
 nsFormFillController::MouseDown(nsIDOMEvent* aEvent)
 {
   nsCOMPtr<nsIDOMMouseEvent> mouseEvent(do_QueryInterface(aEvent));
   if (!mouseEvent)
@@ -958,26 +958,26 @@ nsFormFillController::AddWindowListeners
 
 void
 nsFormFillController::RemoveWindowListeners(nsIDOMWindow *aWindow)
 {
   if (!aWindow)
     return;
 
   StopControllingInput();
-  
+
   nsCOMPtr<nsIDOMDocument> domDoc;
   aWindow->GetDocument(getter_AddRefs(domDoc));
   mPwmgrInputs.Enumerate(RemoveForDOMDocumentEnumerator, domDoc);
 
   nsCOMPtr<nsPIDOMWindow> privateDOMWindow(do_QueryInterface(aWindow));
   nsIDOMEventTarget* target = nsnull;
   if (privateDOMWindow)
     target = privateDOMWindow->GetChromeEventHandler();
-  
+
   if (!target)
     return;
 
   target->RemoveEventListener(NS_LITERAL_STRING("focus"), this, PR_TRUE);
   target->RemoveEventListener(NS_LITERAL_STRING("blur"), this, PR_TRUE);
   target->RemoveEventListener(NS_LITERAL_STRING("pagehide"), this, PR_TRUE);
   target->RemoveEventListener(NS_LITERAL_STRING("mousedown"), this, PR_TRUE);
   target->RemoveEventListener(NS_LITERAL_STRING("input"), this, PR_TRUE);
@@ -1009,27 +1009,27 @@ nsFormFillController::RemoveKeyListener(
   nsCOMPtr<nsIDOMEventTarget> target = do_QueryInterface(mFocusedInput);
   target->RemoveEventListener(NS_LITERAL_STRING("keypress"), this, PR_TRUE);
 }
 
 void
 nsFormFillController::StartControllingInput(nsIDOMHTMLInputElement *aInput)
 {
   // Make sure we're not still attached to an input
-  StopControllingInput(); 
+  StopControllingInput();
 
   // Find the currently focused docShell
   nsCOMPtr<nsIDocShell> docShell = GetDocShellForInput(aInput);
   PRInt32 index = GetIndexOfDocShell(docShell);
   if (index < 0)
     return;
-  
+
   // Cache the popup for the focused docShell
   mPopups->GetElementAt(index, getter_AddRefs(mFocusedPopup));
-  
+
   AddKeyListener(aInput);
   mFocusedInput = aInput;
 
   // Now we are the autocomplete controller's bitch
   mController->SetInput(this);
 }
 
 void
@@ -1105,17 +1105,17 @@ nsFormFillController::GetIndexOfDocShell
   // Recursively check the parent docShell of this one
   nsCOMPtr<nsIDocShellTreeItem> treeItem = do_QueryInterface(aDocShell);
   nsCOMPtr<nsIDocShellTreeItem> parentItem;
   treeItem->GetParent(getter_AddRefs(parentItem));
   if (parentItem) {
     nsCOMPtr<nsIDocShell> parentShell = do_QueryInterface(parentItem);
     return GetIndexOfDocShell(parentShell);
   }
-    
+
   return -1;
 }
 
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsFormFillController)
 
 NS_DEFINE_NAMED_CID(NS_FORMFILLCONTROLLER_CID);
 
 static const mozilla::Module::CIDEntry kSatchelCIDs[] = {
--- a/toolkit/components/satchel/nsFormFillController.h
+++ b/toolkit/components/satchel/nsFormFillController.h
@@ -76,26 +76,26 @@ public:
   nsresult MouseDown(nsIDOMEvent* aMouseEvent);
 
   nsFormFillController();
   virtual ~nsFormFillController();
 
 protected:
   void AddWindowListeners(nsIDOMWindow *aWindow);
   void RemoveWindowListeners(nsIDOMWindow *aWindow);
-  
+
   void AddKeyListener(nsIDOMHTMLInputElement *aInput);
   void RemoveKeyListener();
-  
+
   void StartControllingInput(nsIDOMHTMLInputElement *aInput);
   void StopControllingInput();
-  
+
   void RevalidateDataList();
   PRBool RowMatch(nsFormHistory *aHistory, PRUint32 aIndex, const nsAString &aInputName, const nsAString &aInputValue);
-  
+
   inline nsIDocShell *GetDocShellForInput(nsIDOMHTMLInputElement *aInput);
   inline nsIDOMWindow *GetWindowForDocShell(nsIDocShell *aDocShell);
   inline PRInt32 GetIndexOfDocShell(nsIDocShell *aDocShell);
 
   static PLDHashOperator RemoveForDOMDocumentEnumerator(nsISupports* aKey,
                                                         PRInt32& aEntry,
                                                         void* aUserData);
   PRBool IsEventTrusted(nsIDOMEvent *aEvent);
@@ -115,16 +115,16 @@ protected:
   nsCOMPtr<nsIAutoCompleteObserver> mLastListener;
   nsString mLastSearchString;
 
   nsDataHashtable<nsISupportsHashKey,PRInt32> mPwmgrInputs;
 
   PRUint32 mTimeout;
   PRUint32 mMinResultsForPopup;
   PRUint32 mMaxRows;
-  PRPackedBool mDisableAutoComplete; 
+  PRPackedBool mDisableAutoComplete;
   PRPackedBool mCompleteDefaultIndex;
   PRPackedBool mCompleteSelectedIndex;
   PRPackedBool mForceComplete;
   PRPackedBool mSuppressOnInput;
 };
 
 #endif // __nsFormFillController__
--- a/toolkit/components/satchel/nsIFormFillController.idl
+++ b/toolkit/components/satchel/nsIFormFillController.idl
@@ -55,17 +55,17 @@ interface nsIFormFillController : nsISup
 {
   /*
    * Start controlling form fill behavior for the given browser
    *
    * @param docShell - The docShell to attach to
    * @param popup - The popup to show when autocomplete results are available
    */
   void attachToBrowser(in nsIDocShell docShell, in nsIAutoCompletePopup popup);
-  
+
   /*
    * Stop controlling form fill behavior for the given browser
    *
    * @param docShell - The docShell to detach from
    */
   void detachFromBrowser(in nsIDocShell docShell);
 
   /*
--- a/toolkit/components/satchel/nsIFormHistory.idl
+++ b/toolkit/components/satchel/nsIFormHistory.idl
@@ -52,32 +52,32 @@ interface mozIStorageConnection;
 
 [scriptable, uuid(5d7d84d1-9798-4016-bf61-a32acf09b29d)]
 interface nsIFormHistory2 : nsISupports
 {
   /**
    * Returns true if the form history has any entries.
    */
   readonly attribute boolean hasEntries;
-  
+
   /**
    * Adds a name and value pair to the form history.
    */
   void addEntry(in AString name, in AString value);
 
   /**
    * Removes a name and value pair from the form history.
    */
   void removeEntry(in AString name, in AString value);
 
   /**
    * Removes all entries that are paired with a name.
    */
   void removeEntriesForName(in AString name);
-  
+
   /**
    * Removes all entries in the entire form history.
    */
   void removeAllEntries();
 
   /**
    * Returns true if there is no entry that is paired with a name.
    */
--- a/toolkit/content/widgets/videocontrols.xml
+++ b/toolkit/content/widgets/videocontrols.xml
@@ -222,59 +222,17 @@
                         <box class="volumeBackgroundBar"/>
                         <scale class="volumeControl" orient="vertical" dir="reverse" movetoclick="true"/>
                     </stack>
                 </hbox>
             </vbox>
         </stack>
     </xbl:content>
 
-    <implementation implements="nsISecurityCheckedComponent">
-        <!-- nsISecurityCheckedComponent -->
-        <method name="canCreateWrapper">
-            <parameter name="aIID"/>
-            <body>
-                return "AllAccess";
-            </body>
-        </method> 
-
-        <method name="canCallMethod">
-            <parameter name="aIID"/>
-            <parameter name="aMethodName"/> 
-            <body>
-                return "AllAccess";
-            </body>
-        </method> 
-
-        <method name="canGetProperty">
-            <parameter name="aIID"/>
-            <parameter name="aPropertyName"/> 
-            <body>
-                return "AllAccess";
-            </body>
-        </method> 
-
-        <method name="canSetProperty">
-            <parameter name="aIID"/>
-            <parameter name="aPropertyName"/>
-            <body>
-                return "AllAccess";
-            </body>
-        </method> 
-
-        <method name="QueryInterface">
-            <parameter name="aIID"/>
-            <body>
-            <![CDATA[
-            if (!iid.equals(Components.interfaces.nsISecurityCheckedComponent))
-                throw Components.results.NS_ERROR_NO_INTERFACE;
-            return this;
-            ]]>
-            </body>
-        </method>
+    <implementation>
 
         <constructor>
             <![CDATA[
             this.Utils.init(this);
             ]]>
         </constructor>
 
         <field name="randomID">0</field>