[Pkg-mozext-commits] [firebug] 33/68: It's better desing to put Cu.import()s at the top of the module (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 707bbf0f78a8034f92de2c1960197f1ffccde3c3
Author: Jan Odvarko <odvarko at gmail.com>
Date:   Fri Mar 29 16:14:53 2013 +0100

    It's better desing to put Cu.import()s at the top of the module (related to issue 6168)
---
 extension/content/firebug/chrome/privacy.js | 19 ++++++++++++-------
 extension/modules/storageService.js         | 14 ++++++++++----
 2 files changed, 22 insertions(+), 11 deletions(-)

diff --git a/extension/content/firebug/chrome/privacy.js b/extension/content/firebug/chrome/privacy.js
index f5720f3..be6e4b9 100644
--- a/extension/content/firebug/chrome/privacy.js
+++ b/extension/content/firebug/chrome/privacy.js
@@ -15,6 +15,14 @@ var Cc = Components.classes;
 var Ci = Components.interfaces;
 var Cu = Components.utils;
 
+try
+{
+    Cu["import"]("resource://gre/modules/PrivateBrowsingUtils.jsm");
+}
+catch (err)
+{
+}
+
 // ********************************************************************************************* //
 
 /**
@@ -80,13 +88,10 @@ var Privacy = Obj.extend(Firebug.Module,
     {
         try
         {
-            // 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
-            // for the top parent window).
-            var win = Firebug.chrome.window;
-            return PrivateBrowsingUtils.isWindowPrivate(win);
+            // First check existence of the new PB API. Get firebugFrame.xul and check
+            // private mode (it's the same as for the top parent window).
+            if (typeof PrivateBrowsingUtils != "undefined")
+                return PrivateBrowsingUtils.isWindowPrivate(Firebug.chrome.window);
         }
         catch (e)
         {
diff --git a/extension/modules/storageService.js b/extension/modules/storageService.js
index 4b69243..da540fa 100644
--- a/extension/modules/storageService.js
+++ b/extension/modules/storageService.js
@@ -18,6 +18,14 @@ Cu.import("resource://gre/modules/FileUtils.jsm");
 
 var wm = Cc["@mozilla.org/appshell/window-mediator;1"].getService(Ci.nsIWindowMediator);
 
+try
+{
+    Cu["import"]("resource://gre/modules/PrivateBrowsingUtils.jsm");
+}
+catch (err)
+{
+}
+
 // ********************************************************************************************* //
 // Implementation
 
@@ -324,12 +332,10 @@ var ObjectPersister =
 
         try
         {
-            // For Fx 22+
-            Cu["import"]("resource://gre/modules/PrivateBrowsingUtils.jsm");
-
             // Get firebugFrame.xul and check privaate mode (it's the same as
             // for the top parent window).
-            return PrivateBrowsingUtils.isWindowPrivate(win);
+            if (typeof PrivateBrowsingUtils != "undefined")
+                return PrivateBrowsingUtils.isWindowPrivate(win);
         }
         catch (e)
         {

-- 
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