Skip to content

Commit 7e55ddf

Browse files
committed
re. websocket: mind backward compatibility
1 parent 2213b00 commit 7e55ddf

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

platform/chromium/vapi-background.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1097,6 +1097,18 @@ vAPI.net.registerListeners = function() {
10971097
if ( onBeforeRequest ) {
10981098
urls = this.onBeforeRequest.urls || ['<all_urls>'];
10991099
types = this.onBeforeRequest.types || undefined;
1100+
if (
1101+
(validTypes.websocket) &&
1102+
(types === undefined || types.indexOf('websocket') !== -1) &&
1103+
(urls.indexOf('<all_urls>') === -1)
1104+
) {
1105+
if ( urls.indexOf('ws://*/*') === -1 ) {
1106+
urls.push('ws://*/*');
1107+
}
1108+
if ( urls.indexOf('wss://*/*') === -1 ) {
1109+
urls.push('wss://*/*');
1110+
}
1111+
}
11001112
wrApi.onBeforeRequest.addListener(
11011113
onBeforeRequest,
11021114
{ urls: urls, types: types },

src/js/traffic.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -679,9 +679,7 @@ var headerIndexFromName = function(headerName, headers) {
679679
vAPI.net.onBeforeRequest = {
680680
urls: [
681681
'http://*/*',
682-
'https://*/*',
683-
'ws://*/*',
684-
'wss://*/*'
682+
'https://*/*'
685683
],
686684
extra: [ 'blocking' ],
687685
callback: onBeforeRequest

0 commit comments

Comments
 (0)