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 ) {
|
||||
urls = this.onBeforeRequest.urls || ['<all_urls>'];
|
||||
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(
|
||||
onBeforeRequest,
|
||||
{ urls: urls, types: types },
|
||||
|
|
|
@ -679,9 +679,7 @@ var headerIndexFromName = function(headerName, headers) {
|
|||
vAPI.net.onBeforeRequest = {
|
||||
urls: [
|
||||
'http://*/*',
|
||||
'https://*/*',
|
||||
'ws://*/*',
|
||||
'wss://*/*'
|
||||
'https://*/*'
|
||||
],
|
||||
extra: [ 'blocking' ],
|
||||
callback: onBeforeRequest
|
||||
|
|
Loading…
Reference in New Issue