@@ -111,9 +111,7 @@ vAPI.storage = chrome.storage.local;
111111
112112vAPI . browserSettings = ( function ( ) {
113113 // Not all platforms support `chrome.privacy`.
114- if ( chrome . privacy instanceof Object === false ) {
115- return ;
116- }
114+ if ( chrome . privacy instanceof Object === false ) { return ; }
117115
118116 return {
119117 // Whether the WebRTC-related privacy API is crashy is an open question
@@ -122,11 +120,7 @@ vAPI.browserSettings = (function() {
122120 // an iframe) for platforms where it's a non-issue.
123121 // https://github.com/uBlockOrigin/uBlock-issues/issues/9
124122 // 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 ,
130124
131125 // Calling with `true` means IP address leak is not prevented.
132126 // https://github.com/gorhill/uBlock/issues/533
@@ -145,16 +139,13 @@ vAPI.browserSettings = (function() {
145139 // place.
146140 if ( setting ) { return ; }
147141 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 ; }
154145 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 ) ;
158149 iframe . parentNode . removeChild ( iframe ) ;
159150 iframe = null ;
160151 } ;
@@ -175,12 +166,10 @@ vAPI.browserSettings = (function() {
175166 // WebRTC not supported: `webRTCMultipleRoutesEnabled` can NOT be
176167 // safely accessed. Accessing the property will cause full browser
177168 // crash.
178- if ( this . webRTCSupported !== true ) {
179- return ;
180- }
169+ if ( this . webRTCSupported !== true ) { return ; }
181170
182- var cp = chrome . privacy ,
183- cpn = cp . network ;
171+ const cp = chrome . privacy ;
172+ const cpn = cp . network ;
184173
185174 // Older version of Chromium do not support this setting, and is
186175 // marked as "deprecated" since Chromium 48.
@@ -210,9 +199,14 @@ vAPI.browserSettings = (function() {
210199 } , vAPI . resetLastError ) ;
211200 } else {
212201 // 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.
214206 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' ,
216210 scope : 'regular'
217211 } , vAPI . resetLastError ) ;
218212 }
0 commit comments