mirror of https://github.com/gorhill/uBlock.git
Use `CSS.supports()` to detect support of native `:has()`
Related issue: https://github.com/uBlockOrigin/uBlock-issues/issues/2480#issuecomment-1868595930
This commit is contained in:
parent
abbff2dea9
commit
38bde79146
|
@ -178,38 +178,24 @@ vAPI.webextFlavor = {
|
||||||
soup.add('mobile');
|
soup.add('mobile');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Asynchronous
|
if ( CSS.supports('selector(a:has(b))') ) {
|
||||||
if (
|
soup.add('native_css_has');
|
||||||
browser instanceof Object &&
|
|
||||||
typeof browser.runtime.getBrowserInfo === 'function'
|
|
||||||
) {
|
|
||||||
browser.runtime.getBrowserInfo().then(info => {
|
|
||||||
flavor.major = parseInt(info.version, 10) || flavor.major;
|
|
||||||
soup.add(info.vendor.toLowerCase())
|
|
||||||
.add(info.name.toLowerCase());
|
|
||||||
if ( flavor.major >= 121 && soup.has('mobile') === false ) {
|
|
||||||
soup.add('native_css_has');
|
|
||||||
}
|
|
||||||
dispatch();
|
|
||||||
});
|
|
||||||
if ( browser.runtime.getURL('').startsWith('moz-extension://') ) {
|
|
||||||
soup.add('firefox')
|
|
||||||
.add('user_stylesheet')
|
|
||||||
.add('html_filtering');
|
|
||||||
flavor.major = 115;
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Synchronous -- order of tests is important
|
// Order of tests is important
|
||||||
const match = /\bChrom(?:e|ium)\/([\d.]+)/.exec(ua);
|
if ( browser.runtime.getURL('').startsWith('moz-extension://') ) {
|
||||||
if ( match !== null ) {
|
soup.add('firefox')
|
||||||
soup.add('chromium')
|
.add('user_stylesheet')
|
||||||
.add('user_stylesheet');
|
.add('html_filtering');
|
||||||
flavor.major = parseInt(match[1], 10) || 0;
|
const match = /Firefox\/(\d+)/.exec(ua);
|
||||||
if ( flavor.major >= 105 ) {
|
flavor.major = match && parseInt(match[1], 10) || 115;
|
||||||
soup.add('native_css_has');
|
} else {
|
||||||
|
const match = /\bChrom(?:e|ium)\/(\d+)/.exec(ua);
|
||||||
|
if ( match !== null ) {
|
||||||
|
soup.add('chromium')
|
||||||
|
.add('user_stylesheet');
|
||||||
}
|
}
|
||||||
|
flavor.major = match && parseInt(match[1], 10) || 120;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Don't starve potential listeners
|
// Don't starve potential listeners
|
||||||
|
|
Loading…
Reference in New Issue