mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-09-27 02:41:17 +00:00
Restore Plugin HTML After a WebKit Reload (#15737)
Plugin dialog content is injected with SetPage, so on the WebKit backends a reload (context menu, keyboard shortcut or location.reload()) re-fetches the SetPage base URL instead of the injected document, and the plugin UI is gone for good: load_plugin_content() returned early once m_content_loaded was set. Re-inject the plugin HTML when a main-frame load after the initial swap is neither that swap nor a page the plugin linked to. m_own_page_load marks the load our own SetPage caused, and the URL test recognises the reload: the injected document and the directory a reload re-fetches both report the base URL, so a load of any other URL is left alone. The test ignores a fragment the page navigated to, and undoes the escaping the web view applies to what the resources path holds. A load reaching the base URL is not enough on its own, because WebKitGTK reports a navigation that never committed against the document that stayed and then finishes that document again: a link to a missing file therefore arrives as a load of the base URL and reads exactly like a reload. So the re-injection also requires a navigation to the base URL to have committed, which a reload always does and a failure never does. A bootstrap page that cannot be loaded is still not recovered from: WebKitGTK substitutes a stock error page for it, and that load supersedes the swap whichever way the swap is ordered around it. The file ships, so this is a broken-install path; nothing here makes it worse than it already was. No separate MSW path is needed: wxWebViewEdge ignores the SetPage base URL, so its documents report about:blank and the test never matches there, and WebView2 reloads NavigateToString content from its own history entry anyway.
This commit is contained in:
@@ -64,6 +64,7 @@ protected:
|
||||
|
||||
private:
|
||||
void on_bootstrap_event(wxWebViewEvent& event);
|
||||
void on_navigated(wxWebViewEvent& event);
|
||||
void load_plugin_content();
|
||||
void on_close_window(wxCloseEvent& event);
|
||||
void fire_submit(const nlohmann::json& data);
|
||||
@@ -72,6 +73,8 @@ private:
|
||||
|
||||
std::string m_html;
|
||||
bool m_content_loaded{false};
|
||||
bool m_own_page_load{false}; // a SetPage of the plugin HTML is in flight
|
||||
bool m_content_navigated{false}; // a navigation to the base URL has committed
|
||||
bool m_open{true};
|
||||
bool m_close_fired{false};
|
||||
std::optional<nlohmann::json> m_result;
|
||||
|
||||
Reference in New Issue
Block a user