我是一名高级用户,并且拥有一些程序员技能,但我安装了一些firefox附加组件,并且我想在原始代码中添加一些额外的代码行。但我只有 .xpi 文件。
我知道任何zip工具都可以打开它。但是当我在那里改变某些东西时,它并不起作用。 它将 .js 文件存储在 CONTENT 文件夹中。有一个输出到文件的功能,我想格式化一个字符串,保存到文件中。
您无法提及问题的开头,但主要目标和问题是:如何在已安装的 .xpi .js 文件的任何更改>扩展?任何升级它们的方法。
附加组件:
答案 0 :(得分:2)
基本上你只是再次压缩东西(非SDK附加组件)。您链接的附加组件是非SDK附加组件。
然而,有一些陷阱:
META-INF
文件夹的存在所示。修改内容当然会使签名无效。只需删除该文件夹即可将(修改后的)扩展名再次取消签名。.xpi
)则包含/some-addon-folder/install.rdf
,而不仅仅是/install.rdf
。确保不要压缩外部文件夹,只压缩文件和子文件夹。这是正确压缩的:
$ unzip -l http_request_logger-0.1-fx.xpi
Archive: http_request_logger-0.1-fx.xpi
Length Date Time Name
-------- ---- ---- ----
240 07-29-11 11:45 chrome.manifest
0 07-29-11 11:42 components/
1558 07-29-11 11:47 components/httpRequestLogger.js
1021 07-30-11 12:39 install.rdf
-------- -------
2819 4 files
这未正确压缩(使用OSX压缩菜单项生成):
$ unzip -l http_request_logger-0.1-fx.zip
Archive: http_request_logger-0.1-fx.zip
Length Date Time Name
-------- ---- ---- ----
0 05-16-14 01:54 http_request_logger-0.1-fx/
240 07-29-11 11:45 http_request_logger-0.1-fx/chrome.manifest
0 05-16-14 01:54 __MACOSX/
0 05-16-14 01:54 __MACOSX/http_request_logger-0.1-fx/
187 07-29-11 11:45 __MACOSX/http_request_logger-0.1-fx/._chrome.manifest
0 07-29-11 11:42 http_request_logger-0.1-fx/components/
1558 07-29-11 11:47 http_request_logger-0.1-fx/components/httpRequestLogger.js
0 05-16-14 01:54 __MACOSX/http_request_logger-0.1-fx/components/
187 07-29-11 11:47 __MACOSX/http_request_logger-0.1-fx/components/._httpRequestLogger.js
1021 07-30-11 12:39 http_request_logger-0.1-fx/install.rdf
187 07-30-11 12:39 __MACOSX/http_request_logger-0.1-fx/._install.rdf
187 05-16-14 01:54 __MACOSX/._http_request_logger-0.1-fx
-------- -------
3567 12 files
(除了__MACOSX
废话,现在是http_request_logger-0.1-fx/install.rdf
)
我建议你也阅读Setting up an extension development enviroment,特别是有关代理文件的内容。 ;)
对于SDK附加组件(由harness-options.json
文件的存在表示),重新压缩可能或不起作用。最好只根据.xpi
内容重现package.json和目录结构,并使用SDK cfx
工具构建新的XPI。