[mv3][safari] Internally disable strict-blocking in Safari

Related discussion:
https://github.com/uBlockOrigin/uAssets/issues/30118#issuecomment-3315925462
This commit is contained in:
Raymond Hill 2025-09-21 09:43:21 -04:00
parent 1209119206
commit 511a59584d
No known key found for this signature in database
GPG key ID: 25E1490B761470C2
6 changed files with 28 additions and 20 deletions

View file

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

View file

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

View file

@ -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();

View file

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

View file

@ -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,

View file

@ -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,