Bug 897410 - don't call into the zoom manager if we don't (yet) have a docshell, r=mikedeboer

This commit is contained in:
Gijs Kruitbosch 2013-07-24 15:29:29 +02:00
parent de1150b579
commit e8483bc04f

View File

@ -327,8 +327,14 @@ const CustomizableWidgets = [{
let zoomResetButton = node.childNodes[1];
let window = aDocument.defaultView;
function updateZoomResetButton() {
//XXXgijs in some tests we get called very early, and there's no docShell on the
// tabbrowser. This breaks the zoom toolkit code (see bug 897410). Don't let that happen:
let zoomFactor = 100;
if (window.gBrowser.docShell) {
zoomFactor = Math.floor(window.ZoomManager.zoom * 100);
}
zoomResetButton.setAttribute("label", CustomizableUI.getLocalizedProperty(
buttons[1], "label", [Math.floor(window.ZoomManager.zoom * 100)]
buttons[1], "label", [zoomFactor]
));
};