fix: only the top level frame should have the orca syles and bridges injected

This commit is contained in:
Ian Chua
2026-07-20 12:48:17 +08:00
parent 3a48086f5d
commit ddbbc7f7f2
2 changed files with 9 additions and 5 deletions
@@ -96,6 +96,9 @@ std::string WebViewHostDialog::document_start_injector(const std::string& markup
const std::string literal = nlohmann::json(markup).dump();
std::string s;
s += "(function(){";
// wxWebView's AddUserScript runs in child frames too (including cross-origin
// frames on WebView2). Host theme state belongs only to the top-level page.
s += "if(window.top!==window.self)return;";
s += prelude;
s += "var css=" + literal + ";";
s += "function inject(){";