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

628 Commits

Author SHA1 Message Date
Witold Filipczyk
a456f3824d [spidermonkey] location_finalize 2021-10-12 17:56:47 +02:00
Witold Filipczyk
b4db207725 [ecmascript] window_finalize 2021-10-11 19:21:12 +02:00
Witold Filipczyk
f5463b8758 [document] document_finalize 2021-10-10 15:03:03 +02:00
Witold Filipczyk
8eaef2f5c4 [element] finalizers for debug purposes 2021-10-08 20:27:05 +02:00
Witold Filipczyk
33d8c551ea [ecmascript] debug in check_for_rerender 2021-10-07 18:27:21 +02:00
Witold Filipczyk
8c7223882a [typedef] _t 2021-10-06 18:41:14 +02:00
Witold Filipczyk
7cfca54b59 [css2xpath] added test case and fix 2021-10-05 21:43:23 +02:00
Witold Filipczyk
408f644b4c [querySelector] Added to element 2021-10-04 19:47:56 +02:00
Witold Filipczyk
160deb55d9 [css2xpath] Small fixes 2021-10-04 17:21:44 +02:00
Witold Filipczyk
1618038dc3 [querySelector] implementation of querySelector 2021-10-04 15:28:26 +02:00
Witold Filipczyk
af059861ba [css2xpath] All tests passed 2021-10-04 15:10:03 +02:00
Witold Filipczyk
c0c7fbc784 [tests] One test fails 2021-10-03 22:59:47 +02:00
Witold Filipczyk
4311445f49 [tests] added color 2021-10-03 19:43:47 +02:00
Witold Filipczyk
21a606bf35 [css2xpath] tests 2021-10-03 19:37:19 +02:00
Witold Filipczyk
413a2cb74a [css2xpath] placeholders for Rules 2021-10-02 19:47:23 +02:00
Witold Filipczyk
928afe522c [css2xpath] dolar_equal_rule 2021-10-01 20:36:35 +02:00
Witold Filipczyk
9b30d73047 [css2xpath] preg_replace_callback, based on coderedirect 2021-10-01 16:21:33 +02:00
Witold Filipczyk
983d3f990d [css2xpath] pass by reference 2021-09-30 20:26:45 +02:00
Witold Filipczyk
e3849e567f [css2xpath] preg_replace 2021-09-30 19:15:44 +02:00
Witold Filipczyk
b67d79a661 [css2xpath] explode 2021-09-29 16:25:35 +02:00
Witold Filipczyk
12e33d8ec3 [css2xpath] begining 2021-09-28 16:25:55 +02:00
Witold Filipczyk
1a51761134 [spidermonkey] Placeholders for querySelector and querySelectorAll 2021-09-27 17:23:27 +02:00
Witold Filipczyk
1b518965cf [spidermonkey] 64MB instead of 16MB for runtime 2021-09-25 21:43:50 +02:00
Witold Filipczyk
3c780ccc09 [document] debug statement 2021-09-24 19:33:50 +02:00
Witold Filipczyk
c008cddb83 [ecmascript] One line shorter code 2021-09-21 19:04:25 +02:00
Witold Filipczyk
6ffa7ec6e3 [ecmascript] Show message in status about enabling/disabling Ecmascript 2021-09-20 18:40:01 +02:00
Witold Filipczyk
929c8c9d81 [action] Added toggle-ecmascript action 2021-09-19 19:40:01 +02:00
Witold Filipczyk
da7ed8f90b [document] childNodes 2021-09-17 19:18:07 +02:00
Witold Filipczyk
d5bc97e7f9 [elements] attributes_set_items 2021-09-17 18:55:01 +02:00
Witold Filipczyk
3177d2a09f [element] nodeList_set_items 2021-09-17 18:41:10 +02:00
Witold Filipczyk
3f0ef28f33 [htmlCollection] set_items 2021-09-17 18:28:40 +02:00
Witold Filipczyk
30f7601650 [form] detach form view 2021-09-16 21:43:28 +02:00
Witold Filipczyk
a85fec3aef [form] DefineProperty 2021-09-16 21:19:30 +02:00
Witold Filipczyk
6b4576d2d8 [form] document.forms["name"] 2021-09-16 20:38:13 +02:00
Witold Filipczyk
df9cb9dc5a [forms] Try to JS_SetElement 2021-09-16 20:26:20 +02:00
Witold Filipczyk
00f3f224d1 [implementation] Standard document 2021-09-15 19:29:31 +02:00
Witold Filipczyk
387a2836f1 [ecmascript] domimplementation 2021-09-15 16:22:36 +02:00
Witold Filipczyk
42a3815bfd [element] cloneNode 2021-09-15 15:22:10 +02:00
Witold Filipczyk
4cf55496a1 [element] appendChild returns appended element 2021-09-14 17:08:49 +02:00
Witold Filipczyk
6b0fe3ec23 [document] createDocumentFragment 2021-09-14 17:03:01 +02:00
Witold Filipczyk
ed83097130 [element] added removeChild 2021-09-14 15:58:19 +02:00
Witold Filipczyk
186146f169 [spidermonkey] window.self returns true 2021-09-13 13:45:54 +02:00
Witold Filipczyk
fad6b38091 [ecmascript] More debug 2021-09-12 19:38:32 +02:00
Witold Filipczyk
336169f339 [location] location_goto_common 2021-09-09 12:30:00 +02:00
Witold Filipczyk
aeb6e064f9 [js] std::string -> xmlpp::ustring 2021-09-08 10:53:12 +02:00
Witold Filipczyk
686e83afaa [js] getAttribute 2021-09-08 10:41:36 +02:00
Witold Filipczyk
5737a4d345 [console] console.error and fixes in jsval_to_string 2021-09-07 17:31:45 +02:00
Witold Filipczyk
b8ddbeef0f [spidermonkey] error_reporter with open_memstream 2021-09-06 20:57:00 +02:00
Witold Filipczyk
12bb1ebbfa [stracpy] Free memory allocated by jsval_to_string 2021-08-31 18:08:28 +02:00
Witold Filipczyk
b112650706 [mozjs] up to 78
It compiles.
2021-08-30 21:03:26 +02:00
Witold Filipczyk
7f572e7e4a [ecmascript] bump mozjs version to 68
Memory allocated in jsval_to_string is not freed anywhere.
2021-08-30 20:48:11 +02:00
Witold Filipczyk
d659fca9fc [spidermonkey] Changed jshandle_value_to_string 2021-08-30 14:14:51 +02:00
Witold Filipczyk
47224921de [spidermonkey] jsval_to_string everywhere
Replace JS_EncodeString by jsval_to_string. It will allow easier
changes in the future. In smjs nullptr everywhere.
In ecmascript arrays don't work. For example
document.getElementsByTagName("H1")[0]

smjs even does not start.

Plan is to bump mozjs version, and later back to fixing bugs.
2021-08-27 19:46:05 +02:00
Witold Filipczyk
34e878a0da [ecmascript] nullptr everywhere 2021-08-26 15:44:32 +02:00
Witold Filipczyk
b825f4abf1 [js] Start to adjust code for mozjs-60. 2021-08-25 20:08:02 +02:00
Witold Filipczyk
f211564a80 [element] setAttribute . Check if arguments are strings 2021-08-24 15:57:53 +02:00
Witold Filipczyk
206b36b6fe [window] setNull 2021-08-24 15:12:15 +02:00
Witold Filipczyk
6659cad7ab [spidermonkey] spidermonkey_check_if_function_name() 2021-08-21 11:30:09 +02:00
Witold Filipczyk
b459f64be8 [ecmascript] Check if function name is defined.
There must be some better way.
2021-08-20 16:08:51 +02:00
Witold Filipczyk
4121b163c1 [ecmascript] Added some debug statements 2021-08-19 18:56:50 +02:00
Witold Filipczyk
85f7e8c79b [xml] Removed space from source code. 2021-08-14 21:57:57 +02:00
Witold Filipczyk
66305fcb50 [gettext] try system gettext. Refs #62
Now, only meson was changed.
-Dnls=true -Dgettext=true
2021-08-08 21:25:08 +02:00
Witold Filipczyk
13c4a1ce4d [spidermonkey] return location object
so document.location.href= redirects
2021-08-03 18:47:34 +02:00
Witold Filipczyk
c21e351525 [rerender] draw_formatted called again 2021-07-20 10:11:26 +02:00
Witold Filipczyk
927b8fc1a6 [js] moved check_for_rerender to ecmascript.c 2021-07-20 10:05:58 +02:00
Witold Filipczyk
0b2a1ab919 [xml] Encoding is known 2021-07-18 16:54:31 +02:00
Witold Filipczyk
e1fbc48d9a [scroll] This time scroll3 is tolerable. 2021-07-17 19:03:51 +02:00
Witold Filipczyk
782b4e00f0 [tables] Change of mind. Just render whole document with old renderer. 2021-07-16 19:52:31 +02:00
Witold Filipczyk
d237b06511 [js] document.write adds text at the end of document
It is not ok, but better than inserting code at the beginning.
2021-07-03 12:55:36 +02:00
Witold Filipczyk
5ed65c8733 [gemini] text/gemini 2021-07-01 20:18:29 +02:00
Witold Filipczyk
ebc557f096 [js] sort_links 2021-06-28 20:41:01 +02:00
Witold Filipczyk
fa49422f88 [document] Programming by coincidence.
scroll3 works, width.html works, accesskey still does not
2021-06-27 13:01:19 +02:00
Witold Filipczyk
d5b27592a1 [meson] compilation fixes related to CSS 2021-06-21 21:01:37 +02:00
Witold Filipczyk
c3330e4452 [js] test commit. Scroll version 3 2021-06-14 21:29:22 +02:00
Witold Filipczyk
8be72ca243 [source] Show source files after libxml++ parsing. 2021-06-13 16:41:54 +02:00
Witold Filipczyk
908fa22878 [htmlcxx] htmlcxx retired 2021-06-12 13:29:05 +02:00
Witold Filipczyk
efd495d927 [js] Some debug statements. 2021-06-11 17:23:27 +02:00
Witold Filipczyk
201a61b14f [document] Try to free memory of document->dom in document_done 2021-06-10 15:01:15 +02:00
Witold Filipczyk
e8653c1480 [js] delete old Document
Requires libxml++-5.0.2 or GIT version.
2021-06-09 21:03:05 +02:00
Witold Filipczyk
1c608ef5f5 [js] location.reload 2021-06-09 18:58:00 +02:00
Witold Filipczyk
b4c3c6f171 [js] Improved innerHTML. It accepts html now, not only xhtml. 2021-06-08 16:13:09 +02:00
Witold Filipczyk
e674a7c9d1 [js] element.childNodes 2021-06-07 16:34:53 +02:00
Witold Filipczyk
70a9e53a36 [js] element.children
innerHTML does not accept non-xhtml
2021-06-07 15:41:28 +02:00
Witold Filipczyk
92de5f3c19 [js] Changes in html are visible in more places 2021-06-06 15:31:06 +02:00
Witold Filipczyk
4e651e5391 [js] Improved setter for innerHTML 2021-06-06 15:23:21 +02:00
Witold Filipczyk
871d47bf41 [js] Test commit for "rerendering" of page after modifcation by scripts 2021-06-05 21:58:29 +02:00
Witold Filipczyk
80c1c7a278 [js] element.insertBefore 2021-06-04 19:41:06 +02:00
Witold Filipczyk
040ab5a189 [js] title setter 2021-06-03 14:05:00 +02:00
Witold Filipczyk
4270cb3125 [js] lang setter 2021-06-03 14:01:54 +02:00
Witold Filipczyk
70cd635ef3 [js] id setter 2021-06-03 13:57:33 +02:00
Witold Filipczyk
fc60848d64 [js] dir setter 2021-06-03 13:51:59 +02:00
Witold Filipczyk
7a65feb323 [js] className setter 2021-06-03 13:44:57 +02:00
Witold Filipczyk
5de45a9e96 [js] innerHTML (setter) 2021-06-03 11:59:15 +02:00
Witold Filipczyk
07fccc9f87 [js] element.setAttribute 2021-06-02 18:26:05 +02:00
Witold Filipczyk
4b5d115039 [js] element.appendChild 2021-06-01 21:00:21 +02:00
Witold Filipczyk
3a328cc48c [js] document.createTextNode 2021-06-01 19:55:23 +02:00
Witold Filipczyk
33a694cdb7 [js] document.createComment 2021-06-01 19:51:53 +02:00
Witold Filipczyk
886f1ba978 [js] document.createElement 2021-06-01 19:23:45 +02:00
Witold Filipczyk
f625d74673 [js] element.remove 2021-06-01 17:24:34 +02:00
Witold Filipczyk
fb90f2a832 [js] screen.height (term->height * 16) 2021-05-31 14:27:40 +02:00
Witold Filipczyk
54a7bd7339 [js] screen.width 2021-05-30 12:58:19 +02:00
Witold Filipczyk
719f484422 [js] screen.availWidth (box.width * 8) 2021-05-29 13:42:34 +02:00
Witold Filipczyk
10d731f10c [js] screen.availHeight (here it is 16 * box.height) 2021-05-28 17:51:42 +02:00
Witold Filipczyk
8b2ef1ef45 [js] publicId 2021-05-27 16:16:10 +02:00
Witold Filipczyk
d6df9584c9 Merge branch 'master' into getlementbyid 2021-05-26 08:29:47 +02:00
Witold Filipczyk
207534f3e0 [js] doctype.systemId 2021-05-26 08:22:33 +02:00
Witold Filipczyk
35404925e0 [js] document.doctype.name 2021-05-25 18:12:04 +02:00
Witold Filipczyk
97e1e86e66 [js] document.URL (written uppercase) 2021-05-25 16:55:04 +02:00
Witold Filipczyk
9a0b89e189 [js] document.documentURI 2021-05-25 15:58:15 +02:00
Witold Filipczyk
ed8bff2b82 [js] document.baseURI 2021-05-25 12:22:52 +02:00
Witold Filipczyk
c5b2706354 [js] document.domain 2021-05-24 21:55:57 +02:00
Witold Filipczyk
597101276c [js] document.characterSet 2021-05-23 20:49:21 +02:00
Witold Filipczyk
fc076c3297 [js] test commit. No idea yet how to transform forms into elements 2021-05-23 18:34:33 +02:00
Witold Filipczyk
e74fd3aa30 [js] try to be more like Firefox 2021-05-22 16:38:43 +02:00
Witold Filipczyk
3e7047ee47 [js] Rewrite a bit form get_property 2021-05-21 21:42:14 +02:00
Witold Filipczyk
28127b29b4 [js] Try to rewrite htmlCollection get_property. 2021-05-21 20:46:27 +02:00
Witold Filipczyk
c5a1296200 [js] element.isEqualNode (only for Elements) 2021-05-20 16:44:57 +02:00
Witold Filipczyk
1af9c9fc31 [js] element.ownerDocument 2021-05-19 19:05:03 +02:00
Witold Filipczyk
835d42e892 [js] element.nodeValue 2021-05-18 18:36:01 +02:00
Witold Filipczyk
54f902e72a [js] element.nodeName 2021-05-18 18:13:01 +02:00
Witold Filipczyk
e230acf2ab [js] element.nodeType 2021-05-18 16:21:02 +02:00
Witold Filipczyk
3e8186922d [js] element.isSameNode 2021-05-17 17:25:50 +02:00
Witold Filipczyk
0a395d7dbf [js] hasChildNodes 2021-05-16 19:26:24 +02:00
Witold Filipczyk
22acacb47b [js] element.parentElement 2021-05-16 15:56:02 +02:00
Witold Filipczyk
47c694d7d1 [js] element.parentNode 2021-05-16 15:49:38 +02:00
Witold Filipczyk
ed449aee6e [js] element.previousElementSibling 2021-05-16 15:42:01 +02:00
Witold Filipczyk
e4eaca040d [js] element.previousSibling 2021-05-16 15:38:15 +02:00
Witold Filipczyk
6baba00aab [js] element.nextElementSibling 2021-05-16 15:33:19 +02:00
Witold Filipczyk
30c5bdfa1b [js] element.nextSibling 2021-05-16 15:12:13 +02:00
Witold Filipczyk
760dff4419 [js] element.contains 2021-05-15 20:50:03 +02:00
Witold Filipczyk
09988b7fcd [js] element.getAttributeNode 2021-05-14 21:49:56 +02:00
Witold Filipczyk
5c5621aadd [js] document.attributes 2021-05-13 17:41:18 +02:00
Witold Filipczyk
c71b0f2ee1 [js] document.scripts 2021-05-12 20:05:15 +02:00
Witold Filipczyk
35d7847808 [js] document.images 2021-05-12 20:01:08 +02:00
Witold Filipczyk
22cd7a0052 [js] document.links 2021-05-12 17:37:01 +02:00
Witold Filipczyk
ed3a11b288 [js] document.head 2021-05-12 17:28:03 +02:00
Witold Filipczyk
51fe9d1968 [js] document.documentElement 2021-05-12 17:22:34 +02:00
Witold Filipczyk
937b77cfdf [js] document.body 2021-05-12 17:16:10 +02:00
Witold Filipczyk
8e97e8b048 [js] document.anchors 2021-05-12 17:08:05 +02:00
Witold Filipczyk
799f256157 [js] getElementsByClassName 2021-05-12 16:30:36 +02:00
Witold Filipczyk
d22e77a796 [js] getElementsByTagName
TODO: sanitize input for this function
2021-05-12 16:23:46 +02:00
Witold Filipczyk
3e30d82fb4 [js] jsGetElementsByName 2021-05-11 19:02:54 +02:00
Witold Filipczyk
a8e27fc730 [js] lastElementChild 2021-05-10 19:14:39 +02:00
Witold Filipczyk
39c0e7679d [js] firstElementChild 2021-05-10 19:08:36 +02:00
Witold Filipczyk
6798ffc8b0 [js] lastChild 2021-05-09 21:53:14 +02:00
Witold Filipczyk
8c7517189d [js] firstChild 2021-05-09 21:38:23 +02:00
Witold Filipczyk
e020f83d34 [js] innerHTML and outerHTML getters (libxml++) 2021-05-09 21:21:24 +02:00
Witold Filipczyk
d891cc503a [js] textContent 2021-05-09 20:50:36 +02:00
Witold Filipczyk
501a649068 [js] hasAttribute, hasAttributes 2021-05-09 20:26:08 +02:00
Witold Filipczyk
1a8578aecb [js] tagName ++ 2021-05-09 20:18:09 +02:00
Witold Filipczyk
7c26da3cc3 [js] lang, title 2021-05-09 20:12:46 +02:00
Witold Filipczyk
05620e7d08 [js] childElementCount, className, dir converted to libxml++ 2021-05-09 20:09:05 +02:00
Witold Filipczyk
d71ef9e57c [js] switch to libxml++ . Begining. 2021-05-09 19:56:00 +02:00
Witold Filipczyk
471c9282ee [js] childElementCount 2021-05-08 21:51:34 +02:00
Witold Filipczyk
d9073ea9b1 [js] hasAttributes 2021-05-08 19:55:58 +02:00
Witold Filipczyk
0bdbb6aca6 [js] element.hasAttribute(...) 2021-05-07 19:03:53 +02:00
Witold Filipczyk
004a778382 [ecmascript] Read also ~/.elinks/disallowed.txt
Lines in disallowed.txt may contain prefixes of bad sites.
If current url matches any of line with disallowed prefixes,
ecmascript is not executed.
If disallowed.txt is empty or not matched, then
if allow.txt is not empty, and some prefix from this file
matches current url, ecmascript is allowed.
If allow.txt is empty, ecmascript is allowed too,
otherwise ecmascript is disabled on given page.
2021-05-07 11:29:33 +02:00
Witold Filipczyk
745387e386 [js] location.hash getter 2021-05-06 16:06:37 +02:00
Witold Filipczyk
955a259f5d [js] location.host getter 2021-05-06 15:53:20 +02:00
Witold Filipczyk
4c4ea4bdd9 [js] location.hostname getter 2021-05-06 15:46:39 +02:00
Witold Filipczyk
7c618d3a6f [js] location.origin 2021-05-06 15:40:17 +02:00
Witold Filipczyk
d5f63e6fca [js] location.pathname getter 2021-05-06 15:31:31 +02:00
Witold Filipczyk
9de0a934ff [js] location.search getter 2021-05-06 15:17:46 +02:00
Witold Filipczyk
07dba347ac [js] location.port getter 2021-05-06 15:06:35 +02:00
Witold Filipczyk
b07d39364c [js] textContent (read) 2021-05-05 15:21:37 +02:00
Witold Filipczyk
9b738edb18 [js] location.protocol (read) 2021-05-04 20:55:06 +02:00
Witold Filipczyk
1e8f86628d [js] className (read) 2021-05-04 18:34:10 +02:00
Witold Filipczyk
b0ee34bdd5 [js] dir (read) 2021-05-04 16:24:56 +02:00
Witold Filipczyk
5a78da08f5 [js] lang (read) 2021-05-04 16:12:59 +02:00
Witold Filipczyk
63b07c01d8 [js] tagName 2021-05-04 16:06:50 +02:00
Witold Filipczyk
adadc03821 [js] title (read) 2021-05-04 15:42:52 +02:00
Witold Filipczyk
cf5841b8de [js] outerHTML (read) 2021-05-04 15:32:29 +02:00
Witold Filipczyk
3bd33b9dd3 [js] innerHTML read property 2021-05-03 18:25:31 +02:00
Witold Filipczyk
63d892838c [getElementById] small success. see test/ecmascript/element.html
Now memory leaks, etc. are not taken into account.
For the beginning I will implement read properties.
2021-05-02 17:27:35 +02:00
Witold Filipczyk
ff78bd6a86 [js] getElementById stub 2021-05-01 20:39:13 +02:00
Witold Filipczyk
d4157366b0 [document] add_string_to_string 2021-02-26 18:43:19 +01:00
Witold Filipczyk
5d394926bd [document] done_string 2021-02-26 16:22:18 +01:00
Witold Filipczyk
62245356c8 [document] Another unused variable 2021-02-26 16:16:22 +01:00
Witold Filipczyk
34ccc2c2fd [document] unused variable 2021-02-26 16:14:43 +01:00
nobody@earth.com
550baf1baf [smjs document replace] struct string init and done 2021-02-25 21:58:20 +01:00
nobody@earth.com
99ed5e56f5 [smjs document replace] jshandle_value_to_char_string to void 2021-02-25 21:38:42 +01:00
nobody@earth.com
31ac8dd5d7 [smjs document replace] rewritten to struct string 2021-02-25 13:40:41 +01:00
nobody@earth.com
f953744189 [smjs document replace] fixed property location, replace and writeln functions, tests 2021-02-24 11:23:34 +01:00
Witold Filipczyk
04b9056f98 [js] Compilation fixes 2021-02-24 09:56:06 +01:00
nobody@earth.com
de3f137398 [smjs local storage] limit 1 on key select 2021-02-23 23:00:53 +01:00
nobody@earth.com
60211fdd41 [smjs local storage] changes from comments PR #97 2021-02-23 21:32:00 +01:00
nobody@earth.com
a19b95f20c [smjs local storage] spider monkey local storage 2021-02-22 23:27:19 +01:00
nobody@earth.com
7148c15150 [smjs] fixed spidermonkey error reporting for mozjs52 2021-02-22 17:26:45 +01:00
Witold Filipczyk
7f1d718993 [console.log] Added boolean option ecmascript.enable_console_log. Disabled by default. 2021-02-22 16:05:55 +01:00
Witold Filipczyk
bc7a1ae6ad [console.log] Global variable to store console_log_filename 2021-02-22 15:55:12 +01:00
Witold Filipczyk
4db2b42799 [meson] console.c 2021-02-22 15:39:03 +01:00
nobody@earth.com
c3e0e0f50d [smjs] Console log Cleanup 2021-02-22 01:52:56 +01:00
nobody@earth.com
985a92c079 [smjs] usage of utils/string functions 2021-02-22 01:43:31 +01:00
nobody@earth.com
3cf1559bc6 [smjs] removed redundant defs added fopen check 2021-02-22 01:12:16 +01:00
nobody@earth.com
c6a3d04e21 SpiderMonkey Update v0.1.a - Console Log 2021-02-21 22:33:29 +01:00
Witold Filipczyk
0fea79cc8f [cflags] Removed -Wno-pointer-sign
Likely some new bugs were introduced by this change.
The long term goal is clean compilation by g++.
2021-01-02 16:20:27 +01:00
Witold Filipczyk
867cc8a9c6 [ecmascript] move visited allowed url to the begining of list. 2020-12-11 18:51:53 +01:00
Witold Filipczyk
de793bbf73 [ecmascript] exception for empty list. Allow all urls. 2020-12-09 16:13:20 +01:00
Witold Filipczyk
471fe54053 [ecmascript] Explicit init and done function for ecmascript module. 2020-12-08 20:54:14 +01:00
Witold Filipczyk
f617256ecc [ecmascript] Allow ecmascript scripts only for given urls prefixes.
In ~/.elinks/allowed_ecmascript_url_prefixes.txt you must enter list
of urls. For example:
file://
https://buildlogs.pld-linux.org/
http://example

If url of document starts with one of given prefixes, then given url is
allowed to execute ecmascript. Start from most often used first.
2020-12-07 22:45:13 +01:00
Witold Filipczyk
d4ccb07cf6 [spidermonkey] Delete ac2 (AutoCompartment) 2020-11-27 17:21:11 +01:00
Witold Filipczyk
3e3721582e [ecmascript] Guard for builds without mozjs. Refs #81 2020-11-23 20:11:47 +01:00
Witold Filipczyk
37ae7a0db8 [spidermonkey] ReportError - removed code, which did not work well 2020-11-23 18:06:17 +01:00
Witold Filipczyk
a92df85c11 [spidermonkey] Changes in setTimeout.
Spidermonkey is "hardcoded" in ecmascript, but ecmascript script engine
is rarely being changed.
2020-11-22 16:42:23 +01:00
Witold Filipczyk
085a93d544 [spidermonkey] JS_PS_END 2020-11-21 17:54:47 +01:00
Witold Filipczyk
477e56eb43 [smjs] Maybe it is not correct, but spidermonkey and smjs work together. 2020-11-17 18:46:27 +01:00
Witold Filipczyk
873797935c [spidermonkey] Some code related to compartments. Progress. 2020-11-16 22:00:48 +01:00
Witold Filipczyk
b0ced9308b [spidermonkey] Some random changes. 2020-11-15 17:55:58 +01:00
Witold Filipczyk
8ad7d68b28 [js] Small progress.
It segfaults less often, but still, especially on non utf-8 pages.
And sometimes it did not work.
2020-10-28 22:32:20 +01:00
Witold Filipczyk
d1ecd45828 [mozjs52] It compiles, but often segfaults. No idea yet how to fix it. 2020-10-27 14:53:24 +01:00
Witold Filipczyk
a5b68a25a1 [mozjs45] Code is unstable, but at least compiles. 2020-10-23 22:34:58 +02:00
Witold Filipczyk
01c511f52d [mozjs38] ELinks is compilable, was not heavily tested. 2020-10-16 19:54:02 +02:00
Witold Filipczyk
dd704b900a [mozjs31] SpiderMonkey updated to mozjs31. TODO: smjs scripting. 2020-10-11 15:42:59 +02:00
Witold Filipczyk
1f57e72212 [mozjs24] Allow build elinks with g++
SpiderMonkey was updated to mozjs24. If you want to build elinks
with ecmascript support, you must compile using g++ with -fpermissive .
There is a lot of warnings.
There are some memleaks in ecmascript code, especially related to JSAutoCompartment.
I don't know yet, where and how to free it.

Debian does not support mozjs24, so I'm going to gradually update SpiderMonkey version.
2020-10-05 20:14:55 +02:00
Witold Filipczyk
5f87bdbcb2 [meson] meson build scripts.
Not finished yet, but I added to motivate myself and others.
The goal is to get a few seconds faster builds.

autotools still will be available.
2020-09-05 22:06:01 +02:00
Witold Filipczyk
ca3926bb9d [ecmascript] No warning 2019-11-15 16:40:29 +01:00
Witold Filipczyk
3d96b0d7d7 Revert "Compile with C++."
This reverts commit 4f4df33638.
2019-04-21 12:27:40 +02:00
Witold Filipczyk
8d7112c27d Revert "Fix some issues with js."
This reverts commit 6322d2936a.
2019-04-21 12:26:27 +02:00
Witold Filipczyk
6322d2936a Fix some issues with js. 2019-02-17 23:33:12 +01:00
Witold Filipczyk
4f4df33638 Compile with C++.
Weak points:
- alignof
- js problems

Todo:
- make js work with C++ and mozjs-17
- then mozjs-24
- then mozjs-52
- then mozjs-60
- decrease number of warnings
2019-02-17 20:46:16 +01:00
Witold Filipczyk
25dd2ecae9 Changed ecmascript engine to mozjs-17.0.
Was not tested, especially smjs is likely buggy.
2019-02-10 21:00:37 +01:00
Witold Filipczyk
6dfdd36398 form_control -> el_form_control 2018-09-09 19:18:53 +02:00
Witold Filipczyk
9eaf03cf2a Added HttpOnly cookies 2018-08-25 15:28:29 +02:00
أحمد المحمودي (Ahmed El-Mahmoudy)
887f85f6a9 Add signal.h to heartbeat,c includes
Build failed because hearbeat.c uses SIGVTALRM
2017-12-02 02:47:02 +01:00
Witold Filipczyk
da15322705 Cast to (const char *) in strrchr calls 2016-04-20 21:03:27 +02:00
Kalle Olavi Niemitalo
268249c50b SMJS: move comments to match spidermonkeyFunctionSpec[]
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.
2012-11-26 00:15:09 +02:00
Kalle Olavi Niemitalo
465923e386 ECMAScript: Initialize jsval variables for return values
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.
2012-11-19 00:39:51 +02:00
Kalle Olavi Niemitalo
8b00e1ef70 bug 764: Initialize the right member of union option_value
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.
2012-11-03 22:16:32 +02:00
witekfl
12803e4075 Check if hb is NULL. 2012-03-04 18:20:48 +01: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
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
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
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
Miciah Dashiel Butler Masters
6cb3d30d09 Add missing include and declarations
Add an include for config/options.h to src/ecmascript/spidermonkey.c
and two missing declarations (struct form_view and struct form_state)
to src/ecmascript/spidermonkey.h.
2010-08-07 20:44:02 +00:00
Miciah Dashiel Butler Masters
f31cf6f9fe Heartbeat code using JS_TriggerOperationCallback
Implement new heartbeat code to catch runaway execution of document
ECMAScript code.  The old code uses JS_SetBranchCallback which is
deprecated in new versions of SpiderMonkey.  The new code uses setitimer(2)
and the JS_SetOperationCallback and JS_TriggerOperationCallback interfaces,
introduced in SpiderMonkey 1.8.1.  Compatibility with both the old
JS_SetBranchCallback and the new interfaces is maintained.
2009-11-26 00:57:21 +00:00
Kalle Olavi Niemitalo
7bb51e7139 Merge branch 'elinks-0.12' into elinks-0.13
Conflicts:
	NEWS
	configure.in
	doc/man/man1/elinks.1.in (regenerated)
	doc/man/man5/elinks.conf.5 (regenerated)
	doc/man/man5/elinkskeys.5 (regenerated)
	po/af.po (kept 0.13.GIT)
	po/be.po (kept 0.13.GIT)
	po/bg.po (kept 0.13.GIT)
	po/ca.po (kept 0.13.GIT)
	po/cs.po (kept 0.13.GIT)
	po/da.po (kept 0.13.GIT)
	po/de.po (kept 0.13.GIT)
	po/el.po (kept 0.13.GIT)
	po/es.po (kept 0.13.GIT)
	po/et.po (kept 0.13.GIT)
	po/fi.po (kept 0.13.GIT)
	po/fr.po (kept 0.13.GIT)
	po/gl.po (kept 0.13.GIT)
	po/hr.po (kept 0.13.GIT)
	po/hu.po (kept 0.13.GIT)
	po/id.po (kept 0.13.GIT)
	po/is.po (kept 0.13.GIT)
	po/it.po (kept 0.13.GIT)
	po/lt.po (kept 0.13.GIT)
	po/nb.po (kept 0.13.GIT)
	po/nl.po (kept 0.13.GIT)
	po/pl.po (kept 0.13.GIT)
	po/pt.po (kept 0.13.GIT)
	po/pt_BR.po (kept 0.13.GIT)
	po/ro.po (kept 0.13.GIT)
	po/ru.po (kept 0.13.GIT)
	po/sk.po (kept 0.13.GIT)
	po/sr.po (kept 0.13.GIT)
	po/sv.po (kept 0.13.GIT)
	po/tr.po (kept 0.13.GIT)
	po/uk.po (kept 0.13.GIT)
	src/ecmascript/ecmascript.c
2009-07-11 16:47:33 +03:00
Kalle Olavi Niemitalo
11c0cb859b Debian bug 534835: Check *_get_interpreter return values
This should fix a crash in:

    at /home/Kalle/src/elinks-0.12/src/ecmascript/spidermonkey.c:251
    at /home/Kalle/src/elinks-0.12/src/ecmascript/ecmascript.c:104
    at /home/Kalle/src/elinks-0.12/src/viewer/text/vs.c:64

It seems that spidermonkey_get_interpreter failed and returned NULL to
ecmascript_get_interpreter, which did not check the return value and
behaved as if the ECMAScript interpreter had been properly initialized.
This caused destroy_vs to call ecmascript_put_interpreter, but
backend_data which should have been a JSContext * was NULL, causing
a crash in SpiderMonkey.

An alternative fix might be to make spidermonkey_put_interpreter skip
the JS_DestroyContext call if ctx is NULL.  However, I think it is
better to make sure ecmascript_get_interpreter returns NULL if
spidermonkey_get_interpreter fails, so that vs->ecmascript is left
NULL and there's no chance that some other code might try to
dereference the (JSContext *) NULL.
2009-06-28 00:18:05 +03:00
Kalle Olavi Niemitalo
10c07f9933 Debian bug 534835: Check some SpiderMonkey return values
Perhaps because of bug 981, if one opened hundreds of pages with
elinks --remote openURL(...), then ELinks 0.11.4 could crash with a
SIGSEGV in JS_InitClass called from spidermonkey_get_interpreter.
SpiderMonkey ran out of memory and began returning NULL and JS_FALSE
but ELinks didn't notice them and pressed on.  Add some checks to
avoid the crash, although the underlying out-of-memory error remains.
2009-06-27 19:48:56 +03:00
Kalle Olavi Niemitalo
1bb71f3732 Merge branch 'elinks-0.12' into elinks-0.13
Conflicts:
	src/config/conf.c
	src/network/ssl/ssl.c
2009-03-12 08:46:02 +02:00
Kalle Olavi Niemitalo
5a43c55c9e Rewrap lines in option documentation.
Documentation strings of most options used to contain a "\n" at the
end of each source line.  When the option manager displayed these
strings, it treated each "\n" as a hard newline.  On 80x24 terminals
however, the option description window has only 60 columes available
for the text (with the default setup.h), and the hard newlines were
further apart, so the option manager wrapped the text a second time,
resulting in rather ugly output where long lones are interleaved with
short ones.  This could also cause the text to take up too much
vertical space and not fit in the window.

Replace most of those hard newlines with spaces so that the option
manager (or perhaps BFU) will take care of the wrapping.  At the same
time, rewrap the strings in source code so that the source lines are
at most 79 columns wide.

In some options though, there is a list of possible values and their
meanings.  In those lists, if the description of one value does not
fit in one line, then continuation lines should be indented.  The
option manager and BFU are not currently able to do that.  So, keep
the hard newlines in those lists, but rewrap them to 60 columns so
that they are less likely to require further wrapping at runtime.
2009-03-08 15:18:10 +02:00
Kalle Olavi Niemitalo
3581e2848e Merge branch 'elinks-0.12' into elinks-0.13
Conflicts:
	doc/installation.txt
	src/protocol/http/http.c
2009-02-28 18:22:54 +02:00
Kalle Olavi Niemitalo
1487d206db Bug 1069: Revert "1031: JS_SetErrorReporter only once per JSRuntime."
This reverts commit b94657869b.
I don't know where I got the idea that JS_SetErrorReporter affects the
entire JSRuntime, rather than only the provided JSContext.  The people
on #jsapi say it has never worked that way.
2009-02-26 22:56:33 +02:00
Kalle Olavi Niemitalo
5c2fada371 Merge branch 'elinks-0.12' into elinks-0.13
Conflicts:
	src/session/download.c
2008-11-01 22:39:17 +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
Kalle Olavi Niemitalo
84e19d0e4e bug 1054: Don't abort downloads when closing a terminal.
Except if they have external handlers.

When ELinks receives an event from a terminal, move that terminal to
the beginning of the global "terminals" list, so that the terminals
are always sorted according to the time of the most recent use.  Note,
this affects the numbering of bookmark folders in session snapshots.

Add get_default_terminal(), which returns the most recently used
terminal that is still open.  Use that in various places that
previously used terminals.prev or terminals.next.  Four functions
fetch the size of the terminal for User-Agent headers, and
get_default_terminal() is not really right, but neither was the
original code; add TODO comments in those functions.

When the user chooses "Background and Notify", associate the download
with the terminal where the dialog box is.  So any later messages will
then appear in that terminal, if it is still open.  However, don't
change the terminal if the download has an external handler.

When a download gets some data, don't immediately check the associated
terminal.  Instead, wait for the download to end.  Then, if the
terminal of the download has been closed, use get_default_terminal()
instead.  If there is no default terminal either, just skip any
message boxes.
2008-10-15 23:29:25 +03:00
Kalle Olavi Niemitalo
b40736cafe Merge branch 'elinks-0.12' into elinks-0.13
Conflicts:

	NEWS (merged)
	configure.in (merged)
	doc/man/man1/elinks.1.in (regenerated)
	doc/man/man5/elinks.conf.5 (regenerated)
	doc/man/man5/elinkskeys.5 (regenerated)
	po/fr.po (kept 0.13.GIT version)
	po/pl.po (kept 0.13.GIT version)
2008-09-27 16:28:28 +03:00
Kalle Olavi Niemitalo
b94657869b 1031: JS_SetErrorReporter only once per JSRuntime.
Previously, spidermonkey_get_interpreter() and init_smjs() each called
JS_SetErrorReporter on the JSContexts they created.  However,
JS_SetErrorReporter actually sets the error reporter of the JSRuntime
associated with the JSContext, and all of our JSContexts use the same
JSRuntime nowadays, so only the error_reporter() of
src/ecmascript/spidermonkey.c was left installed.  Because this
error_reporter() asserts that JS_GetContextPrivate(ctx) returns a
non-NULL pointer, and init_smjs() does not set a private pointer for
smjs_ctx, any error in smjs_ctx could cause an assertion failure, at
least in principle.

Fix this by making spidermonkey_runtime_addref() install a shared
error_reporter() when it creates the JSRuntime and the first JSContext.
The shared error_reporter() then checks the JSContext and calls the
appropriate function.

The two error reporters are quite similar with each other.  In the
future, we could move the common code into shared functions.  I'm not
doing that yet though, because fixing the bug doesn't require it.
2008-09-07 20:17:25 +03:00
Kalle Olavi Niemitalo
0ee1d05d81 1031: Return 0 from spidermonkey_runtime_addref if JS_NewContext fails.
Previously, this would have caused an assertion failure.
2008-09-07 18:04:18 +03:00