编辑现有的Firefox

编辑现有的Firefox

本文介绍了编辑现有的Firefox附件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于我正在处理的项目之一,我必须使用DOM Inspector调试Firefox扩展.

For one of the projects I'm working on, I have to use DOM Inspector to debug a Firefox extension.

DOM检查器的问题在于,它仅向您显示代码下方的浏览器,无法分离浏览器或并排分离代码段或浏览器.

The problem with DOM inspector is that it only shows you the browser below the code, there's no way to detach the browser or out the code section or browser side by side.

这对我不起作用,因为我正在调试的插件具有较大的xul覆盖,而有问题的区域在botton上,因此没有物理方式可以查看该区域以及该区域本身的代码.

It didn't work for me because the plugin I was debugging had a large xul overlay, and the problematic area was at the botton, so there's no physical way to see the code for the area as well as the area itself.

因此,我决定修改DOM Inspector本身,以将浏览器放置在代码编辑器的侧面.

So I have decided to modify DOM Inspector itself to place browser to the side of the code editor.

这是我执行的步骤:

  1. 从配置文件目录中获取现有的xpi文件.
  2. 将其更改为邮政编码.
  3. 走进去并使用jar -xf <filename>
  4. 提取inspector.jar
  5. 转到inspectorOverlay.xul并将<vbox id="bxInspectorMain">更改为hbox. (这足以将这两个窗口水平放置.)
  6. 然后我使用jar cf重新创建了jar文件.
  7. 压缩目录以确保名称相同,并将扩展名更改回xpi.
  1. Took the existing xpi file from the profile directory.
  2. Changed it to be a zip.
  3. Went inside and extracted inspector.jar using jar -xf <filename>
  4. Went to inspectorOverlay.xul and changed <vbox id="bxInspectorMain"> to be an hbox. (This should be enough to position those two windows horizontally.)
  5. Then I recreated jar file using jar cf.
  6. Zipped the directory making sure that the name is the same and changed extension back to xpi.

但是,当我尝试运行它时,收到以下警告:

However, when I try to run it, I get the following warnings:

Warning: WARN addons.xpi: Add-on is invalid: [Exception... "Component returned failure code: 0x80520006 (NS_ERROR_FILE_TARGET_DOES_NOT_EXIST) [nsIZipReader.getInputStream]"  nsresult: "0x80520006 (NS_ERROR_FILE_TARGET_DOES_NOT_EXIST)"  location: "JS frame :: resource://gre/modules/XPIProvider.jsm :: loadManifestFromZipReader :: line 740"  data: no]
Source File: resource://gre/modules/XPIProvider.jsm
Line: 740

Warning: WARN addons.xpi: Could not uninstall invalid item from locked install location
Source File: resource://gre/modules/XPIProvider.jsm
Line: 2042

我的问题是-为了正确解释xpi,我通常还需要做哪些其他更改?

My question is - what other changes do I generally need to make for the xpi to be properly interpreted?

推荐答案

我想您在此步骤中做错了什么.查看源代码,该消息来自方法updateMetadata() -Firefox注意到文件已更改,并尝试再次读取install.rdf.该文件应位于XPI文件的顶层,但在您情况下找不到.重新打包文件后,也许install.rdf不再位于顶层.您可以使用unzip命令对其进行测试:

I guess that you did something wrong in this step. Looking at the source code, the message comes from method updateMetadata() - Firefox noticed that the file changed and tries to read in install.rdf again. That file should be at the top level of the XPI file but in your case it cannot be found. Maybe install.rdf is no longer at the top level after you repacked the file. You can test it with the unzip command:

unzip -l [email protected]

它应该显示XPI文件的内容,包括install.rdfchrome.manifest-不带任何前缀目录名称.

It should show the contents of the XPI file, including install.rdf and chrome.manifest - without any prepended directory name.

这篇关于编辑现有的Firefox附件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-29 17:28