Bug 672146 - Ensure that valid arguments are passed to Zoom Manager when 100% is not within the allowed min-max range r=neil a=iann_bugzilla for comm-aurora
authorrsx11m <rsx11m.pub@gmail.com>
Tue, 26 Jul 2011 12:50:21 +0100
changeset 8307 5129a00ec84c5622f29d7704db9476eb2e690950
parent 8306 1e274c1f9e3bd7631cbeb6ffca1876995f773a58
child 8308 9315a92a8dc24aeaaac8466a3be770e617492232
push id84
push userbugzilla@standard8.plus.com
push dateTue, 16 Aug 2011 21:25:04 +0000
treeherdercomm-beta@6970c86be3cd [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersneil, iann_bugzilla
bugs672146
Bug 672146 - Ensure that valid arguments are passed to Zoom Manager when 100% is not within the allowed min-max range r=neil a=iann_bugzilla for comm-aurora
suite/common/viewZoomOverlay.js
--- a/suite/common/viewZoomOverlay.js
+++ b/suite/common/viewZoomOverlay.js
@@ -271,17 +271,17 @@ var FullZoom = {
     ZoomManager.zoom = aZoomValue;
     this._applySettingToPref();
   },
 
   reset: function FullZoom_reset() {
     if (typeof this.globalValue != "undefined")
       ZoomManager.zoom = this.globalValue;
     else
-      ZoomManager.reset();
+      ZoomManager.zoom = this._ensureValid(1);
 
     this._removePref();
   },
 
   /**
    * Set the zoom level for the current tab.
    *
    * Per nsPresContext::setFullZoom, we can set the zoom to its current value
@@ -302,23 +302,23 @@ var FullZoom = {
    **/
   _applyPrefToSetting: function FullZoom_applyPrefToSetting(aValue, aBrowser) {
     if (!this.siteSpecific || window.gInPrintPreviewMode)
       return;
 
     var browser = aBrowser || (getBrowser() && getBrowser().selectedBrowser);
     try {
       if (browser.contentDocument instanceof Components.interfaces.nsIImageDocument)
-        ZoomManager.setZoomForBrowser(browser, 1);
+        ZoomManager.setZoomForBrowser(browser, this._ensureValid(1));
       else if (typeof aValue != "undefined")
         ZoomManager.setZoomForBrowser(browser, this._ensureValid(aValue));
       else if (typeof this.globalValue != "undefined")
         ZoomManager.setZoomForBrowser(browser, this.globalValue);
       else
-        ZoomManager.setZoomForBrowser(browser, 1);
+        ZoomManager.setZoomForBrowser(browser, this._ensureValid(1));
     }
     catch(ex) {}
   },
 
   _applySettingToPref: function FullZoom_applySettingToPref() {
     if (!this.siteSpecific || window.gInPrintPreviewMode ||
         content.document instanceof Components.interfaces.nsIImageDocument)
       return;
@@ -333,17 +333,17 @@ var FullZoom = {
   },
 
 
   //**************************************************************************//
   // Utilities
 
   _ensureValid: function FullZoom_ensureValid(aValue) {
     if (isNaN(aValue))
-      return 1;
+      aValue = 1;
 
     if (aValue < ZoomManager.MIN)
       return ZoomManager.MIN;
 
     if (aValue > ZoomManager.MAX)
       return ZoomManager.MAX;
 
     return aValue;