distinguish between XUL and Firefox when excluding XUL code from webstaff
authorGalen Charlton <gmc@equinoxinitiative.org>
Tue, 7 Feb 2017 17:32:05 +0000 (12:32 -0500)
committerKathy Lussier <klussier@masslnc.org>
Sat, 18 Feb 2017 18:31:31 +0000 (13:31 -0500)
Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>
Signed-off-by: Kathy Lussier <klussier@masslnc.org>
Open-ILS/web/js/dojo/openils/XUL.js

index 459681f..47021d2 100644 (file)
@@ -4,11 +4,16 @@ if(!dojo._hasResource["openils.XUL"]) {
     dojo.declare('openils.XUL', null, {});
 
     openils.XUL.Component_copy;
-    try {
-        openils.XUL.Component_copy = Components;
-    } catch (e) {
-        openils.XUL.Component_copy = null;
-    };
+    if (!window.IAMBROWSER) {
+        // looks like Firefox also exposes 'Components', so its
+        // existence is not sufficient check of XUL-ness
+        try {
+            if (Components.classes)
+                openils.XUL.Component_copy = Components;
+        } catch (e) {
+            openils.XUL.Component_copy = null;
+        };
+    }
 
     openils.XUL.isXUL = function() {
         if(location.protocol == 'chrome:' || location.protocol == 'oils:') return true;