I didn’t respect the right order when I added the functions to move up and down
by half a page a few years ago.
Signed-off-by: Fabienne Ducroquet <fabiduc@gmail.com>
Use the same functions as for the list-style property since only the "type" part
of the list-style property is supported at this stage.
Signed-off-by: Fabienne Ducroquet <fabiduc@gmail.com>
* Rename P_STAR as P_DISC and P_PLUS as P_SQUARE.
* Delete P_NONE because it was used only as the default flag in init_html_parser
and a list with P_NONE then got bullets, so instead use P_DISC by default (as
per the CSS specification), and P_NO_BULLET for lists with no bullets.
* Use as bullets the characters:
- U+25E6 WHITE BULLET for the circle style;
- U+25AA BLACK SMALL SQUARE (alias square bullet) for the square style;
- U+2022 BULLET for the disc style (default).
Signed-off-by: Fabienne Ducroquet <fabiduc@gmail.com>
By default some Python warning messages would be written to standard error
by the interpreter. To prevent these warnings from making a mess of the
ELinks screen, all warnings were turned into exceptions so they could be
caught and displayed through the usual report_scripting_error() mechanism.
With Python 3.2, this approach backfires: A new class of ResourceWarnings
that are filtered by default (and hence would *not* have been written to
standard error) are now turned into exceptions, and these exceptions can't
be caught because they're emitted from the interpreter's cleanup code. As
a result, the uncaught exceptions would make a mess of the ELinks screen.
The new solution is to replace Python's standard library function
warnings.showwarning() with one that turns warning messages into exceptions.
This means we'll wait until a warning would have been written to standard
error before turning it into an exception, so other warnings that would
never have reached that point because they're filtered will remain unseen.
(The behavior of warning messages is described in the documentation for
the "warnings" module from Python's standard library.)
There was hardcoded 4096 for threads size, but below there was:
assertm(fd >= 0 && fd < FD_SETSIZE,
"get_handler: handle %d >= FD_SETSIZE %d",
fd, FD_SETSIZE);
if_assert_failed return NULL;
which fails for fd > 1024 (1024 was previous value of FD_SETSIZE)
DELETED:
* dumb {b}, smart {bb, bb_fr_en, bb_en_fr}: Redirects to Microsoft
Translator, which I can't get to work without JavaScript. Deleted.
* dumb {pyhelp}, smart {py, pydev}: Deleted as recommended by the
author of the CGI script.
* dumb {pyvault, lyrics}, smart {pyvault}: Can't find a new URL for the
service. Deleted.
* smart {gd}: Google Directory has been shut down. Deleted.
* smart {sd, sdc, sdu, sdp, sdj, whatis}: These don't seem to work
without JavaScript. Deleted.
* smart {id, draft}: The search still exists but I can't get it to
take the words from the URL. Deleted.
UPDATED:
* dumb {cia}: Had changed its URL, and the service is down, but they
intend to restore it. Updated and kept.
* dumb {lua}: ELinks no longer supports Lua 4.0. Changed to 5.1 as
installed by Debian.
* smart {cliki, foldoc, gwho, gwhat, gwhere, gwhen, a, imdb, wn, fsd,
rfcs, cr}: Updated URLs.
Each C function that can be called as a method of an ECMAScript object
is typically listed in a spidermonkeyFunctionSpec array and has a
comment that shows the name of the array and the name of the method.
For example, elinks_alert has a comment /* @elinks_funcs{"alert"} */
because elinks_funcs[] contains an element { "alert", elinks_alert, 1 }.
When some of those functions were split into outer and inner functions
for SpiderMonkey 1.8.5 compatibility, the comments were attached to
the inner functions, which contain the bulk of the code. Move the
comments to the outer functions, to which the array elements point.
Partially revert commits
a1c5fe51 (2011-05-08) bookmark_folder_get_property: xulrunner-2.0 fix
e86ec567 (2012-03-04) Compilation fixes (--enable-debug)
jsval_to_bookmark_string once again takes jsval val, rather than jsid id.
This way, bookmark_set_property does not have to call JS_ValueToId,
which would needlessly intern the new string value of the property,
i.e. the title or the URI. Instead, bookmark_folder_get_property
has to call JS_IdToValue.
forms_item declared a variable (jsval val), passed its address to
forms_item2, and set it as the return value. However, forms_item2
could return without initializing the jsval, especially if given too
many arguments. Fix by initializing to JSVAL_VOID right away.
I'm not sure that is the correct value to return in such cases,
but at least it's better than risking a crash.
Likewise in form_elements_item and form_elements_namedItem.
Fix this warning:
Generating docs for page todo...
todo:12: warning: explicit link request to 'url' could not be resolved
The #url syntax was supposed to refer to the url member of the
containing structure, but it apparently doesn't work when @todo
copies the paragraph to a separate page.
Doxygen warned that <uri> is an unsupported xml/html tag.
It was not intended as a tag though; rather as a placeholder
akin to <var>uri</var>. Escape with a backslash.
In almost all calls to parse_header, the second argument is a string
literal: parse_header(head, "Charset", NULL) for example.
Of course, parse_header does not write to that string. Accordingly,
make the parameter point to const, so calls that use a variable rather
than a string literal can make that variable point to const too.
Leaving the other parameters non-const for now.
http_negotiate_parse_data passed &token->length as the int *outlen
parameter of base64_decode_bin, which stores an int at that location.
However, gss_buffer_desc::length is size_t in all implementations that
I checked: MIT Kerberos Version 5 Release 1.10, libgssglue 0.4, and
GNU GSS 1.0.2. This mismatch could cause the build to fail:
.../src/protocol/http/http_negotiate.c: In function ‘http_negotiate_parse_data’:
.../src/protocol/http/http_negotiate.c:173:2: error: passing argument 3 of ‘base64_decode_bin’ from incompatible pointer type [-Werror]
In file included from .../src/protocol/http/http_negotiate.c:30:0:
.../src/util/base64.h:8:16: note: expected ‘int *’ but argument is of type ‘size_t *’
On 64-bit big-endian hosts, it might also cause the GSSAPI
implementation to read too much data from memory and disclose it to
some network server, or crash ELinks.
(cherry picked from elinks-0.12 commit d33c807dd9)
unregister_options() requires as a sentinel an instance of struct
option where option.name is NULL. However, the NULL_OPTION_INFO macro
used for these sentinels actually initializes a struct option_init
instead. Make register_options() overwrite the NULL_OPTION_INFO with
a sentinel in the correct format. This probably makes a difference
only on platforms where null pointers don't have all bits zero.
(cherry picked from elinks-0.12 commit 8ac10e00d4)
l_set_option() was passing the address of an int to
option_types[OPT_INT].set and option_types[OPT_BOOL].set.
That looks correct but is not: both function pointers
point to num_set(), which actually reads *(long *) str.
Change l_set_option() to pass the address of a long instead,
and add comments about this dependency.
(cherry picked from elinks-0.11 commit 8766e3829f)
(cherry picked from elinks-0.12 commit 0797f04921)
ELinks already allowed '+' and '*' in the names of options when
reading a configuration file. The option manager however didn't
let the user add such options. Allow the characters there too.
These characters are needed especially in the mime.type tree,
where '*' is used as a replacement for '.'. For example:
set mime.type.audio.prs*sid = "sid"
set mime.type.application.atom+xml = "atom"
This commit changes one gettextised string.
(cherry picked from elinks-0.12 commit 064ff3921d)
No changes in program logic or data layout.
(cherry picked from elinks-0.12 commit 972afa1c26)
Conflicts:
src/config/options.c:
0.13.GIT has a new function get_option_shadow, now
doxygenized likewise.
INIT_OPTION used to initialize union option_value at compile time by
casting the default value to LIST_OF(struct option) *, which is the
type of the first member. On sparc64 and other big-endian systems
where sizeof(int) < sizeof(struct list_head *), this tended to leave
option->value.number as zero, thus messing up OPT_INT and OPT_BOOL
at least. OPT_LONG however tended to work right.
This would be easy to fix with C99 designated initializers,
but doc/hacking.txt says ELinks must be kept C89 compatible.
Another solution would be to make register_options() read the
value from option->value.tree (the first member), cast it back
to the right type, and write it to the appropriate member;
but that would still require somewhat dubious conversions
between integers, data pointers, and function pointers.
So here's a rather more invasive solution. Add struct option_init,
which is somewhat similar to struct option but has non-overlapping
members for different types of values, to ensure nothing is lost
in compile-time conversions. Move unsigned char *path from struct
option_info to struct option_init, and replace struct option_info
with a union that contains struct option_init and struct option.
Now, this union can be initialized with no portability problems,
and register_options() then moves the values from struct option_init
to their final places in struct option.
In my x86 ELinks build with plenty of options configured in, this
change bloated the text section by 340 bytes but compressed the data
section by 2784 bytes, presumably because union option_info is a
pointer smaller than struct option_info was.
(cherry picked from elinks-0.12 commit e5f6592ee2)
Conflicts:
src/protocol/fsp/fsp.c: All options had been removed in 0.13.GIT.
src/protocol/smb/smb2.c: Ditto.
Fix this GCC 3.4.6 warning, which becomes an error
if configure --enable-debug adds -Werror to CFLAGS:
[CC] src/document/css/apply.o
In file included from /home/Kalle/src/elinks-0.12/src/document/html/internal.h:6,
from /home/Kalle/src/elinks-0.12/src/document/css/apply.c:35:
/home/Kalle/src/elinks-0.12/src/document/html/parser.h:149: warning: parameter has incomplete type
In file included from /home/Kalle/src/elinks-0.12/src/document/css/apply.c:35:
/home/Kalle/src/elinks-0.12/src/document/html/internal.h:125: warning: parameter has incomplete type
Even without this warning, "enum html_special_type;"
would not be standard C89.
(cherry picked from elinks-0.12 commit c9f487cdf4)
Conflicts:
src/document/html/parser.h: 0.13.GIT had more #includes already.
Call get_window_title() at most once per terminal, even if it fails.
If ELinks is configured with X11 support, get_window_title() calls
XOpenDisplay(), which can sleep if $DISPLAY does not respond.
This delay was previously incurred every time ELinks changed the
title. Besides, if ELinks had already changed the title, setting
ditrm->orig_title = get_window_title(); did not make sense anyway.
(cherry picked from elinks-0.12 commit 5d4beadc4b)
Conflicts:
src/terminal/kbd.c:
get_window_title has a codepage parameter in 0.13.GIT.
(cherry picked from elinks-0.12 commit 51dc3beee7)
Conflicts:
NEWS: Both 0.12pre5.GIT and 0.13.GIT had inserted a new section.
src/terminal/window.c: Both had inserted a new function.
... and mention that URI rewriting rules may leak ELinks' identity
in the documentation of protocol.http.user_agent.
Originally requested at <https://bugzilla.redhat.com/856348>.
This reverts commit d06cccffd6.
Some people wants URL in the title bar, but some wants the title.
I restored previous version (the title). If you want the URL, create
the patch with a configurable option.
The long term goal is good looking of the Python docs in ELinks, especially
background colors. Every start tag and every text node would have associated
a natural number. Those numbers would be "drawn" in the document instead
of colors. Finally, the screen driver would change numbers into colors.
This will be done in small steps. The next step is to implement this change
in the screen driver.
Add a case for CSS_LIST_ORDINAL (and assert(0)) to the switch in
css_apply_list_style. This change should eliminate a warning from the
compiler reported by Witold that CSS_LIST_ORDINAL is not handled.
Before this change, exec_later allocates memory for the struct exec_mailcap
structure using calloc. However, the memory is freed in
exec_mailcap_command using mem_free. Change exec_later to use mem_calloc
instead of calloc.
Unless CONFIG_FASTMEM is used, mem_free expects to find debugging metadata
that only the mem_alloc family of functions store, and thus using mem_free
on the memory allocated using calloc causes a crash.
Add terminal_class, which defines a JSObject wrapper for struct terminal.
Add terminal_array_class, which defines a JSObject wrapper for accessing
the "terminals" linked list of struct terminal.
Add session_array_class, which defines a JSObject wrapper for accessing the
tabs (sessions) of a terminal.
Add pointers from struct terminal to the terminal_class object and
the session_array_class object.
Add terminal_props and terminal_get_property for terminal_class.
Add terminal_finalize, which clears the pointers between a struct terminal
and the JSObject wrapper in question.
Add smjs_init_terminal_interface, which creates a terminal_array_class
instance and assigns it to the "terminal" property on the "elinks" object.
Call smjs_init_terminal_interface from smjs_init_elinks_object.
Add smjs_get_terminal_object and smjs_get_session_array_object to get
the wrapper objects for a given struct terminal, and add
smjs_get_terminal_array_object to get a terminal_array_class object.
Add smjs_detach_terminal_object and smjs_detach_session_array_object, which
clear the pointers between a given struct terminal and its JSObject
wrappers.
Add terminal_array_get_property for terminal_array_class.
Add session_array_get_property for session_array_class.
Add session_class, which defines a JSObject wrapper for struct session.
Add location_array_class, which defines a JSObject wrapper for struct
ses_history. The "history" member of struct session is a struct
ses_history, which is a linked list of struct location.
Add a pointer from struct session to the session_class object and the
location_array object.
Add smjs_get_session_object to return a session_class JSObject wrapper for
a given struct session.
Add smjs_get_session_location_array_object to return a location_array_class
JSObject wrapper for a given struct session.
Add "session" property to the "elinks" object, which uses
smjs_get_session_object to get a JSObject wrapper for smjs_ses.
Add smjs_location_array_get_property, which allows indexing
a location_array object using a positive number for history forward or
a negative number for history backward.
Add session_props, session_get_property, session_set_property,
session_funcs, smjs_session_goto_url (which implements the "goto" method),
and smjs_init_session_interface for session_class.
Add session_construct, which creates a new tab and returns the JSObject
session_class wrapper.
Add session_finalize and smjs_location_array_finalize, which clear the
pointers between struct session and the JSObject wrappers in question.
Add smjs_detach_session_object, which clears the pointers between a given
struct session and the corresponding JSObject wrappers.
In destroy_session, call smjs_detach_session_object.
Add jsval_to_object helper in ecmascript/spidermonkey/util.h;
jsval_to_object is used in smjs_session_goto_url.
Modify delayed_goto_uri_frame to allow the target to be NULL.
smjs_session_goto_url needs this modification.
Currently, it is possible for the JSObject that wraps a struct view_state
to outlive the view_state. Using the properties of the JSObject wrapper
will then cause a crash.
This patch adds a smjs_detach_view_state_object function, which is called
in destroy_vs, to dissociate the struct view_state from the JSObject
wrapper. To this end, the patch modifies the struct view_state to point
the JSObject wrapper. smjs_get_view_state_object will use this pointer
if it is set, and copy_vs will copy this pointer to the new view_state.
The patch also modifies view_state_get_property and
view_state_set_property to return immediately if the view_state has been
destroyed. Finally, the patch adds a finalizer (view_state_finalize)
that clears the pointer from the struct view_state to the JSObject.
After recent simplifications, the jsobj variable is no longer necessary.
Instead of assigning it a value and then returning it, just return the
value that was being assigned to it.
Add elinks_get_property and elinks_set_property functions and
a JSPropertySpec elinks_props table to handle properties rather than
defining eilnks_get_home, elinks_get_location, and elinks_set_location
and adding them individually to the class using JS_DefineProperty.
This approach will make it easier to add further properties.
Currently, elinks_alert assumes that smjs_ses is not NULL and crashes if
it is. Change elinks_alert to check whether smjs_term is NULL, try
get_default_terminal if so, and fall back on printing to stderr using
usrerror if no terminal is found.
In smjs_load_uri, check whether the the given URI string is empty. If it
is, return JS_FALSE right away rather than continuing on and passing
get_uri an empty string, which triggers an assertion failure later on.
read_http_post_inline decodes two hexadecimal digits into one byte at
a time, and it asserts that each hexadecimal digit is valid; however,
both assertions print the first digit when they fail. Fix the assertion
on the second digit to print the second digit.
Currently, the function try_form_insert_mode checks whether the current
link is a text area, insert mode is off, and the current action is enter,
and if so, it sets insert mode on. Perform this work in enter instead,
and delete try_form_insert_mode.
The old code works as follows: send_kbd_event → send_to_frame
→ frame_ev → frame_ev_kbd → try_form_insert_mode. The new code works
as follows: send_kbd_event → do_action → enter.
Currently, using smjs_load_uri on javascript: URIs cause an assertion
failure in run_connection because smjs_load_uri uses
get_protocol_handler to find the handler and asserts that the returned
handler is not NULL, but get_protocol_handler returns NULL for
javascript: URIs.
In smjs_load_uri, if the given URI has a protocol for which some
external handler is defined, immediately return JS_FALSE because
smjs_load_uri implements an asynchronous operation, and we cannot
reasonably carry out the operation and callback with an external
handler.
Recognise the list-style property and apply it by setting the
appropriate flag on the element's parattr based on the property's value.
Add test/list-style.html with an example of each possible list-style
value (many are unsupported by the HTML engine).
In follow_url, do not call the follow-url hook if the URI encodes a POST
request. If scripts try to change such a URI, they can corrupt it and
cause problems later on.
This change can be reverted later when the URI structure is changed not
to store the POST data in the URI string.
Using the RFC 3546 server_name TLS extension with TLS 1.1 made
https://bugzilla.novell.com/ never respond to negotiation.
Disable TLS 1.1 with GnuTLS, like it has already been disabled with
OpenSSL. And if an SSL error is detected, disable TLS 1.2 as well.
I was trying to check which charset WIDGET_TEXT uses in the buffer but
had difficulty finding the code that handles key presses and updates
the buffer. These comments should make that easier in the future.
In bookmark_folder_get_property, convert the jsid value into
a jsval value before passing it to jsval_to_bookmark_string.
This commit fixes a bug in the xulrunner-2.0 compatibility changes
of commit 2844f8b715, which rendered
the bookmarks scripting interface for SpiderMonkey nonfunctional.
src/network/ssl/ssl.c defined some constant arrays for passing to
GnuTLS functions. Those functions have been deprecated and their
calls are in #if 0 nowadays. Put #if 0 around the arrays as well.
The URL in <meta http-equiv="Refresh" content="42; URL=target.html">
can now freely contain spaces and semicolons. There cannot be other
parameters between the delay and the URL. If the URL is not quoted,
then it spans to the end of the attribute, except not to trailing
spaces. If the URL is quoted, then it ends at the first closing
quotation mark. All this is consistent with Debian Iceweasel 3.5.16.
The HTML parser decoded SGML entity references and numeric character
references in the following attributes, and then the renderer did the
same again:
link/@title
link/@hreflang
link/@type
link/@media
img/@alt
area/@alt
input[@type="image"]/@alt
input[@type="image"]/@name
input[@type="button"]/@value
The result was that e.g. title="&#65;" displayed as "A"
even though it was supposed to display as "A".
Fix by making the HTML parser tell the renderer that the entities have
already been decoded.
The deprecated gnutls_certificate_verify_peers function returns -1
if it fails, or a set of gnutls_certificate_status_t bits; each bit
indicates some kind of problem, so the result is zero if the
certificate is OK.
The newer gnutls_certificate_verify_peers2 function returns -1 if it
fails, or 0 if it succeeds; and writes the status bits via a pointer.
When using that function, ELinks must check the status separately.
Do that.
Also, if GnuTLS is not being used, do not declare a status variable,
because leaving it unused would break the debug build:
/home/Kalle/src/elinks-0.13/src/network/ssl/socket.c: In function ‘ssl_want_read’:
/home/Kalle/src/elinks-0.13/src/network/ssl/socket.c:87: error: unused variable ‘status’
/home/Kalle/src/elinks-0.13/src/network/ssl/socket.c: In function ‘ssl_connect’:
/home/Kalle/src/elinks-0.13/src/network/ssl/socket.c:121: error: unused variable ‘status’
Make u2cp_() map code points U+0080 to U+009F via strange_chars[] even
if the target codepage is UTF-8. This helps with buggy web pages that
use ’ when they mean ’. This change does not affect how
ELinks decodes raw bytes 0x80 to 0x9F in HTML.
u2cp_() is used only via the u2cp and u2cp_no_nbsp macros.
Possible side effects of this change at each use of these macros:
* get_translation_table(): Not affected because it does not call u2cp
if the target codepage is UTF-8.
* get_entity_string(): Numeric character references are affected, as intended.
Character entity references are not affected because entities[]
does not define any entities in the U+0080...U+009F range.
* kbd_field(), term_send_ucs(), field_op(): Affected. It is no longer
possible to enter code points U+0080...U+009F from the terminal.
This should not be a problem in practice because those would be
control characters anyway and should therefore be filtered by the
slave process (which doesn't yet recognize them; bug 777).
If ELinks was configured --without-x, the build failed at
xprop_to_string:
.../src/osdep/osdep.c:500: error: expected ‘)’ before ‘*’ token
Fix by moving xprop_to_string into the #ifdef HAVE_X11 section.
Reported by Thomas Adam.
If Xutf8TextPropertyToTextList or XmbTextPropertyToTextList returns a
positive number, that means some characters were unconvertible and
have been replaced with XDefaultString(). Use the resulting string
even in that case, as if the function had returned Success.
The previous version ignored the string and didn't even free it.
gnome-terminal 2.30.2 expects UTF-8 in the "OSC Ps ; Pt BEL" sequence
that sets the window title. However, XGetWMName typically returns the
title in "STRING" (Latin-1) or "COMPOUND_TEXT" (escape sequences)
encoding. Recode the title to restore it correctly. This helps
especially in the fi_FI.UTF-8 locale, where gnome-terminal has "Pääte"
as the default title.
Related to bugs 885 and 336.
Try to make the code a little clearer by pulling try_menu out of
send_kbd_event. try_menu calls the BFU code and tells send_kbd_event
whether the BFU code did something with the event (i.e. opened a menu)
or whether the event still needs to be handled.
With document.browse.accesskey.priority = 0, accesskeys were ignored if
the current tab was not the last (rightmost) tab. This commit fixes the
problem.
Add a function tabs_are_on_top(struct terminal *) which returns
a Boolean value indicating whether the topmost window is a tab (as
opposed to, e.g., a menu).
This commit fixes commit 1bd498cde9.
Use check_vs instead of set_pos_x and set_pos_y in fixup_typeahead_match.
This saves us a line of code, and in addition, check_vs does not needlessly
scroll when the link is already in view.
Make set_kbd_repeat_count update the status bar and link highlighting
iff the repeat count is changed to a different value.
Delete code to do the same updates from do_action and try_prefix_key.
Besides simplifying the code, this change also fixes some issues with
the status bar and link highlighting not being properly updated in some
situations.
Introduce and use ses_kbd_repeat_count to change
ses->kbdprefix.repeat_count instead of setting it directly.
This change should not cause any change in behaviour.
Add an option to specify the number of overlapping lines when scrolling
page by page (0 by default because this is ELinks' current behaviour).
Signed-off-by: Fabienne Ducroquet <fabiduc@gmail.com>
than 2GiB in the download dialog. Also let regetting big files.
Previously the Content-Length variable in http.c was int, what is
not enough. Now it is long long.