[Webkit-unassigned] [Bug 26718] [Gtk] Add support for javascript windows for DRT

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri Jun 26 02:36:37 PDT 2009


https://bugs.webkit.org/show_bug.cgi?id=26718





------- Comment #5 from jmalonzo at gmail.com  2009-06-26 02:36 PDT -------
(In reply to comment #3)
> > >  
> > >  void ChromeClient::closeWindowSoon()
> > >  {
> > > -    notImplemented();
> > > +    webkit_web_view_set_group_name(m_webView, "");
> > 
> > What's this for?

We're closing the page (and maybe finalizing the WebView) so might be a good
idea to set the group name to empty. Mac does it too, that's why I added it
there as well :)

> > > +    webkit_web_view_stop_loading(m_webView);
> > > +
> > > +    g_signal_emit_by_name(m_webView, "close-web-view");
> > >  }
> > 
> > In some cases it's good to have a way to ask the user if he wants to cancel the
> > closing action (ie, return TRUE to prevent closing). For example, the case were
> > forms are modified and not submitted when closing a window can be handled in
> > two ways I guess: 'close-web-view', call view_has_modified_forms, if it has
> > show a dialog asking, return what the user wants to close-request. Another
> > option, I guess, is to just have higher level APIs for this
> > ('close-with-modified-forms' signal).
> >
> > Not sure what makes most sense here, but just commenting :)
> >
> 
> I'll add a check if it's handled to give clients a way to do whatever before
> closing. Thanks :)

I've thought about it, but I don't think it makes sense. This gets emitted when
JavaScript is used to close the window, not when a user closes a
window/webview. If a form was filled out and unsubmitted, and the user suddenly
wants to move away from the page, I think a better mechanism should handle
that. Maybe popup a dialog on delete-event, but we don't have access to form
data atm so I'm not sure how to better handle this.

> > > @@ -132,8 +136,10 @@ static gchar* dumpFramesAsText(WebKitWebFrame* frame)
> > >  
> > >      if (gLayoutTestController->dumpChildFramesAsText()) {
> > >          GSList* children = webkit_web_frame_get_children(frame);
> > > -        for (GSList* child = children; child; child = g_slist_next(child))
> > > -           appendString(result, dumpFramesAsText((WebKitWebFrame*)children->data));
> > > +        for (unsigned i = 0; i < g_slist_length(children); ++i) {
> > > +            WebKitWebFrame* childFrame = static_cast<WebKitWebFrame*>(g_slist_nth_data(children, i));
> > > +            appendString(result, dumpFramesAsText(childFrame));
> > > +        }
> > 
> > Mmm, why this?
> 
> This is a fix to get all the unskipped tests in this patch work. This seemed to
> fix it, but I think I know the reason why. I'll update.

We were using children instead of child here. Fix was included in the patch.

> > > +static WebKitWebView* createWebView()
> > > +{
> > > +    WebKitWebView* view = WEBKIT_WEB_VIEW(webkit_web_view_new());
> > > +    webkit_web_view_set_group_name(view, "org.webkit.gtk.DumpRenderTree");
> > > +
> > > +    g_signal_connect(G_OBJECT(view), "load-started", G_CALLBACK(webViewLoadStarted), 0);
> > > +    g_signal_connect(G_OBJECT(view), "load-finished", G_CALLBACK(webViewLoadFinished), 0);
> > > +    g_signal_connect(G_OBJECT(view), "window-object-cleared", G_CALLBACK(webViewWindowObjectCleared), 0);
> > > +    g_signal_connect(G_OBJECT(view), "console-message", G_CALLBACK(webViewConsoleMessage), 0);
> > > +    g_signal_connect(G_OBJECT(view), "script-alert", G_CALLBACK(webViewScriptAlert), 0);
> > > +    g_signal_connect(G_OBJECT(view), "script-prompt", G_CALLBACK(webViewScriptPrompt), 0);
> > > +    g_signal_connect(G_OBJECT(view), "script-confirm", G_CALLBACK(webViewScriptConfirm), 0);
> > > +    g_signal_connect(G_OBJECT(view), "title-changed", G_CALLBACK(webViewTitleChanged), 0);
> > > +    g_signal_connect(G_OBJECT(view), "navigation-policy-decision-requested", G_CALLBACK(webViewNavigationPolicyDecisionRequested), 0);
> > > +    g_signal_connect(G_OBJECT(view), "status-bar-text-changed", G_CALLBACK(webViewStatusBarTextChanged), 0);
> > > +    g_signal_connect(G_OBJECT(view), "create-web-view", G_CALLBACK(webViewCreate), 0);
> > > +    g_signal_connect(G_OBJECT(view), "close-web-view", G_CALLBACK(webViewClose), 0);
> > 
> > While you are at it, g_signal_connect does not take a GObject as first
> > parameter, so no need to cast. And you could use g_object_connect.
> 
> Ok, thanks for that. I'll post an update.

Done. :)


-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.



More information about the webkit-unassigned mailing list