links

lynx-like text mode web browser
git clone anongit@rnpnr.xyz:links.git
Log | Files | Refs | Feed | README | LICENSE

Commit: cf766a6822643026bc11a12eb79ee89758676e08
Parent: bcb97843b0b975f6c261fe792c8e2aa22fc47dd5
Author: opask
Date:   Mon, 20 Aug 2018 21:09:50 -0600

remove remaining js related variables and tests

Diffstat:
Mdefault.c | 16----------------
Mhtml.c | 10++--------
Mhtml_gr.c | 8++------
Mhtml_r.c | 20+++++---------------
Mlinks.h | 16+---------------
Mmain.c | 1-
Msession.c | 1-
Mview.c | 35+++--------------------------------
8 files changed, 13 insertions(+), 94 deletions(-)

diff --git a/default.c b/default.c @@ -1511,14 +1511,6 @@ struct smb_options smb_options = { 0 }; unsigned char download_dir[MAX_STR_LEN] = ""; static int sink; -int js_enable=1; /* 0=disable javascript */ -int js_verbose_errors=0; /* 1=create dialog on every javascript error, 0=be quiet and continue */ -int js_verbose_warnings=0; /* 1=create dialog on every javascript warning, 0=be quiet and continue */ -int js_all_conversions=1; -int js_global_resolve=1; /* resolvovani v globalnim adresnim prostoru, kdyz BFU vomitne document */ -int js_manual_confirmation=1; /* !0==annoying dialog on every goto url etc. */ -int js_fun_depth=100; -int js_memory_limit=5*1024; /* in kilobytes, should be in range 1M-20M (1MB=1024*1024B) */ double display_red_gamma=2.2; /* Red gamma exponent of the display */ double display_green_gamma=2.2; /* Green gamma exponent of the display */ @@ -1658,14 +1650,6 @@ static struct option links_options[] = { {1, gen_cmd, num_rd, num_wr, 0, 1, &dither_images, "dither_images", "dither-images"}, {1, gen_cmd, num_rd, num_wr, 0, 2, &gamma_bits, "gamma_correction", "gamma-correction"}, {1, gen_cmd, num_rd, num_wr, 0, 1, &overwrite_instead_of_scroll, "overwrite_instead_of_scroll", "overwrite-instead-of-scroll"}, - {1, gen_cmd, num_rd, NULL, 0, 1, &js_enable, "enable_javascript", NULL}, - {1, gen_cmd, num_rd, NULL, 0, 1, &js_verbose_errors, "verbose_javascript_errors", NULL}, - {1, gen_cmd, num_rd, NULL, 0, 1, &js_verbose_warnings, "verbose_javascript_warnings", NULL}, - {1, gen_cmd, num_rd, NULL, 0, 1, &js_all_conversions, "enable_all_conversions", NULL}, - {1, gen_cmd, num_rd, NULL, 0, 1, &js_global_resolve, "enable_global_resolution", NULL}, - {1, gen_cmd, num_rd, NULL, 0, 1, &js_manual_confirmation, "javascript_manual_confirmation", NULL}, - {1, gen_cmd, num_rd, NULL, 0, 999999, &js_fun_depth, "js_recursion_depth", NULL}, - {1, gen_cmd, num_rd, NULL, 1024, 30*1024, &js_memory_limit, "js_memory_limit", NULL}, {1, gen_cmd, cp_rd, NULL, 0, 0, &dds.assume_cp, "assume_codepage", NULL}, {1, NULL, term_rd, term_wr, 0, 0, NULL, "terminal", NULL}, {1, NULL, term2_rd, NULL, 0, 0, NULL, "terminal2", NULL}, diff --git a/html.c b/html.c @@ -1304,11 +1304,6 @@ static void html_style(unsigned char *a) html_top.invisible = INVISIBLE_STYLE; } -static void html_noscript(unsigned char *a) -{ - if (d_opt->js_enable) html_skip(a); -} - static void html_center(unsigned char *a) { par_format.align = AL_CENTER; @@ -2834,7 +2829,6 @@ static struct element_info elements[] = { /* {"HEAD", html_skip, 0, 0},*/ {"TITLE", html_title, 0, 0}, {"SCRIPT", html_script, 0, 0}, - {"NOSCRIPT", html_noscript, 0, 0}, {"STYLE", html_style, 0, 0}, {"NOEMBED", html_skip, 0, 0}, @@ -3258,7 +3252,7 @@ int get_image_map(unsigned char *head, unsigned char *s, unsigned char *eof, uns int hdl = 0; struct conv_table *ct; if (head) add_to_str(&hd, &hdl, head); - scan_http_equiv(s, eof, &hd, &hdl, NULL, NULL, NULL, NULL, NULL); + scan_http_equiv(s, eof, &hd, &hdl, NULL, NULL, NULL, NULL); if (!gfx) ct = get_convert_table(hd, to, def, NULL, NULL, hdef); else ct = convert_table; free(hd); @@ -3452,7 +3446,7 @@ int get_image_map(unsigned char *head, unsigned char *s, unsigned char *eof, uns return 0; } -void scan_http_equiv(unsigned char *s, unsigned char *eof, unsigned char **head, int *hdl, unsigned char **title, unsigned char **background, unsigned char **bgcolor, int *pre_wrap, struct js_event_spec **j) +void scan_http_equiv(unsigned char *s, unsigned char *eof, unsigned char **head, int *hdl, unsigned char **title, unsigned char **background, unsigned char **bgcolor, int *pre_wrap) { unsigned char *name, *attr, *he, *c; int namelen; diff --git a/html_gr.c b/html_gr.c @@ -820,8 +820,7 @@ static void g_put_chars(void *p_, unsigned char *s, int l) } check_link: if (last_link || last_image || last_form || format_.link - || format_.image || format_.form - || format_.js_event || last_js_event) + || format_.image || format_.form) goto process_link; back_link: if (putchars_link_ptr) { @@ -907,8 +906,7 @@ static void g_put_chars(void *p_, unsigned char *s, int l) free(last_image); last_link = last_target = last_image = NULL; last_form = NULL; - last_js_event = NULL; - if (!(format_.link || format_.image || format_.form || format_.js_event)) + if (!(format_.link || format_.image || format_.form)) goto back_link; p->link_num++; last_link = stracpy(format_.link); @@ -982,7 +980,6 @@ struct g_part *g_format_html_part(unsigned char *start, unsigned char *end, int free(last_target); last_link = last_image = last_target = NULL; last_form = NULL; - last_js_event = NULL; cached_font_face = to_je_ale_prasarna; p = mem_calloc(sizeof(struct g_part)); @@ -1064,7 +1061,6 @@ struct g_part *g_format_html_part(unsigned char *start, unsigned char *end, int free(last_target); last_link = last_image = last_target = NULL; last_form = NULL; - last_js_event = NULL; if (table_level > 1 && !f_d) add_table_cache_entry(start, end, align, m, width, 0, link_num, p); diff --git a/html_r.c b/html_r.c @@ -577,7 +577,6 @@ unsigned char *last_link = NULL; unsigned char *last_target = NULL; unsigned char *last_image = NULL; struct form_control *last_form = NULL; -struct js_event_spec *last_js_event = NULL; static int nobreak; @@ -670,9 +669,9 @@ static void put_chars(void *p_, unsigned char *c, int l) { ll = l; } - if (last_link || last_image || last_form || format_.link || format_.image - || format_.form || format_.js_event || last_js_event - ) goto process_link; + if (last_link || last_image || last_form || format_.link + || format_.image || format_.form) + goto process_link; no_l: /*printf("%d %d\n",p->cx, p->cy);*/ if (memcmp(&ta_cache, &format_, sizeof(struct text_attrib_beginning))) goto format_change; @@ -687,9 +686,7 @@ static void put_chars(void *p_, unsigned char *c, int l) if (!d_opt->cp && !(format_.attr & AT_GRAPHICS)) { set_hline_uni(p, p->cx, p->cy, ll, uni_c, ((fg&0x08)<<3)|(bg<<3)|(fg&0x07)); } else - { set_hline(p, p->cx, p->cy, l, c, ((fg&0x08)<<3)|(bg<<3)|(fg&0x07)); - } p->cx += ll; nobreak = 0; if (par_format.align != AL_NO) @@ -726,16 +723,13 @@ static void put_chars(void *p_, unsigned char *c, int l) free(last_image); last_link = last_target = last_image = NULL; last_form = NULL; - last_js_event = NULL; - if (!(format_.link || format_.image || format_.form || format_.js_event)) goto no_l; + if (!(format_.link || format_.image || format_.form)) goto no_l; if (d_opt->num_links) { unsigned char s[64]; unsigned char *fl = format_.link, *ft = format_.target, *fi = format_.image; struct form_control *ff = format_.form; - struct js_event_spec *js = format_.js_event; format_.link = format_.target = format_.image = NULL; format_.form = NULL; - format_.js_event = NULL; if (d_opt->num_links) { s[0] = '['; snzprint(s + 1, 62, p->link_num); @@ -756,7 +750,6 @@ static void put_chars(void *p_, unsigned char *c, int l) format_.target = ft; format_.image = fi; format_.form = ff; - format_.js_event = js; } p->link_num++; last_link = stracpy(format_.link); @@ -1055,7 +1048,6 @@ struct part *format_html_part(unsigned char *start, unsigned char *end, int alig free(last_target); last_link = last_image = last_target = NULL; last_form = NULL; - last_js_event = NULL; nobreak = align != AL_NO && align != AL_NO_BREAKABLE; p = mem_calloc(sizeof(struct part)); /*p->x = p->y = 0;*/ @@ -1116,7 +1108,6 @@ struct part *format_html_part(unsigned char *start, unsigned char *end, int alig empty_format = ef; last_link = last_image = last_target = NULL; last_form = NULL; - last_js_event = NULL; if (table_level > 1 && !data) { add_table_cache_entry(start, end, align, m, width, xs, link_num, p); @@ -1211,7 +1202,7 @@ void really_format_html(struct cache_entry *ce, unsigned char *start, unsigned c head = init_str(); hdl = 0; if (ce->head) add_to_str(&head, &hdl, ce->head); - scan_http_equiv(start, end, &head, &hdl, &t, d_opt->plain ? NULL : &bg, d_opt->plain || d_opt->col < 2 ? NULL : &bgcolor, &implicit_pre_wrap, NULL ); + scan_http_equiv(start, end, &head, &hdl, &t, d_opt->plain ? NULL : &bg, d_opt->plain || d_opt->col < 2 ? NULL : &bgcolor, &implicit_pre_wrap); if (d_opt->break_long_lines) implicit_pre_wrap = 1; if (d_opt->plain) *t = 0; if (screen->opt.plain == 2) { @@ -1312,7 +1303,6 @@ int compare_opt(struct document_options *o1, struct document_options *o2) o1->images == o2->images && o1->image_names == o2->image_names && o1->margin == o2->margin && - o1->js_enable == o2->js_enable && o1->plain == o2->plain && o1->num_links == o2->num_links && o1->table_order == o2->table_order && diff --git a/links.h b/links.h @@ -1812,8 +1812,6 @@ struct form_state { int vypos; }; -struct js_event_spec; - struct link { int type; /* one of L_XXX constants */ int num; /* link number (used when user turns on link numbering) */ @@ -1826,7 +1824,6 @@ struct link { int n; /* number of points */ int first_point_to_move; struct point *pos; - struct js_event_spec *js_event; int obj_order; #ifdef G struct rect r; @@ -1898,7 +1895,6 @@ struct document_options { int scrolling; int col, cp, assume_cp, hard_assume; int tables, frames, break_long_lines, images, image_names, margin; - int js_enable; int plain; int num_links, table_order; int auto_refresh; @@ -2222,10 +2218,6 @@ void refresh_image(struct f_data_c *fd, struct g_object *img, uttime tm); struct additional_file *request_additional_file(struct f_data *f, unsigned char *url); -struct js_event_spec { - char dummy; -}; - /* * warning: if you add more additional file stuctures, you must * set RQ upcalls correctly @@ -2956,8 +2948,6 @@ void reset_form(struct f_data_c *f, int form_num); void set_textarea(struct session *, struct f_data_c *, int); void free_format_text_cache(void); -unsigned char *print_js_event_spec(struct js_event_spec *); - /* font_inc.c */ #ifdef G @@ -3187,7 +3177,6 @@ struct text_attrib { unsigned char *link; unsigned char *target; unsigned char *image; - struct js_event_spec *js_event; struct form_control *form; struct rgb clink; unsigned char *href_base; @@ -3269,9 +3258,6 @@ extern unsigned char *last_link; extern unsigned char *last_image; extern unsigned char *last_target; extern struct form_control *last_form; -extern struct js_event_spec *last_js_event; -extern int js_fun_depth; -extern int js_memory_limit; int parse_element(unsigned char *, unsigned char *, unsigned char **, int *, unsigned char **, unsigned char **); unsigned char *get_attr_val(unsigned char *, unsigned char *); @@ -3286,7 +3272,7 @@ int should_skip_script(unsigned char *); unsigned char *skip_comment(unsigned char *, unsigned char *); void parse_html(unsigned char *, unsigned char *, void (*)(void *, unsigned char *, int), void (*)(void *), void *(*)(void *, int, ...), void *, unsigned char *); int get_image_map(unsigned char *, unsigned char *, unsigned char *, unsigned char *a, struct menu_item **, struct memory_list **, unsigned char *, unsigned char *, int, int, int, int gfx); -void scan_http_equiv(unsigned char *, unsigned char *, unsigned char **, int *, unsigned char **, unsigned char **, unsigned char **, int *, struct js_event_spec **); +void scan_http_equiv(unsigned char *, unsigned char *, unsigned char **, int *, unsigned char **, unsigned char **, unsigned char **, int *); int decode_color(unsigned char *, struct rgb *); diff --git a/main.c b/main.c @@ -280,7 +280,6 @@ static void end_dump(struct object_request *r, void *p) ds2do(&dds, &o, 0); o.plain = 0; o.frames = 0; - o.js_enable = 0; o.framename = cast_uchar ""; if (!casecmp(r->url, cast_uchar "file://", 7) && !o.hard_assume) { o.assume_cp = get_commandline_charset(); diff --git a/session.c b/session.c @@ -1626,7 +1626,6 @@ static void html_interpret(struct f_data_c *fd, int report_status) if (fd->parent && fd->parent->f_data && !o.hard_assume) { o.assume_cp = fd->parent->f_data->cp; } - o.js_enable=0; #ifdef G o.bfu_aspect=bfu_aspect; #else diff --git a/view.c b/view.c @@ -45,11 +45,6 @@ void destroy_vs(struct view_state *vs) free(vs); } -unsigned char *print_js_event_spec(struct js_event_spec *j) -{ - return stracpy(cast_uchar ""); -} - void check_vs(struct f_data_c *f) { struct view_state *vs = f->vs; @@ -3409,27 +3404,15 @@ static unsigned char *print_current_linkx(struct f_data_c *fd, struct terminal * m = display_url(term, l->where, 1); goto p; } - m = print_js_event_spec(l->js_event); + m = stracpy((unsigned char *)""); goto p; } if (!l->form) return NULL; if (l->type == L_BUTTON) { if (l->form->type == FC_BUTTON) { - unsigned char *n; - unsigned char *txt; m = init_str(); ll = 0; add_to_str(&m, &ll, get_text_translation(TEXT_(T_BUTTON), term)); - if (!l->js_event) goto p; - add_to_str(&m, &ll, cast_uchar " "); - n=print_js_event_spec(l->js_event); - if (fd->f_data) { - txt=convert(fd->f_data->cp,fd->f_data->opt.cp, n, NULL); - free(n); - } else - txt = n; - add_to_str(&m, &ll, txt); - free(txt); goto p; } if (l->form->type == FC_RESET) { @@ -3522,7 +3505,7 @@ static unsigned char *print_current_linkx_plus(struct f_data_c *fd, struct termi add_to_str(&m, &ll, d); free(d); } - spc = print_js_event_spec(l->js_event); + spc = stracpy((unsigned char *)""); if (spc&&*spc) { add_to_str(&m, &ll, cast_uchar "\n"); @@ -3567,21 +3550,9 @@ static unsigned char *print_current_linkx_plus(struct f_data_c *fd, struct termi if (!l->form) return NULL; if (l->type == L_BUTTON) { if (l->form->type == FC_BUTTON) { - unsigned char *n; - unsigned char *txt; m = init_str(); ll = 0; add_to_str(&m, &ll, get_text_translation(TEXT_(T_BUTTON), term)); - if (!l->js_event) goto p; - add_to_str(&m, &ll, cast_uchar " "); - n=print_js_event_spec(l->js_event); - if (fd->f_data) { - txt=convert(fd->f_data->cp, fd->f_data->opt.cp, n, NULL); - free(n); - } else - txt = n; - add_to_str(&m, &ll, txt); - free(txt); goto p; } if (l->form->type == FC_RESET) { @@ -3639,7 +3610,7 @@ static unsigned char *print_current_linkx_plus(struct f_data_c *fd, struct termi } goto p; } - p: +p: return m; }