feat: Removed legacy stylesheets config and implement c++ mods backen… (#9131)

This commit is contained in:
mr. m
2025-06-23 00:07:39 +02:00
committed by GitHub
parent dc6f46695a
commit 400598a0b1
25 changed files with 528 additions and 282 deletions

View File

@@ -0,0 +1,20 @@
diff --git a/dom/base/Document.cpp b/dom/base/Document.cpp
index a16bef739fcde0f14ba7e53e0acfa3aa2ee1dd3a..78b9d112a56b3d909e31eb4351ee9f3b06c4ef92 100644
--- a/dom/base/Document.cpp
+++ b/dom/base/Document.cpp
@@ -3332,6 +3332,15 @@ void Document::FillStyleSetUserAndUASheets() {
ServoStyleSet& styleSet = EnsureStyleSet();
for (StyleSheet* sheet : *sheetService->UserStyleSheets()) {
+ // If the url starts with "chrome://" and ends with 'zen-themes.css', then
+ // skip it if the document is in a chrome docshell.
+ // This is to avoid loading the user chrome stylesheet in the content
+ // process, which is not allowed.
+ auto spec = sheet->GetSheetURI()->GetSpecOrDefault();
+ if (!IsInChromeDocShell() && StringBeginsWith(spec, "file://"_ns) &&
+ StringEndsWith(spec, "zen-themes.css"_ns)) {
+ continue;
+ }
styleSet.AppendStyleSheet(*sheet);
}