“没有匹配的签名";添加chrome.webRequest侦听器时出错 [英] "No matching signature" error on adding a chrome.webRequest listener
问题描述
我有此代码:
chrome.webRequest.onCompleted.addListener(function(details){
console.log(details);
});
我正在尝试理解和使用chrome.webRequest API.我无法弄清楚为什么代码不起作用,我只想通过记录chrome发出的所有请求来尝试API.我在清单http://*/*
和https://*/*
的清单中设置了权限,但是我总是会从后台脚本中收到此错误:Uncaught TypeError: No matching signature.
希望能提供任何帮助.
I'm trying to understand and use the chrome.webRequest API. I can't figure why the code isn't working, I just wanna give a try to the API by logging all the requests made by chrome. I've set the permissions in my manifest on these two patterns http://*/*
and https://*/*
but i will always get this error from my background script: Uncaught TypeError: No matching signature.
Any help is appreciated.
推荐答案
没有匹配的签名"表示您传递了错误的参数.您可以在文档的概念和 https://crbug.com .
"No matching signature" means you're passing the wrong parameters. As you can see in the documentation's concepts and examples you need to specify at least two parameters. The documentation for individual methods doesn't mention that which is really confusing, and you can report it on https://crbug.com.
chrome.webRequest.onCompleted.addListener(
function(details) {
console.log(details);
},
{urls: ["<all_urls>"]}
);
要查看后台脚本的控制台,请参见此答案.
To view the background script's console see this answer.
这篇关于“没有匹配的签名";添加chrome.webRequest侦听器时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!