Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
gontazaka committed May 1, 2023
2 parents a69124b + 2059f84 commit d6bb81a
Show file tree
Hide file tree
Showing 20 changed files with 214 additions and 124 deletions.
39 changes: 28 additions & 11 deletions assets/assets.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@
"assets/ublock/filters.txt"
],
"cdnURLs": [
"https://ublockorigin.github.io/uAssetsCDN/filters/filters.txt",
"https://ublockorigin.pages.dev/filters/filters.txt",
"https://cdn.jsdelivr.net/gh/uBlockOrigin/uAssetsCDN@main/filters/filters.txt",
"https://cdn.statically.io/gh/uBlockOrigin/uAssetsCDN/main/filters/filters.txt"
"https://ublockorigin.github.io/uAssetsCDN/filters/filters.min.txt",
"https://ublockorigin.pages.dev/filters/filters.min.txt",
"https://cdn.jsdelivr.net/gh/uBlockOrigin/uAssetsCDN@main/filters/filters.min.txt",
"https://cdn.statically.io/gh/uBlockOrigin/uAssetsCDN/main/filters/filters.min.txt"
],
"supportURL": "https://github.com/uBlockOrigin/uAssets"
},
Expand Down Expand Up @@ -78,10 +78,10 @@
"assets/ublock/privacy.txt"
],
"cdnURLs": [
"https://ublockorigin.github.io/uAssetsCDN/filters/privacy.txt",
"https://ublockorigin.pages.dev/filters/privacy.txt",
"https://cdn.jsdelivr.net/gh/uBlockOrigin/uAssetsCDN@main/filters/privacy.txt",
"https://cdn.statically.io/gh/uBlockOrigin/uAssetsCDN/main/filters/privacy.txt"
"https://ublockorigin.github.io/uAssetsCDN/filters/privacy.min.txt",
"https://ublockorigin.pages.dev/filters/privacy.min.txt",
"https://cdn.jsdelivr.net/gh/uBlockOrigin/uAssetsCDN@main/filters/privacy.min.txt",
"https://cdn.statically.io/gh/uBlockOrigin/uAssetsCDN/main/filters/privacy.min.txt"
],
"supportURL": "https://github.com/uBlockOrigin/uAssets"
},
Expand Down Expand Up @@ -166,6 +166,7 @@
"cdnURLs": [
"https://cdn.jsdelivr.net/gh/uBlockOrigin/uAssetsCDN@main/thirdparties/easylist.txt",
"https://cdn.statically.io/gh/uBlockOrigin/uAssetsCDN/main/thirdparties/easylist.txt",
"https://ublockorigin.pages.dev/thirdparties/easylist.txt",
"https://easylist.to/easylist/easylist.txt"
],
"supportURL": "https://easylist.to/"
Expand Down Expand Up @@ -205,6 +206,7 @@
"cdnURLs": [
"https://cdn.jsdelivr.net/gh/uBlockOrigin/uAssetsCDN@main/thirdparties/easyprivacy.txt",
"https://cdn.statically.io/gh/uBlockOrigin/uAssetsCDN/main/thirdparties/easyprivacy.txt",
"https://ublockorigin.pages.dev/thirdparties/easyprivacy.txt",
"https://easylist.to/easylist/easyprivacy.txt"
],
"supportURL": "https://easylist.to/"
Expand Down Expand Up @@ -289,18 +291,33 @@
"group": "social",
"off": true,
"title": "EasyList Cookie",
"contentURL": "https://secure.fanboy.co.nz/fanboy-cookiemonster_ubo.txt",
"contentURL": [
"https://ublockorigin.github.io/uAssets/thirdparties/easylist-cookies.txt",
"https://secure.fanboy.co.nz/fanboy-cookiemonster_ubo.txt"
],
"cdnURLs": [
"https://ublockorigin.github.io/uAssetsCDN/thirdparties/easylist-cookies.txt",
"https://ublockorigin.pages.dev/thirdparties/easylist-cookies.txt",
"https://cdn.jsdelivr.net/gh/uBlockOrigin/uAssetsCDN@main/thirdparties/easylist-cookies.txt",
"https://cdn.statically.io/gh/uBlockOrigin/uAssetsCDN/main/thirdparties/easylist-cookies.txt"
],
"supportURL": "https://github.com/easylist/easylist#fanboy-lists"
},
"fanboy-social": {
"content": "filters",
"group": "social",
"off": true,
"title": "Fanboy’s Social",
"title": "EasyList Social",
"contentURL": [
"https://easylist.to/easylist/fanboy-social.txt",
"https://ublockorigin.github.io/uAssets/thirdparties/easylist-social.txt",
"https://secure.fanboy.co.nz/fanboy-social.txt"
],
"cdnURLs": [
"https://ublockorigin.github.io/uAssetsCDN/thirdparties/easylist-social.txt",
"https://ublockorigin.pages.dev/thirdparties/easylist-social.txt",
"https://cdn.jsdelivr.net/gh/uBlockOrigin/uAssetsCDN@main/thirdparties/easylist-social.txt",
"https://cdn.statically.io/gh/uBlockOrigin/uAssetsCDN/main/thirdparties/easylist-social.txt"
],
"supportURL": "https://easylist.to/"
},
"ublock-annoyances": {
Expand Down
110 changes: 72 additions & 38 deletions assets/resources/scriptlets.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ function safeSelf() {
'RegExp': self.RegExp,
'RegExp_test': self.RegExp.prototype.test,
'RegExp_exec': self.RegExp.prototype.exec,
'addEventListener': self.EventTarget.prototype.addEventListener,
'removeEventListener': self.EventTarget.prototype.removeEventListener,
'log': console.log.bind(console),
'uboLog': function(msg) {
if ( msg === '' ) { return; }
Expand Down Expand Up @@ -117,6 +119,39 @@ function shouldLog(details) {
return scriptletGlobals.has('canDebug') && details.log;
}

/******************************************************************************/

builtinScriptlets.push({
name: 'run-at.fn',
fn: runAt,
dependencies: [
'safe-self.fn',
],
});
function runAt(fn, when) {
const intFromReadyState = state => {
return ({
loading: 1,
interactive: 2,
end: 2,
complete: 3,
idle: 3,
})[`${state}`] || 0;
};
const runAt = intFromReadyState(when);
if ( intFromReadyState(document.readyState) >= runAt ) {
fn(); return;
}
const onStateChange = ( ) => {
if ( intFromReadyState(document.readyState) < runAt ) { return; }
fn();
safe.removeEventListener.apply(document, args);
};
const safe = safeSelf();
const args = [ 'readystatechange', onStateChange, { capture: true } ];
safe.addEventListener.apply(document, args);
}

/*******************************************************************************
Injectable scriptlets
Expand Down Expand Up @@ -432,6 +467,7 @@ builtinScriptlets.push({
fn: addEventListenerDefuser,
dependencies: [
'pattern-to-regex.fn',
'run-at.fn',
'safe-self.fn',
'should-debug.fn',
'should-log.fn',
Expand All @@ -445,37 +481,45 @@ function addEventListenerDefuser(
const details = typeof arg1 !== 'object'
? { type: arg1, pattern: arg2 }
: arg1;
let { type = '', pattern = '' } = details;
const { type = '', pattern = '' } = details;
if ( typeof type !== 'string' ) { return; }
if ( typeof pattern !== 'string' ) { return; }
const safe = safeSelf();
const reType = patternToRegex(type);
const rePattern = patternToRegex(pattern);
const log = shouldLog(details);
const debug = shouldDebug(details);
const proto = self.EventTarget.prototype;
proto.addEventListener = new Proxy(proto.addEventListener, {
apply: function(target, thisArg, args) {
let type, handler;
try {
type = String(args[0]);
handler = String(args[1]);
} catch(ex) {
}
const matchesType = safe.RegExp_test.call(reType, type);
const matchesHandler = safe.RegExp_test.call(rePattern, handler);
const matchesEither = matchesType || matchesHandler;
const matchesBoth = matchesType && matchesHandler;
if ( log === 1 && matchesBoth || log === 2 && matchesEither || log === 3 ) {
safe.uboLog(`addEventListener('${type}', ${handler})`);
}
if ( debug === 1 && matchesBoth || debug === 2 && matchesEither ) {
debugger; // jshint ignore:line
const trapEddEventListeners = ( ) => {
const eventListenerHandler = {
apply: function(target, thisArg, args) {
let type, handler;
try {
type = String(args[0]);
handler = String(args[1]);
} catch(ex) {
}
const matchesType = safe.RegExp_test.call(reType, type);
const matchesHandler = safe.RegExp_test.call(rePattern, handler);
const matchesEither = matchesType || matchesHandler;
const matchesBoth = matchesType && matchesHandler;
if ( log === 1 && matchesBoth || log === 2 && matchesEither || log === 3 ) {
safe.uboLog(`addEventListener('${type}', ${handler})`);
}
if ( debug === 1 && matchesBoth || debug === 2 && matchesEither ) {
debugger; // jshint ignore:line
}
if ( matchesBoth ) { return; }
return Reflect.apply(target, thisArg, args);
}
if ( matchesBoth ) { return; }
return Reflect.apply(target, thisArg, args);
}
});
};
self.EventTarget.prototype.addEventListener = new Proxy(
self.EventTarget.prototype.addEventListener,
eventListenerHandler
);
};
runAt(( ) => {
trapEddEventListeners();
}, details.runAt);
}

/******************************************************************************/
Expand Down Expand Up @@ -979,6 +1023,9 @@ builtinScriptlets.push({
name: 'set-constant.js',
aliases: [ 'set.js' ],
fn: setConstant,
dependencies: [
'run-at.fn',
],
});
function setConstant(
arg1 = '',
Expand Down Expand Up @@ -1144,22 +1191,9 @@ function setConstant(
};
trapChain(window, chain);
}
const runAt = details.runAt;
if ( runAt === 0 ) {
setConstant(chain, cValue); return;
}
const docReadyState = ( ) => {
return ({ loading: 1, interactive: 2, complete: 3, })[document.readyState] || 0;
};
if ( docReadyState() >= runAt ) {
setConstant(chain, cValue); return;
}
const onReadyStateChange = ( ) => {
if ( docReadyState() < runAt ) { return; }
runAt(( ) => {
setConstant(chain, cValue);
document.removeEventListener('readystatechange', onReadyStateChange);
};
document.addEventListener('readystatechange', onReadyStateChange);
}, details.runAt);
}

/******************************************************************************/
Expand Down
4 changes: 2 additions & 2 deletions dist/firefox/updates.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
"[email protected]": {
"updates": [
{
"version": "1.49.1.8",
"version": "1.49.3.4",
"browser_specific_settings": { "gecko": { "strict_min_version": "79.0" } },
"update_link": "https://github.com/gorhill/uBlock/releases/download/1.49.1b8/uBlock0_1.49.1b8.firefox.signed.xpi"
"update_link": "https://github.com/gorhill/uBlock/releases/download/1.49.3b4/uBlock0_1.49.3b4.firefox.signed.xpi"
}
]
}
Expand Down
2 changes: 1 addition & 1 deletion dist/version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.49.1.8
1.49.3.4
2 changes: 1 addition & 1 deletion platform/mv3/extension/_locales/sq/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@
"description": "The header text for the default filtering mode section"
},
"defaultFilteringModeDescription": {
"message": "Mënyra standarde e filtrimit mund të ndryshohet në çdo kohë, në varësi të kërkesave që kanë uebsajte të caktuara. Secila mënyrë ka avantazhet dhe disavantazhet e veta.",
"message": "Mënyra standarde e filtrimit mund të ndryshohet në çdo kohë sipas kërkesave që kanë uebsajte të caktuara. Secila mënyrë ka avantazhet dhe disavantazhet e veta.",
"description": "This describes the default filtering mode setting"
},
"filteringMode0Name": {
Expand Down
4 changes: 2 additions & 2 deletions platform/thunderbird/manifest.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"applications": {
"browser_specific_settings": {
"gecko": {
"id": "[email protected]",
"strict_min_version": "78.0"
"strict_min_version": "91.0"
}
},
"author": "Raymond Hill & contributors",
Expand Down
12 changes: 6 additions & 6 deletions src/_locales/sq/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@
"description": "Checkbox to let user access advanced, technical features"
},
"settingsPrefetchingDisabledPrompt": {
"message": "Çaktivizoj kërkesat paraprake (për të mos pasur lidhje me kërkesat e bllokuara)",
"message": "Çaktivizoj kërkesat paraprake (për të shmangur lidhjet me kërkesat e bllokuara)",
"description": "English: "
},
"settingsHyperlinkAuditingDisabledPrompt": {
Expand All @@ -372,7 +372,7 @@
"description": ""
},
"settingPerSiteSwitchGroupSynopsis": {
"message": "Këto vlera mund të ndryshohen për çdo uebsajt",
"message": "Këto vlera mund të ndryshohen sipas uebsajtit",
"description": ""
},
"settingsNoCosmeticFilteringPrompt": {
Expand Down Expand Up @@ -712,7 +712,7 @@
"description": "A keyword in the built-in row filtering expression"
},
"loggerRowFiltererBuiltinAllowed": {
"message": "e autorizuar",
"message": "e lejuar",
"description": "A keyword in the built-in row filtering expression"
},
"loggerRowFiltererBuiltinModified": {
Expand Down Expand Up @@ -788,7 +788,7 @@
"description": "Used in the static filtering wizard"
},
"loggerStaticFilteringSentencePartAllow": {
"message": "Autorizoj",
"message": "Lejoj",
"description": "Used in the static filtering wizard"
},
"loggerStaticFilteringSentencePartType": {
Expand Down Expand Up @@ -916,7 +916,7 @@
"description": "First paragraph of 'Filter issues' section in Support pane"
},
"supportS3P2": {
"message": "<b>Kujdes:</b> uBlock Origin nuk duhet përdorur njëkohësisht me aplikacionet e ngjashme bllokuese, pasi filtrat mund të shfaqin probleme.",
"message": "<b>Kujdes:</b> uBlock Origin nuk duhet përdorur njëkohësisht me aplikacione të ngjashme bllokuese, pasi mund të keni probleme me filtrat.",
"description": "Second paragraph of 'Filter issues' section in Support pane"
},
"supportS3P3": {
Expand Down Expand Up @@ -1220,7 +1220,7 @@
"description": "An entry in the browser's contextual menu"
},
"contextMenuTemporarilyAllowLargeMediaElements": {
"message": "Autorizoj përkohësisht elementet e mëdha multimediale",
"message": "Lejoj përkohësisht elementet e mëdha multimediale",
"description": "A context menu entry, present when large media elements have been blocked on the current site"
},
"contextMenuViewSource": {
Expand Down
6 changes: 3 additions & 3 deletions src/_locales/zh_CN/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -952,11 +952,11 @@
"description": "A paragraph in the filter issue reporter section"
},
"supportS6P2S1": {
"message": "过滤规则列表每天都会更新。请确认用最新列表无法解决您的问题",
"message": "过滤规则列表每天都会更新。请确认您的问题无法用最新的过滤规则列表解决",
"description": "A paragraph in the filter issue reporter section"
},
"supportS6P2S2": {
"message": "请验证刷新页面后问题依然存在",
"message": "请验证重新加载问题页面后问题依然存在",
"description": "A paragraph in the filter issue reporter section"
},
"supportS6URL": {
Expand Down Expand Up @@ -1276,7 +1276,7 @@
"description": "Summary of number of errors as reported by the linter "
},
"unprocessedRequestTooltip": {
"message": "无法在浏览器启动时正常过滤。请刷新页面以确保正常过滤",
"message": "无法在浏览器启动时正常过滤。请重新加载此页面以确保正常过滤",
"description": "A warning which will appear in the popup panel if needed"
},
"dummy": {
Expand Down
7 changes: 6 additions & 1 deletion src/css/codemirror.css
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,10 @@
direction: ltr;
display: flex;
flex-shrink: 0;
flex-wrap: wrap;
justify-content: space-between;
padding: 0.5em;
padding: var(--default-gap-xsmall);
row-gap: var(--default-gap-xsmall);
user-select: none;
-moz-user-select: none;
-webkit-user-select: none;
Expand Down Expand Up @@ -220,6 +222,9 @@
.cm-search-widget .sourceURL[href=""] {
visibility: hidden;
}
:root.mobile .cm-search-widget .sourceURL[href=""] {
display: none;
}

.cm-linter-widget {
align-items: center;
Expand Down
Loading

0 comments on commit d6bb81a

Please sign in to comment.