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
--- 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;