From c204af75fe019a6b5e90f7def2d8f855f063d1eb Mon Sep 17 00:00:00 2001 From: witekfl Date: Wed, 25 Jan 2006 11:50:46 +0100 Subject: [PATCH] Because of gradual rendering window.open is called many times with the same arguments. This workaround remembers 8 last opened URLs and do not let open them again. --- src/ecmascript/see/window.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/src/ecmascript/see/window.c b/src/ecmascript/see/window.c index 51cfa45e..e284ed77 100644 --- a/src/ecmascript/see/window.c +++ b/src/ecmascript/see/window.c @@ -231,7 +231,8 @@ js_window_open(struct SEE_interpreter *interp, struct SEE_object *self, unsigned char *url, *url2; struct uri *uri; struct SEE_value url_value, target_value; - static struct SEE_string *url_string = NULL, *target_string = NULL; + static struct SEE_string *url_string[8], *target_string[8]; + static int indeks; #if 0 static time_t ratelimit_start; static int ratelimit_count; @@ -262,14 +263,19 @@ js_window_open(struct SEE_interpreter *interp, struct SEE_object *self, #endif SEE_ToString(interp, argv[0], &url_value); if (argc > 1) { + int i; + SEE_ToString(interp, argv[1], &target_value); - if (url_string && target_string && - !SEE_string_cmp(url_value.u.string, url_string) - && !SEE_string_cmp(target_value.u.string, target_string)) { - return; + for (i = 0; i < 8; i++) { + if (url_string[i] && target_string[i]) { + if (!SEE_string_cmp(url_value.u.string, url_string[i]) + && !SEE_string_cmp(target_value.u.string, target_string[i])) + return; + } } - url_string = url_value.u.string; - target_string = target_value.u.string; + url_string[indeks] = url_value.u.string; + target_string[indeks] = target_value.u.string; + indeks = (indeks + 1) & 7; } url = SEE_string_to_unsigned_char(url_value.u.string); if (!url) return; -- 2.11.4.GIT