1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-11-24 03:12:46 +01:00

re. websocket: mind backward compatibility

This commit is contained in:
gorhill 2017-03-06 17:53:25 -05:00
parent 2213b005a0
commit 7e55ddf16b
2 changed files with 13 additions and 3 deletions

View File

@ -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 },

View File

@ -679,9 +679,7 @@ var headerIndexFromName = function(headerName, headers) {
vAPI.net.onBeforeRequest = {
urls: [
'http://*/*',
'https://*/*',
'ws://*/*',
'wss://*/*'
'https://*/*'
],
extra: [ 'blocking' ],
callback: onBeforeRequest