组件返回失败代码:0x80070057 (NS_ERROR_ILLEGAL_VALUE) [nsIDOMEventTarget.dispatchEvent]
我对 javascript 很陌生,所以请原谅我的无知。
我目前正在使用 SWFAddress 为 Flex 应用程序构建深度链接。问题是浏览器历史记录功能在 IE9 中不起作用。
我想解决这个问题,而且看起来这应该不是什么难事。
当我在 Firefox 中调试脚本时,收到此错误消息:
Component returned failure code: 0x80070057 (NS_ERROR_ILLEGAL_VALUE) [nsIDOMEventTarget.dispatchEvent]
this.dispatchEvent(new SWFAddressEvent(type));
这指出这段代码是罪魁祸首:
_dispatch = function(type) {
this.dispatchEvent(new SWFAddressEvent(type));
type = type.substr(0, 1).toUpperCase() + type.substr(1);
if(typeof this['on' + type] == FUNCTION)
this['on' + type]();
},
我已检查并确认 SWFAddressEvent 对象已正确实例化,没有任何问题。
问题似乎就在这里:
this.dispatchEvent = function(event) {
console.log(event);
if (this.hasEventListener(event.type)) {
console.log(event);
event.target = this;
for (var i = 0, l; l = _listeners[event.type][i]; i++)
l(event);
return TRUE;
}
return FALSE;
};
似乎由于某种原因,dispatchEvent
没有收到创建的SWFAddressEvent
。
有人可以解释该错误消息的含义吗?为什么当页面首次加载时,它能够正确调度 3 个事件,但是当涉及调度更多事件时,它似乎失败了?
I am very new to javascript, so forgive me for my ignorance.
I am currently using SWFAddress to build deeplinking for a flex application. The problem is that the browser history functionality does not work in IE9.
I would like to fix that, and it seems like it shouldn't be a difficult fix.
When I debug the script in firefox, I get this error message:
Component returned failure code: 0x80070057 (NS_ERROR_ILLEGAL_VALUE) [nsIDOMEventTarget.dispatchEvent]
this.dispatchEvent(new SWFAddressEvent(type));
This points to this bit of code as the culprit:
_dispatch = function(type) {
this.dispatchEvent(new SWFAddressEvent(type));
type = type.substr(0, 1).toUpperCase() + type.substr(1);
if(typeof this['on' + type] == FUNCTION)
this['on' + type]();
},
I have checked and confirmed that the SWFAddressEvent object is instantiated correctly without any problems.
The problem seems to lie here:
this.dispatchEvent = function(event) {
console.log(event);
if (this.hasEventListener(event.type)) {
console.log(event);
event.target = this;
for (var i = 0, l; l = _listeners[event.type][i]; i++)
l(event);
return TRUE;
}
return FALSE;
};
It seems that for some reason, dispatchEvent
does not receive the SWFAddressEvent
that was created.
Can someone explain what that error message means? And why is it that when the page first loads, it is able to dispatch 3 events properly, but when it comes to dispatching further events, it seems to fail?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在我看来,问题在于对
this
的引用:这部分是在事件处理程序中执行的,因此这不是
SWFAddress
,而是Window
>。我用
SWFAddress.dispatchEvent(new SWFAddressEvent(type));
替换它并修复了它 - 悬停我不是 JS 专家。前三个事件的生成方式与创建 NS_ERROR_ILLEGAL_VALUE 的方式不同。
It seems to me that the problem is the reference to
this
in:This part is executed in an event handler so this is not
SWFAddress
, butWindow
.I replaced it with
SWFAddress.dispatchEvent(new SWFAddressEvent(type));
and that fixed it - hover I am not a JS expert.The first three event are generated in a different way than the one that creates
NS_ERROR_ILLEGAL_VALUE
.