【发布时间】:2017-08-06 14:46:12
【问题描述】:
我最近正在研究 Firefox 网络扩展开发,因此我之前没有扩展开发技能,如果这是一个愚蠢的问题,请提前接受我的道歉。
我开发了一个扩展来操作某个域中的某些元素。它在Firefox about:debugging 环境中运行良好。我只使用 jQuery 和 Javascript 来操作我在 DOM 上的设置。未使用任何 SDK 或 XUL。
storage.local 和 browser tabs API 用于存储和传输我的数据。
我的问题是如何导出此源代码以在少数朋友中进行测试,以在AMO 签名之前验证功能,我在这里的方法是对还是错。
manifest.json
{
"content_scripts": [
{
"matches": [
"*://*.domain.com/*"
],
"run_at": "document_start",
"js": [
"jquery.js",
"flat_ui_min.js",
"application.js"
]
}
],
"name": "Extension name goes here",
"icons": {
"48": "icons/extension-icon-48.png"
},
"description": "Sample description goes here",
"homepage_url": "URL to the extension info",
"version": "1.2",
"manifest_version": 2,
"browser_action": {
"default_icon": {
"32": "icons/browser-icon-32.png"
},
"browser_style": true,
"default_title": "Extension short name",
"default_popup": "popup/layout.html"
},
"permissions": [
"activeTab",
"storage",
"tabs"
]
}
install.rdf
<?xml version="1.0"?>
<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:em="http://www.mozilla.org/2004/em-rdf#">
<Description about="urn:mozilla:install-manifest">
<em:id>name@domain.org</em:id>
<em:type>2</em:type>
<em:name>Extension name</em:name>
<em:version>1.2</em:version>
<em:description>Extension description</em:description>
<em:creator>Creator's name</em:creator>
<em:homepageURL>Extension homepage</em:homepageURL>
<em:optionsType>1</em:optionsType>
<em:targetApplication>
<Description>
<em:id>Some random string</em:id>
<em:minVersion>46.0</em:minVersion>
<em:maxVersion>57.*</em:maxVersion>
</Description>
</em:targetApplication>
</Description>
</RDF>
目录结构
Extension Folder
└─── install.rdf
└─── manifest.json
└─── jquery.js
└─── application.js
└─── flat_ui_min.js
└─── popup/
└─── css/
└─── bootstrap.min.css
└─── flat-ui.min.css
└─── style.css
└─── fonts/
└─── glyphicons/
└─── lato/
└─── layout.html
└─── icons/
└─── browser-icon-32.png
└─── browser-icon-48.png
提前欣赏你的想法。
干杯!
【问题讨论】:
-
正如你所提到的,你还没有得到 Mozilla 的签名,所以你应该使用
about:debugging,而不是about:addons。请参阅:Firefox extension .xpi file structure: description, contents, creation, and installation 以获取有关打包附加组件的信息,Add-on "appears to be corrupt" when trying to install my add-on's .xpi file in Firefox 专门针对“似乎已损坏”的最常见原因。然而,我们真的无法回答任何问题,除了猜测/一般信息而没有实际访问权限 -
您应该在提交之前使用 .xpi 文件将其安装为
about:debugging的临时插件。除了将其提交给 AMO 之外,没有其他方法可以对其进行签名。允许从 about:addons 安装未签名插件的唯一方法是运行 Nightly 或 Developer Edition,或者完全禁用插件签名要求(可以在每个 Firefox 安装的基础上完成;请参阅: How can I disable signature checking for Firefox add-ons?) -
正如我所说,WebExtensions 不使用 install.rdf 文件。
-
提交给 AMO 由您决定。如果您要分发它,这是一个必需的步骤。在提交之前,您已经完成了最重要的部分:功能扩展包。
-
我很高兴能够提供帮助。祝你好运
标签: firefox-addon firefox-addon-webextensions