LEFT | RIGHT |
1 /* | 1 /* |
2 * This file is part of the Adblock Plus, | 2 * This file is part of the Adblock Plus, |
3 * Copyright (C) 2006-2012 Eyeo GmbH | 3 * Copyright (C) 2006-2012 Eyeo GmbH |
4 * | 4 * |
5 * Adblock Plus is free software: you can redistribute it and/or modify | 5 * Adblock Plus is free software: you can redistribute it and/or modify |
6 * it under the terms of the GNU General Public License version 3 as | 6 * it under the terms of the GNU General Public License version 3 as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
8 * | 8 * |
9 * Adblock Plus is distributed in the hope that it will be useful, | 9 * Adblock Plus is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 711 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
722 */ | 722 */ |
723 enabled: false, | 723 enabled: false, |
724 | 724 |
725 /** | 725 /** |
726 * Checks whether private browsing is enabled for a particular window. | 726 * Checks whether private browsing is enabled for a particular window. |
727 */ | 727 */ |
728 enabledForWindow: function(/**Window*/ wnd) /**Boolean*/ | 728 enabledForWindow: function(/**Window*/ wnd) /**Boolean*/ |
729 { | 729 { |
730 try | 730 try |
731 { | 731 { |
732 let loadContext = wnd.QueryInterface(Ci.nsIInterfaceRequestor) | 732 return wnd.QueryInterface(Ci.nsIInterfaceRequestor) |
733 .getInterface(Ci.nsILoadContext); | 733 .getInterface(Ci.nsILoadContext) |
734 if ("usePrivateBrowsing" in loadContext) | 734 .usePrivateBrowsing; |
735 return loadContext.usePrivateBrowsing; | 735 } |
736 else | 736 catch (e) |
737 return false; // Gecko 12 or below | 737 { |
738 } | 738 // Gecko 19 and below will throw NS_NOINTERFACE, this is expected |
739 catch(e) | 739 if (e.result != Cr.NS_NOINTERFACE) |
740 { | 740 Cu.reportError(e); |
741 Cu.reportError(e); | |
742 return false; | 741 return false; |
743 } | 742 } |
744 }, | 743 }, |
745 | 744 |
746 init: function() | 745 init: function() |
747 { | 746 { |
748 if ("@mozilla.org/privatebrowsing;1" in Cc) | 747 if ("@mozilla.org/privatebrowsing;1" in Cc) |
749 { | 748 { |
750 try | 749 try |
751 { | 750 { |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
873 else if (this.wantObj === false && val) | 872 else if (this.wantObj === false && val) |
874 this.curObj.push(val.replace(/\\\[/g, "[")); | 873 this.curObj.push(val.replace(/\\\[/g, "[")); |
875 } | 874 } |
876 finally | 875 finally |
877 { | 876 { |
878 Filter.knownFilters = origKnownFilters; | 877 Filter.knownFilters = origKnownFilters; |
879 Subscription.knownSubscriptions = origKnownSubscriptions; | 878 Subscription.knownSubscriptions = origKnownSubscriptions; |
880 } | 879 } |
881 } | 880 } |
882 }; | 881 }; |
LEFT | RIGHT |