Structure of an Installable Bundle

此页有脚本错误。在网站编辑解决此问题前,你可以查看以上的部分内容。

XULRunner 应用程序, 扩展, 以及主题 全部共享一个公共的目录结构, 在一些情况下同一个包可以用作独立的XMLRunner应用程序或者一个可安装的应用程序插件.


一个Bundle的基础结构

一个bundle可以包括如下文件:

/install.rdf                        扩展/主题安装配置文件
/application.ini                    应用启动配置文件
/components/*                       组件和XPT文件      (>=1.7)
/defaults/preferences/*.js          缺省属性          (>=1.7)
/plugins/*                          NPAPI插件                (>=1.8)
/chrome.manifest                    Chrome注册配置文件 (>=1.8)
/chrome/icons/default/*             Window图标                 (>=1.8)

当然,一个扩展不必(并且通常不会)有所有这些目录。主题由于安全原因受到限制,通常只提供一个chrome.manifest注册和一个JAR文件。

Platform-特殊的子目录

In some cases a single extension or application may wish to include binary component or plugins for multiple platforms, or theme authors might want to include multiple platform-specific JAR files. To facilitate the first case, the extension/app loader has special sub-directories specifically for platform-specific files (starting with Toolkit/Gecko 1.8, Firefox/Thunderbird 1.5). The platform string is defined during the toolkit build process to a value unique for the combination of operating system, processor architecture and compiler. The format of the platform string is:

在一些情况下单个扩展或则应用程序希望包含二进制组件或则针对多个平台的插件,或则主题的作者希望包含多个平台相关的JAR文件.

{OS_TARGET}_{TARGET_XPCOM_ABI}

All of the files which are loaded from the main extension directory are loaded from the subdirectory

/platform/{platform string}

if it exists. 比如, 如果一个插件厂商想为运行Linux, Macintosh, 和Windows操作系统客户电脑提供一个可用的插件,它将提供如下文件:

/platform/Linux_x86-gcc3/plugins/libMyPlugin.so
/platform/WINNT_x86-msvc/plugins/MyPlugin.dll
/platform/Darwin_ppc-gcc3/plugins/libMyPlugin.dylib

因为XPT文件没有平台指定,任何相关的XPT文件将被放在一般的组件目录下:

/components/MyPlugin.xpt

If an extension has non-binary platform-specific code (such as code which uses the windows registry from script), it can also use just the operating system identifier as a platform-subdirectory:

/platform/WINNT/components/registerDoctype.js

When platform-specific JAR files are used, each platform directory should have its own chrome.manifest file:

chrome.manifest
chrome/mytheme-base.jar
platform/Darwin/chrome.manifest
platform/Darwin/chrome/mytheme-mac.jar
platform/WINNT/chrome.manifest
platform/WINNT/chrome/mytheme-win.jar

The app/extension loader processes the base directory first, followed by the applicable platform directories (first /{OS_TARGET}/, then /{OS_TARGET}_{TARGET_XPCOM_ABI}/). When default preferences are defined in several directories, the ones loaded later overwrite the earlier ones.

应用程序相关的扩展文件

In addition to the extension files listed above, applications may read additional files from extensions. For example, Firefox 1.5 and greater will read Sherlock search plugins from

/searchplugins/*.src

Firefox 2 and greater will additionally read MozSearch and OpenSearch plugins from

/searchplugins/*.xml

and Myspell dictionaries from

/dictionaries/*.{aff|dic}

除了上面列出的扩展文件以外,应用程序可以读取来自扩展的其他文件.例如,Firefox 1.5及以上版本从

/searchplugins/*.src

读取Sherlock搜索插件,Firefox 2及以上版本从

/searchplugins/*.xml

读取MozSearch and OpenSearch plugins以及从

/dictionaries/*.{aff/dic}

Myspell字典

Official References for Toolkit API

{{ :cn/Toolkit_API/Official_References }}

Document Tags and Contributors

标签:
Contributors to this page: Gamlty, Developerworks, Freeopen
最后编辑者: Developerworks,