1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-12-04 14:46:47 -05:00

SEE: Do not check thisobj->objectclass in window functions.

init_js_window_object() copies the alert, open, and setTimeout methods
from the window object to the global object.  My fix for bug 846 on
2006-12-10 incorrectly made the corresponding C functions refuse to
work if they were not called as methods of the window object.
This commit is contained in:
Kalle Olavi Niemitalo 2008-07-20 09:26:52 +03:00 committed by Kalle Olavi Niemitalo
parent 39a5d68447
commit 85bfba4530
2 changed files with 12 additions and 3 deletions

3
NEWS
View File

@ -36,6 +36,9 @@ Bugs that should be removed from NEWS before the 0.12.0 release:
was the first release that had these bugs.
* bug 1033: Fix memory leak in ECMAScript window.open. ELinks 0.12pre1
was the first release that had this bug.
* Global ECMAScript functions alert, open, and setTimeout again work
with SEE. ELinks 0.12pre1 was the first release that supported SEE
at all.
ELinks 0.12pre1:
----------------

View File

@ -211,7 +211,9 @@ js_window_alert(struct SEE_interpreter *interp, struct SEE_object *self,
struct view_state *vs = win->vs;
unsigned char *string;
see_check_class(interp, thisobj, &js_window_object_class);
/* Do not check thisobj->objectclass. ELinks sets this
* function as a property of both the window object and the
* global object, so thisobj may validly refer to either. */
SEE_SET_BOOLEAN(res, 1);
if (argc < 1)
@ -248,7 +250,9 @@ js_window_open(struct SEE_interpreter *interp, struct SEE_object *self,
static int ratelimit_count;
#endif
see_check_class(interp, thisobj, &js_window_object_class);
/* Do not check thisobj->objectclass. ELinks sets this
* function as a property of both the window object and the
* global object, so thisobj may validly refer to either. */
SEE_SET_OBJECT(res, (struct SEE_object *)win);
if (get_opt_bool("ecmascript.block_window_opening")) {
@ -342,7 +346,9 @@ js_setTimeout(struct SEE_interpreter *interp, struct SEE_object *self,
unsigned char *code;
int timeout;
see_check_class(interp, thisobj, &js_window_object_class);
/* Do not check thisobj->objectclass. ELinks sets this
* function as a property of both the window object and the
* global object, so thisobj may validly refer to either. */
if (argc != 2) return;
ei = ((struct global_object *)interp)->interpreter;