Bug 1649450 - Optimistically run heuristics immediately upon network-up. r=valentin

Differential Revision: https://phabricator.services.mozilla.com/D81707
This commit is contained in:
Nihanth Subramanya 2020-06-30 16:45:28 +00:00
Родитель 35d83dbe5a
Коммит b507e85bad
2 изменённых файлов: 9 добавлений и 8 удалений

Просмотреть файл

@ -404,20 +404,22 @@ const rollout = {
return;
}
// The network is up. If we know we are not captive or in an unlocked portal,
// run heuristics. If we detect a portal later, we'll run heuristics again
// when it's unlocked.
if (captiveState == "unlocked_portal" || captiveState == "not_captive") {
await rollout.heuristics("netchange");
if (captiveState == "locked_portal") {
return;
}
// The network is up and we don't know that we're in a locked portal.
// Run heuristics. When we detect a portal or lack thereof later, we'll run
// heuristics again. In that case, this run will likely have failed.
await rollout.heuristics("netchange");
},
async onCaptiveStateChanged({ state }) {
log("onCaptiveStateChanged", state);
// unlocked_portal means we were previously in a locked portal and then
// network access was granted.
// network access was granted. not_captive means we know there's no portal.
if (state == "unlocked_portal" || state == "not_captive") {
await rollout.heuristics("netchange");
await rollout.heuristics("captivechanged");
}
},
};

Просмотреть файл

@ -288,7 +288,6 @@ function simulateNetworkChange() {
// TODO: Implement a mock NetworkLinkService and use it to also simulate
// network down events.
Services.obs.notifyObservers(null, "network:link-status-changed", "up");
Services.obs.notifyObservers(null, "captive-portal-login-success");
}
async function ensureTRRMode(mode) {