Firefox 扩展中的 JAR 方案
我正在阅读有关 Firefox 扩展的教程,其中一个重要文件是 chrome.manifest 看起来像这样:
content xulschoolhello jar:chrome/xulschoolhello.jar!/content/
skin xulschoolhello classic/1.0 jar:chrome/xulschoolhello.jar!/skin/unix/
skin xulschoolhello classic/1.0 jar:chrome/xulschoolhello.jar!/skin/mac/ os=Darwin
skin xulschoolhello classic/1.0 jar:chrome/xulschoolhello.jar!/skin/win/ os=WinNT
locale xulschoolhello en-US jar:chrome/xulschoolhello.jar!/locale/en-US/
该文件的一部分是一个 jar 方案,这是这个问题的核心。我对该方案的规范(语义)和作用感兴趣。在上面的教程中只写了:
它告诉 Firefox 查找 JAR 文件并从正确的路径读取文件。
当我寻找有关此方案的更多信息时,我只发现了与Java编程语言但不涉及与Firefox扩展相关的东西。
您能更深入地解释一下这个方案吗?
(我也用 jar
标记了它,但如果这是不同的东西,我会重新标记它)
谢谢
I'm reading a tutorial about Firefox extensions and one of the important files is chrome.manifest
which looks like this:
content xulschoolhello jar:chrome/xulschoolhello.jar!/content/
skin xulschoolhello classic/1.0 jar:chrome/xulschoolhello.jar!/skin/unix/
skin xulschoolhello classic/1.0 jar:chrome/xulschoolhello.jar!/skin/mac/ os=Darwin
skin xulschoolhello classic/1.0 jar:chrome/xulschoolhello.jar!/skin/win/ os=WinNT
locale xulschoolhello en-US jar:chrome/xulschoolhello.jar!/locale/en-US/
Part of this file is a jar scheme
which is the core of this question. I'm interested in the specification (semantics) and role of this scheme. In the above tutorial is only written:
It tells Firefox to look into the JAR file and read the files from the right path.
When I was looking for some more information about this scheme I found only things related to Java programming language but not the things related to Firefox extension.
Could you explain this scheme more in depth?
(I tagged it with jar
too, but I will retag it if this is something different)
thank you
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
chrome.manifest
文件告诉 Firefox 在哪里查找扩展程序的 chrome 文件。这些文件可以打包(在 JAR 文件中)或解包(在文件系统上,而不是在 JAR 文件中)。对于解压的扩展,您只需指定文件系统上文件的路径。jar:
方案是告诉 Firefox 您的 chrome 文件已打包、JAR 所在位置以及在 JAR 中的何处查找文件的方式。它具有以下格式:举一个具体的例子,Greasemonkey 扩展在其清单中包含以下行:
这告诉 Firefox Greasemonkey 在位于
chrome/greasemonkey.jar
的 JAR 中有一个内容目录 (位于名为content
的顶级目录中(相对于清单位置的路径)。The
chrome.manifest
file tells Firefox where to look for an extension's chrome files. These files can be packed (in a JAR file) or unpacked (on the filesystem, not in a JAR file). For unpacked extensions you just need to specify the path to the files on the filesystem. Thejar:
scheme is how you tell Firefox that your chrome files are packed, where the JAR is located, and then where to find the files in the JAR. It has the following format:To take a concrete example, the Greasemonkey extension has the following line in its manifest:
This tells Firefox that Greasemonkey has a content directory in a JAR located at
chrome/greasemonkey.jar
(path relative to the location of the manifest) in a top-level directory namedcontent
.