[Pkg-mozext-commits] [firebug] 32/68: First check the new PB API (related to issue 6168)

David Prévot taffit at moszumanska.debian.org
Mon Mar 31 22:45:52 UTC 2014


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to tag fbtest-1.11.4
in repository firebug.

commit 3f5ecbee46e7ac7a43d8dfec89856a9788d61ee4
Author: Jan Odvarko <odvarko at gmail.com>
Date:   Fri Mar 29 15:48:12 2013 +0100

    First check the new PB API (related to issue 6168)
---
 extension/content/firebug/chrome/privacy.js | 13 +++++-------
 extension/modules/storageService.js         | 32 ++++++++++++++---------------
 2 files changed, 20 insertions(+), 25 deletions(-)

diff --git a/extension/content/firebug/chrome/privacy.js b/extension/content/firebug/chrome/privacy.js
index eb57042..f5720f3 100644
--- a/extension/content/firebug/chrome/privacy.js
+++ b/extension/content/firebug/chrome/privacy.js
@@ -78,14 +78,9 @@ var Privacy = Obj.extend(Firebug.Module,
 
     isPrivateBrowsing: function()
     {
-        // In case where nsIPrivateBrowsingService still exists and the following
-        // property is properly initialized in update() method (before Fx22)
-        if (typeof this.privateBrowsingEnabled != "undefined")
-            return this.privateBrowsingEnabled;
-
         try
         {
-            // For Fx 22+
+            // First check existence of the new PB API
             Cu["import"]("resource://gre/modules/PrivateBrowsingUtils.jsm");
 
             // Get firebugFrame.xul and check privaate mode (it's the same as
@@ -95,9 +90,11 @@ var Privacy = Obj.extend(Firebug.Module,
         }
         catch (e)
         {
-            if (FBTrace.DBG_ERRORS)
-                FBTrace.sysout("Privacy.isPrivateBrowsing; EXCEPTION " + e, e);
         }
+
+        // OK, use nsIPrivateBrowsingService, it should still exist and the following
+        // property should be properly initialized in update() method
+        return this.privateBrowsingEnabled;
     }
 });
 
diff --git a/extension/modules/storageService.js b/extension/modules/storageService.js
index 3ab4a56..4b69243 100644
--- a/extension/modules/storageService.js
+++ b/extension/modules/storageService.js
@@ -311,21 +311,6 @@ var ObjectPersister =
     {
         try
         {
-            // Unfortunatelly the "firebug/chrome/privacy" module can't be used
-            // since this scope is JavaScript code module.
-            // xxxHonza: storageService should be converted into AMD (but it's used
-            // in firebug-service.js, which is also JS code module).
-            // firebug-service.js is gone in JSD2 branch
-            var pbs = Components.classes["@mozilla.org/privatebrowsing;1"]
-                .getService(Components.interfaces.nsIPrivateBrowsingService);
-            return pbs.privateBrowsingEnabled;
-        }
-        catch (e)
-        {
-        }
-
-        try
-        {
             // If |win| is null, the top most window is used to figure out
             // whether the private mode is on or off.
             if (!win)
@@ -348,8 +333,21 @@ var ObjectPersister =
         }
         catch (e)
         {
-            if (FBTrace.DBG_ERRORS)
-                FBTrace.sysout("storageService.isPrivateBrowsing; EXCEPTION " + e, e);
+        }
+
+        try
+        {
+            // Unfortunatelly the "firebug/chrome/privacy" module can't be used
+            // since this scope is JavaScript code module.
+            // xxxHonza: storageService should be converted into AMD (but it's used
+            // in firebug-service.js, which is also JS code module).
+            // firebug-service.js is gone in JSD2 branch
+            var pbs = Components.classes["@mozilla.org/privatebrowsing;1"]
+                .getService(Components.interfaces.nsIPrivateBrowsingService);
+            return pbs.privateBrowsingEnabled;
+        }
+        catch (e)
+        {
         }
 
         return false;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/firebug.git



More information about the Pkg-mozext-commits mailing list