Skip to content

Commit

Permalink
Optimize isTargetWindow(): check only location.href
Browse files Browse the repository at this point in the history
(related to #116 and removes no longer needed fix for #61)
  • Loading branch information
Infocatcher committed Nov 9, 2013
1 parent 864c11e commit 5b258b7
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions bootstrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -464,14 +464,13 @@ var windowsObserver = {
return windows;
},
isTargetWindow: function(window) {
var document = window.document;
var rs = document.readyState;
// We can't touch document.documentElement in not yet loaded window!
// See https://github.com/Infocatcher/Private_Tab/issues/61
if(rs != "interactive" && rs != "complete")
return false;
return document.documentElement.getAttribute("windowtype") == "navigator:browser"
|| window.location.href == "chrome://navigator/content/navigator.xul"; // SeaMonkey >= 2.19a1 (2013-03-27)
// Note: we can't touch document.documentElement in not yet loaded window
// (to check "windowtype"), see https://github.com/Infocatcher/Private_Tab/issues/61
// Also we don't have "windowtype" for private windows in SeaMonkey 2.19+,
// see https://github.com/Infocatcher/Private_Tab/issues/116
var loc = window.location.href;
return loc == "chrome://browser/content/browser.xul"
|| loc == "chrome://navigator/content/navigator.xul";
},
isViewSourceWindow: function(window) {
return window.location.href == "chrome://global/content/viewSource.xul";
Expand Down

0 comments on commit 5b258b7

Please sign in to comment.