What is the simplest way to make the firefox addon, which repeats this chrome functionality:
chrome.webRequest.onBeforeRequest.addListener(
function(info) {
if(info.url.indexOf("notifier") + 1){
return {redirectUrl: "https://domain.null/1.js"};
}
},
{
urls: [
"*://domain2.null/*"
],
types: ["script"]
}, ["blocking"]);
I know about nsIContentPolicy in firefox, but I don't understand how to use it.
All opinions, advice, and help will be appreciated
Answer
I've determined the problem with the restartless extension.
To block content we can use nsIContentPolicy as Wladimir said. We also can inject script to page with windowListener (aWindow.gBrowser).
For example, this practice works perfectly: https://github.com/jvillalobos/AMO-Admin-Assistant/blob/master/src/bootstrap.js