Firefox插件 - 无法触发任何类型的点击事件 [英] Firefox addon - cannot trigger click event of any kind

查看:137
本文介绍了Firefox插件 - 无法触发任何类型的点击事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用一个Firefox自动插件,它会自动 填充登录表单字段和登录名。我有权访问的内容可以是id的类或xpath到登录按钮的任何内容,具体取决于网站的内容。捕获的优先级通常是id的存在。不会触发点击的具体网站是: https:// login.paylocity.com/escher/escher_webui/views/login/login.aspx

我试过使用 $(element)。触发('点击') $(元素).click(),它们都不会自动触发点击。在控制台日志中的错误显示:
$ b


XrayWrapper拒绝访问属性被调用者(原因:值是可调用的)。请参阅 https://developer.mozilla.org/en-US/docs/Xray_vision获取更多信息。请注意,只有第一个被拒绝的属性访问将被报告。

可以触发吗?一个链接的(或任何元素的)点击事件通过JavaScript?
这也不起作用。

解决方案


XrayWrapper拒绝访问属性callee


这表明脚本运行在比页面内容本身具有更高权限的环境中,这反过来导致一些安全障碍(


$ b


$而不是使用jquery,你可以尝试手动合成一个DOM事件并触发它,可能通过访问不安全的窗口。 b $ b

new window.wrappedJSObject.MouseEvent(click),与 dispatchEvent()

另外,您也可以尝试在表单上触发提交事件而不是点击事件。



另一个应用程序roach是通过
.callee rel = nofollow>移植调用函数到内容窗口。


I am working on a firefox addon that will automatically populate the login form fields and login. What I have access to could be anything from id's classes' or the xpath to the login button depending on what the website gives. The priority captured will usually be id's if they exist. The specific website that won't trigger the click is: https://login.paylocity.com/escher/escher_webui/views/login/login.aspx

I tried using $(element).trigger('click') or $(element).click() and they both don't trigger the click automatically. The error in the console log shows:

XrayWrapper denied access to property callee (reason: value is callable). See https://developer.mozilla.org/en-US/docs/Xray_vision for more information. Note that only the first denied property access from a given global object will be reported.

I also tried the Javascript method shown here: Is it possible to trigger a link's (or any element's) click event through JavaScript? That doesn't work either.

解决方案

XrayWrapper denied access to property callee

This suggests that the script is running in an environment that has higher privileges than the page content itself, which in turn results in some security barriers (the xray wrappers in one direction, access denied errors in the other) since the caller now is partially privileged code which content is not allowed to access.

Instead of using jquery you could try manually synthesizing a DOM event and firing it, possibly by accessing the unsafe window.

Something along the lines of new window.wrappedJSObject.MouseEvent("click"), same for dispatchEvent().

Alternatively you could also try firing a submit event on the form instead of a click event.

Yet another approach is to make .callee accessible by transplanting the calling function into the content window.

这篇关于Firefox插件 - 无法触发任何类型的点击事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆