Bug 1121052 - Reset the zoom level for crashed tab pages.

This commit is contained in:
Blake Kaplan 2015-09-11 11:21:14 +05:30
parent fc54b99038
commit 113dd9e919
2 changed files with 35 additions and 1 deletions

View File

@ -1135,11 +1135,15 @@ var gBrowserInit = {
});
gBrowser.addEventListener("AboutTabCrashedLoad", function(event) {
let browser = gBrowser.getBrowserForDocument(event.target);
#ifdef MOZ_CRASHREPORTER
TabCrashReporter.onAboutTabCrashedLoad(gBrowser.getBrowserForDocument(event.target), {
TabCrashReporter.onAboutTabCrashedLoad(browser, {
crashedTabCount: SessionStore.crashedTabCount,
});
#endif
// Reset the zoom for the tabcrashed page.
ZoomManager.setZoomForBrowser(browser, 1);
}, false, true);
gBrowser.addEventListener("AboutTabCrashedMessage", function(event) {

View File

@ -387,3 +387,33 @@ add_task(function* test_hide_restore_all_button() {
gBrowser.removeTab(newTab);
gBrowser.removeTab(newTab2);
});
add_task(function* test_aboutcrashedtabzoom() {
let newTab = gBrowser.addTab();
gBrowser.selectedTab = newTab;
let browser = newTab.linkedBrowser;
ok(browser.isRemoteBrowser, "Should be a remote browser");
yield promiseBrowserLoaded(browser);
browser.loadURI(PAGE_1);
yield promiseBrowserLoaded(browser);
FullZoom.enlarge();
let zoomLevel = ZoomManager.getZoomForBrowser(browser);
ok(zoomLevel !== 1, "should have enlarged");
yield TabStateFlusher.flush(browser);
// Crash the tab
yield crashBrowser(browser);
ok(ZoomManager.getZoomForBrowser(browser) === 1, "zoom should have reset on crash");
clickButton(browser, "restoreTab");
yield promiseTabRestored(newTab);
ok(ZoomManager.getZoomForBrowser(browser) === zoomLevel, "zoom should have gone back to enlarged");
FullZoom.reset();
gBrowser.removeTab(newTab);
});