2012-01-25 34 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()而不更改此偏好。

相关问题