Avoid assert failure when using @import

This commit is contained in:
Oriol Brufau 2023-06-14 15:56:21 +02:00
parent f8235ab3fb
commit bc634be84a
3 changed files with 14 additions and 4 deletions

View file

@ -125,13 +125,12 @@ impl StylesheetContents {
/// An empty namespace map should be fine, as it is only used for parsing,
/// not serialization of existing selectors. Since UA sheets are read only,
/// we should never need the namespace map.
pub fn from_shared_data(
pub fn from_data(
rules: Arc<Locked<CssRules>>,
origin: Origin,
url_data: UrlExtraData,
quirks_mode: QuirksMode,
) -> Arc<Self> {
debug_assert!(rules.is_static());
Arc::new(Self {
rules,
origin,
@ -144,6 +143,17 @@ impl StylesheetContents {
})
}
/// Same as above, but ensuring that the rules are static.
pub fn from_shared_data(
rules: Arc<Locked<CssRules>>,
origin: Origin,
url_data: UrlExtraData,
quirks_mode: QuirksMode,
) -> Arc<Self> {
debug_assert!(rules.is_static());
Self::from_data(rules, origin, url_data, quirks_mode)
}
/// Returns a reference to the list of rules.
#[inline]
pub fn rules<'a, 'b: 'a>(&'a self, guard: &'b SharedRwLockReadGuard) -> &'a [CssRule] {