gpt4 book ai didi

javascript - 安装过程中出现错误 : Extension is invalid - Adapting chrome extension into firefox

转载 作者:行者123 更新时间:2023-11-29 15:17:45 27 4
gpt4 key购买 nike

我正在将 google-chrome 扩展改编成 firefox。

这个扩展相当简单,它只是重新加载当前浏览器窗口并在其中放置一个特定的字符串(它用于在 Odoo 上激活调试状态)。

但是,当我在 mozilla 测试站点上测试它时,它说测试已经通过,扩展应该可以使用了。

但每次我在浏览器上尝试 about:debugging 时,它都会一遍又一遍地抛出同样的东西。

刚刚将浏览器更新到版本 57.0,同样的故事还在继续。

这是我的目录结构(我已将插件添加到 zip 文件中)

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

我的 list 文件:

{
"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"
}
}

它让我:

There was an error during installation: Extension is invalid

我知道不再需要 install.rdf

也许 list 文件有错误?

最佳答案

您不需要 chrome 或 firefox 扩展程序即可在 Odoo 中默认激活和设置 Debug模式。您可以使用 Odoo 框架执行类似以下代码的操作。这取自 this Odoo module

  • 使用设置值创建一个类

    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)
  • 覆盖 web.Home Controller 并添加自动 Debug模式行为:

    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: {}'
    )

关于javascript - 安装过程中出现错误 : Extension is invalid - Adapting chrome extension into firefox,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47447572/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com