如何签署需要 UniversalXPConnect 权限的脚本或网页
我有一个网站,它使用我开发的 Firefox 扩展中实现的一些功能。我的网页之一上的 JavaScript 脚本需要 UniversalXPConnect 权限才能与我的 Firefox 扩展中实现的 XPCOM 组件进行通信。
默认情况下,当我的脚本尝试启用此权限来访问 XPCOM 组件时:
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
...发生以下错误:
错误:来自“http://example.com”的脚本被拒绝 UniversalXPConnect 权限。
要启用此权限,当前用户需要在“about:config”Firefox 页面中手动编辑“signed.applets.codebase_principal_support”设置。
从此页面: http://www.mozilla.org/projects/ security/components/signed-scripts.html 我了解到可以对包含需要此权限的脚本的网页进行显式签名。在我签署脚本后,用户将不需要手动编辑上述设置。
网站托管在 Drupal CMS 下的 Linux 平台上。
如果您能为我提供有关如何签署脚本的详细分步说明(我应该下载哪些工具、如何创建证书等),我将非常感激,以便在按照您的说明编辑 about:config 后不需要设置。
I have a website which uses some functionality implemented in the Firefox extension, which I developed. JavaScript script on one of my webpages requires UniversalXPConnect privilege for communicating with XPCOM component implemented in my Firefox extension.
By default, when my script tries to enable this privilege for accessing XPCOM component:
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
... the following error occurs:
Error: A script from "http://example.com" was denied UniversalXPConnect privileges.
To enable this privilege currently users need to manually edit "signed.applets.codebase_principal_support" setting in "about:config" Firefox page.
From this page: http://www.mozilla.org/projects/security/components/signed-scripts.html I learned that it is possible to explicitly sign my webpage containing script which requires this privilege. After I sign my script users will not need to manually edit above mentioned setting.
Website is hosted on Linux platform under Drupal CMS.
I would very much appreciate if you could give me detailed step-by-step instructions on how do I sign my script (what tools should I download, how to create certificate, etc.), such that after following your instructions editing about:config setting will not be necessary.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
从 Firefox 16 开始,该脚本签名不太可能起作用,因为对 universalXPconnect 的支持似乎已被删除,您现在应该使用附加组件来添加权限,尽管我不知道如何操作。 https://bugzilla.mozilla.org/show_bug.cgi?id=546848
As of Firefox 16 signing the script will not likely work since support for universalXPconnect seems to have been removed and you should now use an add-on for added privileges although I don't know how. https://bugzilla.mozilla.org/show_bug.cgi?id=546848
EnablePrivilege 在 Firefox 15 中被禁用,并将在 Firefox 17 中被删除。
查看以下内容:
https:// /developer.mozilla.org/en-US/docs/Bypassing_Security_Restrictions_and_Signing_Code
EnablePrivilege is disabled in Firefox 15 and will be removed in Firefox 17.
check out this:
https://developer.mozilla.org/en-US/docs/Bypassing_Security_Restrictions_and_Signing_Code