Skip to content

armgit / moli

Public Imported from GitHub
0

Best headless browser for AI agents. Lite, Fast, High-Compatibility. Built in Rust

feat(cssom): expose native starting-style grouping rules

ldm00c33cce924cb
diff --git a/moli-renderer-v8/src/context_bootstrap/css_stylesheet_runtime/detached_snapshot.rs b/moli-renderer-v8/src/context_bootstrap/css_stylesheet_runtime/detached_snapshot.rs
index 2260255d2..5b0ed713d 100644
--- a/moli-renderer-v8/src/context_bootstrap/css_stylesheet_runtime/detached_snapshot.rs
+++ b/moli-renderer-v8/src/context_bootstrap/css_stylesheet_runtime/detached_snapshot.rs
@@ -7,6 +7,27 @@ const SNAPSHOT_SELECTOR_TEXT_INDEX: u32 = 3;
const SNAPSHOT_DECLARATION_TEXT_INDEX: u32 = 4;
const SNAPSHOT_CHILDREN_INDEX: u32 = 5;
const SNAPSHOT_FIELD_COUNT: i32 = 6;
+const CSS_RULE_SNAPSHOT_TYPE_SLOT: &str = "__moliCssRuleSnapshotType";
+
+pub(crate) fn set_css_rule_snapshot_type<'s>(
+ scope: &mut v8::PinScope<'s, '_>,
+ rule: v8::Local<'s, v8::Object>,
+ rule_type: Option<CssRuleType>,
+) {
+ set_private_u32(
+ scope,
+ rule,
+ CSS_RULE_SNAPSHOT_TYPE_SLOT,
+ rule_type.map(css_rule_type_snapshot_code).unwrap_or(0),
+ );
+}
+
+pub(crate) fn css_rule_snapshot_type<'s>(
+ scope: &mut v8::PinScope<'s, '_>,
+ rule: v8::Local<'s, v8::Object>,
+) -> Option<CssRuleType> {
+ private_u32(scope, rule, CSS_RULE_SNAPSHOT_TYPE_SLOT).and_then(css_rule_type_from_snapshot_code)
+}
pub(crate) struct DetachedCssRuleSnapshotEntry<'s> {
pub(crate) snapshot: CssRuleSnapshot,
@@ -48,6 +69,7 @@ pub(crate) fn clear_css_rule_detached_snapshot<'s>(
scope: &mut v8::PinScope<'s, '_>,
rule: v8::Local<'s, v8::Object>,
) {
+ set_css_rule_snapshot_type(scope, rule, None);
set_private_string(scope, rule, CSS_RULE_DETACHED_SNAPSHOT_TEXT_SLOT, "");
set_private_value(
scope,
diff --git a/moli-renderer-v8/src/context_bootstrap/css_stylesheet_runtime/grouping_rule.rs b/moli-renderer-v8/src/context_bootstrap/css_stylesheet_runtime/grouping_rule.rs
index 0ffd7974c..1ab58ce49 100644
--- a/moli-renderer-v8/src/context_bootstrap/css_stylesheet_runtime/grouping_rule.rs
+++ b/moli-renderer-v8/src/context_bootstrap/css_stylesheet_runtime/grouping_rule.rs
@@ -15,10 +15,13 @@ pub(crate) fn css_grouping_rule_css_rules_getter_callback<'s>(
args: v8::FunctionCallbackArguments<'s>,
mut rv: v8::ReturnValue<'s, v8::Value>,
) {
- if !ensure_css_rule_object(scope, args.this(), "CSSGroupingRule", "cssRules") {
- return;
- }
- let rules = css_grouping_rule_rules_array(scope, args.this());
+ let this = args.this();
+ let rules =
+ if css_rule_current_stylo_rule_type_from_object(scope, this) == Some(CssRuleType::Style) {
+ css_style_rule_rules_array(scope, this)
+ } else {
+ css_grouping_rule_rules_array(scope, this)
+ };
rv.set(rules.into());
}
@@ -252,9 +255,6 @@ pub(crate) fn css_grouping_rule_insert_rule_callback<'s>(
mut rv: v8::ReturnValue<'s, v8::Value>,
) {
let this = args.this();
- if !ensure_css_rule_object(scope, this, "CSSGroupingRule", "insertRule") {
- return;
- }
let is_style_rule =
css_rule_current_stylo_rule_type_from_object(scope, this) == Some(CssRuleType::Style);
let rules = if is_style_rule {
@@ -376,9 +376,6 @@ pub(crate) fn css_grouping_rule_delete_rule_callback<'s>(
args: v8::FunctionCallbackArguments<'s>,
mut rv: v8::ReturnValue<'s, v8::Value>,
) {
- if !ensure_css_rule_object(scope, args.this(), "CSSGroupingRule", "deleteRule") {
- return;
- }
let Some(parsed) = webidl::parse_args::<CssGroupingRuleDeleteRuleArgs>(scope, &args) else {
return;
};
diff --git a/moli-renderer-v8/src/context_bootstrap/css_stylesheet_runtime/mutations.rs b/moli-renderer-v8/src/context_bootstrap/css_stylesheet_runtime/mutations.rs
index 2f76f588c..14244da4a 100644
--- a/moli-renderer-v8/src/context_bootstrap/css_stylesheet_runtime/mutations.rs
+++ b/moli-renderer-v8/src/context_bootstrap/css_stylesheet_runtime/mutations.rs
@@ -652,6 +652,7 @@ fn freeze_css_rule_wrapper_from_native_snapshot<'s>(
child_snapshots: v8::Local<'s, v8::Array>,
exposed_parent_style_sheet: Option<v8::Local<'s, v8::Object>>,
) {
+ set_css_rule_snapshot_type(scope, rule, Some(snapshot.rule_type));
if snapshot.rule_type == CssRuleType::Keyframe {
sync_css_keyframe_rule_object_from_native_snapshot(scope, rule, snapshot);
sync_css_rule_pdb_style_wrapper_from_snapshot(
diff --git a/moli-renderer-v8/src/context_bootstrap/css_stylesheet_runtime/rule_callbacks.rs b/moli-renderer-v8/src/context_bootstrap/css_stylesheet_runtime/rule_callbacks.rs
index 80a9524ef..de2572aaa 100644
--- a/moli-renderer-v8/src/context_bootstrap/css_stylesheet_runtime/rule_callbacks.rs
+++ b/moli-renderer-v8/src/context_bootstrap/css_stylesheet_runtime/rule_callbacks.rs
@@ -207,6 +207,7 @@ pub(crate) fn build_detached_css_rule_object_from_snapshot<'s>(
}
};
let _ = set_detached_css_rule_snapshot_text(scope, rule, &snapshot.css_text);
+ set_css_rule_snapshot_type(scope, rule, Some(snapshot.rule_type));
set_detached_css_rule_child_snapshot_array(scope, rule, child_snapshots);
rule
}
@@ -258,6 +259,7 @@ pub(crate) fn build_css_generic_at_rule_object_from_stylo_rule_type<'s>(
declaration,
stylo_rule_type == CssRuleType::Keyframes,
);
+ set_css_rule_snapshot_type(scope, object, Some(stylo_rule_type));
web_api_interfaces::initialize(scope, object, prototype_name)
.expect("CSS rule interface identity should initialize");
if let Some(prototype) = global_constructor_prototype(scope, prototype_name) {
@@ -281,12 +283,12 @@ pub(crate) fn sync_local_css_at_rule_wrapper_slots_from_css_text<'s>(
rule: v8::Local<'s, v8::Object>,
css_text: &str,
) {
- set_private_u32(
- scope,
- rule,
- CSS_AT_RULE_TYPE_SLOT,
- css_at_rule_type(css_at_rule_kind(css_text)),
- );
+ let stylo_rule_type = css_text_single_stylo_rule_type(css_text);
+ set_css_rule_snapshot_type(scope, rule, stylo_rule_type);
+ let kind = stylo_rule_type
+ .and_then(css_at_rule_kind_for_stylo_rule_type)
+ .unwrap_or_else(|| css_at_rule_kind(css_text));
+ set_private_u32(scope, rule, CSS_AT_RULE_TYPE_SLOT, css_at_rule_type(kind));
if get_private_value(scope, rule, CSS_PROPERTY_RULE_NAME_SLOT).is_some() {
if let Some(view) = parse_property_rule_view_with_stylo(css_text) {
sync_css_property_rule_slots_from_stylo_view(scope, rule, &view);
@@ -299,7 +301,7 @@ pub(crate) fn sync_local_css_at_rule_wrapper_slots_from_css_text<'s>(
if let Some(style) = get_private_value(scope, rule, CSS_AT_RULE_STYLE_OBJECT_SLOT)
.and_then(|value| v8::Local::<v8::Object>::try_from(value).ok())
- && let Some(rule_type) = css_text_single_stylo_rule_type(css_text)
+ && let Some(rule_type) = stylo_rule_type
{
let style_text = match rule_type {
CssRuleType::FontFace => css_font_face_rule_style_text_from_css_text(css_text),
@@ -536,8 +538,8 @@ pub(crate) fn build_css_rule_object_with_rule_context<'s>(
} else {
canonical_css_at_rule_text(css_text, rule_kind)
};
+ let stylo_rule_type = stylo_rule_type.or_else(|| css_text_single_stylo_rule_type(&css_text));
let prototype_name = stylo_rule_type
- .or_else(|| css_text_single_stylo_rule_type(&css_text))
.map(css_at_rule_prototype_name_for_stylo_rule_type)
.unwrap_or_else(|| css_at_rule_prototype_name(rule_kind));
let rule_type = stylo_rule_type
@@ -552,6 +554,7 @@ pub(crate) fn build_css_rule_object_with_rule_context<'s>(
};
let object =
bind_css_at_rule_declaration(scope, declaration, rule_kind == CssAtRuleKind::Keyframes);
+ set_css_rule_snapshot_type(scope, object, stylo_rule_type);
web_api_interfaces::initialize(scope, object, prototype_name)
.expect("CSS rule interface identity should initialize");
if let Some(prototype) = global_constructor_prototype(scope, prototype_name) {
@@ -607,6 +610,7 @@ pub(crate) fn css_at_rule_prototype_name_for_stylo_rule_type(
CssRuleType::LayerStatement => "CSSLayerStatementRule",
CssRuleType::Container => "CSSContainerRule",
CssRuleType::Scope => "CSSScopeRule",
+ CssRuleType::StartingStyle => "CSSStartingStyleRule",
_ => "CSSRule",
}
}
@@ -626,9 +630,8 @@ pub(crate) fn css_at_rule_prototype_name(kind: CssAtRuleKind) -> &'static str {
CssAtRuleKind::CounterStyle => "CSSCounterStyleRule",
CssAtRuleKind::Supports => "CSSSupportsRule",
CssAtRuleKind::Container => "CSSContainerRule",
- CssAtRuleKind::StartingStyle | CssAtRuleKind::Property | CssAtRuleKind::Function => {
- "CSSRule"
- }
+ CssAtRuleKind::StartingStyle => "CSSStartingStyleRule",
+ CssAtRuleKind::Property | CssAtRuleKind::Function => "CSSRule",
}
}
@@ -699,6 +702,11 @@ pub(crate) fn css_rule_current_stylo_rule_type_from_object<'s>(
if let Some(rule_type) = css_rule_attached_native_rule_type(scope, object) {
return Some(rule_type);
}
+ // New rule kinds share CSSRule.type == 0. Retain their native kind when
+ // detaching so child lists, parent links, and parsing contexts survive.
+ if let Some(rule_type) = css_rule_snapshot_type(scope, object) {
+ return Some(rule_type);
+ }
if get_private_value(scope, object, CSS_KEYFRAME_RULE_KEY_TEXT_SLOT).is_some() {
return Some(CssRuleType::Keyframe);
}
diff --git a/moli-renderer-v8/src/context_bootstrap/css_stylesheet_runtime/types.rs b/moli-renderer-v8/src/context_bootstrap/css_stylesheet_runtime/types.rs
index 9abe47009..07a72ac7b 100644
--- a/moli-renderer-v8/src/context_bootstrap/css_stylesheet_runtime/types.rs
+++ b/moli-renderer-v8/src/context_bootstrap/css_stylesheet_runtime/types.rs
@@ -541,7 +541,7 @@ pub struct CssRulePrototypeDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(interface = web_api_interfaces::CSSGroupingRule, enumerable)]
+#[webapi(interface = web_api_interfaces::CSSGroupingRule, enumerable, receiver)]
pub struct CssGroupingRulePrototypeDeclaration {
#[webapi(accessor_property, getter = css_grouping_rule_css_rules_getter_callback)]
pub css_rules: (),
diff --git a/moli-renderer-v8/src/context_bootstrap/specs/registry.rs b/moli-renderer-v8/src/context_bootstrap/specs/registry.rs
index fc4a838bb..42950acdf 100644
--- a/moli-renderer-v8/src/context_bootstrap/specs/registry.rs
+++ b/moli-renderer-v8/src/context_bootstrap/specs/registry.rs
@@ -684,6 +684,10 @@ const CONSTRUCTOR_SPECS_BEFORE_STREAMS: &[ConstructorSpec] = &[
interface: web_api_interfaces::CSSScopeRule::DESCRIPTOR,
kind: ConstructorKind::CssRule,
},
+ ConstructorSpec {
+ interface: web_api_interfaces::CSSStartingStyleRule::DESCRIPTOR,
+ kind: ConstructorKind::CssRule,
+ },
ConstructorSpec {
interface: web_api_interfaces::CSSImportRule::DESCRIPTOR,
kind: ConstructorKind::CssRule,
diff --git a/moli-renderer-v8/src/script_vm/tests/dom_xhr/cssom/extracted/css_grouping_receivers.js b/moli-renderer-v8/src/script_vm/tests/dom_xhr/cssom/extracted/css_grouping_receivers.js
new file mode 100644
index 000000000..ad18eb427
--- /dev/null
+++ b/moli-renderer-v8/src/script_vm/tests/dom_xhr/cssom/extracted/css_grouping_receivers.js
@@ -0,0 +1,46 @@
+(() => {
+ 'use strict';
+ const equal = (actual, expected, label) => {
+ if (!Object.is(actual, expected)) throw new Error(`${label}: ${actual} !== ${expected}`);
+ };
+ const other = document.getElementById('child').contentWindow;
+ const sheet = new CSSStyleSheet();
+ sheet.replaceSync('@namespace url("urn:test"); @media all { .a {} } .parent { & .child {} }');
+ const namespace = sheet.cssRules[0], media = sheet.cssRules[1], style = sheet.cssRules[2];
+ const foreignSheet = new other.CSSStyleSheet(); foreignSheet.replaceSync('@media all {}');
+ const foreign = foreignSheet.cssRules[0];
+ let conversions = 0, traps = 0;
+ const text = {toString() { conversions++; return '.x {}'; }};
+ const index = {valueOf() { conversions++; return 0; }};
+ const handler = {get() { traps++; throw new Error('author trap'); }};
+ const revoked = Proxy.revocable(media, handler); revoked.revoke();
+ const invalid = [{}, namespace, Object.create(media), Object.create(CSSGroupingRule.prototype), new Proxy(media, handler), revoked.proxy];
+ for (const realm of [globalThis, other]) {
+ const get = Object.getOwnPropertyDescriptor(realm.CSSGroupingRule.prototype, 'cssRules').get;
+ const insert = realm.CSSGroupingRule.prototype.insertRule;
+ const remove = realm.CSSGroupingRule.prototype.deleteRule;
+ for (const receiver of invalid) {
+ for (const invoke of [() => get.call(receiver), () => insert.call(receiver, text, index), () => remove.call(receiver, index)]) {
+ let thrown = false;
+ try { invoke(); } catch (error) {
+ equal(Object.getPrototypeOf(error), realm.TypeError.prototype, 'callee TypeError realm');
+ thrown = true;
+ }
+ equal(thrown, true, 'receiver rejected');
+ }
+ }
+ equal(conversions, 0, 'brand checks precede argument conversion');
+ equal(traps, 0, 'brand checks do not invoke author proxy traps');
+ for (const rule of [media, style, foreign]) {
+ const list = rule.cssRules;
+ equal(get.call(rule), list, 'inherited getter shares list');
+ const oldLength = list.length;
+ equal(insert.call(rule, '.added {}', oldLength), oldLength, 'genuine cross-realm receiver');
+ equal(get.call(rule), list, 'insertion preserves list');
+ equal(list.length, oldLength + 1, 'inserted rule observable');
+ remove.call(rule, oldLength);
+ equal(list.length, oldLength, 'deletion observable');
+ }
+ }
+ return true;
+})()
diff --git a/moli-renderer-v8/src/script_vm/tests/dom_xhr/cssom/extracted/css_starting_style.js b/moli-renderer-v8/src/script_vm/tests/dom_xhr/cssom/extracted/css_starting_style.js
new file mode 100644
index 000000000..e01765c4e
--- /dev/null
+++ b/moli-renderer-v8/src/script_vm/tests/dom_xhr/cssom/extracted/css_starting_style.js
@@ -0,0 +1,123 @@
+(() => {
+ 'use strict';
+ const equal = (actual, expected, label) => {
+ if (!Object.is(actual, expected)) throw new Error(`${label}: ${actual} !== ${expected}`);
+ };
+ const throws = (callback, Type, name) => {
+ try { callback(); } catch (error) {
+ if (!(error instanceof Type)) throw error;
+ if (name) equal(error.name, name, 'exception name');
+ return;
+ }
+ throw new Error('missing exception');
+ };
+ const other = document.getElementById('child').contentWindow;
+ const check = (rule, realm, sheet, parent = null) => {
+ equal(Object.getPrototypeOf(rule), realm.CSSStartingStyleRule.prototype, 'rule realm');
+ equal(rule instanceof realm.CSSGroupingRule, true, 'grouping interface');
+ equal(rule instanceof realm.CSSRule, true, 'rule interface');
+ equal(Object.prototype.toString.call(rule), '[object CSSStartingStyleRule]', 'tag');
+ equal(rule.type, 0, 'new rule kinds have no legacy type constant');
+ equal(rule.parentStyleSheet, sheet, 'parent sheet');
+ equal(rule.parentRule, parent, 'parent rule');
+ equal(rule.cssRules, rule.cssRules, 'stable child list');
+ };
+ for (const realm of [globalThis, other]) {
+ const C = realm.CSSStartingStyleRule;
+ equal(typeof C, 'function', 'constructor exposure');
+ equal(C.length, 0, 'constructor length');
+ equal(Object.getPrototypeOf(C), realm.CSSGroupingRule, 'constructor inheritance');
+ equal(Object.getPrototypeOf(C.prototype), realm.CSSGroupingRule.prototype, 'prototype inheritance');
+ throws(() => new C(), realm.TypeError);
+ throws(() => C(), realm.TypeError);
+ for (const connected of [false, true]) {
+ const element = connected ? realm.document.createElement('style') : null;
+ const text = `
+ @starting-style { .first { color: red; } }
+ @media all { @starting-style { .inner { color: green; } } }
+ .nested { @starting-style { color: blue; & .desc { color: red; } opacity: 0; } }
+ `;
+ if (element) { element.textContent = text; realm.document.head.append(element); }
+ const sheet = element ? element.sheet : new realm.CSSStyleSheet();
+ if (!element) sheet.replaceSync(text);
+ const rule = sheet.cssRules[0], list = rule.cssRules, first = list[0];
+ check(rule, realm, sheet);
+ equal(first.style.color, 'red', 'parsed declaration');
+ equal(first.parentRule, rule, 'child parent');
+ equal(first.parentStyleSheet, sheet, 'child sheet');
+ equal(Object.getPrototypeOf(list), realm.CSSRuleList.prototype, 'list realm');
+ const insert = CSSGroupingRule.prototype.insertRule;
+ const remove = CSSGroupingRule.prototype.deleteRule;
+ equal(insert.call(rule, '.second { color: blue; }', 1), 1, 'cross-realm insertion');
+ const second = list[1];
+ equal(Object.getPrototypeOf(second), realm.CSSStyleRule.prototype, 'inserted child realm');
+ equal(list[0], first, 'untouched rule identity');
+ equal(second.parentRule, rule, 'inserted child parent');
+ remove.call(rule, 0);
+ equal(rule.cssRules, list, 'list after deletion');
+ equal(list[0], second, 'shifted identity');
+ equal(first.parentRule, null, 'removed child parent');
+ equal(first.parentStyleSheet, null, 'removed child sheet');
+ throws(() => insert.call(rule, '???', 2), DOMException, 'IndexSizeError');
+ throws(() => insert.call(rule, '???', 0), DOMException, 'SyntaxError');
+ throws(() => insert.call(rule, '@import url("ignored.css");', 0), DOMException, 'HierarchyRequestError');
+ throws(() => remove.call(rule, 5), DOMException, 'IndexSizeError');
+ equal(list.length, 1, 'failed mutations leave children intact');
+ const media = sheet.cssRules[1];
+ check(media.cssRules[0], realm, sheet, media);
+ const styleRule = sheet.cssRules[2], nested = styleRule.cssRules[0];
+ check(nested, realm, sheet, styleRule);
+ equal(nested.cssRules.length, 3, 'nested declarations and rule');
+ equal(nested.cssRules[0].style.color, 'blue', 'leading nested declaration');
+ equal(nested.cssRules[2].style.opacity, '0', 'trailing nested declaration');
+ equal(insert.call(nested, '& .next { opacity: 0.5; }', 3), 3, 'nested selector context');
+ equal(nested.cssRules[3].style.opacity, '0.5', 'nested inserted declaration');
+ sheet.deleteRule(2);
+ check(nested, realm, null, styleRule);
+ equal(nested.cssRules[3].parentStyleSheet, null, 'detached nested child sheet');
+ equal(nested.cssRules[3].style.opacity, '0.5', 'detached nested mutation retained');
+ equal(insert.call(nested, '& .after { color: green; }', 4), 4, 'detached nested selector context');
+ equal(nested.cssRules[0].style.color, 'blue', 'detached nested leading declaration');
+ equal(nested.cssRules[3].style.opacity, '0.5', 'detached nested existing declaration');
+ equal(nested.cssRules[4].style.color, 'green', 'detached nested inserted declaration');
+ sheet.deleteRule(0);
+ check(rule, realm, null);
+ equal(rule.cssRules, list, 'removed group retains list');
+ equal(second.parentRule, rule, 'removed group retains child relationship');
+ equal(second.parentStyleSheet, null, 'removed subtree sheet');
+ equal(insert.call(rule, '@starting-style { .late { color: green; } }', 1), 1, 'detached insertion');
+ check(list[1], realm, null, rule);
+ equal(list[1].cssRules[0].style.color, 'green', 'detached nested declaration');
+ remove.call(rule, 0);
+ equal(rule.cssRules.length, 1, 'detached deletion');
+ if (element) element.remove();
+ }
+ const lazySheet = new realm.CSSStyleSheet();
+ lazySheet.replaceSync('@starting-style { @starting-style { .lazy { color: blue; } } }');
+ const lazy = lazySheet.cssRules[0];
+ lazySheet.deleteRule(0);
+ check(lazy, realm, null);
+ check(lazy.cssRules[0], realm, null, lazy);
+ equal(lazy.cssRules[0].cssRules[0].style.color, 'blue', 'lazy detached snapshot');
+ for (const prelude of ['@layer detached', '@scope (.host)']) {
+ const sheet = new realm.CSSStyleSheet();
+ sheet.replaceSync(`${prelude} { .child { color: red; } }`);
+ const group = sheet.cssRules[0], list = group.cssRules, child = list[0];
+ equal(group.type, 0, 'other new rule kinds share the legacy value');
+ sheet.deleteRule(0);
+ equal(child.parentStyleSheet, null, 'detached grouping child sheet');
+ equal(child.parentRule, group, 'detached grouping child parent');
+ equal(group.cssRules, list, 'detached grouping list identity');
+ equal(group.insertRule('.added {}', 1), 1, 'detached grouping insertion');
+ equal(list[1].parentRule, group, 'detached grouping inserted parent');
+ equal(list[1].parentStyleSheet, null, 'detached grouping inserted sheet');
+ }
+ }
+ const original = CSSStartingStyleRule;
+ try {
+ globalThis.CSSStartingStyleRule = function Fake() {};
+ const sheet = new CSSStyleSheet(); sheet.replaceSync('@starting-style {}');
+ equal(Object.getPrototypeOf(sheet.cssRules[0]), original.prototype, 'intrinsic prototype');
+ } finally { globalThis.CSSStartingStyleRule = original; }
+ return true;
+})()
diff --git a/moli-renderer-v8/src/script_vm/tests/dom_xhr/cssom/extracted/grouping_rules.rs b/moli-renderer-v8/src/script_vm/tests/dom_xhr/cssom/extracted/grouping_rules.rs
index f66e732af..f32122fec 100644
--- a/moli-renderer-v8/src/script_vm/tests/dom_xhr/cssom/extracted/grouping_rules.rs
+++ b/moli-renderer-v8/src/script_vm/tests/dom_xhr/cssom/extracted/grouping_rules.rs
@@ -1,5 +1,29 @@
use super::*;
+#[test]
+fn css_starting_style_rules_share_native_grouping_lifecycle_and_realms() {
+ let mut vm = new_parsed_test_vm(
+ "https://css-starting-style.test/",
+ "<!doctype html><body><iframe id=child></iframe>",
+ );
+ assert_eq!(
+ vm.eval(include_str!("css_starting_style.js")).unwrap(),
+ "true"
+ );
+}
+
+#[test]
+fn css_grouping_rule_native_receivers_share_child_lists() {
+ let mut vm = new_parsed_test_vm(
+ "https://css-grouping-receivers.test/",
+ "<!doctype html><body><iframe id=child></iframe>",
+ );
+ assert_eq!(
+ vm.eval(include_str!("css_grouping_receivers.js")).unwrap(),
+ "true"
+ );
+}
+
#[test]
fn css_grouping_rule_insert_delete_materializes_stylo_mutation_children() {
let mut vm = new_storage_test_vm("https://css-grouping-rule-mutation-tree.test/");
diff --git a/moli-renderer-v8/src/web_api_interfaces.rs b/moli-renderer-v8/src/web_api_interfaces.rs
index 3b006021e..f79cf1a55 100644
--- a/moli-renderer-v8/src/web_api_interfaces.rs
+++ b/moli-renderer-v8/src/web_api_interfaces.rs
@@ -71,6 +71,7 @@ interfaces! {
CSSRule;
CSSRuleList;
CSSScopeRule: CSSGroupingRule;
+ CSSStartingStyleRule: CSSGroupingRule;
CSSStyleDeclaration;
CSSStyleProperties: CSSStyleDeclaration;
CSSStyleRule: CSSGroupingRule;