wrapping load_lib() in try {} so these can (potentially) be used outside OpenILS
authormiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Sat, 14 Jan 2006 16:03:56 +0000 (16:03 +0000)
committermiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Sat, 14 Jan 2006 16:03:56 +0000 (16:03 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@2715 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/javascript/backend/libs/jsDOM.js
Open-ILS/src/javascript/backend/libs/xmlhttprequest.js

index 1738b90..f8ab5e1 100644 (file)
@@ -1,5 +1,7 @@
-load_lib('jsOO.js')
-load_lib('xpath.js')
+try {
+       load_lib('jsOO.js')
+       load_lib('xpath.js')
+} catch (e) {}
 
 function DOMException  (c) { this.code = c }
 DOMException.INDEX_SIZE_ERR = 1;
@@ -54,7 +56,11 @@ var __XMLDOC = {};
 var __XMLDOCid = 0;
 DOMImplementation.parseString = function (xml) {
        __XMLDOC['id' + __XMLDOCid] = {};
-       _OILS_FUNC_xml_parse_string(xml, '__XMLDOC.id' + __XMLDOCid);
+       try {
+               _OILS_FUNC_xml_parse_string(xml, '__XMLDOC.id' + __XMLDOCid);
+       } catch (e) {
+               alert("Sorry, no string parsing support");
+       }
        var x = __XMLDOC['id' + __XMLDOCid];
        __XMLDOCid++;
        return x;
index 3a16463..51594e9 100644 (file)
@@ -1,5 +1,7 @@
-load_lib('jsOO.js');
-load_lib('jsDOM.js');
+try {
+       load_lib('jsOO.js');
+       load_lib('jsDOM.js');
+} catch (e) {}
 
 var __xmlhttpreqid = 1;
 var __xmlhttpreq_hash = {};
@@ -30,7 +32,11 @@ XMLHttpRequest.method('send', function (data) {
 
         __xmlhttpreq_hash['id' + this._hash_id] = {};
 
-        _OILS_FUNC_xmlhttprequest_send(this._hash_id,this._method,this._url,this._async,headerlist,data);
+       try {
+               _OILS_FUNC_xmlhttprequest_send(this._hash_id,this._method,this._url,this._async,headerlist,data);
+       } catch (e) {
+               alert("Sorry, no XMLHttpRequest support");
+       }
 
         this.responseText = __xmlhttpreq_hash['id' + this._hash_id].responseText;
         this.readyState = __xmlhttpreq_hash['id' + this._hash_id].readyState;