Merge backout a=me
authorEhsan Akhgari <ehsan@mozilla.com>
Thu, 02 Sep 2010 19:59:48 -0400
changeset 51937 03f80b4e03189acaedb128390051a822a284ee91
parent 51936 4235cd33ad433012678d87ca668203b67c48ad57 (current diff)
parent 51935 983c38bb0f03d49d17989c0dc081ebcd8603905f (diff)
child 51938 af64d768c0fd17e2dcf7aa749e58661ffd8025a5
push idunknown
push userunknown
push dateunknown
reviewersme
milestone2.0b6pre
Merge backout a=me
xpcom/tests/TestOOM.cpp
--- a/browser/base/content/browser-fullZoom.js
+++ b/browser/base/content/browser-fullZoom.js
@@ -251,20 +251,20 @@ var FullZoom = {
     if (aURI.spec == "about:blank") {
       this._applyPrefToSetting(undefined, aBrowser);
       return;
     }
 
     var self = this;
     Services.contentPrefs.getPref(aURI, this.name, function (aResult) {
       // Check that we're still where we expect to be in case this took a while.
-      let isSaneURI = (aBrowser && aBrowser.currentURI) ?
-        aURI.equals(aBrowser.currentURI) : false;
-      if (!aBrowser || isSaneURI)
-        self._applyPrefToSetting(aResult, aBrowser);
+      let browser = aBrowser || gBrowser.selectedBrowser;
+      if (aURI.equals(browser.currentURI)) {
+        self._applyPrefToSetting(aResult, browser);
+      }
     });
   },
 
   // update state of zoom type menu item
 
   updateMenu: function FullZoom_updateMenu() {
     var menuItem = document.getElementById("toggle_zoom");
 
--- a/browser/base/content/browser.css
+++ b/browser/base/content/browser.css
@@ -343,8 +343,12 @@ window[chromehidden~="toolbar"] toolbar:
   display: none;
   -moz-user-focus: normal;
 }
 
 #notification-popup-box[anchorid="geo-notification-icon"] > #geo-notification-icon,
 #notification-popup-box[anchorid="addons-notification-icon"] > #addons-notification-icon {
   display: -moz-box;
 }
+
+#geolocation-notification {
+  -moz-binding: url("chrome://browser/content/urlbarBindings.xml#geolocation-notification");
+}
--- a/browser/base/content/tabbrowser.xml
+++ b/browser/base/content/tabbrowser.xml
@@ -803,16 +803,18 @@
                                           true, false);
             }
 
             // Don't switch the fast find or update the titlebar (bug 540248) - this tab switch is temporary
             if (!this._previewMode) {
               this._fastFind.setDocShell(this.mCurrentBrowser.docShell);
 
               this.updateTitlebar();
+
+              this.mCurrentTab.removeAttribute("titlechanged");
             }
 
             // If the new tab is busy, and our current state is not busy, then
             // we need to fire a start to all progress listeners.
             const nsIWebProgressListener = Components.interfaces.nsIWebProgressListener;
             if (this.mCurrentTab.hasAttribute("busy") && !this.mIsBusy) {
               this.mIsBusy = true;
               this._callProgressListeners(null, "onStateChange",
@@ -2444,16 +2446,18 @@
           var contentWin = event.target.defaultView;
           if (contentWin != contentWin.top)
             return;
 
           var tab = this._getTabForContentWindow(contentWin);
           this.setTabTitle(tab);
           if (tab == this.mCurrentTab)
             this.updateTitlebar();
+          else if (!tab.hasAttribute("busy"))
+            tab.setAttribute("titlechanged", "true");
         ]]>
       </handler>
     </handlers>
   </binding>
 
   <binding id="tabbrowser-tabbox"
            extends="chrome://global/content/bindings/tabbox.xml#tabbox">
     <implementation>
@@ -2768,17 +2772,26 @@
             }, 150, this._animateElement);
           }
         ]]></body>
       </method>
 
       <method name="_getDragTargetTab">
         <parameter name="event"/>
         <body><![CDATA[
-          return event.target.localName == "tab" ? event.target : null;
+          let tab = event.target.localName == "tab" ? event.target : null;
+          if (tab &&
+              (event.type == "drop" || event.type == "dragover") &&
+              event.dataTransfer.dropEffect == "link") {
+            let boxObject = tab.boxObject;
+            if (event.screenX < boxObject.screenX + boxObject.width * .25 ||
+                event.screenX > boxObject.screenX + boxObject.width * .75)
+              return null;
+          }
+          return tab;
         ]]></body>
       </method>
 
       <method name="_getDropIndex">
         <parameter name="event"/>
         <body><![CDATA[
           var tabs = this.childNodes;
           var tab = this._getDragTargetTab(event);
@@ -3017,16 +3030,17 @@
 
         if (effects == "link") {
           let tab = this._getDragTargetTab(event);
           if (tab) {
             if (!this._dragTime)
               this._dragTime = Date.now();
             if (Date.now() >= this._dragTime + this._dragOverDelay)
               this.selectedItem = tab;
+            ind.collapsed = true;
             return;
           }
         }
 
         var newIndex = this._getDropIndex(event);
         var scrollRect = tabStrip.scrollClientRect;
         var rect = this.getBoundingClientRect();
         var minMargin = scrollRect.left - rect.left;
--- a/browser/base/content/tabview/ui.js
+++ b/browser/base/content/tabview/ui.js
@@ -76,16 +76,20 @@ var UIManager = {
   // TabView UI and re-orders the tabs when switcing back to main browser.
   _reorderTabsOnHide : [],
 
   // Variable: _currentTab
   // Keeps track of which xul:tab we are currently on.
   // Used to facilitate zooming down from a previous tab.
   _currentTab : null,
 
+  // Variable: _eventListeners
+  // Keeps track of event listeners added to the AllTabs object.
+  _eventListeners: {},
+
   // ----------
   // Function: init
   // Must be called after the object is created.
   init: function() {
     try {
       let self = this;
 
       // ___ storage
@@ -233,16 +237,17 @@ var UIManager = {
     }
   },
 
   uninit: function() {
     TabItems.uninit();
     GroupItems.uninit();
     Storage.uninit();
 
+    this._removeTabActionHandlers();
     this._currentTab = null;
     this._pageBounds = null;
     this._reorderTabItemsOnShow = null;
     this._reorderTabsOnHide = null;
   },
 
   // ----------
   // Function: getActiveTab
@@ -402,17 +407,17 @@ var UIManager = {
 #endif
 
   // ----------
   // Function: _addTabActionHandlers
   // Adds handlers to handle tab actions.
   _addTabActionHandlers: function() {
     var self = this;
 
-    AllTabs.register("close", function(tab) {
+    this._eventListeners.close = function(tab) {
       if (tab.ownerDocument.defaultView != gWindow)
         return;
 
       if (self._isTabViewVisible()) {
         // just closed the selected tab in the TabView interface.
         if (self._currentTab == tab)
           self._closedSelectedTabInTabView = true;
       } else {
@@ -433,33 +438,44 @@ var UIManager = {
             self._closedLastVisibleTab = true;
             // remove the zoom prep.
             if (tab && tab.tabItem)
               tab.tabItem.setZoomPrep(false);
             self.showTabView();
           }
         }
       }
-    });
+    };
 
-    AllTabs.register("move", function(tab) {
+    this._eventListeners.move = function(tab) {
       if (tab.ownerDocument.defaultView != gWindow)
         return;
 
       let activeGroupItem = GroupItems.getActiveGroupItem();
       if (activeGroupItem)
         self.setReorderTabItemsOnShow(activeGroupItem);
-    });
+    };
 
-    AllTabs.register("select", function(tab) {
+    this._eventListeners.select = function(tab) {
       if (tab.ownerDocument.defaultView != gWindow)
         return;
 
       self.onTabSelect(tab);
-    });
+    };
+
+    for (let name in this._eventListeners)
+      AllTabs.register(name, this._eventListeners[name]);
+  },
+
+  // ----------
+  // Function: _removeTabActionHandlers
+  // Removes handlers to handle tab actions.
+  _removeTabActionHandlers: function() {
+    for (let name in this._eventListeners)
+      AllTabs.unregister(name, this._eventListeners[name]);
   },
 
   // ----------
   // Function: onTabSelect
   // Called when the user switches from one tab to another outside of the TabView UI.
   onTabSelect: function(tab) {
     let currentTab = this._currentTab;
     this._currentTab = tab;
--- a/browser/base/content/test/Makefile.in
+++ b/browser/base/content/test/Makefile.in
@@ -85,16 +85,18 @@ endif
 # The following tests are disabled because they are unreliable:
 #   browser_bug423833.js is bug 428712
 #   browser_sanitize-download-history.js is bug 432425
 #
 # browser_sanitizeDialog_treeView.js is disabled until the tree view is added
 # back to the clear recent history dialog (santize.xul), if it ever is (bug
 # 480169)
 
+# browser_drag.js is disabled, as it needs to be updated for the new behavior from bug 320638.
+
 _BROWSER_FILES = \
                  browser_typeAheadFind.js \
                  browser_NetworkPrioritizer.js \
                  browser_allTabsPanel.js \
                  browser_alltabslistener.js \
                  browser_bug304198.js \
                  browser_bug321000.js \
                  title_test.svg \
@@ -131,29 +133,29 @@ endif
                  browser_bug520538.js \
                  browser_bug521216.js \
                  browser_bug537474.js \
                  browser_bug550565.js \
                  browser_bug553455.js \
                  browser_bug555224.js \
                  browser_bug555767.js \
                  browser_bug556061.js \
+                 browser_bug559991.js \
                  browser_bug561623.js \
                  browser_bug562649.js \
                  browser_bug563588.js \
                  browser_bug577121.js \
                  browser_bug579872.js \
                  browser_bug580956.js \
                  browser_bug581242.js \
                  browser_bug581947.js \
                  browser_bug585830.js \
                  browser_contextSearchTabPosition.js \
                  browser_ctrlTab.js \
                  browser_discovery.js \
-                 browser_drag.js \
                  browser_duplicateIDs.js \
                  browser_gestureSupport.js \
                  browser_getshortcutoruri.js \
                  browser_hide_removing.js \
                  browser_inspector_initialization.js \
                  browser_inspector_treeSelection.js \
                  browser_inspector_highlighter.js \
                  browser_inspector_stylePanel.js \
new file mode 100644
--- /dev/null
+++ b/browser/base/content/test/browser_bug559991.js
@@ -0,0 +1,64 @@
+function test() {
+
+  // ----------
+  // Test setup
+
+  waitForExplicitFinish();
+
+  let oldOLC = FullZoom.onLocationChange;
+  FullZoom.onLocationChange = function(aURI, aIsTabSwitch, aBrowser) {
+    // Ignore calls that are not about tab switching on this test
+    if (aIsTabSwitch)
+      oldOLC.call(FullZoom, aURI, aIsTabSwitch, aBrowser);
+  };
+
+  gPrefService.setBoolPref("browser.zoom.updateBackgroundTabs", true);
+  gPrefService.setBoolPref("browser.zoom.siteSpecific", true);
+
+  let oldAPTS = FullZoom._applyPrefToSetting;
+  let uri = "http://example.org/browser/browser/base/content/test/dummy_page.html";
+
+  // ------------------------------------------------------
+  // Test 1 - Zoom should not be called if URIs don't match
+  FullZoom._applyPrefToSetting = function() {
+    ok(false, "This should not be called");
+  };
+  FullZoom.onLocationChange(makeURI(uri), true);
+
+  let tab = gBrowser.addTab();
+  tab.linkedBrowser.addEventListener("load", function(event) {
+    tab.linkedBrowser.removeEventListener("load", arguments.callee, true);
+
+    // -------------------------------------------------------------------
+    // Test 2 - Trigger a tab switch that should now update the zoom level
+    FullZoom._applyPrefToSetting = function() {
+      ok(true, "applyPrefToSetting was called");
+      endTest();
+    }
+    gBrowser.selectedTab = tab;
+
+  }, true); 
+  tab.linkedBrowser.loadURI(uri);
+
+  // -------------
+  // Test clean-up
+  function endTest() {
+    gBrowser.removeTab(tab);
+    FullZoom._applyPrefToSetting = oldAPTS;
+    FullZoom.onLocationChange = oldOLC;
+
+    oldAPTS = null;
+    oldOLC = null;
+    tab = null;
+
+    if (gPrefService.prefHasUserValue("browser.zoom.updateBackgroundTabs"))
+      gPrefService.clearUserPref("browser.zoom.updateBackgroundTabs");
+
+    if (gPrefService.prefHasUserValue("browser.zoom.siteSpecific"))
+      gPrefService.clearUserPref("browser.zoom.siteSpecific");
+
+    finish();
+  }
+
+}
+
--- a/browser/base/content/urlbarBindings.xml
+++ b/browser/base/content/urlbarBindings.xml
@@ -683,9 +683,42 @@
             }
             return label;
           ]]>
         </body>
       </method>
 
     </implementation>
   </binding>
+
+  <binding id="geolocation-notification" extends="chrome://global/content/bindings/notification.xml#popup-notification">
+    <content>
+      <xul:image class="popup-notification-icon"
+                 xbl:inherits="popupid"/>
+      <xul:vbox>
+        <xul:description class="popup-notification-description"
+                         xbl:inherits="value=label"/>
+        <xul:spacer flex="1"/>
+        <xul:hbox pack="end">
+          <xul:label anonid="learnmore" class="text-link geolocation-text-link"/>
+          <xul:spacer flex="1"/>
+          <xul:button anonid="button"
+                      class="popup-notification-menubutton"
+                      xbl:inherits="oncommand=buttoncommand,label=buttonlabel,accesskey=buttonaccesskey,type=buttontype">
+            <xul:menupopup anonid="menupopup"
+                           xbl:inherits="oncommand=menucommand">
+              <children/>
+            </xul:menupopup>
+          </xul:button>
+        </xul:hbox>
+      </xul:vbox>
+    </content>
+    <implementation>  
+      <constructor><![CDATA[
+        let link = document.getAnonymousElementByAttribute(this, "anonid", "learnmore");
+        link.value = gNavigatorBundle.getString("geolocation.learnMore");
+        
+        let formatter = Cc["@mozilla.org/toolkit/URLFormatterService;1"].getService(Ci.nsIURLFormatter);
+        link.href = formatter.formatURLPref("browser.geolocation.warning.infoURL");
+      ]]></constructor>
+    </implementation>
+  </binding>
 </bindings>
--- a/browser/themes/gnomestripe/browser/browser.css
+++ b/browser/themes/gnomestripe/browser/browser.css
@@ -1022,16 +1022,21 @@ toolbar[iconsize="small"] #fullscreen-bu
 .notification-anchor-icon:-moz-focusring {
   outline: 1px dotted -moz-DialogText;
 }
 
 #geo-notification-icon {
   list-style-image: url(chrome://browser/skin/Geolocation-16.png);
 }
 
+.geolocation-text-link {
+  -moz-padding-start: 13px;
+  padding-top: 10px;
+}
+
 #addons-notification-icon {
   list-style-image: url(chrome://mozapps/skin/extensions/extensionGeneric-16.png);
 }
 
 /* Feed icon */
 #feed-button,
 #feed-button > .button-box,
 #feed-button:hover:active > .button-box {
@@ -1225,16 +1230,20 @@ statusbarpanel#statusbar-display {
 .tabbrowser-tab[pinned] {
   min-height: 20px; /* corresponds to the max. height of non-textual tab contents, i.e. the tab close button */
 }
 
 .tabbrowser-tab[pinned] + .tabbrowser-tab:not([pinned]) {
   -moz-margin-start: 0;
 }
 
+.tabbrowser-tab[pinned][titlechanged]:not([selected="true"]) {
+  -moz-box-shadow: 0 0 0 1em rgba(255,0,0,.5) inset;
+}
+
 .tab-icon-image {
   width: 16px;
   height: 16px;
   -moz-margin-start: 1px;
   -moz-margin-end: 4px;
   list-style-image: url("chrome://global/skin/icons/folder-item.png");
   -moz-image-region: rect(0px, 16px, 16px, 0px);
 }
--- a/browser/themes/pinstripe/browser/browser.css
+++ b/browser/themes/pinstripe/browser/browser.css
@@ -1479,16 +1479,20 @@ toolbarbutton.chevron > .toolbarbutton-m
   background-image: none;
   background-color: -moz-mac-chrome-active;
 }
 
 .tabbrowser-tab[selected="true"]:-moz-window-inactive {
   background-color: -moz-mac-chrome-inactive;
 }
 
+.tabbrowser-tab[pinned][titlechanged]:not([selected="true"]) {
+  background-color: rgba(255,0,0,.5) !important;
+}
+
 #tabbrowser-tabs[tabsontop="true"] > .tabbrowser-tab[selected="true"] {
   -moz-border-top-colors: rgba(0,0,0,.04) rgba(0,0,0,.17) rgba(255,255,255,.9);
   -moz-border-right-colors: rgba(0,0,0,.04) rgba(0,0,0,.17) rgba(255,255,255,.6);
   -moz-border-left-colors: rgba(0,0,0,.04) rgba(0,0,0,.17) rgba(255,255,255,.6);
   background-image: -moz-linear-gradient(rgba(255,255,255,.7), rgba(255,255,255,.58));
 }
 
 .tabbrowser-tab:focus > .tab-text {
@@ -1850,16 +1854,17 @@ toolbarbutton.chevron > .toolbarbutton-m
   background-color: transparent;
   margin-top: -3px;
   margin-left: -23px;
   min-width: 280px;
   -moz-border-image: url(chrome://browser/skin/hud-panel.png) 26 18 22 50 / 26px 18px 22px 50px repeat;
 }
 
 #notification-popup {
+  color: #fff;
   margin-top: -1px;
   margin-left: -27px;
 }
 
 #notification-popup-box {
   margin: 0 3px;
 }
 
@@ -1873,24 +1878,24 @@ toolbarbutton.chevron > .toolbarbutton-m
   -moz-box-shadow: 0 0 3px 1px -moz-mac-focusring inset,
                    0 0 3px 2px -moz-mac-focusring;
 }
 
 #geo-notification-icon {
   list-style-image: url(chrome://browser/skin/Geolocation-16.png);
 }
 
+.geolocation-text-link {
+  color: #fff;
+}
+
 #addons-notification-icon {
   list-style-image: url(chrome://mozapps/skin/extensions/extensionGeneric-16.png);
 }
 
-.popup-notification-description {
-  color: #fff;
-}
-
 .popup-notification-icon {
   width: 64px;
   height: 64px;
   -moz-margin-end: 10px;
 }
 
 .popup-notification-icon[popupid="geolocation"] {
   list-style-image: url(chrome://browser/skin/Geolocation-64.png);
--- a/browser/themes/winstripe/browser/browser.css
+++ b/browser/themes/winstripe/browser/browser.css
@@ -1362,16 +1362,20 @@ richlistitem[type~="action"][actiontype=
   background-image: -moz-linear-gradient(hsla(0,0%,60%,.5), hsla(0,0%,45%,.5) 50%);
 }
 
 .tabbrowser-tab:-moz-lwtheme-darktext:not([selected="true"]):hover,
 .tabs-newtab-button:-moz-lwtheme-darktext:hover {
   background-image: -moz-linear-gradient(hsla(0,0%,80%,.5), hsla(0,0%,60%,.5) 50%);
 }
 
+.tabbrowser-tab[pinned][titlechanged]:not([selected="true"]) {
+  background-image: -moz-linear-gradient(rgba(255,0,0,.5), rgba(255,0,0,.5)) !important;
+}
+
 .tabbrowser-tab[busy] > .tab-icon-image {
   list-style-image: url("chrome://browser/skin/tabbrowser/progress.png") !important;
   -moz-image-region: rect(0, 16px, 16px, 0);
 }
 .tabbrowser-tab[busy][stalled] > .tab-icon-image {
   list-style-image: url("chrome://browser/skin/tabbrowser/progress-pulsing.png") !important;
 }
 .tabbrowser-tab[busy][progress="1"] > .tab-icon-image {
@@ -1798,16 +1802,20 @@ toolbarbutton.bookmark-item[dragover="tr
   height: 64px;
   -moz-margin-end: 10px;
 }
 
 .popup-notification-icon[popupid="geolocation"] {
   list-style-image: url(chrome://browser/skin/Geolocation-64.png);
 }
 
+.geolocation-text-link {
+  padding-top: 5px;
+}
+
 .popup-notification-icon[popupid="xpinstall-disabled"],
 .popup-notification-icon[popupid="addon-install-blocked"],
 .popup-notification-icon[popupid="addon-install-failed"],
 .popup-notification-icon[popupid="addon-install-complete"] {
   list-style-image: url(chrome://mozapps/skin/extensions/extensionGeneric.png);
   width: 32px;
   height: 32px;
 }
--- a/config/config.mk
+++ b/config/config.mk
@@ -389,19 +389,16 @@ DEFINES += \
 		-DIMPL_XREAPI \
 		-DIMPL_NS_NET \
 		-DIMPL_THEBES \
 		$(NULL)
 
 ifndef JS_SHARED_LIBRARY
 DEFINES += -DSTATIC_EXPORTABLE_JS_API
 endif
-ifndef MOZ_NATIVE_ZLIB
-DEFINES += -DZLIB_INTERNAL
-endif
 endif
 endif
 
 # Force _all_ exported methods to be |_declspec(dllexport)| when we're
 # building them into the executable.
 
 ifeq (,$(filter-out WINNT WINCE OS2, $(OS_ARCH)))
 ifdef BUILD_STATIC_LIBS
--- a/content/html/content/src/nsHTMLButtonElement.cpp
+++ b/content/html/content/src/nsHTMLButtonElement.cpp
@@ -77,16 +77,18 @@ static const nsAttrValue::EnumTable kBut
 // Default type is 'submit'.
 static const nsAttrValue::EnumTable* kButtonDefaultType = &kButtonTypeTable[2];
 
 class nsHTMLButtonElement : public nsGenericHTMLFormElement,
                             public nsIDOMHTMLButtonElement,
                             public nsIConstraintValidation
 {
 public:
+  using nsIConstraintValidation::GetValidationMessage;
+
   nsHTMLButtonElement(already_AddRefed<nsINodeInfo> aNodeInfo);
   virtual ~nsHTMLButtonElement();
 
   // nsISupports
   NS_DECL_ISUPPORTS_INHERITED
 
   // nsIDOMNode
   NS_FORWARD_NSIDOMNODE(nsGenericHTMLFormElement::)
--- a/content/html/content/src/nsHTMLFieldSetElement.cpp
+++ b/content/html/content/src/nsHTMLFieldSetElement.cpp
@@ -44,16 +44,18 @@
 #include "nsIConstraintValidation.h"
 
 
 class nsHTMLFieldSetElement : public nsGenericHTMLFormElement,
                               public nsIDOMHTMLFieldSetElement,
                               public nsIConstraintValidation
 {
 public:
+  using nsIConstraintValidation::GetValidationMessage;
+
   nsHTMLFieldSetElement(already_AddRefed<nsINodeInfo> aNodeInfo);
   virtual ~nsHTMLFieldSetElement();
 
   // nsISupports
   NS_DECL_ISUPPORTS_INHERITED
 
   // nsIDOMNode
   NS_FORWARD_NSIDOMNODE(nsGenericHTMLFormElement::)
--- a/content/html/content/src/nsHTMLInputElement.h
+++ b/content/html/content/src/nsHTMLInputElement.h
@@ -113,16 +113,18 @@ class nsHTMLInputElement : public nsGene
                            public nsIDOMHTMLInputElement,
                            public nsITextControlElement,
                            public nsIPhonetic,
                            public nsIDOMNSEditableElement,
                            public nsIFileControlElement,
                            public nsIConstraintValidation
 {
 public:
+  using nsIConstraintValidation::GetValidationMessage;
+
   nsHTMLInputElement(already_AddRefed<nsINodeInfo> aNodeInfo,
                      PRUint32 aFromParser);
   virtual ~nsHTMLInputElement();
 
   // nsISupports
   NS_DECL_ISUPPORTS_INHERITED
 
   // nsIDOMNode
--- a/content/html/content/src/nsHTMLOutputElement.cpp
+++ b/content/html/content/src/nsHTMLOutputElement.cpp
@@ -44,16 +44,18 @@
 
 
 class nsHTMLOutputElement : public nsGenericHTMLFormElement,
                             public nsIDOMHTMLOutputElement,
                             public nsStubMutationObserver,
                             public nsIConstraintValidation
 {
 public:
+  using nsIConstraintValidation::GetValidationMessage;
+
   nsHTMLOutputElement(already_AddRefed<nsINodeInfo> aNodeInfo);
   virtual ~nsHTMLOutputElement();
 
   // nsISupports
   NS_DECL_ISUPPORTS_INHERITED
 
   // nsIDOMNode
   NS_FORWARD_NSIDOMNODE(nsGenericHTMLFormElement::)
--- a/content/html/content/src/nsHTMLSelectElement.h
+++ b/content/html/content/src/nsHTMLSelectElement.h
@@ -236,16 +236,18 @@ private:
  * Implementation of &lt;select&gt;
  */
 class nsHTMLSelectElement : public nsGenericHTMLFormElement,
                             public nsIDOMHTMLSelectElement,
                             public nsISelectElement,
                             public nsIConstraintValidation
 {
 public:
+  using nsIConstraintValidation::GetValidationMessage;
+
   nsHTMLSelectElement(already_AddRefed<nsINodeInfo> aNodeInfo,
                       PRUint32 aFromParser = 0);
   virtual ~nsHTMLSelectElement();
 
   // nsISupports
   NS_DECL_ISUPPORTS_INHERITED
 
   // nsIDOMNode
--- a/content/html/content/src/nsHTMLTextAreaElement.cpp
+++ b/content/html/content/src/nsHTMLTextAreaElement.cpp
@@ -89,16 +89,18 @@ class nsHTMLTextAreaElement : public nsG
                               public nsIDOMHTMLTextAreaElement,
                               public nsIDOMNSHTMLTextAreaElement,
                               public nsITextControlElement,
                               public nsIDOMNSEditableElement,
                               public nsStubMutationObserver,
                               public nsIConstraintValidation
 {
 public:
+  using nsIConstraintValidation::GetValidationMessage;
+
   nsHTMLTextAreaElement(already_AddRefed<nsINodeInfo> aNodeInfo,
                         PRUint32 aFromParser = 0);
 
   // nsISupports
   NS_DECL_ISUPPORTS_INHERITED
 
   // nsIDOMNode
   NS_FORWARD_NSIDOMNODE(nsGenericHTMLFormElement::)
--- a/dom/base/nsJSEnvironment.cpp
+++ b/dom/base/nsJSEnvironment.cpp
@@ -956,101 +956,27 @@ nsJSContext::DOMOperationCallback(JSCont
   PRTime modalStateTime = ctx->mModalStateTime;
 
   MaybeGC(cx);
 
   // Now restore the callback time and count, in case they got reset.
   ctx->mOperationCallbackTime = callbackTime;
   ctx->mModalStateTime = modalStateTime;
 
-  // Check to see if we are running OOM
-  nsCOMPtr<nsIMemory> mem;
-  NS_GetMemoryManager(getter_AddRefs(mem));
-  if (!mem) {
-    JS_ClearPendingException(cx);
-    return JS_FALSE;
-  }
-
-  PRBool lowMemory;
-  mem->IsLowMemory(&lowMemory);
-  if (lowMemory) {
-    // try to clean up:
-    nsJSContext::CC();
-
-    // never prevent system scripts from running
-    if (!::JS_IsSystemObject(cx, ::JS_GetGlobalObject(cx))) {
-
-      // lets see if CC() did anything, if not, cancel the script.
-      mem->IsLowMemory(&lowMemory);
-      if (lowMemory) {
-
-        if (nsContentUtils::GetBoolPref("dom.prevent_oom_dialog", PR_FALSE)) {
-          JS_ClearPendingException(cx);
-          return JS_FALSE;
-        }
-
-        nsCOMPtr<nsIScriptError> errorObject =
-          do_CreateInstance("@mozilla.org/scripterror;1");
-
-        if (errorObject) {
-          nsXPIDLString msg;
-          nsContentUtils::GetLocalizedString(nsContentUtils::eDOM_PROPERTIES,
-                                             "LowMemoryMessage",
-                                             msg);
-
-          JSStackFrame *fp, *iterator = nsnull;
-          fp = ::JS_FrameIterator(cx, &iterator);
-          PRUint32 lineno = 0;
-          nsAutoString sourcefile;
-          if (fp) {
-            JSScript* script = ::JS_GetFrameScript(cx, fp);
-            if (script) {
-              const char* filename = ::JS_GetScriptFilename(cx, script);
-              if (filename) {
-                CopyUTF8toUTF16(nsDependentCString(filename), sourcefile);
-              }
-              jsbytecode* pc = ::JS_GetFramePC(cx, fp);
-              if (pc) {
-                lineno = ::JS_PCToLineNumber(cx, script, pc);
-              }
-            }
-          }
-
-          rv = errorObject->Init(msg.get(),
-                                 sourcefile.get(),
-                                 EmptyString().get(),
-                                 lineno, 0, nsIScriptError::errorFlag,
-                                 "content javascript");
-          if (NS_SUCCEEDED(rv)) {
-            nsCOMPtr<nsIConsoleService> consoleService =
-              do_GetService(NS_CONSOLESERVICE_CONTRACTID, &rv);
-            if (NS_SUCCEEDED(rv)) {
-              consoleService->LogMessage(errorObject);
-            }
-          }
-        }
-
-        JS_ClearPendingException(cx);
-        return JS_FALSE;
-      }
-    }
-  }
-
   PRTime now = PR_Now();
 
   if (callbackTime == 0) {
     // Initialize mOperationCallbackTime to start timing how long the
     // script has run
     ctx->mOperationCallbackTime = now;
     return JS_TRUE;
   }
 
   if (ctx->mModalStateDepth) {
     // We're waiting on a modal dialog, nothing more to do here.
-
     return JS_TRUE;
   }
 
   PRTime duration = now - callbackTime;
 
   // Check the amount of time this script has been running, or if the
   // dialog is disabled.
   PRBool isTrackingChromeCodeTime =
--- a/editor/libeditor/html/crashtests/crashtests.list
+++ b/editor/libeditor/html/crashtests/crashtests.list
@@ -3,17 +3,17 @@ load 382778-1.html
 load 407074-1.html
 load 407277-1.html
 load 418923-1.html
 load 420439.html
 load 428489-1.html
 load 431086-1.xhtml
 load 448329-1.html
 load 448329-2.html
-asserts(16-20) load 448329-3.html
+asserts(8-20) load 448329-3.html
 load 456727-1.html
 load 456727-2.html
 asserts(1) load 467647-1.html # bug 382210
 load 503709-1.xhtml
 load 513375-1.xhtml
 load 535632-1.xhtml
 load 574558-1.xhtml
 load 582138-1.xhtml
--- a/gfx/cairo/cairo/src/cairo-d2d-surface.cpp
+++ b/gfx/cairo/cairo/src/cairo-d2d-surface.cpp
@@ -3623,18 +3623,16 @@ cairo_d2d_surface_create_for_handle(cair
 
 	if (FAILED(hr)) {
 	    goto FAIL_CREATEHANDLE;
 	}
     }
 
     newSurf->rt->CreateSolidColorBrush(D2D1::ColorF(0, 1.0), &newSurf->solidColorBrush);
 
-    _d2d_clear_surface(newSurf);
-
     newSurf->device = d2d_device;
     cairo_addref_device(device);
 
     return &newSurf->base;
    
 FAIL_CREATEHANDLE:
     newSurf->~cairo_d2d_surface_t();
     free(newSurf);
--- a/gfx/layers/d3d9/ThebesLayerD3D9.cpp
+++ b/gfx/layers/d3d9/ThebesLayerD3D9.cpp
@@ -65,16 +65,17 @@ UseOpaqueSurface(Layer* aLayer)
   ContainerLayer* parent = aLayer->GetParent();
   return parent && parent->GetFirstChild() == aLayer &&
          UseOpaqueSurface(parent);
 }
 
 ThebesLayerD3D9::ThebesLayerD3D9(LayerManagerD3D9 *aManager)
   : ThebesLayer(aManager, NULL)
   , LayerD3D9(aManager)
+  , mD2DSurfaceInitialized(false)
 {
   mImplData = static_cast<LayerD3D9*>(this);
   aManager->deviceManager()->mThebesLayers.AppendElement(this);
 }
 
 ThebesLayerD3D9::~ThebesLayerD3D9()
 {
   mD3DManager->deviceManager()->mThebesLayers.RemoveElement(this);
@@ -284,28 +285,32 @@ ThebesLayerD3D9::DrawRegion(const nsIntR
   HRESULT hr;
   nsIntRect visibleRect = mVisibleRegion.GetBounds();
   nsRefPtr<gfxContext> context;
 
 #ifdef CAIRO_HAS_D2D_SURFACE
   if (mD2DSurface) {
     context = new gfxContext(mD2DSurface);
     nsIntRegionRectIterator iter(aRegion);
+
     context->Translate(gfxPoint(-visibleRect.x, -visibleRect.y));
     context->NewPath();
     const nsIntRect *iterRect;
     while ((iterRect = iter.Next())) {
       context->Rectangle(gfxRect(iterRect->x, iterRect->y, iterRect->width, iterRect->height));      
     }
     context->Clip();
-    if (mD2DSurface->GetContentType() != gfxASurface::CONTENT_COLOR) {
+    if (!mD2DSurfaceInitialized || 
+        mD2DSurface->GetContentType() != gfxASurface::CONTENT_COLOR) {
       context->SetOperator(gfxContext::OPERATOR_CLEAR);
       context->Paint();
       context->SetOperator(gfxContext::OPERATOR_OVER);
+      mD2DSurfaceInitialized = true;
     }
+
     LayerManagerD3D9::CallbackInfo cbInfo = mD3DManager->GetCallbackInfo();
     cbInfo.Callback(this, context, aRegion, nsIntRegion(), cbInfo.CallbackData);
     mD2DSurface->Flush();
 
     // XXX - This call is quite expensive, we may want to consider doing our
     // drawing in a seperate 'validation' iteration. And then flushing once for
     // all the D2D surfaces we might have drawn, before doing our D3D9 rendering
     // loop.
@@ -418,16 +423,17 @@ ThebesLayerD3D9::CreateNewTexture(const 
       gfxWindowsPlatform::RENDER_DIRECT2D) {
         if (mD3DManager->deviceManager()->IsD3D9Ex()) {
           // We should have D3D9Ex where we have D2D.
           HANDLE sharedHandle = 0;
           device()->CreateTexture(aSize.width, aSize.height, 1,
                                   D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8,
                                   D3DPOOL_DEFAULT, getter_AddRefs(mTexture), &sharedHandle);
 
+          mD2DSurfaceInitialized = false;
           mD2DSurface = new gfxD2DSurface(sharedHandle, UseOpaqueSurface(this) ?
             gfxASurface::CONTENT_COLOR : gfxASurface::CONTENT_COLOR_ALPHA);
 
           // If there's an error, go on and do what we always do.
           if (mD2DSurface->CairoStatus()) {
             mD2DSurface = nsnull;
             mTexture = nsnull;
           }
--- a/gfx/layers/d3d9/ThebesLayerD3D9.h
+++ b/gfx/layers/d3d9/ThebesLayerD3D9.h
@@ -68,16 +68,18 @@ private:
   /*
    * D3D9 texture
    */
   nsRefPtr<IDirect3DTexture9> mTexture;
 
   /* This contains the D2D surface if we have one */
   nsRefPtr<gfxASurface> mD2DSurface;
 
+  bool mD2DSurfaceInitialized;
+
   /* Have a region of our layer drawn */
   void DrawRegion(const nsIntRegion &aRegion);
 
   /* Create a new texture */
   void CreateNewTexture(const gfxIntSize &aSize);
 };
 
 } /* layers */
--- a/js/src/config/config.mk
+++ b/js/src/config/config.mk
@@ -389,19 +389,16 @@ DEFINES += \
 		-DIMPL_XREAPI \
 		-DIMPL_NS_NET \
 		-DIMPL_THEBES \
 		$(NULL)
 
 ifndef JS_SHARED_LIBRARY
 DEFINES += -DSTATIC_EXPORTABLE_JS_API
 endif
-ifndef MOZ_NATIVE_ZLIB
-DEFINES += -DZLIB_INTERNAL
-endif
 endif
 endif
 
 # Force _all_ exported methods to be |_declspec(dllexport)| when we're
 # building them into the executable.
 
 ifeq (,$(filter-out WINNT WINCE OS2, $(OS_ARCH)))
 ifdef BUILD_STATIC_LIBS
--- a/modules/libpr0n/src/imgFrame.cpp
+++ b/modules/libpr0n/src/imgFrame.cpp
@@ -187,27 +187,16 @@ imgFrame::~imgFrame()
 
 nsresult imgFrame::Init(PRInt32 aX, PRInt32 aY, PRInt32 aWidth, PRInt32 aHeight, 
                         gfxASurface::gfxImageFormat aFormat, PRInt8 aPaletteDepth /* = 0 */)
 {
   // assert for properties that should be verified by decoders, warn for properties related to bad content
   if (!AllowedImageSize(aWidth, aHeight))
     return NS_ERROR_FAILURE;
 
-  // Check to see if we are running OOM
-  nsCOMPtr<nsIMemory> mem;
-  NS_GetMemoryManager(getter_AddRefs(mem));
-  if (!mem)
-    return NS_ERROR_UNEXPECTED;
-
-  PRBool lowMemory;
-  mem->IsLowMemory(&lowMemory);
-  if (lowMemory)
-    return NS_ERROR_OUT_OF_MEMORY;
-
   mOffset.MoveTo(aX, aY);
   mSize.SizeTo(aWidth, aHeight);
 
   mFormat = aFormat;
   mPaletteDepth = aPaletteDepth;
 
   if (aPaletteDepth != 0) {
     // We're creating for a paletted image.
@@ -548,27 +537,16 @@ nsresult imgFrame::Extract(const nsIntRe
 
   *aResult = subImage.forget();
 
   return NS_OK;
 }
 
 nsresult imgFrame::ImageUpdated(const nsIntRect &aUpdateRect)
 {
-  // Check to see if we are running OOM
-  nsCOMPtr<nsIMemory> mem;
-  NS_GetMemoryManager(getter_AddRefs(mem));
-  if (!mem)
-    return NS_ERROR_UNEXPECTED;
-
-  PRBool lowMemory;
-  mem->IsLowMemory(&lowMemory);
-  if (lowMemory)
-    return NS_ERROR_OUT_OF_MEMORY;
-
   mDecoded.UnionRect(mDecoded, aUpdateRect);
 
   // clamp to bounds, in case someone sends a bogus updateRect (I'm looking at
   // you, gif decoder)
   nsIntRect boundsRect(mOffset, mSize);
   mDecoded.IntersectRect(mDecoded, boundsRect);
 
 #ifdef XP_MACOSX
--- a/modules/plugin/base/src/nsPluginHost.cpp
+++ b/modules/plugin/base/src/nsPluginHost.cpp
@@ -1817,23 +1817,23 @@ NS_IMETHODIMP nsPluginHost::GetPlugin(co
 // currently 'unwanted' plugins are Java, and all other plugins except
 // Acrobat, Flash, Quicktime and Shockwave
 static PRBool isUnwantedPlugin(nsPluginTag * tag)
 {
   if (tag->mFileName.IsEmpty())
     return PR_TRUE;
 
   for (PRInt32 i = 0; i < tag->mVariants; ++i) {
-    if (nsnull == PL_strcasecmp(tag->mMimeTypeArray[i], "application/pdf"))
+    if (!PL_strcasecmp(tag->mMimeTypeArray[i], "application/pdf"))
       return PR_FALSE;
 
-    if (nsnull == PL_strcasecmp(tag->mMimeTypeArray[i], "application/x-shockwave-flash"))
+    if (!PL_strcasecmp(tag->mMimeTypeArray[i], "application/x-shockwave-flash"))
       return PR_FALSE;
 
-    if (nsnull == PL_strcasecmp(tag->mMimeTypeArray[i],"application/x-director"))
+    if (!PL_strcasecmp(tag->mMimeTypeArray[i], "application/x-director"))
       return PR_FALSE;
   }
 
   // On Windows, we also want to include the Quicktime plugin from the 4.x directory
   // But because it spans several DLL's, the best check for now is by filename
   if (tag->mFileName.Find("npqtplugin", PR_TRUE, 0, -1) != kNotFound)
     return PR_FALSE;
 
--- a/netwerk/base/public/security-prefs.js
+++ b/netwerk/base/public/security-prefs.js
@@ -3,17 +3,16 @@ pref("security.enable_ssl3",            
 pref("security.enable_tls",		 true);
 pref("security.enable_tls_session_tickets", true);
 
 pref("security.ssl.allow_unrestricted_renego_everywhere__temporarily_available_pref", false);
 pref("security.ssl.renego_unrestricted_hosts", "");
 pref("security.ssl.treat_unsafe_negotiation_as_broken", false);
 pref("security.ssl.require_safe_negotiation",  false);
 pref("security.ssl.warn_missing_rfc5746",  1);
-pref("security.ssl.enable_compression", false);
 pref("security.ssl.enable_false_start", true);
 
 pref("security.ssl2.rc4_128", false);
 pref("security.ssl2.rc2_128", false);
 pref("security.ssl2.des_ede3_192", false);
 pref("security.ssl2.des_64", false);
 pref("security.ssl2.rc4_40", false);
 pref("security.ssl2.rc2_40", false);
--- a/security/manager/ssl/src/nsNSSComponent.cpp
+++ b/security/manager/ssl/src/nsNSSComponent.cpp
@@ -1714,18 +1714,16 @@ nsNSSComponent::InitializeNSS(PRBool sho
       SSL_OptionSetDefault(SSL_REQUIRE_SAFE_NEGOTIATION, enabled);
 
       mPrefBranch->GetBoolPref(
         "security.ssl.allow_unrestricted_renego_everywhere__temporarily_available_pref", 
         &enabled);
       SSL_OptionSetDefault(SSL_ENABLE_RENEGOTIATION, 
         enabled ? SSL_RENEGOTIATE_UNRESTRICTED : SSL_RENEGOTIATE_REQUIRES_XTN);
 
-      mPrefBranch->GetBoolPref("security.ssl.enable_compression", &enabled);
-      SSL_OptionSetDefault(SSL_ENABLE_DEFLATE, enabled);
 #ifdef SSL_ENABLE_FALSE_START // Requires NSS 3.12.8
       mPrefBranch->GetBoolPref("security.ssl.enable_false_start", &enabled);
       SSL_OptionSetDefault(SSL_ENABLE_FALSE_START, enabled);
 #endif
 
       // Disable any ciphers that NSS might have enabled by default
       for (PRUint16 i = 0; i < SSL_NumImplementedCiphers; ++i)
       {
@@ -2248,20 +2246,16 @@ nsNSSComponent::Observe(nsISupports *aSu
       }
     } else if (prefName.Equals("security.ssl.treat_unsafe_negotiation_as_broken")) {
       mPrefBranch->GetBoolPref("security.ssl.treat_unsafe_negotiation_as_broken", &enabled);
       nsSSLIOLayerHelpers::setTreatUnsafeNegotiationAsBroken(enabled);
     } else if (prefName.Equals("security.ssl.warn_missing_rfc5746")) {
       PRInt32 warnLevel = 1;
       mPrefBranch->GetIntPref("security.ssl.warn_missing_rfc5746", &warnLevel);
       nsSSLIOLayerHelpers::setWarnLevelMissingRFC5746(warnLevel);
-    } else if (prefName.Equals("security.ssl.enable_compression")) {
-      mPrefBranch->GetBoolPref("security.ssl.enable_compression", &enabled);
-      SSL_OptionSetDefault(SSL_ENABLE_DEFLATE, enabled);
-      clearSessionCache = PR_TRUE;
 #ifdef SSL_ENABLE_FALSE_START // Requires NSS 3.12.8
     } else if (prefName.Equals("security.ssl.enable_false_start")) {
       mPrefBranch->GetBoolPref("security.ssl.enable_false_start", &enabled);
       SSL_OptionSetDefault(SSL_ENABLE_FALSE_START, enabled);
 #endif
     } else if (prefName.Equals("security.OCSP.enabled")
                || prefName.Equals("security.OCSP.require")) {
       setOCSPOptions(mPrefBranch);
--- a/toolkit/components/console/hudservice/HUDService.jsm
+++ b/toolkit/components/console/hudservice/HUDService.jsm
@@ -74,16 +74,21 @@ XPCOMUtils.defineLazyGetter(this, "Prope
   try {
     Cu.import("resource://gre/modules/PropertyPanel.jsm", obj);
   } catch (err) {
     Cu.reportError(err);
   }
   return obj.PropertyPanel;
 });
 
+XPCOMUtils.defineLazyGetter(this, "namesAndValuesOf", function () {
+  var obj = {};
+  Cu.import("resource://gre/modules/PropertyPanel.jsm", obj);
+  return obj.namesAndValuesOf;
+});
 
 function LogFactory(aMessagePrefix)
 {
   function log(aMessage) {
     var _msg = aMessagePrefix + " " + aMessage + "\n";
     dump(_msg);
   }
   return log;
@@ -155,24 +160,33 @@ ResponseListener.prototype =
    *
    * @param nsIRequest aRequest
    */
   setResponseHeader: function RL_setResponseHeader(aRequest)
   {
     let httpActivity = this.httpActivity;
     // Check if the header isn't set yet.
     if (!httpActivity.response.header) {
+      if (aRequest instanceof Ci.nsIHttpChannel) {
       httpActivity.response.header = {};
-      if (aRequest instanceof Ci.nsIHttpChannel) {
+        try {
         aRequest.visitResponseHeaders({
           visitHeader: function(aName, aValue) {
             httpActivity.response.header[aName] = aValue;
           }
         });
       }
+        // Accessing the response header can throw an NS_ERROR_NOT_AVAILABLE
+        // exception. Catch it and stop it to make it not show up in the.
+        // This can happen if the response is not finished yet and the user
+        // reloades the page.
+        catch (ex) {
+          delete httpActivity.response.header;
+        }
+      }
     }
   },
 
   /**
    * See documention at
    * https://developer.mozilla.org/en/XPCOM_Interface_Reference/nsIStreamListener
    *
    * Grabs a copy of the original data and passes it on to the original listener.
@@ -3484,16 +3498,181 @@ function JSPropertyProvider(aScope, aInp
   };
 }
 
 //////////////////////////////////////////////////////////////////////////
 // JSTerm
 //////////////////////////////////////////////////////////////////////////
 
 /**
+ * JSTermHelper
+ *
+ * Defines a set of functions ("helper functions") that are available from the
+ * WebConsole but not from the webpage.
+ * A list of helper functions used by Firebug can be found here:
+ *   http://getfirebug.com/wiki/index.php/Command_Line_API
+ */
+function JSTermHelper(aJSTerm)
+{
+  return {
+    /**
+     * Returns the result of document.getElementById(aId).
+     *
+     * @param string aId
+     *        A string that is passed to window.document.getElementById.
+     * @returns nsIDOMNode or null
+     */
+    $: function JSTH_$(aId)
+    {
+      try {
+        return aJSTerm._window.document.getElementById(aId);
+      }
+      catch (ex) {
+        aJSTerm.console.error(ex.message);
+      }
+    },
+
+    /**
+     * Returns the result of document.querySelectorAll(aSelector).
+     *
+     * @param string aSelector
+     *        A string that is passed to window.document.querySelectorAll.
+     * @returns array of nsIDOMNode
+     */
+    $$: function JSTH_$$(aSelector)
+    {
+      try {
+        return aJSTerm._window.document.querySelectorAll(aSelector);
+      }
+      catch (ex) {
+        aJSTerm.console.error(ex.message);
+      }
+    },
+
+    /**
+     * Runs a xPath query and returns all matched nodes.
+     *
+     * @param string aXPath
+     *        xPath search query to execute.
+     * @param [optional] nsIDOMNode aContext
+     *        Context to run the xPath query on. Uses window.document if not set.
+     * @returns array of nsIDOMNode
+     */
+    $x: function JSTH_$x(aXPath, aContext)
+    {
+      let nodes = [];
+      let doc = aJSTerm._window.wrappedJSObject.document;
+      let aContext = aContext || doc;
+
+      try {
+        let results = doc.evaluate(aXPath, aContext, null,
+                                    Ci.nsIDOMXPathResult.ANY_TYPE, null);
+
+        let node;
+        while (node = results.iterateNext()) {
+          nodes.push(node);
+        }
+      }
+      catch (ex) {
+        aJSTerm.console.error(ex.message);
+      }
+
+      return nodes;
+    },
+
+    /**
+     * Clears the output of the JSTerm.
+     */
+    clear: function JSTH_clear()
+    {
+      aJSTerm.clearOutput();
+    },
+
+    /**
+     * Returns the result of Object.keys(aObject).
+     *
+     * @param object aObject
+     *        Object to return the property names from.
+     * @returns array of string
+     */
+    keys: function JSTH_keys(aObject)
+    {
+      try {
+        return Object.keys(XPCNativeWrapper.unwrap(aObject));
+      }
+      catch (ex) {
+        aJSTerm.console.error(ex.message);
+      }
+    },
+
+    /**
+     * Returns the values of all properties on aObject.
+     *
+     * @param object aObject
+     *        Object to display the values from.
+     * @returns array of string
+     */
+    values: function JSTH_values(aObject)
+    {
+      let arrValues = [];
+      let obj = XPCNativeWrapper.unwrap(aObject);
+
+      try {
+        for (let prop in obj) {
+          arrValues.push(obj[prop]);
+        }
+      }
+      catch (ex) {
+        aJSTerm.console.error(ex.message);
+      }
+      return arrValues;
+    },
+
+    /**
+     * Inspects the passed aObject. This is done by opening the PropertyPanel.
+     *
+     * @param object aObject
+     *        Object to inspect.
+     * @returns void
+     */
+    inspect: function JSTH_inspect(aObject)
+    {
+      let obj = XPCNativeWrapper.unwrap(aObject);
+      aJSTerm.openPropertyPanel(null, obj);
+    },
+
+    /**
+     * Prints aObject to the output.
+     *
+     * @param object aObject
+     *        Object to print to the output.
+     * @returns void
+     */
+    pprint: function JSTH_pprint(aObject)
+    {
+      if (aObject === null || aObject === undefined || aObject === true || aObject === false) {
+        aJSTerm.console.error(HUDService.getStr("helperFuncUnsupportedTypeError"));
+        return;
+      }
+      let output = [];
+      if (typeof aObject != "string") {
+        aObject = XPCNativeWrapper.unwrap(aObject);
+      }
+      let pairs = namesAndValuesOf(aObject);
+
+      pairs.forEach(function(pair) {
+        output.push("  " + pair.display);
+      });
+
+      aJSTerm.writeOutput(output.join("\n"));
+    }
+  }
+}
+
+/**
  * JSTerm
  *
  * JavaScript Terminal: creates input nodes for console code interpretation
  * and 'JS Workspaces'
  */
 
 /**
  * Create a JSTerminal or attach a JSTerm input node to an existing output node
@@ -3571,16 +3750,17 @@ JSTerm.prototype = {
   createSandbox: function JST_setupSandbox()
   {
     // create a JS Sandbox out of this.context
     this._window.wrappedJSObject.jsterm = {};
     this.console = this._window.wrappedJSObject.console;
     this.sandbox = new Cu.Sandbox(this._window);
     this.sandbox.window = this._window;
     this.sandbox.console = this.console;
+    this.sandbox.__helperFunctions__ = JSTermHelper(this);
     this.sandbox.__proto__ = this._window.wrappedJSObject;
   },
 
   get _window()
   {
     return this.context.get().QueryInterface(Ci.nsIDOMWindowInternal);
   },
   /**
@@ -3589,17 +3769,17 @@ JSTerm.prototype = {
    *
    * @param string aString
    *        String to evaluate in the sandbox.
    * @returns something
    *          The result of the evaluation.
    */
   evalInSandbox: function JST_evalInSandbox(aString)
   {
-    let execStr = "with(window) {" + aString + "}";
+    let execStr = "with(__helperFunctions__) { with(window) {" + aString + "} }";
     return Cu.evalInSandbox(execStr,  this.sandbox, "default", "HUD Console", 1);
   },
 
 
   execute: function JST_execute(aExecuteString)
   {
     // attempt to execute the content of the inputNode
     aExecuteString = aExecuteString || this.inputNode.value;
--- a/toolkit/components/console/hudservice/PropertyPanel.jsm
+++ b/toolkit/components/console/hudservice/PropertyPanel.jsm
@@ -39,17 +39,17 @@
 
 const Cc = Components.classes;
 const Ci = Components.interfaces;
 const Cu = Components.utils;
 
 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
 Cu.import("resource://gre/modules/Services.jsm");
 
-var EXPORTED_SYMBOLS = ["PropertyPanel", "PropertyTreeView"];
+var EXPORTED_SYMBOLS = ["PropertyPanel", "PropertyTreeView", "namesAndValuesOf"];
 
 ///////////////////////////////////////////////////////////////////////////
 //// Helper for PropertyTreeView
 
 const TYPE_OBJECT = 0, TYPE_FUNCTION = 1, TYPE_ARRAY = 2, TYPE_OTHER = 3;
 
 /**
  * Figures out the type of aObject and the string to display in the tree.
--- a/toolkit/components/console/hudservice/tests/browser/browser_HUDServiceTestsAll.js
+++ b/toolkit/components/console/hudservice/tests/browser/browser_HUDServiceTestsAll.js
@@ -1044,16 +1044,61 @@ function testExecutionScope()
 
   is(/location;/.test(outputChildren[1].childNodes[0].nodeValue), true,
     "'location;' written to output");
 
   isnot(outputChildren[2].childNodes[0].textContent.indexOf(TEST_URI), -1,
     "command was executed in the window scope");
 }
 
+function testJSTermHelper()
+{
+  content.location.href = TEST_URI;
+
+  let HUD = HUDService.hudWeakReferences[hudId].get();
+  let jsterm = HUD.jsterm;
+
+  jsterm.clearOutput();
+  jsterm.execute("'id=' + $('header').getAttribute('id')");
+  let group = jsterm.outputNode.querySelector(".hud-group");
+  is(group.childNodes[2].textContent, "id=header", "$() worked");
+
+  jsterm.clearOutput();
+  jsterm.execute("headerQuery = $$('h1')");
+  jsterm.execute("'length=' + headerQuery.length");
+  let group = jsterm.outputNode.querySelector(".hud-group");
+  is(group.childNodes[4].textContent, "length=1", "$$() worked");
+
+  jsterm.clearOutput();
+  jsterm.execute("xpathQuery = $x('.//*', document.body);");
+  jsterm.execute("'headerFound='  + (xpathQuery[0] == headerQuery[0])");
+  let group = jsterm.outputNode.querySelector(".hud-group");
+  is(group.childNodes[4].textContent, "headerFound=true", "$x() worked");
+
+  // no jsterm.clearOutput() here as we clear the output using the clear() fn.
+  jsterm.execute("clear()");
+  let group = jsterm.outputNode.querySelector(".hud-group");
+  is(group.childNodes[1].textContent, "undefined", "clear() worked");
+
+  jsterm.clearOutput();
+  jsterm.execute("'keysResult=' + (keys({b:1})[0] == 'b')");
+  let group = jsterm.outputNode.querySelector(".hud-group");
+  is(group.childNodes[2].textContent, "keysResult=true", "keys() worked");
+
+  jsterm.clearOutput();
+  jsterm.execute("'valuesResult=' + (values({b:1})[0] == 1)");
+  let group = jsterm.outputNode.querySelector(".hud-group");
+  is(group.childNodes[2].textContent, "valuesResult=true", "values() worked");
+
+  jsterm.clearOutput();
+  jsterm.execute("pprint({b:2, a:1})");
+  let group = jsterm.outputNode.querySelector(".hud-group");
+  is(group.childNodes[2].textContent, "  a: 1\n  b: 2", "pprint() worked");
+}
+
 function testPropertyPanel()
 {
   var HUD = HUDService.hudWeakReferences[hudId].get();
   var jsterm = HUD.jsterm;
 
   let propPanel = jsterm.openPropertyPanel("Test", [
     1,
     /abc/,
@@ -1378,16 +1423,17 @@ function test() {
       testGroups();
       testNullUndefinedOutput();
       testJSInputAndOutputStyling();
       testExecutionScope();
       testCompletion();
       testPropertyProvider();
       testJSInputExpand();
       testPropertyPanel();
+      testJSTermHelper();
 
       // NOTE: Put any sync test above this comment.
       //
       // There is a set of async tests that have to run one after another.
       // Currently, when one test is done the next one is called from within the
       // test function until testEnd() is called that terminates the test.
       testNet();
     });
--- a/toolkit/components/console/hudservice/tests/browser/test-console.html
+++ b/toolkit/components/console/hudservice/tests/browser/test-console.html
@@ -11,12 +11,12 @@
       }
       console.info("INLINE SCRIPT:");
       test();
       console.warn("I'm warning you, he will eat up all yr bacon.");
       console.error("Error Message");
     </script>
   </head>
   <body>
-    <h1>Heads Up Display Demo</h1>
+    <h1 id="header">Heads Up Display Demo</h1>
     <button onclick="test();">Log stuff about Dolske</button>
   </body>
 </html>
--- a/toolkit/content/aboutSupport.js
+++ b/toolkit/content/aboutSupport.js
@@ -85,16 +85,17 @@ window.onload = function () {
   // Get the support URL.
   let urlFormatter = Cc["@mozilla.org/toolkit/URLFormatterService;1"]
                        .getService(Ci.nsIURLFormatter);
   let supportUrl = urlFormatter.formatURLPref("app.support.baseURL");
 
   // Update the application basics section.
   document.getElementById("application-box").textContent = Application.name;
   document.getElementById("version-box").textContent = Application.version;
+  document.getElementById("useragent-box").textContent = navigator.userAgent;
   document.getElementById("supportLink").href = supportUrl;
 
   // Update the other sections.
   populatePreferencesSection();
   populateExtensionsSection();
   populateGraphicsSection();
 }
 
--- a/toolkit/content/aboutSupport.xhtml
+++ b/toolkit/content/aboutSupport.xhtml
@@ -96,16 +96,25 @@
             </th>
 
             <td id="version-box">
             </td>
           </tr>
             
           <tr>
             <th class="column">
+              &aboutSupport.appBasicsUserAgent;
+            </th>
+
+            <td id="useragent-box">
+            </td>
+          </tr>
+
+          <tr>
+            <th class="column">
               &aboutSupport.appBasicsProfileDir;
             </th>
 
             <td>
               <button onclick="openProfileDirectory()">
 #ifdef XP_MACOSX
                 &aboutSupport.showMac.label;
 #else
--- a/toolkit/library/dlldeps-zlib.cpp
+++ b/toolkit/library/dlldeps-zlib.cpp
@@ -33,16 +33,17 @@
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 // Force references to all of the symbols that we want exported from
 // the dll that are located in the .lib files we link with
 
+#define ZLIB_INTERNAL
 #include "zlib.h"
 
 void xxxNeverCalledZLib()
 {
     deflate(0, 0);
     deflateInit(0, 0);
 	deflateInit2(0, 0, 0, 0, 0, 0);
     deflateEnd(0);
--- a/toolkit/library/libxul-config.mk
+++ b/toolkit/library/libxul-config.mk
@@ -53,17 +53,16 @@ CPPSRCS += \
 	dlldeps.cpp \
 	nsGFXDeps.cpp \
 	$(NULL)
 
 RCINCLUDE = xulrunner.rc
 
 ifndef MOZ_NATIVE_ZLIB
 CPPSRCS += dlldeps-zlib.cpp
-DEFINES += -DZLIB_INTERNAL
 endif
 
 LOCAL_INCLUDES += -I$(topsrcdir)/widget/src/windows
 endif
 
 ifneq (,$(filter WINNT OS2,$(OS_ARCH)))
 REQUIRES += libreg
 DEFINES	+= -DZLIB_DLL=1
@@ -74,17 +73,16 @@ REQUIRES += widget gfx
 
 CPPSRCS += \
 	dlldeps.cpp \
 	nsGFXDeps.cpp \
 	$(NULL)
 
 ifndef MOZ_NATIVE_ZLIB
 CPPSRCS += dlldeps-zlib.cpp
-DEFINES += -DZLIB_INTERNAL
 endif
 
 ifdef MOZ_ENABLE_LIBXUL
 RESFILE = xulrunos2.res
 RCFLAGS += -i $(topsrcdir)/widget/src/os2
 endif
 
 LOCAL_INCLUDES += -I$(topsrcdir)/widget/src/os2
--- a/toolkit/locales/en-US/chrome/global/aboutSupport.dtd
+++ b/toolkit/locales/en-US/chrome/global/aboutSupport.dtd
@@ -14,16 +14,17 @@
 <!ENTITY aboutSupport.extensionId "ID">
 
 <!ENTITY aboutSupport.appBasicsTitle "Application Basics">
 <!ENTITY aboutSupport.appBasicsName "Name">
 <!ENTITY aboutSupport.appBasicsVersion "Version">
 <!ENTITY aboutSupport.appBasicsProfileDir "Profile Directory">
 <!ENTITY aboutSupport.appBasicsEnabledPlugins "Enabled Plugins">
 <!ENTITY aboutSupport.appBasicsBuildConfig "Build Configuration">
+<!ENTITY aboutSupport.appBasicsUserAgent "User Agent">
 
 <!ENTITY aboutSupport.show.label "Open Containing Folder">
 
 <!-- LOCALIZATION NOTE (aboutSupport.showMac.label): This is the Mac-specific
 variant of aboutSupport.show.label.  This allows us to use the preferred
 "Finder" terminology on Mac. -->
 <!ENTITY aboutSupport.showMac.label "Show in Finder">
 
--- a/toolkit/locales/en-US/chrome/global/headsUpDisplay.properties
+++ b/toolkit/locales/en-US/chrome/global/headsUpDisplay.properties
@@ -58,16 +58,17 @@ jsPropertyTitle=Object Inspector
 # Example: The user executed `window.document` in the WebConsole. The `document`
 # object is written to the output. If the user clicks on the `document` output
 # in the console, a PropertyPanel will show up. The title of the PropertyPanel
 # is set to `Inspect: window.document` because the clicked `document` object was
 # evaluated based on the `window.document` string.
 jsPropertyInspectTitle=Inspect: %S
 copyCmd.label=Copy
 copyCmd.accesskey=C
+helperFuncUnsupportedTypeError=Can't call pprint on this type of object.
 # LOCALIZATION NOTE (networkUrlWithStatus):
 #
 # When the HTTP request is started only the URL of the request is printed to the
 # WebConsole. As the response status of the HTTP request arrives, the URL string
 # is replaced by this string (the response status can look like `HTTP/1.1 200 OK`).
 # The bracket is not closed to mark that this request is not done by now. As the
 # request is finished (the HTTP connection is closed) this string is replaced
 # by `networkUrlWithStatusAndDuration` which has a closing the braket.
--- a/widget/src/windows/nsWindow.cpp
+++ b/widget/src/windows/nsWindow.cpp
@@ -548,24 +548,21 @@ nsWindow::Create(nsIWidget *aParent,
     mParent = aParent;
   } else { // has a nsNative parent
     parent = (HWND)aNativeParent;
     mParent = aNativeParent ? GetNSWindowPtr((HWND)aNativeParent) : nsnull;
   }
 
   mPopupType = aInitData->mPopupHint;
   mContentType = aInitData->mContentType;
+  mIsRTL = aInitData->mRTL;
 
   DWORD style = WindowStyle();
   DWORD extendedStyle = WindowExStyle();
 
-  if (aInitData->mRTL) {
-    extendedStyle |= WS_EX_LAYOUTRTL | WS_EX_NOINHERITLAYOUT;
-  }
-
   if (mWindowType == eWindowType_popup) {
     if (!aParent)
       parent = NULL;
   } else if (mWindowType == eWindowType_invisible) {
     // Make sure CreateWindowEx succeeds at creating a toplevel window
     style &= ~0x40000000; // WS_CHILDWINDOW
   } else {
     // See if the caller wants to explictly set clip children and clip siblings
@@ -4892,18 +4889,36 @@ PRBool nsWindow::ProcessMessage(UINT msg
 
     case WM_MBUTTONUP:
       result = DispatchMouseEvent(NS_MOUSE_BUTTON_UP, wParam, lParam, PR_FALSE,
                                   nsMouseEvent::eMiddleButton, MOUSE_INPUT_SOURCE());
       DispatchPendingEvents();
       break;
 
     case WM_MBUTTONDBLCLK:
-      result = DispatchMouseEvent(NS_MOUSE_BUTTON_DOWN, wParam, lParam, PR_FALSE,
+      result = DispatchMouseEvent(NS_MOUSE_DOUBLECLICK, wParam, lParam, PR_FALSE,
+                                  nsMouseEvent::eMiddleButton, MOUSE_INPUT_SOURCE());
+      break;
+
+    case WM_NCMBUTTONDOWN:
+      result = DispatchMouseEvent(NS_MOUSE_BUTTON_DOWN, 0, lParamToClient(lParam), PR_FALSE,
                                   nsMouseEvent::eMiddleButton, MOUSE_INPUT_SOURCE());
+      DispatchPendingEvents();
+      break;
+
+    case WM_NCMBUTTONUP:
+      result = DispatchMouseEvent(NS_MOUSE_BUTTON_UP, 0, lParamToClient(lParam), PR_FALSE,
+                                  nsMouseEvent::eMiddleButton, MOUSE_INPUT_SOURCE());
+      DispatchPendingEvents();
+      break;
+
+    case WM_NCMBUTTONDBLCLK:
+      result = DispatchMouseEvent(NS_MOUSE_DOUBLECLICK, 0, lParamToClient(lParam), PR_FALSE,
+                                  nsMouseEvent::eMiddleButton, MOUSE_INPUT_SOURCE());
+      DispatchPendingEvents();
       break;
 
     case WM_RBUTTONDOWN:
     {
       result = DispatchMouseEvent(NS_MOUSE_BUTTON_DOWN, wParam, lParam, PR_FALSE,
                                   nsMouseEvent::eRightButton, MOUSE_INPUT_SOURCE());
       DispatchPendingEvents();
     }
--- a/widget/src/windows/nsWindow.h
+++ b/widget/src/windows/nsWindow.h
@@ -468,27 +468,28 @@ protected:
   PRPackedBool          mIsTopWidgetWindow;
   PRPackedBool          mInDtor;
   PRPackedBool          mIsVisible;
   PRPackedBool          mIsInMouseCapture;
   PRPackedBool          mUnicodeWidget;
   PRPackedBool          mPainting;
   PRPackedBool          mExitToNonClientArea;
   PRPackedBool          mTouchWindow;
+  PRPackedBool          mDisplayPanFeedback;
+  PRPackedBool          mHideChrome;
+  PRPackedBool          mIsRTL;
   PRUint32              mBlurSuppressLevel;
   nsContentType         mContentType;
   DWORD_PTR             mOldStyle;
   DWORD_PTR             mOldExStyle;
   HIMC                  mOldIMC;
   PRUint32              mIMEEnabled;
   nsNativeDragTarget*   mNativeDragTarget;
   HKL                   mLastKeyboardLayout;
   nsPopupType           mPopupType;
-  PRPackedBool          mDisplayPanFeedback;
-  PRPackedBool          mHideChrome;
   nsSizeMode            mOldSizeMode;
   WindowHook            mWindowHook;
   static PRUint32       sInstanceCount;
   static TriStateBool   sCanQuit;
   static nsWindow*      sCurrentWindow;
   static BOOL           sIsRegistered;
   static BOOL           sIsPopupClassRegistered;
   static BOOL           sIsOleInitialized;
--- a/xpcom/base/nsIMemory.idl
+++ b/xpcom/base/nsIMemory.idl
@@ -117,12 +117,14 @@ interface nsIMemory : nsISupports
      *   was not on the application's main thread.
      */
     void heapMinimize(in boolean immediate);
 
     /**
      * This predicate can be used to determine if we're in a low-memory
      * situation (what constitutes low-memory is platform dependent). This
      * can be used to trigger the memory pressure observers.
+     *
+     * DEPRECATED - Always returns false.  See bug 592308.
      */
     boolean isLowMemory();
 };
 
--- a/xpcom/base/nsMemoryImpl.cpp
+++ b/xpcom/base/nsMemoryImpl.cpp
@@ -49,40 +49,16 @@
 #include "pratom.h"
 
 #include "nsAlgorithm.h"
 #include "nsAutoLock.h"
 #include "nsCOMPtr.h"
 #include "nsString.h"
 #include "mozilla/Services.h"
 
-#if defined(XP_WIN)
-#include <windows.h>
-#endif
-
-#if (MOZ_PLATFORM_MAEMO == 5 || MOZ_PLATFORM_MAEMO == 4) && defined(__arm__)
-#include <fcntl.h>
-#include <unistd.h>
-static const char kHighMark[] = "/sys/kernel/high_watermark";
-#endif
-
-// Some platforms notify you when system memory is low, others do not.
-// In the case of those that do not, we want to post low memory
-// notifications from IsLowMemory().  For those that can notify us, that
-// code usually lives in toolkit.
-#ifdef WINCE
-#define NOTIFY_LOW_MEMORY
-#endif
-
-#ifdef WINCE_WINDOWS_MOBILE
-#include "aygshell.h"
-#endif
-
-#include "nsITimer.h"
-
 static nsMemoryImpl sGlobalMemory;
 
 NS_IMPL_QUERY_INTERFACE1(nsMemoryImpl, nsIMemory)
 
 NS_IMETHODIMP_(void*)
 nsMemoryImpl::Alloc(PRSize size)
 {
     return NS_Alloc(size);
@@ -101,66 +77,21 @@ nsMemoryImpl::Free(void* ptr)
 }
 
 NS_IMETHODIMP
 nsMemoryImpl::HeapMinimize(PRBool aImmediate)
 {
     return FlushMemory(NS_LITERAL_STRING("heap-minimize").get(), aImmediate);
 }
 
-/* this magic number is something greater than 40mb
- * and after all, 40mb should be good enough for any web app
- * unless it's part of an office suite.
- */
-static const int kRequiredMemory = 0x3000000;
-
 NS_IMETHODIMP
 nsMemoryImpl::IsLowMemory(PRBool *result)
 {
-#if defined(WINCE_WINDOWS_MOBILE)
-    MEMORYSTATUS stat;
-    GlobalMemoryStatus(&stat);
-    *result = (stat.dwMemoryLoad >= 98);
-#elif defined(WINCE)
-    // Bug 525323 - GlobalMemoryStatus kills perf on WinCE.
+    NS_ERROR("IsLowMemory is deprecated.  See bug 592308.");
     *result = PR_FALSE;
-#elif defined(XP_WIN)
-    MEMORYSTATUSEX stat;
-    stat.dwLength = sizeof stat;
-    GlobalMemoryStatusEx(&stat);
-    *result = (stat.ullAvailPageFile < kRequiredMemory) &&
-        ((float)stat.ullAvailPageFile / stat.ullTotalPageFile) < 0.1;
-#elif (MOZ_PLATFORM_MAEMO == 5 || MOZ_PLATFORM_MAEMO == 4) && defined(__arm__)
-    static int osso_highmark_fd = -1;
-    if (osso_highmark_fd == -1) {
-        osso_highmark_fd = open (kHighMark, O_RDONLY);
-
-        if (osso_highmark_fd == -1) {
-            NS_ERROR("can't find the osso highmark file");    
-            *result = PR_FALSE;
-            return NS_OK;
-        }
-    }
-
-    // be kind, rewind.
-    lseek(osso_highmark_fd, 0L, SEEK_SET);
-
-    int c = 0;
-    read (osso_highmark_fd, &c, 1);
-
-    *result = (c == '1');
-#else
-    *result = PR_FALSE;
-#endif
-
-#ifdef NOTIFY_LOW_MEMORY
-    if (*result) {
-        sGlobalMemory.FlushMemory(NS_LITERAL_STRING("low-memory").get(), PR_FALSE);
-    }
-#endif
     return NS_OK;
 }
 
 /*static*/ nsresult
 nsMemoryImpl::Create(nsISupports* outer, const nsIID& aIID, void **aResult)
 {
     NS_ENSURE_NO_AGGREGATION(outer);
     return sGlobalMemory.QueryInterface(aIID, aResult);
--- a/xpcom/tests/Makefile.in
+++ b/xpcom/tests/Makefile.in
@@ -68,17 +68,16 @@ endif
 CPPSRCS		= \
 		nsIFileEnumerator.cpp \
 		TestCallTemplates.cpp \
 		TestINIParser.cpp \
 		TestRacingServiceManager.cpp \
 		TestRegistrationOrder.cpp \
 		TestThreadPoolListener.cpp \
 		TestTimers.cpp \
-		TestOOM.cpp \
 		TestBlockingProcess.cpp \
 		TestQuickReturn.cpp \
 		TestArguments.cpp \
 		TestUnicodeArguments.cpp \
 		$(NULL)
 
 ifdef WRAP_STL_INCLUDES
 CPPSRCS += TestSTLWrappers.cpp
deleted file mode 100644
--- a/xpcom/tests/TestOOM.cpp
+++ /dev/null
@@ -1,108 +0,0 @@
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is a simple OOM Test.
- *
- * The Initial Developer of the Original Code is
- * Mozilla Corporation.
- * Portions created by the Initial Developer are Copyright (C) 2008
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *   Doug Turner <dougt@meer.net>
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
-
-#include "nsXPCOM.h"
-#include "nsISupportsUtils.h"
-#include "nsCOMPtr.h"
-#include "nsIMemory.h"
-
-int main(int argc, char **argv)
-{
-  nsCOMPtr<nsIMemory> mem;
-  nsresult rv = NS_GetMemoryManager(getter_AddRefs(mem));
-
-  if (!mem || NS_FAILED(rv))
-  {
-    printf("Could not get the memory manager\n");
-    return -1;
-  }
-
-  // allocation note.  don't use nsIMemory to allocate,
-  // because we want to test the isLowMemory predicate
-  // without regard for the nsIMemory impelmentation (the
-  // implementation might count bytes handed out.  however,
-  // the predicate should work with out having to rely on
-  // that.
-  void *big_alloc = malloc(1024 * 1024 * 16);
-  (void)big_alloc; // Tell compiler we're not using big_alloc, to fix warning
-
-  const int highpower = 500000;
-  
-  char* buffers[highpower];
-  for (int i=0; i<highpower; i++)
-    buffers[i] = nsnull;
-  
-  for (int i=0; i<highpower; i++)
-  {
-    PRBool lowMem = PR_FALSE;
-    size_t s = 4096; //pow(2,i);
-    buffers[i] = (char*) malloc(s);
-    
-    // You have to touch the buffer
-    if (!buffers[i])
-      printf("Could not allocate a buffer of size %lu\n", (unsigned long)s);
-    else
-    {
-      for (size_t j=0; j<s; j++)
-        buffers[i][j] = 'a';
-    }
-   
-    PRIntervalTime start = PR_IntervalNow();
-    mem->IsLowMemory(&lowMem);
-    PRIntervalTime cost = PR_IntervalNow() - start;
-    
-    
-    printf("Total Allocated: %lu. \tLow Memory now?  %s\t Took (%d)\n",
-           (unsigned long)s*i,
-           lowMem ? "Yes" : "No",
-           PR_IntervalToMilliseconds(cost));
-  
-    if (lowMem)
-      break;
-  }
-
-  for(int i=0; i<highpower; i++)
-  {
-    if (buffers[i])
-      free(buffers[i]);
-  }
-  return 0;
-}