加载脚本时出错(Google Chrome扩展程序)

时间:2012-11-21 17:34:26

标签: javascript html5 google-chrome google-chrome-extension video-game-consoles

我制作了一个适用于Google Chrome扩展程序的脚本。我很快解释道: 有一个名为Dragonbound的在线游戏。脚本的作用是计算你必须向对手射击的力量。好的我已经尝试在外部服务器上容纳我的脚本并且显然已加载但未执行(“正在加载”)。我认为错误可能在代码中(我使用了视频游戏的javascript来创建我的脚本)。副原始代码,json和js调用外部脚本:

Main Javascript in Codeviewer

的manifest.json

{
  "name": "DragonBound Aimbot 2.0",
  "version": "2.0.0",
  "manifest_version": 2,
  "description": "DragonBound Aimbot Hack - HTML5",
   "browser_action": {
    "default_popup": "popup.html",
    "default_icon": "icon.png"
  },
   "permissions": ["tabs", "notifications", "http://*.dropbox.com/u/91461506/*", "https://*.dropbox.com/u/91461506/*"],
   "background": { "page": "background.html", "persistent" : false },
"content_scripts": [
    {
      "matches": ["http://*.dragonbound.net/*","http://*.dropbox.com/u/91461506/*"],
      "js": ["jquery2.js","DragonBoundAimbot.js"],
      "run_at": "document_end"
    }
  ],
  "icons": {"16": "16.png", "48": "48.png", "128": "128.png"},
  "web_accessible_resources": [
    "ranks/*","48.png"
  ],
  "homepage_url" : "http://www.dropbox.com"
}

-Code调用外部脚本:

chrome.extension.sendRequest({type:"init"},function(response){

    if(response.ingame){
        chrome.extension.sendRequest({id:"loading",type:"notification2",text:["Loading","Loading scripts from dropbox.com..."]}, function(response) {});
        chrome.extension.sendRequest({type:"loadscript",url:'http://dl.dropbox.com/u/91461506/prueba2.js',cache:false}, function(response) {
            if(response.type == 1){
                eval(response.scriptcontent);

            }else if(response.type == 0){
                chrome.extension.sendRequest({id:"loading",type:"closenotification2"}, function(response) {})
                chrome.extension.sendRequest({id:"errorloading",time:0,type:"notification2",text:["Error","Failed to load the script, try again later"]}, function(response) {});
            }
        });
    }else{
        chrome.extension.sendRequest({type:"loadscript",url:'http://dl.dropbox.com/u/91461506/page.js',cache:false}, function(response) {
            if(response.type == 1){
                eval(response.scriptcontent);
                PAGEDBA.init();
            }else if(response.type == 0){

            }
        });
    }
});

我上传了谷歌浏览器的扩展程序和未压缩的扩展程序:
Extension of Chrome .CRX

Estension uncompressed .ZIP

Preview Preview 2

视频游戏网页的链接是DragonBound.net

1 个答案:

答案 0 :(得分:1)

您使用eval(),但在Chrome扩展程序中禁用了eval()

http://developer.chrome.com/apps/sandboxingEval.html