mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-29 15:52:07 +00:00
Bug 423540: avoid using XPCOM during component initialization, patch by Marcus Redivo <mredivo@flock.com>, r=me, a=vlad
This commit is contained in:
parent
79f75168cf
commit
3ee91c233f
@ -43,7 +43,7 @@
|
||||
><xul:description id="subscribeUsingDescription"
|
||||
/><xul:menulist id="handlersMenuList" aaa:labelledby="subscribeUsingDescription"
|
||||
><xul:menupopup menugenerated="true" id="handlersMenuPopup"
|
||||
><xul:menuitem id="liveBookmarksMenuItem" label="&feedLiveBookmarks;" class="menuitem-iconic" image="chrome://browser/skin/page-livemarks.png" selected="true"
|
||||
><xul:menuitem id="liveBookmarksMenuItem" label="&feedLiveBookmarks;" class="menuitem-iconic" image="chrome://platform-browser/skin/page-livemarks.png" selected="true"
|
||||
/><xul:menuseparator
|
||||
/></xul:menupopup
|
||||
></xul:menulist
|
||||
|
@ -79,9 +79,7 @@ const SAX_CONTRACTID = "@mozilla.org/saxparser/xmlreader;1";
|
||||
const UNESCAPE_CONTRACTID = "@mozilla.org/feed-unescapehtml;1";
|
||||
|
||||
|
||||
var gIoService = Cc[IO_CONTRACTID].getService(Ci.nsIIOService);
|
||||
var gUnescapeHTML = Cc[UNESCAPE_CONTRACTID].
|
||||
getService(Ci.nsIScriptableUnescapeHTML);
|
||||
var gIoService = null;
|
||||
|
||||
const XMLNS = "http://www.w3.org/XML/1998/namespace";
|
||||
const RSS090NS = "http://my.netscape.com/rdf/simple/0.9/";
|
||||
@ -90,6 +88,8 @@ const WAIROLE_NS = "http://www.w3.org/2005/01/wai-rdf/GUIRoleTaxonomy#";
|
||||
/***** Some general utils *****/
|
||||
function strToURI(link, base) {
|
||||
var base = base || null;
|
||||
if (!gIoService)
|
||||
gIoService = Cc[IO_CONTRACTID].getService(Ci.nsIIOService);
|
||||
try {
|
||||
return gIoService.newURI(link, null, base);
|
||||
}
|
||||
@ -657,12 +657,14 @@ function TextConstruct() {
|
||||
this.base = null;
|
||||
this.type = "text";
|
||||
this.text = null;
|
||||
this.unescapeHTML = Cc[UNESCAPE_CONTRACTID].
|
||||
getService(Ci.nsIScriptableUnescapeHTML);
|
||||
}
|
||||
|
||||
TextConstruct.prototype = {
|
||||
plainText: function TC_plainText() {
|
||||
if (this.type != "text") {
|
||||
return gUnescapeHTML.unescape(stripTags(this.text));
|
||||
return this.unescapeHTML.unescape(stripTags(this.text));
|
||||
}
|
||||
return this.text;
|
||||
},
|
||||
@ -683,7 +685,8 @@ TextConstruct.prototype = {
|
||||
else
|
||||
return null;
|
||||
|
||||
return gUnescapeHTML.parseFragment(this.text, isXML, this.base, element);
|
||||
return this.unescapeHTML.parseFragment(this.text, isXML,
|
||||
this.base, element);
|
||||
},
|
||||
|
||||
// XPCOM stuff
|
||||
@ -1639,8 +1642,7 @@ FeedProcessor.prototype = {
|
||||
if (target == "xml-stylesheet") {
|
||||
var hrefAttribute = data.match(/href=[\"\'](.*?)[\"\']/);
|
||||
if (hrefAttribute && hrefAttribute.length == 2)
|
||||
this._result.stylesheet = gIoService.newURI(hrefAttribute[1], null,
|
||||
this._result.uri);
|
||||
this._result.stylesheet = strToURI(hrefAttribute[1], this._result.uri);
|
||||
}
|
||||
},
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user