mirror of
https://github.com/gorhill/uBlock.git
synced 2024-10-06 09:37:12 +02:00
Add Chromium detection for Chromium-based MS Edge
Related issue: - https://github.com/uBlockOrigin/uBlock-issues/issues/1174
This commit is contained in:
parent
5c68867b92
commit
39190ff469
@ -75,8 +75,7 @@ vAPI.webextFlavor = {
|
|||||||
dispatch();
|
dispatch();
|
||||||
});
|
});
|
||||||
if ( browser.runtime.getURL('').startsWith('moz-extension://') ) {
|
if ( browser.runtime.getURL('').startsWith('moz-extension://') ) {
|
||||||
soup.add('mozilla')
|
soup.add('firefox')
|
||||||
.add('firefox')
|
|
||||||
.add('user_stylesheet')
|
.add('user_stylesheet')
|
||||||
.add('html_filtering');
|
.add('html_filtering');
|
||||||
flavor.major = 60;
|
flavor.major = 60;
|
||||||
@ -85,29 +84,14 @@ vAPI.webextFlavor = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Synchronous -- order of tests is important
|
// Synchronous -- order of tests is important
|
||||||
let match;
|
const match = /\bChrom(?:e|ium)\/([\d.]+)/.exec(ua);
|
||||||
if ( (match = /\bEdge\/(\d+)/.exec(ua)) !== null ) {
|
if ( match !== null ) {
|
||||||
flavor.major = parseInt(match[1], 10) || 0;
|
|
||||||
soup.add('microsoft').add('edge');
|
|
||||||
} else if ( (match = /\bOPR\/(\d+)/.exec(ua)) !== null ) {
|
|
||||||
const reEx = /\bChrom(?:e|ium)\/([\d.]+)/;
|
|
||||||
if ( reEx.test(ua) ) { match = reEx.exec(ua); }
|
|
||||||
flavor.major = parseInt(match[1], 10) || 0;
|
|
||||||
soup.add('opera').add('chromium');
|
|
||||||
} else if ( (match = /\bChromium\/(\d+)/.exec(ua)) !== null ) {
|
|
||||||
flavor.major = parseInt(match[1], 10) || 0;
|
|
||||||
soup.add('chromium');
|
soup.add('chromium');
|
||||||
} else if ( (match = /\bChrome\/(\d+)/.exec(ua)) !== null ) {
|
|
||||||
flavor.major = parseInt(match[1], 10) || 0;
|
flavor.major = parseInt(match[1], 10) || 0;
|
||||||
soup.add('google').add('chromium');
|
// https://github.com/gorhill/uBlock/issues/3588
|
||||||
} else if ( (match = /\bSafari\/(\d+)/.exec(ua)) !== null ) {
|
if ( flavor.major >= 66 ) {
|
||||||
flavor.major = parseInt(match[1], 10) || 0;
|
soup.add('user_stylesheet');
|
||||||
soup.add('apple').add('safari');
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// https://github.com/gorhill/uBlock/issues/3588
|
|
||||||
if ( soup.has('chromium') && flavor.major >= 66 ) {
|
|
||||||
soup.add('user_stylesheet');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Don't starve potential listeners
|
// Don't starve potential listeners
|
||||||
|
Loading…
Reference in New Issue
Block a user