Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Chrome extension not working properly, am I doing something wrong?

here is the code I use in my Chrome extension. It's an extension that for now just intercepts the requests and prints them in the pop-up.

<script>
function interceptRequest(request) {
  var p = document.createElement("p");
  var text = document.createTextNode("" + request.method + " " + request.url + " " + request.headers);
  p.appendChild(text);
  document.body.appendChild(p);
  document.body.append(request.url);
}

chrome.webRequest.onBeforeRequest.addListener(interceptRequest, null, ['blocking']);
</script>

When I do "inspect pop-up" by right clicking on the extension's icon I get this error from the console: Uncaught Error: Parameter 1 is required. extensions/schema_generated_bindings.js:69

Does anyone know what's going on? It used to work a couple of months ago, then I stopped working on this and now it doesn't work anymore.

Thanks

like image 955
Masiar Avatar asked Jan 17 '23 20:01

Masiar


1 Answers

It seems that the second parameter of chrome.webRequest.onBeforeRequest.addListener (trunk of chrome extensions doc) is no more optional.

like image 171
check_ca Avatar answered Jan 31 '23 07:01

check_ca