зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1724108 - switched browser_trigger_listeners to new vpn promo event, r=andreio
Differential Revision: https://phabricator.services.mozilla.com/D122064
This commit is contained in:
Родитель
7a27adb89c
Коммит
2575056f16
|
@ -595,7 +595,10 @@ this.ASRouterTriggerListeners = new Map([
|
|||
|
||||
init(triggerHandler) {
|
||||
if (!this._initialized) {
|
||||
Services.obs.addObserver(this, "captive-portal-login-success");
|
||||
Services.obs.addObserver(
|
||||
this,
|
||||
"captive-portal-login-success-after-button-pressed"
|
||||
);
|
||||
this._initialized = true;
|
||||
}
|
||||
this._triggerHandler = triggerHandler;
|
||||
|
@ -603,7 +606,7 @@ this.ASRouterTriggerListeners = new Map([
|
|||
|
||||
observe(aSubject, aTopic, aData) {
|
||||
switch (aTopic) {
|
||||
case "captive-portal-login-success":
|
||||
case "captive-portal-login-success-after-button-pressed":
|
||||
const browser = Services.wm.getMostRecentBrowserWindow();
|
||||
if (browser) {
|
||||
this._triggerHandler(browser.gBrowser.selectedBrowser, {
|
||||
|
@ -618,7 +621,10 @@ this.ASRouterTriggerListeners = new Map([
|
|||
if (this._initialized) {
|
||||
this._triggerHandler = null;
|
||||
this._initialized = false;
|
||||
Services.obs.removeObserver(this, "captive-portal-login-success");
|
||||
Services.obs.removeObserver(
|
||||
this,
|
||||
"captive-portal-login-success-after-button-pressed"
|
||||
);
|
||||
}
|
||||
},
|
||||
},
|
||||
|
|
|
@ -72,13 +72,21 @@ add_task(async function test_captivePortalLogin() {
|
|||
|
||||
captivePortalTrigger.init(stub);
|
||||
|
||||
Services.obs.notifyObservers(this, "captive-portal-login-success", {});
|
||||
Services.obs.notifyObservers(
|
||||
this,
|
||||
"captive-portal-login-success-after-button-pressed",
|
||||
{}
|
||||
);
|
||||
|
||||
Assert.ok(stub.called, "Called after login event");
|
||||
Assert.ok(stub.called, "Called after button press and login");
|
||||
|
||||
captivePortalTrigger.uninit();
|
||||
|
||||
Services.obs.notifyObservers(this, "captive-portal-login-success", {});
|
||||
Services.obs.notifyObservers(
|
||||
this,
|
||||
"captive-portal-login-success-after-button-pressed",
|
||||
{}
|
||||
);
|
||||
|
||||
Assert.equal(stub.callCount, 1, "Not called after uninit");
|
||||
});
|
||||
|
|
Загрузка…
Ссылка в новой задаче