Bug 481391 - Image document test in FullZoom._applyPrefToSetting fails for background tabs. r=gavin

This commit is contained in:
Dão Gottwald 2009-03-08 07:42:54 +01:00
parent e0153ce3d1
commit 1fc9615f76
2 changed files with 17 additions and 4 deletions

View File

@ -327,17 +327,19 @@ var FullZoom = {
* one. * one.
**/ **/
_applyPrefToSetting: function FullZoom__applyPrefToSetting(aValue, aBrowser) { _applyPrefToSetting: function FullZoom__applyPrefToSetting(aValue, aBrowser) {
var browser = aBrowser || gBrowser.selectedBrowser;
if (!this.siteSpecific || gInPrintPreviewMode || if (!this.siteSpecific || gInPrintPreviewMode ||
content.document instanceof Ci.nsIImageDocument) browser.contentDocument instanceof Ci.nsIImageDocument)
return; return;
try { try {
if (typeof aValue != "undefined") if (typeof aValue != "undefined")
ZoomManager.setZoomForBrowser(aBrowser || gBrowser, this._ensureValid(aValue)); ZoomManager.setZoomForBrowser(browser, this._ensureValid(aValue));
else if (typeof this.globalValue != "undefined") else if (typeof this.globalValue != "undefined")
ZoomManager.setZoomForBrowser(aBrowser || gBrowser, this.globalValue); ZoomManager.setZoomForBrowser(browser, this.globalValue);
else else
ZoomManager.setZoomForBrowser(aBrowser || gBrowser, 1); ZoomManager.setZoomForBrowser(browser, 1);
} }
catch(ex) {} catch(ex) {}
}, },

View File

@ -1,4 +1,5 @@
var gTestPage = "http://example.org/browser/browser/base/content/test/dummy_page.html"; var gTestPage = "http://example.org/browser/browser/base/content/test/dummy_page.html";
var gTestImage = "http://example.org/browser/browser/base/content/test/moz.png";
var gTab1, gTab2, gTab3; var gTab1, gTab2, gTab3;
var gLevel; var gLevel;
@ -44,13 +45,23 @@ function thirdPageLoaded() {
zoomTest(gTab2, gLevel, "Tab 2 should be zoomed now"); zoomTest(gTab2, gLevel, "Tab 2 should be zoomed now");
zoomTest(gTab3, gLevel, "Tab 3 should still be zoomed"); zoomTest(gTab3, gLevel, "Tab 3 should still be zoomed");
load(gTab1, gTestImage, imageLoaded);
}
function imageLoaded() {
zoomTest(gTab1, 1, "Zoom should be 1 when image was loaded in the background");
gBrowser.selectedTab = gTab1;
zoomTest(gTab1, 1, "Zoom should still be 1 when tab with image is selected");
finishTest(); finishTest();
} }
function finishTest() { function finishTest() {
FullZoom.reset(); FullZoom.reset();
gBrowser.removeTab(gTab1); gBrowser.removeTab(gTab1);
FullZoom.reset();
gBrowser.removeTab(gTab2); gBrowser.removeTab(gTab2);
FullZoom.reset();
gBrowser.removeTab(gTab3); gBrowser.removeTab(gTab3);
finish(); finish();
} }