新規タブを、リンクから開く場合は右隣に、それ以外は右端に作成。

まだまだ未完成。
何から呼ばれるか判断するいい方法が分からないので addTab を呼ぶ関数の名前で判断している。
これだとかなり環境に依存するし、全然スマートじゃない。(´Д`;)
TMP を使っていることが前提だし、外部アプリから呼ばれた場合の判別ができない。

他にいい判別方法がないでしょうか・・・。

(function TailNewTab(){

  function is_not_from_link(the_method, the_uri)
    {
      // for debug
      if(typeof the_method.caller.caller.name != 'undefined' &&
         typeof the_method.caller.name != 'undefined'){
        dump("\n**** " + the_method.caller.caller.name + ">");
        dump(the_method.caller.name + ">" + the_uri + "\n");
      }

      var ret = (
        (the_uri == "about:blank") ||                        // 外部呼び出し
        (the_method.caller.caller.name == "openUILinkIn") || // 履歴、ブックマーク
        (the_method.caller.name == "__TMP_LoadBarURL")       // URLバー、検索バー
        );
      return ret;
    }

  gBrowser.__addTabOriginal    = gBrowser.addTab;
  gBrowser.addTab = function(aURI, aReferrerURI, aCharset, aPostData,
                                          aOwner, aAllowThirdPartyFixup)
    {
      var oldTabPos = this.mCurrentTab._tPos;
      var t = this.__addTabOriginal(aURI, aReferrerURI, aCharset, aPostData,
                                          aOwner, aAllowThirdPartyFixup);
      if (is_not_from_link(this.addTab, aURI)){
        this.moveTabTo(t, this.mTabs.length-1);
      }else{
        this.moveTabTo(t, oldTabPos + 1);
      }
      return t;
    };
})();