Best headless browser for AI agents. Lite, Fast, High-Compatibility. Built in Rust
Rust ai-agentsai-toolsbrowserbrowser-automationcloud-browserheadlessheadless-browserkitesurfplaywrightpuppeteerrustservoweb-crawlerweb-crawlingweb-scraperweb-scraping
fix(style): gate web fonts by effective media
ldm0673ee1979e3d
diff --git a/moli-renderer-v8/src/script_vm/tests/mod.rs b/moli-renderer-v8/src/script_vm/tests/mod.rsindex 39cbb41ee..ae960584a 100644--- a/moli-renderer-v8/src/script_vm/tests/mod.rs+++ b/moli-renderer-v8/src/script_vm/tests/mod.rs@@ -9426,6 +9426,61 @@ async fn spawn_gated_image_resource_server()}+async fn spawn_gated_font_resource_server() -> (+ String,+ tokio::sync::oneshot::Receiver<String>,+ tokio::sync::oneshot::Sender<()>,+ tokio::task::JoinHandle<()>,+) {+ let listener = tokio::net::TcpListener::bind("127.0.0.1:0")+ .await+ .expect("bind gated font resource server");+ let addr = listener+ .local_addr()+ .expect("gated font resource server addr");+ let (request_tx, request_rx) = tokio::sync::oneshot::channel();+ let (release_tx, release_rx) = tokio::sync::oneshot::channel();+ let server = tokio::spawn(async move {+ use tokio::io::{AsyncReadExt, AsyncWriteExt};++ let (mut stream, _) = listener+ .accept()+ .await+ .expect("accept gated font resource request");+ let mut request = Vec::new();+ let mut buffer = [0_u8; 1024];+ loop {+ let read = stream+ .read(&mut buffer)+ .await+ .expect("read gated font resource request");+ if read == 0 {+ break;+ }+ request.extend_from_slice(&buffer[..read]);+ if request.windows(4).any(|window| window == b"\r\n\r\n") {+ break;+ }+ }+ let _ = request_tx.send(String::from_utf8_lossy(&request).into_owned());+ let _ = release_rx.await;+ const TEST_FONT: &[u8] =+ include_bytes!("../../../../moli-layout/tests/fixtures/moli-ahem.woff2");+ let response_head = format!(+ "HTTP/1.1 200 OK\r\nContent-Type: font/woff2\r\nContent-Length: {}\r\nConnection: close\r\n\r\n",+ TEST_FONT.len()+ );+ let _ = stream.write_all(response_head.as_bytes()).await;+ let _ = stream.write_all(TEST_FONT).await;+ });+ (+ format!("http://{addr}/print-only.woff2"),+ request_rx,+ release_tx,+ server,+ )+}+async fn spawn_gated_text_track_resource_server(status: u16,) -> (@@ -11678,6 +11733,178 @@ async fn main_document_replacement_retires_pending_image_request_sequence() {);}+#[tokio::test]+async fn web_font_requests_and_registration_follow_effective_stylesheet_media() {+ let (font_url, mut request_rx, release_tx, server) = spawn_gated_font_resource_server().await;+ let document_url = font_url.replace("/print-only.woff2", "/page");+ let loader = ResourceRequestClient::new(&moli_fetch::FetchConfig::default()).expect("loader");+ loader.set_optional_resource_fetch_mask(crate::protocol_types::OptionalResourceFetchMask::FONT);+ let (mut vm, mut resource_completions) =+ new_storage_test_vm_with_loader_and_resource_completion_queue(&document_url, &loader);++ vm.eval(&format!(+ r#"+(() => {{+ const style = document.createElement("style");+ style.media = "print";+ style.textContent = `+ @font-face {{ font-family: PrintOnly; src: url({font_url:?}); }}+ `;+ (document.head || document.documentElement || document).appendChild(style);+ (document.body || document.documentElement).style.fontFamily = "PrintOnly, sans-serif";+}})()+"#+ ))+ .expect("print-only web-font fixture should evaluate");++ assert!(+ vm.refresh_layout_snapshot_for_test(moli_layout::LayoutViewport::new(800, 600, 1.0,))+ .expect("screen layout refresh should succeed")+ );+ assert_eq!(vm.document_web_font_counts_for_test(), (0, 0, 0));+ assert_eq!(+ vm._context_host+ .borrow()+ .pending_subresource_request_count(),+ 0,+ "a print-only font must not create a screen-media request or load delay"+ );+ assert!(+ tokio::time::timeout(std::time::Duration::from_millis(100), &mut request_rx)+ .await+ .is_err(),+ "the server must not observe a request while owner media is ineffective"+ );++ vm.set_emulated_media(&crate::protocol_types::EmulatedMediaOverrides {+ media: Some("print".to_owned()),+ ..Default::default()+ });+ assert!(+ vm.refresh_layout_snapshot_for_test(moli_layout::LayoutViewport::new(800, 600, 1.0,))+ .expect("print layout refresh should succeed")+ );+ assert_eq!(vm.document_web_font_counts_for_test(), (1, 0, 0));+ assert_eq!(+ vm._context_host+ .borrow()+ .pending_subresource_request_count(),+ 1,+ "activating print media must admit exactly one font request"+ );+ let request = tokio::time::timeout(std::time::Duration::from_secs(2), &mut request_rx)+ .await+ .expect("the effective font request should reach the server")+ .expect("font request channel should remain open");+ assert!(request.starts_with("GET /print-only.woff2 HTTP/1.1"));++ release_tx.send(()).expect("release font response");+ server.await.expect("font server should finish");+ assert!(+ tokio::time::timeout(+ std::time::Duration::from_secs(2),+ resource_completions.wait_for_arrival_without_timeout(),+ )+ .await+ .expect("web font completion should reach the Networking source")+ );+ let completion = resource_completions+ .pop_next_async_subresource_event()+ .expect("web font completion must retain its typed terminal");+ let _ = vm+ .complete_async_subresource_fetch_event_body(completion)+ .expect("web font completion should apply to its current document owner");+ assert_eq!(+ vm.document_web_font_counts_for_test(),+ (1, 1, 1),+ "an effective completed font must be registered for layout"+ );++ vm.set_emulated_media(&crate::protocol_types::EmulatedMediaOverrides::default());+ assert!(+ vm.refresh_layout_snapshot_for_test(moli_layout::LayoutViewport::new(800, 600, 1.0,))+ .expect("restored screen layout refresh should succeed")+ );+ assert_eq!(+ vm.document_web_font_counts_for_test(),+ (0, 0, 0),+ "leaving print media must remove the slot and registered layout font"+ );+ assert_eq!(+ vm._context_host+ .borrow()+ .pending_subresource_request_count(),+ 0+ );+}++#[tokio::test]+async fn pending_web_font_response_is_stale_after_stylesheet_media_stops_matching() {+ let (font_url, request_rx, release_tx, server) = spawn_gated_font_resource_server().await;+ let document_url = font_url.replace("/print-only.woff2", "/page");+ let loader = ResourceRequestClient::new(&moli_fetch::FetchConfig::default()).expect("loader");+ loader.set_optional_resource_fetch_mask(crate::protocol_types::OptionalResourceFetchMask::FONT);+ let (mut vm, mut resource_completions) =+ new_storage_test_vm_with_loader_and_resource_completion_queue(&document_url, &loader);+ vm.set_emulated_media(&crate::protocol_types::EmulatedMediaOverrides {+ media: Some("print".to_owned()),+ ..Default::default()+ });+ vm.eval(&format!(+ r#"+const style = document.createElement("style");+style.media = "print";+style.textContent = '@font-face {{ font-family: PendingPrint; src: url({font_url:?}); }}';+(document.head || document.documentElement || document).appendChild(style);+"#+ ))+ .expect("pending print font fixture should evaluate");++ assert!(+ vm.refresh_layout_snapshot_for_test(moli_layout::LayoutViewport::new(800, 600, 1.0,))+ .expect("print layout refresh should succeed")+ );+ request_rx+ .await+ .expect("effective pending font request should reach the server");+ assert_eq!(vm.document_web_font_counts_for_test(), (1, 0, 0));++ vm.set_emulated_media(&crate::protocol_types::EmulatedMediaOverrides::default());+ assert!(+ vm.refresh_layout_snapshot_for_test(moli_layout::LayoutViewport::new(800, 600, 1.0,))+ .expect("screen layout refresh should succeed")+ );+ assert_eq!(+ vm.document_web_font_counts_for_test(),+ (0, 0, 0),+ "the new resource generation must revoke a now-ineffective pending slot"+ );++ release_tx.send(()).expect("release stale font response");+ server.await.expect("font server should finish");+ assert!(+ tokio::time::timeout(+ std::time::Duration::from_secs(2),+ resource_completions.wait_for_arrival_without_timeout(),+ )+ .await+ .expect("stale font completion should reach the Networking source")+ );+ let completion = resource_completions+ .pop_next_async_subresource_event()+ .expect("stale font completion must retain its typed terminal");+ let _ = vm+ .complete_async_subresource_fetch_event_body(completion)+ .expect("stale font completion should settle without mutating layout fonts");+ assert_eq!(vm.document_web_font_counts_for_test(), (0, 0, 0));+ assert_eq!(+ vm._context_host+ .borrow()+ .pending_subresource_request_count(),+ 0+ );+}+#[tokio::test]async fn far_lazy_image_network_request_waits_for_sampled_scroll_reveal() {let (image_url, request_rx, release_tx, server) = spawn_gated_image_resource_server(404).await;diff --git a/moli-renderer-v8/src/style_engine/active_stylesheets.rs b/moli-renderer-v8/src/style_engine/active_stylesheets.rsindex 1708f7ac6..1c2f07c94 100644--- a/moli-renderer-v8/src/style_engine/active_stylesheets.rs+++ b/moli-renderer-v8/src/style_engine/active_stylesheets.rs@@ -59,15 +59,43 @@ pub(super) fn note_full_cascade_update_fallback() {pub(super) struct ActiveStylesheet {source: StyloStylesheetSource,stylesheet: DocumentStyleSheet,- web_font_resources: Arc<[StylesheetLoadBlockingResource]>,+ web_font_resources: Arc<[ActiveWebFontResource]>,import_urls: Arc<[url::Url]>,}+/// One parsed `@font-face` resource tied to its native Stylo rule.+///+/// Retaining the rule address lets device changes project the already-parsed+/// resource set through Stylo's effective-rule iterator without reparsing or+/// treating every installed stylesheet as currently effective.+#[derive(Clone)]+pub(super) struct ActiveWebFontResource {+ rule_address: usize,+ resource: StylesheetLoadBlockingResource,+}++impl ActiveWebFontResource {+ pub(super) fn new(rule_address: usize, resource: StylesheetLoadBlockingResource) -> Self {+ Self {+ rule_address,+ resource,+ }+ }++ pub(super) fn rule_address(&self) -> usize {+ self.rule_address+ }++ pub(super) fn resource(&self) -> &StylesheetLoadBlockingResource {+ &self.resource+ }+}+impl ActiveStylesheet {pub(super) fn new(source: StyloStylesheetSource,stylesheet: DocumentStyleSheet,- web_font_resources: Arc<[StylesheetLoadBlockingResource]>,+ web_font_resources: Arc<[ActiveWebFontResource]>,import_urls: Arc<[url::Url]>,) -> Self {Self {@@ -86,7 +114,7 @@ impl ActiveStylesheet {&self.stylesheet}- pub(super) fn web_font_resources(&self) -> &[StylesheetLoadBlockingResource] {+ pub(super) fn web_font_resources(&self) -> &[ActiveWebFontResource] {self.web_font_resources.as_ref()}diff --git a/moli-renderer-v8/src/style_engine/retained.rs b/moli-renderer-v8/src/style_engine/retained.rsindex f9bc31054..2887ef505 100644--- a/moli-renderer-v8/src/style_engine/retained.rs+++ b/moli-renderer-v8/src/style_engine/retained.rs@@ -157,8 +157,11 @@ pub(super) fn build_retained_style_system(.borrow_for_origin(Origin::UserAgent).clone(),);- let stylesheet_resources =- StylesheetResourceManifest::from_active_stylesheets(&document_stylesheets, &shadow_scopes);+ let stylesheet_resources = StylesheetResourceManifest::from_active_stylesheets(+ &stylist,+ &document_stylesheets,+ &shadow_scopes,+ );RetainedStyleSystem {stylist_identity: NEXT_STYLIST_IDENTITY.fetch_add(1, Ordering::Relaxed),@@ -452,10 +455,11 @@ fn refresh_retained_derived_state(.clone(),);}- if !stylesheet_collections_changed {+ if !device_changed && !stylesheet_collections_changed {return;}let stylesheet_resources = StylesheetResourceManifest::from_active_stylesheets(+ &retained.stylist,&retained.document_stylesheets,&retained.shadow_scopes,);diff --git a/moli-renderer-v8/src/style_engine/stylesheet.rs b/moli-renderer-v8/src/style_engine/stylesheet.rsindex 691464a87..fcbc421cf 100644--- a/moli-renderer-v8/src/style_engine/stylesheet.rs+++ b/moli-renderer-v8/src/style_engine/stylesheet.rs@@ -34,7 +34,7 @@ use crate::{document_runtime::DomHandle, dom::native::DomHost};use super::{StyleViewport, StyloStyleEnvironment,- active_stylesheets::{ActiveStylesheet, ActiveStylesheetCollection},+ active_stylesheets::{ActiveStylesheet, ActiveStylesheetCollection, ActiveWebFontResource},media_list::parse_media_query_list_with_context,source::store::{StyleSourceMetadata, StyloStylesheetSource},source_id::{StyleSourceId, StyleSourceKind},@@ -104,10 +104,12 @@ pub(super) fn install_active_stylesheet(let web_font_resources = native_font_face_rules_for_stylesheet(&stylesheet).into_iter().filter_map(|rule| {+ let rule_address = rule.rule.raw_ptr().as_ptr() as usize;crate::css_resource_urls::stylesheet_web_font_resource(&rule.rule_fingerprint,source.base_url(),)+ .map(|resource| ActiveWebFontResource::new(rule_address, resource))}).collect::<Vec<_>>();ActiveStylesheet::new(@@ -206,22 +208,43 @@ pub(crate) fn native_font_face_projection_for_stylesheet(collect_font_face_rule_projections(contents.rules(&guard), &guard, &mut projection.all_rules);let document_stylesheet = DocumentStyleSheet::new(stylesheet.clone());- let custom_media = CustomMediaMap::default();- if document_stylesheet.enabled()- && document_stylesheet.is_effective_for_device(stylist.device(), &custom_media, &guard)- {- projection.effective_rule_addresses.extend(- contents- .effective_rules(stylist.device(), &custom_media, &guard)- .filter_map(|rule| match rule {- CssRule::FontFace(rule) => Some(rule.raw_ptr().as_ptr() as usize),- _ => None,- }),- );- }+ projection.effective_rule_addresses = native_effective_font_face_rule_addresses_with_guard(+ &document_stylesheet,+ stylist.device(),+ &CustomMediaMap::default(),+ &guard,+ );projection}+pub(super) fn native_effective_font_face_rule_addresses(+ stylesheet: &DocumentStyleSheet,+ device: &Device,+ custom_media: &CustomMediaMap,+) -> HashSet<usize> {+ let guard = stylesheet.0.shared_lock.read();+ native_effective_font_face_rule_addresses_with_guard(stylesheet, device, custom_media, &guard)+}++fn native_effective_font_face_rule_addresses_with_guard(+ stylesheet: &DocumentStyleSheet,+ device: &Device,+ custom_media: &CustomMediaMap,+ guard: &style::shared_lock::SharedRwLockReadGuard<'_>,+) -> HashSet<usize> {+ if !stylesheet.enabled() || !stylesheet.is_effective_for_device(device, custom_media, guard) {+ return HashSet::new();+ }+ stylesheet+ .contents(guard)+ .effective_rules(device, custom_media, guard)+ .filter_map(|rule| match rule {+ CssRule::FontFace(rule) => Some(rule.raw_ptr().as_ptr() as usize),+ _ => None,+ })+ .collect()+}+pub(crate) fn native_font_face_rules_for_stylesheet(stylesheet: &ServoArc<Stylesheet>,) -> Vec<NativeStylesheetFontFaceRuleProjection> {diff --git a/moli-renderer-v8/src/style_engine/stylesheet_resources.rs b/moli-renderer-v8/src/style_engine/stylesheet_resources.rsindex f24554501..a01449de7 100644--- a/moli-renderer-v8/src/style_engine/stylesheet_resources.rs+++ b/moli-renderer-v8/src/style_engine/stylesheet_resources.rs@@ -2,7 +2,12 @@ use std::{collections::BTreeMap, sync::Arc};use crate::{css_resource_urls::StylesheetLoadBlockingResource, document_runtime::DomHandle};-use super::{active_stylesheets::ActiveStylesheetCollection, shadow_scopes::ShadowScopeStyles};+use style::{stylesheets::Origin, stylist::Stylist};++use super::{+ active_stylesheets::ActiveStylesheetCollection, shadow_scopes::ShadowScopeStyles,+ stylesheet::native_effective_font_face_rule_addresses,+};#[cfg(test)]thread_local! {@@ -83,6 +88,7 @@ pub(super) struct StylesheetResourceManifest {impl StylesheetResourceManifest {pub(super) fn from_active_stylesheets(+ stylist: &Stylist,document_stylesheets: &ActiveStylesheetCollection,shadow_scopes: &[ShadowScopeStyles],) -> Self {@@ -90,9 +96,24 @@ impl StylesheetResourceManifest {STYLESHEET_RESOURCE_MANIFEST_BUILD_COUNT.with(|count| count.set(count.get() + 1));let mut web_fonts = BTreeMap::new();let mut imports = BTreeMap::new();- collect_resources(document_stylesheets, &mut web_fonts, &mut imports);+ collect_resources(+ document_stylesheets,+ stylist.device(),+ stylist+ .cascade_data()+ .borrow_for_origin(Origin::Author)+ .custom_media_map(),+ &mut web_fonts,+ &mut imports,+ );for scope in shadow_scopes {- collect_resources(scope.active_stylesheets(), &mut web_fonts, &mut imports);+ collect_resources(+ scope.active_stylesheets(),+ stylist.device(),+ scope.author_styles().data.custom_media_map(),+ &mut web_fonts,+ &mut imports,+ );}Self {web_fonts: web_fonts.into_values().collect::<Vec<_>>().into(),@@ -114,11 +135,22 @@ impl StylesheetResourceManifest {fn collect_resources(stylesheets: &ActiveStylesheetCollection,+ device: &style::device::Device,+ custom_media: &style::stylesheets::CustomMediaMap,web_fonts: &mut BTreeMap<String, StylesheetLoadBlockingResource>,imports: &mut BTreeMap<String, url::Url>,) {for stylesheet in stylesheets.entries() {+ let effective_font_faces = native_effective_font_face_rule_addresses(+ stylesheet.stylesheet(),+ device,+ custom_media,+ );for resource in stylesheet.web_font_resources() {+ if !effective_font_faces.contains(&resource.rule_address()) {+ continue;+ }+ let resource = resource.resource();let Some(font) = resource.web_font() else {continue;};diff --git a/moli-renderer-v8/src/style_engine/tests/subtree_cache.rs b/moli-renderer-v8/src/style_engine/tests/subtree_cache.rsindex 0e0f68aaa..25d791736 100644--- a/moli-renderer-v8/src/style_engine/tests/subtree_cache.rs+++ b/moli-renderer-v8/src/style_engine/tests/subtree_cache.rs@@ -5362,8 +5362,8 @@ fn retained_stylesheet_resource_manifest_advances_only_when_resources_change() {);assert_eq!(stylesheet_resource_manifest_build_count_for_test(),- 1,- "a device-only update must not rebuild the typed resource projection"+ 2,+ "a device update must reproject effective resources without advancing an unchanged manifest");let same_resources_source = StyloStylesheetSource::new(@@ -5392,7 +5392,7 @@ fn retained_stylesheet_resource_manifest_advances_only_when_resources_change() {"ordinary declaration changes must not restart resource reconciliation");assert_eq!(author_source_text_parse_count_for_test(), 2);- assert_eq!(stylesheet_resource_manifest_build_count_for_test(), 2);+ assert_eq!(stylesheet_resource_manifest_build_count_for_test(), 3);let second_source = StyloStylesheetSource::new("@import url(theme-b.css); @font-face { font-family: Second; src: url(font-b.woff2); font-style: italic; }".into(),@@ -5425,6 +5425,126 @@ fn retained_stylesheet_resource_manifest_advances_only_when_resources_change() {3,"each stylesheet revision must be parsed once for both cascade and resources");+ assert_eq!(stylesheet_resource_manifest_build_count_for_test(), 4);+}++#[test]+fn retained_stylesheet_resource_manifest_tracks_effective_font_faces_across_media_changes() {+ reset_author_source_text_parse_count_for_test();+ reset_stylesheet_resource_manifest_build_count_for_test();+ let mut host = test_host();+ let document = host.document_handle();+ let shadow_host = host.create_element("section");+ assert!(host.append_child(document, shadow_host));+ let shadow_root = host+ .attach_shadow_root(shadow_host, "open")+ .expect("font resource fixture should create a ShadowRoot");+ let engine = MoliStyleEngine::new();+ let document_url = url::Url::parse("https://example.test/media-fonts.html").unwrap();+ let owner_media_source = StyloStylesheetSource::new(+ "@font-face { font-family: OwnerPrint; src: url(owner-print.woff2); }".into(),+ document_url.clone(),+ )+ .with_owner_media_text("print");+ let nested_media_source = StyloStylesheetSource::new(+ "@media print { @font-face { font-family: NestedPrint; src: url(nested-print.woff2); } }\+ @media screen { @font-face { font-family: ScreenOnly; src: url(screen.woff2); } }"+ .into(),+ document_url,+ );+ let mut screen_inputs = FullStyleWorldSnapshot {+ document_stylesheet_sources: vec![owner_media_source, nested_media_source],+ ..Default::default()+ };+ screen_inputs.shadow_stylesheet_sources.push((+ shadow_root,+ vec![StyloStylesheetSource::new(+ "@media print { @font-face { font-family: ShadowPrint; src: url(shadow-print.woff2); } }\+ @media screen { @font-face { font-family: ShadowScreen; src: url(shadow-screen.woff2); } }"+ .into(),+ url::Url::parse("https://example.test/media-fonts.html").unwrap(),+ )],+ ));+ let screen_key = StyleWorldKey::new(&screen_inputs, None);+ engine.ensure_retained_style_system_for_document(+ &host,+ document,+ screen_key.clone(),+ &screen_inputs,+ );++ let resource_urls = |snapshot: &StylesheetResourceSnapshot| {+ let mut urls = snapshot+ .web_fonts()+ .iter()+ .map(|resource| resource.request_url().as_str().to_owned())+ .collect::<Vec<_>>();+ urls.sort();+ urls+ };+ let screen = engine+ .stylesheet_resource_snapshot_for_document(document)+ .expect("screen media must publish an effective font projection");+ assert_eq!(+ resource_urls(&screen),+ [+ "https://example.test/screen.woff2",+ "https://example.test/shadow-screen.woff2",+ ]+ );+ assert_eq!(author_source_text_parse_count_for_test(), 3);+ assert_eq!(stylesheet_resource_manifest_build_count_for_test(), 1);+ let stylist_identity = engine.retained_stylist_identity_for_document_for_test(document);++ let mut print_inputs = screen_inputs.clone();+ print_inputs.environment = StyloStyleEnvironment::from_emulated_media(+ &crate::protocol_types::EmulatedMediaOverrides {+ media: Some("print".to_owned()),+ ..Default::default()+ },+ );+ let print_key = StyleWorldKey::new(&print_inputs, None);+ engine.ensure_retained_style_system_for_document(&host, document, print_key, &print_inputs);+ let print = engine+ .stylesheet_resource_snapshot_for_document(document)+ .expect("print media must publish its effective font projection");+ assert_ne!(print.generation(), screen.generation());+ assert_eq!(+ resource_urls(&print),+ [+ "https://example.test/nested-print.woff2",+ "https://example.test/owner-print.woff2",+ "https://example.test/shadow-print.woff2",+ ]+ );+ assert_eq!(+ engine.retained_stylist_identity_for_document_for_test(document),+ stylist_identity,+ "media changes must update the retained Stylist in place"+ );+ assert_eq!(+ author_source_text_parse_count_for_test(),+ 3,+ "device projection must reuse parsed native rules"+ );++ engine.ensure_retained_style_system_for_document(&host, document, screen_key, &screen_inputs);+ let restored_screen = engine+ .stylesheet_resource_snapshot_for_document(document)+ .expect("returning to screen must publish the restored projection");+ assert_ne!(restored_screen.generation(), print.generation());+ assert_eq!(+ resource_urls(&restored_screen),+ [+ "https://example.test/screen.woff2",+ "https://example.test/shadow-screen.woff2",+ ]+ );+ assert_eq!(+ engine.retained_stylist_identity_for_document_for_test(document),+ stylist_identity+ );+ assert_eq!(author_source_text_parse_count_for_test(), 3);assert_eq!(stylesheet_resource_manifest_build_count_for_test(), 3);}