Merge m-c to b2g-inbound
authorWes Kocher <wkocher@mozilla.com>
Tue, 22 Oct 2013 11:19:19 -0400
changeset 166357 fb6e7e47499b0b97a7bff221b4becb6648b771ae
parent 166356 c3507f112ba8ac527abd9e6d8851d462cd210c20 (current diff)
parent 166317 177bf37a49f5b55eb00f2ce6d295fdc6b56cdb76 (diff)
child 166358 a7c3da1f3af7b3f478aa6a6cdb4aae93ae22f466
child 166538 b90b9e4df250d592b1de43e1abc7cff24d5580a5
push id428
push userbbajaj@mozilla.com
push dateTue, 28 Jan 2014 00:16:25 +0000
treeherdermozilla-release@cd72a7ff3a75 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
milestone27.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Merge m-c to b2g-inbound
mobile/android/services/android-drawable-hdpi-resources.mn
mobile/android/services/android-drawable-ldpi-resources.mn
mobile/android/services/android-drawable-mdpi-resources.mn
mobile/android/services/android-drawable-resources.mn
mobile/android/services/android-layout-resources.mn
mobile/android/services/android-values-resources.mn
mobile/android/services/java-sources.mn
mobile/android/services/java-third-party-sources.mn
mobile/android/services/preprocess-sources.mn
--- a/browser/app/profile/firefox.js
+++ b/browser/app/profile/firefox.js
@@ -670,18 +670,16 @@ pref("pfs.datasource.url", "https://pfs.
 pref("plugins.hide_infobar_for_blocked_plugin", false);
 pref("plugins.hide_infobar_for_outdated_plugin", false);
 
 pref("plugins.update.url", "https://www.mozilla.org/%LOCALE%/plugincheck/");
 pref("plugins.update.notifyUser", false);
 
 pref("plugins.click_to_play", true);
 
-pref("plugins.clickToActivateInfo.url", "https://support.mozilla.org/1/firefox/%VERSION%/%OS%/%LOCALE%/clicktoplay");
-
 // let all plugins except Flash default to click-to-play
 pref("plugin.default.state", 1);
 pref("plugin.state.flash", 2);
 
 // display door hanger if flash not installed
 pref("plugins.notifyMissingFlash", true);
 
 #ifdef XP_WIN
--- a/browser/base/content/browser-plugins.js
+++ b/browser/base/content/browser-plugins.js
@@ -700,17 +700,17 @@ var gPluginHandler = {
       // TODO: allow the blocklist to specify a better link, bug 873093
       if (pluginInfo.blocklistState == Ci.nsIBlocklistService.STATE_VULNERABLE_UPDATE_AVAILABLE) {
         url = Services.urlFormatter.formatURLPref("plugins.update.url");
       }
       else if (pluginInfo.blocklistState != Ci.nsIBlocklistService.STATE_NOT_BLOCKED) {
         url = Services.blocklist.getPluginBlocklistURL(pluginInfo.pluginTag);
       }
       else {
-        url = Services.urlFormatter.formatURLPref("plugins.clickToActivateInfo.url");
+        url = Services.urlFormatter.formatURLPref("app.support.baseURL") + "clicktoplay";
       }
       pluginInfo.detailsLink = url;
 
       centerActions.push(pluginInfo);
     }
 
     if (centerActions.length == 0) {
       // TODO: this is a temporary band-aid to avoid broken doorhangers
old mode 100755
new mode 100644
--- a/browser/devtools/inspector/inspector-panel.js
+++ b/browser/devtools/inspector/inspector-panel.js
@@ -21,16 +21,43 @@ loader.lazyGetter(this, "SelectorSearch"
 
 const LAYOUT_CHANGE_TIMER = 250;
 
 /**
  * Represents an open instance of the Inspector for a tab.
  * The inspector controls the highlighter, the breadcrumbs,
  * the markup view, and the sidebar (computed view, rule view
  * and layout view).
+ *
+ * Events:
+ * - ready
+ *      Fired when the inspector panel is opened for the first time and ready to
+ *      use
+ * - new-root
+ *      Fired after a new root (navigation to a new page) event was fired by
+ *      the walker, and taken into account by the inspector (after the markup
+ *      view has been reloaded)
+ * - markuploaded
+ *      Fired when the markup-view frame has loaded
+ * - layout-change
+ *      Fired when the layout of the inspector changes
+ * - breadcrumbs-updated
+ *      Fired when the breadcrumb widget updates to a new node
+ * - layoutview-updated
+ *      Fired when the layoutview (box model) updates to a new node
+ * - markupmutation
+ *      Fired after markup mutations have been processed by the markup-view
+ * - computed-view-refreshed
+ *      Fired when the computed rules view updates to a new node
+ * - computed-view-property-expanded
+ *      Fired when a property is expanded in the computed rules view
+ * - computed-view-property-collapsed
+ *      Fired when a property is collapsed in the computed rules view
+ * - rule-view-refreshed
+ *      Fired when the rule view updates to a new node
  */
 function InspectorPanel(iframeWindow, toolbox) {
   this._toolbox = toolbox;
   this._target = toolbox._target;
   this.panelDoc = iframeWindow.document;
   this.panelWin = iframeWindow;
   this.panelWin.inspector = this;
 
@@ -315,16 +342,17 @@ InspectorPanel.prototype = {
         return;
       }
       this.selection.setNodeFront(defaultNode, "navigateaway");
 
       this._initMarkup();
       this.once("markuploaded", () => {
         this.markup.expandNode(this.selection.nodeFront);
         this.setupSearchBox();
+        this.emit("new-root");
       });
     });
   },
 
   _selectionCssSelector: null,
 
   /**
    * Set the currently selected node unique css selector.
--- a/browser/devtools/inspector/test/browser_inspector_bug_922125_destroy_on_navigate.js
+++ b/browser/devtools/inspector/test/browser_inspector_bug_922125_destroy_on_navigate.js
@@ -5,62 +5,81 @@ let Toolbox = devtools.Toolbox;
 let TargetFactory = devtools.TargetFactory;
 
 function test() {
   waitForExplicitFinish();
 
   const URL_1 = "data:text/html;charset=UTF-8,<div id='one' style='color:red;'>ONE</div>";
   const URL_2 = "data:text/html;charset=UTF-8,<div id='two' style='color:green;'>TWO</div>";
 
-  let inspector;
+  let toolbox, inspector;
 
   // open tab, load URL_1, and wait for load to finish
   let tab = gBrowser.selectedTab = gBrowser.addTab();
   let target = TargetFactory.forTab(gBrowser.selectedTab);
+  let deferred = promise.defer();
   let browser = gBrowser.getBrowserForTab(tab);
 
-  function onPageOneLoad() {
-    browser.removeEventListener("load", onPageOneLoad, true);
+  function onTabLoad() {
+    browser.removeEventListener("load", onTabLoad, true);
+    deferred.resolve(null);
+  }
+  browser.addEventListener("load", onTabLoad, true);
+  browser.loadURI(URL_1);
 
-    gDevTools.showToolbox(target).then(aToolbox => {
-      return aToolbox.selectTool("inspector");
-    }).then(i => {
+  // open devtools panel
+  deferred.promise.then(() => {
+    return gDevTools.showToolbox(target, null, Toolbox.HostType.BOTTOM);
+  }).then(aToolbox => {
+    toolbox = aToolbox;
+  }).then(() => {
+    // select the inspector
+    return toolbox.selectTool("inspector").then(i => {
       inspector = i;
 
       // Verify we are on page one
       let testNode = content.document.querySelector("#one");
       ok(testNode, "We have the test node on page 1");
 
       assertMarkupViewIsLoaded();
+    });
+  }).then(() => {
+    // navigate to URL_2
+    let deferred = promise.defer();
 
-      // Listen to will-navigate to check if the view is empty
-      target.on("will-navigate", () => {
-        info("Navigation to page 2 has started, the inspector should be empty");
-        assertMarkupViewIsEmpty();
-      });
-      inspector.once("markuploaded", () => {
-        info("Navigation to page 2 was done, the inspector should be back up");
+    // Listen to will-navigate to check if the view is empty
+    target.on("will-navigate", () => {
+      info("Navigation to page 2 has started, the inspector should be empty");
+      assertMarkupViewIsEmpty();
+    });
+    inspector.once("new-root", () => {
+      info("Navigation to page 2 was done, the inspector should be back up");
 
-        // Verify we are on page one
-        let testNode = content.document.querySelector("#two");
-        ok(testNode, "We have the test node on page 2");
+      // Verify we are on page one
+      let testNode = content.document.querySelector("#two");
+      ok(testNode, "We have the test node on page 2");
+
+      // On page 2 load, verify we have the right content
+      assertMarkupViewIsLoaded();
 
-        // On page 2 load, verify we have the right content
-        assertMarkupViewIsLoaded();
-        endTests();
+      inspector.selection.setNode(content.document.querySelector("#two"));
+      inspector.once("inspector-updated", () => {
+        deferred.resolve();
       });
+    });
 
-      // Navigate to page 2
+    inspector.selection.setNode(content.document.querySelector("#one"));
+    inspector.once("inspector-updated", () => {
       browser.loadURI(URL_2);
     });
-  }
 
-  // Navigate to page 1
-  browser.addEventListener("load", onPageOneLoad, true);
-  browser.loadURI(URL_1);
+    return deferred.promise;
+  }).then(() => {
+    endTests();
+  });
 
   function assertMarkupViewIsLoaded() {
     let markupViewBox = inspector.panelDoc.getElementById("markup-box");
     is(markupViewBox.childNodes.length, 1, "The markup-view is loaded");
   }
 
   function assertMarkupViewIsEmpty() {
     let markupViewBox = inspector.panelDoc.getElementById("markup-box");
--- a/browser/metro/base/content/bindings/bindings.xml
+++ b/browser/metro/base/content/bindings/bindings.xml
@@ -189,18 +189,24 @@
         <![CDATA[
           let box = this.inputField.parentNode;
           box.showContextMenu(this, event, false);
         ]]>
       </handler>
       <handler event="click" phase="capturing">
         <![CDATA[
         if (event.mozInputSource == Ci.nsIDOMMouseEvent.MOZ_SOURCE_TOUCH) {
-          SelectionHelperUI.attachEditSession(ChromeSelectionHandler,
-                                              event.clientX, event.clientY);
+          if (typeof SelectionHelperUI != 'undefined') {
+            SelectionHelperUI.attachEditSession(ChromeSelectionHandler,
+                                                event.clientX, event.clientY);
+          } else {
+            // If we don't have access to SelectionHelperUI then we are using this
+            // binding for browser content (e.g. about:config)
+            Services.obs.notifyObservers(event, "attach_edit_session_to_content", "");
+          }
         }
       ]]>
       </handler>
     </handlers>
   </binding>
 
   <binding id="search-textbox" extends="chrome://global/content/bindings/textbox.xml#search-textbox">
     <implementation>
@@ -282,16 +288,22 @@
           ContextMenuUI.showContextMenu({ target: aTextbox, json: json });
         ]]></body>
       </method>
     </implementation>
     <handlers>
       <handler event="click" phase="capturing">
         <![CDATA[
           if (event.mozInputSource == Ci.nsIDOMMouseEvent.MOZ_SOURCE_TOUCH) {
-            SelectionHelperUI.attachEditSession(ChromeSelectionHandler,
-                                                event.clientX, event.clientY);
+            if (typeof SelectionHelperUI != 'undefined') {
+              SelectionHelperUI.attachEditSession(ChromeSelectionHandler,
+                                                  event.clientX, event.clientY);
+            } else {
+              // If we don't have access to SelectionHelperUI then we are using this
+              // binding for browser content (e.g. about:config)
+              Services.obs.notifyObservers(event, "attach_edit_session_to_content", "");
+            }
           }
         ]]>
       </handler>
     </handlers>
   </binding>
 </bindings>
--- a/browser/metro/base/content/browser-ui.js
+++ b/browser/metro/base/content/browser-ui.js
@@ -107,16 +107,17 @@ var BrowserUI = {
     // Init core UI modules
     ContextUI.init();
     PanelUI.init();
     FlyoutPanelsUI.init();
     PageThumbs.init();
     NewTabUtils.init();
     SettingsCharm.init();
     NavButtonSlider.init();
+    SelectionHelperUI.init();
 
     // We can delay some initialization until after startup.  We wait until
     // the first page is shown, then dispatch a UIReadyDelayed event.
     messageManager.addMessageListener("pageshow", function onPageShow() {
       if (getBrowser().currentURI.spec == "about:blank")
         return;
 
       messageManager.removeMessageListener("pageshow", onPageShow);
--- a/browser/metro/base/content/config.js
+++ b/browser/metro/base/content/config.js
@@ -2,38 +2,45 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 let Ci = Components.interfaces;
 
 Components.utils.import("resource://gre/modules/Services.jsm");
 
 var ViewConfig = {
+  get _main() {
+    delete this._main;
+    return this._main = document.getElementById("main-container");
+  },
+
   get _container() {
     delete this._container;
     return this._container = document.getElementById("prefs-container");
   },
 
   get _editor() {
     delete this._editor;
     return this._editor = document.getElementById("editor");
   },
 
   init: function init() {
+    this._main.addEventListener("click", this, false);
     window.addEventListener("resize", this, false);
     window.addEventListener("prefchange", this, false);
     window.addEventListener("prefnew", this, false);
 
     this._handleWindowResize();
     this.filter("");
 
     document.getElementById("textbox").focus();
   },
 
   uninit: function uninit() {
+    this._main.removeEventListener("click", this, false);
     window.removeEventListener("resize", this, false);
     window.removeEventListener("prefchange", this, false);
     window.removeEventListener("prefnew", this, false);
   },
 
   filter: function filter(aValue) {
     let row = document.getElementById("editor-row");
 
@@ -163,27 +170,37 @@ var ViewConfig = {
       case "resize":
         this._handleWindowResize();
         break;
 
       case "prefchange":
       case "prefnew":
         this._handlePrefChange(aEvent.detail, aEvent.type == "prefnew");
         break;
+
+      case "click":
+        this._onClick();
+        break;
     }
   },
 
   _handleWindowResize: function _handleWindowResize() {
     let mainBox = document.getElementById("main-container");
     let textbox = document.getElementById("textbox");
     let height = window.innerHeight - textbox.getBoundingClientRect().height;
 
     mainBox.setAttribute("height", height);
   },
 
+  _onClick: function () {
+    // Blur the search box when tapping anywhere else in the content
+    // in order to close the soft keyboard.
+    document.getElementById("textbox").blur();
+  },
+
   _handlePrefChange: function _handlePrefChange(aIndex, aNew) {
     let isEditing = !this._editor.hidden;
     let shouldUpdateEditor = false;
     if (isEditing) {
       let setting = document.getElementById("editor-setting");
       let editorIndex = Utils.getPrefIndex(setting.getAttribute("pref"));
       shouldUpdateEditor = (aIndex == editorIndex);
       if(shouldUpdateEditor || aIndex > editorIndex)
--- a/browser/metro/base/content/contenthandlers/Content.js
+++ b/browser/metro/base/content/contenthandlers/Content.js
@@ -179,16 +179,22 @@ let Content = {
         // the autocomplete.  Perhaps the user used backspace or delete.
         if (!aEvent.target.value)
           this.formAssistant.close();
         else
           this.formAssistant.open(aEvent.target);
         break;
 
       case "click":
+        // Workaround for bug 925457: we sometimes don't recognize the
+        // correct tap target or are unable to identify if it's editable.
+        // Instead always save tap co-ordinates for the keyboard to look for
+        // when it is up.
+        SelectionHandler.onClickCoords(aEvent.clientX, aEvent.clientY);
+
         if (aEvent.eventPhase == aEvent.BUBBLING_PHASE)
           this._onClickBubble(aEvent);
         else
           this._onClickCapture(aEvent);
         break;
 
       case "DOMFormHasPassword":
         LoginManagerContent.onFormPassword(aEvent);
--- a/browser/metro/base/content/contenthandlers/SelectionHandler.js
+++ b/browser/metro/base/content/contenthandlers/SelectionHandler.js
@@ -3,16 +3,17 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 dump("### SelectionHandler.js loaded\n");
 
 var SelectionHandler = {
   init: function init() {
     this.type = kContentSelector;
     this.snap = true;
+    this.lastYPos = this.lastXPos = null;
     addMessageListener("Browser:SelectionStart", this);
     addMessageListener("Browser:SelectionAttach", this);
     addMessageListener("Browser:SelectionEnd", this);
     addMessageListener("Browser:SelectionMoveStart", this);
     addMessageListener("Browser:SelectionMove", this);
     addMessageListener("Browser:SelectionMoveEnd", this);
     addMessageListener("Browser:SelectionUpdate", this);
     addMessageListener("Browser:SelectionClose", this);
@@ -335,16 +336,21 @@ var SelectionHandler = {
       raiseContent: result,
     });
   },
 
   _onPing: function _onPing(aId) {
     this.sendAsync("Content:SelectionHandlerPong", { id: aId });
   },
 
+  onClickCoords: function (xPos, yPos) {
+    this.lastXPos = xPos;
+    this.lastYPos = yPos;
+  },
+
   /*************************************************
    * Selection helpers
    */
 
   /*
    * _clearSelection
    *
    * Clear existing selection if it exists and reset our internla state.
@@ -407,19 +413,22 @@ var SelectionHandler = {
    * keyboard.
    *
    * @param aNewViewHeight the new content view height
    * @return 0 if no positioning is required or a positive val equal to the
    * distance content should be raised to center the target element.
    */
   _calcNewContentPosition: function _calcNewContentPosition(aNewViewHeight) {
     // We have no target element but the keyboard is up
-    // so lets not cover content
+    // so lets not cover content that is below the keyboard
     if (!this._cache || !this._cache.element) {
-      return Services.metro.keyboardHeight;
+      if (this.lastYPos != null && this.lastYPos > aNewViewHeight) {
+        return Services.metro.keyboardHeight;
+      }
+      return 0;
     }
 
     let position = Util.centerElementInView(aNewViewHeight, this._cache.element);
     if (position !== undefined) {
       return position;
     }
 
     // Special case: we are dealing with an input that is taller than the
@@ -518,17 +527,22 @@ var SelectionHandler = {
         this._onSelectionDebug(json);
         break;
 
       case "Browser:SelectionUpdate":
         this._onSelectionUpdate();
         break;
 
       case "Browser:RepositionInfoRequest":
-        this._repositionInfoRequest(json);
+        // This message is sent simultaneously with a tap event.
+        // Wait a bit to make sure we have the most up-to-date tap co-ordinates
+        // before a call to _calcNewContentPosition() which accesses them.
+        content.setTimeout (function () {
+          SelectionHandler._repositionInfoRequest(json);
+        }, 50);
         break;
 
       case "Browser:SelectionHandlerPing":
         this._onPing(json.id);
         break;
     }
   },
 
--- a/browser/metro/base/content/helperui/SelectionHelperUI.js
+++ b/browser/metro/base/content/helperui/SelectionHelperUI.js
@@ -339,16 +339,31 @@ var SelectionHelperUI = {
       return false;
     if ((this._caretMark && this._caretMark.dragging) ||
         (this._startMark && this._startMark.dragging) ||
         (this._endMark && this._endMark.dragging))
       return true;
     return false;
   },
 
+
+  /*
+   * Observers
+   */
+
+  observe: function (aSubject, aTopic, aData) {
+  switch (aTopic) {
+    case "attach_edit_session_to_content":
+      let event = aSubject;
+      SelectionHelperUI.attachEditSession(Browser.selectedTab.browser,
+                                          event.clientX, event.clientY);
+      break;
+    }
+  },
+
   /*
    * Public apis
    */
 
   /*
    * pingSelectionHandler
    * 
    * Ping the SelectionHandler and wait for the right response. Insures
@@ -490,16 +505,20 @@ var SelectionHelperUI = {
       clearSelection: clearSelection
     });
   },
 
   /*
    * Init and shutdown
    */
 
+  init: function () {
+    Services.obs.addObserver(this, "attach_edit_session_to_content", false);
+  },
+
   _init: function _init(aMsgTarget) {
     // store the target message manager
     this._msgTarget = aMsgTarget;
 
     // Init our list of available monocle ids
     this._setupMonocleIdArray();
 
     // Init selection rect info
--- a/browser/metro/locales/import/Makefile.in
+++ b/browser/metro/locales/import/Makefile.in
@@ -25,19 +25,21 @@ include $(topsrcdir)/config/rules.mk
 libs::
 	$(MAKE) -C $(DEPTH)/browser/locales searchplugins \
 	  DIST_SUBDIR=$(DIST_SUBDIR) XPI_ROOT_APPID="$(XPI_ROOT_APPID)"
 
 #########################################
 # Bookmarks
 
 # Pick up desktop's bookmarks.inc file
+ifdef LOCALE_MERGEDIR
+vpath book%.inc $(LOCALE_MERGEDIR)/browser/profile
+endif
 vpath book%.inc $(LOCALE_SRCDIR)/profile
 ifdef LOCALE_MERGEDIR
-vpath book%.inc $(LOCALE_SRCDIR)/profile
 vpath book%.inc @top_srcdir@/$(relativesrcdir)/en-US/profile
 endif
 
 bookmarks-src = $(srcdir)/../generic/profile/bookmarks.json.in
 
 # The resulting bookmarks.json will get picked up and packaged by the
 # processing of the jar file in the parent directory.
 bookmarks: bookmarks.inc
--- a/browser/themes/linux/preferences/in-content/preferences.css
+++ b/browser/themes/linux/preferences/in-content/preferences.css
@@ -1,155 +1,155 @@
-/* - This Source Code Form is subject to the terms of the Mozilla Public
-   - License, v. 2.0. If a copy of the MPL was not distributed with this file,
-   - You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-@import url("chrome://global/skin/inContentUI.css");
-
-@namespace html "http://www.w3.org/1999/xhtml";
-
-#preferences-home {
-  display: block;
-}
-
-#header {
-  margin-bottom: 18px;
-}
-
-.landingButton {
-  -moz-box-align: center;
-  -moz-box-orient: vertical;
-}
-
-.landingButton:hover {
-  cursor: pointer;
-}
-
-.landingButton-label {
-  margin-top: 4px;
-}
-
-.landingButton-icon {
-  display: block;
-  width: 32px;
-  height: 32px;
-  background-image: url("chrome://browser/skin/preferences/Options.png");
-  background-repeat: no-repeat;
-}
-
-.preference-icon {
-  display: block;
-  width: 32px;
-  height: 32px;
-  background-image: url("chrome://browser/skin/preferences/Options.png");
-  background-repeat: no-repeat;
-  margin: 0 20px;
-}
-
-.preference-icon[type="general"],
-.landingButton-icon[type="general"] {
-  background-position: 0 0;
-}
-
-.preference-icon[type="content"],
-.landingButton-icon[type="content"] {
-  background-position: -64px 0;
-}
-
-.preference-icon[type="applications"],
-.landingButton-icon[type="applications"] {
-  background-position: -96px 0;
-}
-
-.preference-icon[type="privacy"],
-.landingButton-icon[type="privacy"] {
-  background-position: -128px 0;
-}
-
-.preference-icon[type="security"],
-.landingButton-icon[type="security"] {
-  background-position: -160px 0;
-}
-
-.preference-icon[type="advanced"],
-.landingButton-icon[type="advanced"] {
-  background-position: -192px 0;
-}
-
-.preference-icon[type="sync"],
-.landingButton-icon[type="sync"] {
-  background-image: url("chrome://browser/skin/preferences/Options-sync.png");
-}
-
-caption {
-  font-size: 20px;
-}
-
-.heading {
-  height: 50px;
-  background-color: rgba(192,199,210,0.7);
-  border-radius: 5px 5px 0 0;
-  margin-bottom: 15px;
-  -moz-box-align: center;
-}
-
-prefpane > .content-box {
-  overflow: auto;
-}
-
-/* Applications Pane Styles */
-
-#applications-content {
-  padding: 15px;
-}
-
-#handlersView {
-  -moz-appearance: none;
-  border: 1px solid ThreeDShadow;
-  overflow-y: auto;
-}
-
-/* XXX This style is for bug 740213 and should be removed once that
-   bug has a solution. */
-description > html|a {
-  cursor: pointer;
-}
-
-/* XXX Styles Below can be removed once bug 660726 lands */
-.nav-button {
-  min-width: 0;
-}
-
-#back-btn:-moz-locale-dir(ltr) {
-  list-style-image: url("moz-icon://stock/gtk-go-back-ltr?size=toolbar");
-}
-
-#forward-btn:-moz-locale-dir(ltr) {
-  list-style-image: url("moz-icon://stock/gtk-go-forward-ltr?size=toolbar");
-}
-
-#back-btn:-moz-locale-dir(rtl) {
-  list-style-image: url("moz-icon://stock/gtk-go-back-rtl?size=toolbar");
-}
-
-#forward-btn:-moz-locale-dir(rtl) {
-  list-style-image: url("moz-icon://stock/gtk-go-forward-rtl?size=toolbar");
-}
-
-#back-btn[disabled="true"]:-moz-locale-dir(ltr) {
-  list-style-image: url("moz-icon://stock/gtk-go-back-ltr?size=toolbar&state=disabled");
-}
-
-#forward-btn[disabled="true"]:-moz-locale-dir(ltr) {
-  list-style-image: url("moz-icon://stock/gtk-go-forward-ltr?size=toolbar&state=disabled");
-}
-
-#back-btn[disabled="true"]:-moz-locale-dir(rtl) {
-  list-style-image: url("moz-icon://stock/gtk-go-back-rtl?size=toolbar&state=disabled");
-}
-
-#forward-btn[disabled="true"]:-moz-locale-dir(rtl) {
-  list-style-image: url("moz-icon://stock/gtk-go-forward-rtl?size=toolbar&state=disabled");
-}
-
-.header-button .toolbarbutton-text {
-  display: none;
-}
+/* - This Source Code Form is subject to the terms of the Mozilla Public
+   - License, v. 2.0. If a copy of the MPL was not distributed with this file,
+   - You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+@import url("chrome://global/skin/inContentUI.css");
+
+@namespace html "http://www.w3.org/1999/xhtml";
+
+#preferences-home {
+  display: block;
+}
+
+#header {
+  margin-bottom: 18px;
+}
+
+.landingButton {
+  -moz-box-align: center;
+  -moz-box-orient: vertical;
+}
+
+.landingButton:hover {
+  cursor: pointer;
+}
+
+.landingButton-label {
+  margin-top: 4px;
+}
+
+.landingButton-icon {
+  display: block;
+  width: 32px;
+  height: 32px;
+  background-image: url("chrome://browser/skin/preferences/Options.png");
+  background-repeat: no-repeat;
+}
+
+.preference-icon {
+  display: block;
+  width: 32px;
+  height: 32px;
+  background-image: url("chrome://browser/skin/preferences/Options.png");
+  background-repeat: no-repeat;
+  margin: 0 20px;
+}
+
+.preference-icon[type="general"],
+.landingButton-icon[type="general"] {
+  background-position: 0 0;
+}
+
+.preference-icon[type="content"],
+.landingButton-icon[type="content"] {
+  background-position: -64px 0;
+}
+
+.preference-icon[type="applications"],
+.landingButton-icon[type="applications"] {
+  background-position: -96px 0;
+}
+
+.preference-icon[type="privacy"],
+.landingButton-icon[type="privacy"] {
+  background-position: -128px 0;
+}
+
+.preference-icon[type="security"],
+.landingButton-icon[type="security"] {
+  background-position: -160px 0;
+}
+
+.preference-icon[type="advanced"],
+.landingButton-icon[type="advanced"] {
+  background-position: -192px 0;
+}
+
+.preference-icon[type="sync"],
+.landingButton-icon[type="sync"] {
+  background-image: url("chrome://browser/skin/preferences/Options-sync.png");
+}
+
+caption {
+  font-size: 20px;
+}
+
+.heading {
+  height: 50px;
+  background-color: rgba(192,199,210,0.7);
+  border-radius: 5px 5px 0 0;
+  margin-bottom: 15px;
+  -moz-box-align: center;
+}
+
+prefpane > .content-box {
+  overflow: auto;
+}
+
+/* Applications Pane Styles */
+
+#applications-content {
+  padding: 15px;
+}
+
+#handlersView {
+  -moz-appearance: none;
+  border: 1px solid ThreeDShadow;
+  overflow-y: auto;
+}
+
+/* XXX This style is for bug 740213 and should be removed once that
+   bug has a solution. */
+description > html|a {
+  cursor: pointer;
+}
+
+/* XXX Styles Below can be removed once bug 660726 lands */
+.nav-button {
+  min-width: 0;
+}
+
+#back-btn:-moz-locale-dir(ltr) {
+  list-style-image: url("moz-icon://stock/gtk-go-back-ltr?size=toolbar");
+}
+
+#forward-btn:-moz-locale-dir(ltr) {
+  list-style-image: url("moz-icon://stock/gtk-go-forward-ltr?size=toolbar");
+}
+
+#back-btn:-moz-locale-dir(rtl) {
+  list-style-image: url("moz-icon://stock/gtk-go-back-rtl?size=toolbar");
+}
+
+#forward-btn:-moz-locale-dir(rtl) {
+  list-style-image: url("moz-icon://stock/gtk-go-forward-rtl?size=toolbar");
+}
+
+#back-btn[disabled="true"]:-moz-locale-dir(ltr) {
+  list-style-image: url("moz-icon://stock/gtk-go-back-ltr?size=toolbar&state=disabled");
+}
+
+#forward-btn[disabled="true"]:-moz-locale-dir(ltr) {
+  list-style-image: url("moz-icon://stock/gtk-go-forward-ltr?size=toolbar&state=disabled");
+}
+
+#back-btn[disabled="true"]:-moz-locale-dir(rtl) {
+  list-style-image: url("moz-icon://stock/gtk-go-back-rtl?size=toolbar&state=disabled");
+}
+
+#forward-btn[disabled="true"]:-moz-locale-dir(rtl) {
+  list-style-image: url("moz-icon://stock/gtk-go-forward-rtl?size=toolbar&state=disabled");
+}
+
+.header-button .toolbarbutton-text {
+  display: none;
+}
--- a/browser/themes/osx/preferences/in-content/preferences.css
+++ b/browser/themes/osx/preferences/in-content/preferences.css
@@ -1,166 +1,166 @@
-/* - This Source Code Form is subject to the terms of the Mozilla Public
-   - License, v. 2.0. If a copy of the MPL was not distributed with this file,
-   - You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-@import url("chrome://global/skin/inContentUI.css");
-
-@namespace html "http://www.w3.org/1999/xhtml";
-
-#preferences-home {
-  display: block;
-}
-
-#header {
-  margin-bottom: 18px;
-}
-
-.landingButton {
-  -moz-box-align: center;
-  -moz-box-orient: vertical;
-  border: none;
-  background: none;
-  box-shadow: none;
-}
-
-.landingButton:hover {
-  cursor: pointer;
-}
-
-.landingButton-label {
-  margin-top: 4px;
-}
-
-.landingButton-icon {
-  display: block;
-  width: 32px;
-  height: 32px;
-  background-image: url("chrome://browser/skin/preferences/Options.png");
-  background-repeat: no-repeat;
-}
-
-.preference-icon {
-  display: block;
-  width: 32px;
-  height: 32px;
-  background-image: url("chrome://browser/skin/preferences/Options.png");
-  background-repeat: no-repeat;
-  margin: 0 20px;
-}
-
-.preference-icon[type="general"],
-.landingButton-icon[type="general"] {
-  background-position: 0 0;
-}
-
-.preference-icon[type="content"],
-.landingButton-icon[type="content"] {
-  background-position: -64px 0;
-}
-
-.preference-icon[type="applications"],
-.landingButton-icon[type="applications"] {
-  background-position: -96px 0;
-}
-
-.preference-icon[type="privacy"],
-.landingButton-icon[type="privacy"] {
-  background-position: -128px 0;
-}
-
-.preference-icon[type="security"],
-.landingButton-icon[type="security"] {
-  background-position: -160px 0;
-}
-
-.preference-icon[type="advanced"],
-.landingButton-icon[type="advanced"] {
-  background-position: -192px 0;
-}
-
-.preference-icon[type="sync"],
-.landingButton-icon[type="sync"] {
-  background-image: url("chrome://browser/skin/preferences/Options-sync.png");
-}
-
-caption {
-  font-size: 20px;
-}
-
-.heading {
-  height: 50px;
-  background-color: rgba(192,199,210,0.7);
-  border-radius: 5px 5px 0 0;
-  margin-bottom: 15px;
-  -moz-box-align: center;
-}
-
-prefpane > .content-box {
-  overflow: auto;
-}
-
-/* Applications Pane Styles */
-
-#applications-content {
-  padding: 15px;
-}
-
-#handlersView {
-  -moz-appearance: none;
-  border: 1px solid rgba(60,73,97,0.5);
-  overflow-y: auto;
-}
-
-/* XXX This style is for bug 740213 and should be removed once that
-   bug has a solution. */
-description > html|a {
-  cursor: pointer;
-}
-
-/* XXX Styles Below can be removed once bug 660726 lands */
-.nav-button {
-  list-style-image: url(chrome://mozapps/skin/extensions/navigation.png);
-}
-
-#back-btn:-moz-locale-dir(ltr),
-#forward-btn:-moz-locale-dir(rtl) {
-  border-top-right-radius: 0;
-  border-bottom-right-radius: 0;
-  border-right: none;
-  -moz-image-region: rect(0, 20px, 20px, 0);
-  padding-right: 3px;
-}
-
-#back-btn:-moz-locale-dir(rtl),
-#forward-btn:-moz-locale-dir(ltr) {
-  border-top-left-radius: 0;
-  border-bottom-left-radius: 0;
-  -moz-image-region: rect(0, 40px, 20px, 20px);
-  padding-left: 3px;
-}
-
-.header-button {
-  -moz-appearance: none;
-  padding: 0 4px;
-  margin: 0;
-  height: 22px;
-  border: 1px solid rgba(60,73,97,0.5);
-  border-radius: @toolbarbuttonCornerRadius@;
-  box-shadow: inset 0 1px rgba(255,255,255,0.25), 0 1px rgba(255,255,255,0.25);
-  background: linear-gradient(rgba(255,255,255,0.45), rgba(255,255,255,0));
-  background-clip: padding-box;
-}
-
-.header-button .toolbarbutton-text {
-  display: none;
-}
-
-.header-button[disabled="true"] .toolbarbutton-icon {
-  opacity: 0.4;
-}
-
-.header-button:not([disabled="true"]):active:hover,
-.header-button[open="true"] {
-  border-color: rgba(45,54,71,0.7);
-  box-shadow: inset 0 0 4px rgb(45,54,71), 0 1px rgba(255,255,255,0.25);
-  background-image: linear-gradient(rgba(45,54,71,0.6), rgba(45,54,71,0));
-}
+/* - This Source Code Form is subject to the terms of the Mozilla Public
+   - License, v. 2.0. If a copy of the MPL was not distributed with this file,
+   - You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+@import url("chrome://global/skin/inContentUI.css");
+
+@namespace html "http://www.w3.org/1999/xhtml";
+
+#preferences-home {
+  display: block;
+}
+
+#header {
+  margin-bottom: 18px;
+}
+
+.landingButton {
+  -moz-box-align: center;
+  -moz-box-orient: vertical;
+  border: none;
+  background: none;
+  box-shadow: none;
+}
+
+.landingButton:hover {
+  cursor: pointer;
+}
+
+.landingButton-label {
+  margin-top: 4px;
+}
+
+.landingButton-icon {
+  display: block;
+  width: 32px;
+  height: 32px;
+  background-image: url("chrome://browser/skin/preferences/Options.png");
+  background-repeat: no-repeat;
+}
+
+.preference-icon {
+  display: block;
+  width: 32px;
+  height: 32px;
+  background-image: url("chrome://browser/skin/preferences/Options.png");
+  background-repeat: no-repeat;
+  margin: 0 20px;
+}
+
+.preference-icon[type="general"],
+.landingButton-icon[type="general"] {
+  background-position: 0 0;
+}
+
+.preference-icon[type="content"],
+.landingButton-icon[type="content"] {
+  background-position: -64px 0;
+}
+
+.preference-icon[type="applications"],
+.landingButton-icon[type="applications"] {
+  background-position: -96px 0;
+}
+
+.preference-icon[type="privacy"],
+.landingButton-icon[type="privacy"] {
+  background-position: -128px 0;
+}
+
+.preference-icon[type="security"],
+.landingButton-icon[type="security"] {
+  background-position: -160px 0;
+}
+
+.preference-icon[type="advanced"],
+.landingButton-icon[type="advanced"] {
+  background-position: -192px 0;
+}
+
+.preference-icon[type="sync"],
+.landingButton-icon[type="sync"] {
+  background-image: url("chrome://browser/skin/preferences/Options-sync.png");
+}
+
+caption {
+  font-size: 20px;
+}
+
+.heading {
+  height: 50px;
+  background-color: rgba(192,199,210,0.7);
+  border-radius: 5px 5px 0 0;
+  margin-bottom: 15px;
+  -moz-box-align: center;
+}
+
+prefpane > .content-box {
+  overflow: auto;
+}
+
+/* Applications Pane Styles */
+
+#applications-content {
+  padding: 15px;
+}
+
+#handlersView {
+  -moz-appearance: none;
+  border: 1px solid rgba(60,73,97,0.5);
+  overflow-y: auto;
+}
+
+/* XXX This style is for bug 740213 and should be removed once that
+   bug has a solution. */
+description > html|a {
+  cursor: pointer;
+}
+
+/* XXX Styles Below can be removed once bug 660726 lands */
+.nav-button {
+  list-style-image: url(chrome://mozapps/skin/extensions/navigation.png);
+}
+
+#back-btn:-moz-locale-dir(ltr),
+#forward-btn:-moz-locale-dir(rtl) {
+  border-top-right-radius: 0;
+  border-bottom-right-radius: 0;
+  border-right: none;
+  -moz-image-region: rect(0, 20px, 20px, 0);
+  padding-right: 3px;
+}
+
+#back-btn:-moz-locale-dir(rtl),
+#forward-btn:-moz-locale-dir(ltr) {
+  border-top-left-radius: 0;
+  border-bottom-left-radius: 0;
+  -moz-image-region: rect(0, 40px, 20px, 20px);
+  padding-left: 3px;
+}
+
+.header-button {
+  -moz-appearance: none;
+  padding: 0 4px;
+  margin: 0;
+  height: 22px;
+  border: 1px solid rgba(60,73,97,0.5);
+  border-radius: @toolbarbuttonCornerRadius@;
+  box-shadow: inset 0 1px rgba(255,255,255,0.25), 0 1px rgba(255,255,255,0.25);
+  background: linear-gradient(rgba(255,255,255,0.45), rgba(255,255,255,0));
+  background-clip: padding-box;
+}
+
+.header-button .toolbarbutton-text {
+  display: none;
+}
+
+.header-button[disabled="true"] .toolbarbutton-icon {
+  opacity: 0.4;
+}
+
+.header-button:not([disabled="true"]):active:hover,
+.header-button[open="true"] {
+  border-color: rgba(45,54,71,0.7);
+  box-shadow: inset 0 0 4px rgb(45,54,71), 0 1px rgba(255,255,255,0.25);
+  background-image: linear-gradient(rgba(45,54,71,0.6), rgba(45,54,71,0));
+}
--- a/browser/themes/windows/preferences/in-content/preferences.css
+++ b/browser/themes/windows/preferences/in-content/preferences.css
@@ -1,177 +1,177 @@
-/* - This Source Code Form is subject to the terms of the Mozilla Public
-   - License, v. 2.0. If a copy of the MPL was not distributed with this file,
-   - You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-@import url("chrome://global/skin/inContentUI.css");
-
-@namespace html "http://www.w3.org/1999/xhtml";
-
-#preferences-home {
-  display: block;
-}
-
-#header {
-  margin-bottom: 18px;
-}
-
-.landingButton {
-  -moz-box-align: center;
-  -moz-box-orient: vertical;
-  border: none;
-  background: none;
-  box-shadow: none;
-}
-
-.landingButton:hover {
-  cursor: pointer;
-}
-
-.landingButton-label {
-  margin-top: 4px;
-}
-
-.landingButton-icon {
-  display: block;
-  width: 32px;
-  height: 32px;
-  background-image: url("chrome://browser/skin/preferences/Options.png");
-  background-repeat: no-repeat;
-}
-
-.preference-icon {
-  display: block;
-  width: 32px;
-  height: 32px;
-  background-image: url("chrome://browser/skin/preferences/Options.png");
-  background-repeat: no-repeat;
-  margin: 0 20px;
-}
-
-.preference-icon[type="general"],
-.landingButton-icon[type="general"] {
-  background-position: 0 0;
-}
-
-.preference-icon[type="content"],
-.landingButton-icon[type="content"] {
-  background-position: -64px 0;
-}
-
-.preference-icon[type="applications"],
-.landingButton-icon[type="applications"] {
-  background-position: -96px 0;
-}
-
-.preference-icon[type="privacy"],
-.landingButton-icon[type="privacy"] {
-  background-position: -128px 0;
-}
-
-.preference-icon[type="security"],
-.landingButton-icon[type="security"] {
-  background-position: -160px 0;
-}
-
-.preference-icon[type="advanced"],
-.landingButton-icon[type="advanced"] {
-  background-position: -192px 0;
-}
-
-.preference-icon[type="sync"],
-.landingButton-icon[type="sync"] {
-  background-image: url("chrome://browser/skin/preferences/Options-sync.png");
-}
-
-caption {
-  font-size: 20px;
-}
-
-.heading {
-  height: 50px;
-  background-color: rgba(192,199,210,0.7);
-  border-radius: 5px 5px 0 0;
-  margin-bottom: 15px;
-  -moz-box-align: center;
-}
-
-prefpane > .content-box {
-  overflow: auto;
-}
-
-/* Applications Pane Styles */
-
-#applications-content {
-  padding: 15px;
-}
-
-#handlersView {
-  -moz-appearance: none;
-  border: 1px solid rgba(31,64,100,0.4);
-  overflow-y: auto;
-}
-
-/* XXX This style is for bug 740213 and should be removed once that
-   bug has a solution. */
-description > html|a {
-  cursor: pointer;
-}
-
-/* XXX Styles Below can be removed once bug 660726 lands */
-.nav-button {
-  list-style-image: url(chrome://mozapps/skin/extensions/navigation.png);
-}
-
-#forward-btn {
-  -moz-border-start: none;
-}
-
-#back-btn:-moz-locale-dir(ltr),
-#forward-btn:-moz-locale-dir(rtl) {
-  -moz-image-region: rect(0, 18px, 18px, 0);
-  border-top-right-radius: 0;
-  border-bottom-right-radius: 0;
-}
-
-#back-btn:-moz-locale-dir(rtl),
-#forward-btn:-moz-locale-dir(ltr) {
-  -moz-image-region: rect(0, 36px, 18px, 18px);
-  border-top-left-radius: 0;
-  border-bottom-left-radius: 0;
-}
-
-.header-button[disabled="true"] {
-  opacity: 0.8;
-}
-
-.header-button {
-  -moz-appearance: none;
-  padding: 1px 3px;
-  color: #444;
-  text-shadow: 0 0 3px white;
-  background: linear-gradient(
-                rgba(251,252,253,0.95),
-                rgba(246,247,248,0) 49%,
-                rgba(211,212,213,0.45) 51%,
-                rgba(225,226,229, 0.3));
-  background-clip: padding-box;
-  border-radius: 2.5px;
-  border: 1px solid rgba(31,64,100,0.4);
-  border-top-color: rgba(31,64,100,0.3);
-  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.25) inset,
-              0 0 2px 1px rgba(255, 255, 255, 0.25) inset;
-}
-
-.header-button[disabled="true"] > .toolbarbutton-icon {
-  opacity: 0.4;
-}
-
-.header-button:not([disabled="true"]):active:hover,
-.header-button[open="true"] {
-  background-color: rgba(61, 76, 92, 0.2);
-  border-color: rgba(39, 53, 68, 0.5);
-  box-shadow: 0 0 3px 1px rgba(39, 53, 68, 0.2) inset;
-}
-
-.header-button > .toolbarbutton-text {
-  display: none;
-}
+/* - This Source Code Form is subject to the terms of the Mozilla Public
+   - License, v. 2.0. If a copy of the MPL was not distributed with this file,
+   - You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+@import url("chrome://global/skin/inContentUI.css");
+
+@namespace html "http://www.w3.org/1999/xhtml";
+
+#preferences-home {
+  display: block;
+}
+
+#header {
+  margin-bottom: 18px;
+}
+
+.landingButton {
+  -moz-box-align: center;
+  -moz-box-orient: vertical;
+  border: none;
+  background: none;
+  box-shadow: none;
+}
+
+.landingButton:hover {
+  cursor: pointer;
+}
+
+.landingButton-label {
+  margin-top: 4px;
+}
+
+.landingButton-icon {
+  display: block;
+  width: 32px;
+  height: 32px;
+  background-image: url("chrome://browser/skin/preferences/Options.png");
+  background-repeat: no-repeat;
+}
+
+.preference-icon {
+  display: block;
+  width: 32px;
+  height: 32px;
+  background-image: url("chrome://browser/skin/preferences/Options.png");
+  background-repeat: no-repeat;
+  margin: 0 20px;
+}
+
+.preference-icon[type="general"],
+.landingButton-icon[type="general"] {
+  background-position: 0 0;
+}
+
+.preference-icon[type="content"],
+.landingButton-icon[type="content"] {
+  background-position: -64px 0;
+}
+
+.preference-icon[type="applications"],
+.landingButton-icon[type="applications"] {
+  background-position: -96px 0;
+}
+
+.preference-icon[type="privacy"],
+.landingButton-icon[type="privacy"] {
+  background-position: -128px 0;
+}
+
+.preference-icon[type="security"],
+.landingButton-icon[type="security"] {
+  background-position: -160px 0;
+}
+
+.preference-icon[type="advanced"],
+.landingButton-icon[type="advanced"] {
+  background-position: -192px 0;
+}
+
+.preference-icon[type="sync"],
+.landingButton-icon[type="sync"] {
+  background-image: url("chrome://browser/skin/preferences/Options-sync.png");
+}
+
+caption {
+  font-size: 20px;
+}
+
+.heading {
+  height: 50px;
+  background-color: rgba(192,199,210,0.7);
+  border-radius: 5px 5px 0 0;
+  margin-bottom: 15px;
+  -moz-box-align: center;
+}
+
+prefpane > .content-box {
+  overflow: auto;
+}
+
+/* Applications Pane Styles */
+
+#applications-content {
+  padding: 15px;
+}
+
+#handlersView {
+  -moz-appearance: none;
+  border: 1px solid rgba(31,64,100,0.4);
+  overflow-y: auto;
+}
+
+/* XXX This style is for bug 740213 and should be removed once that
+   bug has a solution. */
+description > html|a {
+  cursor: pointer;
+}
+
+/* XXX Styles Below can be removed once bug 660726 lands */
+.nav-button {
+  list-style-image: url(chrome://mozapps/skin/extensions/navigation.png);
+}
+
+#forward-btn {
+  -moz-border-start: none;
+}
+
+#back-btn:-moz-locale-dir(ltr),
+#forward-btn:-moz-locale-dir(rtl) {
+  -moz-image-region: rect(0, 18px, 18px, 0);
+  border-top-right-radius: 0;
+  border-bottom-right-radius: 0;
+}
+
+#back-btn:-moz-locale-dir(rtl),
+#forward-btn:-moz-locale-dir(ltr) {
+  -moz-image-region: rect(0, 36px, 18px, 18px);
+  border-top-left-radius: 0;
+  border-bottom-left-radius: 0;
+}
+
+.header-button[disabled="true"] {
+  opacity: 0.8;
+}
+
+.header-button {
+  -moz-appearance: none;
+  padding: 1px 3px;
+  color: #444;
+  text-shadow: 0 0 3px white;
+  background: linear-gradient(
+                rgba(251,252,253,0.95),
+                rgba(246,247,248,0) 49%,
+                rgba(211,212,213,0.45) 51%,
+                rgba(225,226,229, 0.3));
+  background-clip: padding-box;
+  border-radius: 2.5px;
+  border: 1px solid rgba(31,64,100,0.4);
+  border-top-color: rgba(31,64,100,0.3);
+  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.25) inset,
+              0 0 2px 1px rgba(255, 255, 255, 0.25) inset;
+}
+
+.header-button[disabled="true"] > .toolbarbutton-icon {
+  opacity: 0.4;
+}
+
+.header-button:not([disabled="true"]):active:hover,
+.header-button[open="true"] {
+  background-color: rgba(61, 76, 92, 0.2);
+  border-color: rgba(39, 53, 68, 0.5);
+  box-shadow: 0 0 3px 1px rgba(39, 53, 68, 0.2) inset;
+}
+
+.header-button > .toolbarbutton-text {
+  display: none;
+}
--- a/content/media/MediaDecoderReader.cpp
+++ b/content/media/MediaDecoderReader.cpp
@@ -597,10 +597,24 @@ nsresult MediaDecoderReader::DecodeToTar
     }
   }
 
   LOG(PR_LOG_DEBUG, ("MediaDecoderReader::DecodeToTarget(%lld) End", aTarget));
 
   return NS_OK;
 }
 
+nsresult
+MediaDecoderReader::GetBuffered(mozilla::dom::TimeRanges* aBuffered,
+                                int64_t aStartTime)
+{
+  MediaResource* stream = mDecoder->GetResource();
+  int64_t durationUs = 0;
+  {
+    ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
+    durationUs = mDecoder->GetMediaDuration();
+  }
+  GetEstimatedBufferedTimeRanges(stream, durationUs, aBuffered);
+  return NS_OK;
+}
+
 } // namespace mozilla
 
--- a/content/media/MediaDecoderReader.h
+++ b/content/media/MediaDecoderReader.h
@@ -520,19 +520,31 @@ protected:
   // Queue of video frames. This queue is threadsafe, and is accessed from
   // the decoder, state machine, and main threads.
   MediaQueue<VideoData> mVideoQueue;
 
 public:
   // Populates aBuffered with the time ranges which are buffered. aStartTime
   // must be the presentation time of the first frame in the media, e.g.
   // the media time corresponding to playback time/position 0. This function
-  // should only be called on the main thread.
+  // is called on the main, decode, and state machine threads.
+  //
+  // This base implementation in MediaDecoderReader estimates the time ranges
+  // buffered by interpolating the cached byte ranges with the duration
+  // of the media. Reader subclasses should override this method if they
+  // can quickly calculate the buffered ranges more accurately.
+  //
+  // The primary advantage of this implementation in the reader base class
+  // is that it's a fast approximation, which does not perform any I/O.
+  //
+  // The OggReader relies on this base implementation not performing I/O,
+  // since in FirefoxOS we can't do I/O on the main thread, where this is
+  // called.
   virtual nsresult GetBuffered(dom::TimeRanges* aBuffered,
-                               int64_t aStartTime) = 0;
+                               int64_t aStartTime);
 
   class VideoQueueMemoryFunctor : public nsDequeFunctor {
   public:
     VideoQueueMemoryFunctor() : mResult(0) {}
 
     virtual void* operator()(void* anObject);
 
     int64_t mResult;
--- a/content/media/apple/AppleMP3Reader.cpp
+++ b/content/media/apple/AppleMP3Reader.cpp
@@ -510,21 +510,9 @@ AppleMP3Reader::Seek(int64_t aTime,
 
   mDecoder->GetResource()->Seek(nsISeekableStream::NS_SEEK_SET, byteOffset);
 
   ResetDecode();
 
   return NS_OK;
 }
 
-
-nsresult
-AppleMP3Reader::GetBuffered(dom::TimeRanges* aBuffered,
-                            int64_t aStartTime)
-{
-  ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
-  GetEstimatedBufferedTimeRanges(mDecoder->GetResource(),
-                                 mDecoder->GetMediaDuration(),
-                                 aBuffered);
-  return NS_OK;
-}
-
 } // namespace mozilla
--- a/content/media/apple/AppleMP3Reader.h
+++ b/content/media/apple/AppleMP3Reader.h
@@ -33,19 +33,16 @@ public:
   virtual nsresult ReadMetadata(MediaInfo* aInfo,
                                 MetadataTags** aTags) MOZ_OVERRIDE;
 
   virtual nsresult Seek(int64_t aTime,
                         int64_t aStartTime,
                         int64_t aEndTime,
                         int64_t aCurrentTime) MOZ_OVERRIDE;
 
-  virtual nsresult GetBuffered(dom::TimeRanges* aBuffered,
-                               int64_t aStartTime) MOZ_OVERRIDE;
-
   void AudioSampleCallback(UInt32 aNumBytes,
                            UInt32 aNumPackets,
                            const void *aData,
                            AudioStreamPacketDescription *aPackets);
 
   void AudioMetadataCallback(AudioFileStreamID aFileStream,
                              AudioFileStreamPropertyID aPropertyID,
                              UInt32 *aFlags);
--- a/content/media/directshow/DirectShowReader.cpp
+++ b/content/media/directshow/DirectShowReader.cpp
@@ -326,30 +326,16 @@ DirectShowReader::Seek(int64_t aTargetUs
   NS_ENSURE_TRUE(SUCCEEDED(hr), NS_ERROR_FAILURE);
 
   hr = mControl->Run();
   NS_ENSURE_TRUE(SUCCEEDED(hr), NS_ERROR_FAILURE);
 
   return DecodeToTarget(aTargetUs);
 }
 
-nsresult
-DirectShowReader::GetBuffered(mozilla::dom::TimeRanges* aBuffered,
-                              int64_t aStartTime)
-{
-  MediaResource* stream = mDecoder->GetResource();
-  int64_t durationUs = 0;
-  {
-    ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
-    durationUs = mDecoder->GetMediaDuration();
-  }
-  GetEstimatedBufferedTimeRanges(stream, durationUs, aBuffered);
-  return NS_OK;
-}
-
 void
 DirectShowReader::OnDecodeThreadStart()
 {
   MOZ_ASSERT(mDecoder->OnDecodeThread(), "Should be on decode thread.");
   HRESULT hr = CoInitializeEx(0, COINIT_MULTITHREADED);
   NS_ENSURE_TRUE_VOID(SUCCEEDED(hr));
 }
 
--- a/content/media/directshow/DirectShowReader.h
+++ b/content/media/directshow/DirectShowReader.h
@@ -60,19 +60,16 @@ public:
   nsresult ReadMetadata(MediaInfo* aInfo,
                         MetadataTags** aTags) MOZ_OVERRIDE;
 
   nsresult Seek(int64_t aTime,
                 int64_t aStartTime,
                 int64_t aEndTime,
                 int64_t aCurrentTime) MOZ_OVERRIDE;
 
-  nsresult GetBuffered(mozilla::dom::TimeRanges* aBuffered,
-                       int64_t aStartTime) MOZ_OVERRIDE;
-
   void OnDecodeThreadStart() MOZ_OVERRIDE;
   void OnDecodeThreadFinish() MOZ_OVERRIDE;
 
   void NotifyDataArrived(const char* aBuffer,
                          uint32_t aLength,
                          int64_t aOffset) MOZ_OVERRIDE;
 
 private:
--- a/content/media/ogg/OggReader.cpp
+++ b/content/media/ogg/OggReader.cpp
@@ -1750,25 +1750,17 @@ nsresult OggReader::SeekBisection(int64_
 nsresult OggReader::GetBuffered(TimeRanges* aBuffered, int64_t aStartTime)
 {
   {
     mozilla::ReentrantMonitorAutoEnter mon(mMonitor);
     if (mIsChained)
       return NS_ERROR_FAILURE;
   }
 #ifdef OGG_ESTIMATE_BUFFERED
-  MediaResource* stream = mDecoder->GetResource();
-  int64_t durationUs = 0;
-  {
-    ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
-    durationUs = mDecoder->GetMediaDuration();
-  }
-  GetEstimatedBufferedTimeRanges(stream, durationUs, aBuffered);
-
-  return NS_OK;
+  return MediaDecoderReader::GetBuffered(aBuffered, aStartTime);
 #else
   // HasAudio and HasVideo are not used here as they take a lock and cause
   // a deadlock. Accessing mInfo doesn't require a lock - it doesn't change
   // after metadata is read.
   if (!mInfo.HasValidMedia()) {
     // No need to search through the file if there are no audio or video tracks
     return NS_OK;
   }
--- a/content/media/plugins/MediaPluginReader.cpp
+++ b/content/media/plugins/MediaPluginReader.cpp
@@ -324,31 +324,16 @@ nsresult MediaPluginReader::Seek(int64_t
   mVideoQueue.Erase();
   mAudioQueue.Erase();
 
   mAudioSeekTimeUs = mVideoSeekTimeUs = aTarget;
 
   return DecodeToTarget(aTarget);
 }
 
-nsresult MediaPluginReader::GetBuffered(mozilla::dom::TimeRanges* aBuffered, int64_t aStartTime)
-{
-  if (!mPlugin)
-    return NS_OK;
-
-  MediaResource* stream = mDecoder->GetResource();
-
-  int64_t durationUs = 0;
-  mPlugin->GetDuration(mPlugin, &durationUs);
-
-  GetEstimatedBufferedTimeRanges(stream, durationUs, aBuffered);
-  
-  return NS_OK;
-}
-
 MediaPluginReader::ImageBufferCallback::ImageBufferCallback(mozilla::layers::ImageContainer *aImageContainer) :
   mImageContainer(aImageContainer)
 {
 }
 
 void *
 MediaPluginReader::ImageBufferCallback::operator()(size_t aWidth, size_t aHeight,
                                                      MPAPI::ColorFormat aColorFormat)
--- a/content/media/plugins/MediaPluginReader.h
+++ b/content/media/plugins/MediaPluginReader.h
@@ -59,17 +59,16 @@ public:
   virtual bool HasVideo()
   {
     return mHasVideo;
   }
 
   virtual nsresult ReadMetadata(MediaInfo* aInfo,
                                 MetadataTags** aTags);
   virtual nsresult Seek(int64_t aTime, int64_t aStartTime, int64_t aEndTime, int64_t aCurrentTime);
-  virtual nsresult GetBuffered(mozilla::dom::TimeRanges* aBuffered, int64_t aStartTime);
   class ImageBufferCallback : public MPAPI::BufferCallback {
     typedef mozilla::layers::Image Image;
   public:
     ImageBufferCallback(mozilla::layers::ImageContainer *aImageContainer);
     void *operator()(size_t aWidth, size_t aHeight,
                      MPAPI::ColorFormat aColorFormat) MOZ_OVERRIDE;
     already_AddRefed<Image> GetImage();
   private:
--- a/content/media/wmf/WMFReader.cpp
+++ b/content/media/wmf/WMFReader.cpp
@@ -1023,22 +1023,9 @@ WMFReader::Seek(int64_t aTargetUs,
   NS_ENSURE_TRUE(SUCCEEDED(hr), NS_ERROR_FAILURE);
 
   hr = mSourceReader->SetCurrentPosition(GUID_NULL, var);
   NS_ENSURE_TRUE(SUCCEEDED(hr), NS_ERROR_FAILURE);
 
   return DecodeToTarget(aTargetUs);
 }
 
-nsresult
-WMFReader::GetBuffered(mozilla::dom::TimeRanges* aBuffered, int64_t aStartTime)
-{
-  MediaResource* stream = mDecoder->GetResource();
-  int64_t durationUs = 0;
-  {
-    ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
-    durationUs = mDecoder->GetMediaDuration();
-  }
-  GetEstimatedBufferedTimeRanges(stream, durationUs, aBuffered);
-  return NS_OK;
-}
-
 } // namespace mozilla
--- a/content/media/wmf/WMFReader.h
+++ b/content/media/wmf/WMFReader.h
@@ -43,19 +43,16 @@ public:
   nsresult ReadMetadata(MediaInfo* aInfo,
                         MetadataTags** aTags) MOZ_OVERRIDE;
 
   nsresult Seek(int64_t aTime,
                 int64_t aStartTime,
                 int64_t aEndTime,
                 int64_t aCurrentTime) MOZ_OVERRIDE;
 
-  nsresult GetBuffered(mozilla::dom::TimeRanges* aBuffered,
-                       int64_t aStartTime) MOZ_OVERRIDE;
-
   void OnDecodeThreadStart() MOZ_OVERRIDE;
   void OnDecodeThreadFinish() MOZ_OVERRIDE;
 
 private:
 
   HRESULT ConfigureAudioDecoder();
   HRESULT ConfigureVideoDecoder();
   HRESULT ConfigureVideoFrameGeometry(IMFMediaType* aMediaType);
--- a/dom/src/geolocation/nsGeolocation.cpp
+++ b/dom/src/geolocation/nsGeolocation.cpp
@@ -670,17 +670,18 @@ nsresult nsGeolocationService::Init()
   mProvider = new AndroidLocationProvider();
 #endif
 
 #ifdef MOZ_WIDGET_GONK
   mProvider = do_GetService(GONK_GPS_GEOLOCATION_PROVIDER_CONTRACTID);
 #endif
 
 #ifdef MOZ_WIDGET_COCOA
-  if (Preferences::GetBool("geo.provider.use_corelocation", false)) {
+  if (Preferences::GetBool("geo.provider.use_corelocation", true) &&
+      CoreLocationLocationProvider::IsCoreLocationAvailable()) {
     mProvider = new CoreLocationLocationProvider();
   }
 #endif
 
   // Override platform-specific providers with the default (network)
   // provider while testing. Our tests are currently not meant to exercise
   // the provider, and some tests rely on the network provider being used.
   // "geo.provider.testing" is always set for all plain and browser chrome
--- a/dom/system/mac/CoreLocationLocationProvider.h
+++ b/dom/system/mac/CoreLocationLocationProvider.h
@@ -27,14 +27,16 @@ class CoreLocationLocationProvider
   , public nsIGeolocationUpdate
 {
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSIGEOLOCATIONUPDATE
   NS_DECL_NSIGEOLOCATIONPROVIDER
 
   CoreLocationLocationProvider();
+  static bool IsCoreLocationAvailable();
+
 private:
   virtual ~CoreLocationLocationProvider() {};
 
   CoreLocationObjects* mCLObjects;
   nsCOMPtr<nsIGeolocationUpdate> mCallback;
 };
--- a/dom/system/mac/CoreLocationLocationProvider.mm
+++ b/dom/system/mac/CoreLocationLocationProvider.mm
@@ -12,16 +12,22 @@
 #include "CoreLocationLocationProvider.h"
 #include "prtime.h"
 
 #include <CoreLocation/CLError.h>
 #include <CoreLocation/CLLocation.h>
 #include <CoreLocation/CLLocationManager.h>
 #include <CoreLocation/CLLocationManagerDelegate.h>
 
+#include <objc/objc.h>
+#include <objc/objc-runtime.h>
+
+#include "nsObjCExceptions.h"
+#import <CoreWLAN/CoreWLAN.h>
+
 using namespace mozilla;
 
 static const CLLocationAccuracy kHIGH_ACCURACY = kCLLocationAccuracyBest;
 static const CLLocationAccuracy kDEFAULT_ACCURACY = kCLLocationAccuracyNearestTenMeters;
 
 @interface LocationDelegate : NSObject <CLLocationManagerDelegate>
 {
   CoreLocationLocationProvider* mProvider;
@@ -120,16 +126,45 @@ public:
 
 NS_IMPL_ISUPPORTS1(CoreLocationLocationProvider, nsIGeolocationProvider)
 
 CoreLocationLocationProvider::CoreLocationLocationProvider()
   : mCLObjects(nullptr)
 {
 }
 
+bool
+CoreLocationLocationProvider::IsCoreLocationAvailable()
+{
+  NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+
+  @try {
+    NSBundle * bundle = [[[NSBundle alloc] initWithPath:@"/System/Library/Frameworks/CoreWLAN.framework"] autorelease];
+    if (!bundle) {
+      [pool release];
+      return false;
+    }
+
+    Class CWI_class = [bundle classNamed:@"CWInterface"];
+    if (!CWI_class) {
+      [pool release];
+      return false;
+    }
+
+    if ([[[CWI_class interface] interfaceState] intValue] == kCWInterfaceStateRunning) {
+      [pool release];
+      return true;
+    }
+  }
+  @catch(NSException *e) {
+  }
+  [pool release];
+  return false;
+}
+
 NS_IMETHODIMP
 CoreLocationLocationProvider::Startup()
 {
   if (!mCLObjects) {
     nsAutoPtr<CoreLocationObjects> clObjs(new CoreLocationObjects());
 
     nsresult rv = clObjs->Init(this);
     NS_ENSURE_SUCCESS(rv, rv);
--- a/gfx/layers/ipc/ShadowLayers.cpp
+++ b/gfx/layers/ipc/ShadowLayers.cpp
@@ -302,31 +302,49 @@ ShadowLayerForwarder::RepositionChild(Sh
   } else {
     MOZ_LAYERS_LOG(("[LayersForwarder] OpRaiseToTopChild container=%p child=%p",
                    aContainer->AsLayer(), aChild->AsLayer()));
     mTxn->AddEdit(OpRaiseToTopChild(nullptr, Shadow(aContainer),
                                     nullptr, Shadow(aChild)));
   }
 }
 
+
+#ifdef DEBUG
+void
+ShadowLayerForwarder::CheckSurfaceDescriptor(const SurfaceDescriptor* aDescriptor) const
+{
+  if (!aDescriptor) {
+    return;
+  }
+
+  if (aDescriptor->type() == SurfaceDescriptor::TShmem) {
+    const mozilla::ipc::Shmem& shmem = aDescriptor->get_Shmem();
+    shmem.AssertInvariants();
+    MOZ_ASSERT(mShadowManager->IsTrackingSharedMemory(shmem.mSegment));
+  }
+}
+#endif
+
 void
 ShadowLayerForwarder::PaintedTiledLayerBuffer(CompositableClient* aCompositable,
                                               const SurfaceDescriptorTiles& aTileLayerDescriptor)
 {
   mTxn->AddNoSwapPaint(OpPaintTiledLayerBuffer(nullptr, aCompositable->GetIPDLActor(),
                                                aTileLayerDescriptor));
 }
 
 void
 ShadowLayerForwarder::UpdateTexture(CompositableClient* aCompositable,
                                     TextureIdentifier aTextureId,
                                     SurfaceDescriptor* aDescriptor)
 {
   if (aDescriptor->type() != SurfaceDescriptor::T__None &&
       aDescriptor->type() != SurfaceDescriptor::Tnull_t) {
+    CheckSurfaceDescriptor(aDescriptor);
     MOZ_ASSERT(aCompositable);
     MOZ_ASSERT(aCompositable->GetIPDLActor());
     mTxn->AddPaint(OpPaintTexture(nullptr, aCompositable->GetIPDLActor(), 1,
                                   SurfaceDescriptor(*aDescriptor)));
     *aDescriptor = SurfaceDescriptor();
   } else {
     NS_WARNING("Trying to send a null SurfaceDescriptor.");
   }
@@ -334,16 +352,17 @@ ShadowLayerForwarder::UpdateTexture(Comp
 
 void
 ShadowLayerForwarder::UpdateTextureNoSwap(CompositableClient* aCompositable,
                                           TextureIdentifier aTextureId,
                                           SurfaceDescriptor* aDescriptor)
 {
   if (aDescriptor->type() != SurfaceDescriptor::T__None &&
       aDescriptor->type() != SurfaceDescriptor::Tnull_t) {
+    CheckSurfaceDescriptor(aDescriptor);
     MOZ_ASSERT(aCompositable);
     MOZ_ASSERT(aCompositable->GetIPDLActor());
     mTxn->AddNoSwapPaint(OpPaintTexture(nullptr, aCompositable->GetIPDLActor(), 1,
                                         SurfaceDescriptor(*aDescriptor)));
     *aDescriptor = SurfaceDescriptor();
   } else {
     NS_WARNING("Trying to send a null SurfaceDescriptor.");
   }
@@ -364,16 +383,17 @@ ShadowLayerForwarder::UpdateTextureRegio
 void
 ShadowLayerForwarder::UpdateTextureIncremental(CompositableClient* aCompositable,
                                                TextureIdentifier aTextureId,
                                                SurfaceDescriptor& aDescriptor,
                                                const nsIntRegion& aUpdatedRegion,
                                                const nsIntRect& aBufferRect,
                                                const nsIntPoint& aBufferRotation)
 {
+  CheckSurfaceDescriptor(&aDescriptor);
   MOZ_ASSERT(aCompositable);
   MOZ_ASSERT(aCompositable->GetIPDLActor());
   mTxn->AddNoSwapPaint(OpPaintTextureIncremental(nullptr, aCompositable->GetIPDLActor(),
                                                  aTextureId,
                                                  aDescriptor,
                                                  aUpdatedRegion,
                                                  aBufferRect,
                                                  aBufferRotation));
@@ -391,16 +411,19 @@ bool
 ShadowLayerForwarder::AddTexture(CompositableClient* aCompositable,
                                  TextureClient* aTexture)
 {
   SurfaceDescriptor descriptor;
   if (!aTexture->ToSurfaceDescriptor(descriptor)) {
     NS_WARNING("Failed to serialize a TextureClient");
     return false;
   }
+  CheckSurfaceDescriptor(&descriptor);
+  MOZ_ASSERT(aCompositable);
+  MOZ_ASSERT(aCompositable->GetIPDLActor());
   MOZ_ASSERT(aTexture->GetFlags() != 0);
   mTxn->AddEdit(OpAddTexture(nullptr, aCompositable->GetIPDLActor(),
                              aTexture->GetID(),
                              descriptor,
                              aTexture->GetFlags()));
   return true;
 }
 
@@ -847,16 +870,19 @@ ShadowLayerForwarder::Connect(Compositab
 }
 
 void
 ShadowLayerForwarder::CreatedSingleBuffer(CompositableClient* aCompositable,
                                           const SurfaceDescriptor& aDescriptor,
                                           const TextureInfo& aTextureInfo,
                                           const SurfaceDescriptor* aDescriptorOnWhite)
 {
+  CheckSurfaceDescriptor(&aDescriptor);
+  CheckSurfaceDescriptor(aDescriptorOnWhite);
+
   MOZ_ASSERT(aDescriptor.type() != SurfaceDescriptor::T__None &&
              aDescriptor.type() != SurfaceDescriptor::Tnull_t);
   mTxn->AddEdit(OpCreatedTexture(nullptr, aCompositable->GetIPDLActor(),
                                  TextureFront,
                                  aDescriptor,
                                  aTextureInfo));
   if (aDescriptorOnWhite) {
     mTxn->AddEdit(OpCreatedTexture(nullptr, aCompositable->GetIPDLActor(),
@@ -878,16 +904,20 @@ ShadowLayerForwarder::CreatedIncremental
 void
 ShadowLayerForwarder::CreatedDoubleBuffer(CompositableClient* aCompositable,
                                           const SurfaceDescriptor& aFrontDescriptor,
                                           const SurfaceDescriptor& aBackDescriptor,
                                           const TextureInfo& aTextureInfo,
                                           const SurfaceDescriptor* aFrontDescriptorOnWhite,
                                           const SurfaceDescriptor* aBackDescriptorOnWhite)
 {
+  CheckSurfaceDescriptor(&aFrontDescriptor);
+  CheckSurfaceDescriptor(&aBackDescriptor);
+  CheckSurfaceDescriptor(aFrontDescriptorOnWhite);
+  CheckSurfaceDescriptor(aBackDescriptorOnWhite);
   MOZ_ASSERT(aFrontDescriptor.type() != SurfaceDescriptor::T__None &&
              aBackDescriptor.type() != SurfaceDescriptor::T__None &&
              aFrontDescriptor.type() != SurfaceDescriptor::Tnull_t &&
              aBackDescriptor.type() != SurfaceDescriptor::Tnull_t);
   mTxn->AddEdit(OpCreatedTexture(nullptr, aCompositable->GetIPDLActor(),
                                  TextureFront,
                                  aFrontDescriptor,
                                  aTextureInfo));
--- a/gfx/layers/ipc/ShadowLayers.h
+++ b/gfx/layers/ipc/ShadowLayers.h
@@ -408,16 +408,22 @@ public:
   static void PlatformSyncBeforeUpdate();
 
   static already_AddRefed<gfxASurface>
   OpenDescriptor(OpenMode aMode, const SurfaceDescriptor& aSurface);
 
 protected:
   ShadowLayerForwarder();
 
+#ifdef DEBUG
+  void CheckSurfaceDescriptor(const SurfaceDescriptor* aDescriptor) const;
+#else
+  void CheckSurfaceDescriptor(const SurfaceDescriptor* aDescriptor) const {}
+#endif
+
   PLayerTransactionChild* mShadowManager;
 
 #ifdef MOZ_HAVE_SURFACEDESCRIPTORGRALLOC
   // from ISurfaceAllocator
   virtual PGrallocBufferChild* AllocGrallocBuffer(const gfxIntSize& aSize,
                                                   uint32_t aFormat,
                                                   uint32_t aUsage,
                                                   MaybeMagicGrallocBufferHandle* aHandle) MOZ_OVERRIDE;
--- a/ipc/glue/Shmem.h
+++ b/ipc/glue/Shmem.h
@@ -49,21 +49,29 @@
  * If parent code wants to give access rights to the Shmem to the
  * child, it does so by sending its |Shmem| to the child, in an IPDL
  * message.  The parent's |Shmem| then "dies", i.e. becomes
  * inaccessible.  This process could be compared to passing a
  * "shmem-access baton" between parent and child.
  */
 
 namespace mozilla {
+namespace layers {
+class ShadowLayerForwarder;
+}
+
 namespace ipc {
 
 class Shmem MOZ_FINAL
 {
   friend struct IPC::ParamTraits<mozilla::ipc::Shmem>;
+#ifdef DEBUG
+  // For ShadowLayerForwarder::CheckSurfaceDescriptor
+  friend class mozilla::layers::ShadowLayerForwarder;
+#endif
 
 public:
   typedef int32_t id_t;
   // Low-level wrapper around platform shmem primitives.
   typedef mozilla::ipc::SharedMemory SharedMemory;
   typedef SharedMemory::SharedMemoryType SharedMemoryType;
   struct IHadBetterBeIPDLCodeCallingThis_OtherwiseIAmADoodyhead {};
 
--- a/js/src/frontend/BytecodeEmitter.cpp
+++ b/js/src/frontend/BytecodeEmitter.cpp
@@ -2618,16 +2618,32 @@ EmitSwitch(ExclusiveContext *cx, Bytecod
     if (pn->pn_right->isKind(PNK_LEXICALSCOPE))
         EMIT_UINT16_IMM_OP(JSOP_LEAVEBLOCK, blockObjCount);
 #endif
 
     return true;
 }
 
 bool
+BytecodeEmitter::isRunOnceLambda()
+{
+    // The run once lambda flags set by the parser are approximate, and we look
+    // at properties of the function itself before deciding to emit a function
+    // as a run once lambda.
+
+    if (!(parent && parent->emittingRunOnceLambda) && !lazyRunOnceLambda)
+        return false;
+
+    FunctionBox *funbox = sc->asFunctionBox();
+    return !funbox->argumentsHasLocalBinding() &&
+           !funbox->isGenerator() &&
+           !funbox->function()->name();
+}
+
+bool
 frontend::EmitFunctionScript(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *body)
 {
     /*
      * The decompiler has assumptions about what may occur immediately after
      * script->main (e.g., in the case of destructuring params). Thus, put the
      * following ops into the range [script->code, script->main). Note:
      * execution starts from script->code, so this has no semantic effect.
      */
@@ -2662,21 +2678,17 @@ frontend::EmitFunctionScript(ExclusiveCo
         bce->switchToMain();
     }
 
     /*
      * Emit a prologue for run-once scripts which will deoptimize JIT code if
      * the script ends up running multiple times via foo.caller related
      * shenanigans.
      */
-    bool runOnce =
-        bce->isRunOnceLambda() &&
-        !funbox->argumentsHasLocalBinding() &&
-        !funbox->isGenerator() &&
-        !funbox->function()->name();
+    bool runOnce = bce->isRunOnceLambda();
     if (runOnce) {
         bce->switchToProlog();
         if (Emit1(cx, bce, JSOP_RUNONCE) < 0)
             return false;
         bce->switchToMain();
     }
 
     if (!EmitTree(cx, bce, body))
--- a/js/src/frontend/BytecodeEmitter.h
+++ b/js/src/frontend/BytecodeEmitter.h
@@ -122,19 +122,17 @@ struct BytecodeEmitter
 
     bool            emittingForInit:1;  /* true while emitting init expr of for; exclude 'in' */
 
     bool            emittingRunOnceLambda:1; /* true while emitting a lambda which is only
                                                 expected to run once. */
     bool            lazyRunOnceLambda:1; /* true while lazily emitting a script for
                                           * a lambda which is only expected to run once. */
 
-    bool isRunOnceLambda() {
-        return (parent && parent->emittingRunOnceLambda) || lazyRunOnceLambda;
-    }
+    bool isRunOnceLambda();
 
     bool            insideEval:1;       /* True if compiling an eval-expression or a function
                                            nested inside an eval. */
 
     const bool      hasGlobalScope:1;   /* frontend::CompileScript's scope chain is the
                                            global object */
 
     enum EmitterMode {
--- a/js/src/jit/IonFrames.cpp
+++ b/js/src/jit/IonFrames.cpp
@@ -1244,36 +1244,43 @@ SnapshotIterator::slotReadable(const Slo
           return hasLocation(slot.value());
 #endif
 
       default:
         return true;
     }
 }
 
+typedef union {
+    double d;
+    float f;
+} PunDoubleFloat;
+
 Value
 SnapshotIterator::slotValue(const Slot &slot)
 {
     switch (slot.mode()) {
       case SnapshotReader::DOUBLE_REG:
         return DoubleValue(machine_.read(slot.floatReg()));
 
       case SnapshotReader::FLOAT32_REG:
       {
-        double asDouble = machine_.read(slot.floatReg());
+        PunDoubleFloat pdf;
+        pdf.d = machine_.read(slot.floatReg());
         // The register contains the encoding of a float32. We just read
         // the bits without making any conversion.
-        float asFloat = *(float*) &asDouble;
+        float asFloat = pdf.f;
         return DoubleValue(asFloat);
       }
 
       case SnapshotReader::FLOAT32_STACK:
       {
-        double asDouble = ReadFrameDoubleSlot(fp_, slot.stackSlot());
-        float asFloat = *(float*) &asDouble; // no conversion, see comment above.
+        PunDoubleFloat pdf;
+        pdf.d = ReadFrameDoubleSlot(fp_, slot.stackSlot());
+        float asFloat = pdf.f; // no conversion, see comment above.
         return DoubleValue(asFloat);
       }
 
       case SnapshotReader::TYPED_REG:
         return FromTypedPayload(slot.knownType(), machine_.read(slot.reg()));
 
       case SnapshotReader::TYPED_STACK:
       {
--- a/js/src/vm/SelfHosting.cpp
+++ b/js/src/vm/SelfHosting.cpp
@@ -76,16 +76,22 @@ js::intrinsic_IsCallable(JSContext *cx, 
 
 bool
 js::intrinsic_ThrowError(JSContext *cx, unsigned argc, Value *vp)
 {
     CallArgs args = CallArgsFromVp(argc, vp);
     JS_ASSERT(args.length() >= 1);
     uint32_t errorNumber = args[0].toInt32();
 
+#ifdef DEBUG
+    const JSErrorFormatString *efs =
+        js_GetLocalizedErrorMessage(cx, NULL, NULL, errorNumber);
+    JS_ASSERT(efs->argCount == args.length() - 1);
+#endif
+
     char *errorArgs[3] = {nullptr, nullptr, nullptr};
     for (unsigned i = 1; i < 4 && i < args.length(); i++) {
         RootedValue val(cx, args[i]);
         if (val.isInt32()) {
             JSString *str = ToString<CanGC>(cx, val);
             if (!str)
                 return false;
             errorArgs[i - 1] = JS_EncodeString(cx, str);
--- a/js/src/vm/ThreadPool.h
+++ b/js/src/vm/ThreadPool.h
@@ -10,17 +10,16 @@
 #include <stddef.h>
 #include <stdint.h>
 
 #include "jsalloc.h"
 #include "jspubtd.h"
 #ifdef JS_THREADSAFE
 # include "prcvar.h"
 # include "prlock.h"
-# include "prtypes.h"
 #endif
 
 #include "js/Vector.h"
 
 struct JSRuntime;
 struct JSCompartment;
 
 namespace js {
--- a/layout/svg/nsSVGGlyphFrame.cpp
+++ b/layout/svg/nsSVGGlyphFrame.cpp
@@ -1070,93 +1070,16 @@ nsSVGGlyphFrame::SetupContextPaint(gfxCo
     return false;
   }
 
   aContext->SetPattern(pattern);
   return true;
 }
 
 //----------------------------------------------------------------------
-// SVGTextContextPaint methods:
-
-already_AddRefed<gfxPattern>
-mozilla::SVGTextContextPaint::GetFillPattern(float aOpacity,
-                                            const gfxMatrix& aCTM)
-{
-  return mFillPaint.GetPattern(aOpacity, &nsStyleSVG::mFill, aCTM);
-}
-
-already_AddRefed<gfxPattern>
-mozilla::SVGTextContextPaint::GetStrokePattern(float aOpacity,
-                                              const gfxMatrix& aCTM)
-{
-  return mStrokePaint.GetPattern(aOpacity, &nsStyleSVG::mStroke, aCTM);
-}
-
-already_AddRefed<gfxPattern>
-mozilla::SVGTextContextPaint::Paint::GetPattern(float aOpacity,
-                                               nsStyleSVGPaint nsStyleSVG::*aFillOrStroke,
-                                               const gfxMatrix& aCTM)
-{
-  nsRefPtr<gfxPattern> pattern;
-  if (mPatternCache.Get(aOpacity, getter_AddRefs(pattern))) {
-    // Set the pattern matrix just in case it was messed with by a previous
-    // caller. We should get the same matrix each time a pattern is constructed
-    // so this should be fine.
-    pattern->SetMatrix(aCTM * mPatternMatrix);
-    return pattern.forget();
-  }
-
-  switch (mPaintType) {
-  case eStyleSVGPaintType_None:
-    pattern = new gfxPattern(gfxRGBA(0.0f, 0.0f, 0.0f, 0.0f));
-    mPatternMatrix = gfxMatrix();
-    break;
-  case eStyleSVGPaintType_Color:
-    pattern = new gfxPattern(gfxRGBA(NS_GET_R(mPaintDefinition.mColor) / 255.0,
-                                     NS_GET_G(mPaintDefinition.mColor) / 255.0,
-                                     NS_GET_B(mPaintDefinition.mColor) / 255.0,
-                                     NS_GET_A(mPaintDefinition.mColor) / 255.0 * aOpacity));
-    mPatternMatrix = gfxMatrix();
-    break;
-  case eStyleSVGPaintType_Server:
-    pattern = mPaintDefinition.mPaintServerFrame->GetPaintServerPattern(mFrame,
-                                                                        mContextMatrix,
-                                                                        aFillOrStroke,
-                                                                        aOpacity);
-    {
-      // m maps original-user-space to pattern space
-      gfxMatrix m = pattern->GetMatrix();
-      gfxMatrix deviceToOriginalUserSpace = mContextMatrix;
-      deviceToOriginalUserSpace.Invert();
-      // mPatternMatrix maps device space to pattern space via original user space
-      mPatternMatrix = deviceToOriginalUserSpace * m;
-    }
-    pattern->SetMatrix(aCTM * mPatternMatrix);
-    break;
-  case eStyleSVGPaintType_ContextFill:
-    pattern = mPaintDefinition.mContextPaint->GetFillPattern(aOpacity, aCTM);
-    // Don't cache this. mContextPaint will have cached it anyway. If we
-    // cache it, we'll have to compute mPatternMatrix, which is annoying.
-    return pattern.forget();
-  case eStyleSVGPaintType_ContextStroke:
-    pattern = mPaintDefinition.mContextPaint->GetStrokePattern(aOpacity, aCTM);
-    // Don't cache this. mContextPaint will have cached it anyway. If we
-    // cache it, we'll have to compute mPatternMatrix, which is annoying.
-    return pattern.forget();
-  default:
-    MOZ_ASSERT(false, "invalid paint type");
-    return nullptr;
-  }
-
-  mPatternCache.Put(aOpacity, pattern);
-  return pattern.forget();
-}
-
-//----------------------------------------------------------------------
 // Internal methods
 
 void
 nsSVGGlyphFrame::SetGlyphPosition(gfxPoint *aPosition, bool aForceGlobalTransform)
 {
   float drawScale, metricsScale;
 
   nsSVGTextPathFrame *textPath = FindTextPathParent();
--- a/layout/svg/nsSVGGlyphFrame.h
+++ b/layout/svg/nsSVGGlyphFrame.h
@@ -6,16 +6,17 @@
 #ifndef __NS_SVGGLYPHFRAME_H__
 #define __NS_SVGGLYPHFRAME_H__
 
 #include "mozilla/Attributes.h"
 #include "gfxSVGGlyphs.h"
 #include "nsISVGChildFrame.h"
 #include "nsISVGGlyphFragmentNode.h"
 #include "nsSVGGeometryFrame.h"
+#include "nsSVGTextFrame2.h" // for SVGTextContextPaint
 #include "nsSVGUtils.h"
 #include "nsTextFragment.h"
 #include "nsIContent.h"
 #include "DrawMode.h"
 
 class CharacterIterator;
 class gfxContext;
 class nsDisplaySVGGlyphs;
@@ -23,87 +24,20 @@ class nsRenderingContext;
 class nsSVGGlyphFrame;
 class nsSVGTextFrame;
 class nsSVGTextPathFrame;
 class gfxTextContextPaint;
 
 struct CharacterPosition;
 
 namespace mozilla {
-
 namespace dom {
 class SVGIRect;
 }
-
-// Slightly horrible callback for deferring application of opacity
-struct SVGTextContextPaint : public gfxTextContextPaint {
-  already_AddRefed<gfxPattern> GetFillPattern(float aOpacity,
-                                              const gfxMatrix& aCTM) MOZ_OVERRIDE;
-  already_AddRefed<gfxPattern> GetStrokePattern(float aOpacity,
-                                                const gfxMatrix& aCTM) MOZ_OVERRIDE;
-
-  void SetFillOpacity(float aOpacity) { mFillOpacity = aOpacity; }
-  float GetFillOpacity() MOZ_OVERRIDE { return mFillOpacity; }
-
-  void SetStrokeOpacity(float aOpacity) { mStrokeOpacity = aOpacity; }
-  float GetStrokeOpacity() MOZ_OVERRIDE { return mStrokeOpacity; }
-
-  struct Paint {
-    Paint() : mPaintType(eStyleSVGPaintType_None) {}
-
-    void SetPaintServer(nsIFrame *aFrame, const gfxMatrix& aContextMatrix,
-                        nsSVGPaintServerFrame *aPaintServerFrame) {
-      mPaintType = eStyleSVGPaintType_Server;
-      mPaintDefinition.mPaintServerFrame = aPaintServerFrame;
-      mFrame = aFrame;
-      mContextMatrix = aContextMatrix;
-    }
-
-    void SetColor(const nscolor &aColor) {
-      mPaintType = eStyleSVGPaintType_Color;
-      mPaintDefinition.mColor = aColor;
-    }
-
-    void SetContextPaint(gfxTextContextPaint *aContextPaint,
-                         nsStyleSVGPaintType aPaintType) {
-      NS_ASSERTION(aPaintType == eStyleSVGPaintType_ContextFill ||
-                   aPaintType == eStyleSVGPaintType_ContextStroke,
-                   "Invalid context paint type");
-      mPaintType = aPaintType;
-      mPaintDefinition.mContextPaint = aContextPaint;
-    }
-
-    union {
-      nsSVGPaintServerFrame *mPaintServerFrame;
-      gfxTextContextPaint *mContextPaint;
-      nscolor mColor;
-    } mPaintDefinition;
-
-    nsIFrame *mFrame;
-    // CTM defining the user space for the pattern we will use.
-    gfxMatrix mContextMatrix;
-    nsStyleSVGPaintType mPaintType;
-
-    // Device-space-to-pattern-space
-    gfxMatrix mPatternMatrix;
-    nsRefPtrHashtable<nsFloatHashKey, gfxPattern> mPatternCache;
-
-    already_AddRefed<gfxPattern> GetPattern(float aOpacity,
-                                            nsStyleSVGPaint nsStyleSVG::*aFillOrStroke,
-                                            const gfxMatrix& aCTM);
-  };
-
-  Paint mFillPaint;
-  Paint mStrokePaint;
-
-  float mFillOpacity;
-  float mStrokeOpacity;
-};
-
-} // namespace mozilla
+}
 
 using namespace mozilla;
 
 typedef nsSVGGeometryFrame nsSVGGlyphFrameBase;
 
 class nsSVGGlyphFrame : public nsSVGGlyphFrameBase,
                         public nsISVGGlyphFragmentNode,
                         public nsISVGChildFrame
--- a/layout/svg/nsSVGTextFrame2.cpp
+++ b/layout/svg/nsSVGTextFrame2.cpp
@@ -2964,18 +2964,96 @@ SVGTextDrawPathCallbacks::StrokeGeometry
       mColor == NS_40PERCENT_FOREGROUND_COLOR) {
     // Don't paint the stroke when we are filling with a selection color.
     if (nsSVGUtils::SetupCairoStroke(mFrame, gfx)) {
       gfx->Stroke();
     }
   }
 }
 
+//----------------------------------------------------------------------
+// SVGTextContextPaint methods:
+
+already_AddRefed<gfxPattern>
+SVGTextContextPaint::GetFillPattern(float aOpacity,
+                                    const gfxMatrix& aCTM)
+{
+  return mFillPaint.GetPattern(aOpacity, &nsStyleSVG::mFill, aCTM);
 }
 
+already_AddRefed<gfxPattern>
+SVGTextContextPaint::GetStrokePattern(float aOpacity,
+                                      const gfxMatrix& aCTM)
+{
+  return mStrokePaint.GetPattern(aOpacity, &nsStyleSVG::mStroke, aCTM);
+}
+
+already_AddRefed<gfxPattern>
+SVGTextContextPaint::Paint::GetPattern(float aOpacity,
+                                       nsStyleSVGPaint nsStyleSVG::*aFillOrStroke,
+                                       const gfxMatrix& aCTM)
+{
+  nsRefPtr<gfxPattern> pattern;
+  if (mPatternCache.Get(aOpacity, getter_AddRefs(pattern))) {
+    // Set the pattern matrix just in case it was messed with by a previous
+    // caller. We should get the same matrix each time a pattern is constructed
+    // so this should be fine.
+    pattern->SetMatrix(aCTM * mPatternMatrix);
+    return pattern.forget();
+  }
+
+  switch (mPaintType) {
+  case eStyleSVGPaintType_None:
+    pattern = new gfxPattern(gfxRGBA(0.0f, 0.0f, 0.0f, 0.0f));
+    mPatternMatrix = gfxMatrix();
+    break;
+  case eStyleSVGPaintType_Color:
+    pattern = new gfxPattern(gfxRGBA(NS_GET_R(mPaintDefinition.mColor) / 255.0,
+                                     NS_GET_G(mPaintDefinition.mColor) / 255.0,
+                                     NS_GET_B(mPaintDefinition.mColor) / 255.0,
+                                     NS_GET_A(mPaintDefinition.mColor) / 255.0 * aOpacity));
+    mPatternMatrix = gfxMatrix();
+    break;
+  case eStyleSVGPaintType_Server:
+    pattern = mPaintDefinition.mPaintServerFrame->GetPaintServerPattern(mFrame,
+                                                                        mContextMatrix,
+                                                                        aFillOrStroke,
+                                                                        aOpacity);
+    {
+      // m maps original-user-space to pattern space
+      gfxMatrix m = pattern->GetMatrix();
+      gfxMatrix deviceToOriginalUserSpace = mContextMatrix;
+      deviceToOriginalUserSpace.Invert();
+      // mPatternMatrix maps device space to pattern space via original user space
+      mPatternMatrix = deviceToOriginalUserSpace * m;
+    }
+    pattern->SetMatrix(aCTM * mPatternMatrix);
+    break;
+  case eStyleSVGPaintType_ContextFill:
+    pattern = mPaintDefinition.mContextPaint->GetFillPattern(aOpacity, aCTM);
+    // Don't cache this. mContextPaint will have cached it anyway. If we
+    // cache it, we'll have to compute mPatternMatrix, which is annoying.
+    return pattern.forget();
+  case eStyleSVGPaintType_ContextStroke:
+    pattern = mPaintDefinition.mContextPaint->GetStrokePattern(aOpacity, aCTM);
+    // Don't cache this. mContextPaint will have cached it anyway. If we
+    // cache it, we'll have to compute mPatternMatrix, which is annoying.
+    return pattern.forget();
+  default:
+    MOZ_ASSERT(false, "invalid paint type");
+    return nullptr;
+  }
+
+  mPatternCache.Put(aOpacity, pattern);
+  return pattern.forget();
+}
+
+} // namespace mozilla
+
+
 // ============================================================================
 // nsSVGTextFrame2
 
 // ----------------------------------------------------------------------------
 // Display list item
 
 class nsDisplaySVGText : public nsDisplayItem {
 public:
--- a/layout/svg/nsSVGTextFrame2.h
+++ b/layout/svg/nsSVGTextFrame2.h
@@ -5,18 +5,19 @@
 
 #ifndef NS_SVGTEXTFRAME2_H
 #define NS_SVGTEXTFRAME2_H
 
 #include "mozilla/Attributes.h"
 #include "gfxMatrix.h"
 #include "gfxRect.h"
 #include "gfxSVGGlyphs.h"
+#include "nsIContent.h"
 #include "nsStubMutationObserver.h"
-#include "nsSVGGlyphFrame.h" // for SVGTextContextPaint
+#include "nsSVGPaintServerFrame.h"
 #include "nsSVGTextContainerFrame.h"
 
 class nsDisplaySVGText;
 class nsRenderingContext;
 class nsSVGTextFrame2;
 class nsTextFrame;
 class gfxPath;
 
@@ -130,17 +131,82 @@ public:
   NS_DECL_NSIRUNNABLE
   GlyphMetricsUpdater(nsSVGTextFrame2* aFrame) : mFrame(aFrame) { }
   static void Run(nsSVGTextFrame2* aFrame);
   void Revoke() { mFrame = nullptr; }
 private:
   nsSVGTextFrame2* mFrame;
 };
 
-}
+// Slightly horrible callback for deferring application of opacity
+struct SVGTextContextPaint : public gfxTextContextPaint {
+  already_AddRefed<gfxPattern> GetFillPattern(float aOpacity,
+                                              const gfxMatrix& aCTM) MOZ_OVERRIDE;
+  already_AddRefed<gfxPattern> GetStrokePattern(float aOpacity,
+                                                const gfxMatrix& aCTM) MOZ_OVERRIDE;
+
+  void SetFillOpacity(float aOpacity) { mFillOpacity = aOpacity; }
+  float GetFillOpacity() MOZ_OVERRIDE { return mFillOpacity; }
+
+  void SetStrokeOpacity(float aOpacity) { mStrokeOpacity = aOpacity; }
+  float GetStrokeOpacity() MOZ_OVERRIDE { return mStrokeOpacity; }
+
+  struct Paint {
+    Paint() : mPaintType(eStyleSVGPaintType_None) {}
+
+    void SetPaintServer(nsIFrame *aFrame, const gfxMatrix& aContextMatrix,
+                        nsSVGPaintServerFrame *aPaintServerFrame) {
+      mPaintType = eStyleSVGPaintType_Server;
+      mPaintDefinition.mPaintServerFrame = aPaintServerFrame;
+      mFrame = aFrame;
+      mContextMatrix = aContextMatrix;
+    }
+
+    void SetColor(const nscolor &aColor) {
+      mPaintType = eStyleSVGPaintType_Color;
+      mPaintDefinition.mColor = aColor;
+    }
+
+    void SetContextPaint(gfxTextContextPaint *aContextPaint,
+                         nsStyleSVGPaintType aPaintType) {
+      NS_ASSERTION(aPaintType == eStyleSVGPaintType_ContextFill ||
+                   aPaintType == eStyleSVGPaintType_ContextStroke,
+                   "Invalid context paint type");
+      mPaintType = aPaintType;
+      mPaintDefinition.mContextPaint = aContextPaint;
+    }
+
+    union {
+      nsSVGPaintServerFrame *mPaintServerFrame;
+      gfxTextContextPaint *mContextPaint;
+      nscolor mColor;
+    } mPaintDefinition;
+
+    nsIFrame *mFrame;
+    // CTM defining the user space for the pattern we will use.
+    gfxMatrix mContextMatrix;
+    nsStyleSVGPaintType mPaintType;
+
+    // Device-space-to-pattern-space
+    gfxMatrix mPatternMatrix;
+    nsRefPtrHashtable<nsFloatHashKey, gfxPattern> mPatternCache;
+
+    already_AddRefed<gfxPattern> GetPattern(float aOpacity,
+                                            nsStyleSVGPaint nsStyleSVG::*aFillOrStroke,
+                                            const gfxMatrix& aCTM);
+  };
+
+  Paint mFillPaint;
+  Paint mStrokePaint;
+
+  float mFillOpacity;
+  float mStrokeOpacity;
+};
+
+} // namespace mozilla
 
 /**
  * Frame class for SVG <text> elements, used when the
  * layout.svg.css-text.enabled is true.
  *
  * An nsSVGTextFrame2 manages SVG text layout, painting and interaction for
  * all descendent text content elements.  The frame tree will look like this:
  *
@@ -180,16 +246,18 @@ class nsSVGTextFrame2 : public nsSVGText
   friend class mozilla::GlyphMetricsUpdater;
   friend class mozilla::TextFrameIterator;
   friend class mozilla::TextNodeCorrespondenceRecorder;
   friend struct mozilla::TextRenderedRun;
   friend class mozilla::TextRenderedRunIterator;
   friend class MutationObserver;
   friend class nsDisplaySVGText;
 
+  typedef mozilla::SVGTextContextPaint SVGTextContextPaint;
+
 protected:
   nsSVGTextFrame2(nsStyleContext* aContext)
     : nsSVGTextFrame2Base(aContext),
       mFontSizeScaleFactor(1.0f),
       mLastContextScale(1.0f),
       mLengthAdjustScaleFactor(1.0f)
   {
     AddStateBits(NS_STATE_SVG_POSITIONING_DIRTY);
--- a/media/webrtc/signaling/src/common/browser_logging/CSFLog.cpp
+++ b/media/webrtc/signaling/src/common/browser_logging/CSFLog.cpp
@@ -3,17 +3,16 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include <stdio.h>
 #include <string.h>
 #include <stdarg.h>
 
 #include "CSFLog.h"
 #include "base/basictypes.h"
-#include "prtypes.h"
 
 #include <map>
 #include "cpr_threads.h"
 #include "prrwlock.h"
 #include "prthread.h"
 #include "nsThreadUtils.h"
 #ifndef WIN32
 #include <pthread.h>
--- a/media/webrtc/signaling/src/sipcc/core/common/thread_monitor.c
+++ b/media/webrtc/signaling/src/sipcc/core/common/thread_monitor.c
@@ -1,16 +1,15 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "cpr_types.h"
 #include "cpr_stdlib.h"
 #include "thread_monitor.h"
-#include "prtypes.h"
 #include "mozilla/Assertions.h"
 
 /*
  * If thread is running, should have a non-zero entry here that is the threadId
  */
 static cprThread_t thread_list[THREADMON_MAX];
 static boolean wait_list[THREADMON_MAX];
 
--- a/mobile/android/components/HelperAppDialog.js
+++ b/mobile/android/components/HelperAppDialog.js
@@ -29,42 +29,102 @@ HelperAppLauncherDialog.prototype = {
     let defaultHandler = new Object();
     let apps = HelperApps.getAppsForUri(aLauncher.source, {
       mimeType: aLauncher.MIMEInfo.MIMEType,
     });
 
     // Add a fake intent for save to disk at the top of the list
     apps.unshift({
       name: bundle.GetStringFromName("helperapps.saveToDisk"),
+      packageName: "org.mozilla.gecko.Download",
       iconUri: "drawable://icon",
       launch: function() {
         // Reset the preferredAction here
         aLauncher.MIMEInfo.preferredAction = Ci.nsIMIMEInfo.saveToDisk;
         aLauncher.saveToDisk(null, false);
         return true;
       }
     });
 
-    let app = apps[0];
-    if (apps.length > 1) {
-      app = HelperApps.prompt(apps, {
-        title: bundle.GetStringFromName("helperapps.pick")
+    // See if the user already marked something as the default for this mimetype,
+    // and if that app is still installed.
+    let preferredApp = this._getPreferredApp(aLauncher);
+    if (preferredApp) {
+      let pref = apps.filter(function(app) {
+        return app.packageName === preferredApp;
       });
+
+      if (pref.length > 0) {
+        pref[0].launch(aLauncher.source);
+        return;
+      }
+    }
+
+    let callback = function(app) {
+      aLauncher.MIMEInfo.preferredAction = Ci.nsIMIMEInfo.useHelperApp;
+      app.launch(aLauncher.source);
+      if (!app.launch(aLauncher.source)) {
+        aLauncher.cancel(Cr.NS_BINDING_ABORTED);
+      }
     }
 
-    if (app) {
-      aLauncher.MIMEInfo.preferredAction = Ci.nsIMIMEInfo.useHelperApp;
-      if (!app.launch(aLauncher.source)) {
-        aLauncher.cancel();
-      }
+    if (apps.length > 1) {
+      HelperApps.prompt(apps, {
+        title: bundle.GetStringFromName("helperapps.pick"),
+        buttons: [
+          bundle.GetStringFromName("helperapps.alwaysUse"),
+          bundle.GetStringFromName("helperapps.useJustOnce")
+        ]
+      }, (data) => {
+        if (data.button < 0)
+          return;
+
+        callback(apps[data.icongrid0]);
+
+        if (data.button == 0)
+          this._setPreferredApp(aLauncher, apps[data.icongrid0]);
+      });
     } else {
-      // Something weird happened. Log an error
-      Services.console.logStringMessage("Unexpected selection from grid: " + app);
+      callback(apps[0]);
     }
+  },
 
+  _getPrefName: function getPrefName(mimetype) {
+    return "browser.download.preferred." + mimetype.replace("\\", ".");
+  },
+
+  _getMimeTypeFromLauncher: function getMimeTypeFromLauncher(launcher) {
+    let mime = launcher.MIMEInfo.MIMEType;
+    if (!mime)
+      mime = ContentAreaUtils.getMIMETypeForURI(launcher.source) || "";
+    return mime;
+  },
+
+  _getPreferredApp: function getPreferredApp(launcher) {
+    let mime = this._getMimeTypeFromLauncher(launcher);
+    if (!mime)
+      return;
+
+    try {
+      return Services.prefs.getCharPref(this._getPrefName(mime));
+    } catch(ex) {
+      Services.console.logStringMessage("Error getting pref for " + mime + " " + ex);
+    }
+    return null;
+  },
+
+  _setPreferredApp: function setPreferredApp(launcher, app) {
+    let mime = this._getMimeTypeFromLauncher(launcher);
+    if (!mime)
+      return;
+
+    if (app)
+      Services.prefs.setCharPref(this._getPrefName(mime), app.packageName);
+    else
+      Services.prefs.clearUserPref(this._getPrefName(mime));
   },
 
   promptForSaveToFile: function hald_promptForSaveToFile(aLauncher, aContext, aDefaultFile, aSuggestedFileExt, aForcePrompt) {
     // Retrieve the user's default download directory
     let dnldMgr = Cc["@mozilla.org/download-manager;1"].getService(Ci.nsIDownloadManager);
     let defaultFolder = dnldMgr.userDownloadsDirectory;
 
     try {
--- a/mobile/android/locales/en-US/chrome/browser.properties
+++ b/mobile/android/locales/en-US/chrome/browser.properties
@@ -260,16 +260,18 @@ helperapps.open=Open
 helperapps.ignore=Ignore
 helperapps.dontAskAgain=Don't ask again for this site
 helperapps.openWithApp2=Open With %S App
 helperapps.openWithList2=Open With an App
 helperapps.always=Always
 helperapps.never=Never
 helperapps.pick=Complete action using
 helperapps.saveToDisk=Download
+helperapps.alwaysUse=Always
+helperapps.useJustOnce=Just once
 
 #Lightweight themes
 # LOCALIZATION NOTE (lwthemeInstallRequest.message): %S will be replaced with
 # the host name of the site.
 lwthemeInstallRequest.message=This site (%S) attempted to install a theme.
 lwthemeInstallRequest.allowButton=Allow
 
 # LOCALIZATION NOTE (getUserMedia.shareCamera.message, getUserMedia.shareMicrophone.message, getUserMedia.shareCameraAndMicrophone.message, getUserMedia.sharingCamera.message, getUserMedia.sharingMicrophone.message, getUserMedia.sharingCameraAndMicrophone.message): %S is the website origin (e.g. www.mozilla.org)
deleted file mode 100644
deleted file mode 100644
deleted file mode 100644
--- a/mobile/android/services/android-drawable-mdpi-resources.mn
+++ /dev/null
@@ -1,2 +0,0 @@
-mobile/android/base/resources/drawable-mdpi/sync_desktop.png
-mobile/android/base/resources/drawable-mdpi/sync_mobile.png
deleted file mode 100644
--- a/mobile/android/services/android-drawable-resources.mn
+++ /dev/null
@@ -1,1 +0,0 @@
-mobile/android/base/resources/drawable/sync_pin_background.xml
deleted file mode 100644
--- a/mobile/android/services/android-layout-resources.mn
+++ /dev/null
@@ -1,11 +0,0 @@
-res/layout/sync_account.xml
-res/layout/sync_list_item.xml
-res/layout/sync_redirect_to_setup.xml
-res/layout/sync_send_tab.xml
-res/layout/sync_setup.xml
-res/layout/sync_setup_failure.xml
-res/layout/sync_setup_jpake_waiting.xml
-res/layout/sync_setup_nointernet.xml
-res/layout/sync_setup_pair.xml
-res/layout/sync_setup_success.xml
-res/layout/sync_setup_webview.xml
deleted file mode 100644
--- a/mobile/android/services/android-values-resources.mn
+++ /dev/null
@@ -1,1 +0,0 @@
-res/values-large-v11/sync_styles.xml 
deleted file mode 100644
--- a/mobile/android/services/java-sources.mn
+++ /dev/null
@@ -1,289 +0,0 @@
-background/announcements/Announcement.java
-background/announcements/AnnouncementPresenter.java
-background/announcements/AnnouncementsBroadcastReceiver.java
-background/announcements/AnnouncementsBroadcastService.java
-background/announcements/AnnouncementsFetchDelegate.java
-background/announcements/AnnouncementsFetcher.java
-background/announcements/AnnouncementsFetchResourceDelegate.java
-background/announcements/AnnouncementsService.java
-background/BackgroundService.java
-background/bagheera/BagheeraClient.java
-background/bagheera/BagheeraRequestDelegate.java
-background/bagheera/BoundedByteArrayEntity.java
-background/bagheera/DeflateHelper.java
-background/common/DateUtils.java
-background/common/log/Logger.java
-background/common/log/writers/AndroidLevelCachingLogWriter.java
-background/common/log/writers/AndroidLogWriter.java
-background/common/log/writers/LevelFilteringLogWriter.java
-background/common/log/writers/LogWriter.java
-background/common/log/writers/PrintLogWriter.java
-background/common/log/writers/SimpleTagLogWriter.java
-background/common/log/writers/StringLogWriter.java
-background/common/log/writers/TagLogWriter.java
-background/common/log/writers/ThreadLocalTagLogWriter.java
-background/datareporting/TelemetryRecorder.java
-background/db/CursorDumper.java
-background/db/Tab.java
-background/healthreport/Environment.java
-background/healthreport/EnvironmentBuilder.java
-background/healthreport/EnvironmentV1.java
-background/healthreport/HealthReportBroadcastReceiver.java
-background/healthreport/HealthReportBroadcastService.java
-background/healthreport/HealthReportDatabases.java
-background/healthreport/HealthReportDatabaseStorage.java
-background/healthreport/HealthReportGenerator.java
-background/healthreport/HealthReportProvider.java
-background/healthreport/HealthReportStorage.java
-background/healthreport/HealthReportUtils.java
-background/healthreport/ProfileInformationCache.java
-background/healthreport/prune/HealthReportPruneService.java
-background/healthreport/prune/PrunePolicy.java
-background/healthreport/prune/PrunePolicyDatabaseStorage.java
-background/healthreport/prune/PrunePolicyStorage.java
-background/healthreport/upload/AndroidSubmissionClient.java
-background/healthreport/upload/HealthReportUploadService.java
-background/healthreport/upload/ObsoleteDocumentTracker.java
-background/healthreport/upload/SubmissionClient.java
-background/healthreport/upload/SubmissionPolicy.java
-sync/AlreadySyncingException.java
-sync/CollectionKeys.java
-sync/CommandProcessor.java
-sync/CommandRunner.java
-sync/config/AccountPickler.java
-sync/config/activities/SelectEnginesActivity.java
-sync/config/ClientRecordTerminator.java
-sync/config/ConfigurationMigrator.java
-sync/CredentialException.java
-sync/CredentialsSource.java
-sync/crypto/CryptoException.java
-sync/crypto/CryptoInfo.java
-sync/crypto/HKDF.java
-sync/crypto/HMACVerificationException.java
-sync/crypto/KeyBundle.java
-sync/crypto/MissingCryptoInputException.java
-sync/crypto/NoKeyBundleException.java
-sync/crypto/PersistedCrypto5Keys.java
-sync/CryptoRecord.java
-sync/DelayedWorkTracker.java
-sync/delegates/ClientsDataDelegate.java
-sync/delegates/FreshStartDelegate.java
-sync/delegates/GlobalSessionCallback.java
-sync/delegates/JSONRecordFetchDelegate.java
-sync/delegates/KeyUploadDelegate.java
-sync/delegates/MetaGlobalDelegate.java
-sync/delegates/WipeServerDelegate.java
-sync/EngineSettings.java
-sync/ExtendedJSONObject.java
-sync/GlobalSession.java
-sync/HTTPFailureException.java
-sync/InfoCollections.java
-sync/InfoCounts.java
-sync/jpake/BigIntegerHelper.java
-sync/jpake/Gx3OrGx4IsZeroOrOneException.java
-sync/jpake/IncorrectZkpException.java
-sync/jpake/JPakeClient.java
-sync/jpake/JPakeCrypto.java
-sync/jpake/JPakeJson.java
-sync/jpake/JPakeNoActivePairingException.java
-sync/jpake/JPakeNumGenerator.java
-sync/jpake/JPakeNumGeneratorRandom.java
-sync/jpake/JPakeParty.java
-sync/jpake/stage/CompleteStage.java
-sync/jpake/stage/ComputeFinalStage.java
-sync/jpake/stage/ComputeKeyVerificationStage.java
-sync/jpake/stage/ComputeStepOneStage.java
-sync/jpake/stage/ComputeStepTwoStage.java
-sync/jpake/stage/DecryptDataStage.java
-sync/jpake/stage/DeleteChannel.java
-sync/jpake/stage/GetChannelStage.java
-sync/jpake/stage/GetRequestStage.java
-sync/jpake/stage/JPakeStage.java
-sync/jpake/stage/PutRequestStage.java
-sync/jpake/stage/VerifyPairingStage.java
-sync/jpake/Zkp.java
-sync/JSONRecordFetcher.java
-sync/KeyBundleProvider.java
-sync/MetaGlobal.java
-sync/MetaGlobalException.java
-sync/MetaGlobalMissingEnginesException.java
-sync/MetaGlobalNotSetException.java
-sync/middleware/Crypto5MiddlewareRepository.java
-sync/middleware/Crypto5MiddlewareRepositorySession.java
-sync/middleware/MiddlewareRepository.java
-sync/middleware/MiddlewareRepositorySession.java
-sync/net/AuthHeaderProvider.java
-sync/net/BaseResource.java
-sync/net/BaseResourceDelegate.java
-sync/net/BasicAuthHeaderProvider.java
-sync/net/BrowserIDAuthHeaderProvider.java
-sync/net/ConnectionMonitorThread.java
-sync/net/HandleProgressException.java
-sync/net/HawkAuthHeaderProvider.java
-sync/net/HMACAuthHeaderProvider.java
-sync/net/HttpResponseObserver.java
-sync/net/Resource.java
-sync/net/ResourceDelegate.java
-sync/net/SyncResponse.java
-sync/net/SyncStorageCollectionRequest.java
-sync/net/SyncStorageCollectionRequestDelegate.java
-sync/net/SyncStorageRecordRequest.java
-sync/net/SyncStorageRequest.java
-sync/net/SyncStorageRequestDelegate.java
-sync/net/SyncStorageRequestIncrementalDelegate.java
-sync/net/SyncStorageResponse.java
-sync/net/TLSSocketFactory.java
-sync/net/WBOCollectionRequestDelegate.java
-sync/net/WBORequestDelegate.java
-sync/NoCollectionKeysSetException.java
-sync/NodeAuthenticationException.java
-sync/NonArrayJSONException.java
-sync/NonObjectJSONException.java
-sync/NullClusterURLException.java
-sync/PersistedMetaGlobal.java
-sync/PrefsSource.java
-sync/receivers/SyncAccountDeletedReceiver.java
-sync/receivers/SyncAccountDeletedService.java
-sync/receivers/UpgradeReceiver.java
-sync/repositories/android/AndroidBrowserBookmarksDataAccessor.java
-sync/repositories/android/AndroidBrowserBookmarksRepository.java
-sync/repositories/android/AndroidBrowserBookmarksRepositorySession.java
-sync/repositories/android/AndroidBrowserHistoryDataAccessor.java
-sync/repositories/android/AndroidBrowserHistoryDataExtender.java
-sync/repositories/android/AndroidBrowserHistoryRepository.java
-sync/repositories/android/AndroidBrowserHistoryRepositorySession.java
-sync/repositories/android/AndroidBrowserRepository.java
-sync/repositories/android/AndroidBrowserRepositoryDataAccessor.java
-sync/repositories/android/AndroidBrowserRepositorySession.java
-sync/repositories/android/BookmarksDeletionManager.java
-sync/repositories/android/BookmarksInsertionManager.java
-sync/repositories/android/BrowserContractHelpers.java
-sync/repositories/android/CachedSQLiteOpenHelper.java
-sync/repositories/android/ClientsDatabase.java
-sync/repositories/android/ClientsDatabaseAccessor.java
-sync/repositories/android/FennecTabsRepository.java
-sync/repositories/android/FormHistoryRepositorySession.java
-sync/repositories/android/PasswordsRepositorySession.java
-sync/repositories/android/RepoUtils.java
-sync/repositories/BookmarkNeedsReparentingException.java
-sync/repositories/BookmarksRepository.java
-sync/repositories/ConstrainedServer11Repository.java
-sync/repositories/delegates/DeferrableRepositorySessionCreationDelegate.java
-sync/repositories/delegates/DeferredRepositorySessionBeginDelegate.java
-sync/repositories/delegates/DeferredRepositorySessionFetchRecordsDelegate.java
-sync/repositories/delegates/DeferredRepositorySessionFinishDelegate.java
-sync/repositories/delegates/DeferredRepositorySessionStoreDelegate.java
-sync/repositories/delegates/RepositorySessionBeginDelegate.java
-sync/repositories/delegates/RepositorySessionCleanDelegate.java
-sync/repositories/delegates/RepositorySessionCreationDelegate.java
-sync/repositories/delegates/RepositorySessionFetchRecordsDelegate.java
-sync/repositories/delegates/RepositorySessionFinishDelegate.java
-sync/repositories/delegates/RepositorySessionGuidsSinceDelegate.java
-sync/repositories/delegates/RepositorySessionStoreDelegate.java
-sync/repositories/delegates/RepositorySessionWipeDelegate.java
-sync/repositories/domain/BookmarkRecord.java
-sync/repositories/domain/BookmarkRecordFactory.java
-sync/repositories/domain/ClientRecord.java
-sync/repositories/domain/ClientRecordFactory.java
-sync/repositories/domain/FormHistoryRecord.java
-sync/repositories/domain/HistoryRecord.java
-sync/repositories/domain/HistoryRecordFactory.java
-sync/repositories/domain/PasswordRecord.java
-sync/repositories/domain/Record.java
-sync/repositories/domain/RecordParseException.java
-sync/repositories/domain/TabsRecord.java
-sync/repositories/domain/VersionConstants.java
-sync/repositories/FetchFailedException.java
-sync/repositories/HashSetStoreTracker.java
-sync/repositories/HistoryRepository.java
-sync/repositories/IdentityRecordFactory.java
-sync/repositories/InactiveSessionException.java
-sync/repositories/InvalidBookmarkTypeException.java
-sync/repositories/InvalidRequestException.java
-sync/repositories/InvalidSessionTransitionException.java
-sync/repositories/MultipleRecordsForGuidException.java
-sync/repositories/NoContentProviderException.java
-sync/repositories/NoGuidForIdException.java
-sync/repositories/NoStoreDelegateException.java
-sync/repositories/NullCursorException.java
-sync/repositories/ParentNotFoundException.java
-sync/repositories/ProfileDatabaseException.java
-sync/repositories/RecordFactory.java
-sync/repositories/RecordFilter.java
-sync/repositories/Repository.java
-sync/repositories/RepositorySession.java
-sync/repositories/RepositorySessionBundle.java
-sync/repositories/Server11Repository.java
-sync/repositories/Server11RepositorySession.java
-sync/repositories/StoreFailedException.java
-sync/repositories/StoreTracker.java
-sync/repositories/StoreTrackingRepositorySession.java
-sync/Server11PreviousPostFailedException.java
-sync/Server11RecordPostFailedException.java
-sync/setup/activities/AccountActivity.java
-sync/setup/activities/ActivityUtils.java
-sync/setup/activities/ClientRecordArrayAdapter.java
-sync/setup/activities/RedirectToSetupActivity.java
-sync/setup/activities/SendTabActivity.java
-sync/setup/activities/SendTabData.java
-sync/setup/activities/SetupFailureActivity.java
-sync/setup/activities/SetupSuccessActivity.java
-sync/setup/activities/SetupSyncActivity.java
-sync/setup/activities/SyncActivity.java
-sync/setup/activities/WebURLFinder.java
-sync/setup/activities/WebViewActivity.java
-sync/setup/auth/AccountAuthenticator.java
-sync/setup/auth/AuthenticateAccountStage.java
-sync/setup/auth/AuthenticationResult.java
-sync/setup/auth/AuthenticatorStage.java
-sync/setup/auth/EnsureUserExistenceStage.java
-sync/setup/auth/FetchUserNodeStage.java
-sync/setup/Constants.java
-sync/setup/InvalidSyncKeyException.java
-sync/setup/SyncAccounts.java
-sync/setup/SyncAuthenticatorService.java
-sync/stage/AbstractNonRepositorySyncStage.java
-sync/stage/AbstractSessionManagingSyncStage.java
-sync/stage/AndroidBrowserBookmarksServerSyncStage.java
-sync/stage/AndroidBrowserHistoryServerSyncStage.java
-sync/stage/CheckPreconditionsStage.java
-sync/stage/CompletedStage.java
-sync/stage/EnsureClusterURLStage.java
-sync/stage/EnsureCrypto5KeysStage.java
-sync/stage/FennecTabsServerSyncStage.java
-sync/stage/FetchInfoCollectionsStage.java
-sync/stage/FetchMetaGlobalStage.java
-sync/stage/FormHistoryServerSyncStage.java
-sync/stage/GlobalSyncStage.java
-sync/stage/NoSuchStageException.java
-sync/stage/NoSyncIDException.java
-sync/stage/PasswordsServerSyncStage.java
-sync/stage/SafeConstrainedServer11Repository.java
-sync/stage/ServerSyncStage.java
-sync/stage/SyncClientsEngineStage.java
-sync/stage/UploadMetaGlobalStage.java
-sync/syncadapter/SyncAdapter.java
-sync/syncadapter/SyncService.java
-sync/SyncConfiguration.java
-sync/SyncConfigurationException.java
-sync/SyncException.java
-sync/synchronizer/ConcurrentRecordConsumer.java
-sync/synchronizer/RecordConsumer.java
-sync/synchronizer/RecordsChannel.java
-sync/synchronizer/RecordsChannelDelegate.java
-sync/synchronizer/RecordsConsumerDelegate.java
-sync/synchronizer/SerialRecordConsumer.java
-sync/synchronizer/ServerLocalSynchronizer.java
-sync/synchronizer/ServerLocalSynchronizerSession.java
-sync/synchronizer/SessionNotBegunException.java
-sync/synchronizer/Synchronizer.java
-sync/synchronizer/SynchronizerDelegate.java
-sync/synchronizer/SynchronizerSession.java
-sync/synchronizer/SynchronizerSessionDelegate.java
-sync/synchronizer/UnbundleError.java
-sync/synchronizer/UnexpectedSessionException.java
-sync/SynchronizerConfiguration.java
-sync/ThreadPool.java
-sync/UnexpectedJSONException.java
-sync/UnknownSynchronizerConfigurationVersionException.java
-sync/Utils.java
deleted file mode 100644
--- a/mobile/android/services/java-third-party-sources.mn
+++ /dev/null
@@ -1,464 +0,0 @@
-ch/boye/httpclientandroidlib/androidextra/HttpClientAndroidLog.java
-ch/boye/httpclientandroidlib/annotation/GuardedBy.java
-ch/boye/httpclientandroidlib/annotation/Immutable.java
-ch/boye/httpclientandroidlib/annotation/NotThreadSafe.java
-ch/boye/httpclientandroidlib/annotation/ThreadSafe.java
-ch/boye/httpclientandroidlib/auth/AUTH.java
-ch/boye/httpclientandroidlib/auth/AuthenticationException.java
-ch/boye/httpclientandroidlib/auth/AuthScheme.java
-ch/boye/httpclientandroidlib/auth/AuthSchemeFactory.java
-ch/boye/httpclientandroidlib/auth/AuthSchemeRegistry.java
-ch/boye/httpclientandroidlib/auth/AuthScope.java
-ch/boye/httpclientandroidlib/auth/AuthState.java
-ch/boye/httpclientandroidlib/auth/BasicUserPrincipal.java
-ch/boye/httpclientandroidlib/auth/ContextAwareAuthScheme.java
-ch/boye/httpclientandroidlib/auth/Credentials.java
-ch/boye/httpclientandroidlib/auth/InvalidCredentialsException.java
-ch/boye/httpclientandroidlib/auth/MalformedChallengeException.java
-ch/boye/httpclientandroidlib/auth/NTCredentials.java
-ch/boye/httpclientandroidlib/auth/NTUserPrincipal.java
-ch/boye/httpclientandroidlib/auth/params/AuthParamBean.java
-ch/boye/httpclientandroidlib/auth/params/AuthParams.java
-ch/boye/httpclientandroidlib/auth/params/AuthPNames.java
-ch/boye/httpclientandroidlib/auth/UsernamePasswordCredentials.java
-ch/boye/httpclientandroidlib/client/AuthCache.java
-ch/boye/httpclientandroidlib/client/AuthenticationHandler.java
-ch/boye/httpclientandroidlib/client/CircularRedirectException.java
-ch/boye/httpclientandroidlib/client/ClientProtocolException.java
-ch/boye/httpclientandroidlib/client/CookieStore.java
-ch/boye/httpclientandroidlib/client/CredentialsProvider.java
-ch/boye/httpclientandroidlib/client/entity/DecompressingEntity.java
-ch/boye/httpclientandroidlib/client/entity/DeflateDecompressingEntity.java
-ch/boye/httpclientandroidlib/client/entity/GzipDecompressingEntity.java
-ch/boye/httpclientandroidlib/client/entity/UrlEncodedFormEntity.java
-ch/boye/httpclientandroidlib/client/HttpClient.java
-ch/boye/httpclientandroidlib/client/HttpRequestRetryHandler.java
-ch/boye/httpclientandroidlib/client/HttpResponseException.java
-ch/boye/httpclientandroidlib/client/methods/AbortableHttpRequest.java
-ch/boye/httpclientandroidlib/client/methods/HttpDelete.java
-ch/boye/httpclientandroidlib/client/methods/HttpEntityEnclosingRequestBase.java
-ch/boye/httpclientandroidlib/client/methods/HttpGet.java
-ch/boye/httpclientandroidlib/client/methods/HttpHead.java
-ch/boye/httpclientandroidlib/client/methods/HttpOptions.java
-ch/boye/httpclientandroidlib/client/methods/HttpPost.java
-ch/boye/httpclientandroidlib/client/methods/HttpPut.java
-ch/boye/httpclientandroidlib/client/methods/HttpRequestBase.java
-ch/boye/httpclientandroidlib/client/methods/HttpTrace.java
-ch/boye/httpclientandroidlib/client/methods/HttpUriRequest.java
-ch/boye/httpclientandroidlib/client/NonRepeatableRequestException.java
-ch/boye/httpclientandroidlib/client/params/AllClientPNames.java
-ch/boye/httpclientandroidlib/client/params/AuthPolicy.java
-ch/boye/httpclientandroidlib/client/params/ClientParamBean.java
-ch/boye/httpclientandroidlib/client/params/ClientPNames.java
-ch/boye/httpclientandroidlib/client/params/CookiePolicy.java
-ch/boye/httpclientandroidlib/client/params/HttpClientParams.java
-ch/boye/httpclientandroidlib/client/protocol/ClientContext.java
-ch/boye/httpclientandroidlib/client/protocol/ClientContextConfigurer.java
-ch/boye/httpclientandroidlib/client/protocol/RequestAcceptEncoding.java
-ch/boye/httpclientandroidlib/client/protocol/RequestAddCookies.java
-ch/boye/httpclientandroidlib/client/protocol/RequestAuthCache.java
-ch/boye/httpclientandroidlib/client/protocol/RequestClientConnControl.java
-ch/boye/httpclientandroidlib/client/protocol/RequestDefaultHeaders.java
-ch/boye/httpclientandroidlib/client/protocol/RequestProxyAuthentication.java
-ch/boye/httpclientandroidlib/client/protocol/RequestTargetAuthentication.java
-ch/boye/httpclientandroidlib/client/protocol/ResponseAuthCache.java
-ch/boye/httpclientandroidlib/client/protocol/ResponseContentEncoding.java
-ch/boye/httpclientandroidlib/client/protocol/ResponseProcessCookies.java
-ch/boye/httpclientandroidlib/client/RedirectException.java
-ch/boye/httpclientandroidlib/client/RedirectHandler.java
-ch/boye/httpclientandroidlib/client/RedirectStrategy.java
-ch/boye/httpclientandroidlib/client/RequestDirector.java
-ch/boye/httpclientandroidlib/client/ResponseHandler.java
-ch/boye/httpclientandroidlib/client/UserTokenHandler.java
-ch/boye/httpclientandroidlib/client/utils/CloneUtils.java
-ch/boye/httpclientandroidlib/client/utils/Idn.java
-ch/boye/httpclientandroidlib/client/utils/JdkIdn.java
-ch/boye/httpclientandroidlib/client/utils/Punycode.java
-ch/boye/httpclientandroidlib/client/utils/Rfc3492Idn.java
-ch/boye/httpclientandroidlib/client/utils/URIUtils.java
-ch/boye/httpclientandroidlib/client/utils/URLEncodedUtils.java
-ch/boye/httpclientandroidlib/conn/BasicEofSensorWatcher.java
-ch/boye/httpclientandroidlib/conn/BasicManagedEntity.java
-ch/boye/httpclientandroidlib/conn/ClientConnectionManager.java
-ch/boye/httpclientandroidlib/conn/ClientConnectionManagerFactory.java
-ch/boye/httpclientandroidlib/conn/ClientConnectionOperator.java
-ch/boye/httpclientandroidlib/conn/ClientConnectionRequest.java
-ch/boye/httpclientandroidlib/conn/ConnectionKeepAliveStrategy.java
-ch/boye/httpclientandroidlib/conn/ConnectionPoolTimeoutException.java
-ch/boye/httpclientandroidlib/conn/ConnectionReleaseTrigger.java
-ch/boye/httpclientandroidlib/conn/ConnectTimeoutException.java
-ch/boye/httpclientandroidlib/conn/EofSensorInputStream.java
-ch/boye/httpclientandroidlib/conn/EofSensorWatcher.java
-ch/boye/httpclientandroidlib/conn/HttpHostConnectException.java
-ch/boye/httpclientandroidlib/conn/HttpRoutedConnection.java
-ch/boye/httpclientandroidlib/conn/ManagedClientConnection.java
-ch/boye/httpclientandroidlib/conn/MultihomePlainSocketFactory.java
-ch/boye/httpclientandroidlib/conn/OperatedClientConnection.java
-ch/boye/httpclientandroidlib/conn/params/ConnConnectionParamBean.java
-ch/boye/httpclientandroidlib/conn/params/ConnConnectionPNames.java
-ch/boye/httpclientandroidlib/conn/params/ConnManagerParamBean.java
-ch/boye/httpclientandroidlib/conn/params/ConnManagerParams.java
-ch/boye/httpclientandroidlib/conn/params/ConnManagerPNames.java
-ch/boye/httpclientandroidlib/conn/params/ConnPerRoute.java
-ch/boye/httpclientandroidlib/conn/params/ConnPerRouteBean.java
-ch/boye/httpclientandroidlib/conn/params/ConnRouteParamBean.java
-ch/boye/httpclientandroidlib/conn/params/ConnRouteParams.java
-ch/boye/httpclientandroidlib/conn/params/ConnRoutePNames.java
-ch/boye/httpclientandroidlib/conn/routing/BasicRouteDirector.java
-ch/boye/httpclientandroidlib/conn/routing/HttpRoute.java
-ch/boye/httpclientandroidlib/conn/routing/HttpRouteDirector.java
-ch/boye/httpclientandroidlib/conn/routing/HttpRoutePlanner.java
-ch/boye/httpclientandroidlib/conn/routing/RouteInfo.java
-ch/boye/httpclientandroidlib/conn/routing/RouteTracker.java
-ch/boye/httpclientandroidlib/conn/scheme/HostNameResolver.java
-ch/boye/httpclientandroidlib/conn/scheme/LayeredSchemeSocketFactory.java
-ch/boye/httpclientandroidlib/conn/scheme/LayeredSchemeSocketFactoryAdaptor.java
-ch/boye/httpclientandroidlib/conn/scheme/LayeredSocketFactory.java
-ch/boye/httpclientandroidlib/conn/scheme/LayeredSocketFactoryAdaptor.java
-ch/boye/httpclientandroidlib/conn/scheme/PlainSocketFactory.java
-ch/boye/httpclientandroidlib/conn/scheme/Scheme.java
-ch/boye/httpclientandroidlib/conn/scheme/SchemeRegistry.java
-ch/boye/httpclientandroidlib/conn/scheme/SchemeSocketFactory.java
-ch/boye/httpclientandroidlib/conn/scheme/SchemeSocketFactoryAdaptor.java
-ch/boye/httpclientandroidlib/conn/scheme/SocketFactory.java
-ch/boye/httpclientandroidlib/conn/scheme/SocketFactoryAdaptor.java
-ch/boye/httpclientandroidlib/conn/ssl/AbstractVerifier.java
-ch/boye/httpclientandroidlib/conn/ssl/AllowAllHostnameVerifier.java
-ch/boye/httpclientandroidlib/conn/ssl/BrowserCompatHostnameVerifier.java
-ch/boye/httpclientandroidlib/conn/ssl/SSLSocketFactory.java
-ch/boye/httpclientandroidlib/conn/ssl/StrictHostnameVerifier.java
-ch/boye/httpclientandroidlib/conn/ssl/TrustManagerDecorator.java
-ch/boye/httpclientandroidlib/conn/ssl/TrustSelfSignedStrategy.java
-ch/boye/httpclientandroidlib/conn/ssl/TrustStrategy.java
-ch/boye/httpclientandroidlib/conn/ssl/X509HostnameVerifier.java
-ch/boye/httpclientandroidlib/conn/util/InetAddressUtils.java
-ch/boye/httpclientandroidlib/ConnectionClosedException.java
-ch/boye/httpclientandroidlib/ConnectionReuseStrategy.java
-ch/boye/httpclientandroidlib/cookie/ClientCookie.java
-ch/boye/httpclientandroidlib/cookie/Cookie.java
-ch/boye/httpclientandroidlib/cookie/CookieAttributeHandler.java
-ch/boye/httpclientandroidlib/cookie/CookieIdentityComparator.java
-ch/boye/httpclientandroidlib/cookie/CookieOrigin.java
-ch/boye/httpclientandroidlib/cookie/CookiePathComparator.java
-ch/boye/httpclientandroidlib/cookie/CookieRestrictionViolationException.java
-ch/boye/httpclientandroidlib/cookie/CookieSpec.java
-ch/boye/httpclientandroidlib/cookie/CookieSpecFactory.java
-ch/boye/httpclientandroidlib/cookie/CookieSpecRegistry.java
-ch/boye/httpclientandroidlib/cookie/MalformedCookieException.java
-ch/boye/httpclientandroidlib/cookie/params/CookieSpecParamBean.java
-ch/boye/httpclientandroidlib/cookie/params/CookieSpecPNames.java
-ch/boye/httpclientandroidlib/cookie/SetCookie.java
-ch/boye/httpclientandroidlib/cookie/SetCookie2.java
-ch/boye/httpclientandroidlib/cookie/SM.java
-ch/boye/httpclientandroidlib/entity/AbstractHttpEntity.java
-ch/boye/httpclientandroidlib/entity/BasicHttpEntity.java
-ch/boye/httpclientandroidlib/entity/BufferedHttpEntity.java
-ch/boye/httpclientandroidlib/entity/ByteArrayEntity.java
-ch/boye/httpclientandroidlib/entity/ContentLengthStrategy.java
-ch/boye/httpclientandroidlib/entity/ContentProducer.java
-ch/boye/httpclientandroidlib/entity/EntityTemplate.java
-ch/boye/httpclientandroidlib/entity/FileEntity.java
-ch/boye/httpclientandroidlib/entity/HttpEntityWrapper.java
-ch/boye/httpclientandroidlib/entity/InputStreamEntity.java
-ch/boye/httpclientandroidlib/entity/SerializableEntity.java
-ch/boye/httpclientandroidlib/entity/StringEntity.java
-ch/boye/httpclientandroidlib/FormattedHeader.java
-ch/boye/httpclientandroidlib/Header.java
-ch/boye/httpclientandroidlib/HeaderElement.java
-ch/boye/httpclientandroidlib/HeaderElementIterator.java
-ch/boye/httpclientandroidlib/HeaderIterator.java
-ch/boye/httpclientandroidlib/HttpClientConnection.java
-ch/boye/httpclientandroidlib/HttpConnection.java
-ch/boye/httpclientandroidlib/HttpConnectionMetrics.java
-ch/boye/httpclientandroidlib/HttpEntity.java
-ch/boye/httpclientandroidlib/HttpEntityEnclosingRequest.java
-ch/boye/httpclientandroidlib/HttpException.java
-ch/boye/httpclientandroidlib/HttpHeaders.java
-ch/boye/httpclientandroidlib/HttpHost.java
-ch/boye/httpclientandroidlib/HttpInetConnection.java
-ch/boye/httpclientandroidlib/HttpMessage.java
-ch/boye/httpclientandroidlib/HttpRequest.java
-ch/boye/httpclientandroidlib/HttpRequestFactory.java
-ch/boye/httpclientandroidlib/HttpRequestInterceptor.java
-ch/boye/httpclientandroidlib/HttpResponse.java
-ch/boye/httpclientandroidlib/HttpResponseFactory.java
-ch/boye/httpclientandroidlib/HttpResponseInterceptor.java
-ch/boye/httpclientandroidlib/HttpServerConnection.java
-ch/boye/httpclientandroidlib/HttpStatus.java
-ch/boye/httpclientandroidlib/HttpVersion.java
-ch/boye/httpclientandroidlib/impl/AbstractHttpClientConnection.java
-ch/boye/httpclientandroidlib/impl/AbstractHttpServerConnection.java
-ch/boye/httpclientandroidlib/impl/auth/AuthSchemeBase.java
-ch/boye/httpclientandroidlib/impl/auth/BasicScheme.java
-ch/boye/httpclientandroidlib/impl/auth/BasicSchemeFactory.java
-ch/boye/httpclientandroidlib/impl/auth/DigestScheme.java
-ch/boye/httpclientandroidlib/impl/auth/DigestSchemeFactory.java
-ch/boye/httpclientandroidlib/impl/auth/NTLMEngine.java
-ch/boye/httpclientandroidlib/impl/auth/NTLMEngineException.java
-ch/boye/httpclientandroidlib/impl/auth/NTLMEngineImpl.java
-ch/boye/httpclientandroidlib/impl/auth/NTLMScheme.java
-ch/boye/httpclientandroidlib/impl/auth/NTLMSchemeFactory.java
-ch/boye/httpclientandroidlib/impl/auth/RFC2617Scheme.java
-ch/boye/httpclientandroidlib/impl/auth/SpnegoTokenGenerator.java
-ch/boye/httpclientandroidlib/impl/auth/UnsupportedDigestAlgorithmException.java
-ch/boye/httpclientandroidlib/impl/client/AbstractAuthenticationHandler.java
-ch/boye/httpclientandroidlib/impl/client/AbstractHttpClient.java
-ch/boye/httpclientandroidlib/impl/client/BasicAuthCache.java
-ch/boye/httpclientandroidlib/impl/client/BasicCookieStore.java
-ch/boye/httpclientandroidlib/impl/client/BasicCredentialsProvider.java
-ch/boye/httpclientandroidlib/impl/client/BasicResponseHandler.java
-ch/boye/httpclientandroidlib/impl/client/ClientParamsStack.java
-ch/boye/httpclientandroidlib/impl/client/ContentEncodingHttpClient.java
-ch/boye/httpclientandroidlib/impl/client/DefaultConnectionKeepAliveStrategy.java
-ch/boye/httpclientandroidlib/impl/client/DefaultHttpClient.java
-ch/boye/httpclientandroidlib/impl/client/DefaultHttpRequestRetryHandler.java
-ch/boye/httpclientandroidlib/impl/client/DefaultProxyAuthenticationHandler.java
-ch/boye/httpclientandroidlib/impl/client/DefaultRedirectHandler.java
-ch/boye/httpclientandroidlib/impl/client/DefaultRedirectStrategy.java
-ch/boye/httpclientandroidlib/impl/client/DefaultRedirectStrategyAdaptor.java
-ch/boye/httpclientandroidlib/impl/client/DefaultRequestDirector.java
-ch/boye/httpclientandroidlib/impl/client/DefaultTargetAuthenticationHandler.java
-ch/boye/httpclientandroidlib/impl/client/DefaultUserTokenHandler.java
-ch/boye/httpclientandroidlib/impl/client/EntityEnclosingRequestWrapper.java
-ch/boye/httpclientandroidlib/impl/client/RedirectLocations.java
-ch/boye/httpclientandroidlib/impl/client/RequestWrapper.java
-ch/boye/httpclientandroidlib/impl/client/RoutedRequest.java
-ch/boye/httpclientandroidlib/impl/client/TunnelRefusedException.java
-ch/boye/httpclientandroidlib/impl/conn/AbstractClientConnAdapter.java
-ch/boye/httpclientandroidlib/impl/conn/AbstractPooledConnAdapter.java
-ch/boye/httpclientandroidlib/impl/conn/AbstractPoolEntry.java
-ch/boye/httpclientandroidlib/impl/conn/ConnectionShutdownException.java
-ch/boye/httpclientandroidlib/impl/conn/DefaultClientConnection.java
-ch/boye/httpclientandroidlib/impl/conn/DefaultClientConnectionOperator.java
-ch/boye/httpclientandroidlib/impl/conn/DefaultHttpRoutePlanner.java
-ch/boye/httpclientandroidlib/impl/conn/DefaultResponseParser.java
-ch/boye/httpclientandroidlib/impl/conn/HttpInetSocketAddress.java
-ch/boye/httpclientandroidlib/impl/conn/IdleConnectionHandler.java
-ch/boye/httpclientandroidlib/impl/conn/LoggingSessionInputBuffer.java
-ch/boye/httpclientandroidlib/impl/conn/LoggingSessionOutputBuffer.java
-ch/boye/httpclientandroidlib/impl/conn/ProxySelectorRoutePlanner.java
-ch/boye/httpclientandroidlib/impl/conn/SchemeRegistryFactory.java
-ch/boye/httpclientandroidlib/impl/conn/SingleClientConnManager.java
-ch/boye/httpclientandroidlib/impl/conn/tsccm/AbstractConnPool.java
-ch/boye/httpclientandroidlib/impl/conn/tsccm/BasicPooledConnAdapter.java
-ch/boye/httpclientandroidlib/impl/conn/tsccm/BasicPoolEntry.java
-ch/boye/httpclientandroidlib/impl/conn/tsccm/BasicPoolEntryRef.java
-ch/boye/httpclientandroidlib/impl/conn/tsccm/ConnPoolByRoute.java
-ch/boye/httpclientandroidlib/impl/conn/tsccm/PoolEntryRequest.java
-ch/boye/httpclientandroidlib/impl/conn/tsccm/RefQueueHandler.java
-ch/boye/httpclientandroidlib/impl/conn/tsccm/RefQueueWorker.java
-ch/boye/httpclientandroidlib/impl/conn/tsccm/RouteSpecificPool.java
-ch/boye/httpclientandroidlib/impl/conn/tsccm/ThreadSafeClientConnManager.java
-ch/boye/httpclientandroidlib/impl/conn/tsccm/WaitingThread.java
-ch/boye/httpclientandroidlib/impl/conn/tsccm/WaitingThreadAborter.java
-ch/boye/httpclientandroidlib/impl/conn/Wire.java
-ch/boye/httpclientandroidlib/impl/cookie/AbstractCookieAttributeHandler.java
-ch/boye/httpclientandroidlib/impl/cookie/AbstractCookieSpec.java
-ch/boye/httpclientandroidlib/impl/cookie/BasicClientCookie.java
-ch/boye/httpclientandroidlib/impl/cookie/BasicClientCookie2.java
-ch/boye/httpclientandroidlib/impl/cookie/BasicCommentHandler.java
-ch/boye/httpclientandroidlib/impl/cookie/BasicDomainHandler.java
-ch/boye/httpclientandroidlib/impl/cookie/BasicExpiresHandler.java
-ch/boye/httpclientandroidlib/impl/cookie/BasicMaxAgeHandler.java
-ch/boye/httpclientandroidlib/impl/cookie/BasicPathHandler.java
-ch/boye/httpclientandroidlib/impl/cookie/BasicSecureHandler.java
-ch/boye/httpclientandroidlib/impl/cookie/BestMatchSpec.java
-ch/boye/httpclientandroidlib/impl/cookie/BestMatchSpecFactory.java
-ch/boye/httpclientandroidlib/impl/cookie/BrowserCompatSpec.java
-ch/boye/httpclientandroidlib/impl/cookie/BrowserCompatSpecFactory.java
-ch/boye/httpclientandroidlib/impl/cookie/CookieSpecBase.java
-ch/boye/httpclientandroidlib/impl/cookie/DateParseException.java
-ch/boye/httpclientandroidlib/impl/cookie/DateUtils.java
-ch/boye/httpclientandroidlib/impl/cookie/IgnoreSpec.java
-ch/boye/httpclientandroidlib/impl/cookie/IgnoreSpecFactory.java
-ch/boye/httpclientandroidlib/impl/cookie/NetscapeDomainHandler.java
-ch/boye/httpclientandroidlib/impl/cookie/NetscapeDraftHeaderParser.java
-ch/boye/httpclientandroidlib/impl/cookie/NetscapeDraftSpec.java
-ch/boye/httpclientandroidlib/impl/cookie/NetscapeDraftSpecFactory.java
-ch/boye/httpclientandroidlib/impl/cookie/PublicSuffixFilter.java
-ch/boye/httpclientandroidlib/impl/cookie/PublicSuffixListParser.java
-ch/boye/httpclientandroidlib/impl/cookie/RFC2109DomainHandler.java
-ch/boye/httpclientandroidlib/impl/cookie/RFC2109Spec.java
-ch/boye/httpclientandroidlib/impl/cookie/RFC2109SpecFactory.java
-ch/boye/httpclientandroidlib/impl/cookie/RFC2109VersionHandler.java
-ch/boye/httpclientandroidlib/impl/cookie/RFC2965CommentUrlAttributeHandler.java
-ch/boye/httpclientandroidlib/impl/cookie/RFC2965DiscardAttributeHandler.java
-ch/boye/httpclientandroidlib/impl/cookie/RFC2965DomainAttributeHandler.java
-ch/boye/httpclientandroidlib/impl/cookie/RFC2965PortAttributeHandler.java
-ch/boye/httpclientandroidlib/impl/cookie/RFC2965Spec.java
-ch/boye/httpclientandroidlib/impl/cookie/RFC2965SpecFactory.java
-ch/boye/httpclientandroidlib/impl/cookie/RFC2965VersionAttributeHandler.java
-ch/boye/httpclientandroidlib/impl/DefaultConnectionReuseStrategy.java
-ch/boye/httpclientandroidlib/impl/DefaultHttpClientConnection.java
-ch/boye/httpclientandroidlib/impl/DefaultHttpRequestFactory.java
-ch/boye/httpclientandroidlib/impl/DefaultHttpResponseFactory.java
-ch/boye/httpclientandroidlib/impl/DefaultHttpServerConnection.java
-ch/boye/httpclientandroidlib/impl/EnglishReasonPhraseCatalog.java
-ch/boye/httpclientandroidlib/impl/entity/EntityDeserializer.java
-ch/boye/httpclientandroidlib/impl/entity/EntitySerializer.java
-ch/boye/httpclientandroidlib/impl/entity/LaxContentLengthStrategy.java
-ch/boye/httpclientandroidlib/impl/entity/StrictContentLengthStrategy.java
-ch/boye/httpclientandroidlib/impl/HttpConnectionMetricsImpl.java
-ch/boye/httpclientandroidlib/impl/io/AbstractMessageParser.java
-ch/boye/httpclientandroidlib/impl/io/AbstractMessageWriter.java
-ch/boye/httpclientandroidlib/impl/io/AbstractSessionInputBuffer.java
-ch/boye/httpclientandroidlib/impl/io/AbstractSessionOutputBuffer.java
-ch/boye/httpclientandroidlib/impl/io/ChunkedInputStream.java
-ch/boye/httpclientandroidlib/impl/io/ChunkedOutputStream.java
-ch/boye/httpclientandroidlib/impl/io/ContentLengthInputStream.java
-ch/boye/httpclientandroidlib/impl/io/ContentLengthOutputStream.java
-ch/boye/httpclientandroidlib/impl/io/HttpRequestParser.java
-ch/boye/httpclientandroidlib/impl/io/HttpRequestWriter.java
-ch/boye/httpclientandroidlib/impl/io/HttpResponseParser.java
-ch/boye/httpclientandroidlib/impl/io/HttpResponseWriter.java
-ch/boye/httpclientandroidlib/impl/io/HttpTransportMetricsImpl.java
-ch/boye/httpclientandroidlib/impl/io/IdentityInputStream.java
-ch/boye/httpclientandroidlib/impl/io/IdentityOutputStream.java
-ch/boye/httpclientandroidlib/impl/io/SocketInputBuffer.java
-ch/boye/httpclientandroidlib/impl/io/SocketOutputBuffer.java
-ch/boye/httpclientandroidlib/impl/NoConnectionReuseStrategy.java
-ch/boye/httpclientandroidlib/impl/SocketHttpClientConnection.java
-ch/boye/httpclientandroidlib/impl/SocketHttpServerConnection.java
-ch/boye/httpclientandroidlib/io/BufferInfo.java
-ch/boye/httpclientandroidlib/io/EofSensor.java
-ch/boye/httpclientandroidlib/io/HttpMessageParser.java
-ch/boye/httpclientandroidlib/io/HttpMessageWriter.java
-ch/boye/httpclientandroidlib/io/HttpTransportMetrics.java
-ch/boye/httpclientandroidlib/io/SessionInputBuffer.java
-ch/boye/httpclientandroidlib/io/SessionOutputBuffer.java
-ch/boye/httpclientandroidlib/MalformedChunkCodingException.java
-ch/boye/httpclientandroidlib/message/AbstractHttpMessage.java
-ch/boye/httpclientandroidlib/message/BasicHeader.java
-ch/boye/httpclientandroidlib/message/BasicHeaderElement.java
-ch/boye/httpclientandroidlib/message/BasicHeaderElementIterator.java
-ch/boye/httpclientandroidlib/message/BasicHeaderIterator.java
-ch/boye/httpclientandroidlib/message/BasicHeaderValueFormatter.java
-ch/boye/httpclientandroidlib/message/BasicHeaderValueParser.java
-ch/boye/httpclientandroidlib/message/BasicHttpEntityEnclosingRequest.java
-ch/boye/httpclientandroidlib/message/BasicHttpRequest.java
-ch/boye/httpclientandroidlib/message/BasicHttpResponse.java
-ch/boye/httpclientandroidlib/message/BasicLineFormatter.java
-ch/boye/httpclientandroidlib/message/BasicLineParser.java
-ch/boye/httpclientandroidlib/message/BasicListHeaderIterator.java
-ch/boye/httpclientandroidlib/message/BasicNameValuePair.java
-ch/boye/httpclientandroidlib/message/BasicRequestLine.java
-ch/boye/httpclientandroidlib/message/BasicStatusLine.java
-ch/boye/httpclientandroidlib/message/BasicTokenIterator.java
-ch/boye/httpclientandroidlib/message/BufferedHeader.java
-ch/boye/httpclientandroidlib/message/HeaderGroup.java
-ch/boye/httpclientandroidlib/message/HeaderValueFormatter.java
-ch/boye/httpclientandroidlib/message/HeaderValueParser.java
-ch/boye/httpclientandroidlib/message/LineFormatter.java
-ch/boye/httpclientandroidlib/message/LineParser.java
-ch/boye/httpclientandroidlib/message/ParserCursor.java
-ch/boye/httpclientandroidlib/MethodNotSupportedException.java
-ch/boye/httpclientandroidlib/NameValuePair.java
-ch/boye/httpclientandroidlib/NoHttpResponseException.java
-ch/boye/httpclientandroidlib/params/AbstractHttpParams.java
-ch/boye/httpclientandroidlib/params/BasicHttpParams.java
-ch/boye/httpclientandroidlib/params/CoreConnectionPNames.java
-ch/boye/httpclientandroidlib/params/CoreProtocolPNames.java
-ch/boye/httpclientandroidlib/params/DefaultedHttpParams.java
-ch/boye/httpclientandroidlib/params/HttpAbstractParamBean.java
-ch/boye/httpclientandroidlib/params/HttpConnectionParamBean.java
-ch/boye/httpclientandroidlib/params/HttpConnectionParams.java
-ch/boye/httpclientandroidlib/params/HttpParams.java
-ch/boye/httpclientandroidlib/params/HttpProtocolParamBean.java
-ch/boye/httpclientandroidlib/params/HttpProtocolParams.java
-ch/boye/httpclientandroidlib/params/SyncBasicHttpParams.java
-ch/boye/httpclientandroidlib/ParseException.java
-ch/boye/httpclientandroidlib/protocol/BasicHttpContext.java
-ch/boye/httpclientandroidlib/protocol/BasicHttpProcessor.java
-ch/boye/httpclientandroidlib/protocol/DefaultedHttpContext.java
-ch/boye/httpclientandroidlib/protocol/ExecutionContext.java
-ch/boye/httpclientandroidlib/protocol/HTTP.java
-ch/boye/httpclientandroidlib/protocol/HttpContext.java
-ch/boye/httpclientandroidlib/protocol/HttpDateGenerator.java
-ch/boye/httpclientandroidlib/protocol/HttpExpectationVerifier.java
-ch/boye/httpclientandroidlib/protocol/HttpProcessor.java
-ch/boye/httpclientandroidlib/protocol/HttpRequestExecutor.java
-ch/boye/httpclientandroidlib/protocol/HttpRequestHandler.java
-ch/boye/httpclientandroidlib/protocol/HttpRequestHandlerRegistry.java
-ch/boye/httpclientandroidlib/protocol/HttpRequestHandlerResolver.java
-ch/boye/httpclientandroidlib/protocol/HttpRequestInterceptorList.java
-ch/boye/httpclientandroidlib/protocol/HttpResponseInterceptorList.java
-ch/boye/httpclientandroidlib/protocol/HttpService.java
-ch/boye/httpclientandroidlib/protocol/ImmutableHttpProcessor.java
-ch/boye/httpclientandroidlib/protocol/RequestConnControl.java
-ch/boye/httpclientandroidlib/protocol/RequestContent.java
-ch/boye/httpclientandroidlib/protocol/RequestDate.java
-ch/boye/httpclientandroidlib/protocol/RequestExpectContinue.java
-ch/boye/httpclientandroidlib/protocol/RequestTargetHost.java
-ch/boye/httpclientandroidlib/protocol/RequestUserAgent.java
-ch/boye/httpclientandroidlib/protocol/ResponseConnControl.java
-ch/boye/httpclientandroidlib/protocol/ResponseContent.java
-ch/boye/httpclientandroidlib/protocol/ResponseDate.java
-ch/boye/httpclientandroidlib/protocol/ResponseServer.java
-ch/boye/httpclientandroidlib/protocol/SyncBasicHttpContext.java
-ch/boye/httpclientandroidlib/protocol/UriPatternMatcher.java
-ch/boye/httpclientandroidlib/ProtocolException.java
-ch/boye/httpclientandroidlib/ProtocolVersion.java
-ch/boye/httpclientandroidlib/ReasonPhraseCatalog.java
-ch/boye/httpclientandroidlib/RequestLine.java
-ch/boye/httpclientandroidlib/StatusLine.java
-ch/boye/httpclientandroidlib/TokenIterator.java
-ch/boye/httpclientandroidlib/TruncatedChunkException.java
-ch/boye/httpclientandroidlib/UnsupportedHttpVersionException.java
-ch/boye/httpclientandroidlib/util/ByteArrayBuffer.java
-ch/boye/httpclientandroidlib/util/CharArrayBuffer.java
-ch/boye/httpclientandroidlib/util/EncodingUtils.java
-ch/boye/httpclientandroidlib/util/EntityUtils.java
-ch/boye/httpclientandroidlib/util/ExceptionUtils.java
-ch/boye/httpclientandroidlib/util/LangUtils.java
-ch/boye/httpclientandroidlib/util/VersionInfo.java
-org/json/simple/ItemList.java
-org/json/simple/JSONArray.java
-org/json/simple/JSONAware.java
-org/json/simple/JSONObject.java
-org/json/simple/JSONStreamAware.java
-org/json/simple/JSONValue.java
-org/json/simple/parser/ContainerFactory.java
-org/json/simple/parser/ContentHandler.java
-org/json/simple/parser/JSONParser.java
-org/json/simple/parser/ParseException.java
-org/json/simple/parser/Yylex.java
-org/json/simple/parser/Yytoken.java
-org/mozilla/apache/commons/codec/binary/Base32.java
-org/mozilla/apache/commons/codec/binary/Base32InputStream.java
-org/mozilla/apache/commons/codec/binary/Base32OutputStream.java
-org/mozilla/apache/commons/codec/binary/Base64.java
-org/mozilla/apache/commons/codec/binary/Base64InputStream.java
-org/mozilla/apache/commons/codec/binary/Base64OutputStream.java
-org/mozilla/apache/commons/codec/binary/BaseNCodec.java
-org/mozilla/apache/commons/codec/binary/BaseNCodecInputStream.java
-org/mozilla/apache/commons/codec/binary/BaseNCodecOutputStream.java
-org/mozilla/apache/commons/codec/binary/BinaryCodec.java
-org/mozilla/apache/commons/codec/binary/Hex.java
-org/mozilla/apache/commons/codec/binary/StringUtils.java
-org/mozilla/apache/commons/codec/BinaryDecoder.java
-org/mozilla/apache/commons/codec/BinaryEncoder.java
-org/mozilla/apache/commons/codec/CharEncoding.java
-org/mozilla/apache/commons/codec/Decoder.java
-org/mozilla/apache/commons/codec/DecoderException.java
-org/mozilla/apache/commons/codec/digest/DigestUtils.java
-org/mozilla/apache/commons/codec/Encoder.java
-org/mozilla/apache/commons/codec/EncoderException.java
-org/mozilla/apache/commons/codec/language/AbstractCaverphone.java
-org/mozilla/apache/commons/codec/language/Caverphone.java
-org/mozilla/apache/commons/codec/language/Caverphone1.java
-org/mozilla/apache/commons/codec/language/Caverphone2.java
-org/mozilla/apache/commons/codec/language/ColognePhonetic.java
-org/mozilla/apache/commons/codec/language/DoubleMetaphone.java
-org/mozilla/apache/commons/codec/language/Metaphone.java
-org/mozilla/apache/commons/codec/language/RefinedSoundex.java
-org/mozilla/apache/commons/codec/language/Soundex.java
-org/mozilla/apache/commons/codec/language/SoundexUtils.java
-org/mozilla/apache/commons/codec/net/BCodec.java
-org/mozilla/apache/commons/codec/net/QCodec.java
-org/mozilla/apache/commons/codec/net/QuotedPrintableCodec.java
-org/mozilla/apache/commons/codec/net/RFC1522Codec.java
-org/mozilla/apache/commons/codec/net/URLCodec.java
-org/mozilla/apache/commons/codec/net/Utils.java
-org/mozilla/apache/commons/codec/StringDecoder.java
-org/mozilla/apache/commons/codec/StringEncoder.java
-org/mozilla/apache/commons/codec/StringEncoderComparator.java
deleted file mode 100644
--- a/mobile/android/services/preprocess-sources.mn
+++ /dev/null
@@ -1,4 +0,0 @@
-background/common/GlobalConstants.java
-sync/SyncConstants.java
-background/announcements/AnnouncementsConstants.java
-background/healthreport/HealthReportConstants.java
--- a/modules/libjar/nsJAR.h
+++ b/modules/libjar/nsJAR.h
@@ -6,17 +6,16 @@
 
 #ifndef nsJAR_h__
 #define nsJAR_h__
 
 #include "nscore.h"
 #include "prio.h"
 #include "plstr.h"
 #include "prlog.h"
-#include "prtypes.h"
 #include "prinrval.h"
 
 #include "mozilla/Mutex.h"
 #include "nsIComponentManager.h"
 #include "nsCOMPtr.h"
 #include "nsString.h"
 #include "nsIFile.h"
 #include "nsStringEnumerator.h"
--- a/modules/libpref/src/prefread.h
+++ b/modules/libpref/src/prefread.h
@@ -1,16 +1,15 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef prefread_h__
 #define prefread_h__
 
-#include "prtypes.h"
 #include "prefapi.h"
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
 /**
  * Callback function used to notify consumer of preference name value pairs.
--- a/security/manager/ssl/src/nsCrypto.cpp
+++ b/security/manager/ssl/src/nsCrypto.cpp
@@ -2346,17 +2346,17 @@ nsCrypto::ImportUserCertificates(const n
     }
     // Let's figure out which nickname to give the cert.  If 
     // a certificate with the same subject name already exists,
     // then just use that one, otherwise, get the default nickname.
     if (currCert->nickname) {
       localNick = currCert->nickname;
     }
     else if (!nickname || nickname[0] == '\0') {
-      nsNSSCertificateDB::get_default_nickname(currCert, ctx, localNick);
+      nsNSSCertificateDB::get_default_nickname(currCert, ctx, localNick, locker);
     } else {
       //This is the case where we're getting a brand new
       //cert that doesn't have the same subjectName as a cert
       //that already exists in our db and the CA page has 
       //designated a nickname to use for the newly issued cert.
       localNick = nickname;
     }
     {
@@ -2402,17 +2402,17 @@ nsCrypto::ImportUserCertificates(const n
         rv = NS_ERROR_OUT_OF_MEMORY;
         goto loser;
       }
       for (node = CERT_LIST_HEAD(caPubs), i=0; 
            !CERT_LIST_END(node, caPubs);
            node = CERT_LIST_NEXT(node), i++) {
         derCerts[i] = node->cert->derCert;
       }
-      nsNSSCertificateDB::ImportValidCACerts(numCAs, derCerts, ctx);
+      nsNSSCertificateDB::ImportValidCACerts(numCAs, derCerts, ctx, locker);
       nsMemory::Free(derCerts);
     }
   }
  }
 
   if (aDoForcedBackup) {
     // I can't pop up a file picker from the depths of JavaScript,
     // so I'll just post an event on the UI queue to do the backups
--- a/security/manager/ssl/src/nsNSSCertificateDB.cpp
+++ b/security/manager/ssl/src/nsNSSCertificateDB.cpp
@@ -74,16 +74,19 @@ NS_IMETHODIMP
 nsNSSCertificateDB::FindCertByNickname(nsISupports *aToken,
                                       const nsAString &nickname,
                                       nsIX509Cert **_rvCert)
 {
   NS_ENSURE_ARG_POINTER(_rvCert);
   *_rvCert = nullptr;
 
   nsNSSShutDownPreventionLock locker;
+  if (isAlreadyShutDown()) {
+    return NS_ERROR_NOT_AVAILABLE;
+  }
   ScopedCERTCertificate cert;
   char *asciiname = nullptr;
   NS_ConvertUTF16toUTF8 aUtf8Nickname(nickname);
   asciiname = const_cast<char*>(aUtf8Nickname.get());
   PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("Getting \"%s\"\n", asciiname));
 #if 0
   // what it should be, but for now...
   if (aToken) {
@@ -112,16 +115,20 @@ nsNSSCertificateDB::FindCertByDBKey(cons
                                    nsIX509Cert **_cert)
 {
   NS_ENSURE_ARG_POINTER(aDBkey);
   NS_ENSURE_ARG(aDBkey[0]);
   NS_ENSURE_ARG_POINTER(_cert);
   *_cert = nullptr;
 
   nsNSSShutDownPreventionLock locker;
+  if (isAlreadyShutDown()) {
+    return NS_ERROR_NOT_AVAILABLE;
+  }
+
   SECItem keyItem = {siBuffer, nullptr, 0};
   SECItem *dummy;
   CERTIssuerAndSN issuerSN;
   //unsigned long moduleID,slotID;
 
   dummy = NSSBase64_DecodeBuffer(nullptr, &keyItem, aDBkey,
                                  (uint32_t)strlen(aDBkey)); 
   if (!dummy || keyItem.len < NS_NSS_LONG*4) {
@@ -160,16 +167,20 @@ nsNSSCertificateDB::FindCertByDBKey(cons
 
 NS_IMETHODIMP 
 nsNSSCertificateDB::FindCertNicknames(nsISupports *aToken, 
                                      uint32_t      aType,
                                      uint32_t     *_count,
                                      PRUnichar  ***_certNames)
 {
   nsNSSShutDownPreventionLock locker;
+  if (isAlreadyShutDown()) {
+    return NS_ERROR_NOT_AVAILABLE;
+  }
+
   nsresult rv = NS_ERROR_FAILURE;
   /*
    * obtain the cert list from NSS
    */
   ScopedCERTCertList certList;
   PK11CertListType pk11type;
 #if 0
   // this would seem right, but it didn't work...
@@ -181,17 +192,17 @@ nsNSSCertificateDB::FindCertNicknames(ns
     pk11type = PK11CertListUnique;
   certList = PK11_ListCerts(pk11type, nullptr);
   if (!certList)
     goto cleanup;
   /*
    * get list of cert names from list of certs
    * XXX also cull the list (NSS only distinguishes based on user/non-user
    */
-  getCertNames(certList, aType, _count, _certNames);
+  getCertNames(certList, aType, _count, _certNames, locker);
   rv = NS_OK;
   /*
    * finish up
    */
 cleanup:
   return rv;
 }
 
@@ -220,19 +231,19 @@ collect_certs(void *arg, SECItem **certs
     certs++;
   }
 
   return (SECSuccess);
 }
 
 CERTDERCerts*
 nsNSSCertificateDB::getCertsFromPackage(PLArenaPool *arena, uint8_t *data, 
-                                        uint32_t length)
+                                        uint32_t length,
+                                        const nsNSSShutDownPreventionLock &/*proofOfLock*/)
 {
-  nsNSSShutDownPreventionLock locker;
   CERTDERCerts *collectArgs = 
                (CERTDERCerts *)PORT_ArenaZAlloc(arena, sizeof(CERTDERCerts));
   if (!collectArgs)
     return nullptr;
 
   collectArgs->arena = arena;
   SECStatus sec_rv = CERT_DecodeCertPackage(reinterpret_cast<char *>(data), 
                                             length, collect_certs, 
@@ -240,33 +251,32 @@ nsNSSCertificateDB::getCertsFromPackage(
   if (sec_rv != SECSuccess)
     return nullptr;
 
   return collectArgs;
 }
 
 nsresult
 nsNSSCertificateDB::handleCACertDownload(nsIArray *x509Certs,
-                                         nsIInterfaceRequestor *ctx)
+                                         nsIInterfaceRequestor *ctx,
+                                         const nsNSSShutDownPreventionLock &proofOfLock)
 {
   // First thing we have to do is figure out which certificate we're 
   // gonna present to the user.  The CA may have sent down a list of 
   // certs which may or may not be a chained list of certs.  Until
   // the day we can design some solid UI for the general case, we'll
   // code to the > 90% case.  That case is where a CA sends down a
   // list that is a hierarchy whose root is either the first or 
   // the last cert.  What we're gonna do is compare the first 
   // 2 entries, if the second was signed by the first, we assume
   // the root cert is the first cert and display it.  Otherwise,
   // we compare the last 2 entries, if the second to last cert was
   // signed by the last cert, then we assume the last cert is the
   // root and display it.
 
-  nsNSSShutDownPreventionLock locker;
-
   uint32_t numCerts;
 
   x509Certs->GetLength(&numCerts);
   NS_ASSERTION(numCerts > 0, "Didn't get any certs to import.");
   if (numCerts == 0)
     return NS_OK; // Nothing to import, so nothing to do.
 
   nsCOMPtr<nsIX509Cert> certToShow;
@@ -346,22 +356,22 @@ nsNSSCertificateDB::handleCACertDownload
   der.len = 0;
   
   if (!tmpCert) {
     NS_ERROR("Couldn't create cert from DER blob");
     return NS_ERROR_FAILURE;
   }
 
   if (!CERT_IsCACert(tmpCert, nullptr)) {
-    DisplayCertificateAlert(ctx, "NotACACert", certToShow);
+    DisplayCertificateAlert(ctx, "NotACACert", certToShow, proofOfLock);
     return NS_ERROR_FAILURE;
   }
 
   if (tmpCert->isperm) {
-    DisplayCertificateAlert(ctx, "CaCertExists", certToShow);
+    DisplayCertificateAlert(ctx, "CaCertExists", certToShow, proofOfLock);
     return NS_ERROR_FAILURE;
   }
 
   uint32_t trustBits;
   bool allows;
   rv = dialogs->ConfirmDownloadCACert(ctx, certToShow, &trustBits, &allows);
   if (NS_FAILED(rv))
     return rv;
@@ -417,38 +427,42 @@ nsNSSCertificateDB::handleCACertDownload
     if (!tmpCert2) {
       NS_ERROR("Couldn't create temp cert from DER blob");
       continue;  // Let's try to import the rest of 'em
     }
     
     CERT_AddCertToListTail(certList, tmpCert2);
   }
 
-  return ImportValidCACertsInList(certList, ctx);
+  return ImportValidCACertsInList(certList, ctx, proofOfLock);
 }
 
 /*
  *  [noscript] void importCertificates(in charPtr data, in unsigned long length,
  *                                     in unsigned long type, 
  *                                     in nsIInterfaceRequestor ctx);
  */
 NS_IMETHODIMP 
 nsNSSCertificateDB::ImportCertificates(uint8_t * data, uint32_t length, 
                                        uint32_t type, 
                                        nsIInterfaceRequestor *ctx)
 
 {
   nsNSSShutDownPreventionLock locker;
+  if (isAlreadyShutDown()) {
+    return NS_ERROR_NOT_AVAILABLE;
+  }
+
   nsresult nsrv;
 
   PLArenaPool *arena = PORT_NewArena(DER_DEFAULT_CHUNKSIZE);
   if (!arena)
     return NS_ERROR_OUT_OF_MEMORY;
 
-  CERTDERCerts *certCollection = getCertsFromPackage(arena, data, length);
+  CERTDERCerts *certCollection = getCertsFromPackage(arena, data, length, locker);
   if (!certCollection) {
     PORT_FreeArena(arena, false);
     return NS_ERROR_FAILURE;
   }
   nsCOMPtr<nsIMutableArray> array =
     do_CreateInstance(NS_ARRAY_CONTRACTID, &nsrv);
   if (NS_FAILED(nsrv)) {
     PORT_FreeArena(arena, false);
@@ -464,17 +478,17 @@ nsNSSCertificateDB::ImportCertificates(u
      nssCert = nsNSSCertificate::ConstructFromDER((char*)currItem->data, currItem->len);
      if (!nssCert)
        return NS_ERROR_FAILURE;
      x509Cert = do_QueryInterface((nsIX509Cert*)nssCert);
      array->AppendElement(x509Cert, false);
   }
   switch (type) {
   case nsIX509Cert::CA_CERT:
-    nsrv = handleCACertDownload(array, ctx);
+    nsrv = handleCACertDownload(array, ctx, locker);
     break;
   default:
     // We only deal with import CA certs in this method currently.
      nsrv = NS_ERROR_FAILURE;
      break;
   }  
   PORT_FreeArena(arena, false);
   return nsrv;
@@ -519,31 +533,35 @@ ImportCertsIntoPermanentStorage(const Sc
  *                                     in nsIInterfaceRequestor ctx);
  */
 NS_IMETHODIMP
 nsNSSCertificateDB::ImportEmailCertificate(uint8_t * data, uint32_t length, 
                                        nsIInterfaceRequestor *ctx)
 
 {
   nsNSSShutDownPreventionLock locker;
+  if (isAlreadyShutDown()) {
+    return NS_ERROR_NOT_AVAILABLE;
+  }
+
   SECStatus srv = SECFailure;
   nsresult nsrv = NS_OK;
   CERTCertDBHandle *certdb;
   CERTCertificate **certArray = nullptr;
   ScopedCERTCertList certList;
   CERTCertListNode *node;
   SECItem **rawArray;
   int numcerts;
   int i;
 
   PLArenaPool *arena = PORT_NewArena(DER_DEFAULT_CHUNKSIZE);
   if (!arena)
     return NS_ERROR_OUT_OF_MEMORY;
 
-  CERTDERCerts *certCollection = getCertsFromPackage(arena, data, length);
+  CERTDERCerts *certCollection = getCertsFromPackage(arena, data, length, locker);
   if (!certCollection) {
     PORT_FreeArena(arena, false);
     return NS_ERROR_FAILURE;
   }
 
   RefPtr<CertVerifier> certVerifier(GetDefaultCertVerifier());
   NS_ENSURE_TRUE(certVerifier, NS_ERROR_UNEXPECTED);
 
@@ -604,17 +622,17 @@ nsNSSCertificateDB::ImportEmailCertifica
     SECStatus rv = certVerifier->VerifyCert(node->cert,
                                             certificateUsageEmailRecipient,
                                             now, ctx, 0, &verifyCertChain);
 
     ScopedCERTCertList certChain(verifyCertChain);
 
     if (rv != SECSuccess) {
       nsCOMPtr<nsIX509Cert> certToShow = nsNSSCertificate::Create(node->cert);
-      DisplayCertificateAlert(ctx, "NotImportingUnverifiedCert", certToShow);
+      DisplayCertificateAlert(ctx, "NotImportingUnverifiedCert", certToShow, locker);
       continue;
     }
     rv = ImportCertsIntoPermanentStorage(certChain, certUsageEmailRecipient, false);
     if (rv != SECSuccess) {
       goto loser;
     } 
     CERT_SaveSMimeProfile(node->cert, nullptr, nullptr);
 
@@ -630,30 +648,34 @@ loser:
 }
 
 NS_IMETHODIMP
 nsNSSCertificateDB::ImportServerCertificate(uint8_t * data, uint32_t length, 
                                             nsIInterfaceRequestor *ctx)
 
 {
   nsNSSShutDownPreventionLock locker;
+  if (isAlreadyShutDown()) {
+    return NS_ERROR_NOT_AVAILABLE;
+  }
+
   SECStatus srv = SECFailure;
   nsresult nsrv = NS_OK;
   ScopedCERTCertificate cert;
   SECItem **rawCerts = nullptr;
   int numcerts;
   int i;
   nsNSSCertTrust trust;
   char *serverNickname = nullptr;
  
   PLArenaPool *arena = PORT_NewArena(DER_DEFAULT_CHUNKSIZE);
   if (!arena)
     return NS_ERROR_OUT_OF_MEMORY;
 
-  CERTDERCerts *certCollection = getCertsFromPackage(arena, data, length);
+  CERTDERCerts *certCollection = getCertsFromPackage(arena, data, length, locker);
   if (!certCollection) {
     PORT_FreeArena(arena, false);
     return NS_ERROR_FAILURE;
   }
   cert = CERT_NewTempCertificate(CERT_GetDefaultCertDB(), certCollection->rawCerts,
                                  nullptr, false, true);
   if (!cert) {
     nsrv = NS_ERROR_FAILURE;
@@ -689,17 +711,17 @@ nsNSSCertificateDB::ImportServerCertific
 loser:
   PORT_Free(rawCerts);
   if (arena) 
     PORT_FreeArena(arena, true);
   return nsrv;
 }
 
 nsresult
-nsNSSCertificateDB::ImportValidCACerts(int numCACerts, SECItem *CACerts, nsIInterfaceRequestor *ctx)
+nsNSSCertificateDB::ImportValidCACerts(int numCACerts, SECItem *CACerts, nsIInterfaceRequestor *ctx,  const nsNSSShutDownPreventionLock &proofOfLock)
 {
   ScopedCERTCertList certList;
   SECItem **rawArray;
 
   // build a CertList for filtering
   certList = CERT_NewCertList();
   if (!certList) {
     return NS_ERROR_FAILURE;
@@ -733,21 +755,22 @@ nsNSSCertificateDB::ImportValidCACerts(i
     if (cacert)
       cacert = CERT_DupCertificate(cacert);
     if (cacert)
       CERT_AddCertToListTail(certList, cacert);
   }
 
   CERT_DestroyCertArray(certArray, numCACerts);
 
-  return ImportValidCACertsInList(certList, ctx);
+  return ImportValidCACertsInList(certList, ctx, proofOfLock);
 }
 
 nsresult
-nsNSSCertificateDB::ImportValidCACertsInList(CERTCertList *certList, nsIInterfaceRequestor *ctx)
+nsNSSCertificateDB::ImportValidCACertsInList(CERTCertList *certList, nsIInterfaceRequestor *ctx,
+                                             const nsNSSShutDownPreventionLock &proofOfLock)
 {
   RefPtr<CertVerifier> certVerifier(GetDefaultCertVerifier());
   if (!certVerifier)
     return NS_ERROR_UNEXPECTED;
 
   /* filter out the certs we don't want */
   SECStatus srv = CERT_FilterCertListByUsage(certList, certUsageAnyCA, true);
   if (srv != SECSuccess) {
@@ -768,29 +791,30 @@ nsNSSCertificateDB::ImportValidCACertsIn
 
     SECStatus rv = certVerifier->VerifyCert(node->cert, certificateUsageVerifyCA,
                                             PR_Now(), ctx, 0, &verifyCertChain);
 
     ScopedCERTCertList certChain(verifyCertChain);
 
     if (rv != SECSuccess) {
       nsCOMPtr<nsIX509Cert> certToShow = nsNSSCertificate::Create(node->cert);
-      DisplayCertificateAlert(ctx, "NotImportingUnverifiedCert", certToShow);
+      DisplayCertificateAlert(ctx, "NotImportingUnverifiedCert", certToShow, proofOfLock);
       continue;
     }
 
     ImportCertsIntoPermanentStorage(certChain, certUsageAnyCA, true);
   }
   
   return NS_OK;
 }
 
 void nsNSSCertificateDB::DisplayCertificateAlert(nsIInterfaceRequestor *ctx, 
                                                  const char *stringID, 
-                                                 nsIX509Cert *certToShow)
+                                                 nsIX509Cert *certToShow,
+                                                 const nsNSSShutDownPreventionLock &/*proofOfLock*/)
 {
   if (!NS_IsMainThread()) {
     NS_ERROR("nsNSSCertificateDB::DisplayCertificateAlert called off the main thread");
     return;
   }
 
   nsPSMUITracker tracker;
   if (!tracker.isUIForbidden()) {
@@ -822,96 +846,103 @@ NS_IMETHODIMP
 nsNSSCertificateDB::ImportUserCertificate(uint8_t *data, uint32_t length, nsIInterfaceRequestor *ctx)
 {
   if (!NS_IsMainThread()) {
     NS_ERROR("nsNSSCertificateDB::ImportUserCertificate called off the main thread");
     return NS_ERROR_NOT_SAME_THREAD;
   }
   
   nsNSSShutDownPreventionLock locker;
+  if (isAlreadyShutDown()) {
+    return NS_ERROR_NOT_AVAILABLE;
+  }
+
   ScopedPK11SlotInfo slot;
   nsAutoCString nickname;
   nsresult rv = NS_ERROR_FAILURE;
   int numCACerts;
   SECItem *CACerts;
   CERTDERCerts * collectArgs;
   PLArenaPool *arena;
   ScopedCERTCertificate cert;
 
   arena = PORT_NewArena(DER_DEFAULT_CHUNKSIZE);
   if (!arena) {
     goto loser;
   }
 
-  collectArgs = getCertsFromPackage(arena, data, length);
+  collectArgs = getCertsFromPackage(arena, data, length, locker);
   if (!collectArgs) {
     goto loser;
   }
 
   cert = CERT_NewTempCertificate(CERT_GetDefaultCertDB(), collectArgs->rawCerts,
                                  nullptr, false, true);
   if (!cert) {
     goto loser;
   }
 
   slot = PK11_KeyForCertExists(cert, nullptr, ctx);
   if (!slot) {
     nsCOMPtr<nsIX509Cert> certToShow = nsNSSCertificate::Create(cert);
-    DisplayCertificateAlert(ctx, "UserCertIgnoredNoPrivateKey", certToShow);
+    DisplayCertificateAlert(ctx, "UserCertIgnoredNoPrivateKey", certToShow, locker);
     goto loser;
   }
   slot = nullptr;
 
   /* pick a nickname for the cert */
   if (cert->nickname) {
 	/* sigh, we need a call to look up other certs with this subject and
 	 * identify nicknames from them. We can no longer walk down internal
 	 * database structures  rjr */
   	nickname = cert->nickname;
   }
   else {
-    get_default_nickname(cert, ctx, nickname);
+    get_default_nickname(cert, ctx, nickname, locker);
   }
 
   /* user wants to import the cert */
   {
     char *cast_const_away = const_cast<char*>(nickname.get());
     slot = PK11_ImportCertForKey(cert, cast_const_away, ctx);
   }
   if (!slot) {
     goto loser;
   }
   slot = nullptr;
 
   {
     nsCOMPtr<nsIX509Cert> certToShow = nsNSSCertificate::Create(cert);
-    DisplayCertificateAlert(ctx, "UserCertImported", certToShow);
+    DisplayCertificateAlert(ctx, "UserCertImported", certToShow, locker);
   }
   rv = NS_OK;
 
   numCACerts = collectArgs->numcerts - 1;
   if (numCACerts) {
     CACerts = collectArgs->rawCerts+1;
-    rv = ImportValidCACerts(numCACerts, CACerts, ctx);
+    rv = ImportValidCACerts(numCACerts, CACerts, ctx, locker);
   }
   
 loser:
   if (arena) {
     PORT_FreeArena(arena, false);
   }
   return rv;
 }
 
 /*
  * void deleteCertificate(in nsIX509Cert aCert);
  */
 NS_IMETHODIMP 
 nsNSSCertificateDB::DeleteCertificate(nsIX509Cert *aCert)
 {
   nsNSSShutDownPreventionLock locker;
+  if (isAlreadyShutDown()) {
+    return NS_ERROR_NOT_AVAILABLE;
+  }
   nsCOMPtr<nsIX509Cert2> nssCert = do_QueryInterface(aCert);
   ScopedCERTCertificate cert(nssCert->GetCert());
   if (!cert) return NS_ERROR_FAILURE;
   SECStatus srv = SECSuccess;
 
   uint32_t certType;
   nssCert->GetCertType(&certType);
   if (NS_FAILED(nssCert->MarkForPermDeletion()))
@@ -941,16 +972,19 @@ nsNSSCertificateDB::DeleteCertificate(ns
  *                   in unsigned long trust);
  */
 NS_IMETHODIMP 
 nsNSSCertificateDB::SetCertTrust(nsIX509Cert *cert, 
                                  uint32_t type,
                                  uint32_t trusted)
 {
   nsNSSShutDownPreventionLock locker;
+  if (isAlreadyShutDown()) {
+    return NS_ERROR_NOT_AVAILABLE;
+  }
   SECStatus srv;
   nsNSSCertTrust trust;
   nsCOMPtr<nsIX509Cert2> pipCert = do_QueryInterface(cert);
   if (!pipCert)
     return NS_ERROR_FAILURE;
   ScopedCERTCertificate nsscert(pipCert->GetCert());
 
   if (type == nsIX509Cert::CA_CERT) {
@@ -988,16 +1022,19 @@ nsNSSCertificateDB::IsCertTrusted(nsIX50
                                   uint32_t certType,
                                   uint32_t trustType,
                                   bool *_isTrusted)
 {
   NS_ENSURE_ARG_POINTER(_isTrusted);
   *_isTrusted = false;
 
   nsNSSShutDownPreventionLock locker;
+  if (isAlreadyShutDown()) {
+    return NS_ERROR_NOT_AVAILABLE;
+  }
   SECStatus srv;
   nsCOMPtr<nsIX509Cert2> pipCert = do_QueryInterface(cert);
   ScopedCERTCertificate nsscert(pipCert->GetCert());
   CERTCertTrust nsstrust;
   srv = CERT_GetCertTrust(nsscert, &nsstrust);
   if (srv != SECSuccess)
     return NS_ERROR_FAILURE;
 
@@ -1037,16 +1074,21 @@ nsNSSCertificateDB::IsCertTrusted(nsIX50
 }
 
 
 NS_IMETHODIMP 
 nsNSSCertificateDB::ImportCertsFromFile(nsISupports *aToken, 
                                         nsIFile *aFile,
                                         uint32_t aType)
 {
+  nsNSSShutDownPreventionLock locker;
+  if (isAlreadyShutDown()) {
+    return NS_ERROR_NOT_AVAILABLE;
+  }
+
   NS_ENSURE_ARG(aFile);
   switch (aType) {
     case nsIX509Cert::CA_CERT:
     case nsIX509Cert::EMAIL_CERT:
     case nsIX509Cert::SERVER_CERT:
       // good
       break;
     
@@ -1101,16 +1143,21 @@ nsNSSCertificateDB::ImportCertsFromFile(
   delete [] buf;
   return rv;  
 }
 
 NS_IMETHODIMP 
 nsNSSCertificateDB::ImportPKCS12File(nsISupports *aToken, 
                                      nsIFile *aFile)
 {
+  nsNSSShutDownPreventionLock locker;
+  if (isAlreadyShutDown()) {
+    return NS_ERROR_NOT_AVAILABLE;
+  }
+
   NS_ENSURE_ARG(aFile);
   nsPKCS12Blob blob;
   nsCOMPtr<nsIPK11Token> token = do_QueryInterface(aToken);
   if (token) {
     blob.SetToken(token);
   }
   return blob.ImportFromFile(aFile);
 }
@@ -1118,16 +1165,20 @@ nsNSSCertificateDB::ImportPKCS12File(nsI
 NS_IMETHODIMP 
 nsNSSCertificateDB::ExportPKCS12File(nsISupports     *aToken, 
                                      nsIFile          *aFile,
                                      uint32_t          count,
                                      nsIX509Cert     **certs)
                                      //const PRUnichar **aCertNames)
 {
   nsNSSShutDownPreventionLock locker;
+  if (isAlreadyShutDown()) {
+    return NS_ERROR_NOT_AVAILABLE;
+  }
+
   NS_ENSURE_ARG(aFile);
   nsPKCS12Blob blob;
   if (count == 0) return NS_OK;
   nsCOMPtr<nsIPK11Token> localRef;
   if (!aToken) {
     ScopedPK11SlotInfo keySlot(PK11_GetInternalKeySlot());
     NS_ASSERTION(keySlot,"Failed to get the internal key slot");
     localRef = new nsPK11Token(keySlot);
@@ -1151,22 +1202,23 @@ nsNSSCertificateDB::ExportPKCS12File(nsI
  * GetSortedNameList
  *
  * Converts a CERTCertList to a list of certificate names
  */
 void
 nsNSSCertificateDB::getCertNames(CERTCertList *certList,
                                  uint32_t      type, 
                                  uint32_t     *_count,
-                                 PRUnichar  ***_certNames)
+                                 PRUnichar  ***_certNames,
+                                 const nsNSSShutDownPreventionLock &/*proofOfLock*/)
 {
-  nsNSSShutDownPreventionLock locker;
   CERTCertListNode *node;
   uint32_t numcerts = 0, i=0;
   PRUnichar **tmpArray = nullptr;
+
   PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("List of certs %d:\n", type));
   for (node = CERT_LIST_HEAD(certList);
        !CERT_LIST_END(node, certList);
        node = CERT_LIST_NEXT(node)) {
     if (getCertType(node->cert) == type) {
       numcerts++;
     }
   }
@@ -1213,16 +1265,20 @@ nsNSSCertificateDB::FindEmailEncryptionC
 {
   NS_ENSURE_ARG_POINTER(_retval);
   *_retval = nullptr;
 
   if (aNickname.IsEmpty())
     return NS_OK;
 
   nsNSSShutDownPreventionLock locker;
+  if (isAlreadyShutDown()) {
+    return NS_ERROR_NOT_AVAILABLE;
+  }
+
   nsCOMPtr<nsIInterfaceRequestor> ctx = new PipUIContext();
   char *asciiname = nullptr;
   NS_ConvertUTF16toUTF8 aUtf8Nickname(aNickname);
   asciiname = const_cast<char*>(aUtf8Nickname.get());
 
   /* Find a good cert in the user's database */
   ScopedCERTCertificate cert;
   cert = CERT_FindUserCertByUsage(CERT_GetDefaultCertDB(), asciiname, 
@@ -1245,16 +1301,20 @@ nsNSSCertificateDB::FindEmailSigningCert
 {
   NS_ENSURE_ARG_POINTER(_retval);
   *_retval = nullptr;
 
   if (aNickname.IsEmpty())
     return NS_OK;
 
   nsNSSShutDownPreventionLock locker;
+  if (isAlreadyShutDown()) {
+    return NS_ERROR_NOT_AVAILABLE;
+  }
+
   ScopedCERTCertificate cert;
   nsCOMPtr<nsIInterfaceRequestor> ctx = new PipUIContext();
   char *asciiname = nullptr;
   NS_ConvertUTF16toUTF8 aUtf8Nickname(aNickname);
   asciiname = const_cast<char*>(aUtf8Nickname.get());
 
   /* Find a good cert in the user's database */
   cert = CERT_FindUserCertByUsage(CERT_GetDefaultCertDB(), asciiname, 
@@ -1270,16 +1330,19 @@ nsNSSCertificateDB::FindEmailSigningCert
   nssCert.forget(_retval);
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsNSSCertificateDB::FindCertByEmailAddress(nsISupports *aToken, const char *aEmailAddress, nsIX509Cert **_retval)
 {
   nsNSSShutDownPreventionLock locker;
+  if (isAlreadyShutDown()) {
+    return NS_ERROR_NOT_AVAILABLE;
+  }
   
   RefPtr<CertVerifier> certVerifier(GetDefaultCertVerifier());
   NS_ENSURE_TRUE(certVerifier, NS_ERROR_UNEXPECTED);
 
   ScopedCERTCertList certlist(
       PK11_FindCertsFromEmailAddress(aEmailAddress, nullptr));
   if (!certlist)
     return NS_ERROR_FAILURE;  
@@ -1343,16 +1406,20 @@ nsNSSCertificateDB::ConstructX509FromBas
   uint32_t lengthDER = (len * 3) / 4;
   if (base64[len-1] == '=') {
     lengthDER--;
     if (base64[len-2] == '=')
       lengthDER--;
   }
 
   nsNSSShutDownPreventionLock locker;
+  if (isAlreadyShutDown()) {
+    return NS_ERROR_NOT_AVAILABLE;
+  }
+
   SECItem secitem_cert;
   secitem_cert.type = siDERCertBuffer;
   secitem_cert.data = (unsigned char*)certDER;
   secitem_cert.len = lengthDER;
 
   ScopedCERTCertificate cert;
   cert =
     CERT_NewTempCertificate(CERT_GetDefaultCertDB(), &secitem_cert,
@@ -1369,21 +1436,21 @@ nsNSSCertificateDB::ConstructX509FromBas
   }
   nssCert.forget(_retval);
   return NS_OK;
 }
 
 void
 nsNSSCertificateDB::get_default_nickname(CERTCertificate *cert, 
                                          nsIInterfaceRequestor* ctx,
-                                         nsCString &nickname)
+                                         nsCString &nickname,
+                                         const nsNSSShutDownPreventionLock &/*proofOfLock*/)
 {
   nickname.Truncate();
 
-  nsNSSShutDownPreventionLock locker;
   nsresult rv;
   CK_OBJECT_HANDLE keyHandle;
 
   CERTCertDBHandle *defaultcertdb = CERT_GetDefaultCertDB();
   nsCOMPtr<nsINSSComponent> nssComponent(do_GetService(kNSSComponentCID, &rv));
   if (NS_FAILED(rv))
     return;
 
@@ -1486,16 +1553,21 @@ nsNSSCertificateDB::get_default_nickname
   }
 }
 
 NS_IMETHODIMP nsNSSCertificateDB::AddCertFromBase64(const char *aBase64, const char *aTrust, const char *aName)
 {
   NS_ENSURE_ARG_POINTER(aBase64);
   nsCOMPtr <nsIX509Cert> newCert;
 
+  nsNSSShutDownPreventionLock locker;
+  if (isAlreadyShutDown()) {
+    return NS_ERROR_NOT_AVAILABLE;
+  }
+
   nsNSSCertTrust trust;
 
   // need to calculate the trust bits from the aTrust string.
   SECStatus stat = CERT_DecodeTrustString(trust.GetTrust(),
     /* this is const, but not declared that way */(char *) aTrust);
   NS_ENSURE_STATE(stat == SECSuccess); // if bad trust passed in, return error.
 
 
@@ -1546,16 +1618,21 @@ nsNSSCertificateDB::AddCert(const nsACSt
   nsresult rv = Base64Encode(aCertDER, base64);
   NS_ENSURE_SUCCESS(rv, rv);
   return AddCertFromBase64(base64.get(), aTrust, aName);
 }
 
 NS_IMETHODIMP 
 nsNSSCertificateDB::GetCerts(nsIX509CertList **_retval)
 {
+  nsNSSShutDownPreventionLock locker;
+  if (isAlreadyShutDown()) {
+    return NS_ERROR_NOT_AVAILABLE;
+  }
+
   CERTCertList *certList;
 
   nsCOMPtr<nsIInterfaceRequestor> ctx = new PipUIContext();
   nsCOMPtr<nsIX509CertList> nssCertList;
   certList = PK11_ListCerts(PK11CertListUnique, ctx);
 
   // nsNSSCertList 1) adopts certList, and 2) handles the nullptr case fine.
   // (returns an empty list) 
@@ -1564,16 +1641,21 @@ nsNSSCertificateDB::GetCerts(nsIX509Cert
   *_retval = nssCertList;
   NS_ADDREF(*_retval);
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsNSSCertificateDB::GetRecentBadCerts(bool isPrivate, nsIRecentBadCerts** result)
 {
+  nsNSSShutDownPreventionLock locker;
+  if (isAlreadyShutDown()) {
+    return NS_ERROR_NOT_AVAILABLE;
+  }
+
   MutexAutoLock lock(mBadCertsLock);
   if (isPrivate) {
     if (!mPrivateRecentBadCerts) {
       mPrivateRecentBadCerts = new nsRecentBadCerts;
     }
     NS_ADDREF(*result = mPrivateRecentBadCerts);
   } else {
     if (!mPublicRecentBadCerts) {
--- a/security/manager/ssl/src/nsNSSCertificateDB.h
+++ b/security/manager/ssl/src/nsNSSCertificateDB.h
@@ -2,64 +2,78 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef __NSNSSCERTIFICATEDB_H__
 #define __NSNSSCERTIFICATEDB_H__
 
 #include "nsIX509CertDB.h"
 #include "nsIX509CertDB2.h"
+#include "nsNSSShutDown.h"
 #include "mozilla/RefPtr.h"
 #include "mozilla/Mutex.h"
 #include "certt.h"
 
 class nsCString;
 class nsIArray;
 class nsRecentBadCerts;
 
-class nsNSSCertificateDB : public nsIX509CertDB, public nsIX509CertDB2
+class nsNSSCertificateDB : public nsIX509CertDB
+                         , public nsIX509CertDB2
+                         , public nsNSSShutDownObject
+
 {
 public:
   NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_NSIX509CERTDB
   NS_DECL_NSIX509CERTDB2
 
   nsNSSCertificateDB(); 
   virtual ~nsNSSCertificateDB();
 
   // Use this function to generate a default nickname for a user
   // certificate that is to be imported onto a token.
   static void
   get_default_nickname(CERTCertificate *cert, nsIInterfaceRequestor* ctx,
-                       nsCString &nickname);
+                       nsCString &nickname,
+                       const nsNSSShutDownPreventionLock &proofOfLock);
 
   static nsresult 
-  ImportValidCACerts(int numCACerts, SECItem *CACerts, nsIInterfaceRequestor *ctx);
+  ImportValidCACerts(int numCACerts, SECItem *CACerts, nsIInterfaceRequestor *ctx,
+                     const nsNSSShutDownPreventionLock &proofOfLock);
 
 private:
 
   static nsresult
-  ImportValidCACertsInList(CERTCertList *certList, nsIInterfaceRequestor *ctx);
+  ImportValidCACertsInList(CERTCertList *certList, nsIInterfaceRequestor *ctx,
+                           const nsNSSShutDownPreventionLock &proofOfLock);
 
   static void DisplayCertificateAlert(nsIInterfaceRequestor *ctx, 
-                                      const char *stringID, nsIX509Cert *certToShow);
+                                      const char *stringID, nsIX509Cert *certToShow,
+                                      const nsNSSShutDownPreventionLock &proofOfLock);
 
   void getCertNames(CERTCertList *certList,
                     uint32_t      type, 
                     uint32_t     *_count,
-                    PRUnichar  ***_certNameList);
+                    PRUnichar  ***_certNameList,
+                    const nsNSSShutDownPreventionLock &proofOfLock);
 
   CERTDERCerts *getCertsFromPackage(PLArenaPool *arena, uint8_t *data, 
-                                    uint32_t length);
+                                    uint32_t length,
+                                    const nsNSSShutDownPreventionLock &proofOfLock);
   nsresult handleCACertDownload(nsIArray *x509Certs, 
-                                nsIInterfaceRequestor *ctx);
+                                nsIInterfaceRequestor *ctx,
+                                const nsNSSShutDownPreventionLock &proofOfLock);
 
   mozilla::Mutex mBadCertsLock;
   mozilla::RefPtr<nsRecentBadCerts> mPublicRecentBadCerts;
   mozilla::RefPtr<nsRecentBadCerts> mPrivateRecentBadCerts;
+
+  // We don't own any NSS objects here, so no need to clean up
+  virtual void virtualDestroyNSSReference() { };
 };
 
 #define NS_X509CERTDB_CID { /* fb0bbc5c-452e-4783-b32c-80124693d871 */ \
     0xfb0bbc5c,                                                        \
     0x452e,                                                            \
     0x4783,                                                            \
     {0xb3, 0x2c, 0x80, 0x12, 0x46, 0x93, 0xd8, 0x71}                   \
   }
--- a/testing/marionette/marionette-server.js
+++ b/testing/marionette/marionette-server.js
@@ -2176,17 +2176,17 @@ MarionetteServerConnection.prototype = {
       case "Marionette:register":
         // This code processes the content listener's registration information
         // and either accepts the listener, or ignores it
         let nullPrevious = (this.curBrowser.curFrameId == null);
         let listenerWindow = 
                             Services.wm.getOuterWindowWithId(message.json.value);
 
         //go in here if we're already in a remote frame.
-        if (!listenerWindow || (listenerWindow.location.href != message.json.href) &&
+        if ((!listenerWindow || listenerWindow.location.href != message.json.href) &&
             (this.curBrowser.frameManager.currentRemoteFrame !== null)) {
           // The outerWindowID from an OOP frame will not be meaningful to
           // the parent process here, since each process maintains its own
           // independent window list.  So, it will either be null (!listenerWindow)
           // if we're already in a remote frame,
           // or it will point to some random window, which will hopefully 
           // cause an href mismatch.  Currently this only happens
           // in B2G for OOP frames registered in Marionette:switchToFrame, so
--- a/toolkit/components/jsdownloads/src/DownloadLegacy.js
+++ b/toolkit/components/jsdownloads/src/DownloadLegacy.js
@@ -126,19 +126,19 @@ DownloadLegacyTransfer.prototype = {
   },
 
   onProgressChange: function DLT_onProgressChange(aWebProgress, aRequest,
                                                   aCurSelfProgress,
                                                   aMaxSelfProgress,
                                                   aCurTotalProgress,
                                                   aMaxTotalProgress)
   {
-    return onProgressChange64(aWebProgress, aRequest, aCurSelfProgress,
-                              aMaxSelfProgress, aCurTotalProgress,
-                              aMaxTotalProgress);
+    this.onProgressChange64(aWebProgress, aRequest, aCurSelfProgress,
+                            aMaxSelfProgress, aCurTotalProgress,
+                            aMaxTotalProgress);
   },
 
   onLocationChange: function () { },
 
   onStatusChange: function DLT_onStatusChange(aWebProgress, aRequest, aStatus,
                                               aMessage)
   {
     // The status change may optionally be received in addition to the state
--- a/toolkit/crashreporter/nsExceptionHandler.cpp
+++ b/toolkit/crashreporter/nsExceptionHandler.cpp
@@ -217,16 +217,21 @@ static const int kAvailablePageFileParam
 static const char kAvailablePhysicalMemoryParameter[] = "AvailablePhysicalMemory=";
 static const int kAvailablePhysicalMemoryParameterLen =
   sizeof(kAvailablePhysicalMemoryParameter)-1;
 
 static const char kIsGarbageCollectingParameter[] = "IsGarbageCollecting=";
 static const int kIsGarbageCollectingParameterLen =
   sizeof(kIsGarbageCollectingParameter)-1;
 
+#ifdef XP_WIN
+static const char kBlockedDllsParameter[] = "BlockedDllList=";
+static const int kBlockedDllsParameterLen = sizeof(kBlockedDllsParameter) - 1;
+#endif
+
 // this holds additional data sent via the API
 static Mutex* crashReporterAPILock;
 static Mutex* notesFieldLock;
 static AnnotationTable* crashReporterAPIData_Hash;
 static nsCString* crashReporterAPIData = nullptr;
 static nsCString* notesField = nullptr;
 static bool isGarbageCollecting;
 
@@ -535,16 +540,19 @@ bool MinidumpCallback(
         WriteFile(hFile, "\n", 1, &nBytes, nullptr);
       }
       if (isGarbageCollecting) {
         WriteFile(hFile, kIsGarbageCollectingParameter, kIsGarbageCollectingParameterLen,
                   &nBytes, nullptr);
         WriteFile(hFile, isGarbageCollecting ? "1" : "0", 1, &nBytes, nullptr);
         WriteFile(hFile, "\n", 1, &nBytes, nullptr);
       }
+      WriteFile(hFile, kBlockedDllsParameter, kBlockedDllsParameterLen, &nBytes, nullptr);
+      WriteBlockedDlls(hFile);
+      WriteFile(hFile, "\n", 1, &nBytes, nullptr);
 
       // Try to get some information about memory.
       MEMORYSTATUSEX statex;
       statex.dwLength = sizeof(statex);
       if (GlobalMemoryStatusEx(&statex)) {
         char buffer[128];
         int bufferLen;
 
--- a/toolkit/crashreporter/nsExceptionHandler.h
+++ b/toolkit/crashreporter/nsExceptionHandler.h
@@ -39,16 +39,21 @@ nsresult SetMinidumpPath(const nsAString
 // AnnotateCrashReport and AppendAppNotesToCrashReport may be called from any
 // thread in a chrome process, but may only be called from the main thread in
 // a content process.
 nsresult AnnotateCrashReport(const nsACString& key, const nsACString& data);
 nsresult AppendAppNotesToCrashReport(const nsACString& data);
 
 nsresult SetGarbageCollecting(bool collecting);
 
+#ifdef XP_WIN
+// Implemented by the blocklist, this method writes the blocklist annotation
+void WriteBlockedDlls(HANDLE file);
+#endif
+
 nsresult SetRestartArgs(int argc, char** argv);
 nsresult SetupExtraData(nsIFile* aAppDataDirectory,
                         const nsACString& aBuildID);
 bool GetLastRunCrashID(nsAString& id);
 
 // Registers an additional memory region to be included in the minidump
 nsresult RegisterAppMemory(void* ptr, size_t length);
 nsresult UnregisterAppMemory(void* ptr);
--- a/toolkit/xre/nsWindowsDllBlocklist.cpp
+++ b/toolkit/xre/nsWindowsDllBlocklist.cpp
@@ -15,20 +15,21 @@
 
 #include "nsAutoPtr.h"
 #include "nsThreadUtils.h"
 
 #include "prlog.h"
 
 #include "nsWindowsDllInterceptor.h"
 #include "mozilla/WindowsVersion.h"
+#include "nsWindowsHelpers.h"
 
 using namespace mozilla;
 
-#if defined(MOZ_CRASHREPORTER) && !defined(NO_BLOCKLIST_CRASHREPORTER)
+#ifdef MOZ_CRASHREPORTER
 #include "nsExceptionHandler.h"
 #endif
 
 #define ALL_VERSIONS   ((unsigned long long)-1LL)
 
 // DLLs sometimes ship without a version number, particularly early
 // releases. Blocking "version <= 0" has the effect of blocking unversioned
 // DLLs (since the call to get version info fails), but not blocking
@@ -133,16 +134,20 @@ static DllBlockInfo sWindowsDllBlocklist
 
   // Older belgian ID card software causes Firefox to crash or hang on
   // shutdown, bug 831285 and 918399.
   { "beid35cardlayer.dll", MAKE_VERSION(3, 5, 6, 6968) },
 
   // bug 925459, bitguard crashes
   { "bitguard.dll", MAKE_VERSION(2, 6, 1694, 24) },
 
+  // bug 812683 - crashes in Windows library when Asus Gamer OSD is installed
+  // Software is discontinued/unsupported
+  { "atkdx11disp.dll", ALL_VERSIONS },
+
   { nullptr, 0 }
 };
 
 #ifndef STATUS_DLL_NOT_FOUND
 #define STATUS_DLL_NOT_FOUND ((DWORD)0xC0000135L)
 #endif
 
 // define this for very verbose dll load debug spew
@@ -215,72 +220,152 @@ CheckASLR(const wchar_t* path)
       ::CloseHandle(map);
     }
     ::CloseHandle(file);
   }
 
   return retval;
 }
 
+// This lock protects both the reentrancy sentinel and the crash reporter
+// data structures.
+static CRITICAL_SECTION sLock;
+
 /**
  * Some versions of Windows call LoadLibraryEx to get the version information
  * for a DLL, which causes our patched LdrLoadDll implementation to re-enter
  * itself and cause infinite recursion and a stack-exhaustion crash. We protect
  * against reentrancy by allowing recursive loads of the same DLL.
  *
  * Note that we don't use __declspec(thread) because that doesn't work in DLLs
  * loaded via LoadLibrary and there can be a limited number of TLS slots, so
  * we roll our own.
  */
 class ReentrancySentinel
 {
 public:
   explicit ReentrancySentinel(const char* dllName)
   {
     DWORD currentThreadId = GetCurrentThreadId();
-    EnterCriticalSection(&sLock);
+    AutoCriticalSection lock(&sLock);
     mPreviousDllName = (*sThreadMap)[currentThreadId];
 
     // If there is a DLL currently being loaded and it has the same name
     // as the current attempt, we're re-entering.
     mReentered = mPreviousDllName && !stricmp(mPreviousDllName, dllName);
     (*sThreadMap)[currentThreadId] = dllName;
-    LeaveCriticalSection(&sLock);
   }
     
   ~ReentrancySentinel()
   {
     DWORD currentThreadId = GetCurrentThreadId();
-    EnterCriticalSection(&sLock);
+    AutoCriticalSection lock(&sLock);
     (*sThreadMap)[currentThreadId] = mPreviousDllName;
-    LeaveCriticalSection(&sLock);
   }
 
   bool BailOut() const
   {
     return mReentered;
   };
     
   static void InitializeStatics()
   {
     InitializeCriticalSection(&sLock);
     sThreadMap = new std::map<DWORD, const char*>;
   }
 
 private:
-  static CRITICAL_SECTION sLock;
   static std::map<DWORD, const char*>* sThreadMap;
 
   const char* mPreviousDllName;
   bool mReentered;
 };
 
-CRITICAL_SECTION ReentrancySentinel::sLock;
 std::map<DWORD, const char*>* ReentrancySentinel::sThreadMap;
 
+/**
+ * This is a linked list of DLLs that have been blocked. It doesn't use
+ * mozilla::LinkedList because this is an append-only list and doesn't need
+ * to be doubly linked.
+ */
+class DllBlockSet
+{
+public:
+  static void Add(const char* name, unsigned long long version);
+
+  // Write the list of blocked DLLs to a file HANDLE. This method is run after
+  // a crash occurs and must therefore not use the heap, etc.
+  static void Write(HANDLE file);
+
+private:
+  DllBlockSet(const char* name, unsigned long long version)
+    : mName(name)
+    , mVersion(version)
+    , mNext(nullptr)
+  {
+  }
+
+  const char* mName; // points into the sWindowsDllBlocklist string
+  unsigned long long mVersion;
+  DllBlockSet* mNext;
+
+  static DllBlockSet* gFirst;
+};
+
+DllBlockSet* DllBlockSet::gFirst;
+
+void
+DllBlockSet::Add(const char* name, unsigned long long version)
+{
+  AutoCriticalSection lock(&sLock);
+  for (DllBlockSet* b = gFirst; b; b = b->mNext) {
+    if (0 == strcmp(b->mName, name) && b->mVersion == version) {
+      return;
+    }
+  }
+  // Not already present
+  DllBlockSet* n = new DllBlockSet(name, version);
+  n->mNext = gFirst;
+  gFirst = n;
+}
+
+void
+DllBlockSet::Write(HANDLE file)
+{
+  AutoCriticalSection lock(&sLock);
+  DWORD nBytes;
+
+  // Because this method is called after a crash occurs, and uses heap memory,
+  // protect this entire block with a structured exception handler.
+  __try {
+    for (DllBlockSet* b = gFirst; b; b = b->mNext) {
+      // write name[,v.v.v.v];
+      WriteFile(file, b->mName, strlen(b->mName), &nBytes, nullptr);
+      if (b->mVersion != -1) {
+        WriteFile(file, ",", 1, &nBytes, nullptr);
+        uint16_t parts[4];
+        parts[0] = b->mVersion >> 48;
+        parts[1] = (b->mVersion >> 32) & 0xFFFF;
+        parts[2] = (b->mVersion >> 16) & 0xFFFF;
+        parts[3] = b->mVersion & 0xFFFF;
+        for (int p = 0; p < 4; ++p) {
+          char buf[32];
+          ltoa(parts[p], buf, 10);
+          WriteFile(file, buf, strlen(buf), &nBytes, nullptr);
+          if (p != 3) {
+            WriteFile(file, ".", 1, &nBytes, nullptr);
+          }
+        }
+      }
+      WriteFile(file, ";", 1, &nBytes, nullptr);
+    }
+  }
+  __except (EXCEPTION_EXECUTE_HANDLER) { }
+}
+
 static
 wchar_t* getFullPath (PWCHAR filePath, wchar_t* fname)
 {
   // In Windows 8, the first parameter seems to be used for more than just the
   // path name.  For example, its numerical value can be 1.  Passing a non-valid
   // pointer to SearchPathW will cause a crash, so we need to check to see if we
   // are handed a valid pointer, and otherwise just pass nullptr to SearchPathW.
   PWCHAR sanitizedFilePath = (intptr_t(filePath) < 1024) ? nullptr : filePath;
@@ -299,16 +384,27 @@ wchar_t* getFullPath (PWCHAR filePath, w
   }
 
   // now actually grab it
   SearchPathW(sanitizedFilePath, fname, L".dll", pathlen + 1, full_fname,
               nullptr);
   return full_fname;
 }
 
+// No builtin function to find the last character matching a set
+static wchar_t* lastslash(wchar_t* s, int len)
+{
+  for (wchar_t* c = s + len - 1; c >= s; --c) {
+    if (*c == L'\\' || *c == L'/') {
+      return c;
+    }
+  }
+  return nullptr;
+}
+
 static NTSTATUS NTAPI
 patched_LdrLoadDll (PWCHAR filePath, PULONG flags, PUNICODE_STRING moduleFileName, PHANDLE handle)
 {
   // We have UCS2 (UTF16?), we want ASCII, but we also just want the filename portion
 #define DLLNAME_MAX 128
   char dllName[DLLNAME_MAX+1];
   wchar_t *dll_part;
   DllBlockInfo *info;
@@ -325,17 +421,17 @@ patched_LdrLoadDll (PWCHAR filePath, PUL
       fname[len] != 0)
   {
 #ifdef DEBUG
     printf_stderr("LdrLoadDll: non-null terminated string found!\n");
 #endif
     goto continue_loading;
   }
 
-  dll_part = wcsrchr(fname, L'\\');
+  dll_part = lastslash(fname, len);
   if (dll_part) {
     dll_part = dll_part + 1;
     len -= dll_part - fname;
   } else {
     dll_part = fname;
   }
 
 #ifdef DEBUG_very_verbose
@@ -391,16 +487,18 @@ patched_LdrLoadDll (PWCHAR filePath, PUL
     printf_stderr("LdrLoadDll: info->name: '%s'\n", info->name);
 #endif
 
     if ((info->flags == DllBlockInfo::BLOCK_WIN8PLUS_ONLY) &&
         !IsWin8OrLater()) {
       goto continue_loading;
     }
 
+    unsigned long long fVersion = ALL_VERSIONS;
+
     if (info->maxVersion != ALL_VERSIONS) {
       ReentrancySentinel sentinel(dllName);
       if (sentinel.BailOut()) {
         goto continue_loading;
       }
 
       full_fname = getFullPath(filePath, fname);
       if (!full_fname) {
@@ -417,30 +515,31 @@ patched_LdrLoadDll (PWCHAR filePath, PUL
       if (infoSize != 0) {
         nsAutoArrayPtr<unsigned char> infoData(new unsigned char[infoSize]);
         VS_FIXEDFILEINFO *vInfo;
         UINT vInfoLen;
 
         if (GetFileVersionInfoW(full_fname, 0, infoSize, infoData) &&
             VerQueryValueW(infoData, L"\\", (LPVOID*) &vInfo, &vInfoLen))
         {
-          unsigned long long fVersion =
+          fVersion =
             ((unsigned long long)vInfo->dwFileVersionMS) << 32 |
             ((unsigned long long)vInfo->dwFileVersionLS);
 
           // finally do the version check, and if it's greater than our block
           // version, keep loading
           if (fVersion > info->maxVersion)
             load_ok = true;
         }
       }
     }
 
     if (!load_ok) {
       printf_stderr("LdrLoadDll: Blocking load of '%s' -- see http://www.mozilla.com/en-US/blocklist/\n", dllName);
+      DllBlockSet::Add(info->name, fVersion);
       return STATUS_DLL_NOT_FOUND;
     }
   }
 
 continue_loading:
 #ifdef DEBUG_very_verbose
   printf_stderr("LdrLoadDll: continuing load... ('%S')\n", moduleFileName->Buffer);
 #endif
@@ -476,14 +575,22 @@ XRE_SetupDllBlocklist()
 
   bool ok = NtDllIntercept.AddHook("LdrLoadDll", reinterpret_cast<intptr_t>(patched_LdrLoadDll), (void**) &stub_LdrLoadDll);
 
 #ifdef DEBUG
   if (!ok)
     printf_stderr ("LdrLoadDll hook failed, no dll blocklisting active\n");
 #endif
 
-#if defined(MOZ_CRASHREPORTER) && !defined(NO_BLOCKLIST_CRASHREPORTER)
+#ifdef MOZ_CRASHREPORTER
   if (!ok) {
     CrashReporter::AppendAppNotesToCrashReport(NS_LITERAL_CSTRING("DllBlockList Failed\n"));
   }
 #endif
 }
+
+#ifdef MOZ_CRASHREPORTER
+void
+CrashReporter::WriteBlockedDlls(HANDLE file)
+{
+  DllBlockSet::Write(file);
+}
+#endif
--- a/tools/trace-malloc/bloatblame.cpp
+++ b/tools/trace-malloc/bloatblame.cpp
@@ -17,17 +17,16 @@
 extern int  getopt(int argc, char *const *argv, const char *shortopts);
 extern char *optarg;
 extern int  optind;
 #endif
 #endif
 #include <math.h>
 #include <time.h>
 #include <sys/stat.h>
-#include "prtypes.h"
 #include "prlog.h"
 #include "prprf.h"
 #include "plhash.h"
 #include "pldhash.h"
 #include "nsTraceMalloc.h"
 #include "tmreader.h"
 
 static char   *program;
--- a/tools/trace-malloc/lib/nsDebugHelpWin32.cpp
+++ b/tools/trace-malloc/lib/nsDebugHelpWin32.cpp
@@ -3,17 +3,16 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 
 #if defined(_WIN32) && (defined(_M_IX86) || defined(_M_X64))
 // This is the .cpp file where the globals live
 #define DHW_IMPLEMENT_GLOBALS
 #include <stdio.h>
-#include "prtypes.h"
 #include "prprf.h"
 #include "prlog.h"
 #include "plstr.h"
 #include "prlock.h"
 #include "nscore.h"
 #include "nsDebugHelpWin32.h"
 #else
 #error "nsDebugHelpWin32.cpp should only be built in Win32 x86/x64 builds"
--- a/tools/trace-malloc/lib/nsTypeInfo.h
+++ b/tools/trace-malloc/lib/nsTypeInfo.h
@@ -2,18 +2,16 @@
  *
  * This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef trace_malloc_nsTypeInfo_h_
 #define trace_malloc_nsTypeInfo_h_
 
-#include "prtypes.h"
-
 #ifdef __cplusplus
 extern "C" {
 #endif
 
 extern const char* nsGetTypeName(void* ptr);
 
 extern void RegisterTraceMallocShutdown();
 
--- a/tools/trace-malloc/lib/nsWinTraceMalloc.cpp
+++ b/tools/trace-malloc/lib/nsWinTraceMalloc.cpp
@@ -2,17 +2,16 @@
  *
  * This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include <stdio.h>
 #include <stdlib.h>
 
-#include "prtypes.h"
 #include "prinrval.h"
 #include "prlock.h"
 #include "nscore.h"
 
 #include "nsDebugHelpWin32.h"
 #include "nsTraceMallocCallbacks.h"
 
 /***************************************************************************/
--- a/widget/gtk/nsColorPicker.cpp
+++ b/widget/gtk/nsColorPicker.cpp
@@ -66,19 +66,21 @@ NS_IMETHODIMP nsColorPicker::Open(nsICol
     return NS_ERROR_FAILURE;
   }
   mCallback = aColorPickerShownCallback;
 
   nsXPIDLCString title;
   title.Adopt(ToNewUTF8String(mTitle));
   GtkWidget *color_chooser = gtk_color_selection_dialog_new(title);
 
+  GtkWindow *window = GTK_WINDOW(color_chooser);
+  gtk_window_set_modal(window, TRUE);
+
   GtkWindow *parent_window = GTK_WINDOW(mParentWidget->GetNativeData(NS_NATIVE_SHELLWIDGET));
   if (parent_window) {
-    GtkWindow *window = GTK_WINDOW(color_chooser);
     gtk_window_set_transient_for(window, parent_window);
     gtk_window_set_destroy_with_parent(window, TRUE);
   }
 
   gtk_color_selection_set_current_color(
       GTK_COLOR_SELECTION(gtk_color_selection_dialog_get_color_selection(
         GTK_COLOR_SELECTION_DIALOG(color_chooser))),
       &mDefaultColor);
--- a/xpcom/base/nsWindowsHelpers.h
+++ b/xpcom/base/nsWindowsHelpers.h
@@ -4,16 +4,36 @@
 
 #ifndef nsWindowsHelpers_h
 #define nsWindowsHelpers_h
 
 #include <windows.h>
 #include "nsAutoRef.h"
 #include "nscore.h"
 
+// ----------------------------------------------------------------------------
+// Critical Section helper class
+// ----------------------------------------------------------------------------
+
+class AutoCriticalSection
+{
+public:
+  AutoCriticalSection(LPCRITICAL_SECTION section)
+    : mSection(section)
+  {
+    ::EnterCriticalSection(mSection);
+  }
+  ~AutoCriticalSection()
+  {
+    ::LeaveCriticalSection(mSection);
+  }
+private:
+  LPCRITICAL_SECTION mSection;
+};
+
 template<>
 class nsAutoRefTraits<HKEY>
 {
 public:
   typedef HKEY RawRef;
   static HKEY Void()
   {
     return nullptr;
--- a/xpcom/ds/TimeStamp_windows.cpp
+++ b/xpcom/ds/TimeStamp_windows.cpp
@@ -9,16 +9,17 @@
 
 // XXX Forcing log to be able to catch issues in the field.  Should be removed
 // before this reaches the Release or even Beta channel.
 #define FORCE_PR_LOG
 
 #include "mozilla/MathAlgorithms.h"
 #include "mozilla/Mutex.h"
 #include "mozilla/TimeStamp.h"
+#include "nsWindowsHelpers.h"
 #include <windows.h>
 
 #include "nsCRT.h"
 #include "prlog.h"
 #include "prprf.h"
 #include <stdio.h>
 
 #include <intrin.h>
@@ -180,36 +181,16 @@ static DWORD sLastGTCResult = 0;
 // incremented atomically.
 static DWORD sLastGTCRollover = 0;
 
 namespace mozilla {
 
 typedef ULONGLONG (WINAPI* GetTickCount64_t)();
 static GetTickCount64_t sGetTickCount64 = nullptr;
 
-// ----------------------------------------------------------------------------
-// Critical Section helper class
-// ----------------------------------------------------------------------------
-
-class AutoCriticalSection
-{
-public:
-  AutoCriticalSection(LPCRITICAL_SECTION section)
-    : mSection(section)
-  {
-    ::EnterCriticalSection(mSection);
-  }
-  ~AutoCriticalSection()
-  {
-    ::LeaveCriticalSection(mSection);
-  }
-private:
-  LPCRITICAL_SECTION mSection;
-};
-
 // Function protecting GetTickCount result from rolling over,
 // result is in [ms]
 static ULONGLONG WINAPI
 MozGetTickCount64()
 {
   DWORD GTC = ::GetTickCount();
 
   // Cheaper then CMPXCHG8B