diff --git a/platform/chromium/vapi-background.js b/platform/chromium/vapi-background.js index 499693c8d..42a9fead5 100644 --- a/platform/chromium/vapi-background.js +++ b/platform/chromium/vapi-background.js @@ -109,6 +109,26 @@ vAPI.browserSettings = { break; case 'webrtcIPAddress': + // https://github.com/gorhill/uBlock/issues/533#issuecomment-164292868 + // If WebRTC is supported, there won't be an exception if we + // try to instanciate a peer connection object. + var pc = null; + try { + var PC = self.RTCPeerConnection || self.webkitRTCPeerConnection; + if ( PC ) { + pc = new PC(null); + } + } catch (ex) { + console.error(ex); + } + if ( pc === null ) { + break; + } + pc.close(); + + // https://github.com/gorhill/uBlock/issues/533 + // If we reach this point, the property + // `webRTCMultipleRoutesEnabled` can be safely accessed. if ( typeof chrome.privacy.network.webRTCMultipleRoutesEnabled === 'object' ) { try { chrome.privacy.network.webRTCMultipleRoutesEnabled.set({