Exemple #1
0
END_TEST


/**
 * url reference (copy) and unreference(free)
 */
START_TEST(nsurl_ref_test)
{
	nserror err;
	nsurl *res1;
	nsurl *res2;

	err = nsurl_create(base_str, &res1);

	/* result must be valid */
	ck_assert(err == NSERROR_OK);

	res2 = nsurl_ref(res1);

	ck_assert_str_eq(nsurl_access(res1), nsurl_access(res2));

	nsurl_unref(res2);

	nsurl_unref(res1);
}
Exemple #2
0
/** callback to free a resource fetch */
static void fetch_resource_free(void *ctx)
{
	struct fetch_resource_context *c = ctx;
	if (c->redirect_url != NULL)
		nsurl_unref(c->redirect_url);
	if (c->url != NULL)
		nsurl_unref(c->url);
	RING_REMOVE(ring, c);
	free(ctx);
}
Exemple #3
0
static nserror
html_stylesheet_from_domnode(html_content *c,
			     dom_node *node,
			     hlcache_handle **sheet)
{
	hlcache_child_context child;
	dom_string *style;
	nsurl *url;
	dom_exception exc;
	nserror error;
	uint32_t key;
	char urlbuf[64];

	child.charset = c->encoding;
	child.quirks = c->base.quirks;

	exc = dom_node_get_text_content(node, &style);
	if ((exc != DOM_NO_ERR) || (style == NULL)) {
		LOG("No text content");
		return NSERROR_OK;
	}

	error = html_css_fetcher_add_item(style, c->base_url, &key);
	if (error != NSERROR_OK) {
		dom_string_unref(style);
		return error;
	}

	dom_string_unref(style);

	snprintf(urlbuf, sizeof(urlbuf), "x-ns-css:%u", key);

	error = nsurl_create(urlbuf, &url);
	if (error != NSERROR_OK) {
		return error;
	}

	error = hlcache_handle_retrieve(url, 0,
			content_get_url(&c->base), NULL,
			html_convert_css_callback, c, &child, CONTENT_CSS,
			sheet);
	if (error != NSERROR_OK) {
		nsurl_unref(url);
		return error;
	}

	nsurl_unref(url);

	c->base.active++;
	LOG("%d fetches active", c->base.active);

	return NSERROR_OK;
}
Exemple #4
0
void ro_uri_message_received(wimp_message *msg)
{
	uri_full_message_process *uri_message = (uri_full_message_process *)msg;
	uri_h uri_handle;
	char* uri_requested;
	int uri_length;
	nsurl *url;
	nserror error;

	uri_handle = uri_message->handle;

	if (nsurl_create(uri_message->uri, &url) != NSERROR_OK) {
		return;
	}

	if (!fetch_can_fetch(url)) {
		nsurl_unref(url);
		return;
	}

	nsurl_unref(url);

	uri_message->your_ref = uri_message->my_ref;
	uri_message->action = message_URI_PROCESS_ACK;

	xwimp_send_message(wimp_USER_MESSAGE, (wimp_message*)uri_message,
		uri_message->sender);

	xuri_request_uri(0, 0, 0, uri_handle, &uri_length);
	uri_requested = calloc((unsigned int)uri_length, sizeof(char));
	if (uri_requested == NULL)
		return;

	xuri_request_uri(0, uri_requested, uri_length, uri_handle, NULL);

	error = nsurl_create(uri_requested, &url);
	free(uri_requested);
	if (error == NSERROR_OK) {
		error = browser_window_create(BROWSER_WINDOW_VERIFIABLE |
					      BROWSER_WINDOW_HISTORY,
					      url,
					      NULL,
					      NULL,
					      NULL);
		nsurl_unref(url);
	}
	if (error != NSERROR_OK) {
		warn_user(messages_get_errorcode(error), 0);
	}
}
Exemple #5
0
/* exported interface documented in content/fetch.h */
void fetch_free(struct fetch *f)
{
#ifdef DEBUG_FETCH_VERBOSE
	LOG(("Freeing fetch %p, fetcher %p", f, f->fetcher_handle));
#endif
	f->ops->free_fetch(f->fetcher_handle);
	fetch_unref_fetcher(f->ops);
	nsurl_unref(f->url);
	if (f->referer != NULL)
		nsurl_unref(f->referer);
	if (f->host != NULL)
		lwc_string_unref(f->host);
	free(f);
}
Exemple #6
0
/** callback to initialise the resource fetcher. */
static bool fetch_resource_initialise(lwc_string *scheme)
{
	struct fetch_resource_map_entry *e;
	uint32_t i;

	fetch_resource_path_count = 0;

	for (i = 0; i < NOF_ELEMENTS(fetch_resource_paths); i++) {
		e = &fetch_resource_map[fetch_resource_path_count];

		if (lwc_intern_string(fetch_resource_paths[i],
				strlen(fetch_resource_paths[i]),
				&e->path) != lwc_error_ok) {
			while (i > 0) {
				i--;
				lwc_string_unref(fetch_resource_map[i].path);
				nsurl_unref(fetch_resource_map[i].url);
			}
		}

		e->url = gui_get_resource_url(fetch_resource_paths[i]);
		LOG(("URL is %s " ,lwc_string_data(e->path)));
		if (e->url == NULL) {
			lwc_string_unref(e->path);
		} else {
			fetch_resource_path_count++;
		}
	}

	return true;
}
Exemple #7
0
/**
 * Handle closing of login dialog
 */
void ro_gui_401login_close(wimp_w w)
{
	os_error *error;
	struct session_401 *session;

	session = (struct session_401 *)ro_gui_wimp_event_get_user_data(w);

	assert(session);

	/* If ok didn't happen, send failure response */
	if (session->cb != NULL)
		session->cb(false, session->cbpw);

	nsurl_unref(session->url);
	lwc_string_unref(session->host);
	free(session->realm);
	free(session);

	error = xwimp_delete_window(w);
	if (error) {
		LOG(("xwimp_delete_window: 0x%x:%s",
			error->errnum, error->errmess));
		warn_user("WimpError", error->errmess);
	}
	ro_gui_wimp_event_finalise(w);
}
Exemple #8
0
static void __CDECL menu_about(short item, short title, void *data)
{
	nsurl *url;
	nserror error;
	char buf[PATH_MAX];

	LOG(("%s", __FUNCTION__));
	strcpy((char*)&buf, "file://");
	strncat((char*)&buf, (char*)"./doc/README.TXT",
			PATH_MAX - (strlen("file://")+1) );

	error = nsurl_create(buf, &url);
	if (error == NSERROR_OK) {
		error = browser_window_create(BROWSER_WINDOW_VERIFIABLE |
					      BROWSER_WINDOW_HISTORY,
					      url,
					      NULL,
					      NULL,
					      NULL);
		nsurl_unref(url);
	}
	if (error != NSERROR_OK) {
		warn_user(messages_get_errorcode(error), 0);
	} 
}
Exemple #9
0
gboolean nsgtk_websearch_activate(GtkWidget *widget, gpointer data)
{
	struct nsgtk_scaffolding *g = data;
	nserror ret;
	nsurl *url;

	ret = search_web_omni(
		gtk_entry_get_text(GTK_ENTRY(nsgtk_scaffolding_websearch(g))),
		SEARCH_WEB_OMNI_SEARCHONLY,
		&url);
	if (ret == NSERROR_OK) {
		temp_open_background = 0;
		ret = browser_window_create(
			BW_CREATE_HISTORY | BW_CREATE_TAB,
			url,
			NULL,
			nsgtk_get_browser_window(nsgtk_scaffolding_top_level(g)),
			NULL);
		temp_open_background = -1;
		nsurl_unref(url);
	}
	if (ret != NSERROR_OK) {
		nsgtk_warning(messages_get_errorcode(ret), 0);
	}

	return TRUE;
}
Exemple #10
0
struct content_rfc5988_link *
content__free_rfc5988_link(struct content_rfc5988_link *link) 
{
	struct content_rfc5988_link *next;

	next = link->next;

	lwc_string_unref(link->rel);
	nsurl_unref(link->href);
	if (link->hreflang != NULL) {
		lwc_string_unref(link->hreflang);
	}
	if (link->type != NULL) {
		lwc_string_unref(link->type);
	}
	if (link->media != NULL) {
		lwc_string_unref(link->media);
	}
	if (link->sizes != NULL) {
		lwc_string_unref(link->sizes);
	}
	free(link);

	return next;
}
Exemple #11
0
static void __CDECL menu_new_win(short item, short title, void *data)
{
	nsurl *url;
	nserror error;
	const char *addr;

	LOG(("%s", __FUNCTION__));
		
	if (nsoption_charp(homepage_url) != NULL) {
		addr = nsoption_charp(homepage_url);
	} else {
		addr = NETSURF_HOMEPAGE;
	}

	/* create an initial browser window */
	error = nsurl_create(addr, &url);
	if (error == NSERROR_OK) {
		error = browser_window_create(BROWSER_WINDOW_VERIFIABLE |
					      BROWSER_WINDOW_HISTORY,
					      url,
					      NULL,
					      NULL,
					      NULL);
		nsurl_unref(url);

	}
	if (error != NSERROR_OK) {
		warn_user(messages_get_errorcode(error), 0);
	}
}
Exemple #12
0
/**
 * Free list of imagemap entries
 *
 * \param list Pointer to head of list
 */
void imagemap_freelist(struct mapentry *list)
{
	struct mapentry *entry, *prev;

	assert(list != NULL);

	entry = list;

	while (entry != NULL) {
		prev = entry;

		nsurl_unref(entry->url);

		if (entry->target)
			free(entry->target);

		if (entry->type == IMAGEMAP_POLY) {
			free(entry->bounds.poly.xcoords);
			free(entry->bounds.poly.ycoords);
		}

		entry = entry->next;
		free(prev);
	}
}
Exemple #13
0
static void __CDECL menu_open_file(short item, short title, void *data)
{

	LOG(("%s", __FUNCTION__));

	const char * filename = file_select(messages_get("OpenFile"), "");
	if( filename != NULL ){
		char * urltxt = local_file_to_url( filename );
		if( urltxt ){
			nsurl *url;
			nserror error;

			error = nsurl_create(urltxt, &url);
			if (error == NSERROR_OK) {
				error = browser_window_create(BROWSER_WINDOW_VERIFIABLE |
							      BROWSER_WINDOW_HISTORY,
							      url,
							      NULL,
							      NULL,
							      NULL);
				nsurl_unref(url);
				
			}
			if (error != NSERROR_OK) {
				warn_user(messages_get_errorcode(error), 0);
			}
			free( urltxt );
		}
	}
}
Exemple #14
0
/**
 * Free a fetch structure and associated resources.
 */
static void fetch_curl_free(void *vf)
{
	struct curl_fetch_info *f = (struct curl_fetch_info *)vf;
	int i;

	if (f->curl_handle) {
		curl_easy_cleanup(f->curl_handle);
	}
	nsurl_unref(f->url);
	lwc_string_unref(f->host);
	free(f->location);
	free(f->cookie_string);
	free(f->realm);
	if (f->headers) {
		curl_slist_free_all(f->headers);
	}
	free(f->post_urlenc);
	if (f->post_multipart) {
		curl_formfree(f->post_multipart);
	}

	for (i = 0; i < MAX_CERTS && f->cert_data[i].cert; i++) {
		f->cert_data[i].cert->references--;
		if (f->cert_data[i].cert->references == 0) {
			X509_free(f->cert_data[i].cert);
		}
	}

	free(f);
}
Exemple #15
0
/** callback to free a about fetch */
static void fetch_about_free(void *ctx)
{
	struct fetch_about_context *c = ctx;
	nsurl_unref(c->url);
	RING_REMOVE(ring, c);
	free(ctx);
}
Exemple #16
0
/**
 * event handler for when a completion suggestion is selected.
 */
static gboolean
nsgtk_completion_match_select(GtkEntryCompletion *widget,
			      GtkTreeModel *model,
			      GtkTreeIter *iter,
			      gpointer user_data)
{
	GValue value = {0, };
	struct nsgtk_scaffolding *g = user_data;
	struct browser_window *bw = nsgtk_get_browser_window(nsgtk_scaffolding_top_level(g));
	nserror ret;
	nsurl *url;

	gtk_tree_model_get_value(model, iter, 0, &value);

	ret = search_web_omni(g_value_get_string(&value),
			      SEARCH_WEB_OMNI_NONE,
			      &url);

	g_value_unset(&value);

	if (ret == NSERROR_OK) {
		ret = browser_window_navigate(bw,
					      url, NULL, BW_NAVIGATE_HISTORY,
					      NULL, NULL, NULL);
		nsurl_unref(url);
	}
	if (ret != NSERROR_OK) {
		nsgtk_warning(messages_get_errorcode(ret), 0);
	}

	return TRUE;
}
Exemple #17
0
/**
 * Callback to determine if a node is a linking element whose target has been
 * visited.
 *
 * \param pw     HTML document
 * \param node   DOM node
 * \param match  Pointer to location to receive result
 * \return CSS_OK.
 *
 * \post \a match will contain true if the node matches and false otherwise.
 */
css_error node_is_visited(void *pw, void *node, bool *match)
{
	nscss_select_ctx *ctx = pw;
	nsurl *url;
	nserror error;
	const struct url_data *data;

	dom_exception exc;
	dom_node *n = node;
	dom_string *s = NULL;

	*match = false;

	exc = dom_node_get_node_name(n, &s);
	if ((exc != DOM_NO_ERR) || (s == NULL)) {
		return CSS_NOMEM;
	}

	if (!dom_string_caseless_lwc_isequal(s, corestring_lwc_a)) {
		/* Can't be visited; not ancher element */
		dom_string_unref(s);
		return CSS_OK;
	}

	/* Finished with node name string */
	dom_string_unref(s);
	s = NULL;

	exc = dom_element_get_attribute(n, corestring_dom_href, &s);
	if ((exc != DOM_NO_ERR) || (s == NULL)) {
		/* Can't be visited; not got a URL */
		return CSS_OK;
	}

	/* Make href absolute */
	/* TODO: this duplicates what we do for box->href
	 *       should we put the absolute URL on the dom node? */
	error = nsurl_join(ctx->base_url, dom_string_data(s), &url);

	/* Finished with href string */
	dom_string_unref(s);

	if (error != NSERROR_OK) {
		/* Couldn't make nsurl object */
		return CSS_NOMEM;
	}

	data = urldb_get_url_data(url);

	/* Visited if in the db and has
	 * non-zero visit count */
	if (data != NULL && data->visits > 0)
		*match = true;

	nsurl_unref(url);

	return CSS_OK;
}
static bool save_complete_rewrite_url_value(save_complete_ctx *ctx,
		const char *value, size_t value_len)
{
	nsurl *url;
	hlcache_handle *content;
	char *escaped;
	nserror error;
	utf8_convert_ret ret;

	error = nsurl_join(ctx->base, value, &url);
	if (error == NSERROR_NOMEM)
		return false;

	if (url != NULL) {
		content = save_complete_ctx_find_content(ctx, url);
		if (content != NULL) {
			/* found a match */
			nsurl_unref(url);

			fprintf(ctx->fp, "\"%p\"", content);
		} else {
			/* no match found */
			ret = utf8_to_html(nsurl_access(url), "UTF-8",
					nsurl_length(url), &escaped);
			nsurl_unref(url);

			if (ret != UTF8_CONVERT_OK)
				return false;

			fprintf(ctx->fp, "\"%s\"", escaped);

			free(escaped);
		}
	} else {
		ret = utf8_to_html(value, "UTF-8", value_len, &escaped);
		if (ret != UTF8_CONVERT_OK)
			return false;

		fprintf(ctx->fp, "\"%s\"", escaped);

		free(escaped);
	}

	return true;
}
Exemple #19
0
/** callback to finalise the resource fetcher. */
static void fetch_resource_finalise(lwc_string *scheme)
{
	uint32_t i;

	for (i = 0; i < fetch_resource_path_count; i++) {
		lwc_string_unref(fetch_resource_map[i].path);
		nsurl_unref(fetch_resource_map[i].url);
	}
}
Exemple #20
0
/** callback to free a resource fetch */
static void fetch_javascript_free(void *ctx)
{
	struct fetch_javascript_context *c = ctx;
	if (c->url != NULL) {
		nsurl_unref(c->url);
	}
	RING_REMOVE(ring, c);
	free(ctx);
}
Exemple #21
0
END_TEST

/**
 * check unref asserts on NULL parameter
 */
START_TEST(nsurl_api_assert_unref_test)
{
	nsurl_unref(NULL);
}
Exemple #22
0
END_TEST

/**
 * refragment url
 */
START_TEST(nsurl_refragment_test)
{
	nserror err;
	nsurl *url;
	nsurl *res_url;
	const struct test_pairs *tst = &fragment_tests[_i];
	lwc_string *frag;

	/* not testing create, this should always succeed */
	err = nsurl_create(tst->test, &url);
	ck_assert(err == NSERROR_OK);

	/* grab the fragment - not testing should succeed */
	frag = nsurl_get_component(url, NSURL_FRAGMENT);
	ck_assert(frag != NULL);
	nsurl_unref(url);

	/* not testing create, this should always succeed */
	err = nsurl_create(tst->res, &url);
	ck_assert(err == NSERROR_OK);

	err = nsurl_refragment(url, frag, &res_url);
	if (tst->res == NULL) {
		/* result must be invalid (bad input) */
		ck_assert(err != NSERROR_OK);
	} else {
		/* result must be valid */
		ck_assert(err == NSERROR_OK);

		ck_assert_str_eq(nsurl_access(res_url), tst->test);

		nsurl_unref(res_url);
	}

	lwc_string_unref(frag);

	nsurl_unref(url);
}
Exemple #23
0
static void gui_download_window_done(struct gui_download_window *dw)
{
	struct dlnode *dln,*dln2 = NULL;
	struct browser_window *bw;
	bool queuedl = false;

	if(!dw) return;
	bw = dw->bw;

	if((nsoption_bool(download_notify)) && (dw->result == AMINS_DLOAD_OK))
	{
		Notify(ami_gui_get_app_id(), APPNOTIFY_Title, messages_get("amiDownloadComplete"),
				APPNOTIFY_PubScreenName, "FRONT",
				APPNOTIFY_BackMsg, dw->fname,
				APPNOTIFY_CloseOnDC, TRUE,
				APPNOTIFY_Text, dw->fname,
				TAG_DONE);
	}

	download_context_destroy(dw->ctx);

	if((dln = dw->dln))
	{
		dln2 = (struct dlnode *)GetSucc((struct Node *)dln);
		if((dln!=dln2) && (dln2)) queuedl = true;

		free(dln->filename);
		Remove((struct Node *)dln);
		FreeVec(dln);
	}

	FClose(dw->fh);
	SetComment(dw->fname, dw->url);

	downloads_in_progress--;

	DisposeObject(dw->objects[OID_MAIN]);
	DelObject(dw->node);
	if(queuedl) {
		nsurl *url;
		if (nsurl_create(dln2->node.ln_Name, &url) != NSERROR_OK) {
			amiga_warn_user("NoMemory", 0);
		} else {
			browser_window_navigate(bw,
				url,
				NULL,
				BW_NAVIGATE_DOWNLOAD,
				NULL,
				NULL,
				NULL);
			nsurl_unref(url);
		}
	}
	ami_try_quit(); /* In case the only window open was this download */
}
/* Documented in local_history.h */
void browser_window_history_go(struct browser_window *bw,
		struct history_entry *entry, bool new_window)
{
	struct history *history;
	nsurl *url;
	struct history_entry *current;
	nserror error;

	assert(bw != NULL);
	history = bw->history;

	if (entry->page.frag_id) {
		error = nsurl_refragment(entry->page.url,
				entry->page.frag_id, &url);

		if (error != NSERROR_OK) {
			warn_user("NoMemory", 0);
			return;
		}
	} else {
		url = nsurl_ref(entry->page.url);
	}

	if (new_window) {
		current = history->current;
		history->current = entry;

		error = browser_window_create(BW_CREATE_CLONE,
				url, NULL, bw, NULL);
		history->current = current;
		if (error != NSERROR_OK) {
			nsurl_unref(url);
			return;
		}
	} else {
		history->current = entry;
		browser_window_navigate(bw, url, NULL,
				BW_NAVIGATE_NONE, NULL, NULL, NULL);
	}

	nsurl_unref(url);
}
Exemple #25
0
bool ro_gui_iconbar_menu_select(wimp_w w, wimp_i i, wimp_menu *menu,
		wimp_selection *selection, menu_action action)
{
	nsurl *url;
	nserror error;

	if (w != wimp_ICON_BAR || i != wimp_ICON_WINDOW)
		return false;

	switch (action) {
	case HELP_OPEN_CONTENTS:
		error = nsurl_create("http://www.netsurf-browser.org/documentation/", &url);
		if (error == NSERROR_OK) {
			error = browser_window_create(BW_CREATE_HISTORY,
					url,
					NULL,
					NULL,
					NULL);
			nsurl_unref(url);
		}
		if (error != NSERROR_OK) {
			warn_user(messages_get_errorcode(error), 0);
		}
		return true;
	
	case BROWSER_NAVIGATE_URL:
		ro_gui_dialog_prepare_open_url();
		ro_gui_dialog_open_persistent(NULL, dialog_openurl, true);
		return true;
	case HOTLIST_SHOW:
		ro_gui_hotlist_open();
		return true;
	case HISTORY_SHOW_GLOBAL:
		ro_gui_global_history_open();
		return true;
	case COOKIES_SHOW:
		ro_gui_cookies_open();
		return true;
	case CHOICES_SHOW:
		ro_gui_configure_show();
		return true;
	case APPLICATION_QUIT:
		if (ro_gui_prequit()) {
			LOG(("QUIT in response to user request"));
			netsurf_quit = true;
		}
		return true;
	default:
		return false;
	}

	return false;
}
Exemple #26
0
static void browser_window_history__free_entry(struct history_entry *entry)
{
	if (!entry)
		return;
	browser_window_history__free_entry(entry->forward);
	browser_window_history__free_entry(entry->next);
	nsurl_unref(entry->page.url);
	if (entry->page.frag_id)
		lwc_string_unref(entry->page.frag_id);
	free(entry->page.title);
	free(entry);
}
Exemple #27
0
void html_css_fini(void)
{
	if (html_user_stylesheet_url != NULL) {
		nsurl_unref(html_user_stylesheet_url);
		html_user_stylesheet_url = NULL;
	}

	if (html_quirks_stylesheet_url != NULL) {
		nsurl_unref(html_quirks_stylesheet_url);
		html_quirks_stylesheet_url = NULL;
	}

	if (html_adblock_stylesheet_url != NULL) {
		nsurl_unref(html_adblock_stylesheet_url);
		html_adblock_stylesheet_url = NULL;
	}

	if (html_default_stylesheet_url != NULL) {
		nsurl_unref(html_default_stylesheet_url);
		html_default_stylesheet_url = NULL;
	}
}
Exemple #28
0
/**
 * URL resolution callback for libcss
 *
 * \param pw    Resolution context
 * \param base  Base URI
 * \param rel   Relative URL
 * \param abs   Pointer to location to receive resolved URL
 * \return CSS_OK       on success,
 *         CSS_NOMEM    on memory exhaustion,
 *         CSS_INVALID  if resolution failed.
 */
css_error nscss_resolve_url(void *pw, const char *base, 
		lwc_string *rel, lwc_string **abs)
{
	lwc_error lerror;
	nserror error;
	nsurl *nsbase;
	nsurl *nsabs;

	/* Create nsurl from base */
	/* TODO: avoid this */
	error = nsurl_create(base, &nsbase);
	if (error != NSERROR_OK) {
		return error == NSERROR_NOMEM ? CSS_NOMEM : CSS_INVALID;
	}

	/* Resolve URI */
	error = nsurl_join(nsbase, lwc_string_data(rel), &nsabs);
	if (error != NSERROR_OK) {
		nsurl_unref(nsbase);
		return error == NSERROR_NOMEM ? CSS_NOMEM : CSS_INVALID;
	}

	nsurl_unref(nsbase);

	/* Intern it */
	lerror = lwc_intern_string(nsurl_access(nsabs),
			nsurl_length(nsabs), abs);
	if (lerror != lwc_error_ok) {
		*abs = NULL;
		nsurl_unref(nsabs);
		return lerror == lwc_error_oom ? CSS_NOMEM : CSS_INVALID;
	}

	nsurl_unref(nsabs);

	return CSS_OK;
}
Exemple #29
0
static void ami_menu_item_project_newwin(struct Hook *hook, APTR window, struct IntuiMessage *msg)
{
	nsurl *url;
	nserror error;

	error = nsurl_create(nsoption_charp(homepage_url), &url);
	if (error == NSERROR_OK) {
		error = browser_window_create(BW_CREATE_HISTORY,
					      url,
					      NULL,
					      NULL,
					      NULL);
		nsurl_unref(url);
	}
	if (error != NSERROR_OK) {
		warn_user(messages_get_errorcode(error), 0);
	}
}
Exemple #30
0
static int
fb_url_enter(void *pw, char *text)
{
	struct browser_window *bw = pw;
	nsurl *url;
	nserror error;

	error = nsurl_create(text, &url);
	if (error != NSERROR_OK) {
		warn_user(messages_get_errorcode(error), 0);
	} else {
		browser_window_navigate(bw, url, NULL, BW_NAVIGATE_HISTORY,
				NULL, NULL, NULL);
		nsurl_unref(url);
	}

	return 0;
}