Chrome扩展程序在打开弹出窗口时损坏 [英] Chrome extension corrupted when open popup

查看:187
本文介绍了Chrome扩展程序在打开弹出窗口时损坏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试打开



其他功能,例如上下文菜单 options page works fine。



Chrome商店。调试版在开发人员模式下工作正常。



基本上可能在一些chrome更新后出现问题。因为扩展很长时间以来一直运行良好,并且没有对代码进行任何更改。



主要问题是,我没有任何信息来确定问题的原因,因为即使 Chrome日志也没有说明什么。



问题:

有什么方法可以找出问题的原因吗?也许有一些特殊的日志存在这种用途?



有没有人在chrome中遇到过这样的问题并且能够修复它?



清单文件:

  {
manifest_version:2,

name:ReportJ,
description:JIRA系统的报告助手,
homepage_url:https://github.com/mishani0x0ef/reportj,
version:2.3.1,
permissions:[storage,activeTab,contextMenus],
background:{
scripts :[config.js,js / urlService.js,lib / jquery.min.js,js / jira.js,background.js]
},
browser_action:{
name:ReportJ,
default_icon:img / logo.png,
default_title:ReportJ,
options_page:options.html,
default_popup:popup.html
},
options_page:options.html,
图标: {
16:img / logo.png,
48 :img / logo.png,
128:img / logo128x128.png
},
content_scripts:[{
js:[ lib / jquery.min.js],
matches:[*://*.localhost/*]
}]
}


解决方案

如果扩展中的某个文件的大小是4096的倍数, bug#720597 ,已在Chrome 61中修复。

< a href =https://gist.github.com/kingychiu/8faf23a3e42e864ae9ebd4c1b5939924 =nofollow noreferrer> kingychiu的.py脚本来测试大小:

<!c $ c> import os
导入glob
size_dir = {}
用于glob.iglob中的文件名('./* * / *。*',recursive = True):
size = os.path.getsize(filename)
如果大小%4096 == 0且size!= 0:
size_dir [filename ] = os.path.getsize(文件名)

用于名称,size_dir.items()中的大小:
prin t(名称,大小)

Windows .bat文件:
$ b $($ b pre $ $ $ $ $ $ $ $ $ $ $ $ b $ / $%$%$ %%〜za %% 4096
if!rem! == 0 echo %% a
endlocal

pause

使用PowerShell的Windows .bat文件:

  @powershell -c ^ 
gci -r $(if '%1'){'%1'+'\ *'} else {''})|?{$ _。Length %% 4096 -eq 0} | %% {$ _。FullName}
@pause


Chrome extension crashes when try to open popup. Error message appear in chrome://extensions/:

This extension may have been corrupted.

Other features, such as context menu and options page works fine.

Problem occurs only in version from Chrome Store. Debug version in developer mode works fine.

Basically problem occurred probably after some of chrome updates. Because extension had been working well for a long time and no changes to code was done.

The main problem that I have no info to identify the reason of the problem, because even chrome logs says nothing.

Questions:

Is there any way to identify reason of the issue? Maybe some special logs exists for this purpose?

Does anyone faced with such problem in chrome and was able to fix it?

Manifest file:

{
    "manifest_version": 2,

    "name": "ReportJ",
    "description": "The reporting helper for JIRA system.",
    "homepage_url": "https://github.com/mishani0x0ef/reportj",
    "version": "2.3.1",
    "permissions": ["storage", "activeTab", "contextMenus"],
    "background": {
        "scripts": ["config.js", "js/urlService.js", "lib/jquery.min.js", "js/jira.js", "background.js"]
    },
    "browser_action": {
        "name": "ReportJ",
        "default_icon": "img/logo.png",
        "default_title": "ReportJ",
        "options_page": "options.html",
        "default_popup": "popup.html"
    },
    "options_page": "options.html",
    "icons": {
        "16": "img/logo.png",
        "48": "img/logo.png",
        "128": "img/logo128x128.png"
    },
    "content_scripts": [{
        "js": ["lib/jquery.min.js"],
        "matches": ["*://*.localhost/*"]
  }]
}

解决方案

If some file in the extension has size which is a multiple of 4096, you probably hit bug#720597, fixed in Chrome 61.

kingychiu's .py script to test the sizes:

import os
import glob
size_dir = {}
for filename in glob.iglob('./**/*.*', recursive=True):
  size =os.path.getsize(filename)
  if size % 4096 == 0 and size != 0:
    size_dir[filename] = os.path.getsize(filename)

for name, size in size_dir.items():
  print(name, size)

Windows .bat file:

@echo off
for /r %1 %%a in (*) do (
  setlocal enableDelayedExpansion
  set /a rem=%%~za %% 4096
  if !rem! == 0 echo %%a
  endlocal
)
pause

Windows .bat file that uses PowerShell:

@powershell -c ^
  "gci -r $(if('%1'){'%1'+'\*'}else{''}) | ?{ $_.Length%%4096 -eq 0 } | %%{ $_.FullName }"
@pause

这篇关于Chrome扩展程序在打开弹出窗口时损坏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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