summaryrefslogtreecommitdiff
path: root/css/css.c
diff options
context:
space:
mode:
Diffstat (limited to 'css/css.c')
-rw-r--r--css/css.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/css/css.c b/css/css.c
index 79eda90b8..9d0014ec6 100644
--- a/css/css.c
+++ b/css/css.c
@@ -587,13 +587,22 @@ css_error nscss_handle_import(void *pw, css_stylesheet *parent,
/* Create content */
c->imports[c->import_count].media = media;
- nerror = hlcache_handle_retrieve(lwc_string_data(url),
- 0, referer, NULL, nscss_import, ctx,
- &child, accept,
- &c->imports[c->import_count].c);
- if (nerror != NSERROR_OK) {
+
+ /* Avoid importing ourself */
+ if (strcmp(lwc_string_data(url), referer) == 0) {
+ c->imports[c->import_count].c = NULL;
+ /* No longer require context as we're not fetching anything */
free(ctx);
- return CSS_NOMEM;
+ ctx = NULL;
+ } else {
+ nerror = hlcache_handle_retrieve(lwc_string_data(url),
+ 0, referer, NULL, nscss_import, ctx,
+ &child, accept,
+ &c->imports[c->import_count].c);
+ if (nerror != NSERROR_OK) {
+ free(ctx);
+ return CSS_NOMEM;
+ }
}
#ifdef NSCSS_IMPORT_TRACE