mirror of https://github.com/gorhill/uBlock.git
Fix handling of `path` in `set-cookie` scriptlet
As per feedback from filter list volunteers.
This commit is contained in:
parent
f6ee3f9878
commit
7901a00bd7
|
@ -739,7 +739,11 @@ function setCookieHelper(
|
||||||
if ( expires !== '' ) {
|
if ( expires !== '' ) {
|
||||||
cookieParts.push('; expires=', expires);
|
cookieParts.push('; expires=', expires);
|
||||||
}
|
}
|
||||||
if ( path !== '' ) {
|
|
||||||
|
if ( path === '' ) { path = '/'; }
|
||||||
|
else if ( path === 'none' ) { path = ''; }
|
||||||
|
if ( path !== '' && path !== '/' ) { return; }
|
||||||
|
if ( path === '/' ) {
|
||||||
cookieParts.push('; path=/');
|
cookieParts.push('; path=/');
|
||||||
}
|
}
|
||||||
document.cookie = cookieParts.join('');
|
document.cookie = cookieParts.join('');
|
||||||
|
@ -2752,10 +2756,6 @@ function setCookie(
|
||||||
}
|
}
|
||||||
value = encodeURIComponent(value);
|
value = encodeURIComponent(value);
|
||||||
|
|
||||||
const validPaths = [ '', '/', 'none' ];
|
|
||||||
if ( validPaths.includes(path) === false ) { return; }
|
|
||||||
if ( path === 'none' ) { path = ''; }
|
|
||||||
|
|
||||||
setCookieHelper(
|
setCookieHelper(
|
||||||
name,
|
name,
|
||||||
value,
|
value,
|
||||||
|
@ -2894,10 +2894,6 @@ function trustedSetCookie(
|
||||||
expires = time.toUTCString();
|
expires = time.toUTCString();
|
||||||
}
|
}
|
||||||
|
|
||||||
const validPaths = [ '', '/', 'none' ];
|
|
||||||
if ( validPaths.includes(path) === false ) { return; }
|
|
||||||
if ( path === 'none' ) { path = ''; }
|
|
||||||
|
|
||||||
setCookieHelper(
|
setCookieHelper(
|
||||||
name,
|
name,
|
||||||
value,
|
value,
|
||||||
|
|
Loading…
Reference in New Issue