make the pseudo css fetcher report initialisation errors

This commit is contained in:
Vincent Sanders 2014-10-25 21:34:09 +01:00
parent 49873c8bf3
commit df89f689f7
3 changed files with 18 additions and 9 deletions

View File

@ -632,7 +632,9 @@ nserror html_css_init(void)
{
nserror error;
html_css_fetcher_register();
error = html_css_fetcher_register();
if (error != NSERROR_OK)
return error;
error = nsurl_create("resource:default.css",
&html_default_stylesheet_url);

View File

@ -274,7 +274,8 @@ static void html_css_fetcher_poll(lwc_string *scheme)
} while ( (c = next) != ring && ring != NULL);
}
void html_css_fetcher_register(void)
/* exported interface documented in html_internal.h */
nserror html_css_fetcher_register(void)
{
lwc_string *scheme;
const struct fetcher_operation_table html_css_fetcher_ops = {
@ -289,16 +290,17 @@ void html_css_fetcher_register(void)
};
if (lwc_intern_string("x-ns-css", SLEN("x-ns-css"),
&scheme) != lwc_error_ok) {
die("Failed to initialise the fetch module "
"(couldn't intern \"x-ns-css\").");
&scheme) != lwc_error_ok) {
LOG(("could not intern \"x-ns-css\"."));
return NSERROR_INIT_FAILED;
}
fetcher_add(scheme, &html_css_fetcher_ops);
return fetcher_add(scheme, &html_css_fetcher_ops);
}
nserror html_css_fetcher_add_item(dom_string *data, nsurl *base_url,
uint32_t *key)
/* exported interface documented in html_internal.h */
nserror
html_css_fetcher_add_item(dom_string *data, nsurl *base_url, uint32_t *key)
{
html_css_fetcher_item *item = malloc(sizeof(*item));

View File

@ -293,7 +293,12 @@ nserror html_css_new_selection_context(html_content *c,
css_select_ctx **ret_select_ctx);
/* in render/html_css_fetcher.c */
void html_css_fetcher_register(void);
/**
* Register the fetcher for the pseudo x-ns-css scheme.
*
* \return NSERROR_OK on successful registration or error code on failure.
*/
nserror html_css_fetcher_register(void);
nserror html_css_fetcher_add_item(dom_string *data, nsurl *base_url,
uint32_t *key);