Bug 602420 - getPageZoomLevel should not return Infinity [r=mfinkle]
authorMatt Brubeck <mbrubeck@mozilla.com>
Fri, 08 Oct 2010 14:38:26 -0700
changeset 2175 04dbed7f2854
parent 2174 624d369d9020
child 2176 604c4cbfc091
push id1831
push usermbrubeck@mozilla.com
push date2010-10-08 21:38 +0000
reviewersmfinkle
bugs602420
Bug 602420 - getPageZoomLevel should not return Infinity [r=mfinkle]
chrome/content/browser.js
--- a/chrome/content/browser.js
+++ b/chrome/content/browser.js
@@ -2548,16 +2548,19 @@ Tab.prototype = {
     if (threshold < pageZoom && pageZoom < 1)
       pageZoom = 1;
 
     return this.clampZoomLevel(pageZoom);
   },
 
   getPageZoomLevel: function getPageZoomLevel() {
     let browserW = this._browser.contentDocumentWidth;
+    if (browserW == 0)
+      return 1.0;
+
     return this._browser.getBoundingClientRect().width / browserW;
   },
 
   get allowZoom() {
     return this.metadata.allowZoom;
   },
 
   updateThumbnail: function updateThumbnail() {