Fix recursion problems when loading pages from a virtual file system using the WebKitGTK+ backend. Navigating through pages in an archive now works correctly.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/SOC2011_WEBVIEW@68515 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -137,6 +137,10 @@ public:
|
|||||||
*/
|
*/
|
||||||
bool m_busy;
|
bool m_busy;
|
||||||
|
|
||||||
|
//We use this flag to stop recursion when we load a page from the navigation
|
||||||
|
//callback, mainly when loading a VFS page
|
||||||
|
bool m_guard;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const;
|
virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const;
|
||||||
|
@@ -63,13 +63,19 @@ wxgtk_webview_webkit_load_status(GtkWidget* widget,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
wxgtk_webview_webkit_navigation(WebKitWebView *view,
|
wxgtk_webview_webkit_navigation(WebKitWebView *,
|
||||||
WebKitWebFrame *frame,
|
WebKitWebFrame *frame,
|
||||||
WebKitNetworkRequest *request,
|
WebKitNetworkRequest *request,
|
||||||
WebKitWebNavigationAction *,
|
WebKitWebNavigationAction *,
|
||||||
WebKitWebPolicyDecision *policy_decision,
|
WebKitWebPolicyDecision *policy_decision,
|
||||||
wxWebViewWebKit *webKitCtrl)
|
wxWebViewWebKit *webKitCtrl)
|
||||||
{
|
{
|
||||||
|
if(webKitCtrl->m_guard)
|
||||||
|
{
|
||||||
|
webKitCtrl->m_guard = false;
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
webKitCtrl->m_busy = true;
|
webKitCtrl->m_busy = true;
|
||||||
|
|
||||||
const gchar* uri = webkit_network_request_get_uri(request);
|
const gchar* uri = webkit_network_request_get_uri(request);
|
||||||
@@ -108,14 +114,15 @@ wxgtk_webview_webkit_navigation(WebKitWebView *view,
|
|||||||
//ourselves
|
//ourselves
|
||||||
if(handler)
|
if(handler)
|
||||||
{
|
{
|
||||||
|
webKitCtrl->m_guard = true;
|
||||||
wxFSFile* file = handler->GetFile(wxuri);
|
wxFSFile* file = handler->GetFile(wxuri);
|
||||||
g_signal_handlers_block_by_func(view,
|
if(file)
|
||||||
(gpointer)wxgtk_webview_webkit_navigation,
|
{
|
||||||
webKitCtrl);
|
webKitCtrl->SetPage(*file->GetStream(), wxuri);
|
||||||
webKitCtrl->SetPage(*file->GetStream(), wxuri);
|
}
|
||||||
g_signal_handlers_unblock_by_func(view,
|
//We need to throw some sort of error here if file is NULL
|
||||||
(gpointer)wxgtk_webview_webkit_navigation,
|
webkit_web_policy_decision_ignore(policy_decision);
|
||||||
webKitCtrl);
|
return TRUE;
|
||||||
}
|
}
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@@ -325,6 +332,7 @@ bool wxWebViewWebKit::Create(wxWindow *parent,
|
|||||||
{
|
{
|
||||||
m_ready = false;
|
m_ready = false;
|
||||||
m_busy = false;
|
m_busy = false;
|
||||||
|
m_guard = false;
|
||||||
|
|
||||||
if (!PreCreation( parent, pos, size ) ||
|
if (!PreCreation( parent, pos, size ) ||
|
||||||
!CreateBase( parent, id, pos, size, style, wxDefaultValidator, name ))
|
!CreateBase( parent, id, pos, size, style, wxDefaultValidator, name ))
|
||||||
|
Reference in New Issue
Block a user