Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"No matching signature" error on adding a chrome.webRequest listener

I have this code:

chrome.webRequest.onCompleted.addListener(function(details){
  console.log(details);
});

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.

like image 955
jihuuNI Avatar asked Sep 01 '19 11:09

jihuuNI


1 Answers

"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.

like image 137
wOxxOm Avatar answered Oct 02 '22 13:10

wOxxOm