static void notify_load_status_cb(WebKitWebView* view, GParamSpec* pspec, GMainLoop* loop)
{
    WebKitLoadStatus status = webkit_web_view_get_load_status (view);
    WebKitWebFrame* frame = webkit_web_view_get_main_frame(view);
    WebKitWebDataSource* dataSource = webkit_web_frame_get_data_source(frame);

    if (status == WEBKIT_LOAD_COMMITTED) {
        g_assert(webkit_web_data_source_is_loading(dataSource));
        return;
    }
    else if (status != WEBKIT_LOAD_FINISHED)
        return;

    /* Test get_request */
    g_test_message("Testing webkit_web_data_source_get_request");
    WebKitNetworkRequest* request = webkit_web_data_source_get_request(dataSource);
    g_assert_cmpstr(webkit_network_request_get_uri(request), ==, "http://www.webkit.org/");

    /* Test get_main_resource */
    g_test_message("Testing webkit_web_data_source_get_main_resource");
    WebKitWebResource* resource = webkit_web_data_source_get_main_resource(dataSource);
    g_assert_cmpstr("text/html", ==, webkit_web_resource_get_mime_type(resource));
    g_assert_cmpstr("http://www.webkit.org/", ==, webkit_web_resource_get_uri(resource));

    /* Test get_data. We just test if data has certain size for the mean time */
    g_test_message("Testing webkit_web_data_source_get_data has certain size");
    GString* data = webkit_web_data_source_get_data(dataSource);
    g_assert(data->len > 100);

    /* FIXME: Add test for get_encoding */

    g_main_loop_quit(loop);
}
Beispiel #2
0
static void
web_view_load_status_changed_cb (WebKitWebView *webkit_web_view,
                                 GParamSpec *pspec,
                                 gpointer user_data)
{
	WebKitLoadStatus status;
	ESearchBar *search_bar;

	status = webkit_web_view_get_load_status (webkit_web_view);
	if (status != WEBKIT_LOAD_FINISHED)
		return;

	if (!user_data)
		return;

	search_bar = E_SEARCH_BAR (user_data);

	if (gtk_widget_get_visible (GTK_WIDGET (search_bar))) {
		if (search_bar->priv->active_search != NULL) {
		       search_bar_find (search_bar, TRUE);
		}
	} else {
		e_web_view_update_highlights (search_bar->priv->web_view);
	}
}
Beispiel #3
0
static void status_changed_cb(GObject* object, GParamSpec* pspec, WebLoadingFixture* fixture)
{
    WebKitLoadStatus status = webkit_web_view_get_load_status(WEBKIT_WEB_VIEW(object));

    switch (status) {
    case WEBKIT_LOAD_PROVISIONAL:
        g_assert(!fixture->has_been_provisional);
        g_assert(!fixture->has_been_committed);
        g_assert(!fixture->has_been_first_visually_non_empty_layout);
        fixture->has_been_provisional = TRUE;
        break;
    case WEBKIT_LOAD_COMMITTED:
        g_assert(fixture->has_been_provisional);
        g_assert(!fixture->has_been_committed);
        g_assert(!fixture->has_been_first_visually_non_empty_layout);
        fixture->has_been_committed = TRUE;
        break;
    case WEBKIT_LOAD_FIRST_VISUALLY_NON_EMPTY_LAYOUT:
        g_assert(fixture->has_been_provisional);
        g_assert(fixture->has_been_committed);
        g_assert(!fixture->has_been_first_visually_non_empty_layout);
        fixture->has_been_first_visually_non_empty_layout = TRUE;
        break;
    case WEBKIT_LOAD_FINISHED:
        g_assert(fixture->has_been_provisional);
        g_assert(fixture->has_been_committed);
        g_assert(fixture->has_been_first_visually_non_empty_layout);
        break;
    default:
        g_assert_not_reached();
    }
}
Beispiel #4
0
void cb_wv_notify_load_status(WebKitWebView *view, GParamSpec *pspec, Browser *b)
{
	WebKitWebFrame *frame;
	WebKitWebDataSource *source;
	WebKitNetworkRequest *request;
	SoupMessage *message;
	char *uri;

	switch (webkit_web_view_get_load_status(b->UI.view)) {
	case WEBKIT_LOAD_COMMITTED:
		uri = browser_get_uri(b);
		if (strstr(uri, "https://") == uri) {
			/* get ssl state */
			frame = webkit_web_view_get_main_frame(b->UI.view);
			source = webkit_web_frame_get_data_source(frame);
			request = webkit_web_data_source_get_request(source);
			message = webkit_network_request_get_message(request);
			b->State.ssl = soup_message_get_flags(message)
				^ SOUP_MESSAGE_CERTIFICATE_TRUSTED;
		}
		break;
	case WEBKIT_LOAD_FINISHED:
		/* add uri to history */
		if (!private_browsing && (uri = (char *)webkit_web_view_get_uri(b->UI.view))) {
			history_add(uri);
		}
		b->State.progress = 100;
		break;
	default:
		break;
	}

	/* update browser (statusbar, progress, position) */
	browser_update(b);
}
static void load_status_cb(WebKitWebView* webView, GParamSpec* spec, gpointer data)
{
    CopyAndPasteFixture* fixture = (CopyAndPasteFixture*)data;
    WebKitLoadStatus status = webkit_web_view_get_load_status(webView);
    if (status != WEBKIT_LOAD_FINISHED)
        return;

    GtkClipboard* clipboard = gtk_clipboard_get(GDK_SELECTION_CLIPBOARD);
    gtk_clipboard_clear(clipboard);

    webkit_web_view_copy_clipboard(webView);

    gchar* text = gtk_clipboard_wait_for_text(clipboard);
    g_assert(text || !fixture->info->expectedContent);
    g_assert(!text || !strcmp(text, fixture->info->expectedContent));
    g_free(text);

    // Verify that the markup starts with the proper content-type meta tag prefix.
    GtkSelectionData* selectionData = gtk_clipboard_wait_for_contents(clipboard, gdk_atom_intern("text/html", FALSE));
    if (selectionData) {
        static const char* markupPrefix = "<meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\">";
        char* markup = g_strndup((const char*) gtk_selection_data_get_data(selectionData),
            gtk_selection_data_get_length(selectionData));
        g_assert(strlen(markupPrefix) <= strlen(markup));
        g_assert(!strncmp(markupPrefix, markup, strlen(markupPrefix)));
        g_free(markup);
    }

    g_assert(!gtk_clipboard_wait_is_uris_available(clipboard));
    g_assert(!gtk_clipboard_wait_is_image_available(clipboard));

    g_main_loop_quit(fixture->loop);
}
Beispiel #6
0
static void view_cb_notify_load_status(WebKitWebView *view, GParamSpec *pspec,
				       struct browser_context *ctx)
{
	int status = webkit_web_view_get_load_status(view);
	wpa_printf(MSG_DEBUG, "BROWSER:%s load-status=%d uri=%s",
		   __func__, status, webkit_web_view_get_uri(view));
}
static void test_ime_load_status_cb(WebKitWebView* webView, GParamSpec* spec, gpointer data)
{
    KeyEventFixture* fixture = (KeyEventFixture*)data;
    WebKitLoadStatus status = webkit_web_view_get_load_status(webView);
    if (status != WEBKIT_LOAD_FINISHED)
        return;

    JSGlobalContextRef context = webkit_web_frame_get_global_context(
        webkit_web_view_get_main_frame(webView));
    g_assert(context);

    GtkIMContext* imContext = 0;
    g_object_get(webView, "im-context", &imContext, NULL);
    g_assert(imContext);

    // Test that commits that happen outside of key events
    // change the text field immediately. This closely replicates
    // the behavior of SCIM.
    g_assert(element_text_equal_to(context, ""));
    g_signal_emit_by_name(imContext, "commit", "a");
    g_assert(element_text_equal_to(context, "a"));
    g_signal_emit_by_name(imContext, "commit", "b");
    g_assert(element_text_equal_to(context, "ab"));
    g_signal_emit_by_name(imContext, "commit", "c");
    g_assert(element_text_equal_to(context, "abc"));

    g_object_unref(imContext);
    g_main_loop_quit(fixture->loop);
}
Beispiel #8
0
static void load_goback_status_changed_cb(GObject* object, GParamSpec* pspec, WebLoadingFixture* fixture)
{
    WebKitLoadStatus status = webkit_web_view_get_load_status(WEBKIT_WEB_VIEW(object));

    switch(status) {
    case WEBKIT_LOAD_PROVISIONAL:
        g_assert(!fixture->has_been_provisional);
        fixture->has_been_provisional = TRUE;
        break;
    case WEBKIT_LOAD_COMMITTED:
        g_assert(fixture->has_been_provisional);
        fixture->has_been_committed = TRUE;
        break;
    case WEBKIT_LOAD_FAILED:
        g_assert_not_reached();
        break;
    case WEBKIT_LOAD_FINISHED:
        g_assert(fixture->has_been_provisional);
        g_assert(fixture->has_been_committed);
        fixture->has_been_finished = TRUE;
        g_main_loop_quit(fixture->loop);
        break;
    default:
        break;
    }
}
Beispiel #9
0
static void idleQuitLoopCallback(WebKitWebView *webView, GParamSpec *paramSpec, gboolean *iconOrPageLoaded)
{
    WebKitLoadStatus status = webkit_web_view_get_load_status(webView);

    if (status == WEBKIT_LOAD_FINISHED || status == WEBKIT_LOAD_FAILED)
        quitMainLoopIfLoadCompleted(iconOrPageLoaded);
}
static void
load_status_notify_cb (GObject *object,
		       GParamSpec *spec,
		       EphyGreasemonkeyExtension *extension)
{
	ApplyScriptCBData *data;
	WebKitWebView *web_view;
	WebKitLoadStatus status;
	const char *location;

	web_view = WEBKIT_WEB_VIEW (object);

	status = webkit_web_view_get_load_status (web_view);
	if (status != WEBKIT_LOAD_FINISHED)
		return;

	location = webkit_web_view_get_uri (web_view);
	if (location == NULL)
		return;

	data = g_new (ApplyScriptCBData, 1);
	data->web_view = web_view;
	data->location = location;

	g_hash_table_foreach (extension->priv->scripts,
			      (GHFunc) maybe_apply_script, data);

	g_free (data);
}
Beispiel #11
0
static void load_wentback_status_changed_cb(GObject* object, GParamSpec* pspec, WebLoadingFixture* fixture)
{
    WebKitLoadStatus status = webkit_web_view_get_load_status(WEBKIT_WEB_VIEW(object));
    char* uri_string;
    char* uri_string2;

    uri_string = get_uri_for_path("/test_loading_status");
    uri_string2 = get_uri_for_path("/test_loading_status2");

    switch(status) {
    case WEBKIT_LOAD_PROVISIONAL:
        g_assert_cmpstr(webkit_web_view_get_uri(fixture->webView), ==, uri_string2);
        break;
    case WEBKIT_LOAD_COMMITTED:
        g_assert_cmpstr(webkit_web_view_get_uri(fixture->webView), ==, uri_string);
        break;
    case WEBKIT_LOAD_FAILED:
        g_assert_not_reached();
        break;
    case WEBKIT_LOAD_FINISHED:
        g_assert_cmpstr(webkit_web_view_get_uri(fixture->webView), ==, uri_string);
        g_main_loop_quit(fixture->loop);
        break;
    default:
        break;
    }

    g_free(uri_string);
    g_free(uri_string2);
}
Beispiel #12
0
static void load_status_callback(WebKitWebView* webView, GParamSpec* spec, DomDomviewFixture* fixture)
{
    WebKitLoadStatus status = webkit_web_view_get_load_status(webView);
    if (status == WEBKIT_LOAD_FINISHED) {
        WebKitDOMDocument* document;
        WebKitDOMDOMWindow* domWindow;
        WebKitDOMElement* element;
        WebKitDOMEvent* event;
        glong clientX, clientY;

        document = webkit_web_view_get_dom_document(WEBKIT_WEB_VIEW(fixture->webView));
        g_assert(document);
        domWindow = webkit_dom_document_get_default_view(document);
        g_assert(domWindow);
        fixture->domWindow = domWindow;

        element = webkit_dom_document_get_element_by_id(document, "test");
        g_assert(element);
        event = webkit_dom_document_create_event(document, "MouseEvent", NULL);
        g_assert(event);
        g_assert(WEBKIT_DOM_IS_EVENT(event));
        g_assert(WEBKIT_DOM_IS_MOUSE_EVENT(event));
        clientX = webkit_dom_element_get_client_left(element);
        clientY = webkit_dom_element_get_client_top(element);
        webkit_dom_mouse_event_init_mouse_event(WEBKIT_DOM_MOUSE_EVENT(event),
                                                "click", TRUE, TRUE,
                                                fixture->domWindow, 0, 0, 0, clientX, clientY,
                                                FALSE, FALSE, FALSE, FALSE,
                                                1, WEBKIT_DOM_EVENT_TARGET(element));
        webkit_dom_event_target_add_event_listener(WEBKIT_DOM_EVENT_TARGET(element), "click", G_CALLBACK(clicked_cb), false, fixture);
        g_assert(fixture->clicked == FALSE);
        webkit_dom_event_target_dispatch_event(WEBKIT_DOM_EVENT_TARGET(element), event, NULL);
    }

}
Beispiel #13
0
static void
load_status_cb (GObject* object, GParamSpec* pspec, gpointer data) {
    WebKitDOMDocument *document;
    WebKitWebView *web_view;
    WebKitLoadStatus status;
    Ctx *ctx;
    gulong count;
    gint64 now, elapsed;

    ctx = (Ctx *) data;
    web_view = WEBKIT_WEB_VIEW(object);
    status = webkit_web_view_get_load_status(web_view);
    if (status != WEBKIT_LOAD_FINISHED) {
        return;
    }

    /* We now know that the document has been loaded */
    g_main_loop_quit(ctx->loop);
    now = g_get_monotonic_time();
    printf("Document loaded in %lldms\n", TO_MS(now - (ctx->start_time)));

    document = webkit_web_view_get_dom_document(web_view);
    count = walk_dom(WEBKIT_DOM_NODE(document));
    elapsed = g_get_monotonic_time() - now;
    printf("Document has %ld nodes and took %lldms to walk\n", count, TO_MS(elapsed));
}
Beispiel #14
0
/** 
 * Callback that will be called if the load-status changes, return true to stop
 * the emission
 *
 * @callback WebKitWebView#loadUriCallback 
 * @param {WebKitWebView} wv The webview which loaded the uri
 * */
static gboolean 
wv_status_cb(CallbackData *c) 
{
    WebKitLoadStatus status = webkit_web_view_get_load_status(WEBKIT_WEB_VIEW(c->gobject));
    if (status == WEBKIT_LOAD_FINISHED || status == WEBKIT_LOAD_FAILED) 
        return true;
    return false;
}/*}}}*/
/* FIXME: This is necessary because WebKit caches the Problems.html page, even
though Page Caching is turned off! So unless it is reloaded right after it is
loaded, the compiler's newly written version is not picked up. Shame there is no
webkit_web_view_load_uri_bypass_cache(). Presumably this is fixed in WebKit2. */
static void
on_load_status_finished_reload(WebKitWebView *html, GParamSpec *pspec)
{
    WebKitLoadStatus status = webkit_web_view_get_load_status(html);
    if(status != WEBKIT_LOAD_FINISHED && status != WEBKIT_LOAD_FAILED)
        return;
    webkit_web_view_reload_bypass_cache(html);
    g_signal_handlers_disconnect_by_func(html, on_load_status_finished_reload, NULL);
}
Beispiel #16
0
JNIEXPORT jint JNICALL WebKitGTK_NATIVE(_1webkit_1web_1view_1get_1load_1status)
	(JNIEnv *env, jclass that, jintLong arg0)
{
	jint rc = 0;
	WebKitGTK_NATIVE_ENTER(env, that, _1webkit_1web_1view_1get_1load_1status_FUNC);
	rc = (jint)webkit_web_view_get_load_status((WebKitWebView *)arg0);
	WebKitGTK_NATIVE_EXIT(env, that, _1webkit_1web_1view_1get_1load_1status_FUNC);
	return rc;
}
Beispiel #17
0
static void notifyLoadStatusCb(WebKitWebView* webView, GParamSpec* pspec, GtkWidget* uriEntry)
{
    if (webkit_web_view_get_load_status(webView) == WEBKIT_LOAD_COMMITTED) {
        WebKitWebFrame *frame = webkit_web_view_get_main_frame(webView);
        const gchar *uri = webkit_web_frame_get_uri(frame);
        if (uri)
            gtk_entry_set_text(GTK_ENTRY(uriEntry), uri);
    }
}
Beispiel #18
0
void
wk_load_status_cb (GObject *object, GParamSpec *pspec, gpointer data) {
	WebKitWebView *web_view = WEBKIT_WEB_VIEW(object);
	WebKitLoadStatus status = webkit_web_view_get_load_status(web_view);

	if (status == WEBKIT_LOAD_FINISHED) {
		LOG_DEBUG("webkit: load finished");
		pthread_mutex_unlock(&web_view_ready_mutex);
	}
}
static char* gtkWebBrowserGetStatusAttrib(Ihandle* ih)
{
  WebKitLoadStatus status = webkit_web_view_get_load_status((WebKitWebView*)ih->handle);
  if (status == WEBKIT_LOAD_FAILED)
    return "FAILED";
  else if (status == WEBKIT_LOAD_FINISHED)
    return "COMPLETED";
  else
    return "LOADING";
}
static void load_status_cb(WebKitWebView* webview, GParamSpec *pspec, gpointer user_data){
  //TODO is GParamSpec holding the actual value?
  WebKitLoadStatus s = webkit_web_view_get_load_status(webview);
  //printf("Load status: %d\n", s);
  if (s == WEBKIT_LOAD_FINISHED){
    printf("Loading Tumblr TV succeeded!\n");
  } else if (s == WEBKIT_LOAD_FAILED){
    printf("Load failed! Womp womp :(\n");
  }
}
static void load_status_cb(WebKitWebView* webView, GParamSpec* spec, gpointer data)
{
    KeyEventFixture* fixture = (KeyEventFixture*)data;
    WebKitLoadStatus status = webkit_web_view_get_load_status(webView);
    if (status == WEBKIT_LOAD_FINISHED) {
        gtk_test_widget_send_key(GTK_WIDGET(fixture->webView),
                                 gdk_unicode_to_keyval('a'), 0);
    }

}
Beispiel #22
0
static void load_event_callback(WebKitWebView* webView, GParamSpec* spec, DomDomviewFixture* fixture)
{
    WebKitLoadStatus status = webkit_web_view_get_load_status(webView);
    if (status == WEBKIT_LOAD_FINISHED) {
        webkit_dom_event_target_add_event_listener(WEBKIT_DOM_EVENT_TARGET(fixture->domWindow), "click", G_CALLBACK(clickedCallback), false, fixture);

        g_assert(fixture->clicked == FALSE);
        gtk_test_widget_click(GTK_WIDGET(fixture->webView), 1, 0);
    }

}
Beispiel #23
0
static void
load_status_cb (GObject* object, GParamSpec* pspec, gpointer data) {
    WebKitWebView *web_view = WEBKIT_WEB_VIEW(object);
    WebKitLoadStatus status = webkit_web_view_get_load_status(web_view);
    if (status != WEBKIT_LOAD_FINISHED) {
        return;
    }

    save_as_pdf(GTK_WIDGET(web_view), (const gchar *) data);

    gtk_main_quit();
}
Beispiel #24
0
void
plugins_load_status_cb(WebKitWebView *wv, GParamSpec *p, GList *gl) 
{
    WebKitLoadStatus status = webkit_web_view_get_load_status(wv);
    if (status == WEBKIT_LOAD_COMMITTED) 
    {
        WebKitDOMDocument *doc = webkit_web_view_get_dom_document(wv);
        WebKitDOMDOMWindow *win = webkit_dom_document_get_default_view(doc);
        webkit_dom_event_target_add_event_listener(WEBKIT_DOM_EVENT_TARGET(win), "beforeload", G_CALLBACK(plugins_before_load_cb), true, gl);
        webkit_dom_event_target_add_event_listener(WEBKIT_DOM_EVENT_TARGET(win), "beforeunload", G_CALLBACK(plugins_before_unload_cb), true, gl);
    }
}
Beispiel #25
0
static void
mail_printer_load_status_cb (WebKitWebView *web_view,
                             GParamSpec *pspec,
                             GSimpleAsyncResult *simple)
{
    AsyncContext *async_context;
    WebKitLoadStatus load_status;
    GCancellable *cancellable;
    GError *error = NULL;

    /* Note: we disregard WEBKIT_LOAD_FAILED and print what we can. */
    load_status = webkit_web_view_get_load_status (web_view);
    if (load_status != WEBKIT_LOAD_FINISHED)
        return;

    /* Signal handlers are holding the only GSimpleAsyncResult
     * references.  This is to avoid finalizing it prematurely. */
    g_object_ref (simple);

    async_context = g_simple_async_result_get_op_res_gpointer (simple);
    cancellable = async_context->cancellable;

    /* WebKit reloads the page once more right before starting to print,
     * so disconnect this handler after the first time to avoid starting
     * another print operation. */
    g_signal_handler_disconnect (
        async_context->web_view,
        async_context->load_status_handler_id);
    async_context->load_status_handler_id = 0;

    /* Check if we've been cancelled. */
    if (g_cancellable_set_error_if_cancelled (cancellable, &error)) {
        g_simple_async_result_take_error (simple, error);
        g_simple_async_result_complete_in_idle (simple);

        /* Give WebKit some time to perform layouting and rendering before
         * we start printing.  500ms should be enough in most cases. */
    } else {
        GSource *timeout_source;

        timeout_source = g_timeout_source_new (500);
        g_source_set_callback (
            timeout_source,
            mail_printer_print_timeout_cb,
            g_object_ref (simple),
            (GDestroyNotify) g_object_unref);
        g_source_attach (
            timeout_source, async_context->main_context);
        g_source_unref (timeout_source);
    }

    g_object_unref (simple);
}
static void
load_status_cb(WebKitWebView* webView,
               GParamSpec* spec,
               gpointer data)
{
    WebKitLoadStatus status = webkit_web_view_get_load_status(webView);
    TestInfo* info = (TestInfo*)data;

    if (status == WEBKIT_LOAD_FINISHED) {
        WebKitHitTestResult* result;
        guint context;
        GdkEvent* event = gdk_event_new(GDK_BUTTON_PRESS);
        WebKitDOMNode* node;
        gint x, y;

        /* Close enough to 0,0 */
        event->button.x = 5;
        event->button.y = 5;

        result = webkit_web_view_get_hit_test_result(webView, (GdkEventButton*) event);
        gdk_event_free(event);
        g_assert(result);

        g_object_get(result, "context", &context, NULL);
        g_assert(context & info->flag);

        g_object_get(result, "inner-node", &node, NULL);
        g_assert(node);
        g_assert(WEBKIT_DOM_IS_NODE(node));

        g_object_get(result, "x", &x, "y", &y, NULL);
        g_assert_cmpint(x, ==, 5);
        g_assert_cmpint(y, ==, 5);

        /* We can only test these node types at the moment. In the
         * input case there seems to be an extra layer with a DIV on
         * top of the input, which gets assigned to the inner-node.
         * tag */
        if (info->flag == WEBKIT_HIT_TEST_RESULT_CONTEXT_DOCUMENT)
            g_assert(WEBKIT_DOM_IS_HTML_HTML_ELEMENT(node));
        else if (info->flag == WEBKIT_HIT_TEST_RESULT_CONTEXT_IMAGE)
            g_assert(WEBKIT_DOM_IS_HTML_IMAGE_ELEMENT(node));
        else if (info->flag == WEBKIT_HIT_TEST_RESULT_CONTEXT_LINK) {
            /* The hit test will give us the inner text node, we want
             * the A tag */
            WebKitDOMNode* parent = webkit_dom_node_get_parent_node(node);
            g_assert(WEBKIT_DOM_IS_HTML_ANCHOR_ELEMENT(parent));
        }

        g_object_unref(result);
        g_main_loop_quit(loop);
    }
Beispiel #27
0
void
session_load_status_callback(WebKitWebView *wv, GParamSpec *p, SessionTab *tab) 
{
    WebKitLoadStatus status = webkit_web_view_get_load_status(wv);
    switch (status) {
        case WEBKIT_LOAD_FINISHED:  VIEW(tab->gl)->status->lockprotect = tab->lock;
                                    dwb_tab_label_set_text(tab->gl, NULL);
        case WEBKIT_LOAD_FAILED:    g_signal_handlers_disconnect_by_func(wv, (GFunc)session_load_status_callback, tab);
                                    g_free(tab);
                                    break;
        default: return;
    }
}
static void notify_load_status_lifetime_cb(WebKitWebView* view, GParamSpec* pspec, GMainLoop* loop)
{
    WebKitLoadStatus status = webkit_web_view_get_load_status (view);
    WebKitWebFrame* frame = webkit_web_view_get_main_frame(view);
    WebKitWebDataSource* dataSource = webkit_web_frame_get_data_source(frame);

    if (status == WEBKIT_LOAD_COMMITTED) {
        g_assert(webkit_web_data_source_is_loading(dataSource));
        return;
    } else if (status != WEBKIT_LOAD_FINISHED)
        return;

    g_main_loop_quit(loop);
}
Beispiel #29
0
void
loadstatuschange(WebKitWebView *view, GParamSpec *pspec, Client *c) {
	switch(webkit_web_view_get_load_status (c->view)) {
	case WEBKIT_LOAD_COMMITTED:
		setatom(c, AtomUri, geturi(c));
		break;
	case WEBKIT_LOAD_FINISHED:
		c->progress = 0;
		update(c);
		break;
	default:
		break;
	}
}
static void
load_status_notify_cb (EphyWebView *view,
		       GParamSpec *pspec,
		       EphySession *session)
{
	WebKitLoadStatus status = webkit_web_view_get_load_status (WEBKIT_WEB_VIEW (view));

	/* We won't know the URL we are loading in PROVISIONAL because
	   of bug #593149, but save session anyway */
	if (status == WEBKIT_LOAD_PROVISIONAL ||
	    status == WEBKIT_LOAD_COMMITTED || 
	    status == WEBKIT_LOAD_FINISHED)
		ephy_session_save (session, SESSION_STATE);
}