From 09d7d1fdc4a2bd8619ad51c56430f7f9c0cdb2cc Mon Sep 17 00:00:00 2001 From: gorhill Date: Sun, 13 Dec 2015 15:38:31 -0500 Subject: [PATCH] this fixes #533 (need confirmation) --- platform/chromium/vapi-background.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) 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({