是否可以将 Firefox 插件从 XPI 解码为 XUL?

发布于 2024-11-04 02:33:05 字数 104 浏览 7 评论 0原文

是否可以将 Firefox 插件从 XPI 绑定格式解码为本机语言 XUL?

我只是想学习如何制作插件。所以,我想如果我可以解码 Firefox 插件,那么我就可以学习插件架构!

Is it possible to decode a firefox addon from the XPI binding format to the native language XUL?

I am just trying to learn how to make a addon. So, I think if I can decode a Firefox addon then I can learn addon architecture!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(3

少年亿悲伤 2024-11-11 02:33:05

XPI 只是一个 ZIP 文件,因此您可以提取其内容并读取文件...

XPI is simply put a ZIP file, so you can just extract its contents and read the files...

夕嗳→ 2024-11-11 02:33:05

您想要查看的大部分代码都位于扩展程序的 chrome 目录中,通常位于 jar 文件中。您所需要的只是一个可以提取 zip 文件的文件提取器。解压 xpi(它只是一个带有 xpi 扩展名的 zip 文件)后,打开 chrome 子文件夹并查看其中的内容。如果它是 jar 文件,请提取其内容(.jar 文件也只是具有不同扩展名的 zip 文件)。从那里,可能有一个内容文件夹,其中应该包含大部分 xul、css、js 等。

Most of the code that you will want to look at is in the extension's chrome directory, usually in a jar file. All you need is a file extractor that can extract zip files. Once you extract the xpi (it's just a zip file with an xpi extension), open the chrome subfolder and see what's there. If it's a jar file, extract it's contents (.jar files are also just zip files with a different extension). From there, there's probably a content folder, which should have most of the xul, css, js, etc.

向日葵 2024-11-11 02:33:05

刚刚了解到还有 xpi-unpack 和相应的 < Ubuntu 中的 code>xpi-pack(通过 sudo apt-get install mozilla-devscripts);似乎考虑了 .xpi 和包含的 .jar 文件的解压。

干杯!

编辑:但是请注意,您可能会遇到 xpi-unpack 的权限问题;这是我的一个示例命令行日志:

user@PC:Desktop$ xpi-unpack colt.xpi colt-dir
Unpacking colt.xpi
Unpacking ./chrome/colt.jar
Unpacked xpi file.
user@PC:Desktop$ ls -la colt-dir/chrome/colt.jar\!/
total 16
drwxr-xr-x  4 user user 4096 2011-07-05 09:52 .
drwxr-xr-x  3 user user 4096 2011-07-05 09:52 ..
d---------  2 user user 4096 2010-09-12 05:15 content
d--------- 25 user user 4096 2011-01-08 17:08 locale

user@PC:Desktop$ stat -c '%n %a' colt-dir/chrome/colt.jar\!/
colt-dir/chrome/colt.jar!/ 755
user@PC:Desktop$ stat -c '%n %a' colt-dir/chrome/colt.jar\!/content/
colt-dir/chrome/colt.jar!/content/ 0

user@PC:Desktop$ sudo chmod -R 755 colt-dir/chrome/colt.jar\!/ 

user@PC:Desktop$ ls -la colt-dir/chrome/colt.jar\!/
total 16
drwxr-xr-x  4 user user 4096 2011-07-05 09:52 .
drwxr-xr-x  3 user user 4096 2011-07-05 09:52 ..
drwxr-xr-x  2 user user 4096 2010-09-12 05:15 content
drwxr-xr-x 25 user user 4096 2011-01-08 17:08 locale

EDIT2:实际上,事实证明其他文件也可能缺乏权限:

user@PC:Desktop$ ls -la colt-dir/
total 28
drwxr-xr-x 4 user user 4096 2011-07-05 09:52 .
drwxr-xr-x 5 user user 4096 2011-07-05 10:04 ..
drwxr-xr-x 3 user user 4096 2011-07-05 10:04 chrome
---------- 1 user user 1337 2011-06-23 00:05 chrome.manifest
drwxr-xr-x 3 user user 4096 2011-07-05 09:52 defaults
---------- 1 user user 1969 2011-06-23 00:05 install.rdf
---------- 1 user user 1275 2010-09-12 05:04 LICENSE.txt
user@PC:Desktop$ stat -c '%n %a' colt-dir/install.rdf 
colt-dir/install.rdf 0

...所以最好在尝试之前 chmod 所有内容: sudo chmod -R 755 colt-dir/进行更改并打包(如xpi-pack colt-dir colt-2.xpi

Just learned there is also xpi-unpack and corresponding xpi-pack in Ubuntu (via sudo apt-get install mozilla-devscripts); seems to take unpacking of both .xpi and included .jar files into account..

Cheers!

Edit: note however, you may have permission problems with xpi-unpack; here's an example command line log I had:

user@PC:Desktop$ xpi-unpack colt.xpi colt-dir
Unpacking colt.xpi
Unpacking ./chrome/colt.jar
Unpacked xpi file.
user@PC:Desktop$ ls -la colt-dir/chrome/colt.jar\!/
total 16
drwxr-xr-x  4 user user 4096 2011-07-05 09:52 .
drwxr-xr-x  3 user user 4096 2011-07-05 09:52 ..
d---------  2 user user 4096 2010-09-12 05:15 content
d--------- 25 user user 4096 2011-01-08 17:08 locale

user@PC:Desktop$ stat -c '%n %a' colt-dir/chrome/colt.jar\!/
colt-dir/chrome/colt.jar!/ 755
user@PC:Desktop$ stat -c '%n %a' colt-dir/chrome/colt.jar\!/content/
colt-dir/chrome/colt.jar!/content/ 0

user@PC:Desktop$ sudo chmod -R 755 colt-dir/chrome/colt.jar\!/ 

user@PC:Desktop$ ls -la colt-dir/chrome/colt.jar\!/
total 16
drwxr-xr-x  4 user user 4096 2011-07-05 09:52 .
drwxr-xr-x  3 user user 4096 2011-07-05 09:52 ..
drwxr-xr-x  2 user user 4096 2010-09-12 05:15 content
drwxr-xr-x 25 user user 4096 2011-01-08 17:08 locale

EDIT2: Actually, turns out other files may be lacking permissions too:

user@PC:Desktop$ ls -la colt-dir/
total 28
drwxr-xr-x 4 user user 4096 2011-07-05 09:52 .
drwxr-xr-x 5 user user 4096 2011-07-05 10:04 ..
drwxr-xr-x 3 user user 4096 2011-07-05 10:04 chrome
---------- 1 user user 1337 2011-06-23 00:05 chrome.manifest
drwxr-xr-x 3 user user 4096 2011-07-05 09:52 defaults
---------- 1 user user 1969 2011-06-23 00:05 install.rdf
---------- 1 user user 1275 2010-09-12 05:04 LICENSE.txt
user@PC:Desktop$ stat -c '%n %a' colt-dir/install.rdf 
colt-dir/install.rdf 0

... so best to chmod everything: sudo chmod -R 755 colt-dir/ before trying to make changes and pack (as in xpi-pack colt-dir colt-2.xpi)

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