diff options
Diffstat (limited to 'files/zh-cn/archive/mozilla/xpinstall')
6 files changed, 0 insertions, 828 deletions
diff --git a/files/zh-cn/archive/mozilla/xpinstall/index.html b/files/zh-cn/archive/mozilla/xpinstall/index.html deleted file mode 100644 index b1d122e53b..0000000000 --- a/files/zh-cn/archive/mozilla/xpinstall/index.html +++ /dev/null @@ -1,83 +0,0 @@ ---- -title: XPInstall -slug: Archive/Mozilla/XPInstall -tags: - - XPInstall - - XPInstall_API_reference -translation_of: Archive/Mozilla/XPInstall ---- -<p></p><div class="warning"><p>Parts of this page show the use of the <a href="https://developer.mozilla.org/zh-CN/docs/XPInstall_API_Reference">XPInstall API</a>. The majority of this API is now deprecated and as of Gecko 1.9 no longer available. <a href="https://developer.mozilla.org/zh-CN/docs/Extensions">Extension</a>, <a href="https://developer.mozilla.org/zh-CN/docs/Themes">Theme</a>, and <a href="https://developer.mozilla.org/zh-CN/docs/Plugins">plug-in</a> developers must switch away from <code>install.js</code> based packages to the new <a href="https://developer.mozilla.org/zh-CN/docs/Bundles">packaging scheme</a> with an <code><a href="https://developer.mozilla.org/zh-CN/docs/Install_Manifests">install.rdf</a></code> manifest. In particular plugin developers should see <a class="new" href="https://developer.mozilla.org/zh-CN/docs/Shipping_a_plugin_as_a_Toolkit_bundle" rel="nofollow">how to package a plugin as an extension</a>.</p></div><p></p> - -<div><strong>Cross-Platform Install (XPInstall)</strong> is a technology used by Mozilla Application Suite, Mozilla Firefox, Mozilla Thunderbird and other <a href="cn/XUL">XUL</a>-based applications for installing <a href="cn/Extensions">extensions</a>. An <a href="cn/XPI">XPI</a> (pronounced "zippy" and derived from XPInstall) installer module is a ZIP file that contains an install script or manifest (entitled install.js or <a href="cn/Install_Manifests">install.rdf</a>) at the root of the file.<br> -<strong>跨平台安装(XPInstall)</strong>是被Mozilla应用程序套件(Firefox, Thunderbird, 其它一些基于<a href="cn/XUL">XUL</a>的应用程序)所使用的一项安装扩展的技术. <a href="cn/XPI">XPI</a>安装模块是一个ZIP文件, 它包括一个位于根路径的安装脚本文件或者清单(符合规定格式的install.js或者<a href="cn/Install_Manifests">install.ref</a>)文件</div> - -<p>.</p> - -<table class="topicpage-table"> - <tbody> - <tr> - <td> - <h4 id="Documentation" name="Documentation"><a>Documentation</a></h4> - - <dl> - <dt><a href="cn/XPInstall_API_Reference">XPInstall API 参考</a></dt> - </dl> - - <dl> - <dt><a href="cn/Learn_XPI_Installer_Scripting_by_Example">通过实例学习XPI安装脚本</a></dt> - <dd><small>This article uses the installer script from <code>browser.xpi</code> install package as the basis for discussing XPI installations in general. </small></dd> - <dd>这篇文章使用了取至于<code>browser.xpi</code>安装包中的安装脚本来讨论XPI安装的基本原理.</dd> - </dl> - - <dl> - <dt><a href="cn/Creating_XPI_Installer_Modules">创建XPI安装模块</a></dt> - <dd><small>This article describes the packaging scheme of the Mozilla and offers a tutorial for creating a new package that can then be redistributed, installed, and made available to users. </small></dd> - <dd>这篇文件描述了Mozilla安装模块的打包方案, 并提供了一个关于创建一个新的可用来分发, 安装和用户可用的安装包的教程.</dd> - </dl> - - <dl> - <dt><a href="cn/Install_Wizards_(aka/Stub_Installers)">安装向导 (aka: Stub Installers)</a></dt> - </dl> - - <p><span class="alllinks"><a>View All...</a></span></p> - </td> - <td> - <h4 id="Community" name="Community">Community</h4> - - <ul> - <li>View Mozilla forums...</li> - </ul> - - <p></p><ul> - <li><a href="https://lists.mozilla.org/listinfo/dev-platform"> 邮件列表</a></li> - - - <li><a href="http://groups.google.com/group/mozilla.dev.platform"> 新闻组</a></li> - <li><a href="http://groups.google.com/group/mozilla.dev.platform/feeds"> Web feed</a></li> -</ul><p></p> - - <h4 id="Tools" name="Tools">Tools</h4> - - <ul> - <li><a class="external" href="http://www.mozilla.org/quality/smartupdate/xpinstall-trigger.html">XPInstall trigger page</a></li> - </ul> - - <h4 id="Related_Topics" name="Related_Topics">Related Topics</h4> - - <dl> - <dd><a href="cn/Extensions">Extensions</a>, <a href="cn/XUL">XUL</a>, <a href="cn/XPI">XPI</a></dd> - </dl> - </td> - </tr> - </tbody> -</table> - -<p><span class="comment">Categories</span></p> - -<p><span class="comment">Interwiki Language Links</span></p> - -<p> </p> - -<div class="noinclude"> </div> - -<p></p> diff --git a/files/zh-cn/archive/mozilla/xpinstall/reference/index.html b/files/zh-cn/archive/mozilla/xpinstall/reference/index.html deleted file mode 100644 index 5111ad1a6b..0000000000 --- a/files/zh-cn/archive/mozilla/xpinstall/reference/index.html +++ /dev/null @@ -1,189 +0,0 @@ ---- -title: XPInstall API reference -slug: Archive/Mozilla/XPInstall/Reference -translation_of: Archive/Mozilla/XPInstall/Reference ---- -<p></p><div class="warning"><p>Parts of this page show the use of the <a href="https://developer.mozilla.org/zh-CN/docs/XPInstall_API_Reference">XPInstall API</a>. The majority of this API is now deprecated and as of Gecko 1.9 no longer available. <a href="https://developer.mozilla.org/zh-CN/docs/Extensions">Extension</a>, <a href="https://developer.mozilla.org/zh-CN/docs/Themes">Theme</a>, and <a href="https://developer.mozilla.org/zh-CN/docs/Plugins">plug-in</a> developers must switch away from <code>install.js</code> based packages to the new <a href="https://developer.mozilla.org/zh-CN/docs/Bundles">packaging scheme</a> with an <code><a href="https://developer.mozilla.org/zh-CN/docs/Install_Manifests">install.rdf</a></code> manifest. In particular plugin developers should see <a class="new" href="https://developer.mozilla.org/zh-CN/docs/Shipping_a_plugin_as_a_Toolkit_bundle" rel="nofollow">how to package a plugin as an extension</a>.</p></div><p></p> - - -<h3 id="Objects" name="Objects">Objects</h3> - -<h4 id="Install" name="Install"><a href="/en-US/docs/XPInstall_API_Reference/Install_Object">Install</a></h4> - -<dl> - <dd><a href="/en-US/docs/XPInstall_API_Reference/Install_Object/Properties">Properties</a></dd> - <dd><a href="/en-US/docs/XPInstall_API_Reference/Install_Object/Methods">Methods</a></dd> -</dl> - -<dl> - <dd> - <dl> - <dd><a href="/en-US/docs/XPInstall_API_Reference/Install_Object/Methods/addDirectory">addDirectory</a></dd> - <dd><a href="/en-US/docs/XPInstall_API_Reference/Install_Object/Methods/addFile">addFile</a></dd> - <dd><a href="/en-US/docs/XPInstall_API_Reference/Install_Object/Methods/alert">alert</a></dd> - <dd><a href="/en-US/docs/XPInstall_API_Reference/Install_Object/Methods/cancelInstall">cancelInstall</a></dd> - <dd><a href="/en-US/docs/XPInstall_API_Reference/Install_Object/Methods/confirm">confirm</a></dd> - <dd><a href="/en-US/docs/XPInstall_API_Reference/Install_Object/Methods/deleteRegisteredFile">deleteRegisteredFile</a></dd> - <dd><a href="/en-US/docs/XPInstall_API_Reference/Install_Object/Methods/execute">execute</a></dd> - <dd><a href="/en-US/docs/XPInstall_API_Reference/Install_Object/Methods/gestalt">gestalt</a></dd> - <dd><a href="/en-US/docs/XPInstall_API_Reference/Install_Object/Methods/getComponentFolder">getComponentFolder</a></dd> - <dd><a href="/en-US/docs/XPInstall_API_Reference/Install_Object/Methods/getFolder">getFolder</a></dd> - <dd><a href="/en-US/docs/XPInstall_API_Reference/Install_Object/Methods/getLastError">getLastError</a></dd> - <dd><a href="/en-US/docs/XPInstall_API_Reference/Install_Object/Methods/getWinProfile">getWinProfile</a></dd> - <dd><a href="/en-US/docs/XPInstall_API_Reference/Install_Object/Methods/getWinRegistry">getWinRegistry</a></dd> - <dd><a href="/en-US/docs/XPInstall_API_Reference/Install_Object/Methods/initInstall">initInstall</a></dd> - <dd><a href="/en-US/docs/XPInstall_API_Reference/Install_Object/Methods/loadResources">loadResources</a></dd> - <dd><a href="/en-US/docs/XPInstall_API_Reference/Install_Object/Methods/logComment">logComment</a></dd> - <dd><a href="/en-US/docs/XPInstall_API_Reference/Install_Object/Methods/patch">patch</a></dd> - <dd><a href="/en-US/docs/XPInstall_API_Reference/Install_Object/Methods/performInstall">performInstall</a></dd> - <dd><a href="/en-US/docs/XPInstall_API_Reference/Install_Object/Methods/refreshPlugins">refreshPlugins</a></dd> - <dd><a href="/en-US/docs/XPInstall_API_Reference/Install_Object/Methods/registerChrome">registerChrome</a></dd> - <dd><a href="/en-US/docs/XPInstall_API_Reference/Install_Object/Methods/resetError">resetError</a></dd> - <dd><a href="/en-US/docs/XPInstall_API_Reference/Install_Object/Methods/setPackageFolder">setPackageFolder</a></dd> - </dl> - </dd> -</dl> - -<h4 id="InstallTrigger" name="InstallTrigger"><a href="/en-US/docs/XPInstall_API_Reference/InstallTrigger_Object">InstallTrigger</a></h4> - -<dl> - <dd><em>No properties</em></dd> - <dd><a href="/en-US/docs/XPInstall_API_Reference/InstallTrigger_Object/Methods">Methods</a></dd> -</dl> - -<dl> - <dd> - <dl> - <dd><a href="/en-US/docs/XPInstall_API_Reference/InstallTrigger_Object/Methods/compareVersion">compareVersion</a></dd> - <dd><a href="/en-US/docs/XPInstall_API_Reference/InstallTrigger_Object/Methods/enabled">enabled</a></dd> - <dd><a href="/en-US/docs/XPInstall_API_Reference/InstallTrigger_Object/Methods/getVersion">getVersion</a></dd> - <dd><a href="/en-US/docs/XPInstall_API_Reference/InstallTrigger_Object/Methods/install">install</a></dd> - <dd><a href="/en-US/docs/XPInstall_API_Reference/InstallTrigger_Object/Methods/installChrome">installChrome</a></dd> - <dd><a href="/en-US/docs/XPInstall_API_Reference/InstallTrigger_Object/Methods/startSoftwareUpdate">startSoftwareUpdate</a></dd> - </dl> - </dd> -</dl> - -<h4 id="InstallVersion" name="InstallVersion"><a href="/en-US/docs/XPInstall_API_Reference/InstallVersion_Object">InstallVersion</a></h4> - -<dl> - <dd><a href="/en-US/docs/XPInstall_API_Reference/InstallVersion_Object/Properties">Properties</a></dd> - <dd><a href="/en-US/docs/XPInstall_API_Reference/InstallVersion_Object/Methods">Methods</a></dd> -</dl> - -<dl> - <dd> - <dl> - <dd><a href="/en-US/docs/XPInstall_API_Reference/InstallVersion_Object/Methods/compareTo">compareTo</a></dd> - <dd><a href="/en-US/docs/XPInstall_API_Reference/InstallVersion_Object/Methods/init">init</a></dd> - <dd><a href="/en-US/docs/XPInstall_API_Reference/InstallVersion_Object/Methods/toString">toString</a></dd> - </dl> - </dd> -</dl> - -<h4 id="File" name="File"><a href="/en-US/docs/XPInstall_API_Reference/File_Object">File</a></h4> - -<dl> - <dd><em>No properties</em></dd> - <dd><a href="/en-US/docs/XPInstall_API_Reference/File_Object/Methods">Methods</a></dd> -</dl> - -<dl> - <dd> - <dl> - <dd><a href="/en-US/docs/XPInstall_API_Reference/File_Object/Methods/copy">copy</a></dd> - <dd><a href="/en-US/docs/XPInstall_API_Reference/File_Object/Methods/dirCreate">dirCreate</a></dd> - <dd><a href="/en-US/docs/XPInstall_API_Reference/File_Object/Methods/dirGetParent">dirGetParent</a></dd> - <dd><a href="/en-US/docs/XPInstall_API_Reference/File_Object/Methods/dirRemove">dirRemove</a></dd> - <dd><a href="/en-US/docs/XPInstall_API_Reference/File_Object/Methods/dirRename">dirRename</a></dd> - <dd><a href="/en-US/docs/XPInstall_API_Reference/File_Object/Methods/diskSpaceAvailable">diskSpaceAvailable</a></dd> - <dd><a href="/en-US/docs/XPInstall_API_Reference/File_Object/Methods/execute">execute</a></dd> - <dd><a href="/en-US/docs/XPInstall_API_Reference/File_Object/Methods/exists">exists</a></dd> - <dd><a href="/en-US/docs/XPInstall_API_Reference/File_Object/Methods/isDirectory">isDirectory</a></dd> - <dd><a href="/en-US/docs/XPInstall_API_Reference/File_Object/Methods/isFile">isFile</a></dd> - <dd><a href="/en-US/docs/XPInstall_API_Reference/File_Object/Methods/macAlias">macAlias</a></dd> - <dd><a href="/en-US/docs/XPInstall_API_Reference/File_Object/Methods/modDate">modDate</a></dd> - <dd><a href="/en-US/docs/XPInstall_API_Reference/File_Object/Methods/modDateChanged">modDateChanged</a></dd> - <dd><a href="/en-US/docs/XPInstall_API_Reference/File_Object/Methods/move">move</a></dd> - <dd><a href="/en-US/docs/XPInstall_API_Reference/File_Object/Methods/remove">remove</a></dd> - <dd><a href="/en-US/docs/XPInstall_API_Reference/File_Object/Methods/rename">rename</a></dd> - <dd><a href="/en-US/docs/XPInstall_API_Reference/File_Object/Methods/size">size</a></dd> - <dd><a href="/en-US/docs/XPInstall_API_Reference/File_Object/Methods/windowsGetShortName">windowsGetShortName</a></dd> - <dd><a href="/en-US/docs/XPInstall_API_Reference/File_Object/Methods/windowsRegisterServer">windowsRegisterServer</a></dd> - <dd><a href="/en-US/docs/XPInstall_API_Reference/File_Object/Methods/windowsShortcut">windowsShortcut</a></dd> - </dl> - </dd> -</dl> - -<h4 id="WinProfile" name="WinProfile"><a href="/en-US/docs/XPInstall_API_Reference/WinProfile_Object">WinProfile</a></h4> - -<dl> - <dd><em>No properties</em></dd> - <dd><a href="/en-US/docs/XPInstall_API_Reference/WinProfile_Object/Methods">Methods</a></dd> -</dl> - -<dl> - <dd> - <dl> - <dd><a href="/en-US/docs/XPInstall_API_Reference/WinProfile_Object/Methods/getString">getString</a></dd> - <dd><a href="/en-US/docs/XPInstall_API_Reference/WinProfile_Object/Methods/writeString">writeString</a></dd> - </dl> - </dd> -</dl> - -<h4 id="WinReg" name="WinReg"><a href="/en-US/docs/XPInstall_API_Reference/WinReg_Object">WinReg</a></h4> - -<dl> - <dd><em>No properties</em></dd> - <dd><a href="/en-US/docs/XPInstall_API_Reference/WinReg_Object/Methods">Methods</a></dd> -</dl> - -<dl> - <dd> - <dl> - <dd><a href="/en-US/docs/XPInstall_API_Reference/WinReg_Object/Methods/createKey">createKey</a></dd> - <dd><a href="/en-US/docs/XPInstall_API_Reference/WinReg_Object/Methods/deleteKey">deleteKey</a></dd> - <dd><a href="/en-US/docs/XPInstall_API_Reference/WinReg_Object/Methods/deleteValue">deleteValue</a></dd> - <dd><a href="/en-US/docs/XPInstall_API_Reference/WinReg_Object/Methods/enumKeys">enumKeys</a></dd> - <dd><a href="/en-US/docs/XPInstall_API_Reference/WinReg_Object/Methods/enumValueNames">enumValueNames</a></dd> - <dd><a href="/en-US/docs/XPInstall_API_Reference/WinReg_Object/Methods/getValue">getValue</a></dd> - <dd><a href="/en-US/docs/XPInstall_API_Reference/WinReg_Object/Methods/getValueNumber">getValueNumber</a></dd> - <dd><a href="/en-US/docs/XPInstall_API_Reference/WinReg_Object/Methods/getValueString">getValueString</a></dd> - <dd><a href="/en-US/docs/XPInstall_API_Reference/WinReg_Object/Methods/isKeyWritable">isKeyWritable</a></dd> - <dd><a href="/en-US/docs/XPInstall_API_Reference/WinReg_Object/Methods/keyExists">keyExists</a></dd> - <dd><a href="/en-US/docs/XPInstall_API_Reference/WinReg_Object/Methods/setRootKey">setRootKey</a></dd> - <dd><a href="/en-US/docs/XPInstall_API_Reference/WinReg_Object/Methods/setValue">setValue</a></dd> - <dd><a href="/en-US/docs/XPInstall_API_Reference/WinReg_Object/Methods/setValueNumber">setValueNumber</a></dd> - <dd><a href="/en-US/docs/XPInstall_API_Reference/WinReg_Object/Methods/setValueString">setValueString</a></dd> - <dd><a href="/en-US/docs/XPInstall_API_Reference/WinReg_Object/Methods/valueExists">valueExists</a></dd> - </dl> - </dd> -</dl> - -<dl> - <dd><a href="/en-US/docs/XPInstall_API_Reference/WinReg_Object/WinRegValue">WinRegValue constructor</a></dd> -</dl> - -<h3 id="Other_Information" name="Other_Information">Other Information</h3> - -<h4 id="Return_Codes" name="Return_Codes">Return Codes</h4> - -<p><a href="/en-US/docs/XPInstall_API_Reference/Return_Codes">See complete list</a></p> - -<h4 id="Examples" name="Examples"><a href="/en-US/docs/XPInstall_API_Reference/Examples">Examples</a></h4> - -<dl> - <dd><a href="/en-US/docs/XPInstall_API_Reference/Examples/Trigger_Scripts_and_Install_Scripts">Trigger Scripts and Install Scripts</a></dd> -</dl> - -<h5 id="Code_Samples" name="Code_Samples">Code Samples</h5> - -<dl> - <dd><a href="/en-US/docs/XPInstall_API_Reference/Examples/File.macAlias">File.macAlias</a></dd> - <dd><a href="/en-US/docs/XPInstall_API_Reference/Examples/File.windowsShortcut">File.windowsShortcut</a></dd> - <dd><a href="/en-US/docs/XPInstall_API_Reference/Examples/Install.addDirectory">Install.addDirectory</a></dd> - <dd><a href="/en-US/docs/XPInstall_API_Reference/Examples/Install.addFile">Install.addFile</a></dd> - <dd><a href="/en-US/docs/XPInstall_API_Reference/Examples/InstallTrigger.installChrome">InstallTrigger.installChrome</a></dd> - <dd><a href="/en-US/docs/XPInstall_API_Reference/Examples/InstallTrigger.startSoftwareUpdate">InstallTrigger.startSoftwareUpdate</a></dd> - <dd><a href="/en-US/docs/XPInstall_API_Reference/Examples/Windows_Install">Windows Install</a></dd> -</dl> diff --git a/files/zh-cn/archive/mozilla/xpinstall/reference/install_object/index.html b/files/zh-cn/archive/mozilla/xpinstall/reference/install_object/index.html deleted file mode 100644 index 0a4a02a30a..0000000000 --- a/files/zh-cn/archive/mozilla/xpinstall/reference/install_object/index.html +++ /dev/null @@ -1,50 +0,0 @@ ---- -title: Install Object -slug: Archive/Mozilla/XPInstall/Reference/Install_Object -tags: - - XPInstall_API_reference -translation_of: Archive/Mozilla/XPInstall/Reference/Install_Object ---- -<p></p><div class="warning"><p>Parts of this page show the use of the <a href="https://developer.mozilla.org/zh-CN/docs/XPInstall_API_Reference">XPInstall API</a>. The majority of this API is now deprecated and as of Gecko 1.9 no longer available. <a href="https://developer.mozilla.org/zh-CN/docs/Extensions">Extension</a>, <a href="https://developer.mozilla.org/zh-CN/docs/Themes">Theme</a>, and <a href="https://developer.mozilla.org/zh-CN/docs/Plugins">plug-in</a> developers must switch away from <code>install.js</code> based packages to the new <a href="https://developer.mozilla.org/zh-CN/docs/Bundles">packaging scheme</a> with an <code><a href="https://developer.mozilla.org/zh-CN/docs/Install_Manifests">install.rdf</a></code> manifest. In particular plugin developers should see <a class="new" href="https://developer.mozilla.org/zh-CN/docs/Shipping_a_plugin_as_a_Toolkit_bundle" rel="nofollow">how to package a plugin as an extension</a>.</p></div><p></p> - -<h2 id="Install_.28Install_.E5.AF.B9.E8.B1.A1.29" name="Install_.28Install_.E5.AF.B9.E8.B1.A1.29">Install (Install 对象)</h2> - -<p>Use the <code>Install</code> object to manage the downloading and installation of software with the XPI Installation Manager.<br> - 译:使用<code>Install</code>对象协同XPI安装管理器操纵软件的下载和安装.</p> - -<h3 id="Overview" name="Overview">Overview</h3> - -<p>The Install object is used primarily in installation scripts. In all cases, the <code>Install</code> object is implicit--like the <code>window</code> object in regular web page scripts--and needn't be prefixed to the object methods. The following two lines, for example, are equivalent:<br> - Install对象首先会被安装脚本所使用. Install对象总是隐式的, 如同在规则的web页脚本中的<code>window</code>对象一样, 你并不需要将其作为其方法的调用前缀. 例如, 以下两行代码功能是完全一样的:</p> - -<pre>f = getFolder("Program"); -f = Install.getFolder("Program"); -</pre> - -<p>An installation script is composed of calls to the Install object, and generally takes the following form:<br> - 一个安装脚本被书写为调用Install对象, 并且通常采取以下形式:</p> - -<dl> - <dt>Initialize the installation (初始化安装)</dt> - <dd>Call <a href="cn/XPInstall_API_Reference/Install_Object/Methods/initInstall"> initInstall</a> with the name of the installation and the necessary registry and version information.</dd> - <dd>调用<a href="cn/XPInstall_API_Reference/Install_Object/Methods/initInstall">initInstall(函数)</a>, 和安装的名称, 必须的注册以及版本信息.</dd> - <dt>Add the files to the installation (添加文件到安装)</dt> - <dd>Add files to the installation by calling <a href="cn/XPInstall_API_Reference/Install_Object/Methods/getFolder"> getFolder</a> to get file objects and passing those object refs to <a href="cn/XPInstall_API_Reference/Install_Object/Methods/addFile"> addFile</a> as many times as necessary.</dd> - <dd>添加文件到安装, 通过调用<a href="cn/XPInstall_API_Reference/Install_Object/Methods/getFolder"> getFolder(函数)</a>取得文件对象并传递那些对象引用到<a href="cn/XPInstall_API_Reference/Install_Object/Methods/addFile"> addFile(函数)</a>, 多数时候这样做还是有必要的.</dd> - <dt>Perform installation (执行安装)</dt> - <dd>Check that the files have been added successfully (e.g., by checking the error <a href="cn/XPInstall_API_Reference/Return_Codes"> Return Codes</a> from many of the main installation methods, and go ahead with the install if everything is in order:</dd> - <dd>检查那些文件是否被添加成功(比如通过检查<a href="cn/XPInstall_API_Reference/Return_Codes"> Return Codes</a>从多数主要安装函数所返回的错误代码), 并且如果所有函数的执行都是正确的, 那么就可以进行后继安装步骤:</dd> -</dl> - -<pre>performOrCancel(); -function performOrCancel() -{ - if (0 == getLastError()) - performInstall(); - else - cancelInstall(); -} -</pre> - -<p>For complete script examples, see <a href="cn/XPInstall_API_Reference/Examples"> Script Examples</a>.<br> - 完事的脚本实例, 参见<a href="cn/XPInstall_API_Reference/Examples"> Script Examples</a>.</p> diff --git a/files/zh-cn/archive/mozilla/xpinstall/reference/install_object/properties/index.html b/files/zh-cn/archive/mozilla/xpinstall/reference/install_object/properties/index.html deleted file mode 100644 index 76804ce8cd..0000000000 --- a/files/zh-cn/archive/mozilla/xpinstall/reference/install_object/properties/index.html +++ /dev/null @@ -1,33 +0,0 @@ ---- -title: Properties -slug: Archive/Mozilla/XPInstall/Reference/Install_Object/Properties -translation_of: Archive/Mozilla/XPInstall/Reference/Install_Object/Properties ---- -<p> </p> -<h3 id="Properties" name="Properties">Properties</h3> -<dl> - <dt> - <code>archive</code></dt> - <dd> - Full local path of the archive after it is downloaded to the platform specific temp folder. (e.g. <code>C:\TEMP\argstest.xpi</code>)</dd> - <dt> - <code>arguments</code></dt> - <dd> - args can be passed in through the triggering APIs by attaching a ? and then the rg string to the xpi URL: (e.g. <code>startSoftwareUpdate(<span class="nowiki">"http://webserver/argstest.xpi?ARGUMENT_STRING"</span>)</code> will result in the value of <code>Install.arguments</code> being <code>ARGUMENT_STRING</code> #). Note that spaces in the arg string are legal. Everything after the question mark is treated as one string which becomes the <code>Install.arguments</code> property.</dd> - <dt> - <code>buildID</code></dt> - <dd> - The application build ID in the form 20041231. Note that due to branching (different versions of Gecko with different feature sets might be built on the same day), using this property to "detect" the application version may produce false results. Additionally, the build ID can be 0 for custom builds.</dd> - <dt> - <code>jarfile</code></dt> - <dd> - Alias for <code>archive</code></dd> - <dt> - <code>platform</code></dt> - <dd> - Contains information about the platform XPInstall was compiled for/runs on. For example, the value could begin with "Windows", "Macintosh" or "X11" (for Unix/Linux). For more details, see the corresponding code living in the <a class="external" href="http://lxr.mozilla.org/mozilla/ident?i=GetInstallPlatform">GetInstallPlatform method of class nsInstall</a>.</dd> - <dt> - <code>url</code></dt> - <dd> - The fully qualified URL of the xpi (file URL, http URL, ftp URL, etc.) (e.g. <code><span class="nowiki">http://dolfin/sgehani/zzz/ip.xpi</span></code>). Note, even if triggered using relative URLs this will show the full URL (after qualification).</dd> -</dl> diff --git a/files/zh-cn/archive/mozilla/xpinstall/scripting_by_example/index.html b/files/zh-cn/archive/mozilla/xpinstall/scripting_by_example/index.html deleted file mode 100644 index fb43c1237c..0000000000 --- a/files/zh-cn/archive/mozilla/xpinstall/scripting_by_example/index.html +++ /dev/null @@ -1,246 +0,0 @@ ---- -title: Learn XPI Installer Scripting by Example -slug: Archive/Mozilla/XPInstall/Scripting_by_example -tags: - - XPInstall - - XPInstall_API_reference -translation_of: Archive/Mozilla/XPInstall/Scripting_by_example ---- -<p></p><div class="warning"><p>Parts of this page show the use of the <a href="https://developer.mozilla.org/zh-CN/docs/XPInstall_API_Reference">XPInstall API</a>. The majority of this API is now deprecated and as of Gecko 1.9 no longer available. <a href="https://developer.mozilla.org/zh-CN/docs/Extensions">Extension</a>, <a href="https://developer.mozilla.org/zh-CN/docs/Themes">Theme</a>, and <a href="https://developer.mozilla.org/zh-CN/docs/Plugins">plug-in</a> developers must switch away from <code>install.js</code> based packages to the new <a href="https://developer.mozilla.org/zh-CN/docs/Bundles">packaging scheme</a> with an <code><a href="https://developer.mozilla.org/zh-CN/docs/Install_Manifests">install.rdf</a></code> manifest. In particular plugin developers should see <a class="new" href="https://developer.mozilla.org/zh-CN/docs/Shipping_a_plugin_as_a_Toolkit_bundle" rel="nofollow">how to package a plugin as an extension</a>.</p></div><p></p> - -<p>This article uses the installer script from browser.xpi install package as the basis for discussing XPI installations in general. This <code><a href="cn/Learn_XPI_Installer_Scripting_by_Example/Installer_Script">installer script</a></code> is relatively short, but it exercises most of the important features of the XPInstall API, and it can easily be used as a template for other more general software installations. In this article, we use the unix install file, but the installers for all the platforms are quite similar, and you can easily take what you learn here and apply it to installations on any platform that mozilla supports.</p> - -<h2 id="About_browser.xpi" name="About_browser.xpi">About <code>browser.xpi</code></h2> - -<p><code>browser.xpi</code> is the XPI archive in which the main components of the Mozilla browser are archived for installation. Mozilla cross-platform installations use the XPI format as a way to organize, compress, and automate software installations and software updates. A XPI is a PKZIP-compressed archive (like ZIP and JAR files) with a special script at the highest level that manages the installation. That <code><a href="cn/Learn_XPI_Installer_Scripting_by_Example/Installer_Script">installer script</a></code> , usually named <code>install.js</code>, is the subject of this article.</p> - -<p>First, a quick scan of the contents of the XPI file (which you can open using with any unzip utility) reveals the following high-level directory structure:</p> - -<pre>install.js -bin\ - chrome\ - components - defaults\ - icons\ - plugins\ - res\ -</pre> - -<p>Note that this high-level structure parallels the directory structure of the installed browser very closely:</p> - -<p><img alt="mozilla directory on linux"></p> - -<p>As you will see in the installation script, the contents of the archive are installed onto the file system in much the same way that they are stored in the archive itself, though it's possible to rearrange things arbitrarily upon installation--to create new directories, to install files in system folders and other areas.</p> - -<h2 id="Overview_of_the_Install_Script" name="Overview_of_the_Install_Script">Overview of the Install Script</h2> - -<p>XPI install scripts are written in JavaScript using XPInstall Engine syntax defined in the <a href="cn/XPInstall_API_Reference">XPInstall API Reference</a>.</p> - -<p>Most installation scripts, including the one discussed here, take the following basic form (in pseudo-code and with links to the sections in which these installation steps are documented):</p> - -<pre>initInstall(); -if (verify_space()) { - err = add_dirs_and_files; - register_files; - - if (err==SUCCESS) { performInstall() }; - else { cancelInstall() }; -} -</pre> - -<p>As you can see in the <a href="cn/Learn_XPI_Installer_Scripting_by_Example/Installer_Script">code listing</a>, the verification process at the top is on lines 1 to 18; the file addition process, here part of the main installation block, is on lines 24 to 41; the registration part of the main installation block is on lines 42-58; and the execution at the end of the main block is on lines 59 to 71. If you choose not to register the installed software or do the verifications at the front end of the installation, then at a minimum, the install scripts must<em>initialize, add the files to be installed, and execute.</em></p> - -<p>Note also that when you call methods on the <code>Install</code>--as you do so often in installation scripts (<code>getFolder</code>, <code>initInstall</code>, <code>addFile</code>, and <code>performInstall</code> are all examples of common <code>Install</code> object methods)--the <code>Install</code> object is implicit; like the <code>window</code> object in regular web page scripts, the Install object does not need to be prefixed to the method.</p> - -<h3 id="Initializing_the_Installation" name="Initializing_the_Installation">Initializing the Installation</h3> - -<p>All installations must begin with <code>initInstall()</code>. The <code>initInstall()</code> method on the Install object creates a new installation for the specified software and version. In the browser.xpi installation, this function appears at line 20: <code> var err = initInstall("Netscape Seamonkey", "Browser", "6.0.0.2000110807"); </code></p> - -<p>If you call a method on the <code>Install</code> object before <code>initInstall()</code>, you will get an error.</p> - -<p>The <code>initInstall</code> method takes the following parameters: the display name of the package, the name of the package as it appears in the client registry, and the version, which can be expressed as a number or as an InstallVersion object. In the example above, "Netscape Seamonkey" is the display name, "Browser" is the registry name, and the version is "6.0.0.2000110807." See <code><a href="cn/XPInstall_API_Reference/Install_Object/Methods/initInstall">initInstall</a></code> in the <a href="cn/XPInstall_API_Reference">XPInstall API Reference</a> for more information on the initialization process.</p> - -<h3 id="Verifying_the_Target" name="Verifying_the_Target">Verifying the Target</h3> - -<p>The first thing the installation script does when it's executed is to check that there is adequate disk space for the software to be installed, where the <code>verifyDiskSpace</code> function is called as a condition of the main installation block that starts at line 24).</p> - -<pre> // this function verifies disk space in kilobytes - function verifyDiskSpace(dirPath, spaceRequired) - { - var spaceAvailable; - // Get the available disk space on the given path - spaceAvailable = fileGetDiskSpaceAvailable(dirPath); - - // Convert the available disk space into kilobytes - spaceAvailable = parseInt(spaceAvailable / 1024); - // do the verification - if(spaceAvailable < spaceRequired) - { - logComment("Insufficient disk space: " + dirPath); - logComment(" required : " + spaceRequired + " K"); - logComment(" available: " + spaceAvailable + " K"); - return(false); - } - return(true); - } -</pre> - -<p>In the <code>verifyDiskSpace</code> block, <code>fileGetDiskSpaceAvailable</code> is called with <code>dirPath</code> as its expected input. This input is defined in line 22, where <code>getFolder()</code> is used to assign a value to the communicatorFolder variable representing the "Program" folder on the local system:</p> - -<pre>var communicatorFolder = getFolder("Program"); -spaceAvailable = fileGetDiskSpaceAvailable(dirPath); -</pre> - -<p><code>spaceRequired</code>, the other expected input to the <code>verifyDiskSpace</code> function, is given as 17311 kilobytes on line 19. Inside the function, the two sizes are compared and if the available space is larger than the required space, the installation proceeds.</p> - -<h3 id="Adding_Files_and_Directories_.28Full_of_Files.29_to_the_Install" name="Adding_Files_and_Directories_.28Full_of_Files.29_to_the_Install">Adding Files and Directories (Full of Files) to the Install</h3> - -<p>Once you have verified that the target can accomodate the software to be installed and initialized the actual installation, you must add files and directories to the installation in order to have them installed. In the <code>browser.xpi</code> install script, the files are added in lines 26-41:</p> - -<pre> err = addDirectory("Program", - "6.0.0.2000110807", - "bin", // jar source folder - communicatorFolder, // target folder - "", // target subdir - true ); // force flag - - logComment("addDirectory() returned: " + err); - - // create the plugins folder next to mozilla - var pluginsFolder = getFolder("Plugins"); - if (!fileExists(pluginsFolder)) - { - var ignoreErr = dirCreate(pluginsFolder); - logComment("dirCreate() returned: " + ignoreErr); - } - else - logComment("Plugins folder already exists"); -</pre> - -<p>In this case, the files are contained within a single directory, so calling the <code>Install</code> object's <code>addDirectory</code> method is sufficient to queue all the files in the archive for installation. The <code>addDirectory</code>, like <code>addFile</code>, handles both the source file location and the target location. In the example above, all of the contents of the "bin" directory in the archive are queued for installation, and the target of that installation (when the installation is actually begun with a call to <code>performInstall</code> at the end), is the <code>communicatorFolder</code> directory defined at line 22 as "Program."</p> - -<p>"Program" is one of a short list of keywords that can be used in place of full path names in methods such as <code>addFile</code>. "Program" represents the directory where software itself is installed (e.g., <code>C:\Program Files\</code> on win32 systems), as opposed to supporting directories like "Components", "Chrome", or "Temporary" (see <code><a href="cn/XPInstall_API_Reference/Install_Object/Methods/getFolder">getFolder</a></code> in the <a href="cn/XPInstall_API_Reference">XPInstall API Reference</a> for a list of keywords).</p> - -<h3 id="Registering_the_Software" name="Registering_the_Software">Registering the Software</h3> - -<p>Registering software is sometimes a requirement of both the operating system and of the Netscape 6 platform. When you install new chrome, for example, like the <code>browser.xpi</code> install does, you need to alert the chrome registry to these changes, so that skins, user preferences, packaging lists, and localization bundles will all track the new software.</p> - -<p>For registering software with the win32 operating system, the XPInstall API provides two special Install objects, <code>WinProfile</code> and <code>WinReg</code>. These two objects provide programmatic access to the Windows user profile and the Windows registry, respectively. The <code>browser.xpi</code> install script does not demonstrate the use of these objects, but see the XPInstall API Reference for more information about registering software with the win32 operating systems and other operating systems.</p> - -<p>To register new Netscape 6-based software (e.g., plug-ins, new components, new themes, new packages) with the chrome registry, you must use the registerChrome function of the Install object. If successful, this function returns a "0" and makes entries into the<em>installed-chrome.txt</em> file in the <code>chrome</code> subdirectory, which is then used to regenerate the various RDF files that make up the chrome registry.</p> - -<pre> var cf = getFolder("Chrome"); - registerChrome(CONTENT | DELAYED_CHROME, getFolder(cf,"toolkit.xpi"),"content/global/"); - registerChrome(CONTENT | DELAYED_CHROME, getFolder(cf,"browser.xpi"),"content/communicator/"); - registerChrome(CONTENT | DELAYED_CHROME, getFolder(cf,"browser.xpi"),"content/editor/"); - registerChrome(CONTENT | DELAYED_CHROME, getFolder(cf,"browser.xpi"),"content/navigator/"); - registerChrome(SKIN | DELAYED_CHROME, getFolder(cf,"modern.jar"),"skin/modern/communicator/"); - registerChrome(SKIN | DELAYED_CHROME, getFolder(cf,"modern.jar"),"skin/modern/editor/"); - ... -</pre> - -<p>In lines 42-58, <code>registerChrome</code> is called as many times as there are different directories that contain content that needs to be registered with the chrome registry. Note that in the first few lines of this process, new content from the XPI is being registered, and in the remainder, it is new skin information. In this most common form of the <code>registerChrome</code> function (it can also be used to support the now-deprecated<em>manifest.rdf</em> style of installation archive), the three parameters represent, in order, the chrome <code>SWITCH</code> used to indicate what kind of software is being registered, the target destination of the software (e.g., the "Chrome" folder in the example above), and the path within the XPI (or JAR theme archive) where the contents.rdf file is located.</p> - -<p>See <code><a href="cn/XPInstall_API_Reference/Install_Object/Methods/registerChrome">registerChrome</a></code> in the XPInstall API Reference for more information about registering new packages with the chrome registry.</p> - -<h3 id="Executing_the_Installation" name="Executing_the_Installation">Executing the Installation</h3> - -<p>Once you have added all the files to the installation, the final step is to actually execute the installation. Note that until this point, the install calls you have been making on the Install object are preliminary only. Recall that an install process takes the following general form:</p> - -<pre>initInstall(); -if (verify_space()) { - err = add_dirs_and_files; - register_files; - - if (err==SUCCESS) { performInstall() }; - else { cancelInstall() }; -} -</pre> - -<p>In this arrangement, the actual execution of the installation is checked against the errors returned from the addition of files to the installation, which may itself have been conditioned on some verification of version and necessary disk space.</p> - -<p>The actual install code used to execute the installation appears in the<em>install.js</em> file as follows:</p> - -<pre>if (err==SUCCESS) - { - err = performInstall(); - logComment("performInstall() returned: " + err); - } - - else - { - cancelInstall(err); - logComment("cancelInstall() due to error: " + err); - } -} -else - cancelInstall(INSUFFICIENT_DISK_SPACE); -</pre> - -<p><code>performInstall</code> is the function used to execute the install once it has been initialized and loaded, and it is the last step to installing the software. Note that in the example above, the installation is cancelled if the error code from the file addition process returns success (0), and also cancelled outside the main block if the earlier verification process is not successful.</p> - -<p>Note also the comments that indicate the success of various steps in the process--including the performInstall and cancelInstall steps--are written to the install log using the <code>logComment</code>, described in the following section.</p> - -<h2 id="Installation_Logging" name="Installation_Logging">Installation Logging</h2> - -<p>Logging is an important feature of the XPInstall API that can help you streamline and debug your installations. In the example in the <a href="#Executing_the_Installation">Executing the Installation</a> section and in many places in the installation script, the <code>logComment</code> API is used to write data to a log file that can then be reviewed when things don't go as planned.</p> - -<p>The install log is created in the product directory by default (where the browser executable is). If the installation doesn't have proper permission, the install log is written to the user's profile directory. Respectively, these directories correspond to the "Program" and "Current User" keywords for the getFolder method.</p> - -<h2 id="Extending_the_Example" name="Extending_the_Example">Extending the Example</h2> - -<p>What does all this mean to you? How can this information be adapted for your own installations? In this final section, we describe the application of the XPInstall technology described here in the creation and deployment of a very simple installation script and installation archive (XPI).</p> - -<p>Say you have a simple executable and a README file that goes with it, and you want to make it available for installation from a XPI. After putting these two files in a XPI (which, as described above, is simply a ZIP file with an install.js script at the top and a suffix of '.xpi'), the next step is to add an installation script to the XPI.</p> - -<p>Minimally, the installation script must:</p> - -<ul> - <li>Call <code>initInstall</code> with the name and version of the executable (the version is not optional, though you may or may not use the version in subsequent installations or updates)</li> - <li>Find somewhere to put the installed files. In the example below, <code>getFolder</code> is used with the "Program" keyword to specify the browser's program directory as the target for installation. Since I am using NS6 right now on a Windows machine, that target directory is "C:\Program Files\Netscape\Netscape 6\".</li> - <li>Add files to the initialized installation using <code>addFile</code>.</li> - <li>Call performInstall to execute the installation.</li> -</ul> - -<p>Here is an example of small but complete installation script.</p> - -<pre>var xpiSrc = "cd_ripper.exe"; -var xpiDoc = "README_cdrip"; - -initInstall("My CD Ripper", "cdrip", "1.0.1.7"); -f = getFolder("Program"); -setPackageFolder(f); -addFile(xpiSrc); -addFile(xpiDoc); - -if (0 == getLastError()) - performInstall(); -else - cancelInstall(); -</pre> - -<p>The example above shows this minimal installation. This install script does not include any version or disk space checking, very little error checking, only a single executable, no registration, and no commenting. It does, however, take the executable and the README file and install them on the user's system. Note also that for the installation script in a XPI to be automatically triggered from a web page, you must use a "trigger script." The following InstallTrigger function, called from an event handler on a regular web page, will point to the remotely-hosted XPI (called here 'cdrip.xpi') and trigger its installation:</p> - -<pre>function putIt() -{ - xpi={'CD_Ripper':'cdrip.xpi'}; - InstallTrigger.install(xpi); -} -... - -<a href="#" onclick="putIt();">install the CD Ripper Now!</a> -</pre> - -<p>See the <a href="cn/XPInstall_API_Reference/InstallTrigger_Object">InstallTrigger</a> object in the XPInstall API Reference for more information on triggering installations.</p> - -<div class="originaldocinfo"> -<h2 id="Original_Document_Information" name="Original_Document_Information">Original Document Information</h2> - -<ul> - <li>Author(s): <a class="link-mailto" href="mailto:mailto:oeschger@netscape.com">Ian Oeschger</a></li> - <li>Last Updated Date: 01/26/2006</li> - <li>Copyright Information: Copyright (C) <a class="link-mailto" href="mailto:mailto:oeschger@netscape.com">Ian Oeschger</a></li> -</ul> -</div> - -<p></p> diff --git a/files/zh-cn/archive/mozilla/xpinstall/using_xpinstall_to_install_plugins/index.html b/files/zh-cn/archive/mozilla/xpinstall/using_xpinstall_to_install_plugins/index.html deleted file mode 100644 index 7df82abc04..0000000000 --- a/files/zh-cn/archive/mozilla/xpinstall/using_xpinstall_to_install_plugins/index.html +++ /dev/null @@ -1,227 +0,0 @@ ---- -title: Using XPInstall to Install Plugins -slug: Archive/Mozilla/XPInstall/Using_XPInstall_to_Install_Plugins -tags: - - Plugins - - XPInstall -translation_of: Archive/Mozilla/XPInstall/Installing_plugins ---- -<p><a href="cn/XPInstall">XPInstall</a> is a JavaScript-based installer technology that works across all the platforms that <a class="external" href="http://mozilla.org">Mozilla</a> and Netscape browsers based on Mozilla (such as Netscape 7) are deployed. It can be a way to ensure a smooth user-experience when obtaining plugins, without obliging the user to exit the browsing environment to launch a binary installer (the classic setup.exe experience on Windows) or obliging the user to restart their browser. For plugin vendors who have already written a native code (e.g. EXE) installer, XPInstall can wrap this native installer and run it so that the user never has to leave the browsing environment and click on the EXE to run it. This article presents a guideline for improving the plugin installation experience for Netscape Gecko browsers using <a href="cn/XPInstall_API_Reference">XPInstall</a>. XPInstall是基于js的安装plugin插件的跨平台技术。其包*.xpi,同扩展/主题|皮肤(*.jar)是一样的(zip包)。</p> -<h3 id="A_Definition_of_Terms" name="A_Definition_of_Terms">A Definition of Terms</h3> -<p>XPInstall is an installer technology, and the name itself stands for "Cross Platform Install" (hence "XP" -- an abbreviation for "Cross Platform"). An XPInstall package is usually called an XPI package for short (and often pronounced "zippy"). This article is about how you can use XPInstall to install plugins to the browsers that support XPInstall.</p> -<p>An XPI Package is in fact a ZIP file with the XPI file extension (e.g. myPluginInstaller.xpi), and can be created on Windows by utilities such as WinZip. XPI Packages, like ZIP files, "contain" other files, typically: 典型的插件包结构:</p> -<ul> - <li>The software component to be installed. In our case, this is the plugin software.</li> -</ul> -<p>1。插件本身(动态库:如office.so or office.dll等,另外常见的为各种多媒体插件)。</p> -<ul> - <li>A JavaScript file called install.js, which is the install logic that drives the installation. This includes instructions on where to install the software, and what messages to feed to the user.</li> -</ul> -<p>2。install.js:如何安装该插件的javascript脚本。 You can create an XPInstall file by first zipping all the items you want installed with WinZip (create a ZIP archive) and then renaming it with the XPI file extension instead of the ZIP file extension.</p> -<p>Unlike native code installers (for example, files called setup.exe), the programming language for install operations in XPI is JavaScript. Since the file format that contains the software and the install.js JavaScript file is a cross-platform file (Zip) and since JavaScript is understood by Mozilla browsers on all platforms, often one single XPI package can be deployed on all platforms. This is, in fact, <a class="external" href="http://www.mozilla.org/docs/xul/xulnotes/xulnote_packages.html">how skins and themes are installed to Mozilla browsers</a>, changing their look and feel. This article focuses on how to install plugins.</p> -<h3 id="Which_Browsers_Support_XPInstall.3F" name="Which_Browsers_Support_XPInstall.3F">Which Browsers Support XPInstall?</h3> -<p>哪些浏览器支持XPInstall安装方式? Currently, all <a class="external" href="http://mozilla.org/releases/stable.html">Mozilla browsers released by mozilla.org</a> support XPInstall, and a family of browsers based on Mozilla code support XPInstall. In particular, this includes:</p> -<ul> - <li>Recent Netscape browsers such as Netscape 6.2.x and Netscape 7.0, which are both based on Netscape Gecko, which is at the core of the Mozilla browser</li> - <li>Recent <b>beta-only</b> versions of the AOL software based on Netscape Gecko, the layout engine of the Mozilla project.</li> -</ul> -<p><b>Caveats:</b></p> -<ul> - <li>AOL Time Warner's <a class="external" href="http://www.compuserve.com/">CompuServe browser</a>, also based on Netscape Gecko, does not support XPInstall.</li> - <li>Netscape Communicator 4.x does not support XPInstall.</li> -</ul> -<h3 id="What_Does_a_Plugin_Consist_Of.3F" name="What_Does_a_Plugin_Consist_Of.3F">What Does a Plugin Consist Of?</h3> -<p>一个插件通常包含什么内容? Plugins can consist of the following types of files, all of which can be installed via an XPI Package:</p> -<ul> - <li><b>动态共享链接库</b> (例如,在Windows中,有DLL文件;在Unix中有*.so文件)。 These files are native code files made with the <a href="cn/Gecko_Plugin_API_Reference">Netscape Plugin API</a>.</li> -</ul> -<p>1。遵从Gecko Plugin API或Netscape Plugin API接口的动态库。[cada:也可能only ln连接文件]</p> -<ul> - <li>If the plugin is scriptable, then it will also consist of an <a href="cn/Gecko_Plugin_API_Reference/Plug-in_Development_Overview">XPT file</a>. Examples would be Flash 6r47 on Windows, which consists of a DLL (called npswf32.dll) and an XPT file for scriptability (called flashplayer.xpt). If you are developing a plugin and wish to <a href="cn/Gecko_Plugin_API_Reference/Plug-in_Development_Overview">make it scriptable</a>, read the relevant portions of the <a href="cn/Gecko_Plugin_API_Reference">Plugin API</a>.</li> -</ul> -<p>2。可选文件:xpt文件(该文件用来暴露该插件对外的接口描述--通常用javascript脚本可以访问)--新的插件API无须xpt文件也可以支持同样功能了!</p> -<ul> - <li><b>Additional software.</b> Many plugins are part of additional software for media types. For example, RealPlayer on Windows consists of a plugin DLL, but also the RealPlayer application (EXE) which the plugin DLL is a subset of. In this case, the plugin is the part of the software package that is browser-specific, as a mechanism to give the application additional "hooks" into the browser.</li> -</ul> -<p>3。这种情形也特别多:即某个插件还是某个应用程序的一部分,即该插件必须依赖该应用程序才能在browser中运行,即此时插件依赖的其他文件就是该应用程序的其他相关模块。例如openoffice插件也是这样的。</p> -<p>XPInstall can be used to install any combination of these files on an end-user's machine. For those familiar with Netscape Communicator 4.x's SmartUpdate technology, this will be a familiar idea.</p> -<h3 id="A_Brief_History_of_Netscape_Installer_Technologies" name="A_Brief_History_of_Netscape_Installer_Technologies">A Brief History of Netscape Installer Technologies</h3> -<p>Netscape 安装技术的简要历史: This section is relevant if you are familiar with Netscape Communicator 4.x's SmartUpdate installer technology.[智能update安装技术] The use of JavaScript as the install logic is not unprecedented in Netscape browsers. Netscape Communicator 4.x uses the notion of SmartUpdate to install software, particularly plugins and Java applets to be run locally. SmartUpdate is - <i> - <b>not supported</b></i> - by Mozilla browsers (and Netscape/AOL browsers based on Mozilla such as Netscape 7), but because of the similarity between the two installer technologies, it is easy to convert your SmartUpdate files to XPInstall files. SmartUpdate involves a digitally signed JAR file which contained the software components to be installed as well as a JavaScript install.js file (called the install script安装脚本) as the installer logic. Downloads and installs would be initiated with a security dialog box naming the certificate authority and the signer(签名安装包的验证). Often, the SmartUpdate download was triggered via the pluginurl attribute of the embed tag:</p> -<pre><embed type="application/x-randomtype" src="myfile.typ" width="50" height="50" -pluginurl="http://mytypecompany.xyz/jarpacks/mytypeplugin.jar"></embed> -</pre> -<p>在上面的例子中, the pluginurl attribute points to the signed JAR file, which Netscape Communicator 4.x would then download (subject to the security dialog boxes) <b>if</b> the plugin was not located on the user's machine. SmartUpdate differs from XPInstall in that:以上是Netscape Communicator的插件包(签名的jar包)安装技术概要,他与XPInstall的区别如下:</p> -<ul> - <li>XPInstall uses ZIP files named XPI files (*.xpi) and SmartUpdate uses JAR files (*.jar)一个是zip包一个是jar包--cada:jar包仅仅比zip包多一个自动生成的manifest文件,所以jar包通常比zip包大一点点(对同样内容而言)</li> - <li>Unlike a SmartUpdate JAR file, XPI Packages do not have to be digitally signed with a code-signing certificate.XPI包可以不签名</li> - <li>XPI Packages make use of <a href="cn/XPInstall_API_Reference">different APIs</a> from within install.js(该js中大量使用XPInstall API去实现安装逻辑), although the concept is the same.</li> -</ul> -<p>XPInstall for Mozilla-based browsers is analogous to SmartUpdate in Netscape Communicator 4.x browsers. Porting SmartUpdate deployments to XPInstall is trivial after gaining some familiarity with the <a href="cn/XPInstall_API_Reference">new XPInstall API</a>. 二者移植比较琐碎!详细请查看XPInstall API。</p> -<h3 id="The_Recommended_Installation_Process" name="The_Recommended_Installation_Process">The Recommended Installation Process</h3> -<p>XPInstall provides a cohesive API to accomplish rapid installation and setup of plugin software for end-users. The benefit of using XPInstall is to provide a streamlined installation mechanism. This section discusses what an ideal XPInstall Package will do, as well as points out some of the JavaScript API calls that you will make to accomplish these install tasks. An ideal XPI Package will:</p> -<ol> - <li>Install to the current browser that is initiating the XPInstall installation via HTML or triggering an XPInstall installation via a Trigger Script. We will use the term current browser to refer to the browser that initiates the XPInstall download by visiting a site which requires a plugin that the current browser can not find locally. This step will involve the use of the <a href="cn/XPInstall_API_Reference/Install_Object/Methods/initInstall">initInstall</a> API call to start everything off, and also the <a href="cn/XPInstall_API_Reference/Install_Object/Methods/getFolder">getFolder</a> API call, which helps to locate the current browser's plugin directory.</li> - <li>Install the plugin software to another location on the user's hard disk, so that other Mozilla-based browsers that the user may install later can find the plugin (the browser specific components) and pick it up. The goal is to ensure that future Netscape Gecko browsers that the user may install later can benefit from the installation that the user initiated with the current browser. An example might be that the current browser is Netscape 7, but later, the user downloads a beta of the AOL software using Netscape Gecko. Rather than re-initiate the download of the plugin with the yet another browser, the second Netscape Gecko browser can detect that an installation has already occurred. This discovery mechanism hinges on making the secondary install location available from looking at a common repository of metadata. On Windows, this is the Windows System Registry. Once again, this step involves calls to <a href="cn/XPInstall_API_Reference/Install_Object/Methods/getFolder">getFolder</a> to locate a "well known" directory in which to install to as a secondary install location.</li> - <li>On Windows: write Windows Registry keys that Netscape Gecko browsers (that get installed after the current browser) can parse to discover where the plugin is installed on the machine. In particular, the Windows Registry keys should point to the secondary install location so that future Netscape Gecko browsers can find and add to their list of available plugin locations. The exact format of these registry keys and how they should be written is covered in the section on the first install problem. To actually create and write keys to the Windows System Registry, you'll use the functions of the <a href="cn/XPInstall_API_Reference/WinReg_Object">WinReg object</a>.</li> - <li>Ensure that the plugin that has just been installed is refreshed by correctly invoking the <a href="cn/XPInstall_API_Reference/Install_Object/Methods/refreshPlugins">refreshPlugins API</a>. By refreshing your plugin, you're ensuring that the plugin is available for use immediately, without obliging the user to restart their browser. This is one of the chief advantages of a smooth XPInstall experience.</li> -</ol> -<h3 id="The_First_Install_Problem" name="The_First_Install_Problem">The First Install Problem</h3> -<p>The First Install Problem refers to the conditions arising when a plugin arrives on a user's machine before a browser arrives. The recommended install process addresses this issue, which is to install to a secondary location after installing to the current browser. In a nutshell, the first install problem can be summed up by the question: how can a browser which is installed on a user's machine after a given plugin has already been installed by the user benefit from the existing installation rather than download the same plugin again? In order to address this issue, plugin vendors are encouraged to:</p> -<ul> - <li>Install the plugin software components for the browser (e.g. DLLs on Windows, and XPT files if applicable) to a secondary location, in addition to that of the plugins directory of the current browser.</li> - <li>Write keys in the Windows registry which store information about this secondary location, in particular the Plugin Path and the XPT Path (if applicable) so that Netscape Gecko browsers can pick up the plugin from the secondary location if they are installed after the plugin is (and thus, if a particular Netscape Gecko browser follows or replaces the current browser). The keys to write and the information they should contain is <a class="external" href="http://www.mozilla.org/projects/plugins/first-install-problem.html">discussed in detail in the specification posted on mozilla.org</a>. There is also a <a class="external" href="http://www.mozilla.org/projects/plugins/example-scobe.txt">sample registry entry</a> created by an imaginary company that is illustrative of what is discussed in the <a class="external" href="http://www.mozilla.org/projects/plugins/first-install-problem.html">specification for these registry keys</a>.</li> - <li>On Windows, the Windows Registry keys mentioned above follow a nomenclature using the concept of a <a class="external" href="http://www.mozilla.org/projects/plugins/plugin-identifier.html">Plugin Identifier</a> as the name of the key under the MozillaPlugins subkey. The <a class="external" href="http://www.mozilla.org/projects/plugins/plugin-identifier.html">Plugin Identifier (or PLID)</a> is a useful concept that is also applicable when initializing the installation via the <a href="cn/XPInstall_API_Reference/Install_Object/Methods/initInstall">initInstall API</a>.</li> -</ul> -<h3 id="A_Breakdown_of_the_APIs_Used" name="A_Breakdown_of_the_APIs_Used">A Breakdown of the APIs Used</h3> -<p>The recommended plugin installation process makes use of the XPInstall APIs to install to the current browser's Plugins directory, install to a secondary location, and to <a class="external" href="http://www.mozilla.org/projects/plugins/first-install-problem.html">write to the Windows System Registry to disclose this secondary location</a>. This section traces some of the XPInstall APIs that can do this. A complete template of an XPI Package is also presented in this section. Not all the work needs to be done in JavaScript -- if you have a native installer (EXE) that <a class="external" href="http://mozilla.org/projects/plugins/install-scheme.html">recognizes Netscape Gecko browsers</a>, and you merely wish to wrap the EXE installer in an XPI Package for a streamlined delivery to the client, you can easily do so. This section refers extensively to the <a href="cn/XPInstall_API_Reference">XPInstall API Documentation</a>.</p> -<h4 id="Initializing_Installation_with_Plugin_Identifier" name="Initializing_Installation_with_Plugin_Identifier">Initializing Installation with Plugin Identifier</h4> -<p>All XPInstall installations are initiated with the <a href="cn/XPInstall_API_Reference/Install_Object/Methods/initInstall">initInstall method of the Install Object</a>. Since the Install Object is available to the install script, it need not be mentioned in the install script (e.g. there is no need to invoke Install.initInstall; simply invoking <a href="cn/XPInstall_API_Reference/Install_Object/Methods/initInstall">initInstall</a> will suffice). The initInstall method is polymorphic, but here is a recommended invocation mechanism:</p> -<pre>initInstall("My Plugin Software", "@myplugin.com/MyPlugin,version=2.5", "2.5.0.0"); -</pre> -<p>在上面的一段代码中, the <a href="cn/XPInstall_API_Reference/Install_Object/Methods/initInstall">initInstall</a> method is invoked with three parameters:</p> -<ul> - <li>A String for the name of the application</li> - <li>A String signifying the <a class="external" href="http://mozilla.org/projects/plugins/plugin-identifier.html">Plugin Identifier</a> associated with the plugin. This value is actually entered in the Client Version Registry upon installation, a Mozilla-browser file that stores metadata about the software that has just been installed. This value can be queried via web-page delivered JavaScript, and is useful for initiating XPInstall downloads via <a href="cn/XPInstall_API_Reference/InstallTrigger_Object">Trigger Scripts</a>. You can determine the version of the software that has been installed, and determine whether to update it, all via JavaScript in a web-page.</li> - <li>A String representing the four digit version of the software.</li> -</ul> -<p><b>Caveat:</b> Certain versions of Mozilla-based browsers (such as Netscape 6.x) treat the use of the equals character ("=") as an illegal token and thus do not allow invocation of initInstall with strings containing "=". A workaround to this would be to detect if initInstall has failed, and then invoke it again without the "=" string. Here is an example:</p> -<pre>var PLID = "MyPlugin.plug/version=6.5"; -err = initInstall(SOFTWARE_NAME, PLID, VERSION); - -if (err != 0) -{ - // install may have failed because of N6 and = - // replace PLID with a simple string - err = initInstall(SOFTWARE_NAME, "MyPluginString", VERSION); - if (err != 0) - cancelInstall(err); -} -</pre> -<p>Note that above, the PLID contains an "=" and in case the XPI package is running on browsers that treat "=" as an illegal token, the workaround is to handle the error and invoke initInstall again.</p> -<h3 id="Using_XPInstall_to_Run_an_EXE_.28Native_Code.29_Installer" name="Using_XPInstall_to_Run_an_EXE_.28Native_Code.29_Installer">Using XPInstall to Run an EXE (Native Code) Installer</h3> -<p>If you wish to run a native installer (EXE) to install plugin software, but wish to make the delivery of this native installer streamlined and within the browser's process, then you ought to consider wrapping it in an XPI Package. From JavaScript, you can call XPInstall's <a href="cn/XPInstall_API_Reference/Install_Object/Methods/execute">execute method of the Install Object</a> to execute the binary. You can also call the <a href="cn/XPInstall_API_Reference/File_Object/Methods/execute">execute method of the File object</a> if you wish to actually install the file you are executing, rather than have it deleted. You can pass command line parameters to the executable. An example of calling the execute method from the Install Object on an executable that has a temporary life span (and is not needed after one execution) is:</p> -<pre>// Initialize the installation .... - -// initInstall(..... ) has already been called - -// Using the Install Object's execute method to block on a native installer - -execute("setup.exe", "-s", true); - -// In the above sample, assume that running "setup -s" from the -// Command Prompt runs the setup executable, and that "-s" is some -// invocation parameter defined by the setup.exe file, perhaps to force -// the installer to run silently. We are passing "-s" to the setup file. -// By passing 'true' we are telling the Install Script to block -// on the execution of the installable, and do it synchronously - -// Must call performInstall to make it all happen... - -err = getLastError(); -if (!err) - performInstall(); -else - cancelInstall(err); -</pre> -<h4 id="Installing_Plugin_Files_To_the_Current_Browser" name="Installing_Plugin_Files_To_the_Current_Browser">Installing Plugin Files To the Current Browser</h4> -<p>Installing to the current browser is the task that is the most important for the XPI Package to succeed in. Here is a code snippet that accomplishes this:</p> -<pre>// Name of the files to be installed -var PLUGIN_FILE = "NPMyPlugin.dll"; -var COMPONENT_FILE = "NPMyPluginScriptablePeer.xpt"; - -// invoke initInstall to start the installation - -.... - -var pluginFolder = getFolder("Plugins"); - -// verify disk space is appropriate - -.... - -err = addFile("@myplugin.com/MyPlugin,version=2.5.0.0", - "2.5.0.0", PLUGIN_FILE, pluginsFolder, null); - if (err != 0) - { - //alert("Installation of MyPlugin plug-in failed. Error code "+err); - logComment("adding file "+PLUGIN_FILE+" failed. Errror conde: " + err); - return err; - } - -err = addFile(null, CULT_VERSION, COMPONENT_FILE, componentsFolder, null); - if (err != 0) - { - alert("Installation of MyPlugin component failed. Error code "+err); - logComment("adding file "+COMPONENT_FILE+" failed. Error conde: " + err); - return err; - } -</pre> -<h4 id="Installing_to_a_Secondary_Location" name="Installing_to_a_Secondary_Location">Installing to a Secondary Location</h4> -<p>For the purposes of solving the <a class="external" href="http://www.mozilla.org/projects/plugins/first-install-problem.html">First Install Problem</a>, it is necessary to install to a secondary location to ensure discoverability of the plugin by other Netscape Gecko browser in addition to the current browser. A good choice for this secondary location might be the Windows directory on Windows machines. <b>Caveat:</b> Because of possible administrator issues, handle errors carefully!</p> -<pre>// Get the Windows System directory e.g. C:\WINNT\system32\ directory - -var winDirectory = getFolder("Win System"); - -// Create the Folder C:\WINNT\system32\MyPlugin - -var dllWin32Folder = getFolder("file:///", winDirectory+"\\MyPlugin\\"); -//Install DLL to C:\Windows Folder - copyErr = addFile("", VERSION, PLUGIN_FILE, dllWin32Folder, null); - if (copyErr != 0) - { - logComment("First Install:"+copyErr); - return copyErr; - } - -// Install the XPT file to C:\WINNT\system32\MyPlugin folder - -var xptWin32Folder = getFolder("file:///", winDirectory+"\\MyPlugin\\"); - copyErr = addFile("", VERSION, COMPONENT_FILE, xptWin32Folder, null); - if (copyErr != 0) - { - logComment("First Install:"+copyErr); - return copyErr; - } -</pre> -<p>Once the secondary installation has taken place, the <a class="external" href="http://www.mozilla.org/projects/plugins/first-install-problem.html">Win32 Registry keys have to be updated</a> to indicate information about where the secondary install location is, so that browsers can discover it. This is accomplished with the <a href="cn/XPInstall_API_Reference/WinReg_Object">WinReg</a> object that is exposed to XPInstall. The pieces all come together in the template below.</p> -<h3 id="An_XPInstall_Template" name="An_XPInstall_Template">An XPInstall Template</h3> -<p>We have provided you with <a href="cn/Using_XPInstall_to_Install_Plugins/Install_script_template">a template for an install script</a> which you might want to open in another tab or window. This install script does all of the following:</p> -<ul> - <li>It installs both a DLL and an XPT file to the browser's plugins directory. The plugin itself is an imaginary one: MyPlugin. The variables that determine the plugin name, however, can be easily modified. This install.js file assumes that the plugin software that is to be installed consists of both a DLL and an XPT file, which is not always true. Many plugins may involve more than one DLL, or perhaps additional native code. It is, however, a safe assumption for most plugins, especially <a class="external" href="http://www.macromedia.com/go/getflashplayerbutton/">Macromedia's Flash Plugin</a> which consists of a single DLL (on Windows this is npswf32.dll) and a single XPT file for scriptability (called flashplayer.xpt).</li> - <li>It further installs to a secondary location on the user's desktop. In particular, like many OCX files (ActiveX controls) it installs to a special directory within C:\WINNT\System32\, called C:\WINNT\System32\MyPlugin. XPInstall is able to determine what directory this is by the <a href="cn/XPInstall_API_Reference/Install_Object/Methods/getFolder">getFolder</a> API call. We have written our own JavaScript function to contain all the secondary installation code -- function createSecondaryInstall()</li> - <li>And finally, it writes the <a class="external" href="http://www.mozilla.org/projects/plugins/first-install-problem.html">required registry keys to Windows</a>. This is done via the created function, called function registerPLID().</li> -</ul> -<p>Certainly, this script is Windows-centric, but it is easy to port it to any other platform. Easier, perhaps, since the lengthy Win32 Registry manipulation need not occur on Linux or Mac OSX. The <a href="cn/XPInstall_API_Reference/Install_Object/Methods/getFolder">getFolder API</a> provides you with enough "syntactic sugar" to determine other locations on the user's computer on different platforms and OS's. A single install.js is often capable of running on many different platforms.</p> -<h3 id="Some_Installation_Concerns" name="Some_Installation_Concerns">Some Installation Concerns</h3> -<p>This section gathers together some of the chief concerns about deploying XPI packages, notably: how ought a plugin download via XPI be initiated? And what about uninstalling plugins?</p> -<h3 id="Triggering_an_XPInstall_Download_with_a_TriggerScript" name="Triggering_an_XPInstall_Download_with_a_TriggerScript">Triggering an XPInstall Download with a TriggerScript</h3> -<p>A <a href="cn/XPInstall_API_Reference/Examples/Trigger_Scripts_and_Install_Scripts">Trigger Script</a> is web-page delivered piece of JavaScript that can automatically initiate an XPInstall download. This can be done conditionally, since <a href="cn/XPInstall_API_Reference/Examples/Trigger_Scripts_and_Install_Scripts">Trigger Scripts</a> can also detect what software has already been installed to the user's machine via XPInstall. This feature is useful for Web sites because:</p> -<ul> - <li>HTML pages and JavaScript already have a way of detecting what plugins are installed. Additionally, via the <a href="cn/XPInstall_API_Reference/InstallTrigger_Object">InstallTrigger</a> object which is exposed in Web pages, they can find out what the last version of the XPI Package was.</li> - <li>The <a href="cn/XPInstall_API_Reference/InstallTrigger_Object">InstallTrigger</a> object can also start an XPI download automatically. This is useful because users can visit a Web site, and conditionally get served software (in a streamlined manner) that the Web site wants the user to have.</li> -</ul> -<p>Trigger Scripts are a recommended way of initiating an XPInstall download.</p> -<h3 id="Triggering_an_XPInstall_Download_from_HTML" name="Triggering_an_XPInstall_Download_from_HTML">Triggering an XPInstall Download from HTML</h3> -<p>In a manner analogous to how SmartUpdate downloads were initiated by the pluginurl attribute of the embed tag, XPInstall downloads can also be initiated by HTML tags invoking plugins, notably via the <a class="external" href="http://www.w3.org/TR/REC-html40/struct/objects.html#adef-codebase-OBJECT">codebase</a> attribute of the <a class="external" href="http://www.w3.org/TR/REC-html40/struct/objects.html#edef-OBJECT">object</a> tag. This is analogous to how Internet Explorer downloads CAB files pointed to by the <a class="external" href="http://www.w3.org/TR/REC-html40/struct/objects.html#adef-codebase-OBJECT">codebase</a> attribute of the <a class="external" href="http://www.w3.org/TR/REC-html40/struct/objects.html#edef-OBJECT">object</a> tag. Here's an example of a hypothetical object tag used to invoke MyPlugin (an imaginary application):</p> -<pre> <object id="thePlugin" type="application/x-myplugin" width="100" - height="100" codebase="http://location/XPI/myplugin.xpi"> - -<param .... > -</pre> -<p>In the above case, the codebase attribute points directly to the XPI Package, and if the browser can not identify any plugin to handle the (imaginary) application/x-myplugin MIME type, it will download the XPI Package.</p> -<p><b>Note:</b> XPI Packages (files with the xpi extension) use the application/x-xpinstall MIME type. When serving XPI Packages from servers to clients, make sure that XPI Packages are served with this MIME type in the HTTP headers. Associate the application/x-xpinstall MIME type with XPI Packages.</p> -<h3 id="The_Uninstall_Problem" name="The_Uninstall_Problem">The Uninstall Problem</h3> -<p>In its current iteration, XPInstall does not have an affiliated uninstall technology. It can therefore only be used to install files or deliver native code installers to the client, and if uninstall is a legitimate concern, it might be wise to write a native code (EXE) uninstaller to remove the software. XPInstall can therefore be the "agent of delivery" to streamline the download of the EXE software, but ultimately, the logic of installation and uninstallation will be handled by EXE, which can then create files and registry entries and also clean up after itself upon removal.</p> -<div class="originaldocinfo"> - <h3 id="Original_Document_Information" name="Original_Document_Information">Original Document Information</h3> - <ul> - <li>Author(s): Arun K. Ranganathan, Netscape Communications</li> - <li>Last Updated Date: 05 Aug 2002</li> - <li>Copyright Information: Copyright © 2001-2003 Netscape. All rights reserved.</li> - <li>Link: <a class="external" href="http://devedge-temp.mozilla.org/viewsource/2002/xpinstall-guidelines/index_en.html" rel="freelink">http://devedge-temp.mozilla.org/view.../index_en.html</a></li> - </ul> -</div> -<p> </p> |