Changeset 154329 in webkit
- Timestamp:
- Aug 20, 2013 8:57:38 AM (11 years ago)
- Location:
- trunk/Source/WebKit2
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r154321 r154329 1 2013-08-20 Anton Obzhirov <a.obzhirov@samsung.com> 2 3 <https://webkit.org/b/119487> [Gtk] Cancel authentication on load failed 4 5 Reviewed by Martin Robinson. 6 7 Added callback to handle load-failed event in default authentication dialog. 8 Authentication request gets cancelled and the dialog widget gets destroyed. 9 10 * UIProcess/API/gtk/WebKitAuthenticationDialog.cpp: 11 (pageLoadFailed): 12 (webkitAuthenticationDialogInitialize): 13 (webkitAuthenticationDialogDispose): 14 (webkit_authentication_dialog_class_init): 15 (webkitAuthenticationDialogNew): 16 * UIProcess/API/gtk/WebKitAuthenticationDialog.h: 17 * UIProcess/API/gtk/WebKitWebView.cpp: 18 (webkitWebViewAuthenticate): 19 1 20 2013-08-20 Allan Sandfeld Jensen <allan.jensen@digia.com> 2 21 -
trunk/Source/WebKit2/UIProcess/API/gtk/WebKitAuthenticationDialog.cpp
r153882 r154329 25 25 #include "WebKitCredentialPrivate.h" 26 26 #include "WebKitPrivate.h" 27 #include "WebKitWebView.h" 27 28 28 29 using namespace WebKit; … … 32 33 GtkWidget* authWidget; 33 34 GtkWidget* defaultButton; 35 unsigned long loadFailedEventID; 34 36 GRefPtr<GtkStyleContext> styleContext; 37 WebKitWebView* webView; 35 38 }; 36 39 … … 52 55 } 53 56 54 static void webkitAuthenticationDialogInitialize(WebKitAuthenticationDialog* authDialog, CredentialStorageMode credentialStorageMode) 57 static void pageLoadFailed(WebKitWebView*, WebKitLoadEvent, const char*, GError*, WebKitAuthenticationDialog* authDialog) 58 { 59 webkit_authentication_request_cancel(authDialog->priv->request.get()); 60 gtk_widget_destroy(GTK_WIDGET(authDialog)); 61 } 62 63 static void webkitAuthenticationDialogInitialize(WebKitAuthenticationDialog* authDialog, CredentialStorageMode credentialStorageMode, WebKitWebView* webView) 55 64 { 56 65 GtkWidget* frame = gtk_frame_new(0); … … 89 98 gtk_container_add(GTK_CONTAINER(authDialog), frame); 90 99 gtk_widget_show(frame); 100 101 authDialog->priv->webView = webView; 102 authDialog->priv->loadFailedEventID = g_signal_connect(webView, "load-failed", G_CALLBACK(pageLoadFailed), authDialog); 91 103 } 92 104 … … 125 137 } 126 138 139 static void webkitAuthenticationDialogDispose(GObject* object) 140 { 141 WebKitAuthenticationDialogPrivate* priv = WEBKIT_AUTHENTICATION_DIALOG(object)->priv; 142 if (priv->loadFailedEventID) { 143 g_signal_handler_disconnect(priv->webView, priv->loadFailedEventID); 144 priv->loadFailedEventID = 0; 145 } 146 147 G_OBJECT_CLASS(webkit_authentication_dialog_parent_class)->dispose(object); 148 } 149 127 150 static void webkit_authentication_dialog_class_init(WebKitAuthenticationDialogClass* klass) 128 151 { 129 152 GObjectClass* objectClass = G_OBJECT_CLASS(klass); 130 153 objectClass->constructed = webkitAuthenticationDialogConstructed; 154 objectClass->dispose = webkitAuthenticationDialogDispose; 131 155 132 156 GtkWidgetClass* widgetClass = GTK_WIDGET_CLASS(klass); … … 135 159 } 136 160 137 GtkWidget* webkitAuthenticationDialogNew(WebKitAuthenticationRequest* request, CredentialStorageMode mode )161 GtkWidget* webkitAuthenticationDialogNew(WebKitAuthenticationRequest* request, CredentialStorageMode mode, WebKitWebView* webView) 138 162 { 139 163 WebKitAuthenticationDialog* authDialog = WEBKIT_AUTHENTICATION_DIALOG(g_object_new(WEBKIT_TYPE_AUTHENTICATION_DIALOG, NULL)); 140 164 authDialog->priv->request = request; 141 webkitAuthenticationDialogInitialize(authDialog, mode );165 webkitAuthenticationDialogInitialize(authDialog, mode, webView); 142 166 return GTK_WIDGET(authDialog); 143 167 } -
trunk/Source/WebKit2/UIProcess/API/gtk/WebKitAuthenticationDialog.h
r153882 r154329 23 23 #include "WebKitAuthenticationRequest.h" 24 24 #include "WebKitAuthenticationWidget.h" 25 #include "WebKitWebView.h" 25 26 #include <gtk/gtk.h> 26 27 … … 49 50 50 51 GType webkit_authentication_dialog_get_type(); 51 GtkWidget* webkitAuthenticationDialogNew(WebKitAuthenticationRequest*, CredentialStorageMode );52 GtkWidget* webkitAuthenticationDialogNew(WebKitAuthenticationRequest*, CredentialStorageMode, WebKitWebView*); 52 53 53 54 G_END_DECLS -
trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp
r153882 r154329 436 436 { 437 437 CredentialStorageMode credentialStorageMode = webkit_authentication_request_can_save_credentials(request) ? AllowPersistentStorage : DisallowPersistentStorage; 438 webkitWebViewBaseAddAuthenticationDialog(WEBKIT_WEB_VIEW_BASE(webView), webkitAuthenticationDialogNew(request, credentialStorageMode ));438 webkitWebViewBaseAddAuthenticationDialog(WEBKIT_WEB_VIEW_BASE(webView), webkitAuthenticationDialogNew(request, credentialStorageMode, webView)); 439 439 440 440 return TRUE;
Note: See TracChangeset
for help on using the changeset viewer.