Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[embedlite-components] Report offline state changes to nsIOService. J…
…B#45654
  • Loading branch information
rainemak committed Nov 17, 2020
1 parent cd8b553 commit 13ea58a
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions jscomps/EmbedLiteChromeManager.js
Expand Up @@ -105,6 +105,7 @@ EmbedLiteChromeManager.prototype = {
_initialize() {
// Use "embedliteviewcreated" instead of "domwindowopened".
Services.obs.addObserver(this, "embedliteviewcreated", true);
Services.obs.addObserver(this, "embed-network-link-status", true)
Services.obs.addObserver(this, "domwindowclosed", true);
Services.obs.addObserver(this, "xpcom-shutdown", false);
},
Expand Down Expand Up @@ -151,6 +152,13 @@ EmbedLiteChromeManager.prototype = {
case "domwindowclosed":
self.onWindowClosed(aSubject);
break;
case "embed-network-link-status":
let network = JSON.parse(aData);
Services.io.manageOfflineStatus = true;
Services.io.offline = network.offline;
Services.obs.notifyObservers(null, "network:link-status-changed",
network.offline ? "down" : "up");
break;
default:
Logger.debug("EmbedLiteChromeManager subject", aSubject, "topic:", aTopic);
}
Expand Down

0 comments on commit 13ea58a

Please sign in to comment.