From cc0e23b5409879c3173cf0c61c84af6608c3b8e3 Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Wed, 7 Apr 2010 10:33:46 +0000 Subject: Don't dump box trees on crash, and fix view source for new cache. svn path=/trunk/netsurf/; revision=10262 --- riscos/gui.c | 30 +++++++++++++++++------------- riscos/gui.h | 2 +- 2 files changed, 18 insertions(+), 14 deletions(-) (limited to 'riscos') diff --git a/riscos/gui.c b/riscos/gui.c index 24723a87c..72b41e838 100644 --- a/riscos/gui.c +++ b/riscos/gui.c @@ -53,6 +53,7 @@ #include "rufl.h" #include "utils/config.h" #include "content/content.h" +#include "content/hlcache.h" #include "content/urldb.h" #include "desktop/gui.h" #include "desktop/netsurf.h" @@ -806,7 +807,6 @@ void gui_quit(void) void ro_gui_signal(int sig) { - struct content *c; void (*prev_handler)(int); static const os_error error = { 1, "NetSurf has detected a serious " "error and must exit. Please submit a bug report, " @@ -862,11 +862,6 @@ void ro_gui_signal(int sig) xhourglass_on(); xhourglass_colours(0x0000ffff, 0x000000ff, &old_sand, &old_glass); - for (c = content_list; c; c = c->next) - if (c->type == CONTENT_HTML && c->data.html.layout) { - LOG(("Dumping: '%s'", c->url)); - box_dump(stderr, c->data.html.layout, 0); - } options_dump(); /*rufl_dump_state();*/ @@ -2199,7 +2194,7 @@ void ro_gui_open_help_page(const char *page) * Send the source of a content to a text editor. */ -void ro_gui_view_source(struct content *content) +void ro_gui_view_source(hlcache_handle *c) { os_error *error; char full_name[256]; @@ -2208,13 +2203,23 @@ void ro_gui_view_source(struct content *content) int objtype; bool done = false; - if (!content || !content->source_data) { + const char *source_data; + unsigned long source_size; + + if (!c) { + warn_user("MiscError", "No document source"); + return; + } + + source_data = content_get_source_data(c, &source_size); + + if (!source_data) { warn_user("MiscError", "No document source"); return; } /* try to load local files directly. */ - temp_name = url_to_path(content->url); + temp_name = url_to_path(content_get_url(c)); if (temp_name) { error = xosfile_read_no_path(temp_name, &objtype, 0, 0, 0, 0); if ((!error) && (objtype == osfile_IS_FILE)) { @@ -2247,10 +2252,9 @@ void ro_gui_view_source(struct content *content) } message.file_name[211] = '\0'; error = xosfile_save_stamped(message.file_name, - ro_content_filetype(content), - (byte *) content->source_data, - (byte *) content->source_data + - content->source_size); + ro_content_filetype(c), + (byte *) source_data, + (byte *) source_data + source_size); if (error) { LOG(("xosfile_save_stamped failed: 0x%x: %s", error->errnum, error->errmess)); diff --git a/riscos/gui.h b/riscos/gui.h index aef4b53e7..657f62e4e 100644 --- a/riscos/gui.h +++ b/riscos/gui.h @@ -121,7 +121,7 @@ extern struct gui_window *ro_gui_current_redraw_gui; void ro_gui_open_window_request(wimp_open *open); void ro_gui_open_help_page(const char *page); void ro_gui_screen_size(int *width, int *height); -void ro_gui_view_source(struct content *content); +void ro_gui_view_source(struct hlcache_handle *c); void ro_gui_dump_content(struct content *content); void ro_gui_drag_box_start(wimp_pointer *pointer); bool ro_gui_prequit(void); -- cgit v1.2.3