@@ -2740,6 +2740,27 @@ void test_clipboard_read_host_completion(webscene_engine* engine)
27402740
27412741void test_native_performance_timeline_identity ( webscene_engine * engine )
27422742{
2743+ execute ( engine , R "JS ( ( ( ) => {
2744+ const frame = document . createElement ( 'iframe' ) ;
2745+ document . body . appendChild ( frame ) ;
2746+ frame . contentDocument . open ( ) ;
2747+ frame . contentDocument . write (
2748+ '<html><body><script>'
2749+ + 'globalThis.__nativePerformanceFrameReady = true;'
2750+ + '</ script > </ body> </ html> ');
2751+ frame.contentDocument.close();
2752+ globalThis.__nativePerformanceFrame = frame;
2753+ })())JS", "native-performance-frame-setup.js");
2754+ require(
2755+ evaluate_until_equals(
2756+ engine,
2757+ "globalThis.__nativePerformanceFrame?.contentWindow"
2758+ ".__nativePerformanceFrameReady === true"
2759+ " && typeof globalThis.__nativePerformanceFrame.contentWindow"
2760+ ".performance?.mark === 'function'",
2761+ "native-performance-frame-ready.js",
2762+ "true") == "true",
2763+ "iframe Performance timeline was not installed after hydration");
27432764 const auto result = evaluate(engine, R"JS((() => {
27442765 const probe = (performance, prefix) => {
27452766 const mark = performance.mark;
@@ -2764,14 +2785,11 @@ void test_native_performance_timeline_identity(webscene_engine* engine)
27642785 duration: entry.duration
27652786 };
27662787 };
2767- const frame = document.createElement('iframe');
2768- document.body.appendChild(frame);
2769- frame.contentDocument.open();
2770- frame.contentDocument.write('<html><body></body></html>');
2771- frame.contentDocument.close();
27722788 return {
27732789 main: probe(performance, 'native-main'),
2774- frame: probe(frame.contentWindow.performance, 'native-frame')
2790+ frame: probe(
2791+ globalThis.__nativePerformanceFrame.contentWindow.performance,
2792+ 'native-frame')
27752793 };
27762794 })())JS", "native-performance-timeline-identity.js");
27772795 require(
0 commit comments