Permalink
Browse files

Workaround to save window position with disabled e10s

  • Loading branch information...
Infocatcher committed Feb 13, 2018
1 parent 266b78f commit 15132aabbeeced1352446eaefa29725af09cbc97
Showing with 20 additions and 2 deletions.
  1. +9 −0 background.js
  2. +11 −2 properties.js
View
@@ -30,6 +30,15 @@ browser.browserAction.onClicked.addListener(function() {
// _log("commands.onCommand: " + command);
//});
var broadcastChannel = new BroadcastChannel("LPP:windowPosition");
broadcastChannel.onmessage = function(msg) {
_log("Save window position using BroadcastChannel");
browser.storage.local.set(msg.data);
};
addEventListener("unload", function() {
broadcastChannel.close();
}, { once: true });
function openLinkProperties(url, ref, sourceTab, autoStart) {
var p = prefs.windowPosition || {};
var url = getPropertiesURL(url, ref, autoStart);
View
@@ -57,14 +57,23 @@ browser.windows.getCurrent().then(function(win) {
});
addEventListener("beforeunload", function() { // Note: can't save on unload
browser.storage.local.set({
var storageData = {
windowPosition: {
x: screenX,
y: screenY,
w: outerWidth,
h: outerHeight
}
});
};
// Workaround to save state with disabled e10s mode
var broadcastChannel = new BroadcastChannel("LPP:windowPosition");
broadcastChannel.postMessage(storageData);
broadcastChannel.close();
browser.storage.local.set(storageData).then(function() {
_log("Save window position using direct browser.storage.local.set() call");
}, _err);
}, { once: true });
});

0 comments on commit 15132aa

Please sign in to comment.