@@ -111,9 +111,7 @@ vAPI.storage = chrome.storage.local;
111
111
112
112
vAPI . browserSettings = ( function ( ) {
113
113
// Not all platforms support `chrome.privacy`.
114
- if ( chrome . privacy instanceof Object === false ) {
115
- return ;
116
- }
114
+ if ( chrome . privacy instanceof Object === false ) { return ; }
117
115
118
116
return {
119
117
// Whether the WebRTC-related privacy API is crashy is an open question
@@ -122,11 +120,7 @@ vAPI.browserSettings = (function() {
122
120
// an iframe) for platforms where it's a non-issue.
123
121
// https://github.com/uBlockOrigin/uBlock-issues/issues/9
124
122
// Some Chromium builds are made to look like a Chrome build.
125
- webRTCSupported : ( function ( ) {
126
- if ( vAPI . webextFlavor . soup . has ( 'chromium' ) === false ) {
127
- return true ;
128
- }
129
- } ) ( ) ,
123
+ webRTCSupported : vAPI . webextFlavor . soup . has ( 'chromium' ) === false || undefined ,
130
124
131
125
// Calling with `true` means IP address leak is not prevented.
132
126
// https://github.com/gorhill/uBlock/issues/533
@@ -145,16 +139,13 @@ vAPI.browserSettings = (function() {
145
139
// place.
146
140
if ( setting ) { return ; }
147
141
this . webRTCSupported = { setting : setting } ;
148
- var iframe = document . createElement ( 'iframe' ) ;
149
- var me = this ;
150
- var messageHandler = function ( ev ) {
151
- if ( ev . origin !== self . location . origin ) {
152
- return ;
153
- }
142
+ let iframe = document . createElement ( 'iframe' ) ;
143
+ const messageHandler = ev => {
144
+ if ( ev . origin !== self . location . origin ) { return ; }
154
145
window . removeEventListener ( 'message' , messageHandler ) ;
155
- var setting = me . webRTCSupported . setting ;
156
- me . webRTCSupported = ev . data === 'webRTCSupported' ;
157
- me . setWebrtcIPAddress ( setting ) ;
146
+ const setting = this . webRTCSupported . setting ;
147
+ this . webRTCSupported = ev . data === 'webRTCSupported' ;
148
+ this . setWebrtcIPAddress ( setting ) ;
158
149
iframe . parentNode . removeChild ( iframe ) ;
159
150
iframe = null ;
160
151
} ;
@@ -175,12 +166,10 @@ vAPI.browserSettings = (function() {
175
166
// WebRTC not supported: `webRTCMultipleRoutesEnabled` can NOT be
176
167
// safely accessed. Accessing the property will cause full browser
177
168
// crash.
178
- if ( this . webRTCSupported !== true ) {
179
- return ;
180
- }
169
+ if ( this . webRTCSupported !== true ) { return ; }
181
170
182
- var cp = chrome . privacy ,
183
- cpn = cp . network ;
171
+ const cp = chrome . privacy ;
172
+ const cpn = cp . network ;
184
173
185
174
// Older version of Chromium do not support this setting, and is
186
175
// marked as "deprecated" since Chromium 48.
@@ -210,9 +199,14 @@ vAPI.browserSettings = (function() {
210
199
} , vAPI . resetLastError ) ;
211
200
} else {
212
201
// https://github.com/uBlockOrigin/uAssets/issues/333#issuecomment-289426678
213
- // - Leverage virtuous side-effect of strictest setting.
202
+ // Leverage virtuous side-effect of strictest setting.
203
+ // https://github.com/gorhill/uBlock/issues/3009
204
+ // Firefox currently works differently, use
205
+ // `default_public_interface_only` for now.
214
206
cpn . webRTCIPHandlingPolicy . set ( {
215
- value : 'disable_non_proxied_udp' ,
207
+ value : vAPI . webextFlavor . soup . has ( 'chromium' )
208
+ ? 'disable_non_proxied_udp'
209
+ : 'default_public_interface_only' ,
216
210
scope : 'regular'
217
211
} , vAPI . resetLastError ) ;
218
212
}
0 commit comments