Making Firefox use Thunderbird for web feeds

I was saving this tip for today, because it’s a bit of a Christmas present, courtesy of alta88.

Users of both Firefox and Thunderbird may have noticed that when you get the feed preview screen in Firefox 2, and use the drop-down list to add the feed to Thunderbird, it does not work. There are bugs filed for this. One that I know of, is bug 350735.

To make it work, you’ll need to close Firefox, and go into the \components\ folder, in the Firefox program directory. (eg. C:\Program Files\Mozilla Firefox\components ), and open the file FeedConverter.js in a text editor. You had better make a backup of it first. Because of the line breaks, Notepad won’t work; but Wordpad will work.

At around line 332, you’ll see text that looks like:

case "client":
var clientApp =
prefs.getComplexValue(PREF_SELECTED_APP, Ci.nsILocalFile);
//@line 393 "/cygdrive/c/builds/tinderbox/Fx-Mozilla1.8-release/WINNT_5.2_Depend/mozilla/browser/components/feeds/src/FeedConverter.js"
var ss =
Cc["@mozilla.org/browser/shell-service;1"].
getService(Ci.nsIShellService_MOZILLA_1_8_BRANCH);
ss.openApplicationWithURI(clientApp, spec);
break;

Replace that (select, copy, paste) with:

case "client":
const PREF_SELECTED_APP_ARGS = "browser.feeds.handlers.application.args";
const PREF_SELECTED_APP_URIPREFIX = "browser.feeds.handlers.application.uriPrefix";

var clientApp = prefs.getComplexValue(PREF_SELECTED_APP, Ci.nsILocalFile);
var feedhandlerArgs = safeGetCharPref(PREF_SELECTED_APP_ARGS, Ci.nsIILocalFile);
var uriPrefix = safeGetCharPref(PREF_SELECTED_APP_URIPREFIX, Ci.nsIILocalFile);

var file = Cc["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile);
file.initWithPath(clientApp.persistentDescriptor);
var process = Cc["@mozilla.org/process/util;1"].createInstance(Components.interfaces.nsIProcess);
process.init(file);

if (uriPrefix) spec = uriPrefix + spec;
if (feedhandlerArgs)
var args = [feedhandlerArgs, spec];
else
var args = [spec];

process.run(false, args, args.length);
break;

Save and close FeedConverter.js.

Next, open Firefox and use about:config to add the following preferences:
Add the String preference browser.feeds.handlers.application.args.
Set the value to -mail.
Add the String preference browser.feeds.handlers.application.uriPrefix.
Set the value to feed:. (Include the colon.)

Enjoy, and have a merry Christmas. 🙂

17 Replies to “Making Firefox use Thunderbird for web feeds”

  1. You want to leave
    switch (handler) {
    in place and not replace it with the substitute text. Otherwise Firefox complains it doesn’t have an application to handle feeds: and the error console points to the line
    case “client”

  2. How do use Thunderbird from WITHIN Firefox 3.0. I was able to in earlier Firefox.

    Thanks Kenneth

  3. Those who made it to this page looking for a similar solution for Firefox 3 (as I did) may find this hack useful… be warned that it’s nowhere near as polished as the above, and not very extensively tested, but I did successfully use it to add a feed in Thunderbird. 🙂 Around line 392, look for…
    case “client”:
    var clientApp = prefs.getComplexValue(getPrefAppForType(feedType), Ci.nsILocalFile);

    // For the benefit of applications that might know how to deal with more
    // URLs than just feeds, send feed: URLs in the following format:
    //
    // http urls: replace scheme with feed, e.g.
    // http://foo.com/index.rdf -> feed://foo.com/index.rdf
    // other urls: prepend feed: scheme, e.g.
    // https://foo.com/index.rdf -> feed:https://foo.com/index.rdf
    var ios =
    Cc[“@mozilla.org/network/io-service;1”].
    getService(Ci.nsIIOService);
    var feedURI = ios.newURI(spec, null, null);
    if (feedURI.schemeIs(“http”)) {
    feedURI.scheme = “feed”;
    spec = feedURI.spec;
    }
    else
    spec = “feed:” + spec;

    var ss =
    Cc[“@mozilla.org/browser/shell-service;1”].
    getService(Ci.nsIShellService);
    ss.openApplicationWithURI(clientApp, spec);
    break;

    And replace with…
    case “client”:
    var clientApp = prefs.getComplexValue(getPrefAppForType(feedType), Ci.nsILocalFile);
    // next five lines are new
    var feedhandlerArgs = safeGetCharPref(“browser.feeds.handlers.application.args”, Ci.nsIILocalFile);
    var file = Cc[“@mozilla.org/file/local;1”].createInstance(Components.interfaces.nsILocalFile);
    file.initWithPath(clientApp.persistentDescriptor);
    var process = Cc[“@mozilla.org/process/util;1”].createInstance(Components.interfaces.nsIProcess);
    process.init(file);

    // For the benefit of applications that might know how to deal with more
    // URLs than just feeds, send feed: URLs in the following format:
    //
    // http urls: replace scheme with feed, e.g.
    // http://foo.com/index.rdf -> feed://foo.com/index.rdf
    // other urls: prepend feed: scheme, e.g.
    // https://foo.com/index.rdf -> feed:https://foo.com/index.rdf
    //var ios =
    // Cc[“@mozilla.org/network/io-service;1”].
    // getService(Ci.nsIIOService);
    //var feedURI = ios.newURI(spec, null, null);
    //if (feedURI.schemeIs(“http”)) {
    // feedURI.scheme = “feed”;
    // spec = feedURI.spec;
    //}
    //else
    spec = “feed:” + spec;
    // next four lines are new
    if (feedhandlerArgs)
    var args = [feedhandlerArgs, spec];
    else
    var args = [spec];

    //var ss =
    // Cc[“@mozilla.org/browser/shell-service;1”].
    // getService(Ci.nsIShellService);
    //ss.openApplicationWithURI(clientApp, spec);
    process.run(false, args, args.length);
    break;

    It can probably be done much more robustly, but it seems to work for the stated purpose. Enjoy!

  4. Hi,

    i have tried the Michale Staib’s (previous post) method for Firefox 3 but it doesn’t work for me… When i click the RSS icon in the address bar an error window appears with this message:

    “Firefox doesn’t know how to open this address, because the protocol (feed) isn’t associated with any programhael”

    Any idea?

  5. Great! Woo!
    I agree with you!

    Thank you for sharing this with us.

Comments are closed.