Browse Source

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.
pull/2/head
Deathamns 10 years ago
committed by gorhill
parent
commit
3e39e1bd9f
  1. 16
      platform/firefox/vapi-client.js

16
platform/firefox/vapi-client.js

@ -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…
Cancel
Save