Skip to content

Commit

Permalink
Correctly reload styles, if opened only private windows in SeaMonkey
Browse files Browse the repository at this point in the history
  • Loading branch information
Infocatcher committed Nov 9, 2013
1 parent ffb4bdf commit 25081c3
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions bootstrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,20 @@ var windowsObserver = {
}
return windows;
},
getMostRecentBrowserWindow: function() {
var window = Services.wm.getMostRecentWindow("navigator:browser");
if(window)
return window;
if(this.isSeaMonkey) {
var ws = Services.wm.getEnumerator(null);
while(ws.hasMoreElements()) {
window = ws.getNext();
if(this.isTargetWindow(window))
return window;
}
}
return null;
},
isTargetWindow: function(window) {
// Note: we can't touch document.documentElement in not yet loaded window
// (to check "windowtype"), see https://github.com/Infocatcher/Private_Tab/issues/61
Expand Down Expand Up @@ -3086,9 +3100,8 @@ var windowsObserver = {
sss.unregisterSheet(this.cssURI, sss.USER_SHEET);
},
reloadStyles: function(window) {
window = window
|| Services.wm.getMostRecentWindow("navigator:browser")
|| Services.wm.getMostRecentWindow("navigator:private"); // SeaMonkey >= 2.19a1 (2013-03-27)
if(!window)
window = this.getMostRecentBrowserWindow();
this.unloadStyles();
if(window)
this.loadStyles(window);
Expand Down

0 comments on commit 25081c3

Please sign in to comment.