简体   繁体   English

安装过程中出错:扩展无效 - 将chrome扩展适配到firefox

[英]There was an error during installation: Extension is invalid - Adapting chrome extension into firefox

I'm adapting a google-chrome extension into firefox. 我正在将google-chrome扩展改编为firefox。

This extension is fairly simple, it just reloads current browser window and places a specific string into it (It is used to activate a debugging state on Odoo ). 这个扩展非常简单,它只是重新加载当前的浏览器窗口并将特定的字符串放入其中(它用于激活Odoo上的调试状态)。

However, when I test it agaisnt the mozilla test site, it says the test has passed and the extension should be ready to go. 但是,当我对mozilla测试站点进行测试时,它说测试已经通过,扩展应该准备好了。

But everytime I try on my browser on about:debugging erss, it throws the same thing over and over again. 但是每次我在浏览器上尝试about:debugging erss时,它会一遍又一遍地抛出同样的东西。

Just updated the browser to version 57.0 and the same story goes on. 刚刚将浏览器更新到版本57.0 ,同样的故事也在继续。

This is my directory structure (I've added the addon to a zip file) 这是我的目录结构(我已将插件添加到zip文件中)

 background.js
 LICENSE
 manifest.json
 off.png
 on.png
 README.md
 super_on.png

My manifest file: 我的清单文件:

{
"name": "My Debug",
"version": "3.3",
"manifest_version": 2,
"description": "Toggle debug mode",
"short_name": "My Debug",
"offline_enabled": true,
"browser_action": {
    "default_icon": "off_.png",
    "default_title": "- Click for Debug \n- Double Click for Debug"
},
"applications": {
      "id": "email@email.com"
},
"incognito": "spanning",
"background": {
    "scripts": ["background.js"]
},
"permissions": ["activeTab", "webNavigation", "*://*/*", "tabs"],
"icons": {
    "16": "off.png",
    "128": "off.png"
}
}

It throws me: 它抛出了我:

There was an error during installation: Extension is invalid

I know the install.rdf isn't needed anymore. 我知道不再需要install.rdf了。

Maybe some error on manifest file? 也许清单文件有些错误?

You don't need a chrome or firefox extension to activate and set the debug mode by default in Odoo. 在Odoo中,默认情况下不需要chrome或firefox扩展来激活和设置调试模式。 You can do something like the following code withing the Odoo framework. 您可以使用Odoo框架执行类似以下代码的操作。 This is taken from this Odoo module 这是从这个Odoo模块中获取的

  • Create a class with the settings values 使用设置值创建一个类

     class DevelopmentToolsConfigSettings(models.TransientModel): _name = 'development_tools.config.settings' development_mode = fields.Boolean( string='Development mode as default', required=False, readonly=False, index=False, default=True, help='Set development mode by default' ) @api.model def get_default_values(self, values): return dict( development_mode=self.get_debug_mode(), ) def get_debug_mode(self): param = self._get_parameter('development_mode') if param: value = self._safe_eval(param.value, bool) else: value = self._defaults['development_mode'] return value def _set_debug_mode(self): param = self._get_parameter('development_mode', force=True) param.value = unicode(self.development_mode) 
  • Override web.Home controller and add auto-debug mode behavior: 覆盖web.Home控制器并添加自动调试模式行为:

     from openerp.http import route, request, Controller, redirect_with_hash import openerp.addons.web.controllers.main as webmain from openerp.tools.translate import _ from logging import getLogger import werkzeug _logger = getLogger(__name__) class Home(webmain.Home): @route() def web_client(self, s_action=None, **kw): result = None if not request.debug and request.db and self._get_debug_mode(): _logger.info(self._debug_message) result = self._build_debug_response() return result or super(Home, self).web_client(s_action, **kw) def _get_debug_mode(self): config = request.env['development_tools.config.settings'] debug = config.get_debug_mode() return debug == True def _build_debug_response(self): result = None try: query = request.params query.update({'debug': u''}) url = '/web?' + werkzeug.url_encode(query) result = redirect_with_hash(url) except Exception as ex: _logger.error(self._error_response.format(ex)) return result _debug_message = _(u'Auto-redirect to enter in debug mode') _error_response = _( u'The debug response could not be built.\\n' u'System has said: {}' ) 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM