From a2d83afe66a6c62de1cb4283b4b0fd65b5b5af12 Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Sun, 6 Feb 2022 09:00:25 -0500 Subject: [PATCH] Further narrow when unconditionally calling webRTCIPHandlingPolicy.clear() The enabled cached state probably exists in the browser only when the setting was originally enabled -- so we need to clear it only in such case. --- platform/common/vapi-background.js | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/platform/common/vapi-background.js b/platform/common/vapi-background.js index cd00a322e..6cafb805c 100644 --- a/platform/common/vapi-background.js +++ b/platform/common/vapi-background.js @@ -152,7 +152,7 @@ vAPI.browserSettings = (( ) => { } break; - case 'webrtcIPAddress': + case 'webrtcIPAddress': { // https://github.com/uBlockOrigin/uBlock-issues/issues/1928 // https://www.reddit.com/r/uBlockOrigin/comments/sl7p74/ // Hypothetical: some browsers _think_ uBO is still using @@ -161,26 +161,27 @@ vAPI.browserSettings = (( ) => { // using the setting appears to solve those unexpected // reported occurrences of uBO interfering despite never // using the API. + const mustEnable = !details[setting]; if ( this.canLeakLocalIPAddresses === false ) { - if ( vAPI.webextFlavor.soup.has('chromium') ) { + if ( mustEnable && vAPI.webextFlavor.soup.has('chromium') ) { bp.network.webRTCIPHandlingPolicy.clear({ scope: 'regular', }); } - return; + continue; } - if ( !!details[setting] ) { - bp.network.webRTCIPHandlingPolicy.clear({ - scope: 'regular', - }); - } else { + if ( mustEnable ) { bp.network.webRTCIPHandlingPolicy.set({ value: 'default_public_interface_only', scope: 'regular' }); + } else { + bp.network.webRTCIPHandlingPolicy.clear({ + scope: 'regular', + }); } break; - + } default: break; }