[Pale-Moon] Issue MoonchildProductions/UXP#516 - Remove named function syntax from palemoon/components/feeds.

This commit is contained in:
athenian200 2020-02-06 06:48:27 -06:00 • committed by Roy Tam
commit c7bcbe215d
4 changed files with 96 additions and 96 deletions

View file

@ -127,7 +127,7 @@ FeedConverter.prototype = {
/** /**
* See nsIStreamConverter.idl * See nsIStreamConverter.idl
*/ */
convert: function FC_convert(sourceStream, sourceType, destinationType, convert: function (sourceStream, sourceType, destinationType,
context) { context) {
throw Cr.NS_ERROR_NOT_IMPLEMENTED; throw Cr.NS_ERROR_NOT_IMPLEMENTED;
}, },
@ -135,7 +135,7 @@ FeedConverter.prototype = {
/** /**
* See nsIStreamConverter.idl * See nsIStreamConverter.idl
*/ */
asyncConvertData: function FC_asyncConvertData(sourceType, destinationType, asyncConvertData: function (sourceType, destinationType,
listener, context) { listener, context) {
this._listener = listener; this._listener = listener;
}, },
@ -148,7 +148,7 @@ FeedConverter.prototype = {
/** /**
* Release our references to various things once we're done using them. * Release our references to various things once we're done using them.
*/ */
_releaseHandles: function FC__releaseHandles() { _releaseHandles: function () {
this._listener = null; this._listener = null;
this._request = null; this._request = null;
this._processor = null; this._processor = null;
@ -157,7 +157,7 @@ FeedConverter.prototype = {
/** /**
* See nsIFeedResultListener.idl * See nsIFeedResultListener.idl
*/ */
handleResult: function FC_handleResult(result) { handleResult: function (result) {
// Feeds come in various content types, which our feed sniffer coerces to // Feeds come in various content types, which our feed sniffer coerces to
// the maybe.feed type. However, feeds are used as a transport for // the maybe.feed type. However, feeds are used as a transport for
// different data types, e.g. news/blogs (traditional feed), video/audio // different data types, e.g. news/blogs (traditional feed), video/audio
@ -270,7 +270,7 @@ FeedConverter.prototype = {
/** /**
* See nsIStreamListener.idl * See nsIStreamListener.idl
*/ */
onDataAvailable: function FC_onDataAvailable(request, context, inputStream, onDataAvailable: function (request, context, inputStream,
sourceOffset, count) { sourceOffset, count) {
if (this._processor) if (this._processor)
this._processor.onDataAvailable(request, context, inputStream, this._processor.onDataAvailable(request, context, inputStream,
@ -280,7 +280,7 @@ FeedConverter.prototype = {
/** /**
* See nsIRequestObserver.idl * See nsIRequestObserver.idl
*/ */
onStartRequest: function FC_onStartRequest(request, context) { onStartRequest: function (request, context) {
var channel = request.QueryInterface(Ci.nsIChannel); var channel = request.QueryInterface(Ci.nsIChannel);
// Check for a header that tells us there was no sniffing // Check for a header that tells us there was no sniffing
@ -323,7 +323,7 @@ FeedConverter.prototype = {
/** /**
* See nsIRequestObserver.idl * See nsIRequestObserver.idl
*/ */
onStopRequest: function FC_onStopRequest(request, context, status) { onStopRequest: function (request, context, status) {
if (this._processor) if (this._processor)
this._processor.onStopRequest(request, context, status); this._processor.onStopRequest(request, context, status);
}, },
@ -331,7 +331,7 @@ FeedConverter.prototype = {
/** /**
* See nsISupports.idl * See nsISupports.idl
*/ */
QueryInterface: function FC_QueryInterface(iid) { QueryInterface: function (iid) {
if (iid.equals(Ci.nsIFeedResultListener) || if (iid.equals(Ci.nsIFeedResultListener) ||
iid.equals(Ci.nsIStreamConverter) || iid.equals(Ci.nsIStreamConverter) ||
iid.equals(Ci.nsIStreamListener) || iid.equals(Ci.nsIStreamListener) ||
@ -366,7 +366,7 @@ FeedResultService.prototype = {
/** /**
* See nsIFeedResultService.idl * See nsIFeedResultService.idl
*/ */
addToClientReader: function FRS_addToClientReader(spec, title, subtitle, feedType) { addToClientReader: function (spec, title, subtitle, feedType) {
var prefs = var prefs =
Cc["@mozilla.org/preferences-service;1"]. Cc["@mozilla.org/preferences-service;1"].
getService(Ci.nsIPrefBranch); getService(Ci.nsIPrefBranch);
@ -432,7 +432,7 @@ FeedResultService.prototype = {
/** /**
* See nsIFeedResultService.idl * See nsIFeedResultService.idl
*/ */
addFeedResult: function FRS_addFeedResult(feedResult) { addFeedResult: function (feedResult) {
NS_ASSERT(feedResult.uri != null, "null URI!"); NS_ASSERT(feedResult.uri != null, "null URI!");
NS_ASSERT(feedResult.uri != null, "null feedResult!"); NS_ASSERT(feedResult.uri != null, "null feedResult!");
var spec = feedResult.uri.spec; var spec = feedResult.uri.spec;
@ -444,7 +444,7 @@ FeedResultService.prototype = {
/** /**
* See nsIFeedResultService.idl * See nsIFeedResultService.idl
*/ */
getFeedResult: function RFS_getFeedResult(uri) { getFeedResult: function (uri) {
NS_ASSERT(uri != null, "null URI!"); NS_ASSERT(uri != null, "null URI!");
var resultList = this._results[uri.spec]; var resultList = this._results[uri.spec];
for (var i in resultList) { for (var i in resultList) {
@ -457,7 +457,7 @@ FeedResultService.prototype = {
/** /**
* See nsIFeedResultService.idl * See nsIFeedResultService.idl
*/ */
removeFeedResult: function FRS_removeFeedResult(uri) { removeFeedResult: function (uri) {
NS_ASSERT(uri != null, "null URI!"); NS_ASSERT(uri != null, "null URI!");
var resultList = this._results[uri.spec]; var resultList = this._results[uri.spec];
if (!resultList) if (!resultList)
@ -478,13 +478,13 @@ FeedResultService.prototype = {
delete this._results[uri.spec]; delete this._results[uri.spec];
}, },
createInstance: function FRS_createInstance(outer, iid) { createInstance: function (outer, iid) {
if (outer != null) if (outer != null)
throw Cr.NS_ERROR_NO_AGGREGATION; throw Cr.NS_ERROR_NO_AGGREGATION;
return this.QueryInterface(iid); return this.QueryInterface(iid);
}, },
QueryInterface: function FRS_QueryInterface(iid) { QueryInterface: function (iid) {
if (iid.equals(Ci.nsIFeedResultService) || if (iid.equals(Ci.nsIFeedResultService) ||
iid.equals(Ci.nsIFactory) || iid.equals(Ci.nsIFactory) ||
iid.equals(Ci.nsISupports)) iid.equals(Ci.nsISupports))
@ -500,7 +500,7 @@ FeedResultService.prototype = {
function GenericProtocolHandler() { function GenericProtocolHandler() {
} }
GenericProtocolHandler.prototype = { GenericProtocolHandler.prototype = {
_init: function GPH_init(scheme) { _init: function (scheme) {
var ios = var ios =
Cc["@mozilla.org/network/io-service;1"]. Cc["@mozilla.org/network/io-service;1"].
getService(Ci.nsIIOService); getService(Ci.nsIIOService);
@ -520,11 +520,11 @@ GenericProtocolHandler.prototype = {
return this._http.defaultPort; return this._http.defaultPort;
}, },
allowPort: function GPH_allowPort(port, scheme) { allowPort: function (port, scheme) {
return this._http.allowPort(port, scheme); return this._http.allowPort(port, scheme);
}, },
newURI: function GPH_newURI(spec, originalCharset, baseURI) { newURI: function (spec, originalCharset, baseURI) {
// Feed URIs can be either nested URIs of the form feed:realURI (in which // Feed URIs can be either nested URIs of the form feed:realURI (in which
// case we create a nested URI for the realURI) or feed://example.com, in // case we create a nested URI for the realURI) or feed://example.com, in
// which case we create a nested URI for the real protocol which is http. // which case we create a nested URI for the real protocol which is http.
@ -548,7 +548,7 @@ GenericProtocolHandler.prototype = {
return uri; return uri;
}, },
newChannel2: function GPH_newChannel(aUri, aLoadInfo) { newChannel2: function (aUri, aLoadInfo) {
var inner = aUri.QueryInterface(Ci.nsINestedURI).innerURI; var inner = aUri.QueryInterface(Ci.nsINestedURI).innerURI;
var channel = Cc["@mozilla.org/network/io-service;1"]. var channel = Cc["@mozilla.org/network/io-service;1"].
getService(Ci.nsIIOService). getService(Ci.nsIIOService).
@ -562,7 +562,7 @@ GenericProtocolHandler.prototype = {
}, },
QueryInterface: function GPH_QueryInterface(iid) { QueryInterface: function (iid) {
if (iid.equals(Ci.nsIProtocolHandler) || if (iid.equals(Ci.nsIProtocolHandler) ||
iid.equals(Ci.nsISupports)) iid.equals(Ci.nsISupports))
return this; return this;

View file

@ -149,12 +149,12 @@ FeedWriter.prototype = {
_mimeSvc : Cc["@mozilla.org/mime;1"]. _mimeSvc : Cc["@mozilla.org/mime;1"].
getService(Ci.nsIMIMEService), getService(Ci.nsIMIMEService),
_getPropertyAsBag: function FW__getPropertyAsBag(container, property) { _getPropertyAsBag: function (container, property) {
return container.fields.getProperty(property). return container.fields.getProperty(property).
QueryInterface(Ci.nsIPropertyBag2); QueryInterface(Ci.nsIPropertyBag2);
}, },
_getPropertyAsString: function FW__getPropertyAsString(container, property) { _getPropertyAsString: function (container, property) {
try { try {
return container.fields.getPropertyAsAString(property); return container.fields.getPropertyAsAString(property);
} }
@ -163,7 +163,7 @@ FeedWriter.prototype = {
return ""; return "";
}, },
_setContentText: function FW__setContentText(id, text) { _setContentText: function (id, text) {
this._contentSandbox.element = this._document.getElementById(id); this._contentSandbox.element = this._document.getElementById(id);
this._contentSandbox.textNode = text.createDocumentFragment(this._contentSandbox.element); this._contentSandbox.textNode = text.createDocumentFragment(this._contentSandbox.element);
var codeStr = var codeStr =
@ -190,7 +190,7 @@ FeedWriter.prototype = {
* The URI spec to set as the href * The URI spec to set as the href
*/ */
_safeSetURIAttribute: _safeSetURIAttribute:
function FW__safeSetURIAttribute(element, attribute, uri) { function (element, attribute, uri) {
var secman = Cc["@mozilla.org/scriptsecuritymanager;1"]. var secman = Cc["@mozilla.org/scriptsecuritymanager;1"].
getService(Ci.nsIScriptSecurityManager); getService(Ci.nsIScriptSecurityManager);
const flags = Ci.nsIScriptSecurityManager.DISALLOW_INHERIT_PRINCIPAL; const flags = Ci.nsIScriptSecurityManager.DISALLOW_INHERIT_PRINCIPAL;
@ -243,7 +243,7 @@ FeedWriter.prototype = {
* @param aElement * @param aElement
* the XUL element to call doCommand() on. * the XUL element to call doCommand() on.
*/ */
_safeDoCommand: function FW___safeDoCommand(aElement) { _safeDoCommand: function (aElement) {
this._contentSandbox.element = aElement; this._contentSandbox.element = aElement;
Cu.evalInSandbox("element.doCommand();", this._contentSandbox); Cu.evalInSandbox("element.doCommand();", this._contentSandbox);
this._contentSandbox.element = null; this._contentSandbox.element = null;
@ -268,16 +268,16 @@ FeedWriter.prototype = {
return this.__bundle; return this.__bundle;
}, },
_getFormattedString: function FW__getFormattedString(key, params) { _getFormattedString: function (key, params) {
return this._bundle.formatStringFromName(key, params, params.length); return this._bundle.formatStringFromName(key, params, params.length);
}, },
_getString: function FW__getString(key) { _getString: function (key) {
return this._bundle.GetStringFromName(key); return this._bundle.GetStringFromName(key);
}, },
/* Magic helper methods to be used instead of xbl properties */ /* Magic helper methods to be used instead of xbl properties */
_getSelectedItemFromMenulist: function FW__getSelectedItemFromList(aList) { _getSelectedItemFromMenulist: function (aList) {
var node = aList.firstChild.firstChild; var node = aList.firstChild.firstChild;
while (node) { while (node) {
if (node.localName == "menuitem" && node.getAttribute("selected") == "true") if (node.localName == "menuitem" && node.getAttribute("selected") == "true")
@ -289,7 +289,7 @@ FeedWriter.prototype = {
return null; return null;
}, },
_setCheckboxCheckedState: function FW__setCheckboxCheckedState(aCheckbox, aValue) { _setCheckboxCheckedState: function (aCheckbox, aValue) {
// see checkbox.xml, xbl bindings are not applied within the sandbox! // see checkbox.xml, xbl bindings are not applied within the sandbox!
this._contentSandbox.checkbox = aCheckbox; this._contentSandbox.checkbox = aCheckbox;
var codeStr; var codeStr;
@ -315,7 +315,7 @@ FeedWriter.prototype = {
* @param dateString * @param dateString
* A date as extracted from a feed entry. (entry.updated) * A date as extracted from a feed entry. (entry.updated)
*/ */
_parseDate: function FW__parseDate(dateString) { _parseDate: function (dateString) {
// Convert the date into the user's local time zone // Convert the date into the user's local time zone
dateObj = new Date(dateString); dateObj = new Date(dateString);
@ -334,7 +334,7 @@ FeedWriter.prototype = {
* Returns the feed type. * Returns the feed type.
*/ */
__feedType: null, __feedType: null,
_getFeedType: function FW__getFeedType() { _getFeedType: function () {
if (this.__feedType != null) if (this.__feedType != null)
return this.__feedType; return this.__feedType;
@ -352,7 +352,7 @@ FeedWriter.prototype = {
/** /**
* Maps a feed type to a maybe-feed mimetype. * Maps a feed type to a maybe-feed mimetype.
*/ */
_getMimeTypeForFeedType: function FW__getMimeTypeForFeedType() { _getMimeTypeForFeedType: function () {
switch (this._getFeedType()) { switch (this._getFeedType()) {
case Ci.nsIFeed.TYPE_VIDEO: case Ci.nsIFeed.TYPE_VIDEO:
return TYPE_MAYBE_VIDEO_FEED; return TYPE_MAYBE_VIDEO_FEED;
@ -370,7 +370,7 @@ FeedWriter.prototype = {
* @param container * @param container
* The feed container * The feed container
*/ */
_setTitleText: function FW__setTitleText(container) { _setTitleText: function (container) {
if (container.title) { if (container.title) {
var title = container.title.plainText(); var title = container.title.plainText();
this._setContentText(TITLE_ID, container.title); this._setContentText(TITLE_ID, container.title);
@ -390,7 +390,7 @@ FeedWriter.prototype = {
* @param container * @param container
* The feed container * The feed container
*/ */
_setTitleImage: function FW__setTitleImage(container) { _setTitleImage: function (container) {
try { try {
var parts = container.image; var parts = container.image;
@ -432,7 +432,7 @@ FeedWriter.prototype = {
* @param container * @param container
* The container of entries in the feed * The container of entries in the feed
*/ */
_writeFeedContent: function FW__writeFeedContent(container) { _writeFeedContent: function (container) {
// Build the actual feed content // Build the actual feed content
var feed = container.QueryInterface(Ci.nsIFeed); var feed = container.QueryInterface(Ci.nsIFeed);
if (feed.items.length == 0) if (feed.items.length == 0)
@ -532,7 +532,7 @@ FeedWriter.prototype = {
* The URL string from which to create a display name * The URL string from which to create a display name
* @returns a string * @returns a string
*/ */
_getURLDisplayName: function FW__getURLDisplayName(aURL) { _getURLDisplayName: function (aURL) {
var url = makeURI(aURL); var url = makeURI(aURL);
url.QueryInterface(Ci.nsIURL); url.QueryInterface(Ci.nsIURL);
if (url == null || url.fileName.length == 0) if (url == null || url.fileName.length == 0)
@ -548,7 +548,7 @@ FeedWriter.prototype = {
* FeedEntry with enclosures * FeedEntry with enclosures
* @returns element * @returns element
*/ */
_buildEnclosureDiv: function FW__buildEnclosureDiv(entry) { _buildEnclosureDiv: function (entry) {
var enclosuresDiv = this._document.createElementNS(HTML_NS, "div"); var enclosuresDiv = this._document.createElementNS(HTML_NS, "div");
enclosuresDiv.className = "enclosures"; enclosuresDiv.className = "enclosures";
@ -628,7 +628,7 @@ FeedWriter.prototype = {
* @returns A valid nsIFeedContainer object containing the contents of * @returns A valid nsIFeedContainer object containing the contents of
* the feed. * the feed.
*/ */
_getContainer: function FW__getContainer(result) { _getContainer: function (result) {
var feedService = var feedService =
Cc["@mozilla.org/browser/feeds/result-service;1"]. Cc["@mozilla.org/browser/feeds/result-service;1"].
getService(Ci.nsIFeedResultService); getService(Ci.nsIFeedResultService);
@ -668,7 +668,7 @@ FeedWriter.prototype = {
* A nsIFile to look up the name of * A nsIFile to look up the name of
* @returns The display name of the application represented by the file. * @returns The display name of the application represented by the file.
*/ */
_getFileDisplayName: function FW__getFileDisplayName(file) { _getFileDisplayName: function (file) {
#ifdef XP_WIN #ifdef XP_WIN
if (file instanceof Ci.nsILocalFileWin) { if (file instanceof Ci.nsILocalFileWin) {
try { try {
@ -710,7 +710,7 @@ FeedWriter.prototype = {
* Helper method to get an element in the XBL binding where the handler * Helper method to get an element in the XBL binding where the handler
* selection UI lives * selection UI lives
*/ */
_getUIElement: function FW__getUIElement(id) { _getUIElement: function (id) {
return this._document.getAnonymousElementByAttribute( return this._document.getAnonymousElementByAttribute(
this._document.getElementById("feedSubscribeLine"), "anonid", id); this._document.getElementById("feedSubscribeLine"), "anonid", id);
}, },
@ -720,7 +720,7 @@ FeedWriter.prototype = {
* @param aCallback the callback method, passes in true if a feed reader was * @param aCallback the callback method, passes in true if a feed reader was
* selected, false otherwise. * selected, false otherwise.
*/ */
_chooseClientApp: function FW__chooseClientApp(aCallback) { _chooseClientApp: function (aCallback) {
try { try {
let fp = Cc["@mozilla.org/filepicker;1"].createInstance(Ci.nsIFilePicker); let fp = Cc["@mozilla.org/filepicker;1"].createInstance(Ci.nsIFilePicker);
let fpCallback = function fpCallback_done(aResult) { let fpCallback = function fpCallback_done(aResult) {
@ -766,7 +766,7 @@ FeedWriter.prototype = {
} }
}, },
_setAlwaysUseCheckedState: function FW__setAlwaysUseCheckedState(feedType) { _setAlwaysUseCheckedState: function (feedType) {
var checkbox = this._getUIElement("alwaysUse"); var checkbox = this._getUIElement("alwaysUse");
if (checkbox) { if (checkbox) {
var alwaysUse = false; var alwaysUse = false;
@ -781,7 +781,7 @@ FeedWriter.prototype = {
} }
}, },
_setSubscribeUsingLabel: function FW__setSubscribeUsingLabel() { _setSubscribeUsingLabel: function () {
var stringLabel = "subscribeFeedUsing"; var stringLabel = "subscribeFeedUsing";
switch (this._getFeedType()) { switch (this._getFeedType()) {
case Ci.nsIFeed.TYPE_VIDEO: case Ci.nsIFeed.TYPE_VIDEO:
@ -800,7 +800,7 @@ FeedWriter.prototype = {
Cu.evalInSandbox(codeStr, this._contentSandbox); Cu.evalInSandbox(codeStr, this._contentSandbox);
}, },
_setAlwaysUseLabel: function FW__setAlwaysUseLabel() { _setAlwaysUseLabel: function () {
var checkbox = this._getUIElement("alwaysUse"); var checkbox = this._getUIElement("alwaysUse");
if (checkbox) { if (checkbox) {
if (this._handlersMenuList) { if (this._handlersMenuList) {
@ -864,7 +864,7 @@ FeedWriter.prototype = {
} }
}, },
_setSelectedHandler: function FW__setSelectedHandler(feedType) { _setSelectedHandler: function (feedType) {
var prefs = var prefs =
Cc["@mozilla.org/preferences-service;1"]. Cc["@mozilla.org/preferences-service;1"].
getService(Ci.nsIPrefBranch); getService(Ci.nsIPrefBranch);
@ -927,7 +927,7 @@ FeedWriter.prototype = {
} }
}, },
_initSubscriptionUI: function FW__initSubscriptionUI() { _initSubscriptionUI: function () {
var handlersMenuPopup = this._getUIElement("handlersMenuPopup"); var handlersMenuPopup = this._getUIElement("handlersMenuPopup");
if (!handlersMenuPopup) if (!handlersMenuPopup)
return; return;
@ -1105,7 +1105,7 @@ FeedWriter.prototype = {
* @param aWindow * @param aWindow
* The window of the document invoking the BrowserFeedWriter * The window of the document invoking the BrowserFeedWriter
*/ */
_getOriginalURI: function FW__getOriginalURI(aWindow) { _getOriginalURI: function (aWindow) {
var chan = aWindow.QueryInterface(Ci.nsIInterfaceRequestor). var chan = aWindow.QueryInterface(Ci.nsIInterfaceRequestor).
getInterface(Ci.nsIWebNavigation). getInterface(Ci.nsIWebNavigation).
QueryInterface(Ci.nsIDocShell).currentDocumentChannel; QueryInterface(Ci.nsIDocShell).currentDocumentChannel;
@ -1135,7 +1135,7 @@ FeedWriter.prototype = {
_handlersMenuList: null, _handlersMenuList: null,
// BrowserFeedWriter WebIDL methods // BrowserFeedWriter WebIDL methods
init: function FW_init(aWindow) { init: function (aWindow) {
var window = aWindow; var window = aWindow;
this._feedURI = this._getOriginalURI(window); this._feedURI = this._getOriginalURI(window);
if (!this._feedURI) if (!this._feedURI)
@ -1171,7 +1171,7 @@ FeedWriter.prototype = {
prefs.addObserver(PREF_AUDIO_SELECTED_APP, this, false); prefs.addObserver(PREF_AUDIO_SELECTED_APP, this, false);
}, },
writeContent: function FW_writeContent() { writeContent: function () {
if (!this._window) if (!this._window)
return; return;
@ -1190,7 +1190,7 @@ FeedWriter.prototype = {
} }
}, },
close: function FW_close() { close: function () {
this._getUIElement("handlersMenuPopup") this._getUIElement("handlersMenuPopup")
.removeEventListener("command", this, false); .removeEventListener("command", this, false);
this._getUIElement("subscribeButton") this._getUIElement("subscribeButton")
@ -1220,7 +1220,7 @@ FeedWriter.prototype = {
this.__contentSandbox = null; this.__contentSandbox = null;
}, },
_removeFeedFromCache: function FW__removeFeedFromCache() { _removeFeedFromCache: function () {
if (this._feedURI) { if (this._feedURI) {
var feedService = Cc["@mozilla.org/browser/feeds/result-service;1"]. var feedService = Cc["@mozilla.org/browser/feeds/result-service;1"].
getService(Ci.nsIFeedResultService); getService(Ci.nsIFeedResultService);
@ -1229,7 +1229,7 @@ FeedWriter.prototype = {
} }
}, },
subscribe: function FW_subscribe() { subscribe: function () {
var feedType = this._getFeedType(); var feedType = this._getFeedType();
// Subscribe to the feed using the selected handler and save prefs // Subscribe to the feed using the selected handler and save prefs
@ -1313,7 +1313,7 @@ FeedWriter.prototype = {
}, },
// nsIObserver // nsIObserver
observe: function FW_observe(subject, topic, data) { observe: function (subject, topic, data) {
if (!this._window) { if (!this._window) {
// this._window is null unless this.init was called with a trusted // this._window is null unless this.init was called with a trusted
// window object. // window object.
@ -1356,7 +1356,7 @@ FeedWriter.prototype = {
* to the icon url. See Bug 358878 for details. * to the icon url. See Bug 358878 for details.
*/ */
_setFaviconForWebReader: _setFaviconForWebReader:
function FW__setFaviconForWebReader(aReaderUrl, aMenuItem) { function (aReaderUrl, aMenuItem) {
var readerURI = makeURI(aReaderUrl); var readerURI = makeURI(aReaderUrl);
if (!/^https?$/.test(readerURI.scheme)) { if (!/^https?$/.test(readerURI.scheme)) {
// Don't try to get a favicon for non http(s) URIs. // Don't try to get a favicon for non http(s) URIs.

View file

@ -73,19 +73,19 @@ const NS_ERROR_DOM_SYNTAX_ERR = NS_ERROR_MODULE_DOM + 12;
function WebContentConverter() { function WebContentConverter() {
} }
WebContentConverter.prototype = { WebContentConverter.prototype = {
convert: function WCC_convert() { }, convert: function () { },
asyncConvertData: function WCC_asyncConvertData() { }, asyncConvertData: function () { },
onDataAvailable: function WCC_onDataAvailable() { }, onDataAvailable: function () { },
onStopRequest: function WCC_onStopRequest() { }, onStopRequest: function () { },
onStartRequest: function WCC_onStartRequest(request, context) { onStartRequest: function (request, context) {
var wccr = var wccr =
Cc[WCCR_CONTRACTID]. Cc[WCCR_CONTRACTID].
getService(Ci.nsIWebContentConverterService); getService(Ci.nsIWebContentConverterService);
wccr.loadPreferredHandler(request); wccr.loadPreferredHandler(request);
}, },
QueryInterface: function WCC_QueryInterface(iid) { QueryInterface: function (iid) {
if (iid.equals(Ci.nsIStreamConverter) || if (iid.equals(Ci.nsIStreamConverter) ||
iid.equals(Ci.nsIStreamListener) || iid.equals(Ci.nsIStreamListener) ||
iid.equals(Ci.nsISupports)) iid.equals(Ci.nsISupports))
@ -95,13 +95,13 @@ WebContentConverter.prototype = {
}; };
var WebContentConverterFactory = { var WebContentConverterFactory = {
createInstance: function WCCF_createInstance(outer, iid) { createInstance: function (outer, iid) {
if (outer != null) if (outer != null)
throw Cr.NS_ERROR_NO_AGGREGATION; throw Cr.NS_ERROR_NO_AGGREGATION;
return new WebContentConverter().QueryInterface(iid); return new WebContentConverter().QueryInterface(iid);
}, },
QueryInterface: function WCC_QueryInterface(iid) { QueryInterface: function (iid) {
if (iid.equals(Ci.nsIFactory) || if (iid.equals(Ci.nsIFactory) ||
iid.equals(Ci.nsISupports)) iid.equals(Ci.nsISupports))
return this; return this;
@ -125,7 +125,7 @@ ServiceInfo.prototype = {
/** /**
* See nsIHandlerApp * See nsIHandlerApp
*/ */
equals: function SI_equals(aHandlerApp) { equals: function (aHandlerApp) {
if (!aHandlerApp) if (!aHandlerApp)
throw Cr.NS_ERROR_NULL_POINTER; throw Cr.NS_ERROR_NULL_POINTER;
@ -154,11 +154,11 @@ ServiceInfo.prototype = {
/** /**
* See nsIWebContentHandlerInfo * See nsIWebContentHandlerInfo
*/ */
getHandlerURI: function SI_getHandlerURI(uri) { getHandlerURI: function (uri) {
return this._uri.replace(/%s/gi, encodeURIComponent(uri)); return this._uri.replace(/%s/gi, encodeURIComponent(uri));
}, },
QueryInterface: function SI_QueryInterface(iid) { QueryInterface: function (iid) {
if (iid.equals(Ci.nsIWebContentHandlerInfo) || if (iid.equals(Ci.nsIWebContentHandlerInfo) ||
iid.equals(Ci.nsISupports)) iid.equals(Ci.nsISupports))
return this; return this;
@ -180,11 +180,11 @@ WebContentConverterRegistrar.prototype = {
return WebContentConverterRegistrar.prototype.stringBundle = sb; return WebContentConverterRegistrar.prototype.stringBundle = sb;
}, },
_getFormattedString: function WCCR__getFormattedString(key, params) { _getFormattedString: function (key, params) {
return this.stringBundle.formatStringFromName(key, params, params.length); return this.stringBundle.formatStringFromName(key, params, params.length);
}, },
_getString: function WCCR_getString(key) { _getString: function (key) {
return this.stringBundle.GetStringFromName(key); return this.stringBundle.GetStringFromName(key);
}, },
@ -192,7 +192,7 @@ WebContentConverterRegistrar.prototype = {
* See nsIWebContentConverterService * See nsIWebContentConverterService
*/ */
getAutoHandler: getAutoHandler:
function WCCR_getAutoHandler(contentType) { function (contentType) {
contentType = this._resolveContentType(contentType); contentType = this._resolveContentType(contentType);
if (contentType in this._autoHandleContentTypes) if (contentType in this._autoHandleContentTypes)
return this._autoHandleContentTypes[contentType]; return this._autoHandleContentTypes[contentType];
@ -203,7 +203,7 @@ WebContentConverterRegistrar.prototype = {
* See nsIWebContentConverterService * See nsIWebContentConverterService
*/ */
setAutoHandler: setAutoHandler:
function WCCR_setAutoHandler(contentType, handler) { function (contentType, handler) {
if (handler && !this._typeIsRegistered(contentType, handler.uri)) if (handler && !this._typeIsRegistered(contentType, handler.uri))
throw Cr.NS_ERROR_NOT_AVAILABLE; throw Cr.NS_ERROR_NOT_AVAILABLE;
@ -226,7 +226,7 @@ WebContentConverterRegistrar.prototype = {
* Update the internal data structure (not persistent) * Update the internal data structure (not persistent)
*/ */
_setAutoHandler: _setAutoHandler:
function WCCR__setAutoHandler(contentType, handler) { function (contentType, handler) {
if (handler) if (handler)
this._autoHandleContentTypes[contentType] = handler; this._autoHandleContentTypes[contentType] = handler;
else if (contentType in this._autoHandleContentTypes) else if (contentType in this._autoHandleContentTypes)
@ -237,7 +237,7 @@ WebContentConverterRegistrar.prototype = {
* See nsIWebContentConverterService * See nsIWebContentConverterService
*/ */
getWebContentHandlerByURI: getWebContentHandlerByURI:
function WCCR_getWebContentHandlerByURI(contentType, uri) { function (contentType, uri) {
var handlers = this.getContentHandlers(contentType, { }); var handlers = this.getContentHandlers(contentType, { });
for (var i = 0; i < handlers.length; ++i) { for (var i = 0; i < handlers.length; ++i) {
if (handlers[i].uri == uri) if (handlers[i].uri == uri)
@ -250,7 +250,7 @@ WebContentConverterRegistrar.prototype = {
* See nsIWebContentConverterService * See nsIWebContentConverterService
*/ */
loadPreferredHandler: loadPreferredHandler:
function WCCR_loadPreferredHandler(request) { function (request) {
var channel = request.QueryInterface(Ci.nsIChannel); var channel = request.QueryInterface(Ci.nsIChannel);
var contentType = this._resolveContentType(channel.contentType); var contentType = this._resolveContentType(channel.contentType);
var handler = this.getAutoHandler(contentType); var handler = this.getAutoHandler(contentType);
@ -269,7 +269,7 @@ WebContentConverterRegistrar.prototype = {
* See nsIWebContentConverterService * See nsIWebContentConverterService
*/ */
removeProtocolHandler: removeProtocolHandler:
function WCCR_removeProtocolHandler(aProtocol, aURITemplate) { function (aProtocol, aURITemplate) {
var eps = Cc["@mozilla.org/uriloader/external-protocol-service;1"]. var eps = Cc["@mozilla.org/uriloader/external-protocol-service;1"].
getService(Ci.nsIExternalProtocolService); getService(Ci.nsIExternalProtocolService);
var handlerInfo = eps.getProtocolHandlerInfo(aProtocol); var handlerInfo = eps.getProtocolHandlerInfo(aProtocol);
@ -292,7 +292,7 @@ WebContentConverterRegistrar.prototype = {
* See nsIWebContentConverterService * See nsIWebContentConverterService
*/ */
removeContentHandler: removeContentHandler:
function WCCR_removeContentHandler(contentType, uri) { function (contentType, uri) {
function notURI(serviceInfo) { function notURI(serviceInfo) {
return serviceInfo.uri != uri; return serviceInfo.uri != uri;
} }
@ -326,7 +326,7 @@ WebContentConverterRegistrar.prototype = {
* @returns The resolved contentType value. * @returns The resolved contentType value.
*/ */
_resolveContentType: _resolveContentType:
function WCCR__resolveContentType(contentType) { function (contentType) {
if (contentType in this._mappings) if (contentType in this._mappings)
return this._mappings[contentType]; return this._mappings[contentType];
return contentType; return contentType;
@ -339,7 +339,7 @@ WebContentConverterRegistrar.prototype = {
}, },
_checkAndGetURI: _checkAndGetURI:
function WCCR_checkAndGetURI(aURIString, aContentWindow) function (aURIString, aContentWindow)
{ {
try { try {
let baseURI = aContentWindow.document.baseURIObject; let baseURI = aContentWindow.document.baseURIObject;
@ -382,7 +382,7 @@ WebContentConverterRegistrar.prototype = {
* @return true if it is already registered, false otherwise. * @return true if it is already registered, false otherwise.
*/ */
_protocolHandlerRegistered: _protocolHandlerRegistered:
function WCCR_protocolHandlerRegistered(aProtocol, aURITemplate) { function (aProtocol, aURITemplate) {
var eps = Cc["@mozilla.org/uriloader/external-protocol-service;1"]. var eps = Cc["@mozilla.org/uriloader/external-protocol-service;1"].
getService(Ci.nsIExternalProtocolService); getService(Ci.nsIExternalProtocolService);
var handlerInfo = eps.getProtocolHandlerInfo(aProtocol); var handlerInfo = eps.getProtocolHandlerInfo(aProtocol);
@ -401,7 +401,7 @@ WebContentConverterRegistrar.prototype = {
* See nsIWebContentHandlerRegistrar * See nsIWebContentHandlerRegistrar
*/ */
registerProtocolHandler: registerProtocolHandler:
function WCCR_registerProtocolHandler(aProtocol, aURIString, aTitle, aContentWindow) { function (aProtocol, aURIString, aTitle, aContentWindow) {
LOG("registerProtocolHandler(" + aProtocol + "," + aURIString + "," + aTitle + ")"); LOG("registerProtocolHandler(" + aProtocol + "," + aURIString + "," + aTitle + ")");
var uri = this._checkAndGetURI(aURIString, aContentWindow); var uri = this._checkAndGetURI(aURIString, aContentWindow);
@ -455,7 +455,7 @@ WebContentConverterRegistrar.prototype = {
protocolInfo: { protocol: aProtocol, uri: uri.spec, name: aTitle }, protocolInfo: { protocol: aProtocol, uri: uri.spec, name: aTitle },
callback: callback:
function WCCR_addProtocolHandlerButtonCallback(aNotification, aButtonInfo) { function (aNotification, aButtonInfo) {
var protocol = aButtonInfo.protocolInfo.protocol; var protocol = aButtonInfo.protocolInfo.protocol;
var uri = aButtonInfo.protocolInfo.uri; var uri = aButtonInfo.protocolInfo.uri;
var name = aButtonInfo.protocolInfo.name; var name = aButtonInfo.protocolInfo.name;
@ -496,7 +496,7 @@ WebContentConverterRegistrar.prototype = {
* prompt the user to confirm the registration. * prompt the user to confirm the registration.
*/ */
registerContentHandler: registerContentHandler:
function WCCR_registerContentHandler(aContentType, aURIString, aTitle, aContentWindow) { function (aContentType, aURIString, aTitle, aContentWindow) {
LOG("registerContentHandler(" + aContentType + "," + aURIString + "," + aTitle + ")"); LOG("registerContentHandler(" + aContentType + "," + aURIString + "," + aTitle + ")");
// Check against the type blacklist. // Check against the type blacklist.
@ -526,7 +526,7 @@ WebContentConverterRegistrar.prototype = {
* Returns the browser chrome window in which the content window is in * Returns the browser chrome window in which the content window is in
*/ */
_getBrowserWindowForContentWindow: _getBrowserWindowForContentWindow:
function WCCR__getBrowserWindowForContentWindow(aContentWindow) { function (aContentWindow) {
return aContentWindow.QueryInterface(Ci.nsIInterfaceRequestor) return aContentWindow.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIWebNavigation) .getInterface(Ci.nsIWebNavigation)
.QueryInterface(Ci.nsIDocShellTreeItem) .QueryInterface(Ci.nsIDocShellTreeItem)
@ -547,7 +547,7 @@ WebContentConverterRegistrar.prototype = {
* (i.e. the content window of a frame/iframe). * (i.e. the content window of a frame/iframe).
*/ */
_getBrowserForContentWindow: _getBrowserForContentWindow:
function WCCR__getBrowserForContentWindow(aBrowserWindow, aContentWindow) { function (aBrowserWindow, aContentWindow) {
// This depends on pseudo APIs of browser.js and tabbrowser.xml // This depends on pseudo APIs of browser.js and tabbrowser.xml
aContentWindow = aContentWindow.top; aContentWindow = aContentWindow.top;
var browsers = aBrowserWindow.gBrowser.browsers; var browsers = aBrowserWindow.gBrowser.browsers;
@ -579,7 +579,7 @@ WebContentConverterRegistrar.prototype = {
* @return true if a notification has been appended, false otherwise. * @return true if a notification has been appended, false otherwise.
*/ */
_appendFeedReaderNotification: _appendFeedReaderNotification:
function WCCR__appendFeedReaderNotification(aURI, aName, aNotificationBox) { function (aURI, aName, aNotificationBox) {
var uriSpec = aURI.spec; var uriSpec = aURI.spec;
var notificationValue = "feed reader notification: " + uriSpec; var notificationValue = "feed reader notification: " + uriSpec;
var notificationIcon = aURI.prePath + "/favicon.ico"; var notificationIcon = aURI.prePath + "/favicon.ico";
@ -603,7 +603,7 @@ WebContentConverterRegistrar.prototype = {
/* static */ /* static */
callback: callback:
function WCCR__addFeedReaderButtonCallback(aNotification, aButtonInfo) { function (aNotification, aButtonInfo) {
var uri = aButtonInfo.feedReaderInfo.uri; var uri = aButtonInfo.feedReaderInfo.uri;
var name = aButtonInfo.feedReaderInfo.name; var name = aButtonInfo.feedReaderInfo.name;
var outer = aButtonInfo._outer; var outer = aButtonInfo._outer;
@ -645,7 +645,7 @@ WebContentConverterRegistrar.prototype = {
* browser.contentHandlers.title0 = Foo 2.0alphr * browser.contentHandlers.title0 = Foo 2.0alphr
*/ */
_saveContentHandlerToPrefs: _saveContentHandlerToPrefs:
function WCCR__saveContentHandlerToPrefs(contentType, uri, title) { function (contentType, uri, title) {
var ps = var ps =
Cc["@mozilla.org/preferences-service;1"]. Cc["@mozilla.org/preferences-service;1"].
getService(Ci.nsIPrefService); getService(Ci.nsIPrefService);
@ -685,7 +685,7 @@ WebContentConverterRegistrar.prototype = {
* @param uri * @param uri
* The uri of the * The uri of the
*/ */
_typeIsRegistered: function WCCR__typeIsRegistered(contentType, uri) { _typeIsRegistered: function (contentType, uri) {
if (!(contentType in this._contentTypes)) if (!(contentType in this._contentTypes))
return false; return false;
@ -705,7 +705,7 @@ WebContentConverterRegistrar.prototype = {
* @returns A contract id to construct a converter to convert between the * @returns A contract id to construct a converter to convert between the
* contentType and *\/*. * contentType and *\/*.
*/ */
_getConverterContractID: function WCCR__getConverterContractID(contentType) { _getConverterContractID: function (contentType) {
const template = "@mozilla.org/streamconv;1?from=%s&to=*/*"; const template = "@mozilla.org/streamconv;1?from=%s&to=*/*";
return template.replace(/%s/, contentType); return template.replace(/%s/, contentType);
}, },
@ -721,7 +721,7 @@ WebContentConverterRegistrar.prototype = {
* the human readable name of the web service * the human readable name of the web service
*/ */
_registerContentHandler: _registerContentHandler:
function WCCR__registerContentHandler(contentType, uri, title) { function (contentType, uri, title) {
this._updateContentTypeHandlerMap(contentType, uri, title); this._updateContentTypeHandlerMap(contentType, uri, title);
this._saveContentHandlerToPrefs(contentType, uri, title); this._saveContentHandlerToPrefs(contentType, uri, title);
@ -754,7 +754,7 @@ WebContentConverterRegistrar.prototype = {
* The human readable name of the web service * The human readable name of the web service
*/ */
_updateContentTypeHandlerMap: _updateContentTypeHandlerMap:
function WCCR__updateContentTypeHandlerMap(contentType, uri, title) { function (contentType, uri, title) {
if (!(contentType in this._contentTypes)) if (!(contentType in this._contentTypes))
this._contentTypes[contentType] = []; this._contentTypes[contentType] = [];
@ -776,7 +776,7 @@ WebContentConverterRegistrar.prototype = {
* See nsIWebContentConverterService * See nsIWebContentConverterService
*/ */
getContentHandlers: getContentHandlers:
function WCCR_getContentHandlers(contentType, countRef) { function (contentType, countRef) {
countRef.value = 0; countRef.value = 0;
if (!(contentType in this._contentTypes)) if (!(contentType in this._contentTypes))
return []; return [];
@ -790,7 +790,7 @@ WebContentConverterRegistrar.prototype = {
* See nsIWebContentConverterService * See nsIWebContentConverterService
*/ */
resetHandlersForType: resetHandlersForType:
function WCCR_resetHandlersForType(contentType) { function (contentType) {
// currently unused within the tree, so only useful for extensions; previous // currently unused within the tree, so only useful for extensions; previous
// impl. was buggy (and even infinite-looped!), so I argue that this is a // impl. was buggy (and even infinite-looped!), so I argue that this is a
// definite improvement // definite improvement
@ -833,7 +833,7 @@ WebContentConverterRegistrar.prototype = {
* Load the auto handler, content handler and protocol tables from * Load the auto handler, content handler and protocol tables from
* preferences. * preferences.
*/ */
_init: function WCCR__init() { _init: function () {
var ps = var ps =
Cc["@mozilla.org/preferences-service;1"]. Cc["@mozilla.org/preferences-service;1"].
getService(Ci.nsIPrefService); getService(Ci.nsIPrefService);
@ -883,7 +883,7 @@ WebContentConverterRegistrar.prototype = {
/** /**
* See nsIObserver * See nsIObserver
*/ */
observe: function WCCR_observe(subject, topic, data) { observe: function (subject, topic, data) {
var os = var os =
Cc["@mozilla.org/observer-service;1"]. Cc["@mozilla.org/observer-service;1"].
getService(Ci.nsIObserverService); getService(Ci.nsIObserverService);
@ -901,7 +901,7 @@ WebContentConverterRegistrar.prototype = {
/** /**
* See nsIFactory * See nsIFactory
*/ */
createInstance: function WCCR_createInstance(outer, iid) { createInstance: function (outer, iid) {
if (outer != null) if (outer != null)
throw Cr.NS_ERROR_NO_AGGREGATION; throw Cr.NS_ERROR_NO_AGGREGATION;
return this.QueryInterface(iid); return this.QueryInterface(iid);

View file

@ -9,15 +9,15 @@ var SubscribeHandler = {
*/ */
_feedWriter: null, _feedWriter: null,
init: function SH_init() { init: function () {
this._feedWriter = new BrowserFeedWriter(); this._feedWriter = new BrowserFeedWriter();
}, },
writeContent: function SH_writeContent() { writeContent: function () {
this._feedWriter.writeContent(); this._feedWriter.writeContent();
}, },
uninit: function SH_uninit() { uninit: function () {
this._feedWriter.close(); this._feedWriter.close();
} }
}; };