Skip to content

Commit fb09b09

Browse files
committed
Remove support for cap_user_stylesheet
All supported browsers support user stylesheets, and in any case filter list maintainers shouldn't have to worry about whether user stylesheets are supported or not.
1 parent 57ade5f commit fb09b09

5 files changed

Lines changed: 7 additions & 24 deletions

File tree

platform/common/vapi-background.js

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,6 @@ if ( vAPI.canWASM === false ) {
4141
vAPI.canWASM = csp !== undefined && csp.indexOf("'wasm-unsafe-eval'") !== -1;
4242
}
4343

44-
vAPI.supportsUserStylesheets = vAPI.webextFlavor.soup.has('user_stylesheet');
45-
4644
/******************************************************************************/
4745

4846
vAPI.app = {
@@ -342,14 +340,9 @@ vAPI.Tabs = class {
342340
}
343341

344342
async insertCSS(tabId, details) {
345-
if ( vAPI.supportsUserStylesheets ) {
346-
details.cssOrigin = 'user';
347-
}
348-
try {
349-
await webext.tabs.insertCSS(...arguments);
350-
}
351-
catch {
352-
}
343+
details.cssOrigin = 'user';
344+
try { await webext.tabs.insertCSS(...arguments); }
345+
catch { }
353346
}
354347

355348
async query(queryInfo) {
@@ -363,14 +356,9 @@ vAPI.Tabs = class {
363356
}
364357

365358
async removeCSS(tabId, details) {
366-
if ( vAPI.supportsUserStylesheets ) {
367-
details.cssOrigin = 'user';
368-
}
369-
try {
370-
await webext.tabs.removeCSS(...arguments);
371-
}
372-
catch {
373-
}
359+
details.cssOrigin = 'user';
360+
try { await webext.tabs.removeCSS(...arguments); }
361+
catch { }
374362
}
375363

376364
// Properties of the details object:

platform/common/vapi-common.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -186,15 +186,13 @@ vAPI.webextFlavor = {
186186
flavor.isGecko = extensionOrigin.startsWith('moz-extension://');
187187
if ( flavor.isGecko ) {
188188
soup.add('firefox')
189-
.add('user_stylesheet')
190189
.add('html_filtering');
191190
const match = /Firefox\/(\d+)/.exec(ua);
192191
flavor.major = match && parseInt(match[1], 10) || 115;
193192
} else {
194193
const match = /\bChrom(?:e|ium)\/(\d+)/.exec(ua);
195194
if ( match !== null ) {
196-
soup.add('chromium')
197-
.add('user_stylesheet');
195+
soup.add('chromium');
198196
}
199197
flavor.major = match && parseInt(match[1], 10) || 120;
200198
// Brave can't be told apart through the user agent string, which is

platform/mv3/extension/js/offscreen/compile-filters.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,6 @@ async function updateList(list) {
327327
'mv3',
328328
'ublock',
329329
'ubol',
330-
'user_stylesheet',
331330
],
332331
};
333332
const asset = { urls: [ list.id ] };

platform/mv3/make-rulesets.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@ const env = [
8282
'mv3',
8383
'ublock',
8484
'ubol',
85-
'user_stylesheet',
8685
...envExtra,
8786
];
8887

src/js/static-filtering-parser.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4240,7 +4240,6 @@ export const utils = (( ) => {
42404240
[ 'env_mv3', 'mv3' ],
42414241
[ 'env_safari', 'safari' ],
42424242
[ 'cap_html_filtering', 'html_filtering' ],
4243-
[ 'cap_user_stylesheet', 'user_stylesheet' ],
42444243
[ 'cap_ipaddress', 'ipaddress' ],
42454244
[ 'false', 'false' ],
42464245
// Hoping ABP-only list maintainers can at least make use of it to

0 commit comments

Comments
 (0)