From f2c441cc2e7c36df106707880624a13cc403caa8 Mon Sep 17 00:00:00 2001 From: Marcus Tillmanns Date: Wed, 4 Nov 2026 14:43:49 +0100 Subject: [PATCH] qt-core, webview: Keep the trace's file name in the QtProfiler viewer The viewer picks its parser by file name: a name ending in .qtd is read as XML, anything else as the compressed .qzt format. The webview wrote every trace to /traces/trace.qtd, so a .qzt trace was parsed as XML and failed with "Encountered incorrectly encoded content". Write the trace under its real file name instead. Assisted-by: Claude Code Change-Id: I68fac9804b3c3f91aafb383efe2c266cf8d3a662 --- .../src/apps/qml-trace/viewlogic.profiler.svelte.ts | 12 +++++++++--- .../src/apps/qml-trace/viewlogic.svelte.ts | 3 ++- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/qt-core/webview-ui/src/apps/qml-trace/viewlogic.profiler.svelte.ts b/qt-core/webview-ui/src/apps/qml-trace/viewlogic.profiler.svelte.ts index 02340e650..1e3c10d35 100644 --- a/qt-core/webview-ui/src/apps/qml-trace/viewlogic.profiler.svelte.ts +++ b/qt-core/webview-ui/src/apps/qml-trace/viewlogic.profiler.svelte.ts @@ -21,7 +21,13 @@ interface QtWindow { qtprofiler_entry: unknown; } -export async function load(ui: HTMLElement, dist: string, bytes: Uint8Array) { +export async function load( + ui: HTMLElement, + dist: string, + bytes: Uint8Array, + fileName: string +) { + const tracePath = `/traces/${fileName}`; await loadScript(`${dist}/qtloader.js`); await loadScript(`${dist}/qtprofiler.js`); @@ -31,11 +37,11 @@ export async function load(ui: HTMLElement, dist: string, bytes: Uint8Array) { containerElements: [ui], entryFunction: w.qtprofiler_entry, }, - arguments: ['--embedded', '/traces/trace.qtd'], + arguments: ['--embedded', tracePath], locateFile: (p) => `${dist}/${p}`, preRun: [module => { module.FS.mkdir('/traces'); - module.FS.writeFile('/traces/trace.qtd', bytes); + module.FS.writeFile(tracePath, bytes); }] }); } diff --git a/qt-core/webview-ui/src/apps/qml-trace/viewlogic.svelte.ts b/qt-core/webview-ui/src/apps/qml-trace/viewlogic.svelte.ts index bb442ab13..fb8a10b76 100644 --- a/qt-core/webview-ui/src/apps/qml-trace/viewlogic.svelte.ts +++ b/qt-core/webview-ui/src/apps/qml-trace/viewlogic.svelte.ts @@ -20,7 +20,8 @@ export async function onAppMount() { await profiler.load( ui.container, data.configs.qtProfiler.distDir, - data.bytes + data.bytes, + data.configs.fileName ); }