diff --git a/desktop/browser_window.c b/desktop/browser_window.c index 226741be5..57da7d56e 100644 --- a/desktop/browser_window.c +++ b/desktop/browser_window.c @@ -1338,6 +1338,24 @@ browser_window__handle_fetcherror(struct browser_window *bw, memset(¶ms, 0, sizeof(params)); + /* If it is the error page itself that failed, navigating to the error + * page again lands straight back here. Nothing bounds that: the pair + * recurses, allocating a content per turn, until the heap is gone and + * the real failure is buried under hundreds of retries. Report the + * reason and stop instead. */ + if (nsurl_compare(url, corestring_nsurl_about_query_fetcherror, + NSURL_COMPLETE)) { + NSLOG(netsurf, WARNING, + "error page itself failed: %s -- not retrying", reason); + fprintf(stderr, + "netsurf: error page failed (%s); giving up\n", reason); + browser_window_set_status(bw, reason); + return browser_window_stop_throbber(bw); + } + + fprintf(stderr, "netsurf: fetch of '%s' failed: %s\n", + nsurl_access(url), reason); + params.url = nsurl_ref(corestring_nsurl_about_query_fetcherror); params.referrer = nsurl_ref(url); params.flags = BW_NAVIGATE_HISTORY | BW_NAVIGATE_NO_TERMINAL_HISTORY_UPDATE | BW_NAVIGATE_INTERNAL;