[Pkg-mozext-commits] [requestpolicy] 190/280: catch exceptions when adding tree elements

David Prévot taffit at moszumanska.debian.org
Sat May 2 20:30:23 UTC 2015


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

taffit pushed a commit to branch master
in repository requestpolicy.

commit cdb511dfccdc702ec7a740c2f97dbfed43ff4f5e
Author: Martin Kimmerle <dev at 256k.de>
Date:   Tue Jan 27 11:41:18 2015 +0100

    catch exceptions when adding tree elements
---
 src/content/lib/utils/xul.jsm       | 9 +++++++--
 src/content/main/window-manager.jsm | 2 +-
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/src/content/lib/utils/xul.jsm b/src/content/lib/utils/xul.jsm
index 1b08075..c239e79 100644
--- a/src/content/lib/utils/xul.jsm
+++ b/src/content/lib/utils/xul.jsm
@@ -99,8 +99,8 @@ function setAttributes(node, element) {
 }
 
 
-function recursivelyAddXULElements(doc, elements, parentElement) {
-  let parentElementIsSet = parentElement ? true : false;
+function recursivelyAddXULElements(doc, elements, parentElement=null) {
+  let parentElementIsSet = !!parentElement;
 
   for (let i in elements) {
     let element = elements[i];
@@ -113,6 +113,11 @@ function recursivelyAddXULElements(doc, elements, parentElement) {
     if (false === parentElement) {
       continue;
     }
+    if (parentElement === null) {
+      Logger.warning(Logger.TYPE_ERROR,
+                     "parentElement of '"+element.id+"' is null!");
+      continue;
+    }
 
     let newElem = doc.createElement(element.tag);
     setAttributes(newElem, element);
diff --git a/src/content/main/window-manager.jsm b/src/content/main/window-manager.jsm
index db7c6d5..86ff46e 100644
--- a/src/content/main/window-manager.jsm
+++ b/src/content/main/window-manager.jsm
@@ -66,7 +66,7 @@ let rpWindowManager = (function(self) {
       XULUtils.addTreeElementsToWindow(window, "mainTree");
     } catch (e) {
       Logger.warning(Logger.TYPE_ERROR,
-                     "Couldn't add tree elements to window.");
+                     "Couldn't add tree elements to window. " + e, e);
     }
 
 

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



More information about the Pkg-mozext-commits mailing list