@@ -524,20 +524,36 @@ const Liberator = Module("liberator", {
524524 let fileMap = services . get ( "liberator:" ) . FILE_MAP ;
525525 let overlayMap = services . get ( "liberator:" ) . OVERLAY_MAP ;
526526
527+ // XXX: util.httpGet is very heavy on startup. (Fx32)
528+ function httpGet ( url ) {
529+ var channel = services . get ( "io" ) . newChannelFromURI ( makeURI ( url ) ) ;
530+ try {
531+ var stream = channel . open ( ) ;
532+ } catch ( ex ) {
533+ return null ;
534+ }
535+
536+ var ps = new DOMParser ;
537+ var res = ps . parseFromStream ( stream , "utf-8" , stream . available ( ) , "text/xml" ) ;
538+ stream . close ( ) ;
539+ return { responseXML : res } ;
540+ }
541+
527542 // Left as an XPCOM instantiation so it can easilly be moved
528543 // into XPCOM code.
529544 function XSLTProcessor ( sheet ) {
530545 let xslt = Cc [ "@mozilla.org/document-transformer;1?type=xslt" ] . createInstance ( Ci . nsIXSLTProcessor ) ;
531- xslt . importStylesheet ( util . httpGet ( sheet ) . responseXML ) ;
546+ xslt . importStylesheet ( httpGet ( sheet ) . responseXML ) ;
532547 return xslt ;
533548 }
534549
535550 // Find help and overlay files with the given name.
536551 function findHelpFile ( file ) {
537552 let result = [ ] ;
553+
538554 for ( let namespace of namespaces ) {
539555 let url = [ "chrome://" , namespace , "/locale/" , file , ".xml" ] . join ( "" ) ;
540- let res = util . httpGet ( url ) ;
556+ let res = httpGet ( url ) ;
541557 if ( res ) {
542558 if ( res . responseXML . documentElement . localName == "document" )
543559 fileMap [ file ] = url ;
@@ -611,7 +627,7 @@ const Liberator = Module("liberator", {
611627 </document>` . toString ( ) ;
612628 fileMap [ "plugins" ] = function ( ) [ 'text/xml;charset=UTF-8' , help ] ;
613629
614- addTags ( "plugins" , util . httpGet ( "liberator://help/plugins" ) . responseXML ) ;
630+ addTags ( "plugins" , httpGet ( "liberator://help/plugins" ) . responseXML ) ;
615631 } ,
616632
617633 /**
0 commit comments