Clear script ids in RemoveAllUserScripts()

This commit is contained in:
Tobias Taschner 2021-02-28 22:38:09 +01:00
parent 5a30bbe38f
commit 5e35e6c635
No known key found for this signature in database
GPG Key ID: AE6ECD71294F87FD

View File

@ -887,13 +887,13 @@ bool wxWebViewEdge::AddUserScript(const wxString& javascript,
void wxWebViewEdge::RemoveAllUserScripts()
{
m_impl->m_pendingUserScripts.clear();
for (wxVector<wxString>::iterator it = m_impl->m_userScriptIds.begin();
it != m_impl->m_userScriptIds.end(); ++it)
for (auto& scriptId : m_impl->m_userScriptIds)
{
HRESULT hr = m_impl->m_webView->RemoveScriptToExecuteOnDocumentCreated(it->wc_str());
HRESULT hr = m_impl->m_webView->RemoveScriptToExecuteOnDocumentCreated(scriptId.wc_str());
if (FAILED(hr))
wxLogApiError("RemoveScriptToExecuteOnDocumentCreated", hr);
}
m_impl->m_userScriptIds.clear();
}
void wxWebViewEdge::RegisterHandler(wxSharedPtr<wxWebViewHandler> handler)