From a17aa7d47fa3fd081ef838ccf7e4a16537b4a234 Mon Sep 17 00:00:00 2001 From: John Mark Bell Date: Thu, 3 Feb 2005 10:04:06 +0000 Subject: [project @ 2005-02-03 10:04:06 by jmb] Fix issue with plugins embedded in a page requesting fetch of the same page on load. Add option to block popups. svn path=/import/netsurf/; revision=1482 --- riscos/options.h | 9 ++++++--- riscos/plugin.c | 15 ++++++++++++--- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/riscos/options.h b/riscos/options.h index 0ba6941b4..566d40161 100644 --- a/riscos/options.h +++ b/riscos/options.h @@ -72,6 +72,7 @@ extern char *option_font_default_bold; extern char *option_font_default_bold_italic; extern bool option_font_ufont; extern int option_screen_cache; +extern bool option_block_popups; #define EXTRA_OPTION_DEFINE \ bool option_use_mouse_gestures = false;\ @@ -128,7 +129,8 @@ char *option_font_default_italic = 0; \ char *option_font_default_bold = 0; \ char *option_font_default_bold_italic = 0; \ bool option_font_ufont = false; \ -int option_screen_cache = 0; +int option_screen_cache = 0; \ +bool option_block_popups = 0; #define EXTRA_OPTION_TABLE \ { "use_mouse_gestures", OPTION_BOOL, &option_use_mouse_gestures },\ @@ -184,7 +186,8 @@ int option_screen_cache = 0; { "font_default_italic", OPTION_STRING, &option_font_default_italic }, \ { "font_default_bold", OPTION_STRING, &option_font_default_bold }, \ { "font_default_bold_italic", OPTION_STRING, &option_font_default_bold_italic }, \ -{ "font_ufont", OPTION_BOOL, &option_font_ufont}, \ -{ "screen_cache", OPTION_INTEGER, &option_screen_cache} +{ "font_ufont", OPTION_BOOL, &option_font_ufont }, \ +{ "screen_cache", OPTION_INTEGER, &option_screen_cache }, \ +{ "block_popups", OPTION_BOOL, &option_block_popups } #endif diff --git a/riscos/plugin.c b/riscos/plugin.c index 03692c262..828bc0c92 100644 --- a/riscos/plugin.c +++ b/riscos/plugin.c @@ -796,13 +796,22 @@ void plugin_url_access(wimp_message *message) * other window names */ if (!post) { /* GET request */ - if (strcasecmp(window, "_self") == 0 || + if (strcasecmp(url, + c->data.plugin.bw->current_content->url) && + (strcasecmp(window, "_self") == 0 || strcasecmp(window, "_parent") == 0 || strcasecmp(window, "_top") == 0 || - strcasecmp(window, "") == 0) { + strcasecmp(window, "") == 0)) { + /* only open in current window if not + * already at the URL requested, else you + * end up in an infinite loop of fetching + * the same page + */ browser_window_go(c->data.plugin.bw, url, 0); } - else if (strcasecmp(window, "_blank") == 0) { + else if (!option_block_popups && + strcasecmp(window, "_blank") == 0) { + /* don't do this if popups are blocked */ browser_window_create(url, NULL, 0); } } -- cgit v1.2.3