1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-06-30 01:55:30 +00:00
Commit Graph

479 Commits

Author SHA1 Message Date
Witold Filipczyk
a7c2f14e6d bug 1067: the node was freed, but still used. 2009-02-12 09:48:04 +01:00
Kalle Olavi Niemitalo
99d1269bc5 bug 153, 1066: Convert session-snapshot bookmarks to/from UTF-8.
These functions now expect or return strings in UTF-8:
delete_folder_by_name (sneak in a const, too), bookmark_terminal_tabs,
open_bookmark_folder, and get_auto_save_bookmark_foldername_utf8 (new
function).
2009-02-08 18:26:19 +02:00
Kalle Olavi Niemitalo
ad45176dde Add get_terminal_codepage().
This simplifies the callers a little and may help implement
simultaneous support for different charsets on different terminals
of the same type (bug 1064).
2009-01-01 16:16:17 +00:00
Kalle Olavi Niemitalo
25da8085b3 Fix double-free crash if EOF immediately follows </MAP>.
look_for_link() used to return 0 both when it found the closing </MAP>
tag, and when it hit the end of the file.  In the first case, it also
added *menu to the memory_list; in the second case, it did not.  The
caller get_image_map() supposedly distinguished between these cases by
checking whether pos >= eof, and freed *menu separately if so.

However, if the </MAP> was at the very end of the HTML file, so that
not even a newline followed it, then look_for_link() left pos == eof
even though it had found the </MAP> and added *menu to the memory_list.
This made get_image_map() misinterpret the result and mem_free(*menu)
even though *menu had already been freed as part of the memory_list;
thus the crash.

To fix this, make look_for_link() return -1 instead of 0 if it hits
EOF without finding the </MAP>.  Then make get_image_map() check the
return value instead of comparing pos to eof.  And add a test case,
although not an automated one.

Alternatively, look_for_link() could have been changed to decrement
pos between finding the </MAP> and returning 0.  Then, the pos >= eof
comparison in get_image_map() would have been false.  That scheme
would however have been a bit more difficult to understand and
maintain, I think.

Reported by Paul B. Mahol.
(cherry picked from commit a2404407ce)
2008-12-31 20:15:44 +00:00
Peter Collingbourne
658b9cc70f Fixed bug relating to newlines in hidden input fields
This patch fixes an issue whereby a newline character appearing within
a hidden input field is incorrectly reinterpreted as a space character.
The patch handles almost all cases, and includes a test case.
15/18 tests pass, but the remainder currently fail due to the fact
that ELinks does not currently support textarea scripting.
2008-11-09 23:28:46 +02:00
M. Vefa Bicakci
20a7a6c460 Patch 3: Further fixes including strcasestr and convert_to_lowercase 2008-11-01 22:32:43 +02:00
M. Vefa Bicakci
96b3093519 Patch 2: Modifications to the remaining parts of ELinks
[Forward ported to 0.12 from bug 1004 attachment 499.  --KON]
2008-11-01 22:20:25 +02:00
M. Vefa Bicakci
86085de07e Patch 1: Finalize modifications to the HTML parser
[Forward ported to 0.12 from bug 1004 attachment 498.  --KON]
2008-10-26 18:00:19 +02:00
M. Vefa Bicakci
85c26ddc45 Patch 0: Partial modification of the HTML parser and modification of the FastFind subsystem
[Forward ported to 0.12 from bug 1004 attachment 500.  --KON]
2008-10-26 16:13:38 +02:00
Kalle Olavi Niemitalo
018af50f1d Rename cache_entry.id and related members.
cache_entry.id => cache_entry.cache_id
document.id => document.cache_id
ecmascript_interpreter.onload_snippets_owner => .onload_snippets_cache_id

This is a combination of:

commit 232c07aa7f
bug 1009: id variables renamed, added document_id to the document.

commit 6007043458bf8f14abfc18b9db60785bdc0279f6
Revert addition of document.document_id
2008-08-03 21:27:56 +03:00
Kalle Olavi Niemitalo
6c2e8cd7b2 Bug 1013: Don't assume errno is between 0 and 100000
Replace almost all uses of enum connection_state with struct
connection_status.  This removes the assumption that errno values used
by the system are between 0 and 100000.  The GNU Hurd uses values like
ENOENT = 0x40000002 and EMIG_SERVER_DIED = -308.

This commit is derived from my attachments 450 and 467 to bug 1013.
2008-08-03 17:56:41 +03:00
Kalle Olavi Niemitalo
83ccaa3673 Bug 698: Keep forms contiguous and non-overlapping and start from 0.
In document.forms, each struct form has form_num and form_end members
that reserve a subrange of [0, INT_MAX] to that form.  Previously,
multiple forms in the list could have form_end == INT_MAX and thus
overlap each other.  Prevent that by adjusting form_end of each form
newly added to the list.

Revert 438f039bda,
"check_html_form_hierarchy: Old code was buggy.", which made
check_html_form_hierarchy attach controls to the wrong forms.
Instead, construct the dummy form ("for those Flying Dutchmans") at
form_num == 0 always before adding any real forms to the list.
This prevents the assertion failure by ensuring that every possible
form_control.position is covered by some form, if there are any forms.

Add a function assert_forms_list_ok, which checks that the set of
forms actually covers the [0, INT_MAX] range without overlapping,
as intended.  Call that from check_html_form_hierarchy to detect
any corruption.

I have tested this code (before any cherry-picking) with:
- bug 613 attachment 210: didn't crash
- bug 714 attachment 471: didn't crash
- bug 961 attachment 382: didn't crash
- bug 698 attachment 239: all the submit buttons showed the right URLs
- bug 698 attachment 470: the submit button showed the right URL

(cherry picked from commit 386a5d517b)
2008-07-20 11:46:01 +03:00
Kalle Olavi Niemitalo
bbadb99dd1 952, 954: Add ecmascript_{detach,moved}_form_state stubs
Anything that frees or reallocates struct form_state must now call the
new functions ecmascript_detach_form_state or ecmascript_moved_form_state.
These functions should then clear out any dangling pointers, but that has
not yet been implemented.
2008-07-18 19:56:49 +03:00
Jonas Fonseca
1bd98053b0 Fix memory leak in the DOM configuration module
... by making the (only) user (which is the RSS renderer) responsible
allocation of the dom_config structure.
2008-06-21 00:19:15 +02:00
Miciah Dashiel Butler Masters
0b99fa70ca Bug 620: Reset form fields to default values on reload
Do not retain changed values in form fields when the user reloads.  Doing
so can be confusing or even cause data-loss when new default values are
specified in the updated document.  For example, when editing an article on
Wikipedia, one loads the edit page for the article, makes and submits
changes, goes back to the edit page to make further modifications, and
reloads to get the new article text.  Before this change, reloading the
edit page would not update the textarea on the page with the new article
source, which can lead one (and has led me) to make changes to the original
version of the article by accident.

This fixes bug 620.
(cherry picked from commit 9e1e94bee0)
2008-06-15 22:49:57 +03:00
Miciah Dashiel Butler Masters
3a0286e447 Strings corrections from Malcolm Parsons
Fix the spelling and grammar in various comments, variable names, comment
descriptions, and documentation.
2008-01-27 04:19:23 +00:00
Kalle Olavi Niemitalo
cab0b3fbd5 const in CSS 2008-01-26 18:10:13 +02:00
Kalle Olavi Niemitalo
e2cc0bd434 Don't cast qsort comparison function pointers.
Instead, convert the element pointers inside the comparison functions.

The last argument of qsort() is supposed to be of type
int (*)(const void *, const void *).  Previously, comp_links() was
defined to take struct link * instead of const void *, and the type
mismatch was silenced by casting the function pointer to void *.
This was in principle not portable because:

(1) The different pointer types may have different representations.
    In a word-oriented machine, the const void * might include a byte
    selector while the struct link * might not.

(2) Casting a function pointer to a data pointer can lose bits in some
    memory models.  Apparently this does not occur in POSIX-conforming
    systems though, as dlsym() would fail if it did.

This commit also fixes hits_cmp() and compare_dir_entries(), which
had similar problems.  However, I'm leaving alias_compare() in
src/intl/gettext/localealias.c unchanged for now, so as not to diverge
from the GNU version.

I also checked the bsearch() calls but they were all okay, apart from
one that used the alias_compare() mentioned above.
2007-10-06 23:05:05 +03:00
Laurent MONIN
27057926b9 Fix compilation with --disable-css.
Compilation failed due to missing DEBUG_CSS test.
This was introduced in commit 98260f7970
2007-09-21 11:05:40 +02:00
Laurent MONIN
39d9f669c9 Revert "format_html_part(): save and restore renderer_context.last_tag_for_newline too."
This reverts commit 4abce8e363.
This was a bad move, anchors ceased to function correctly.
Reported by Witekfl.
2007-09-19 09:14:53 +02:00
Laurent MONIN
7b6cb249ed Fix compilation using --enable-html-highlight.
It was broken by commit 09cf904814.
Reported by witekfl.
2007-09-17 10:54:52 +02:00
Miciah Dashiel Butler Masters
7033247905 Introduce start_document_refreshes()
start_document_refreshes() performs the NULL-pointer checks that
previously all callers to start_document_refresh() must perform
and then calls start_document_refresh().
2007-09-14 16:44:04 +02:00
Jonas Fonseca
8e3c2d6042 Move find_tag to document/document 2007-09-14 16:29:13 +02:00
Laurent MONIN
f0e66866f5 Trim trailing whitespaces. 2007-09-14 15:12:32 +02:00
Jonas Fonseca
890903a65d Compile fix for commit e876df70d8 2007-09-14 15:08:51 +02:00
Petr Baudis
c1b91c7bf3 document/html: Make HTML parser state transparent
Before, *_html_parser_state() operated with struct html_element *. Now, it is
transparent for the renderer (just void *), so that DOM won't have to provide
this struct but will be able to use something internal.

Backported from master.
2007-09-14 15:06:56 +02:00
Petr Baudis
37b20d998c document/html: Move enum html_special_type from parser.h to renderer.h
...since it is renderer interface.
2007-09-14 15:03:14 +02:00
Laurent MONIN
09cf904814 Backport Pasky's changes concerning text_style-related stuff.
It partially includes changes made in following commits:

document/html: struct text_attrib_style -> struct text_style
commit    e133941206

document: struct format_attr -> struct text_style_format
commit    070d335796

document: Unify text style -> screen attribute handling
commit    b66d2bec67

document: Move text_style-related stuff to dedicated format.*
commit    db9431465f
2007-09-14 14:59:37 +02:00
Laurent MONIN
419cd4775e format_html_part(): group int variables declarations 2007-09-14 10:07:32 +02:00
Laurent MONIN
4abce8e363 format_html_part(): save and restore renderer_context.last_tag_for_newline too. 2007-09-14 09:59:34 +02:00
Laurent MONIN
a6f3323a4b Use explicit names for variables in format_html_part().
llm -> saved_last_link_to_move
ltm -> saved_last_tag_to_move
ef  -> saved_empty_format
lm  -> saved_margin
2007-09-14 09:55:43 +02:00
Laurent MONIN
73b1f43468 Drop useless goto/label. 2007-09-14 09:26:39 +02:00
Laurent MONIN
6e89b39ed0 Fix get_opt_bool() call and finish backport of process_head() split. 2007-09-12 23:51:43 +02:00
Miciah Dashiel Butler Masters
bd0a6f6f7d Reflow check_head_for_cache_control 2007-09-12 23:41:37 +02:00
Miciah Dashiel Butler Masters
deb74bd1bd Factor check_head_for_cache_control out of process_head 2007-09-12 23:41:17 +02:00
Miciah Dashiel Butler Masters
4b297a5b03 Factor check_head_for_refresh out of process_head 2007-09-12 23:38:41 +02:00
Miciah Dashiel Butler Masters
23262b3145 Fix process_head to check for cache-control information even if no refresh
Previously, process_head immediately returned if there was no refresh, never giving the cache-control check further down a chance to run.

Also add new tests:

   nocache.html
   refresh+nocache.html
2007-09-12 23:33:40 +02:00
Laurent MONIN
5b28e89026 Extend Use of LWS() macro to parse_old_meta_refresh(). 2007-09-11 17:57:19 +02:00
Laurent MONIN
41ece7a758 Make meta refresh content attribute parsing more tolerant.
Simply search for 'url' marker ignoring anything
before it.
ELinks is now able to follow incorrectly written
meta refresh content attribute with missing ; before
url= parameter.
As an example, try http://akkada.tivi.net.pl/
2007-09-11 17:55:10 +02:00
Witold Filipczyk
7f49eda39e DOM renderer: off by one error. 2007-09-02 20:44:36 +00:00
Kalle Olavi Niemitalo
870df797cf Doxygen: Escape some HTML tags. 2007-07-31 13:48:20 +03:00
Kalle Olavi Niemitalo
76c6f38169 Doxygen: Begin commands with @ not \. 2007-07-31 13:47:12 +03:00
Kalle Olavi Niemitalo
0cb047b298 Bug 968: Don't use copy_chars in justify_line.
All the needed memory has been allocated before the loop so we can use
copy_screen_chars() directly.  This avoids the assertion failure in
copy_chars() for width==0 and should be a bit faster too.  According
to ISO/IEC 9899:1999 7.21.1p2, memcpy() doesn't copy anything if n==0
(but the pointers must be valid).
(original 'git cherry-pick' arguments: cherry-pick bug968-att394)
2007-07-30 16:43:46 +03:00
Kalle Olavi Niemitalo
297ad024c3 const in css_appliers[] 2007-07-28 02:38:11 +03:00
Kalle Olavi Niemitalo
80f5ec1827 Doxygenate src/document/css/ 2007-07-28 02:35:36 +03:00
Kalle Olavi Niemitalo
a26db3948a Doxygenate src/document/ (but not subdirs) 2007-07-28 02:34:59 +03:00
Kalle Olavi Niemitalo
96176a8c77 Declare element types of lists. 2007-07-26 22:47:23 +03:00
Kalle Olavi Niemitalo
d3d2bb26c5 New macro LIST_OF for better Doxygen support. 2007-07-26 22:45:51 +03:00
Kalle Olavi Niemitalo
585f8b426b Doxygen syntax fixes
Fix warnings:
dom/stack.h:70: Warning: explicit link request to 'pop_dom_node' could not be resolved
dom/stack.h:71: Warning: explicit link request to 'pop_dom_nodes' could not be resolved
dom/stack.h:71: Warning: explicit link request to 'pop_dom_state' could not be resolved
dom/stack.h:115: Warning: explicit link request to 'done_dom_node' could not be resolved

Use @returns instead of \return in src/document/css/parser.c,
and other such things.
2007-07-26 14:14:27 +03:00
Kalle Olavi Niemitalo
64da6774c2 CSS: Count nested blocks when skipping.
When skipping "@media print { #foo {bar: baz} pre {white-space: normal} }",
the previous code would look for the first "{" and then the first "}", and
fail to skip the "pre" rule.  Seen at support.microsoft.com.

I originally posted this change as part of attachment 383 to bug 722.
2007-07-22 16:51:04 +03:00