1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-09-29 03:17:53 -04:00
Commit Graph

204 Commits

Author SHA1 Message Date
Kalle Olavi Niemitalo
2437d35904 Merge commit 'pasky.or.cz/elinks-0.12' into elinks-0.13
There were conflicts in src/document/css/ because 0.12.GIT switched
to LIST_OF(struct css_selector) and 0.13.GIT switched to struct
css_selector_set.  Resolved by using LIST_OF(struct css_selector)
inside struct css_selector_set.
2007-07-28 03:22:29 +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
eccc8c23f0 Merge with http://elinks.cz/elinks.git#elinks-0.12 2007-07-09 16:03:06 +03:00
Kalle Olavi Niemitalo
1ea44dcda5 Bug 957: if_assert_failed in ecmascript_put_interpreter.
[ Forward ported from commit 566039624f
  in ELinks 0.11.3.GIT.  --KON ]
2007-07-02 23:46:54 +03:00
Kalle Olavi Niemitalo
871a1befad Bug 755: Save the form_state index in a reserved slot, not as private data.
The previous code cast the integer (long actually) to void * and gave
that to JS_SetPrivate.  This did not work because JS_SetPrivate
expects pointers to be aligned and replaces the least significant bit
with a tag.  By using JS_SetReservedSlot instead, we get control of
the jsval conversions and can store the integer properly.
2007-06-24 18:46:22 +03:00
Witold Filipczyk
057c3be77c bug 957 fixed. 2007-06-21 22:33:19 +03:00
Kalle Olavi Niemitalo
58e3ebf2e7 Bug 957: Assert that the ECMAScript interpreter is not running.
Add ecmascript_interpreter.backend_nesting, increment it when
beginning to evaluate an expression, and decrement it when evaluation
finishes.  Then assert that it is zero in ecmascript_put_interpreter.
This detects bug 957 and similar ones before they corrupt memory.
2007-06-21 21:34:36 +03:00
Kalle Olavi Niemitalo
c7b3a8c423 SEE: Always use SEE_no_enumerator instead of NULL.
Although <see/object.h> of SEE 2.0.1131 has a comment saying that
SEE_objectclass.enumerator is optional and may be left NULL, SEE
crashes if one tries to enumerate the properties of an object created
from such a class.  Conveniently, it provides a suitable stub function.

http://www.adaptive-enterprises.com.au/bugs/show_bug.cgi?id=75
2007-06-10 15:10:32 +03:00
Kalle Olavi Niemitalo
c9b2fbbd46 SMJS: Fix error "forms.namedItem is not a function".
Commit 63752c854b303f5f58636a512a137bf3702e051b on 2004-12-27
seems to have broken this.
2007-06-10 13:11:53 +03:00
Kalle Olavi Niemitalo
619c90588d SMJS: Correct sense of JS_ValueToInt32 return value test.
I made this bug in commit b53525e98e.
2007-05-30 03:11:27 +03:00
Witold Filipczyk
ac3608bda0 ECMAScript: evaluating onclick, onsubmit etc. done in the right way.
Scripts such as onsubmit are called as a function not as a script.

[ From commit 688ca8cf31 on the witekfl
  branch.  --KON ]
2007-05-30 02:35:18 +03:00
Witold Filipczyk
e741932d58 SEE: Renamed ELinks functions with the "SEE" prefix to distinguish them
from SEE functions.

[ Backported from commit c5b102ba08 on
  the witekfl branch.  --KON ]
2007-05-30 02:35:06 +03:00
Kalle Olavi Niemitalo
26766defe7 SMJS: Assert that form_number of input_class is in range. 2007-05-27 19:18:44 +03:00
Kalle Olavi Niemitalo
33b5884821 SEE: Assert that js_input.form_number is in range. 2007-05-27 19:10:44 +03:00
Kalle Olavi Niemitalo
a38b22b356 SEE: Define the synthetic argv as an array.
This does not change the behaviour but perhaps makes the code clearer.
2007-05-27 18:53:31 +03:00
Kalle Olavi Niemitalo
9743729cb1 SMJS: comment changes 2007-05-27 18:36:31 +03:00
Kalle Olavi Niemitalo
99f648b911 SMJS: Use JS_GetInstancePrivate where applicable.
This is a further precaution against reading a pointer from the wrong
type of object.  All of the JS_GetPrivate calls were already protected
with JS_InstanceOf checks if assertions are enabled, and many of them
also if assertions are not enabled.
2007-05-27 18:32:53 +03:00
Kalle Olavi Niemitalo
b53525e98e SMJS: Check return values of JS_ValueToInt32. 2007-05-27 18:09:37 +03:00
Witold Filipczyk
ecc03ad608 bug 755: Fixed.
Remember the index of struct form_state in vs->form_info
instead of the pointer to it. The pointer may change,
the index is persistent.
The field ecmascript_obj of the struct form_state is unused.
2007-05-27 14:44:46 +03:00
Witold Filipczyk
d43fe19224 SEE: bug 755 doesn't occur. 2007-05-27 14:44:35 +03:00
Witold Filipczyk
b53aa7812a ecmascript: Convert numbers using JS_ValueToInt32. 2007-05-27 14:44:28 +03:00
Witold Filipczyk
984613ade1 bug 755: attempt to fix this bug. 2007-05-27 14:44:20 +03:00
Kalle Olavi Niemitalo
5e83337d49 Bug 784: Keep form_control.default_value in the document charset.
Previously, html_special_form_control converted
form_control.default_value to the terminal charset, and init_form_state
then copied the value to form_state.value.  However, when CONFIG_UTF8
is defined and UTF-8 I/O is enabled, form_state.value is supposed to
be in UTF-8, rather than in the terminal charset.

This mismatch could not be conveniently fixed in
html_special_form_control because that does not know which terminal is
being used and whether UTF-8 I/O is enabled there.  Also, constructing
a conversion table from the document charset to form_state.value could
have ruined renderer_context.convert_table, because src/intl/charsets.c
does not support multiple concurrent conversion tables.

So instead, we now keep form_control.default_value in the document
charset, and convert it in the viewer each time it is needed.  Because
the result of the conversion is kept in form_state.value between
incremental renderings, this shouldn't even slow things down too much.

I am not implementing the proper charset conversions for the DOM
defaultValue property yet, because the current code doesn't have
them for other string properties either, and bug 805 is already open
for that.
2007-04-29 22:01:13 +03:00
Laurent MONIN
0b98c5051b Fix trailing whitespaces 2007-04-26 15:02:04 +02:00
Laurent MONIN
90980a944e Mark all module names for translation and include needed header files. 2007-03-21 11:01:06 +01:00
Kalle Olavi Niemitalo
7645a836fc Cast the NULL argument of straconcat to unsigned char *.
straconcat reads the args with va_arg(ap, const unsigned char *),
and the NULL macro may have the wrong type (e.g. int).

Many places pass string literals of type char * to straconcat.  This
is in principle also a violation, but I'm ignoring it for now because
if it becomes a problem with some C implementation, then so will the
use of unsigned char * with printf "%s", which is so widespread in
ELinks that I'm not going to try fixing it now.
2007-03-11 12:59:11 +02:00
Kalle Olavi Niemitalo
801d520ddd Fix compiler errors without HAVE_VARIADIC_MACROS. 2007-03-11 12:22:02 +02:00
Witold Filipczyk
cf86e2e72f Added SEE_CFLAGS to the Makefile.config. Use SEE_CFLAGS only when necessary. 2007-02-18 17:09:32 +02:00
Kalle Olavi Niemitalo
92d079de82 Set ecmascript.enable = 0 by default.
ECMAScript support is still considered experimental, and there are
several known vulnerabilities (bugs 548, 755, 771).
2006-12-29 23:24:42 +02:00
Kalle Olavi Niemitalo
49c3c89dcb Add an initial comment as commanded in doc/hacking.txt. 2006-12-23 01:44:26 +02:00
Kalle Olavi Niemitalo
846a8f9a4e Bug 846, SEE: Add checktype.c and checktype.h.
These should have been in commit 8bc3d7a798.
2006-12-10 17:12:27 +02:00
Kalle Olavi Niemitalo
8bc3d7a798 Bug 846, SEE: Check thisobj->objectclass before casting. 2006-12-10 01:09:06 +02:00
Kalle Olavi Niemitalo
d731fe2db0 Renumber all tinyids of SMJS properties to negative integers.
This change does not fix any bug, but the SMJS builtin classes use
negative tinyids already, so I presume this is the preferred practice.
At least it means the tinyids won't have to be renumbered later if
some of these objects are changed to behave as arrays.
2006-12-06 23:09:14 +02:00
Kalle Olavi Niemitalo
7894e30ace Bug 870: Don't panic if an SMJS property ID is unrecognized.
If ECMAScript code does obj[42], then the getProperty or setProperty
function of the JSClass of obj gets 42 as the property ID and must not
treat that as an internal error.
2006-12-03 12:07:07 +02:00
Kalle Olavi Niemitalo
aa410301f1 Bug 846: {get,set}Property check JS_InstanceOf without asserting.
The getProperty and setProperty functions of a JSClass must not assume
that the obj parameter points to an instance of that class.  It might
instead point to another object that merely has an instance of the
class in its prototype chain.  Thus, do not assert that JS_InstanceOf
returns true there.  Instead, run the check even with CONFIG_FASTMEM,
and just return JS_FALSE if it fails.
2006-12-03 11:17:48 +02:00
Kalle Olavi Niemitalo
bddafe5f7e Document how timer callbacks erase timer IDs; add some assertions.
Tangential to bug 868.
2006-12-02 18:35:03 +02:00
Kalle Olavi Niemitalo
7e52d23d2f Bug 846: Document the expected parents of form_elements_class instances.
This should have been in commit 36f5f73a60.
The corresponding commit e76e047196 in the
REL_0_10 branch does include it.
2006-11-26 17:35:33 +02:00
Kalle Olavi Niemitalo
47dce0922b Bug 846: Add plenty of JS_InstanceOf assertions and checks. 2006-11-25 16:09:38 +02:00
Kalle Olavi Niemitalo
bbf0d478e9 Bug 846: Separate JS_GetParent & JS_GetPrivate calls from initializations.
This will allow the types of objects to be checked before those calls.
2006-11-25 15:55:25 +02:00
Kalle Olavi Niemitalo
98a120b3d5 Bug 846: Rename some local variables.
Rename parent to parent_win if it points to an instance of window_class.
2006-11-25 14:57:44 +02:00
Kalle Olavi Niemitalo
356678dd80 Bug 846: Document the JSClass assumed in each JS_{Set,Get}Private call. 2006-11-25 14:52:58 +02:00
Kalle Olavi Niemitalo
36f5f73a60 Bug 846: Document the expected parents of SMJS class instances. 2006-11-25 14:42:20 +02:00
Kalle Olavi Niemitalo
670ad939c3 Bug 846: Comments on the relations between JSClasses and functions. 2006-11-25 13:36:28 +02:00
Kalle Olavi Niemitalo
d6ea143f36 Bug 846: Document the private data in each SMJS class. 2006-11-25 13:19:35 +02:00
Petr Baudis
eab3cb762f ECMAScript: Fix a leak in case of setTimeout(..., 0)
identified by Jonas seconds after I pushed the original fix out. *blush*
2006-11-23 01:24:56 +01:00
Petr Baudis
e66b6737db ECMAScript: Fix crash on setTimeout(..., 0) 2006-11-21 08:01:36 +01:00
Petr Baudis
8ecf87b7b7 setTimeout: Fix da assert
Yeah, Miciah, I'm an idiot, don't walk around the fact.
2006-11-05 01:13:29 +01:00
Petr Baudis
da5ec748b6 setTimeout: kill previous timer when planting a new one
Otherwise if the page installs multiple timers the old one would live
on unreferenced and possibly (likely) trigger after the document's death
and everything would go to hell.
2006-11-05 00:53:04 +01:00
Petr Baudis
74997f772c setTimeout: A more sensibel assert 2006-11-05 00:35:04 +01:00
Petr Baudis
a3a85ef453 setTimeout: Second try to fix timer crashes 2006-11-04 13:20:29 +01:00
Petr Baudis
847feea09e setTimeout: Kill timer when it timed out, fixes random crashes 2006-11-03 20:18:31 +01:00
Miciah Dashiel Butler Masters
6a53f92179 SMJS (doc): Don't signal an error when assigning to window.status 2006-10-26 20:30:26 +00:00
Witold Filipczyk
f4e66f1fc6 ECMAScript: added writeonly property window.status 2006-10-24 20:41:25 +02:00
Witold Filipczyk
6e08e1bf5d ECMAScript: Probably superfluous kill_timer. Removed unused include. 2006-10-24 19:10:10 +02:00
Witold Filipczyk
2fe0623298 Moved the setTimeout timer to the struct document. 2006-10-24 16:47:41 +02:00
Witold Filipczyk
c76ce39a87 SpiderMonkey: added setTimeout. 2006-10-24 15:52:44 +02:00
Witold Filipczyk
e5e6727e81 SEE: setTimeout is a window object method. 2006-10-24 15:33:14 +02:00
Witold Filipczyk
cc4d02b0ae SEE: Added setTimeout function. 2006-10-23 22:45:55 +02:00
Witold Filipczyk
86bc6a534b Should be visible not location. 2006-09-26 19:40:59 +02:00
Witold Filipczyk
c961564d0b SEE: use keystr as return value. Killed warning. 2006-09-03 13:21:23 +02:00
Kalle Olavi Niemitalo
8850d85998 ECMAScript: If accessKey is a surrogate, throw an error when reading it.
Surrogates are now treated the same way as out-of-range characters
like U+110000; if a link has such an access key, then the ECMAScript
accessKey property cannot be read.  It seems currently impossible to
set such an access key though, because accesskey_string_to_unicode()
doesn't support multibyte characters yet.
2006-08-27 11:45:11 +03:00
Kalle Olavi Niemitalo
38fe5b72f7 Define and use macros for handling UTF-16 surrogates. 2006-08-24 23:30:41 +03:00
Kalle Olavi Niemitalo
2d898272c1 ECMAScript: Preserve all of Unicode when setting the accessKey property.
Well, almost all.  U+0000 cannot be used because ELinks thinks that
means the link has no access key.
2006-08-20 17:40:27 +03:00
Kalle Olavi Niemitalo
45b194d1e7 ECMAScript: Fix previous careless SEE changes. 2006-08-20 17:36:06 +03:00
Kalle Olavi Niemitalo
00a5b88371 ECMAScript: Preserve all of Unicode when reading the accessKey property.
Setting the property does not yet support Unicode.
2006-08-20 13:37:03 +03:00
Witold Filipczyk
b1c8eb5572 SEE: use periodic callback. SEE engine passes infinite test 2006-08-12 19:07:16 +02:00
Witold Filipczyk
19315e136e Ecmascript: the code adjusted for SEE-2.0 2006-08-12 18:43:31 +02:00
Witold Filipczyk
2d9e28bd68 Used dir_sep instead of hard coded '/' 2006-07-09 13:02:44 +02:00
Laurent MONIN
5acb5e6663 Trim trailing whitespaces. 2006-05-31 19:34:49 +02:00
Witold Filipczyk
9f69170c2a fixup_select_state was unnecessary 2006-05-02 12:56:05 +02:00
Witold Filipczyk
cdd86d3c20 Ecmascript: write to the variable selectedIndex. Not tested 2006-05-02 11:28:41 +02:00
Witold Filipczyk
d9d6bc23ae Ecmascript: introduced selectedIndex 2006-05-02 09:36:23 +02:00
Witold Filipczyk
c540a9ed63 Ecmascript: more id checks 2006-05-01 19:55:43 +02:00
Witold Filipczyk
8761bf04a9 Ecmascript: check also id, not only name of form controls. This is required
by scripts at http://www.ecs.com.tw/
2006-05-01 19:37:54 +02:00
Witold Filipczyk
dc8f89e5b1 SEE: see_eval_stringback returns either string when SEE_value is string
or NULL otherwise. At www.ecs.com.tw hyperlinks didn't "work".
When document.browse.forms.confirm_submit is 1 there is a problem with
big dialog box.
2006-04-15 19:22:38 +02:00
Witold Filipczyk
3feb4a55a4 SEE: window.navigator is alias for navigator 2006-04-13 22:47:32 +02:00
Witold Filipczyk
83d0d6f84a Fixed the memleak 2006-04-02 17:57:12 +02:00
Witold Filipczyk
c571aea567 Ecmascript: 8 last urls opened by window.open() remembered in a safer way. 2006-04-02 17:00:55 +02:00
Miciah Dashiel Butler Masters
d7a964efaf SMJS: fix segfault on exit
Create and immediately destroy a context when initialising the SMJS
document scripting module, because SMJS crashes on exit if there has
been no context created since it started, which is the case if one does
not load any documents.
2006-03-26 20:28:25 +00:00
Witold Filipczyk
dc075685ae ECMAScript: better handling of set action 2006-03-21 18:45:40 +01:00
witekfl
30a60caa12 SpiderMonkey: do not remember context. Maybe this time it won't hung. 2006-03-01 18:17:16 +01:00
Miciah Dashiel Butler Masters
4b3d88dd6e Delegate ECMAScript submodule initialisation the right way
Replace the ECMAScript module initialisation and de-initialisation
routines that wrapped the SMJS and SEE module initialisation and
de-initialisation routines by having the module system call the SMJS
and SEE routines its own darned self.
2006-02-26 08:51:36 +00:00
Miciah Dashiel Butler Masters
a464157d4d SEE & SMJS: document.write(ln): use all arguments
Additionally add a test to test/ecmascript/document_write.html.

Thanks to Kirk Reiser for observing that ELinks only printed the first.
2006-02-12 04:33:42 +00:00
Miciah Dashiel Butler Masters
7b092af628 SEE: document.writeln: always add new line
Add the new-line character even if SEE_value_to_unsigned_char returns
NULL.
2006-02-12 04:25:10 +00:00
witekfl
10589b04eb Base href was lost while setting form->action by ECMAScript. This is
attempt to fix it
2006-02-09 22:50:30 +01:00
witekfl
d267fcc747 SpiderMonkey: Handling both 'document.location.href ='
and 'document.location ='
2006-02-01 09:31:26 +01:00
witekfl
3c0c912198 SpiderMonkey: target was not set 2006-01-31 13:03:17 +01:00
Miciah Dashiel Butler Masters
db9768963f Merge with git+ssh://pasky.or.cz/srv/git/elinks.git
git+ssh://pasky.or.cz/srv/git/elinks.git
2006-01-30 15:42:03 +00:00
b4d9b7f5a6 Make SpiderMonkey consistent with SEE. Do not cache ecmascript_objs 2006-01-30 11:15:04 +01:00
44710bb1e9 The same trick as in SEE: Remember last 8 locations and do not open
them again
2006-01-30 10:47:24 +01:00
Miciah Dashiel Butler Masters
be07858b2b Refactor the document.write routines
Factor js_document_write_do out of js_document_write and
js_document_writeln and document_write_do out of document_write and
document_write_ln.
2006-01-28 20:39:07 +00:00
645689f1aa I have no idea why it is still crashing. This is last attempt
today to fix it
2006-01-28 19:57:40 +01:00
71871edd43 Maybe this time it won't crash 2006-01-28 17:08:45 +01:00
7c7541f4d1 parent, self and top are the same since now 2006-01-28 14:15:55 +01:00
9cc9db4e24 Handling onsubmit 2006-01-28 11:17:22 +01:00
9c9fa1d81c Defined document.write and document.writeln for SEE 2006-01-27 14:55:53 +01:00
8bf45d0ece Spidermonkey's document.write and document.writeln defined. They work,
but rendering doesn't work
2006-01-27 13:29:38 +01:00
62d42380f8 Added ret param for document.write 2006-01-27 12:07:45 +01:00
6761b3995d Avoided code duplication 2006-01-27 10:08:19 +01:00
witekfl
e5dbbff398 Set returned value. 2006-01-25 22:22:10 +01:00