Skip to content

Commit

Permalink
Merge branch 'jb45654' into 'master'
Browse files Browse the repository at this point in the history
[embedlite-components] Report offline state changes to nsIOService. JB#45654

See merge request mer-core/embedlite-components!98
  • Loading branch information
rainemak committed Nov 17, 2020
2 parents cd8b553 + 13ea58a commit f29fcb5
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 f29fcb5

Please sign in to comment.