ネットワーク

XMLHttpRequest

サーバへのリクエストはXMLHttpRequestで行えます。この方法はWebページ上からリクエストするときは同一起源ポリシーの制約を受けますが、アドオンからは任意のサーバへリクエストできます

パフォーマンスへの悪影響を抑えるため、XMLHttpRequestは必ず非同期モードで使用します。その他の推奨事項 - Appendix A: Add-on Performance - XUL | MDN

GET

var xmlHttpRequest = new XMLHttpRequest();
xmlHttpRequest.onreadystatechange = function()
{
    if( this.readyState == 4 && this.status == 200 )
    {
        // this.responseText;
    }
}

xmlHttpRequest.open( 'GET', 'http://example.com?a=1&b=2', true );
xmlHttpRequest.send( null );

POST

var xmlHttpRequest = new XMLHttpRequest();
xmlHttpRequest.onreadystatechange = function()
{
    if( this.readyState == 4 && this.status == 200 )
    {
        // this.responseText;
    }
}

xmlHttpRequest.open( 'POST', 'http://example.com', true );
xmlHttpRequest.setRequestHeader( 'Content-Type', 'application/x-www-form-urlencoded' );
xmlHttpRequest.send( 'a=1&b=2' );
Firefoxアドオンの情報サイトから、まとめて検索