1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-11-04 08:17:17 -05:00
Commit Graph

2814 Commits

Author SHA1 Message Date
Miciah Dashiel Butler Masters
416d7fac7d css_apply_list_style: fix compiler warning
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.
2011-11-16 16:58:08 +00:00
Miciah Dashiel Butler Masters
e37caa01ec exec_later: use mem_calloc instead of calloc
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.
2011-11-15 20:14:14 +00:00
Miciah Dashiel Butler Masters
c74ddb29c5 SMJS: add terminal object
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.
2011-11-14 04:34:51 +00:00
Miciah Dashiel Butler Masters
cdad9adf19 SMJS: add session object
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.
2011-11-14 04:34:51 +00:00
Miciah Dashiel Butler Masters
3932af9b17 SMJS: handle view_state outliving wrapping object
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.
2011-11-14 04:34:51 +00:00
Miciah Dashiel Butler Masters
211c624aca smjs_get_elinks_object: drop jsobj temp variable
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.
2011-11-14 04:34:51 +00:00
Miciah Dashiel Butler Masters
54c33284fc elinks_get_property: return empty string if no URI
For the elinks.location property, if elinks_get_property fails to find
a URI, just return the empty string rather than returning an error.
2011-11-14 04:34:51 +00:00
Miciah Dashiel Butler Masters
e092b6b08b SMJS: refactor elinks object's property handlers
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.
2011-11-14 04:34:51 +00:00
Miciah Dashiel Butler Masters
68801b7382 elinks_object: use usrerror if there is no term
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.
2011-11-14 04:34:51 +00:00
Miciah Dashiel Butler Masters
e310843a2a smjs_load_uri: check for empty URI
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.
2011-11-14 04:34:51 +00:00
Miciah Dashiel Butler Masters
f8bdc3ca9e read_http_post_inline: fix assertion-failed message
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.
2011-11-14 04:34:50 +00:00
Miciah Dashiel Butler Masters
daa6f36e83 Perform the work of try_form_insert_mode in enter
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.
2011-11-14 04:34:50 +00:00
Miciah Dashiel Butler Masters
a3918d8c30 cache_entry_get_property: fix assertion failure
In cache_entry_get_property, don't assert the return value from
get_cache_fragment; instead, just return JS_FALSE if the value is NULL.
2011-11-14 04:34:50 +00:00
Miciah Dashiel Butler Masters
da209c6b6f smjs_load_uri: return if there is an external handler
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.
2011-11-14 04:34:50 +00:00
Miciah Dashiel Butler Masters
bdeace4811 keymap_set_property: xulrunner-2.0 fix
In keymap_set_property, convert the jsid value into a jsval value before
calling JS_ValueToString on it.
2011-11-14 04:34:50 +00:00
Miciah Dashiel Butler Masters
0189b6bfc9 Add support & test for the CSS list-style property
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).
2011-11-14 04:34:50 +00:00
Miciah Dashiel Butler Masters
4eb7827fe5 Call follow-url hook on redirects
In redirect_cache, call the follow-url hook so that scripts can modify
URIs in redirects.
2011-11-14 04:34:50 +00:00
Miciah Dashiel Butler Masters
56f1b5d834 follow_url: do not pass POST requests to scripts
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.
2011-11-14 04:34:50 +00:00
witekfl
3d4fe9c4d2 Always do reload after submitting forms.
In fact, it does reload after pressing any button, but it should not
hurt. To remember to press 'x' for submitting forms was too hard.
2011-11-12 15:17:53 +01:00
witekfl
d06cccffd6 Show the URI in the title bar even if document title is set.
ECMAcript's window.title overrides this.
2011-10-18 20:57:32 +02:00
witekfl
c656c5c929 Pass -Wno-uninitialized for the gettext compilation.
The compilation --with-debug failed on the plural.c.
2011-10-08 12:07:02 +02:00
witekfl
0e5822edae Memorize the auth form only when the "document.browse.forms.show_formhist" is on. 2011-10-06 10:54:11 +02:00
witekfl
ddc0d8d7be Use formhist for 401 Unauthorized and others. 2011-10-05 22:42:41 +02:00
Petr Baudis
9a001f051a Remove variables that were set but not used
Required to make new gcc with default warning settings happy.
2011-09-24 02:25:51 +02:00
Petr Baudis
69a226eba1 find_clonable_bittorrent_peer_request(): Remove likely wrong inner clone declaration 2011-09-24 02:21:59 +02:00
Petr Baudis
b9fb1d3c7d menu_keys(): Do not compare different enums 2011-09-24 02:10:54 +02:00
Kalle Olavi Niemitalo
0c3f3e09a7 1024: Verify server certificate hostname with OpenSSL
Not tested with nss-compat-ossl.
2011-07-28 17:23:51 +03:00
Kalle Olavi Niemitalo
7c40e03421 1024: Always disable TLS1.1 with GnuTLS
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.
2011-07-28 17:23:51 +03:00
Kalle Olavi Niemitalo
6c84978cf5 1024: Use RFC 3546 server_name TLS extension
For both GnuTLS and OpenSSL.  Not tested with nss-compat-openssl.
2011-07-28 17:23:51 +03:00
Kalle Olavi Niemitalo
5d0e4e2452 1024: Reject OpenPGP certificates 2011-07-28 17:23:51 +03:00
Witold Filipczyk
a15216863f 1024: Verify hostname and expiration time of the certificate.
GnuTLS only.

[ From bug 1024 attachment 483.  Resolved conflicts with 0.13.GIT.  --KON ]
2011-07-28 17:23:51 +03:00
witekfl
eb4e5d7e0d Revert "Do not try to use gpm in X11."
This reverts commit 8183aecd90.
2011-07-06 13:41:41 +02:00
witekfl
ab8fa8daed Revert "redraw_terminal_cls instead of redraw_terminal in delete_window."
This reverts commit 03c698e926.
2011-07-06 13:23:30 +02:00
witekfl
8183aecd90 Do not try to use gpm in X11.
X11 is detected by checking DISPLAY variable.
Without this ELinks stopped on reading from /dev/gpmctl.
2011-07-06 13:19:09 +02:00
witekfl
03c698e926 redraw_terminal_cls instead of redraw_terminal in delete_window.
On http://pcarena.pl/ the msgbox is shown saying,
that document.getElementById is not a function.
The "ghosts" remained after pressing OK.
2011-06-17 14:33:46 +02:00
witekfl
81c9f462c2 Deleted ecmascript code using SEE.
AFAIK SEE is no longer developped.
I see no reason to use SEE in ELinks.
2011-05-11 11:31:15 +02:00
Kalle Olavi Niemitalo
ad9c144e5c BFU: Add comments in enum widget_type
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.
2011-05-09 23:28:12 +03:00
Kalle Olavi Niemitalo
dd608c500b BFU: Document additional data in struct dialog 2011-05-09 23:28:12 +03:00
Miciah Dashiel Butler Masters
a1c5fe518b bookmark_folder_get_property: xulrunner-2.0 fix
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.
2011-05-08 03:04:10 +00:00
Kalle Olavi Niemitalo
5ddf20b85e GNUTLS: Make anon_cred and xcred static
anon_cred and xcred are defined in src/network/ssl/ssl.c and not
mentioned in any other file.  Make them static.
2011-05-02 14:55:17 +03:00
Kalle Olavi Niemitalo
6457a13005 GNUTLS: #if 0 arrays needed by deprecated functions
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.
2011-05-02 14:55:17 +03:00
Kalle Olavi Niemitalo
8a89a627bc SMJS: Define XP_UNIX and others as 1, not as empty
This change is intended to prevent a macro redefinition warning
if CFLAGS already contains -DXP_UNIX from pkg-config --cflags mozilla-js.
2011-05-01 23:41:44 +03:00
Kalle Olavi Niemitalo
e22eae2e93 HTML: Rewrite parsing of meta refresh
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.
2011-05-01 22:59:23 +03:00
Kalle Olavi Niemitalo
715571a5d6 HTML bug 1114: Don't doubly decode entities in attributes
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="&amp;#65;" displayed as "A"
even though it was supposed to display as "&#65;".

Fix by making the HTML parser tell the renderer that the entities have
already been decoded.
2011-05-01 22:54:45 +03:00
Kalle Olavi Niemitalo
2d8fd9cecf bug 1115: Check status after gnutls_certificate_verify_peers2
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’
2011-05-01 02:27:19 +03:00
witekfl
b228fe82ab bug 1115: Avoid deprecated functions when compile --with-gnutls 2011-04-28 18:21:40 +02:00
witekfl
5a99cca30b gcry_create_nounce is part of libgcrypt.
Lack of -lgcrypt caused linking error when compiled --with-gnutls.
2011-04-28 18:02:00 +02:00
witekfl
218a2250a7 SpiderMonkey: fix issue with javascript:history.back()
In history.back() and others set rval to NULL.
Do not convert NULL to string in spidermoney_eval_stringback.
2011-04-25 21:04:03 +02:00
witekfl
2844f8b715 JS_VERSION at least 185 is required for ECMASCript (xulrunner-2.0 or later)
The code wasn't tested. It compiles
2011-04-19 22:41:05 +02:00
Kalle Olavi Niemitalo
9e4d7d1883 mailcap bug 1113: Don't leak values of duplicate fields
If a mailcap entry has two test commands or two descriptions,
free the first one before replacing it with the second one.
2011-04-17 21:26:08 +03:00