Firefox 如何编程xulrunner应用程序以显示输出文件或命令行?

Firefox 如何编程xulrunner应用程序以显示输出文件或命令行?,firefox,add-on,xulrunner,Firefox,Add On,Xulrunner,我的问题是对这篇文章的回应 我已经下载并配置了xulrunner,这是我运行链接中给出的javascript以显示其输出的唯一问题。使用xulrunner,我想知道如何以无头命令行程序而不是gui的形式生成输出 var httpRequest = Components.classes["@mozilla.org/xmlextr/xmlhttprequest;1"].createInstance(); // Disable alert popups on SSL error

我的问题是对这篇文章的回应

我已经下载并配置了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,有些帮助对我很有帮助。

要在控制台上打印内容,请使用。如果代码在窗口上下文中运行,则需要将
browser.dom.window.dump.enabled
首选项更改为
true
。XPCOM组件只需调用
dump()
,而无需更改此首选项