Fix potential spurious redirection in whitelisted tabless contexts

Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1478
This commit is contained in:
Raymond Hill 2021-01-30 15:08:21 -05:00
parent 28b25f5e5a
commit 0390bb8b8a
No known key found for this signature in database
GPG key ID: 25E1490B761470C2

View file

@ -323,11 +323,16 @@ const onBeforeBehindTheSceneRequest = function(fctxt) {
// use the origin URL as the scope. Most such requests aren't going to
// be blocked, so we test for whitelisting and modify the result only
// when the request is being blocked.
//
// https://github.com/uBlockOrigin/uBlock-issues/issues/1478
// Also remove potential redirection when request is to be
// whitelisted.
if (
result === 1 &&
µb.getNetFilteringSwitch(fctxt.tabOrigin) === false
) {
result = 2;
fctxt.redirectURL = undefined;
fctxt.filter = { engine: 'u', result: 2, raw: 'whitelisted' };
}
}