组件返回失败代码:0x80070057 (NS_ERROR_ILLEGAL_VALUE) [nsIDOMEventTarget.dispatchEvent]

发布于 2024-12-10 20:56:46 字数 1242 浏览 0 评论 0原文

我对 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

尐籹人 2024-12-17 20:56:46

在我看来,问题在于对 this 的引用:

this.dispatchEvent(new SWFAddressEvent(type));

这部分是在事件处理程序中执行的,因此这不是 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.dispatchEvent(new SWFAddressEvent(type));

This part is executed in an event handler so this is not SWFAddress, but Window.

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文