我正在编写一个使用套接字与 Java 服务器通信的 chrome JS 扩展。当我使用以下行时:
var socket = chrome.socket || chrome.experimental.socket;
socket.create('tcp',{},function(createInfo) {
我明白了
Error in event handler for 'tabs.onUpdated': Cannot read property 'socket' of undefined TypeError: Cannot read property 'socket' of undefined
错误(JS 代码在 tabs.onUpdated 函数中)。
我的清单文件是:
{
"manifest_version": 2,
"name": "MitM Phishing Detector",
"description": "This extension protects your browser against phishing attacks based on MitM attacks",
"version": "1.0",
"background": {
"scripts": ["notify.js"],
"persistent": false
},
"browser_action": {
"default_icon": "bluetooth_device.png",
"default_popup": "choose_device.html"
},
"permissions": [
"tabs",
"http://*/*",
"background",
{"socket":
[ "tcp-connect:127.0.0.1:8081" ]
},
"notifications"
]
}