XULRunner 下的 javascript 服务器失败
我正在尝试调试名为 crowbar 的 DOM 抓取打包。 不管怎样,当我跑步时我得到:
错误:[异常...“组件返回失败代码:0xc1f30001(NS_ERROR_NOT_INITIALIZED)[nsIServerSocket.asyncListen]”nsresult:“0xc1f30001(NS_ERROR_NOT_INITIALIZED)”位置:“JS框架:: chrome://crowbar/content/crowbar .js :: onLoad :: 第 375 行数据:否]
源文件:chrome://crowbar/content/crowbar.js
线路:375
基本上,asyncListen()
抛出NS_ERROR_NOT_INITIALIZED
。 这很奇怪,因为紧接在此之前的代码行是对 init()
的调用! 我尝试
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
在调用 asyncListen()
之前添加: 但没有效果。 这是安全问题吗? (顺便说一句,以防万一,这是在 Fedora 机器上,以 root 身份运行,禁用了 selinux)...我还尝试了一些不同的端口号...
I'm trying to debug a DOM scraping packaged called crowbar. Anyhow, when I run I get:
Error: [Exception... "Component returned failure code: 0xc1f30001 (NS_ERROR_NOT_INITIALIZED) [nsIServerSocket.asyncListen]" nsresult: "0xc1f30001 (NS_ERROR_NOT_INITIALIZED)" location: "JS frame :: chrome://crowbar/content/crowbar.js :: onLoad :: line 375" data: no]
Source File: chrome://crowbar/content/crowbar.js
Line: 375
Basically, asyncListen()
is throwing NS_ERROR_NOT_INITIALIZED
. This is weird because the line of code immediately before this is a call to init()
! I've tried adding:
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
just before the call to asyncListen()
and it had no effect. Is this a security issue? (btw, in case it matters, this is on a Fedora box, running as root, with selinux disabled)... I've also tried a few different port numbers...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这是源代码: http://mxr .mozilla.org/mozilla-central/source/netwerk/base/src/nsServerSocket.cpp#369
你确定
init()
不会失败吗(这就是初始化mFD )? 也许在你打电话之前有什么事情
关闭
?我会 构建一个调试 XULRunner 来构建调试版本和/或尝试获取日志记录应用程序的输出。 不幸的是,我无法弄清楚该代码中的
LOG()
宏解析为什么,通常是 NSPR 日志记录,但您必须猜测模块名称才能启用此模块的日志记录。Boris Zbarsky(mozilla 核心开发人员之一)说:
Here's the source code: http://mxr.mozilla.org/mozilla-central/source/netwerk/base/src/nsServerSocket.cpp#369
Are you sure
init()
doesn't fail (that's what initializesmFD
)? Maybe somethingclose
s it before your call?I would build a debug XULRunner to build a debug version and/or try to get logging output from the app. Unfortunately, I can't figure out what the
LOG()
macro in that code resolves to, usually it's NSPR logging, but you have to guess the module name in order to enable logging for this module.Boris Zbarsky (one mozilla core developers) says:
我也面临这个问题。 我从 CrowBar 派生了我的代码,并通过 Win 7 上的 xulrunner 1.9.1 运行它。
当我与网络断开连接时,我遇到了问题。 如果我在网络上,它就可以工作。 我确实有多个线程 [多个 xul 元素]。 但我相信我正在主线程上运行它(虽然我不确定如何找到当前线程),所以线程不监听不应该是问题。
我还注意到,在 nsSocketTransportService2.cpp 中,线程变为空,所以鲍里斯也许是对的。
希望这有助于确定问题。
谢谢
哈温德
I am too facing this problem. I have derived my code from CrowBar and running it through xulrunner 1.9.1 on Win 7.
I get the problem when I am diconnected from the net. If I am on a network it works. I do have multiple threads [multiple xul elements ]. But I belive I am running it on main thread (I am not sure how I can find current thread though), so thread not listening should not be the issue.
Also I have noted that in nsSocketTransportService2.cpp thread becomes null, so Boris maybe right.
Hope this helps pin down the problem.
thanks
harvinder