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.
This commit is contained in:
Raymond Hill 2022-02-06 09:00:25 -05:00
parent 19681f510d
commit a2d83afe66
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2
1 changed files with 10 additions and 9 deletions

View File

@ -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;
}