[Australis] Bug 956285: update zoom controls percentage label upon navigation. r=Gijs

This commit is contained in:
Mike de Boer 2014-01-20 11:25:00 +01:00
parent a848b04d5c
commit 6a58b4476b
4 changed files with 10 additions and 8 deletions

View File

@ -510,14 +510,14 @@ var FullZoom = {
},
/**
* Asynchronously broadcasts "FullZoom:TESTS:location-change" so that tests
* can select tabs, load pages, etc. and be notified when the zoom levels on
* those pages change. The notification is always asynchronous so that
* observers are guaranteed a consistent behavior.
* Asynchronously broadcasts "browser-fullZoom:location-change" so that
* listeners can be notified when the zoom levels on those pages change.
* The notification is always asynchronous so that observers are guaranteed a
* consistent behavior.
*/
_notifyOnLocationChange: function FullZoom__notifyOnLocationChange() {
this._executeSoon(function () {
Services.obs.notifyObservers(null, "FullZoom:TESTS:location-change", "");
Services.obs.notifyObservers(null, "browser-fullZoom:location-change", "");
});
},

View File

@ -317,7 +317,7 @@ let FullZoomHelper = {
Services.obs.addObserver(function obs(subj, topic, data) {
Services.obs.removeObserver(obs, topic);
deferred.resolve();
}, "FullZoom:TESTS:location-change", false);
}, "browser-fullZoom:location-change", false);
return deferred.promise;
},

View File

@ -376,6 +376,7 @@ const CustomizableWidgets = [{
// Register ourselves with the service so we know when the zoom prefs change.
Services.obs.addObserver(updateZoomResetButton, "browser-fullZoom:zoomChange", false);
Services.obs.addObserver(updateZoomResetButton, "browser-fullZoom:zoomReset", false);
Services.obs.addObserver(updateZoomResetButton, "browser-fullZoom:location-change", false);
if (inPanel) {
let panel = aDocument.getElementById(kPanelId);
@ -446,6 +447,7 @@ const CustomizableWidgets = [{
CustomizableUI.removeListener(listener);
Services.obs.removeObserver(updateZoomResetButton, "browser-fullZoom:zoomChange");
Services.obs.removeObserver(updateZoomResetButton, "browser-fullZoom:zoomReset");
Services.obs.removeObserver(updateZoomResetButton, "browser-fullZoom:location-change");
let panel = aDoc.getElementById(kPanelId);
panel.removeEventListener("popupshowing", updateZoomResetButton);
let container = aDoc.defaultView.gBrowser.tabContainer;

View File

@ -14,7 +14,7 @@ function test() {
function doTestWhenReady(aIsZoomedWindow, aWindow, aCallback) {
// Need to wait on two things, the ordering of which is not guaranteed:
// (1) the page load, and (2) FullZoom's update to the new page's zoom
// level. FullZoom broadcasts "FullZoom:TESTS:location-change" when its
// level. FullZoom broadcasts "browser-fullZoom:location-change" when its
// update is done. (See bug 856366 for details.)
let n = 0;
@ -30,7 +30,7 @@ function test() {
Services.obs.removeObserver(onLocationChange, topic);
if (++n == 2)
doTest(aIsZoomedWindow, aWindow, aCallback);
}, "FullZoom:TESTS:location-change", false);
}, "browser-fullZoom:location-change", false);
browser.loadURI("about:blank");
}