[Pkg-mozext-commits] [wot] 81/226: fixes #27 Private browsing changes may break the add-on
David Prévot
taffit at moszumanska.debian.org
Fri May 1 00:35:36 UTC 2015
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository wot.
commit 454387ee5ca227b197ec701de3347de9ae4f1802
Author: Sergey Andryukhin <sorgoz at yandex.com>
Date: Wed May 15 14:57:54 2013 +0300
fixes #27 Private browsing changes may break the add-on
---
content/util.js | 23 +++++++++++++++++------
1 file changed, 17 insertions(+), 6 deletions(-)
diff --git a/content/util.js b/content/util.js
index 11e5a0a..333037d 100644
--- a/content/util.js
+++ b/content/util.js
@@ -306,13 +306,24 @@ var wot_browser =
isprivatemode: function()
{
- try {
- var pbs = Components.classes["@mozilla.org/privatebrowsing;1"]
- .getService(Components.interfaces.nsIPrivateBrowsingService);
- return pbs.privateBrowsingEnabled;
- } catch (e) {
- }
+ try {
+ // Firefox 20
+ var win = getBrowser().contentDocument.defaultView;
+ Components.utils.import("resource://gre/modules/PrivateBrowsingUtils.jsm");
+ return PrivateBrowsingUtils.isWindowPrivate(win);
+
+ } catch(e) {
+ // pre Firefox 20 (if you do not have access to a doc.
+ // might use doc.hasAttribute("privatebrowsingmode") then instead)
+ try {
+ var pbs = Cc["@mozilla.org/privatebrowsing;1"].
+ getService(Ci.nsIPrivateBrowsingService);
+ return pbs.privateBrowsingEnabled;
+ } catch(e) {
+ Cu.reportError(e); return;
+ }
+ }
return false;
},
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/wot.git
More information about the Pkg-mozext-commits
mailing list