mirror of
https://github.com/gorhill/uMatrix.git
synced 2024-06-14 00:05:08 +12:00
Firefox: new method for request handling
Now both nsIContentPolicy and on-http-* observers are used for net request monitoring. Reasons: - In many cases, nsIContentPolicy.shouldLoad is invoked twice for the same resource, because of the speculative parsing. - nsIContentPolicy.shouldLoad don't have information about the channel, so it can't redirect the request, nor change its headers, however on-http-opening-request can. Also, local mirroring and inline-script blocking has been implemented.
This commit is contained in:
parent
e70bf61206
commit
3e39e1bd9f
|
@ -95,10 +95,10 @@ vAPI.messaging = {
|
|||
|
||||
this.channels['vAPI'] = {};
|
||||
this.channels['vAPI'].listener = function(msg) {
|
||||
if (msg.cmd === 'injectScript') {
|
||||
if ( msg.cmd === 'injectScript' ) {
|
||||
var details = msg.details;
|
||||
|
||||
if (!details.allFrames && window !== window.top) {
|
||||
if ( !details.allFrames && window !== window.top ) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -108,12 +108,14 @@ vAPI.messaging = {
|
|||
},
|
||||
|
||||
close: function() {
|
||||
if (this.connector) {
|
||||
removeMessageListener(this.connectorId, this.connector);
|
||||
this.connector = null;
|
||||
this.channels = {};
|
||||
this.listeners = {};
|
||||
if ( !this.connector ) {
|
||||
return;
|
||||
}
|
||||
|
||||
removeMessageListener(this.connectorId, this.connector);
|
||||
this.connector = null;
|
||||
this.channels = {};
|
||||
this.listeners = {};
|
||||
},
|
||||
|
||||
channel: function(channelName, callback) {
|
||||
|
|
Loading…
Reference in a new issue