如何访问Firefox扩展的manifest.json文件? [英] How to access the manifest.json file of a Firefox extension?

查看:974
本文介绍了如何访问Firefox扩展的manifest.json文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在做一个关于Chrome和Firefox扩展的简短研究。我可以通过这个URL chrome-extension://< extension_id> /manifest.json manifest.json 文件C $ C>。有没有一个Firefox浏览器的URL可以看到Firefox扩展的 manifest.json
N.B:我已经试过 moz-extension:// 前缀。但是,这是行不通的。

解决方案

用于WebExtensions附件中的文件的URL格式如下:


$ b

  moz-extension://< extension UUID> /< pathToFileInExtension> 

如果您使用的是扩展名中的代码,则可以获取扩展名中任何文件的URL chrome。 extension.getURL() 。这将有效地为您的扩展UUID。



如果您想通过在Firefox浏览器用户界面的URL栏中输入文件来访问文件,那么您将需要获得你想要的扩展的UUID。对于WebExtensions,可以从 about:config extensions.webextensions.uuids 中从扩展ID到UUID的映射。该键的值是一个JSON格式的对象,其键是WebExtension ID,每个键的值是WebExtensions的UUID。

如果您一般访问特定扩展名中的文件,则最好找到扩展打包归档文件(通常是 [extensionID] .xpi ),通常位于 [profileDirectory] ​​/ extensions 的。然后,您需要解压缩文件(一个正常的 .zip 压缩文件扩展名已被修改)来访问这些文件。这样做可能比通过在URL栏中逐个输入URL来抓取文件更容易。


I am making a short research about Chrome and Firefox extensions. I can access the manifest.json file of a Chrome extension installed on my Chrome browser with this URL chrome-extension://<extension_id>/manifest.json. Is there a Firefox equivalent URL to see the manifest.json of a Firefox extension? N.B: I have already tried moz-extension:// prefix. But it does not work.

解决方案

The URLs used for files inside WebExtensions add-ons are in the format:

moz-extension://<extension UUID>/<pathToFileInExtension>

If you are in code within the extension, you can obtain the URL to any file in your extension with chrome.extension.getURL(). This will effectively give you the UUID for your extension.

If you are wanting to access a file through typing it into the URL bar of the Firefox Browser UI, then you will need to obtain the UUID for the extension you desire. For WebExtensions, the mapping from extension ID to UUID is available from about:config in extensions.webextensions.uuids. The value for that key is a JSON formatted Object with keys that are the WebExtension IDs and the value for each key is that WebExtensions' UUID.

If you are wanting to generally access files within a particular extension, you may be better off finding the extensions packed archive (usually [extensionID].xpi) which will, normally, be located in your [profileDirectory]/extensions. You will then need to unpack the archive (a normal .zip archive with the file extension changed) to access the files. Doing this may be easier than trying to crawl through the files by entering their URLs one-by-one in the URL bar.

这篇关于如何访问Firefox扩展的manifest.json文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆