mirror of https://github.com/gorhill/uBlock.git
re. websocket: mind backward compatibility
This commit is contained in:
parent
2213b005a0
commit
7e55ddf16b
|
@ -1097,6 +1097,18 @@ vAPI.net.registerListeners = function() {
|
||||||
if ( onBeforeRequest ) {
|
if ( onBeforeRequest ) {
|
||||||
urls = this.onBeforeRequest.urls || ['<all_urls>'];
|
urls = this.onBeforeRequest.urls || ['<all_urls>'];
|
||||||
types = this.onBeforeRequest.types || undefined;
|
types = this.onBeforeRequest.types || undefined;
|
||||||
|
if (
|
||||||
|
(validTypes.websocket) &&
|
||||||
|
(types === undefined || types.indexOf('websocket') !== -1) &&
|
||||||
|
(urls.indexOf('<all_urls>') === -1)
|
||||||
|
) {
|
||||||
|
if ( urls.indexOf('ws://*/*') === -1 ) {
|
||||||
|
urls.push('ws://*/*');
|
||||||
|
}
|
||||||
|
if ( urls.indexOf('wss://*/*') === -1 ) {
|
||||||
|
urls.push('wss://*/*');
|
||||||
|
}
|
||||||
|
}
|
||||||
wrApi.onBeforeRequest.addListener(
|
wrApi.onBeforeRequest.addListener(
|
||||||
onBeforeRequest,
|
onBeforeRequest,
|
||||||
{ urls: urls, types: types },
|
{ urls: urls, types: types },
|
||||||
|
|
|
@ -679,9 +679,7 @@ var headerIndexFromName = function(headerName, headers) {
|
||||||
vAPI.net.onBeforeRequest = {
|
vAPI.net.onBeforeRequest = {
|
||||||
urls: [
|
urls: [
|
||||||
'http://*/*',
|
'http://*/*',
|
||||||
'https://*/*',
|
'https://*/*'
|
||||||
'ws://*/*',
|
|
||||||
'wss://*/*'
|
|
||||||
],
|
],
|
||||||
extra: [ 'blocking' ],
|
extra: [ 'blocking' ],
|
||||||
callback: onBeforeRequest
|
callback: onBeforeRequest
|
||||||
|
|
Loading…
Reference in New Issue