1
0
forked from pool/wxWidgets-3_2
wxWidgets-3_2/fix_webkit_tests.patch
2024-10-07 12:52:58 +02:00

74 lines
3.0 KiB
Diff

From 1622a5c9c2f123ef27fc3a52938162a68892e725 Mon Sep 17 00:00:00 2001
From: Scott Talbert <swt@techie.net>
Date: Thu, 1 Feb 2024 20:36:50 -0500
Subject: [PATCH 1/4] Fix WebView tests with WebKitGTK 2.43+
It seems that WebKitGTK is now failing to navigate to about: URLs unless
they are about:blank or about:srcdoc, so use about:srcdoc as the
alternate URL to fix the WebView tests.
Ref: https://github.com/WebKit/WebKit/commit/3c3163e71f647db507949ecebad35d0f2ffb33f3
---
tests/controls/webtest.cpp | 4 ++++
1 file changed, 4 insertions(+)
Index: wxWidgets-3.2.6/samples/webview/webview.cpp
===================================================================
--- wxWidgets-3.2.6.orig/samples/webview/webview.cpp
+++ wxWidgets-3.2.6/samples/webview/webview.cpp
@@ -992,38 +992,38 @@ void WebFrame::OnToolsClicked(wxCommandE
}
m_histMenuItems.clear();
- wxVector<wxSharedPtr<wxWebViewHistoryItem> > back = m_browser->GetBackwardHistory();
- wxVector<wxSharedPtr<wxWebViewHistoryItem> > forward = m_browser->GetForwardHistory();
+ // We can't use empty labels for the menu items, so use this helper to give
+ // them at least some name if we don't have anything better.
+ const auto makeLabel = [](const wxString& title)
+ {
+ return title.empty() ? "(untitled)" : title;
+ };
wxMenuItem* item;
- unsigned int i;
- for(i = 0; i < back.size(); i++)
+ for ( const auto& histItem : m_browser->GetBackwardHistory() )
{
- wxString title = back[i]->GetTitle();
- if ( title.empty() )
+ wxString title = histItem->GetTitle()
+ if ( title.empty() )
title = "(untitled)";
- item = m_tools_history_menu->AppendRadioItem(wxID_ANY, title);
- m_histMenuItems[item->GetId()] = back[i];
+ item = m_tools_history_menu->AppendRadioItem(wxID_ANY, makeLabel(title));
+ m_histMenuItems[item->GetId()] = histItem;
Bind(wxEVT_MENU, &WebFrame::OnHistory, this, item->GetId());
}
- wxString title = m_browser->GetCurrentTitle();
- if ( title.empty() )
- title = "(untitled)";
- item = m_tools_history_menu->AppendRadioItem(wxID_ANY, title);
+ item = m_tools_history_menu->AppendRadioItem(wxID_ANY, makeLabel(m_browser->GetCurrentTitle()));
item->Check();
//No need to connect the current item
m_histMenuItems[item->GetId()] = wxSharedPtr<wxWebViewHistoryItem>(new wxWebViewHistoryItem(m_browser->GetCurrentURL(), m_browser->GetCurrentTitle()));
- for(i = 0; i < forward.size(); i++)
+ for ( const auto& histItem : m_browser->GetForwardHistory() )
{
- wxString title = forward[i]->GetTitle();
+ wxString title = histItem->GetTitle()
if ( title.empty() )
title = "(untitled)";
- item = m_tools_history_menu->AppendRadioItem(wxID_ANY, title);
- m_histMenuItems[item->GetId()] = forward[i];
+ item = m_tools_history_menu->AppendRadioItem(wxID_ANY, makeLabel(title));
+ m_histMenuItems[item->GetId()] = histItem;
Bind(wxEVT_TOOL, &WebFrame::OnHistory, this, item->GetId());
}