2012-01-25 60 views
0

我的問題是在迴應這篇文章 https://developer.mozilla.org/En/How_to_check_the_security_state_of_an_XMLHTTPRequest_over_SSL如何編寫xulrunner應用程序來顯示輸出文件或命令行?

我已經下載並配置了xulrunner的我越來越運行中的鏈接給JavaScript來顯示其輸出的唯一問題。使用xulrunner我想知道如何產生一個輸出作爲無標題的命令行程序而不是gui。

var httpRequest = Components.classes["@mozilla.org/xmlextr/xmlhttprequest;1"].createInstance(); 
    // Disable alert popups on SSL error 
    httpRequest.mozBackgroundRequest = true; 
    httpRequest.open("GET", "https://developer.mozilla.org/", true); 
    httpRequest.onreadystatechange = function (aEvt) { 
    if (httpRequest.readyState == 4) { 
// Print security state of request 
    dumpSecurityInfo(httpRequest.channel); 
} 
    }; 

    httpRequest.send(null); 

從我希望看到我的命令的屏幕,甚至是寫入文件會做信息的函數的輸出相同的鏈接採取上面的代碼。

我必須改變* .xul文件擴展名中的內容。我是使用xulrunner的新手,一些幫助對我很有幫助。

回答

0

要打印某些東西到控制檯,請使用dump() function。如果您的代碼在窗口的上下文中運行,則需要將browser.dom.window.dump.enabled首選項更改爲true。 XPCOM組件可以簡單地調用dump()而不更改此偏好。

相關問題