error checking
authorphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 9 Dec 2005 19:11:02 +0000 (19:11 +0000)
committerphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 9 Dec 2005 19:11:02 +0000 (19:11 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@2310 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/xul/staff_client/server/cat/opac.js

index 3d73bf7..63c0a6d 100644 (file)
@@ -3,99 +3,113 @@ dump('entering cat.opac.js\n');
 if (typeof patron == 'undefined') patron = {};
 cat.opac = function (params) {
 
-       netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
-       JSAN.use('util.error'); this.error = new util.error();
+       try {
+               netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
+               JSAN.use('util.error'); this.error = new util.error();
+       } catch(E) {
+               dump('cat.opac: ' + E + '\n');
+       }
 }
 
 cat.opac.prototype = {
 
        'init' : function( params ) {
 
-               netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
+               try {
+                       netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
 
-               var obj = this;
+                       var obj = this;
 
-               obj.session = params['session'];
-               obj.url = params['url'];
+                       obj.session = params['session'];
+                       obj.url = params['url'];
 
-               JSAN.use('main.controller'); obj.controller = new main.controller();
-               obj.controller.init(
-                       {
-                               control_map : {
-                                       'cmd_broken' : [
-                                               ['command'],
-                                               function() { alert('Not Yet Implemented'); }
-                                       ],
+                       JSAN.use('main.controller'); obj.controller = new main.controller();
+                       obj.controller.init(
+                               {
+                                       control_map : {
+                                               'cmd_broken' : [
+                                                       ['command'],
+                                                       function() { alert('Not Yet Implemented'); }
+                                               ],
+                                       }
                                }
-                       }
-               );
-               obj.controller.view.opac_browser = document.getElementById('opac_browser');
+                       );
+                       obj.controller.view.opac_browser = document.getElementById('opac_browser');
 
-               obj.buildProgressListener();
-               obj.controller.view.opac_browser.addProgressListener(obj.progressListener,
-                               Components.interfaces.nsIWebProgress.NOTIFY_ALL );
+                       obj.buildProgressListener();
+                       obj.controller.view.opac_browser.addProgressListener(obj.progressListener,
+                                       Components.interfaces.nsIWebProgress.NOTIFY_ALL );
 
-               obj.controller.view.opac_browser.setAttribute('src',obj.url);
+                       obj.controller.view.opac_browser.setAttribute('src',obj.url);
 
+               } catch(E) {
+                       this.error.sdump('D_ERROR','cat.opac.init: ' + E + '\n');
+               }
        },
 
        'push_variables' : function() {
 
-               netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
-
-               obj.controller.view.opac_browser.contentWindow.IAMXUL = true;
-
-               if (window.xulG) obj.controller.view.opac_browser.contentWindow.xulG = xulG;
+               try {
+                       netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
+                       obj.controller.view.opac_browser.contentWindow.IAMXUL = true;
+                       if (window.xulG) obj.controller.view.opac_browser.contentWindow.xulG = xulG;
+               } catch(E) {
+                       this.error.sdump('D_ERROR','cat.opac.push_variables: ' + E + '\n');
+               }
        },
        
        'buildProgressListener' : function() {
 
-               netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
-
-               var obj = this;
-               obj.progressListener = {
-                       onProgressChange        : function(){},
-                       onLocationChange        : function(){},
-                       onStatusChange          : function(){},
-                       onSecurityChange        : function(){},
-                       onStateChange           : function ( webProgress, request, stateFlags, status) {
-                               var s = '';
-                               const nsIWebProgressListener = Components.interfaces.nsIWebProgressListener;
-                               const nsIChannel = Components.interfaces.nsIChannel;
-                               if (stateFlags == 65540 || stateFlags == 65537 || stateFlags == 65552) { return; }
-                               s = ('onStateChange: stateFlags = ' + stateFlags + ' status = ' + status + '\n');
-                               if (stateFlags & nsIWebProgressListener.STATE_IS_REQUEST) {
-                                       s += ('\tSTATE_IS_REQUEST\n');
-                               }
-                               if (stateFlags & nsIWebProgressListener.STATE_IS_DOCUMENT) {
-                                       s += ('\tSTATE_IS_DOCUMENT\n');
-                                       if( stateFlags & nsIWebProgressListener.STATE_STOP ) obj.push_variables(); 
-                               }
-                               if (stateFlags & nsIWebProgressListener.STATE_IS_NETWORK) {
-                                       s += ('\tSTATE_IS_NETWORK\n');
-                               }
-                               if (stateFlags & nsIWebProgressListener.STATE_IS_WINDOW) {
-                                       s += ('\tSTATE_IS_WINDOW\n');
-                               }
-                               if (stateFlags & nsIWebProgressListener.STATE_START) {
-                                       s += ('\tSTATE_START\n');
-                               }
-                               if (stateFlags & nsIWebProgressListener.STATE_REDIRECTING) {
-                                       s += ('\tSTATE_REDIRECTING\n');
-                               }
-                               if (stateFlags & nsIWebProgressListener.STATE_TRANSFERING) {
-                                       s += ('\tSTATE_TRANSFERING\n');
-                               }
-                               if (stateFlags & nsIWebProgressListener.STATE_NEGOTIATING) {
-                                       s += ('\tSTATE_NEGOTIATING\n');
-                               }
-                               if (stateFlags & nsIWebProgressListener.STATE_STOP) {
-                                       s += ('\tSTATE_STOP\n');
+               try {
+                       netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
+
+                       var obj = this;
+                       obj.progressListener = {
+                               onProgressChange        : function(){},
+                               onLocationChange        : function(){},
+                               onStatusChange          : function(){},
+                               onSecurityChange        : function(){},
+                               onStateChange           : function ( webProgress, request, stateFlags, status) {
+                                       var s = '';
+                                       const nsIWebProgressListener = Components.interfaces.nsIWebProgressListener;
+                                       const nsIChannel = Components.interfaces.nsIChannel;
+                                       if (stateFlags == 65540 || stateFlags == 65537 || stateFlags == 65552) { return; }
+                                       s = ('onStateChange: stateFlags = ' + stateFlags + ' status = ' + status + '\n');
+                                       if (stateFlags & nsIWebProgressListener.STATE_IS_REQUEST) {
+                                               s += ('\tSTATE_IS_REQUEST\n');
+                                       }
+                                       if (stateFlags & nsIWebProgressListener.STATE_IS_DOCUMENT) {
+                                               s += ('\tSTATE_IS_DOCUMENT\n');
+                                               if( stateFlags & nsIWebProgressListener.STATE_STOP ) obj.push_variables(); 
+                                       }
+                                       if (stateFlags & nsIWebProgressListener.STATE_IS_NETWORK) {
+                                               s += ('\tSTATE_IS_NETWORK\n');
+                                       }
+                                       if (stateFlags & nsIWebProgressListener.STATE_IS_WINDOW) {
+                                               s += ('\tSTATE_IS_WINDOW\n');
+                                       }
+                                       if (stateFlags & nsIWebProgressListener.STATE_START) {
+                                               s += ('\tSTATE_START\n');
+                                       }
+                                       if (stateFlags & nsIWebProgressListener.STATE_REDIRECTING) {
+                                               s += ('\tSTATE_REDIRECTING\n');
+                                       }
+                                       if (stateFlags & nsIWebProgressListener.STATE_TRANSFERING) {
+                                               s += ('\tSTATE_TRANSFERING\n');
+                                       }
+                                       if (stateFlags & nsIWebProgressListener.STATE_NEGOTIATING) {
+                                               s += ('\tSTATE_NEGOTIATING\n');
+                                       }
+                                       if (stateFlags & nsIWebProgressListener.STATE_STOP) {
+                                               s += ('\tSTATE_STOP\n');
+                                       }
+                                       obj.error.sdump('D_OPAC',s);    
                                }
-                               obj.error.sdump('D_OPAC',s);    
                        }
+                       obj.progressListener.QueryInterface = function(){return this;};
+               } catch(E) {
+                       this.error.sdump('D_ERROR','cat.opac.buildProgressListener: ' + E + '\n');
                }
-               obj.progressListener.QueryInterface = function(){return this;};
        },
 }