Bug 43284 - [GTK] Create a frame-created signal
Summary: [GTK] Create a frame-created signal
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKitGTK (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC Linux
: P3 Normal
Assignee: Nobody
URL:
Keywords: Gtk
Depends on:
Blocks:
 
Reported: 2010-07-30 16:27 PDT by Martin Robinson
Modified: 2010-08-02 14:58 PDT (History)
0 users

See Also:


Attachments
Add frame-created signal and test (9.09 KB, patch)
2010-07-30 16:41 PDT, Martin Robinson
xan.lopez: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Robinson 2010-07-30 16:27:10 PDT
There is no way to track the creation of new frames and attach signals to them. A frame-created signal allows a developer to attach signals to all new frames.
Comment 1 Martin Robinson 2010-07-30 16:41:02 PDT
Created attachment 63123 [details]
Add frame-created signal and test
Comment 2 Xan Lopez 2010-08-02 04:24:22 PDT
Comment on attachment 63123 [details]
Add frame-created signal and test

>+    g_signal_connect(webView, "frame-created", G_CALLBACK(createFrameSignalTestFrameCreatedCallback), loop);
>+
>+    // We want to ensure that exactly two create-frame signals are
>+    // fired and no more, so we set a timeout here. There does not appear
>+    // to be a simple way via the API to figure out when all frames have
>+    // loaded.
>+    g_timeout_add(500, createFrameSignalTestTimeout, loop);

webview::document-load-finished does not work?

>+
>+    gtk_container_add(GTK_CONTAINER(window), webView);
>+    gtk_widget_show(window);
>+    gtk_widget_show(webView);
>+
>+    webkit_web_view_load_string(WEBKIT_WEB_VIEW(webView),
>+        "<html><body>Frames!"
>+        "<iframe></iframe>"
>+        "<iframe></iframe>"
>+        "</body></html>",
>+        "text/html", "utf-8", "file://");
>+    g_main_loop_run(loop);
>+}
>+

>+    /*
>+     * WebKitWebView::frame-created
>+     * @web_view: the object which received the signal
>+     * @web_frame: the #WebKitWebFrame which was just created.
>+     *
>+     * Emitted when a WebKitWebView has created a new frame. This signal will
>+     * be fired for all sub-frames created during page load. It will not be
>+     * emitted for the main frame, which originates in the WebKitWebView constructor
>+     * and may be accessed any time using webkit_web_view_get_main_frame.

Missing a Since:

Looks good otherwise.
Comment 3 Martin Robinson 2010-08-02 14:51:32 PDT
(In reply to comment #2)
> >+    g_timeout_add(500, createFrameSignalTestTimeout, loop);
> webview::document-load-finished does not work?

I tried a patch which counted document-load-finished signals, but
that seemed to have bad interactions with the GLib main loop and
libsoup. I wonder if it's exposing another bug. :/

> Missing a Since:

Fixed!
Comment 4 Martin Robinson 2010-08-02 14:58:53 PDT
Committed r64496: <http://trac.webkit.org/changeset/64496>