code review: remove old cruft

This commit is contained in:
gorhill 2017-03-05 17:20:28 -05:00
parent 4c832718d3
commit c271fbbd0d
1 changed files with 31 additions and 55 deletions

View File

@ -1092,20 +1092,9 @@ vAPI.net.registerListeners = function() {
return onHeadersReceivedClient(details);
};
var installListeners = (function() {
//listener = function(details) {
// quickProfiler.start('onBeforeRequest');
// var r = onBeforeRequest(details);
// quickProfiler.stop();
// return r;
//};
var urls, types;
if (
onBeforeRequest &&
wrApi.onBeforeRequest.hasListener(onBeforeRequest) === false
) {
if ( onBeforeRequest ) {
urls = this.onBeforeRequest.urls || ['<all_urls>'];
types = this.onBeforeRequest.types || undefined;
wrApi.onBeforeRequest.addListener(
@ -1117,10 +1106,7 @@ vAPI.net.registerListeners = function() {
// Chromium 48 and lower does not support `ping` type.
// Chromium 56 and higher does support `csp_report` stype.
if (
onBeforeSendHeaders &&
wrApi.onBeforeSendHeaders.hasListener(onBeforeSendHeaders) === false
) {
if ( onBeforeSendHeaders ) {
wrApi.onBeforeSendHeaders.addListener(
onBeforeSendHeaders,
{
@ -1131,10 +1117,7 @@ vAPI.net.registerListeners = function() {
);
}
if (
onHeadersReceived &&
wrApi.onHeadersReceived.hasListener(onHeadersReceived) === false
) {
if ( onHeadersReceived ) {
urls = this.onHeadersReceived.urls || ['<all_urls>'];
types = onHeadersReceivedTypes;
wrApi.onHeadersReceived.addListener(
@ -1143,13 +1126,6 @@ vAPI.net.registerListeners = function() {
this.onHeadersReceived.extra
);
}
// https://github.com/gorhill/uBlock/issues/675
// Experimental: keep polling to be sure our listeners are still installed.
//setTimeout(installListeners, 20000);
}).bind(this);
installListeners();
};
/******************************************************************************/