Fix bug 477248 - Calendar hangs - Syntax error calProviderUtils.jsm (new XML(...)) after opening outlook/lotus notes invitation mail.
authorPeter Goerzen <pgoerzen@hustlerturf.com>
Wed, 04 Mar 2009 17:28:14 +0100
changeset 2128 07a97d5e80ca49b84e1854027848fc389891e087
parent 2127 513295ae0230e3d0baa73b1ee98627d4b2f97d24
child 2129 0c9fa2b7a595c2cd90851ad29115d7583e0fef55
push id1720
push usermozilla@kewis.ch
push dateWed, 04 Mar 2009 16:28:23 +0000
treeherdercomm-central@07a97d5e80ca [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs477248
Fix bug 477248 - Calendar hangs - Syntax error calProviderUtils.jsm (new XML(...)) after opening outlook/lotus notes invitation mail.
calendar/base/modules/calProviderUtils.jsm
calendar/lightning/components/lightningTextCalendarConverter.js
--- a/calendar/base/modules/calProviderUtils.jsm
+++ b/calendar/base/modules/calProviderUtils.jsm
@@ -117,16 +117,19 @@ cal.convertByteArray = function calConve
         if (aThrow) {
             throw e;
         }
     }
     return null;
 };
 
 cal.safeNewXML = function calSafeNewXML(aStr) {
+    // Restore XML global property defaults as a precaution
+    XML.setSettings();
+
     // Strip <?xml and surrounding whitespaces
     return new XML(aStr.replace(/^\s*<\?xml[^>]*>/g, "").trimRight());
 };
 
 /**
  * getInterface method for providers. This should be called in the context of
  * the respective provider, i.e
  *
--- a/calendar/lightning/components/lightningTextCalendarConverter.js
+++ b/calendar/lightning/components/lightningTextCalendarConverter.js
@@ -46,16 +46,19 @@ function makeTableRow(val) {
 function getLightningStringBundle()
 {
     var svc = Components.classes["@mozilla.org/intl/stringbundle;1"].
               getService(Components.interfaces.nsIStringBundleService);
     return svc.createBundle("chrome://lightning/locale/lightning.properties");
 }
 
 function linkifyText(text) {
+    // Save off the settings
+    var savedSettings = XML.settings();
+
     XML.ignoreWhitespace = false;
     XML.prettyPrinting = false;
     XML.prettyIndent = false;
     var linkifiedText = <p/>;
     var localText = text;
 
     // XXX This should be improved to also understand abbreviated urls, could be
     // extended to only linkify urls that have an internal protocol handler, or
@@ -78,16 +81,19 @@ function linkifyText(text) {
         var a = <a>{url}</a>;
         a.@href = url;
 
         linkifiedText.appendChild(a);
 
         localText = localText.substr(endPos);
     }
     dump(linkifiedText.toXMLString());
+    // restore the settings
+    XML.setSettings(savedSettings);
+
     return linkifiedText;
 }
 
 function createHtmlTableSection(label, text, linkify)
 {
     var tblRow = <tr>
                     <td class="description">
                         <p>{label}</p>