mirror of https://github.com/gorhill/uBlock.git
Support AdGuard's `[trusted-]set-cookie-reload` scriptlets
Related issue: https://github.com/uBlockOrigin/uBlock-issues/issues/2881
This commit is contained in:
parent
5bd40b34cd
commit
9d3acd91b8
|
@ -3395,6 +3395,19 @@ function setCookie(
|
|||
);
|
||||
}
|
||||
|
||||
// For compatiblity with AdGuard
|
||||
builtinScriptlets.push({
|
||||
name: 'set-cookie-reload.js',
|
||||
fn: setCookieReload,
|
||||
world: 'ISOLATED',
|
||||
dependencies: [
|
||||
'set-cookie.js',
|
||||
],
|
||||
});
|
||||
function setCookieReload(name, value, path, ...args) {
|
||||
setCookie(name, value, path, 'reload', '1', ...args);
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* set-local-storage-item.js
|
||||
|
@ -3773,6 +3786,20 @@ function trustedSetCookie(
|
|||
);
|
||||
}
|
||||
|
||||
// For compatiblity with AdGuard
|
||||
builtinScriptlets.push({
|
||||
name: 'trusted-set-cookie-reload.js',
|
||||
requiresTrust: true,
|
||||
fn: trustedSetCookieReload,
|
||||
world: 'ISOLATED',
|
||||
dependencies: [
|
||||
'trusted-set-cookie.js',
|
||||
],
|
||||
});
|
||||
function trustedSetCookieReload(name, value, offsetExpiresSec, path, ...args) {
|
||||
trustedSetCookie(name, value, offsetExpiresSec, path, 'reload', '1', ...args);
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* trusted-set-local-storage-item.js
|
||||
|
|
|
@ -234,7 +234,8 @@ const lookupScriptlet = function(rawToken, mainMap, isolatedMap) {
|
|||
while ( dependencies.length !== 0 ) {
|
||||
const token = dependencies.shift();
|
||||
if ( targetWorldMap.has(token) ) { continue; }
|
||||
const details = reng.contentFromName(token, 'fn/javascript');
|
||||
const details = reng.contentFromName(token, 'fn/javascript') ||
|
||||
reng.contentFromName(token, 'text/javascript');
|
||||
if ( details === undefined ) { continue; }
|
||||
targetWorldMap.set(token, details.js);
|
||||
if ( Array.isArray(details.dependencies) === false ) { continue; }
|
||||
|
|
Loading…
Reference in New Issue