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(performance): align observer types with Event Timing exposure
ldm01be4b6c4414e
diff --git a/moli-renderer-v8/src/context_bootstrap/performance_runtime.rs b/moli-renderer-v8/src/context_bootstrap/performance_runtime.rsindex 145389b0d..8bd5b9920 100644--- a/moli-renderer-v8/src/context_bootstrap/performance_runtime.rs+++ b/moli-renderer-v8/src/context_bootstrap/performance_runtime.rs@@ -90,7 +90,14 @@ pub(super) const PERFORMANCE_LIFECYCLE_TIMESTAMPS_SLOT: &str =pub(super) const PERFORMANCE_PENDING_EVENT_COUNTS_SLOT: &str ="__moliPerformancePendingEventCounts";pub(in crate::context_bootstrap) const WINDOW_PERFORMANCE_OBSERVER_SUPPORTED_ENTRY_TYPES:- &[&str] = &["mark", "measure", "navigation", "resource"];+ &[&str] = &[+ "event",+ "first-input",+ "mark",+ "measure",+ "navigation",+ "resource",+];pub(in crate::context_bootstrap) const WORKER_PERFORMANCE_OBSERVER_SUPPORTED_ENTRY_TYPES:&[&str] = &["mark", "measure", "resource"];diff --git a/moli-renderer-v8/src/script_vm/tests/browser_api/navigation/performance.rs b/moli-renderer-v8/src/script_vm/tests/browser_api/navigation/performance.rsindex 56d0d1e44..c133be280 100644--- a/moli-renderer-v8/src/script_vm/tests/browser_api/navigation/performance.rs+++ b/moli-renderer-v8/src/script_vm/tests/browser_api/navigation/performance.rs@@ -1070,7 +1070,7 @@ fn performance_navigation_observer_supports_idle_gap_probe() {assert_eq!(result,- r#"{"supported":"mark,measure,navigation,resource","records":1,"entryType":"navigation","finiteTiming":true,"nonZeroDuration":true,"idleGapFound":true}"#+ r#"{"supported":"event,first-input,mark,measure,navigation,resource","records":1,"entryType":"navigation","finiteTiming":true,"nonZeroDuration":true,"idleGapFound":true}"#);}diff --git a/moli-renderer-v8/src/script_vm/tests/performance_timing_interface_exposure_interfaces.rs b/moli-renderer-v8/src/script_vm/tests/performance_timing_interface_exposure_interfaces.rsindex 6df73d8c5..b211f04e0 100644--- a/moli-renderer-v8/src/script_vm/tests/performance_timing_interface_exposure_interfaces.rs+++ b/moli-renderer-v8/src/script_vm/tests/performance_timing_interface_exposure_interfaces.rs@@ -1,5 +1,34 @@use super::*;+#[test]+fn event_timing_observer_types_match_interface_exposure_in_each_window() {+ for url in ["https://event-timing.test/", "http://event-timing.test/"] {+ let mut vm = new_storage_test_vm(url);+ assert_eq!(+ vm.eval(+ r#"+(() => {+ const root = document.documentElement || document.appendChild(document.createElement('html'));+ const frame = root.appendChild(document.createElement('iframe'));+ for (const realm of [window, frame.contentWindow]) {+ const exposed = 'PerformanceEventTiming' in realm;+ for (const type of ['event', 'first-input']) {+ if (realm.PerformanceObserver.supportedEntryTypes.includes(type) !== exposed) {+ throw Error(type + ' does not match PerformanceEventTiming exposure');+ }+ }+ }+ return 'passed';+})()+"#,+ )+ .unwrap(),+ "passed",+ "{url}",+ );+ }+}+#[test]fn performance_timing_interface_exposure_interfaces_have_realm_local_constructors_and_exposure() {for url in [diff --git a/moli-renderer-v8/src/script_vm/tests/webidl_fetch/byte_streams_and_observers.rs b/moli-renderer-v8/src/script_vm/tests/webidl_fetch/byte_streams_and_observers.rsindex a3e7ae791..4f4d8d690 100644--- a/moli-renderer-v8/src/script_vm/tests/webidl_fetch/byte_streams_and_observers.rs+++ b/moli-renderer-v8/src/script_vm/tests/webidl_fetch/byte_streams_and_observers.rs@@ -986,7 +986,7 @@ fn plain_data_surfaces_preserve_expected_shapes() {assert_eq!(result,- r#"{"encodeInto":"read,written|2|3|104,195,169","params":"1,2|a=1,a=2,b=3","headers":"x-a,x-b|1,2|x-a=1,x-b=2","perfTiming":"navigationStart,unloadEventStart,unloadEventEnd,redirectStart,redirectEnd,fetchStart,domainLookupStart,domainLookupEnd,connectStart,connectEnd,secureConnectionStart,requestStart,responseStart,responseEnd,domLoading,domInteractive,domContentLoadedEventStart,domContentLoadedEventEnd,domComplete,loadEventStart,loadEventEnd","perfNavigation":"|0|0","perfSupported":"mark,measure,navigation,resource"}"#+ r#"{"encodeInto":"read,written|2|3|104,195,169","params":"1,2|a=1,a=2,b=3","headers":"x-a,x-b|1,2|x-a=1,x-b=2","perfTiming":"navigationStart,unloadEventStart,unloadEventEnd,redirectStart,redirectEnd,fetchStart,domainLookupStart,domainLookupEnd,connectStart,connectEnd,secureConnectionStart,requestStart,responseStart,responseEnd,domLoading,domInteractive,domContentLoadedEventStart,domContentLoadedEventEnd,domComplete,loadEventStart,loadEventEnd","perfNavigation":"|0|0","perfSupported":"event,first-input,mark,measure,navigation,resource"}"#);}diff --git a/moli-wpt-compat/fixtures/wpt/ported/idl/performanceobserver-idlharness.html b/moli-wpt-compat/fixtures/wpt/ported/idl/performanceobserver-idlharness.htmlindex 7cdeb0f65..c1f9676a8 100644--- a/moli-wpt-compat/fixtures/wpt/ported/idl/performanceobserver-idlharness.html+++ b/moli-wpt-compat/fixtures/wpt/ported/idl/performanceobserver-idlharness.html@@ -33,7 +33,7 @@ interface PerformanceObserver {test(function () {assert_true(Array.isArray(PerformanceObserver.supportedEntryTypes));- assert_array_equals(PerformanceObserver.supportedEntryTypes, ["mark", "measure", "navigation", "resource"]);+ assert_array_equals(PerformanceObserver.supportedEntryTypes, ["event", "first-input", "mark", "measure", "navigation", "resource"]);const observer = new PerformanceObserver(function () {});observer.observe({ entryTypes: ["mark"] });assert_array_equals(observer.takeRecords(), []);