Bug 851845 - Intermittent (NS_ERROR_NOT_AVAILABLE) [nsIDOMWindowUtils.getScrollbarSize]; r=jaws
authorTim Taubert <ttaubert@mozilla.com>
Thu, 21 Mar 2013 09:23:02 +0100
changeset 125737 2dff2dde9ce8be429d22dcbe0776ea7c6e41e9fa
parent 125736 f6e7195e87dbf93f65e36b0214f9ff15c65474ed
child 125738 4caaa0bc587dbaa2b718ba9c50be46688746404e
push id25087
push usereakhgari@mozilla.com
push dateThu, 21 Mar 2013 12:27:40 +0000
treeherdermozilla-inbound@be6da6dbf632 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjaws
bugs851845
milestone22.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
Bug 851845 - Intermittent (NS_ERROR_NOT_AVAILABLE) [nsIDOMWindowUtils.getScrollbarSize]; r=jaws
toolkit/components/thumbnails/PageThumbs.jsm
--- a/toolkit/components/thumbnails/PageThumbs.jsm
+++ b/toolkit/components/thumbnails/PageThumbs.jsm
@@ -239,17 +239,24 @@ this.PageThumbs = {
    * @param aWindow The content window.
    * @param aCanvas The target canvas.
    * @return An array containing width, height and scale.
    */
   _determineCropSize: function PageThumbs_determineCropSize(aWindow, aCanvas) {
     let utils = aWindow.QueryInterface(Ci.nsIInterfaceRequestor)
                        .getInterface(Ci.nsIDOMWindowUtils);
     let sbWidth = {}, sbHeight = {};
-    utils.getScrollbarSize(false, sbWidth, sbHeight);
+
+    try {
+      utils.getScrollbarSize(false, sbWidth, sbHeight);
+    } catch (e) {
+      // This might fail if the window does not have a presShell.
+      Cu.reportError("Unable to get scrollbar size in _determineCropSize.");
+      sbWidth.value = sbHeight.value = 0;
+    }
 
     // Even in RTL mode, scrollbars are always on the right.
     // So there's no need to determine a left offset.
     let sw = aWindow.innerWidth - sbWidth.value;
     let sh = aWindow.innerHeight - sbHeight.value;
 
     let {width: thumbnailWidth, height: thumbnailHeight} = aCanvas;
     let scale = Math.min(Math.max(thumbnailWidth / sw, thumbnailHeight / sh), 1);