mirror of
https://github.com/gorhill/uBlock.git
synced 2026-03-11 09:04:36 +00:00
[mv3][safari] Internally disable strict-blocking in Safari
Related discussion: https://github.com/uBlockOrigin/uAssets/issues/30118#issuecomment-3315925462
This commit is contained in:
parent
1209119206
commit
511a59584d
6 changed files with 28 additions and 20 deletions
|
|
@ -86,6 +86,10 @@ h3[data-i18n="filteringMode0Name"]::first-letter {
|
|||
text-transform: capitalize;
|
||||
}
|
||||
|
||||
body[data-platform="safari"] [data-platform-exclude="safari"] {
|
||||
display: none;
|
||||
}
|
||||
|
||||
body:not(.committing) #commit-spinner {
|
||||
display: none;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@
|
|||
<div data-i18n="completeFilteringModeDescription"></div>
|
||||
</label>
|
||||
</div>
|
||||
<p><label id="strictBlockMode" data-i18n="enableStrictBlockLabel"><span class="input checkbox"><input type="checkbox"><svg viewBox="0 0 24 24"><path d="M1.73,12.91 8.1,19.28 22.79,4.59"/></svg></span>_</label><legend data-i18n="enableStrictBlockLegend"></legend>
|
||||
<p data-platform-exclude="safari"><label id="strictBlockMode" data-i18n="enableStrictBlockLabel"><span class="input checkbox"><input type="checkbox"><svg viewBox="0 0 24 24"><path d="M1.73,12.91 8.1,19.28 22.79,4.59"/></svg></span>_</label><legend data-i18n="enableStrictBlockLegend"></legend>
|
||||
<p id="developerMode"><label data-i18n="developerModeLabel"><span class="input checkbox"><input type="checkbox"><svg viewBox="0 0 24 24"><path d="M1.73,12.91 8.1,19.28 22.79,4.59"/></svg></span>_</label><legend data-i18n="developerModeLegend"></legend>
|
||||
</div>
|
||||
</section>
|
||||
|
|
|
|||
|
|
@ -109,18 +109,6 @@ function getCurrentVersion() {
|
|||
return runtime.getManifest().version;
|
||||
}
|
||||
|
||||
// The goal is just to be able to find out whether a specific version is older
|
||||
// than another one.
|
||||
|
||||
function intFromVersion(version) {
|
||||
const match = /^(\d+)\.(\d+)\.(\d+)$/.exec(version);
|
||||
if ( match === null ) { return 0; }
|
||||
const year = parseInt(match[1], 10);
|
||||
const monthday = parseInt(match[2], 10);
|
||||
const min = parseInt(match[3], 10);
|
||||
return (year - 2022) * (1232 * 2400) + monthday * 2400 + min;
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
async function onPermissionsRemoved() {
|
||||
|
|
@ -566,13 +554,6 @@ async function startSession() {
|
|||
// obsolete ruleset to remove.
|
||||
if ( isNewVersion ) {
|
||||
ubolLog(`Version change: ${rulesetConfig.version} => ${currentVersion}`);
|
||||
// https://github.com/uBlockOrigin/uBOL-home/issues/428#issuecomment-3172663563
|
||||
if ( webextFlavor === 'safari' && rulesetConfig.strictBlockMode ) {
|
||||
const before = intFromVersion(rulesetConfig.version);
|
||||
if ( before <= intFromVersion('2025.804.2359') ) {
|
||||
rulesetConfig.strictBlockMode = false;
|
||||
}
|
||||
}
|
||||
rulesetConfig.version = currentVersion;
|
||||
await patchDefaultRulesets();
|
||||
saveRulesetConfig();
|
||||
|
|
|
|||
|
|
@ -26,10 +26,13 @@ import {
|
|||
localWrite,
|
||||
runtime,
|
||||
sendMessage,
|
||||
webextFlavor,
|
||||
} from './ext.js';
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
dom.body.dataset.platform = webextFlavor;
|
||||
|
||||
{
|
||||
const manifest = runtime.getManifest();
|
||||
dom.text('#aboutNameVer', `${manifest.name} ${manifest.version}`);
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ import {
|
|||
localRead, localRemove, localWrite,
|
||||
runtime,
|
||||
sessionRead, sessionRemove, sessionWrite,
|
||||
webextFlavor,
|
||||
} from './ext.js';
|
||||
|
||||
import {
|
||||
|
|
@ -237,6 +238,11 @@ async function updateStrictBlockRules(currentRules, addRules, removeRuleIds) {
|
|||
|
||||
if ( rulesetConfig.strictBlockMode === false ) { return; }
|
||||
|
||||
// https://github.com/uBlockOrigin/uBOL-home/issues/428#issuecomment-3172663563
|
||||
// https://bugs.webkit.org/show_bug.cgi?id=298199
|
||||
// https://developer.apple.com/forums/thread/756214
|
||||
if ( webextFlavor === 'safari' ) { return; }
|
||||
|
||||
const [
|
||||
hasOmnipotence,
|
||||
rulesetDetails,
|
||||
|
|
|
|||
|
|
@ -195,6 +195,20 @@ const strArrayEq = (a = [], b = [], sort = true) => {
|
|||
|
||||
/******************************************************************************/
|
||||
|
||||
// The goal is just to be able to find out whether a specific version is older
|
||||
// than another one.
|
||||
|
||||
export function intFromVersion(version) {
|
||||
const match = /^(\d+)\.(\d+)\.(\d+)$/.exec(version);
|
||||
if ( match === null ) { return 0; }
|
||||
const year = parseInt(match[1], 10);
|
||||
const monthday = parseInt(match[2], 10);
|
||||
const min = parseInt(match[3], 10);
|
||||
return (year - 2022) * (1232 * 2400) + monthday * 2400 + min;
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
export {
|
||||
broadcastMessage,
|
||||
parsedURLromOrigin,
|
||||
|
|
|
|||
Loading…
Reference in a new issue