Bug 1968202 - Generalize GlobalStyleSheetCache to support author stylesheets. r=smaug

In bug 1967507 I changed the timing of AnonymousContent stylesheet
loading in a way that it perturbed a css cache test because of
accessiblecaret.css

  https://hg.mozilla.org/mozilla-central/rev/a6a294ae1d18

However that made me realize that accessiblecaret.css is loaded
virtually in all processes, and it should be using the same mechanism we
use for UA sheets, rather than using all the CSS loader machinery
in-content. Same goes for details.css.

Expand GlobalStyleSheetCache to allow UA and Author sheets, and allow
ShadowRoot to get built-in stylesheets appended.

This allows accessiblecaret.css and details.css not to be marked as
content-accessible.

We could do the same at the document level for plaintext.css and co, but
that seems a bit less common, so maybe fine.

Differential Revision: https://phabricator.services.mozilla.com/D250909
This commit is contained in:
Emilio Cobos Álvarez
2025-05-24 11:24:43 +00:00
committed by ealvarez@mozilla.com
parent ca0bd4918b
commit 7c0d4089c5
18 changed files with 178 additions and 147 deletions

View File

@@ -8911,7 +8911,6 @@ pub unsafe extern "C" fn Servo_SharedMemoryBuilder_AddStylesheet(
) -> *const LockedCssRules {
// Assert some things we assume when we create a style sheet from shared
// memory.
debug_assert_eq!(contents.origin, Origin::UserAgent);
debug_assert_eq!(contents.quirks_mode, QuirksMode::NoQuirks);
debug_assert!(contents.source_map_url.read().is_none());
debug_assert!(contents.source_url.read().is_none());