From 153ea907a8d8cef48b86c550d099c703b327529a Mon Sep 17 00:00:00 2001 From: sgerwk Date: Sat, 25 Jul 2020 13:28:56 +0200 Subject: [PATCH 001/179] also pass the uri as %u to external handlers --- doc/mime.txt | 19 ++++++++++--------- src/mime/backend/default.c | 3 ++- src/session/download.c | 28 +++++++++++++++++++++++----- 3 files changed, 35 insertions(+), 15 deletions(-) diff --git a/doc/mime.txt b/doc/mime.txt index 4ba7d080..8c6bf977 100644 --- a/doc/mime.txt +++ b/doc/mime.txt @@ -91,7 +91,8 @@ choice if you want). Attaching a program to it:: You must tell ELinks the exact command for running it (with any - options you wish). In place of the filename you must enter %. + options you wish). In place of the filename you must enter %f. Also the + uri can be used as %u. Choosing whether you want confirmation before applying it:: @@ -144,12 +145,12 @@ and value with the value you want to assign to the item. You must do so for each of the available items: program, ask and block. The value for program is a string with the exact command you want to be issued -to view the file, placing % were you would put the file name. The values for -ask and block are either 0 (no) or 1 (yes). Available contexts include unix -and unix-xwin, which mean UNIX text terminal and X respectively (others can be -os2, win32, beos, riscos, ...). The latter does not mean you are running -ELinks from X, just that the DISPLAY variable is set so that ELinks may run an -X program. +to view the file, placing %f were you would put the file name and %u the uri +(if needed). The values for ask and block are either 0 (no) or 1 (yes). +Available contexts include unix and unix-xwin, which mean UNIX text terminal +and X respectively (others can be os2, win32, beos, riscos, ...). The latter +does not mean you are running ELinks from X, just that the DISPLAY variable is +set so that ELinks may run an X program. To illustrate it, here is an example. Suppose you want to define the image_viewer handler which should be used to view images. The configuration @@ -162,8 +163,8 @@ set mime.handler.image_viewer.unix-xwin.ask = 0 set mime.handler.image_viewer.unix.block = 1 set mime.handler.image_viewer.unix-xwin.block = 0 -set mime.handler.image_viewer.unix.program = "zgv %" -set mime.handler.image_viewer.unix-xwin.program = "xli %" +set mime.handler.image_viewer.unix.program = "zgv %f" +set mime.handler.image_viewer.unix-xwin.program = "xli %f" -------------------------------------------------------------------------------- In this example the image_viewer handler uses the svgalib image viewer zgv diff --git a/src/mime/backend/default.c b/src/mime/backend/default.c index 923b073b..8e191fa7 100644 --- a/src/mime/backend/default.c +++ b/src/mime/backend/default.c @@ -74,7 +74,8 @@ static union option_info default_mime_options[] = { "program", 0, "", /* xgettext:no-c-format */ N_("External viewer for this file type. " - "'%' in this string will be substituted by a file name. " + "'%f' in this string will be substituted by a file name, " + "'%u' by its uri. " "Do _not_ put single- or double-quotes around the % sign.")), diff --git a/src/session/download.c b/src/session/download.c index 000bbe97..97552f6b 100644 --- a/src/session/download.c +++ b/src/session/download.c @@ -1028,12 +1028,13 @@ get_temp_name(struct uri *uri) static unsigned char * -subst_file(unsigned char *prog, unsigned char *file) +subst_file(unsigned char *prog, unsigned char *file, unsigned char *uri) { struct string name; /* When there is no %s in the mailcap entry, the handler program reads * data from stdin instead of a file. */ int input = 1; + char *replace, *original = "% "; if (!init_string(&name)) return NULL; @@ -1046,6 +1047,21 @@ subst_file(unsigned char *prog, unsigned char *file) prog += p; if (*prog == '%') { + prog++; + if (*prog == 'f' || *prog == ' ' || *prog == '\0') + replace = file; + else if (*prog == 'u') + replace = uri; + else if (*prog == '%') + replace = "%"; + else { + original[1] = *prog; + replace = original; + } + + if (*prog == ' ' || *prog == '\0') + prog--; + input = 0; #if defined(HAVE_CYGWIN_CONV_TO_FULL_WIN32_PATH) #ifdef MAX_PATH @@ -1054,10 +1070,10 @@ subst_file(unsigned char *prog, unsigned char *file) unsigned char new_path[1024]; #endif - cygwin_conv_to_full_win32_path(file, new_path); + cygwin_conv_to_full_win32_path(replace, new_path); add_to_string(&name, new_path); #else - add_shell_quoted_to_string(&name, file, strlen(file)); + add_shell_quoted_to_string(&name, replace, strlen(replace)); #endif prog++; } @@ -1242,7 +1258,8 @@ continue_download_do(struct terminal *term, int fd, void *data, if (type_query->external_handler) { file_download->external_handler = subst_file(type_query->external_handler, - codw_hop->file); + codw_hop->file, + type_query->uri->string); file_download->delete_ = 1; file_download->copiousoutput = type_query->copiousoutput; mem_free(codw_hop->file); @@ -1490,7 +1507,8 @@ tp_open(struct type_query *type_query) if (file) { decode_uri(file); - handler = subst_file(type_query->external_handler, file); + handler = subst_file(type_query->external_handler, + file, file); mem_free(file); } From 073bad0776d5ba1e593360222152ded81cb5f79f Mon Sep 17 00:00:00 2001 From: Witold Filipczyk Date: Sun, 26 Jul 2020 15:36:39 +0200 Subject: [PATCH 002/179] [po] update --- po/af.po | 79 ++++++++++++++++++++++++------------------------- po/be.po | 79 ++++++++++++++++++++++++------------------------- po/bg.po | 79 ++++++++++++++++++++++++------------------------- po/ca.po | 79 ++++++++++++++++++++++++------------------------- po/cs.po | 79 ++++++++++++++++++++++++------------------------- po/da.po | 79 ++++++++++++++++++++++++------------------------- po/de.po | 79 ++++++++++++++++++++++++------------------------- po/el.po | 79 ++++++++++++++++++++++++------------------------- po/es.po | 79 ++++++++++++++++++++++++------------------------- po/et.po | 79 ++++++++++++++++++++++++------------------------- po/fi.po | 81 ++++++++++++++++++++++++++------------------------- po/fr.po | 81 ++++++++++++++++++++++++++------------------------- po/gl.po | 79 ++++++++++++++++++++++++------------------------- po/hr.po | 79 ++++++++++++++++++++++++------------------------- po/hu.po | 79 ++++++++++++++++++++++++------------------------- po/id.po | 79 ++++++++++++++++++++++++------------------------- po/is.po | 79 ++++++++++++++++++++++++------------------------- po/it.po | 79 ++++++++++++++++++++++++------------------------- po/ja.po | 79 ++++++++++++++++++++++++------------------------- po/lt.po | 79 ++++++++++++++++++++++++------------------------- po/nb.po | 79 ++++++++++++++++++++++++------------------------- po/nl.po | 79 ++++++++++++++++++++++++------------------------- po/pl.po | 84 +++++++++++++++++++++++++++-------------------------- po/pt.po | 79 ++++++++++++++++++++++++------------------------- po/pt_BR.po | 79 ++++++++++++++++++++++++------------------------- po/ro.po | 79 ++++++++++++++++++++++++------------------------- po/ru.po | 79 ++++++++++++++++++++++++------------------------- po/sk.po | 79 ++++++++++++++++++++++++------------------------- po/sr.po | 79 ++++++++++++++++++++++++------------------------- po/sv.po | 79 ++++++++++++++++++++++++------------------------- po/tr.po | 79 ++++++++++++++++++++++++------------------------- po/uk.po | 79 ++++++++++++++++++++++++------------------------- 32 files changed, 1285 insertions(+), 1252 deletions(-) diff --git a/po/af.po b/po/af.po index 733567c6..40226523 100644 --- a/po/af.po +++ b/po/af.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: 0.12\n" "Report-Msgid-Bugs-To: elinks-users@linuxfromscratch.org\n" -"POT-Creation-Date: 2020-06-26 19:00+0200\n" +"POT-Creation-Date: 2020-07-26 15:28+0200\n" "PO-Revision-Date: 2006-09-25 17:13+0200\n" "Last-Translator: Friedel Wolff \n" "Language-Team: \n" @@ -183,7 +183,7 @@ msgstr "Leë string word nie toegelaat nie" #: src/dialogs/options.c:244 src/dialogs/options.c:323 src/mime/dialogs.c:133 #: src/protocol/auth/dialogs.c:160 src/protocol/bittorrent/dialogs.c:820 #: src/scripting/lua/core.c:402 src/scripting/lua/core.c:483 -#: src/session/download.c:840 src/session/download.c:1666 +#: src/session/download.c:840 src/session/download.c:1684 #: src/viewer/text/search.c:1937 msgid "~Cancel" msgstr "~Kanseleer" @@ -200,7 +200,7 @@ msgstr "Digitale horlose in die statusbalk." #: src/config/options.inc:1343 src/ecmascript/ecmascript.c:44 #: src/globhist/globhist.c:64 src/mime/backend/mailcap.c:93 #: src/mime/backend/mimetypes.c:52 src/network/ssl/ssl.c:129 -#: src/network/ssl/ssl.c:278 +#: src/network/ssl/ssl.c:282 msgid "Enable" msgstr "Aktiveer" @@ -1904,7 +1904,7 @@ msgstr "Kan nie 'n keuse hier byvoeg nie." #. accelerator_context(src/config/dialogs.c:keybinding_buttons, src/config/dialogs.c:option_buttons, src/cookies/dialogs.c:cookie_buttons, src/formhist/dialogs.c:formhist_buttons, src/protocol/bittorrent/dialogs.c:bittorrent_query_callback, src/session/download.c:do_type_query, terminal_options) #: src/config/dialogs.c:505 src/config/dialogs.c:933 src/cookies/dialogs.c:543 #: src/dialogs/options.c:243 src/formhist/dialogs.c:214 -#: src/protocol/bittorrent/dialogs.c:807 src/session/download.c:1650 +#: src/protocol/bittorrent/dialogs.c:807 src/session/download.c:1668 msgid "Sa~ve" msgstr "Stoo~r" @@ -4437,7 +4437,7 @@ msgid "Domain" msgstr "Domein" #: src/cookies/dialogs.c:41 src/mime/backend/mailcap.c:97 -#: src/mime/backend/mimetypes.c:56 src/protocol/file/cgi.c:44 +#: src/mime/backend/mimetypes.c:56 src/protocol/file/cgi.c:45 msgid "Path" msgstr "Pad" @@ -6122,25 +6122,26 @@ msgstr "" #: src/mime/backend/default.c:76 #, no-c-format msgid "" -"External viewer for this file type. '%' in this string will be substituted " -"by a file name. Do _not_ put single- or double-quotes around the % sign." +"External viewer for this file type. '%f' in this string will be substituted " +"by a file name, '%u' by its uri. Do _not_ put single- or double-quotes " +"around the % sign." msgstr "" -#: src/mime/backend/default.c:81 +#: src/mime/backend/default.c:82 msgid "File extension associations" msgstr "" -#: src/mime/backend/default.c:83 +#: src/mime/backend/default.c:84 msgid "Extension <-> MIME type association." msgstr "" -#: src/mime/backend/default.c:87 +#: src/mime/backend/default.c:88 msgid "" "MIME-type matching this file extension ('*' is used here in place of '.')." msgstr "" #. name: -#: src/mime/backend/default.c:219 +#: src/mime/backend/default.c:220 msgid "Option system" msgstr "" @@ -6270,23 +6271,23 @@ msgid "" "configuration of OpenSSL by the user." msgstr "" -#: src/network/ssl/ssl.c:121 +#: src/network/ssl/ssl.c:121 src/network/ssl/ssl.c:251 msgid "Use HTTPS by default" msgstr "" -#: src/network/ssl/ssl.c:123 +#: src/network/ssl/ssl.c:123 src/network/ssl/ssl.c:253 msgid "Use HTTPS when a URL scheme is not provided." msgstr "" -#: src/network/ssl/ssl.c:125 src/network/ssl/ssl.c:274 +#: src/network/ssl/ssl.c:125 src/network/ssl/ssl.c:278 msgid "Client Certificates" msgstr "" -#: src/network/ssl/ssl.c:127 src/network/ssl/ssl.c:276 +#: src/network/ssl/ssl.c:127 src/network/ssl/ssl.c:280 msgid "X509 client certificate options." msgstr "" -#: src/network/ssl/ssl.c:131 src/network/ssl/ssl.c:280 +#: src/network/ssl/ssl.c:131 src/network/ssl/ssl.c:284 msgid "" "Enable or not the sending of X509 client certificates to servers which " "request them." @@ -6309,11 +6310,11 @@ msgid "" "The database can be also shared with Mozilla browsers." msgstr "" -#: src/network/ssl/ssl.c:149 src/network/ssl/ssl.c:283 +#: src/network/ssl/ssl.c:149 src/network/ssl/ssl.c:287 msgid "Certificate File" msgstr "" -#: src/network/ssl/ssl.c:151 src/network/ssl/ssl.c:285 +#: src/network/ssl/ssl.c:151 src/network/ssl/ssl.c:289 msgid "" "The location of a file containing the client certificate and unencrypted " "private key in PEM format. If unset, the file pointed to by the " @@ -6334,12 +6335,12 @@ msgstr "" #. * of binary packages should of course change the default to #. * suit their systems. #. * TODO: If the file name is relative, look in elinks_home? -#: src/network/ssl/ssl.c:259 +#: src/network/ssl/ssl.c:263 #, fuzzy msgid "Trusted CA file" msgstr "Oordrag gefaal" -#: src/network/ssl/ssl.c:266 +#: src/network/ssl/ssl.c:270 msgid "" "The location of a file containing certificates of trusted certification " "authorities in PEM format. ELinks then trusts certificates issued by these " @@ -6350,11 +6351,11 @@ msgid "" msgstr "" #. name: -#: src/network/ssl/ssl.c:306 src/network/ssl/ssl.c:323 +#: src/network/ssl/ssl.c:310 src/network/ssl/ssl.c:327 msgid "SSL" msgstr "SSL" -#: src/network/ssl/ssl.c:308 +#: src/network/ssl/ssl.c:312 msgid "SSL options." msgstr "SSL-keuses." @@ -7249,7 +7250,7 @@ msgstr "Wat wil u doen met die lêer '%s'?" msgid "Information about the torrent" msgstr "" -#: src/protocol/bittorrent/dialogs.c:782 src/session/download.c:1553 +#: src/protocol/bittorrent/dialogs.c:782 src/session/download.c:1571 msgid "What to do?" msgstr "Hoe gemaak?" @@ -7259,37 +7260,37 @@ msgid "Down~load" msgstr "~Laai af" #. accelerator_context(src/protocol/bittorrent/dialogs.c:bittorrent_query_callback, src/session/download.c:do_type_query) -#: src/protocol/bittorrent/dialogs.c:810 src/session/download.c:1656 +#: src/protocol/bittorrent/dialogs.c:810 src/session/download.c:1674 msgid "~Display" msgstr "~Vertoon" #. accelerator_context(src/protocol/bittorrent/dialogs.c:bittorrent_query_callback, src/session/download.c:do_type_query) -#: src/protocol/bittorrent/dialogs.c:814 src/session/download.c:1660 +#: src/protocol/bittorrent/dialogs.c:814 src/session/download.c:1678 msgid "Show ~header" msgstr "Wys ~kop" -#: src/protocol/file/cgi.c:40 +#: src/protocol/file/cgi.c:41 msgid "Local CGI" msgstr "" -#: src/protocol/file/cgi.c:42 +#: src/protocol/file/cgi.c:43 msgid "Local CGI specific options." msgstr "" -#: src/protocol/file/cgi.c:46 +#: src/protocol/file/cgi.c:47 msgid "Colon separated list of directories, where CGI scripts are stored." msgstr "" -#: src/protocol/file/cgi.c:49 +#: src/protocol/file/cgi.c:50 msgid "Allow local CGI" msgstr "" -#: src/protocol/file/cgi.c:51 +#: src/protocol/file/cgi.c:52 msgid "Whether to execute local CGI scripts." msgstr "" #. name: -#: src/protocol/file/cgi.c:56 +#: src/protocol/file/cgi.c:57 msgid "CGI" msgstr "CGI" @@ -7796,7 +7797,7 @@ msgid "" msgstr "" #. name: -#: src/protocol/rewrite/rewrite.c:360 +#: src/protocol/rewrite/rewrite.c:348 msgid "URI rewrite" msgstr "" @@ -7991,36 +7992,36 @@ msgstr "~Oorskryf die oorspronklike naam" msgid "~Resume download of the original file" msgstr "~Hervat die aflaai van die oorspronklike lêer" -#: src/session/download.c:1556 +#: src/session/download.c:1574 msgid "Unknown type" msgstr "Onbekende soort" -#: src/session/download.c:1581 +#: src/session/download.c:1599 #, c-format msgid "What would you like to do with the file '%s' (type: %s%s%s)?" msgstr "Wat wil u doen met die lêer '%s' (soort: %s%s%s)?" -#: src/session/download.c:1584 +#: src/session/download.c:1602 #, fuzzy, c-format msgid "What would you like to do with the file (type: %s%s%s)?" msgstr "Wat wil u doen met die lêer '%s' (soort: %s%s%s)?" -#: src/session/download.c:1612 +#: src/session/download.c:1630 #, no-c-format msgid "Program ('%' will be replaced by the filename)" msgstr "Program ('%' sal vervang word met die lêernaam)" -#: src/session/download.c:1616 +#: src/session/download.c:1634 msgid "Block the terminal" msgstr "Blok die terminaal" -#: src/session/download.c:1622 +#: src/session/download.c:1640 #, c-format msgid "The file will be opened with the program '%s'." msgstr "Die lêer sal met die program '%s' oopgemaak word." #. accelerator_context(src/session/download.c:do_type_query) -#: src/session/download.c:1643 +#: src/session/download.c:1661 msgid "~Open" msgstr "~Open" diff --git a/po/be.po b/po/be.po index 20fa4fe1..ca0a93de 100644 --- a/po/be.po +++ b/po/be.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: ELinks 0.5pre0.CVS\n" "Report-Msgid-Bugs-To: elinks-users@linuxfromscratch.org\n" -"POT-Creation-Date: 2020-06-26 19:00+0200\n" +"POT-Creation-Date: 2020-07-26 15:28+0200\n" "PO-Revision-Date: 2003-01-03 03:41+0100\n" "Last-Translator: Yevgeny Gromov \n" "Language-Team: Belarusian \n" @@ -187,7 +187,7 @@ msgstr "Пустыя радкі не дазваляюцца" #: src/dialogs/options.c:244 src/dialogs/options.c:323 src/mime/dialogs.c:133 #: src/protocol/auth/dialogs.c:160 src/protocol/bittorrent/dialogs.c:820 #: src/scripting/lua/core.c:402 src/scripting/lua/core.c:483 -#: src/session/download.c:840 src/session/download.c:1666 +#: src/session/download.c:840 src/session/download.c:1684 #: src/viewer/text/search.c:1937 #, fuzzy msgid "~Cancel" @@ -206,7 +206,7 @@ msgstr "" #: src/config/options.inc:1343 src/ecmascript/ecmascript.c:44 #: src/globhist/globhist.c:64 src/mime/backend/mailcap.c:93 #: src/mime/backend/mimetypes.c:52 src/network/ssl/ssl.c:129 -#: src/network/ssl/ssl.c:278 +#: src/network/ssl/ssl.c:282 #, fuzzy msgid "Enable" msgstr "метка" @@ -2008,7 +2008,7 @@ msgstr "Тут нельга дадаць параметр" #. accelerator_context(src/config/dialogs.c:keybinding_buttons, src/config/dialogs.c:option_buttons, src/cookies/dialogs.c:cookie_buttons, src/formhist/dialogs.c:formhist_buttons, src/protocol/bittorrent/dialogs.c:bittorrent_query_callback, src/session/download.c:do_type_query, terminal_options) #: src/config/dialogs.c:505 src/config/dialogs.c:933 src/cookies/dialogs.c:543 #: src/dialogs/options.c:243 src/formhist/dialogs.c:214 -#: src/protocol/bittorrent/dialogs.c:807 src/session/download.c:1650 +#: src/protocol/bittorrent/dialogs.c:807 src/session/download.c:1668 #, fuzzy msgid "Sa~ve" msgstr "Захаваць" @@ -4603,7 +4603,7 @@ msgid "Domain" msgstr "Інфармацыя пра дакумент" #: src/cookies/dialogs.c:41 src/mime/backend/mailcap.c:97 -#: src/mime/backend/mimetypes.c:56 src/protocol/file/cgi.c:44 +#: src/mime/backend/mimetypes.c:56 src/protocol/file/cgi.c:45 msgid "Path" msgstr "" @@ -6379,26 +6379,27 @@ msgstr "Няма праграмы" #: src/mime/backend/default.c:76 #, no-c-format msgid "" -"External viewer for this file type. '%' in this string will be substituted " -"by a file name. Do _not_ put single- or double-quotes around the % sign." +"External viewer for this file type. '%f' in this string will be substituted " +"by a file name, '%u' by its uri. Do _not_ put single- or double-quotes " +"around the % sign." msgstr "" -#: src/mime/backend/default.c:81 +#: src/mime/backend/default.c:82 #, fuzzy msgid "File extension associations" msgstr "Расшырэнні файлаў" -#: src/mime/backend/default.c:83 +#: src/mime/backend/default.c:84 msgid "Extension <-> MIME type association." msgstr "" -#: src/mime/backend/default.c:87 +#: src/mime/backend/default.c:88 msgid "" "MIME-type matching this file extension ('*' is used here in place of '.')." msgstr "" #. name: -#: src/mime/backend/default.c:219 +#: src/mime/backend/default.c:220 msgid "Option system" msgstr "" @@ -6528,24 +6529,24 @@ msgid "" "configuration of OpenSSL by the user." msgstr "" -#: src/network/ssl/ssl.c:121 +#: src/network/ssl/ssl.c:121 src/network/ssl/ssl.c:251 msgid "Use HTTPS by default" msgstr "" -#: src/network/ssl/ssl.c:123 +#: src/network/ssl/ssl.c:123 src/network/ssl/ssl.c:253 msgid "Use HTTPS when a URL scheme is not provided." msgstr "" -#: src/network/ssl/ssl.c:125 src/network/ssl/ssl.c:274 +#: src/network/ssl/ssl.c:125 src/network/ssl/ssl.c:278 msgid "Client Certificates" msgstr "" -#: src/network/ssl/ssl.c:127 src/network/ssl/ssl.c:276 +#: src/network/ssl/ssl.c:127 src/network/ssl/ssl.c:280 #, fuzzy msgid "X509 client certificate options." msgstr "Настройкі тэрмінала" -#: src/network/ssl/ssl.c:131 src/network/ssl/ssl.c:280 +#: src/network/ssl/ssl.c:131 src/network/ssl/ssl.c:284 msgid "" "Enable or not the sending of X509 client certificates to servers which " "request them." @@ -6569,12 +6570,12 @@ msgid "" "The database can be also shared with Mozilla browsers." msgstr "" -#: src/network/ssl/ssl.c:149 src/network/ssl/ssl.c:283 +#: src/network/ssl/ssl.c:149 src/network/ssl/ssl.c:287 #, fuzzy msgid "Certificate File" msgstr "Чакаемы час" -#: src/network/ssl/ssl.c:151 src/network/ssl/ssl.c:285 +#: src/network/ssl/ssl.c:151 src/network/ssl/ssl.c:289 msgid "" "The location of a file containing the client certificate and unencrypted " "private key in PEM format. If unset, the file pointed to by the " @@ -6595,12 +6596,12 @@ msgstr "" #. * of binary packages should of course change the default to #. * suit their systems. #. * TODO: If the file name is relative, look in elinks_home? -#: src/network/ssl/ssl.c:259 +#: src/network/ssl/ssl.c:263 #, fuzzy msgid "Trusted CA file" msgstr "Перасылка" -#: src/network/ssl/ssl.c:266 +#: src/network/ssl/ssl.c:270 msgid "" "The location of a file containing certificates of trusted certification " "authorities in PEM format. ELinks then trusts certificates issued by these " @@ -6611,11 +6612,11 @@ msgid "" msgstr "" #. name: -#: src/network/ssl/ssl.c:306 src/network/ssl/ssl.c:323 +#: src/network/ssl/ssl.c:310 src/network/ssl/ssl.c:327 msgid "SSL" msgstr "" -#: src/network/ssl/ssl.c:308 +#: src/network/ssl/ssl.c:312 #, fuzzy msgid "SSL options." msgstr "Захаваць настройкі" @@ -7557,7 +7558,7 @@ msgstr "" msgid "Information about the torrent" msgstr "Скачаць відарыс" -#: src/protocol/bittorrent/dialogs.c:782 src/session/download.c:1553 +#: src/protocol/bittorrent/dialogs.c:782 src/session/download.c:1571 msgid "What to do?" msgstr "Што рабіць?" @@ -7568,40 +7569,40 @@ msgid "Down~load" msgstr "Закачка" #. accelerator_context(src/protocol/bittorrent/dialogs.c:bittorrent_query_callback, src/session/download.c:do_type_query) -#: src/protocol/bittorrent/dialogs.c:810 src/session/download.c:1656 +#: src/protocol/bittorrent/dialogs.c:810 src/session/download.c:1674 #, fuzzy msgid "~Display" msgstr "Паказаць" #. accelerator_context(src/protocol/bittorrent/dialogs.c:bittorrent_query_callback, src/session/download.c:do_type_query) -#: src/protocol/bittorrent/dialogs.c:814 src/session/download.c:1660 +#: src/protocol/bittorrent/dialogs.c:814 src/session/download.c:1678 msgid "Show ~header" msgstr "" -#: src/protocol/file/cgi.c:40 +#: src/protocol/file/cgi.c:41 #, fuzzy msgid "Local CGI" msgstr "файлаў" -#: src/protocol/file/cgi.c:42 +#: src/protocol/file/cgi.c:43 #, fuzzy msgid "Local CGI specific options." msgstr "Не ўказана праграма для" -#: src/protocol/file/cgi.c:46 +#: src/protocol/file/cgi.c:47 msgid "Colon separated list of directories, where CGI scripts are stored." msgstr "" -#: src/protocol/file/cgi.c:49 +#: src/protocol/file/cgi.c:50 msgid "Allow local CGI" msgstr "" -#: src/protocol/file/cgi.c:51 +#: src/protocol/file/cgi.c:52 msgid "Whether to execute local CGI scripts." msgstr "" #. name: -#: src/protocol/file/cgi.c:56 +#: src/protocol/file/cgi.c:57 msgid "CGI" msgstr "" @@ -8113,7 +8114,7 @@ msgid "" msgstr "" #. name: -#: src/protocol/rewrite/rewrite.c:360 +#: src/protocol/rewrite/rewrite.c:348 msgid "URI rewrite" msgstr "" @@ -8299,37 +8300,37 @@ msgstr "" msgid "~Resume download of the original file" msgstr "" -#: src/session/download.c:1556 +#: src/session/download.c:1574 msgid "Unknown type" msgstr "Невядомы тып" -#: src/session/download.c:1581 +#: src/session/download.c:1599 #, c-format msgid "What would you like to do with the file '%s' (type: %s%s%s)?" msgstr "" -#: src/session/download.c:1584 +#: src/session/download.c:1602 #, c-format msgid "What would you like to do with the file (type: %s%s%s)?" msgstr "" -#: src/session/download.c:1612 +#: src/session/download.c:1630 #, no-c-format msgid "Program ('%' will be replaced by the filename)" msgstr "" -#: src/session/download.c:1616 +#: src/session/download.c:1634 #, fuzzy msgid "Block the terminal" msgstr "Тэрмінал BeOS" -#: src/session/download.c:1622 +#: src/session/download.c:1640 #, c-format msgid "The file will be opened with the program '%s'." msgstr "" #. accelerator_context(src/session/download.c:do_type_query) -#: src/session/download.c:1643 +#: src/session/download.c:1661 #, fuzzy msgid "~Open" msgstr "Адкрыць" diff --git a/po/bg.po b/po/bg.po index 995a14af..569eb1fa 100644 --- a/po/bg.po +++ b/po/bg.po @@ -10,7 +10,7 @@ msgid "" msgstr "" "Project-Id-Version: ELinks 0.5pre0.CVS\n" "Report-Msgid-Bugs-To: elinks-users@linuxfromscratch.org\n" -"POT-Creation-Date: 2020-06-26 19:00+0200\n" +"POT-Creation-Date: 2020-07-26 15:28+0200\n" "PO-Revision-Date: 2003-01-03 03:41+0100\n" "Last-Translator: Dimitar Dimitrov \n" "Language-Team: Bulgarian \n" @@ -203,7 +203,7 @@ msgstr "Не е позволен празен символен низ" #: src/dialogs/options.c:244 src/dialogs/options.c:323 src/mime/dialogs.c:133 #: src/protocol/auth/dialogs.c:160 src/protocol/bittorrent/dialogs.c:820 #: src/scripting/lua/core.c:402 src/scripting/lua/core.c:483 -#: src/session/download.c:840 src/session/download.c:1666 +#: src/session/download.c:840 src/session/download.c:1684 #: src/viewer/text/search.c:1937 #, fuzzy msgid "~Cancel" @@ -222,7 +222,7 @@ msgstr "" #: src/config/options.inc:1343 src/ecmascript/ecmascript.c:44 #: src/globhist/globhist.c:64 src/mime/backend/mailcap.c:93 #: src/mime/backend/mimetypes.c:52 src/network/ssl/ssl.c:129 -#: src/network/ssl/ssl.c:278 +#: src/network/ssl/ssl.c:282 #, fuzzy msgid "Enable" msgstr "име" @@ -2038,7 +2038,7 @@ msgstr "Изтрий опция" #. accelerator_context(src/config/dialogs.c:keybinding_buttons, src/config/dialogs.c:option_buttons, src/cookies/dialogs.c:cookie_buttons, src/formhist/dialogs.c:formhist_buttons, src/protocol/bittorrent/dialogs.c:bittorrent_query_callback, src/session/download.c:do_type_query, terminal_options) #: src/config/dialogs.c:505 src/config/dialogs.c:933 src/cookies/dialogs.c:543 #: src/dialogs/options.c:243 src/formhist/dialogs.c:214 -#: src/protocol/bittorrent/dialogs.c:807 src/session/download.c:1650 +#: src/protocol/bittorrent/dialogs.c:807 src/session/download.c:1668 #, fuzzy msgid "Sa~ve" msgstr "Запазване" @@ -4630,7 +4630,7 @@ msgid "Domain" msgstr "Информация за документа" #: src/cookies/dialogs.c:41 src/mime/backend/mailcap.c:97 -#: src/mime/backend/mimetypes.c:56 src/protocol/file/cgi.c:44 +#: src/mime/backend/mimetypes.c:56 src/protocol/file/cgi.c:45 msgid "Path" msgstr "" @@ -6443,26 +6443,27 @@ msgstr "Няма програма" #: src/mime/backend/default.c:76 #, no-c-format msgid "" -"External viewer for this file type. '%' in this string will be substituted " -"by a file name. Do _not_ put single- or double-quotes around the % sign." +"External viewer for this file type. '%f' in this string will be substituted " +"by a file name, '%u' by its uri. Do _not_ put single- or double-quotes " +"around the % sign." msgstr "" -#: src/mime/backend/default.c:81 +#: src/mime/backend/default.c:82 #, fuzzy msgid "File extension associations" msgstr "Файлови разширения" -#: src/mime/backend/default.c:83 +#: src/mime/backend/default.c:84 msgid "Extension <-> MIME type association." msgstr "" -#: src/mime/backend/default.c:87 +#: src/mime/backend/default.c:88 msgid "" "MIME-type matching this file extension ('*' is used here in place of '.')." msgstr "" #. name: -#: src/mime/backend/default.c:219 +#: src/mime/backend/default.c:220 msgid "Option system" msgstr "" @@ -6592,24 +6593,24 @@ msgid "" "configuration of OpenSSL by the user." msgstr "" -#: src/network/ssl/ssl.c:121 +#: src/network/ssl/ssl.c:121 src/network/ssl/ssl.c:251 msgid "Use HTTPS by default" msgstr "" -#: src/network/ssl/ssl.c:123 +#: src/network/ssl/ssl.c:123 src/network/ssl/ssl.c:253 msgid "Use HTTPS when a URL scheme is not provided." msgstr "" -#: src/network/ssl/ssl.c:125 src/network/ssl/ssl.c:274 +#: src/network/ssl/ssl.c:125 src/network/ssl/ssl.c:278 msgid "Client Certificates" msgstr "" -#: src/network/ssl/ssl.c:127 src/network/ssl/ssl.c:276 +#: src/network/ssl/ssl.c:127 src/network/ssl/ssl.c:280 #, fuzzy msgid "X509 client certificate options." msgstr "Настройки на терминала" -#: src/network/ssl/ssl.c:131 src/network/ssl/ssl.c:280 +#: src/network/ssl/ssl.c:131 src/network/ssl/ssl.c:284 msgid "" "Enable or not the sending of X509 client certificates to servers which " "request them." @@ -6633,12 +6634,12 @@ msgid "" "The database can be also shared with Mozilla browsers." msgstr "" -#: src/network/ssl/ssl.c:149 src/network/ssl/ssl.c:283 +#: src/network/ssl/ssl.c:149 src/network/ssl/ssl.c:287 #, fuzzy msgid "Certificate File" msgstr "Прогнозирано време" -#: src/network/ssl/ssl.c:151 src/network/ssl/ssl.c:285 +#: src/network/ssl/ssl.c:151 src/network/ssl/ssl.c:289 msgid "" "The location of a file containing the client certificate and unencrypted " "private key in PEM format. If unset, the file pointed to by the " @@ -6659,12 +6660,12 @@ msgstr "" #. * of binary packages should of course change the default to #. * suit their systems. #. * TODO: If the file name is relative, look in elinks_home? -#: src/network/ssl/ssl.c:259 +#: src/network/ssl/ssl.c:263 #, fuzzy msgid "Trusted CA file" msgstr "Предаване" -#: src/network/ssl/ssl.c:266 +#: src/network/ssl/ssl.c:270 msgid "" "The location of a file containing certificates of trusted certification " "authorities in PEM format. ELinks then trusts certificates issued by these " @@ -6675,11 +6676,11 @@ msgid "" msgstr "" #. name: -#: src/network/ssl/ssl.c:306 src/network/ssl/ssl.c:323 +#: src/network/ssl/ssl.c:310 src/network/ssl/ssl.c:327 msgid "SSL" msgstr "" -#: src/network/ssl/ssl.c:308 +#: src/network/ssl/ssl.c:312 #, fuzzy msgid "SSL options." msgstr "Запази настройките" @@ -7627,7 +7628,7 @@ msgstr "HTTP 100 (???)" msgid "Information about the torrent" msgstr "Премести курсора надолу" -#: src/protocol/bittorrent/dialogs.c:782 src/session/download.c:1553 +#: src/protocol/bittorrent/dialogs.c:782 src/session/download.c:1571 msgid "What to do?" msgstr "Какво да правя?" @@ -7638,40 +7639,40 @@ msgid "Down~load" msgstr "Свали (дръпни, изтегли)" #. accelerator_context(src/protocol/bittorrent/dialogs.c:bittorrent_query_callback, src/session/download.c:do_type_query) -#: src/protocol/bittorrent/dialogs.c:810 src/session/download.c:1656 +#: src/protocol/bittorrent/dialogs.c:810 src/session/download.c:1674 #, fuzzy msgid "~Display" msgstr "Показване" #. accelerator_context(src/protocol/bittorrent/dialogs.c:bittorrent_query_callback, src/session/download.c:do_type_query) -#: src/protocol/bittorrent/dialogs.c:814 src/session/download.c:1660 +#: src/protocol/bittorrent/dialogs.c:814 src/session/download.c:1678 msgid "Show ~header" msgstr "" -#: src/protocol/file/cgi.c:40 +#: src/protocol/file/cgi.c:41 #, fuzzy msgid "Local CGI" msgstr "файла" -#: src/protocol/file/cgi.c:42 +#: src/protocol/file/cgi.c:43 #, fuzzy msgid "Local CGI specific options." msgstr "Не е посочена програма за" -#: src/protocol/file/cgi.c:46 +#: src/protocol/file/cgi.c:47 msgid "Colon separated list of directories, where CGI scripts are stored." msgstr "" -#: src/protocol/file/cgi.c:49 +#: src/protocol/file/cgi.c:50 msgid "Allow local CGI" msgstr "" -#: src/protocol/file/cgi.c:51 +#: src/protocol/file/cgi.c:52 msgid "Whether to execute local CGI scripts." msgstr "" #. name: -#: src/protocol/file/cgi.c:56 +#: src/protocol/file/cgi.c:57 msgid "CGI" msgstr "" @@ -8182,7 +8183,7 @@ msgid "" msgstr "" #. name: -#: src/protocol/rewrite/rewrite.c:360 +#: src/protocol/rewrite/rewrite.c:348 msgid "URI rewrite" msgstr "" @@ -8371,37 +8372,37 @@ msgstr "Запиши под друго име" msgid "~Resume download of the original file" msgstr "Продължи тегленето на оригиналния файл" -#: src/session/download.c:1556 +#: src/session/download.c:1574 msgid "Unknown type" msgstr "Непознат тип" -#: src/session/download.c:1581 +#: src/session/download.c:1599 #, fuzzy, c-format msgid "What would you like to do with the file '%s' (type: %s%s%s)?" msgstr "HTTP 100 (???)" -#: src/session/download.c:1584 +#: src/session/download.c:1602 #, fuzzy, c-format msgid "What would you like to do with the file (type: %s%s%s)?" msgstr "HTTP 100 (???)" -#: src/session/download.c:1612 +#: src/session/download.c:1630 #, no-c-format msgid "Program ('%' will be replaced by the filename)" msgstr "" -#: src/session/download.c:1616 +#: src/session/download.c:1634 #, fuzzy msgid "Block the terminal" msgstr "BeOS терминал" -#: src/session/download.c:1622 +#: src/session/download.c:1640 #, c-format msgid "The file will be opened with the program '%s'." msgstr "" #. accelerator_context(src/session/download.c:do_type_query) -#: src/session/download.c:1643 +#: src/session/download.c:1661 #, fuzzy msgid "~Open" msgstr "Отвори" diff --git a/po/ca.po b/po/ca.po index 5e9bf004..e50d4ada 100644 --- a/po/ca.po +++ b/po/ca.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: ELinks 0.5pre0.CVS\n" "Report-Msgid-Bugs-To: elinks-users@linuxfromscratch.org\n" -"POT-Creation-Date: 2020-06-26 19:00+0200\n" +"POT-Creation-Date: 2020-07-26 15:28+0200\n" "PO-Revision-Date: 2003-01-03 03:41+0100\n" "Last-Translator: Carles Sadurní Anguita \n" "Language-Team: Catalan \n" @@ -186,7 +186,7 @@ msgstr "No s'hi permeten cadenes buides" #: src/dialogs/options.c:244 src/dialogs/options.c:323 src/mime/dialogs.c:133 #: src/protocol/auth/dialogs.c:160 src/protocol/bittorrent/dialogs.c:820 #: src/scripting/lua/core.c:402 src/scripting/lua/core.c:483 -#: src/session/download.c:840 src/session/download.c:1666 +#: src/session/download.c:840 src/session/download.c:1684 #: src/viewer/text/search.c:1937 #, fuzzy msgid "~Cancel" @@ -205,7 +205,7 @@ msgstr "" #: src/config/options.inc:1343 src/ecmascript/ecmascript.c:44 #: src/globhist/globhist.c:64 src/mime/backend/mailcap.c:93 #: src/mime/backend/mimetypes.c:52 src/network/ssl/ssl.c:129 -#: src/network/ssl/ssl.c:278 +#: src/network/ssl/ssl.c:282 #, fuzzy msgid "Enable" msgstr "nom" @@ -1996,7 +1996,7 @@ msgstr "" #. accelerator_context(src/config/dialogs.c:keybinding_buttons, src/config/dialogs.c:option_buttons, src/cookies/dialogs.c:cookie_buttons, src/formhist/dialogs.c:formhist_buttons, src/protocol/bittorrent/dialogs.c:bittorrent_query_callback, src/session/download.c:do_type_query, terminal_options) #: src/config/dialogs.c:505 src/config/dialogs.c:933 src/cookies/dialogs.c:543 #: src/dialogs/options.c:243 src/formhist/dialogs.c:214 -#: src/protocol/bittorrent/dialogs.c:807 src/session/download.c:1650 +#: src/protocol/bittorrent/dialogs.c:807 src/session/download.c:1668 #, fuzzy msgid "Sa~ve" msgstr "Desar" @@ -4576,7 +4576,7 @@ msgid "Domain" msgstr "~Informació del document" #: src/cookies/dialogs.c:41 src/mime/backend/mailcap.c:97 -#: src/mime/backend/mimetypes.c:56 src/protocol/file/cgi.c:44 +#: src/mime/backend/mimetypes.c:56 src/protocol/file/cgi.c:45 msgid "Path" msgstr "" @@ -6344,26 +6344,27 @@ msgstr "Cap programa" #: src/mime/backend/default.c:76 #, no-c-format msgid "" -"External viewer for this file type. '%' in this string will be substituted " -"by a file name. Do _not_ put single- or double-quotes around the % sign." +"External viewer for this file type. '%f' in this string will be substituted " +"by a file name, '%u' by its uri. Do _not_ put single- or double-quotes " +"around the % sign." msgstr "" -#: src/mime/backend/default.c:81 +#: src/mime/backend/default.c:82 #, fuzzy msgid "File extension associations" msgstr "~Extensions de fitxers" -#: src/mime/backend/default.c:83 +#: src/mime/backend/default.c:84 msgid "Extension <-> MIME type association." msgstr "" -#: src/mime/backend/default.c:87 +#: src/mime/backend/default.c:88 msgid "" "MIME-type matching this file extension ('*' is used here in place of '.')." msgstr "" #. name: -#: src/mime/backend/default.c:219 +#: src/mime/backend/default.c:220 msgid "Option system" msgstr "" @@ -6493,24 +6494,24 @@ msgid "" "configuration of OpenSSL by the user." msgstr "" -#: src/network/ssl/ssl.c:121 +#: src/network/ssl/ssl.c:121 src/network/ssl/ssl.c:251 msgid "Use HTTPS by default" msgstr "" -#: src/network/ssl/ssl.c:123 +#: src/network/ssl/ssl.c:123 src/network/ssl/ssl.c:253 msgid "Use HTTPS when a URL scheme is not provided." msgstr "" -#: src/network/ssl/ssl.c:125 src/network/ssl/ssl.c:274 +#: src/network/ssl/ssl.c:125 src/network/ssl/ssl.c:278 msgid "Client Certificates" msgstr "" -#: src/network/ssl/ssl.c:127 src/network/ssl/ssl.c:276 +#: src/network/ssl/ssl.c:127 src/network/ssl/ssl.c:280 #, fuzzy msgid "X509 client certificate options." msgstr "Opcions del terminal" -#: src/network/ssl/ssl.c:131 src/network/ssl/ssl.c:280 +#: src/network/ssl/ssl.c:131 src/network/ssl/ssl.c:284 msgid "" "Enable or not the sending of X509 client certificates to servers which " "request them." @@ -6534,12 +6535,12 @@ msgid "" "The database can be also shared with Mozilla browsers." msgstr "" -#: src/network/ssl/ssl.c:149 src/network/ssl/ssl.c:283 +#: src/network/ssl/ssl.c:149 src/network/ssl/ssl.c:287 #, fuzzy msgid "Certificate File" msgstr "temps estimat" -#: src/network/ssl/ssl.c:151 src/network/ssl/ssl.c:285 +#: src/network/ssl/ssl.c:151 src/network/ssl/ssl.c:289 msgid "" "The location of a file containing the client certificate and unencrypted " "private key in PEM format. If unset, the file pointed to by the " @@ -6560,12 +6561,12 @@ msgstr "" #. * of binary packages should of course change the default to #. * suit their systems. #. * TODO: If the file name is relative, look in elinks_home? -#: src/network/ssl/ssl.c:259 +#: src/network/ssl/ssl.c:263 #, fuzzy msgid "Trusted CA file" msgstr "Transferint" -#: src/network/ssl/ssl.c:266 +#: src/network/ssl/ssl.c:270 msgid "" "The location of a file containing certificates of trusted certification " "authorities in PEM format. ELinks then trusts certificates issued by these " @@ -6576,11 +6577,11 @@ msgid "" msgstr "" #. name: -#: src/network/ssl/ssl.c:306 src/network/ssl/ssl.c:323 +#: src/network/ssl/ssl.c:310 src/network/ssl/ssl.c:327 msgid "SSL" msgstr "" -#: src/network/ssl/ssl.c:308 +#: src/network/ssl/ssl.c:312 #, fuzzy msgid "SSL options." msgstr "Desar opcions" @@ -7520,7 +7521,7 @@ msgstr "" msgid "Information about the torrent" msgstr "Descarregar imat~ge" -#: src/protocol/bittorrent/dialogs.c:782 src/session/download.c:1553 +#: src/protocol/bittorrent/dialogs.c:782 src/session/download.c:1571 msgid "What to do?" msgstr "Què en fem?" @@ -7531,40 +7532,40 @@ msgid "Down~load" msgstr "Descarregar" #. accelerator_context(src/protocol/bittorrent/dialogs.c:bittorrent_query_callback, src/session/download.c:do_type_query) -#: src/protocol/bittorrent/dialogs.c:810 src/session/download.c:1656 +#: src/protocol/bittorrent/dialogs.c:810 src/session/download.c:1674 #, fuzzy msgid "~Display" msgstr "Mostrar" #. accelerator_context(src/protocol/bittorrent/dialogs.c:bittorrent_query_callback, src/session/download.c:do_type_query) -#: src/protocol/bittorrent/dialogs.c:814 src/session/download.c:1660 +#: src/protocol/bittorrent/dialogs.c:814 src/session/download.c:1678 msgid "Show ~header" msgstr "" -#: src/protocol/file/cgi.c:40 +#: src/protocol/file/cgi.c:41 #, fuzzy msgid "Local CGI" msgstr "fitxers" -#: src/protocol/file/cgi.c:42 +#: src/protocol/file/cgi.c:43 #, fuzzy msgid "Local CGI specific options." msgstr "No hi ha cap programa especificat per a" -#: src/protocol/file/cgi.c:46 +#: src/protocol/file/cgi.c:47 msgid "Colon separated list of directories, where CGI scripts are stored." msgstr "" -#: src/protocol/file/cgi.c:49 +#: src/protocol/file/cgi.c:50 msgid "Allow local CGI" msgstr "" -#: src/protocol/file/cgi.c:51 +#: src/protocol/file/cgi.c:52 msgid "Whether to execute local CGI scripts." msgstr "" #. name: -#: src/protocol/file/cgi.c:56 +#: src/protocol/file/cgi.c:57 msgid "CGI" msgstr "" @@ -8072,7 +8073,7 @@ msgid "" msgstr "" #. name: -#: src/protocol/rewrite/rewrite.c:360 +#: src/protocol/rewrite/rewrite.c:348 msgid "URI rewrite" msgstr "" @@ -8256,37 +8257,37 @@ msgstr "" msgid "~Resume download of the original file" msgstr "" -#: src/session/download.c:1556 +#: src/session/download.c:1574 msgid "Unknown type" msgstr "Tipus desconegut" -#: src/session/download.c:1581 +#: src/session/download.c:1599 #, c-format msgid "What would you like to do with the file '%s' (type: %s%s%s)?" msgstr "" -#: src/session/download.c:1584 +#: src/session/download.c:1602 #, c-format msgid "What would you like to do with the file (type: %s%s%s)?" msgstr "" -#: src/session/download.c:1612 +#: src/session/download.c:1630 #, no-c-format msgid "Program ('%' will be replaced by the filename)" msgstr "" -#: src/session/download.c:1616 +#: src/session/download.c:1634 #, fuzzy msgid "Block the terminal" msgstr "Terminal ~BeOS" -#: src/session/download.c:1622 +#: src/session/download.c:1640 #, c-format msgid "The file will be opened with the program '%s'." msgstr "" #. accelerator_context(src/session/download.c:do_type_query) -#: src/session/download.c:1643 +#: src/session/download.c:1661 #, fuzzy msgid "~Open" msgstr "Obrir" diff --git a/po/cs.po b/po/cs.po index ebd3994d..ccfaf5f8 100644 --- a/po/cs.po +++ b/po/cs.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: ELinks 0.5pre0.CVS\n" "Report-Msgid-Bugs-To: elinks-users@linuxfromscratch.org\n" -"POT-Creation-Date: 2020-06-26 19:00+0200\n" +"POT-Creation-Date: 2020-07-26 15:28+0200\n" "PO-Revision-Date: 2005-01-04 00:42+0100\n" "Last-Translator: Petr Baudis \n" "Language-Team: Czech \n" @@ -183,7 +183,7 @@ msgstr "Napiš tam něco" #: src/dialogs/options.c:244 src/dialogs/options.c:323 src/mime/dialogs.c:133 #: src/protocol/auth/dialogs.c:160 src/protocol/bittorrent/dialogs.c:820 #: src/scripting/lua/core.c:402 src/scripting/lua/core.c:483 -#: src/session/download.c:840 src/session/download.c:1666 +#: src/session/download.c:840 src/session/download.c:1684 #: src/viewer/text/search.c:1937 #, fuzzy msgid "~Cancel" @@ -201,7 +201,7 @@ msgstr "Digitální hodiny na stavové liště." #: src/config/options.inc:1343 src/ecmascript/ecmascript.c:44 #: src/globhist/globhist.c:64 src/mime/backend/mailcap.c:93 #: src/mime/backend/mimetypes.c:52 src/network/ssl/ssl.c:129 -#: src/network/ssl/ssl.c:278 +#: src/network/ssl/ssl.c:282 msgid "Enable" msgstr "Zapnout" @@ -2008,7 +2008,7 @@ msgstr "Do této složky nemůžu přidat novou volbu." #. accelerator_context(src/config/dialogs.c:keybinding_buttons, src/config/dialogs.c:option_buttons, src/cookies/dialogs.c:cookie_buttons, src/formhist/dialogs.c:formhist_buttons, src/protocol/bittorrent/dialogs.c:bittorrent_query_callback, src/session/download.c:do_type_query, terminal_options) #: src/config/dialogs.c:505 src/config/dialogs.c:933 src/cookies/dialogs.c:543 #: src/dialogs/options.c:243 src/formhist/dialogs.c:214 -#: src/protocol/bittorrent/dialogs.c:807 src/session/download.c:1650 +#: src/protocol/bittorrent/dialogs.c:807 src/session/download.c:1668 #, fuzzy msgid "Sa~ve" msgstr "Uložit" @@ -4858,7 +4858,7 @@ msgid "Domain" msgstr "Doména" #: src/cookies/dialogs.c:41 src/mime/backend/mailcap.c:97 -#: src/mime/backend/mimetypes.c:56 src/protocol/file/cgi.c:44 +#: src/mime/backend/mimetypes.c:56 src/protocol/file/cgi.c:45 msgid "Path" msgstr "Cesta" @@ -6586,28 +6586,29 @@ msgstr "Program" #: src/mime/backend/default.c:76 #, fuzzy, no-c-format msgid "" -"External viewer for this file type. '%' in this string will be substituted " -"by a file name. Do _not_ put single- or double-quotes around the % sign." +"External viewer for this file type. '%f' in this string will be substituted " +"by a file name, '%u' by its uri. Do _not_ put single- or double-quotes " +"around the % sign." msgstr "" "Externí prohlížeč pro tento typ souboru. V tomto řetězci bude '%' nahrazeno\n" "jménem souboru." -#: src/mime/backend/default.c:81 +#: src/mime/backend/default.c:82 msgid "File extension associations" msgstr "Asociace přípon souborů" -#: src/mime/backend/default.c:83 +#: src/mime/backend/default.c:84 msgid "Extension <-> MIME type association." msgstr "Asociace mezi příponou souboru a jeho MIME typem." -#: src/mime/backend/default.c:87 +#: src/mime/backend/default.c:88 #, fuzzy msgid "" "MIME-type matching this file extension ('*' is used here in place of '.')." msgstr "MIME typ odpovídající této příponě (místo '.' se používá '*')." #. name: -#: src/mime/backend/default.c:219 +#: src/mime/backend/default.c:220 msgid "Option system" msgstr "Konfigurační systém" @@ -6764,23 +6765,23 @@ msgstr "" "Ověřit SSL certifikát druhé strany. Ke zprovoznění tohoto nastavení\n" "je třeba odpovídajícím způsobem nakonfigurovat OpenSSL." -#: src/network/ssl/ssl.c:121 +#: src/network/ssl/ssl.c:121 src/network/ssl/ssl.c:251 msgid "Use HTTPS by default" msgstr "" -#: src/network/ssl/ssl.c:123 +#: src/network/ssl/ssl.c:123 src/network/ssl/ssl.c:253 msgid "Use HTTPS when a URL scheme is not provided." msgstr "" -#: src/network/ssl/ssl.c:125 src/network/ssl/ssl.c:274 +#: src/network/ssl/ssl.c:125 src/network/ssl/ssl.c:278 msgid "Client Certificates" msgstr "Klientské certifikáty" -#: src/network/ssl/ssl.c:127 src/network/ssl/ssl.c:276 +#: src/network/ssl/ssl.c:127 src/network/ssl/ssl.c:280 msgid "X509 client certificate options." msgstr "Nastavení klientského certifikátu X509." -#: src/network/ssl/ssl.c:131 src/network/ssl/ssl.c:280 +#: src/network/ssl/ssl.c:131 src/network/ssl/ssl.c:284 #, fuzzy msgid "" "Enable or not the sending of X509 client certificates to servers which " @@ -6807,11 +6808,11 @@ msgid "" "The database can be also shared with Mozilla browsers." msgstr "" -#: src/network/ssl/ssl.c:149 src/network/ssl/ssl.c:283 +#: src/network/ssl/ssl.c:149 src/network/ssl/ssl.c:287 msgid "Certificate File" msgstr "Soubor s certifikátem" -#: src/network/ssl/ssl.c:151 src/network/ssl/ssl.c:285 +#: src/network/ssl/ssl.c:151 src/network/ssl/ssl.c:289 #, fuzzy msgid "" "The location of a file containing the client certificate and unencrypted " @@ -6839,12 +6840,12 @@ msgstr "" #. * of binary packages should of course change the default to #. * suit their systems. #. * TODO: If the file name is relative, look in elinks_home? -#: src/network/ssl/ssl.c:259 +#: src/network/ssl/ssl.c:263 #, fuzzy msgid "Trusted CA file" msgstr "Přenáším" -#: src/network/ssl/ssl.c:266 +#: src/network/ssl/ssl.c:270 msgid "" "The location of a file containing certificates of trusted certification " "authorities in PEM format. ELinks then trusts certificates issued by these " @@ -6855,11 +6856,11 @@ msgid "" msgstr "" #. name: -#: src/network/ssl/ssl.c:306 src/network/ssl/ssl.c:323 +#: src/network/ssl/ssl.c:310 src/network/ssl/ssl.c:327 msgid "SSL" msgstr "SSL" -#: src/network/ssl/ssl.c:308 +#: src/network/ssl/ssl.c:312 msgid "SSL options." msgstr "Nastavení SSL." @@ -7803,7 +7804,7 @@ msgstr "Chtěl bys zobrazit soubor '%s' (typ: %s)?" msgid "Information about the torrent" msgstr "Zobrazení informací o současné stránce" -#: src/protocol/bittorrent/dialogs.c:782 src/session/download.c:1553 +#: src/protocol/bittorrent/dialogs.c:782 src/session/download.c:1571 msgid "What to do?" msgstr "Co mám podle tebe dělat?" @@ -7814,39 +7815,39 @@ msgid "Down~load" msgstr "Stahování" #. accelerator_context(src/protocol/bittorrent/dialogs.c:bittorrent_query_callback, src/session/download.c:do_type_query) -#: src/protocol/bittorrent/dialogs.c:810 src/session/download.c:1656 +#: src/protocol/bittorrent/dialogs.c:810 src/session/download.c:1674 #, fuzzy msgid "~Display" msgstr "Zobrazit" #. accelerator_context(src/protocol/bittorrent/dialogs.c:bittorrent_query_callback, src/session/download.c:do_type_query) -#: src/protocol/bittorrent/dialogs.c:814 src/session/download.c:1660 +#: src/protocol/bittorrent/dialogs.c:814 src/session/download.c:1678 #, fuzzy msgid "Show ~header" msgstr "Zobrazit hlavičku" -#: src/protocol/file/cgi.c:40 +#: src/protocol/file/cgi.c:41 msgid "Local CGI" msgstr "Lokální CGI skripty" -#: src/protocol/file/cgi.c:42 +#: src/protocol/file/cgi.c:43 msgid "Local CGI specific options." msgstr "Nastavení spouštění lokálních CGI skriptů." -#: src/protocol/file/cgi.c:46 +#: src/protocol/file/cgi.c:47 msgid "Colon separated list of directories, where CGI scripts are stored." msgstr "Seznam adresářů (oddělených dvojtečkou), kde jsou uloženy CGI skripty." -#: src/protocol/file/cgi.c:49 +#: src/protocol/file/cgi.c:50 msgid "Allow local CGI" msgstr "Povolit lokální CGI skripty" -#: src/protocol/file/cgi.c:51 +#: src/protocol/file/cgi.c:52 msgid "Whether to execute local CGI scripts." msgstr "Zdalipak se mají spouštět lokální CGI skripty." #. name: -#: src/protocol/file/cgi.c:56 +#: src/protocol/file/cgi.c:57 msgid "CGI" msgstr "" @@ -8437,7 +8438,7 @@ msgid "" msgstr "" #. name: -#: src/protocol/rewrite/rewrite.c:360 +#: src/protocol/rewrite/rewrite.c:348 msgid "URI rewrite" msgstr "Přepisování URI" @@ -8650,37 +8651,37 @@ msgstr "Přepsat původní soubor" msgid "~Resume download of the original file" msgstr "Obnovit stahování původního souboru" -#: src/session/download.c:1556 +#: src/session/download.c:1574 msgid "Unknown type" msgstr "Neznámý typ" -#: src/session/download.c:1581 +#: src/session/download.c:1599 #, fuzzy, c-format msgid "What would you like to do with the file '%s' (type: %s%s%s)?" msgstr "Chtěl bys zobrazit soubor '%s' (typ: %s)?" -#: src/session/download.c:1584 +#: src/session/download.c:1602 #, fuzzy, c-format msgid "What would you like to do with the file (type: %s%s%s)?" msgstr "Chtěl bys zobrazit soubor '%s' (typ: %s)?" -#: src/session/download.c:1612 +#: src/session/download.c:1630 #, no-c-format msgid "Program ('%' will be replaced by the filename)" msgstr "" -#: src/session/download.c:1616 +#: src/session/download.c:1634 #, fuzzy msgid "Block the terminal" msgstr "Zablokovat terminál" -#: src/session/download.c:1622 +#: src/session/download.c:1640 #, c-format msgid "The file will be opened with the program '%s'." msgstr "" #. accelerator_context(src/session/download.c:do_type_query) -#: src/session/download.c:1643 +#: src/session/download.c:1661 #, fuzzy msgid "~Open" msgstr "Otevřít" diff --git a/po/da.po b/po/da.po index b1efd361..b86f457e 100644 --- a/po/da.po +++ b/po/da.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: ELinks 0.10.CVS\n" "Report-Msgid-Bugs-To: elinks-users@linuxfromscratch.org\n" -"POT-Creation-Date: 2020-06-26 19:00+0200\n" +"POT-Creation-Date: 2020-07-26 15:28+0200\n" "PO-Revision-Date: 2005-06-12 02:00+0200\n" "Last-Translator: Jonas Fonseca \n" "Language-Team: Danish \n" @@ -181,7 +181,7 @@ msgstr "Tom tekststreng ikke tilladt" #: src/dialogs/options.c:244 src/dialogs/options.c:323 src/mime/dialogs.c:133 #: src/protocol/auth/dialogs.c:160 src/protocol/bittorrent/dialogs.c:820 #: src/scripting/lua/core.c:402 src/scripting/lua/core.c:483 -#: src/session/download.c:840 src/session/download.c:1666 +#: src/session/download.c:840 src/session/download.c:1684 #: src/viewer/text/search.c:1937 msgid "~Cancel" msgstr "A~nnullér" @@ -198,7 +198,7 @@ msgstr "Digitalt ur i statuslinjen." #: src/config/options.inc:1343 src/ecmascript/ecmascript.c:44 #: src/globhist/globhist.c:64 src/mime/backend/mailcap.c:93 #: src/mime/backend/mimetypes.c:52 src/network/ssl/ssl.c:129 -#: src/network/ssl/ssl.c:278 +#: src/network/ssl/ssl.c:282 msgid "Enable" msgstr "Aktivér" @@ -2055,7 +2055,7 @@ msgstr "Indstillinger kan ikke tilføjes her." #. accelerator_context(src/config/dialogs.c:keybinding_buttons, src/config/dialogs.c:option_buttons, src/cookies/dialogs.c:cookie_buttons, src/formhist/dialogs.c:formhist_buttons, src/protocol/bittorrent/dialogs.c:bittorrent_query_callback, src/session/download.c:do_type_query, terminal_options) #: src/config/dialogs.c:505 src/config/dialogs.c:933 src/cookies/dialogs.c:543 #: src/dialogs/options.c:243 src/formhist/dialogs.c:214 -#: src/protocol/bittorrent/dialogs.c:807 src/session/download.c:1650 +#: src/protocol/bittorrent/dialogs.c:807 src/session/download.c:1668 msgid "Sa~ve" msgstr "~Gem" @@ -5014,7 +5014,7 @@ msgid "Domain" msgstr "Domæne" #: src/cookies/dialogs.c:41 src/mime/backend/mailcap.c:97 -#: src/mime/backend/mimetypes.c:56 src/protocol/file/cgi.c:44 +#: src/mime/backend/mimetypes.c:56 src/protocol/file/cgi.c:45 msgid "Path" msgstr "Sti" @@ -6748,29 +6748,30 @@ msgstr "Program" #: src/mime/backend/default.c:76 #, fuzzy, no-c-format msgid "" -"External viewer for this file type. '%' in this string will be substituted " -"by a file name. Do _not_ put single- or double-quotes around the % sign." +"External viewer for this file type. '%f' in this string will be substituted " +"by a file name, '%u' by its uri. Do _not_ put single- or double-quotes " +"around the % sign." msgstr "" "Ekstern fremviser for denne filtype. Et '%' i denne tekststreng vil\n" "blive erstattet af et filnavn.\n" "Omring _ikke_ % med enkelt- eller dobbelt-citationstegn." -#: src/mime/backend/default.c:81 +#: src/mime/backend/default.c:82 msgid "File extension associations" msgstr "Programhåndtering efter filendelse" -#: src/mime/backend/default.c:83 +#: src/mime/backend/default.c:84 msgid "Extension <-> MIME type association." msgstr "Sammenkædning af MIME-type og filendelse." -#: src/mime/backend/default.c:87 +#: src/mime/backend/default.c:88 #, fuzzy msgid "" "MIME-type matching this file extension ('*' is used here in place of '.')." msgstr "MIME-type for denne filendelse (\"*\" bruges i stedet for \".\")." #. name: -#: src/mime/backend/default.c:219 +#: src/mime/backend/default.c:220 msgid "Option system" msgstr "Opsætningsssystem" @@ -6926,23 +6927,23 @@ msgstr "" "Verificér værtsserverens SSL-certifikat. Bemærk at dette\n" "kræver omfattende opsætning af OpenSSL af brugeren." -#: src/network/ssl/ssl.c:121 +#: src/network/ssl/ssl.c:121 src/network/ssl/ssl.c:251 msgid "Use HTTPS by default" msgstr "" -#: src/network/ssl/ssl.c:123 +#: src/network/ssl/ssl.c:123 src/network/ssl/ssl.c:253 msgid "Use HTTPS when a URL scheme is not provided." msgstr "" -#: src/network/ssl/ssl.c:125 src/network/ssl/ssl.c:274 +#: src/network/ssl/ssl.c:125 src/network/ssl/ssl.c:278 msgid "Client Certificates" msgstr "Klientcertifikater" -#: src/network/ssl/ssl.c:127 src/network/ssl/ssl.c:276 +#: src/network/ssl/ssl.c:127 src/network/ssl/ssl.c:280 msgid "X509 client certificate options." msgstr "Indstillinger for X509-klientcertifikater." -#: src/network/ssl/ssl.c:131 src/network/ssl/ssl.c:280 +#: src/network/ssl/ssl.c:131 src/network/ssl/ssl.c:284 #, fuzzy msgid "" "Enable or not the sending of X509 client certificates to servers which " @@ -6969,11 +6970,11 @@ msgid "" "The database can be also shared with Mozilla browsers." msgstr "" -#: src/network/ssl/ssl.c:149 src/network/ssl/ssl.c:283 +#: src/network/ssl/ssl.c:149 src/network/ssl/ssl.c:287 msgid "Certificate File" msgstr "Certifikatsfil" -#: src/network/ssl/ssl.c:151 src/network/ssl/ssl.c:285 +#: src/network/ssl/ssl.c:151 src/network/ssl/ssl.c:289 #, fuzzy msgid "" "The location of a file containing the client certificate and unencrypted " @@ -7002,12 +7003,12 @@ msgstr "" #. * of binary packages should of course change the default to #. * suit their systems. #. * TODO: If the file name is relative, look in elinks_home? -#: src/network/ssl/ssl.c:259 +#: src/network/ssl/ssl.c:263 #, fuzzy msgid "Trusted CA file" msgstr "Overførelse mislykkedes" -#: src/network/ssl/ssl.c:266 +#: src/network/ssl/ssl.c:270 msgid "" "The location of a file containing certificates of trusted certification " "authorities in PEM format. ELinks then trusts certificates issued by these " @@ -7018,11 +7019,11 @@ msgid "" msgstr "" #. name: -#: src/network/ssl/ssl.c:306 src/network/ssl/ssl.c:323 +#: src/network/ssl/ssl.c:310 src/network/ssl/ssl.c:327 msgid "SSL" msgstr "SSL" -#: src/network/ssl/ssl.c:308 +#: src/network/ssl/ssl.c:312 msgid "SSL options." msgstr "SSL-indstillinger." @@ -7957,7 +7958,7 @@ msgstr "Hvad vil du gøre med filen \"%s\"?" msgid "Information about the torrent" msgstr "Information om torrent-filen" -#: src/protocol/bittorrent/dialogs.c:782 src/session/download.c:1553 +#: src/protocol/bittorrent/dialogs.c:782 src/session/download.c:1571 msgid "What to do?" msgstr "Hvad skal der ske med filen?" @@ -7967,37 +7968,37 @@ msgid "Down~load" msgstr "Down~load" #. accelerator_context(src/protocol/bittorrent/dialogs.c:bittorrent_query_callback, src/session/download.c:do_type_query) -#: src/protocol/bittorrent/dialogs.c:810 src/session/download.c:1656 +#: src/protocol/bittorrent/dialogs.c:810 src/session/download.c:1674 msgid "~Display" msgstr "~Vis" #. accelerator_context(src/protocol/bittorrent/dialogs.c:bittorrent_query_callback, src/session/download.c:do_type_query) -#: src/protocol/bittorrent/dialogs.c:814 src/session/download.c:1660 +#: src/protocol/bittorrent/dialogs.c:814 src/session/download.c:1678 msgid "Show ~header" msgstr "Vis ~protokolhoved" -#: src/protocol/file/cgi.c:40 +#: src/protocol/file/cgi.c:41 msgid "Local CGI" msgstr "Lokale CGI-scripts" -#: src/protocol/file/cgi.c:42 +#: src/protocol/file/cgi.c:43 msgid "Local CGI specific options." msgstr "Indstillinger for lokale CGI-scripts." -#: src/protocol/file/cgi.c:46 +#: src/protocol/file/cgi.c:47 msgid "Colon separated list of directories, where CGI scripts are stored." msgstr "Kolonsepareret liste over kataloger med CGI-scripts." -#: src/protocol/file/cgi.c:49 +#: src/protocol/file/cgi.c:50 msgid "Allow local CGI" msgstr "Tillad lokal CGI" -#: src/protocol/file/cgi.c:51 +#: src/protocol/file/cgi.c:52 msgid "Whether to execute local CGI scripts." msgstr "Om udførelse af lokale CGI-scripts er tilladt." #. name: -#: src/protocol/file/cgi.c:56 +#: src/protocol/file/cgi.c:57 msgid "CGI" msgstr "" @@ -8622,7 +8623,7 @@ msgstr "" "%% erstattes med \"%\"." #. name: -#: src/protocol/rewrite/rewrite.c:360 +#: src/protocol/rewrite/rewrite.c:348 msgid "URI rewrite" msgstr "Adresseomskrivning" @@ -8828,36 +8829,36 @@ msgstr "~Overskriv originalfilen" msgid "~Resume download of the original file" msgstr "~Genoptag overførsel af originalfilen" -#: src/session/download.c:1556 +#: src/session/download.c:1574 msgid "Unknown type" msgstr "Ukendt type" -#: src/session/download.c:1581 +#: src/session/download.c:1599 #, c-format msgid "What would you like to do with the file '%s' (type: %s%s%s)?" msgstr "Hvad vil du gøre med filen \"%s\" (type: %s%s%s)?" -#: src/session/download.c:1584 +#: src/session/download.c:1602 #, c-format msgid "What would you like to do with the file (type: %s%s%s)?" msgstr "Hvad vil du gøre med filen (type: %s%s%s)?" -#: src/session/download.c:1612 +#: src/session/download.c:1630 #, no-c-format msgid "Program ('%' will be replaced by the filename)" msgstr "Program (\"%\" vil blive erstattet med filnavnet)" -#: src/session/download.c:1616 +#: src/session/download.c:1634 msgid "Block the terminal" msgstr "Bloker terminalen" -#: src/session/download.c:1622 +#: src/session/download.c:1640 #, c-format msgid "The file will be opened with the program '%s'." msgstr "Filen vil blive åbnet med programmet \"%s\"." #. accelerator_context(src/session/download.c:do_type_query) -#: src/session/download.c:1643 +#: src/session/download.c:1661 msgid "~Open" msgstr "~Åbn" diff --git a/po/de.po b/po/de.po index b1cd7c6c..da986fde 100644 --- a/po/de.po +++ b/po/de.po @@ -10,7 +10,7 @@ msgid "" msgstr "" "Project-Id-Version: ELinks 0.9.CVS\n" "Report-Msgid-Bugs-To: elinks-users@linuxfromscratch.org\n" -"POT-Creation-Date: 2020-06-26 19:00+0200\n" +"POT-Creation-Date: 2020-07-26 15:28+0200\n" "PO-Revision-Date: 2005-06-14 20:52+0200\n" "Last-Translator: Jens Seidel \n" "Language-Team: German \n" @@ -187,7 +187,7 @@ msgstr "Zeichenfolge darf nicht leer sein" #: src/dialogs/options.c:244 src/dialogs/options.c:323 src/mime/dialogs.c:133 #: src/protocol/auth/dialogs.c:160 src/protocol/bittorrent/dialogs.c:820 #: src/scripting/lua/core.c:402 src/scripting/lua/core.c:483 -#: src/session/download.c:840 src/session/download.c:1666 +#: src/session/download.c:840 src/session/download.c:1684 #: src/viewer/text/search.c:1937 #, fuzzy msgid "~Cancel" @@ -205,7 +205,7 @@ msgstr "Digitale Uhrzeit in der Statuszeile." #: src/config/options.inc:1343 src/ecmascript/ecmascript.c:44 #: src/globhist/globhist.c:64 src/mime/backend/mailcap.c:93 #: src/mime/backend/mimetypes.c:52 src/network/ssl/ssl.c:129 -#: src/network/ssl/ssl.c:278 +#: src/network/ssl/ssl.c:282 msgid "Enable" msgstr "Aktivieren" @@ -2068,7 +2068,7 @@ msgstr "Hier kann keine Option hinzugefügt werden." #. accelerator_context(src/config/dialogs.c:keybinding_buttons, src/config/dialogs.c:option_buttons, src/cookies/dialogs.c:cookie_buttons, src/formhist/dialogs.c:formhist_buttons, src/protocol/bittorrent/dialogs.c:bittorrent_query_callback, src/session/download.c:do_type_query, terminal_options) #: src/config/dialogs.c:505 src/config/dialogs.c:933 src/cookies/dialogs.c:543 #: src/dialogs/options.c:243 src/formhist/dialogs.c:214 -#: src/protocol/bittorrent/dialogs.c:807 src/session/download.c:1650 +#: src/protocol/bittorrent/dialogs.c:807 src/session/download.c:1668 #, fuzzy msgid "Sa~ve" msgstr "Speichern" @@ -4962,7 +4962,7 @@ msgid "Domain" msgstr "Domain" #: src/cookies/dialogs.c:41 src/mime/backend/mailcap.c:97 -#: src/mime/backend/mimetypes.c:56 src/protocol/file/cgi.c:44 +#: src/mime/backend/mimetypes.c:56 src/protocol/file/cgi.c:45 msgid "Path" msgstr "Pfad" @@ -6721,21 +6721,22 @@ msgstr "Programm" #: src/mime/backend/default.c:76 #, fuzzy, no-c-format msgid "" -"External viewer for this file type. '%' in this string will be substituted " -"by a file name. Do _not_ put single- or double-quotes around the % sign." +"External viewer for this file type. '%f' in this string will be substituted " +"by a file name, '%u' by its uri. Do _not_ put single- or double-quotes " +"around the % sign." msgstr "" "Externer Betrachter für diesen Datei-Typ. Ein '%' in der Zeichkette\n" "wird durch den Dateinamen ersetzt." -#: src/mime/backend/default.c:81 +#: src/mime/backend/default.c:82 msgid "File extension associations" msgstr "Verknüpfungen zu Dateiendungen" -#: src/mime/backend/default.c:83 +#: src/mime/backend/default.c:84 msgid "Extension <-> MIME type association." msgstr "Dateiendung <-> MIME-Typ Verknüpfung." -#: src/mime/backend/default.c:87 +#: src/mime/backend/default.c:88 #, fuzzy msgid "" "MIME-type matching this file extension ('*' is used here in place of '.')." @@ -6744,7 +6745,7 @@ msgstr "" "'.' benutzt)." #. name: -#: src/mime/backend/default.c:219 +#: src/mime/backend/default.c:220 msgid "Option system" msgstr "Konfigurations-System" @@ -6900,23 +6901,23 @@ msgstr "" "dass OpenSSL hierfür durch den Benutzer konfiguriert\n" "werden muss." -#: src/network/ssl/ssl.c:121 +#: src/network/ssl/ssl.c:121 src/network/ssl/ssl.c:251 msgid "Use HTTPS by default" msgstr "" -#: src/network/ssl/ssl.c:123 +#: src/network/ssl/ssl.c:123 src/network/ssl/ssl.c:253 msgid "Use HTTPS when a URL scheme is not provided." msgstr "" -#: src/network/ssl/ssl.c:125 src/network/ssl/ssl.c:274 +#: src/network/ssl/ssl.c:125 src/network/ssl/ssl.c:278 msgid "Client Certificates" msgstr "Benutzer-Zertifikate" -#: src/network/ssl/ssl.c:127 src/network/ssl/ssl.c:276 +#: src/network/ssl/ssl.c:127 src/network/ssl/ssl.c:280 msgid "X509 client certificate options." msgstr "Optionen für X509-Benutzer-Zertifikate." -#: src/network/ssl/ssl.c:131 src/network/ssl/ssl.c:280 +#: src/network/ssl/ssl.c:131 src/network/ssl/ssl.c:284 #, fuzzy msgid "" "Enable or not the sending of X509 client certificates to servers which " @@ -6941,11 +6942,11 @@ msgid "" "The database can be also shared with Mozilla browsers." msgstr "" -#: src/network/ssl/ssl.c:149 src/network/ssl/ssl.c:283 +#: src/network/ssl/ssl.c:149 src/network/ssl/ssl.c:287 msgid "Certificate File" msgstr "Zertifikats-Datei" -#: src/network/ssl/ssl.c:151 src/network/ssl/ssl.c:285 +#: src/network/ssl/ssl.c:151 src/network/ssl/ssl.c:289 #, fuzzy msgid "" "The location of a file containing the client certificate and unencrypted " @@ -6974,12 +6975,12 @@ msgstr "" #. * of binary packages should of course change the default to #. * suit their systems. #. * TODO: If the file name is relative, look in elinks_home? -#: src/network/ssl/ssl.c:259 +#: src/network/ssl/ssl.c:263 #, fuzzy msgid "Trusted CA file" msgstr "Übertragung" -#: src/network/ssl/ssl.c:266 +#: src/network/ssl/ssl.c:270 msgid "" "The location of a file containing certificates of trusted certification " "authorities in PEM format. ELinks then trusts certificates issued by these " @@ -6990,11 +6991,11 @@ msgid "" msgstr "" #. name: -#: src/network/ssl/ssl.c:306 src/network/ssl/ssl.c:323 +#: src/network/ssl/ssl.c:310 src/network/ssl/ssl.c:327 msgid "SSL" msgstr "SSL" -#: src/network/ssl/ssl.c:308 +#: src/network/ssl/ssl.c:312 msgid "SSL options." msgstr "SSL-Optionen" @@ -7945,7 +7946,7 @@ msgstr "Soll die Datei '%s' (Typ: %s) angezeigt werden?" msgid "Information about the torrent" msgstr "Zeige Informationen zur aktuellen Seite" -#: src/protocol/bittorrent/dialogs.c:782 src/session/download.c:1553 +#: src/protocol/bittorrent/dialogs.c:782 src/session/download.c:1571 msgid "What to do?" msgstr "Treffen Sie Ihre Wahl." @@ -7956,41 +7957,41 @@ msgid "Down~load" msgstr "Download" #. accelerator_context(src/protocol/bittorrent/dialogs.c:bittorrent_query_callback, src/session/download.c:do_type_query) -#: src/protocol/bittorrent/dialogs.c:810 src/session/download.c:1656 +#: src/protocol/bittorrent/dialogs.c:810 src/session/download.c:1674 #, fuzzy msgid "~Display" msgstr "Anzeigen" #. accelerator_context(src/protocol/bittorrent/dialogs.c:bittorrent_query_callback, src/session/download.c:do_type_query) -#: src/protocol/bittorrent/dialogs.c:814 src/session/download.c:1660 +#: src/protocol/bittorrent/dialogs.c:814 src/session/download.c:1678 #, fuzzy msgid "Show ~header" msgstr "Vorlagen zeigen" -#: src/protocol/file/cgi.c:40 +#: src/protocol/file/cgi.c:41 msgid "Local CGI" msgstr "Lokales CGI" -#: src/protocol/file/cgi.c:42 +#: src/protocol/file/cgi.c:43 msgid "Local CGI specific options." msgstr "Spezifische Optionen für lokales CGI." -#: src/protocol/file/cgi.c:46 +#: src/protocol/file/cgi.c:47 msgid "Colon separated list of directories, where CGI scripts are stored." msgstr "" "Durch Doppelpunkt getrennte Liste von Verzeichnissen, wo\n" "CGI-Skripts gespeichert sind." -#: src/protocol/file/cgi.c:49 +#: src/protocol/file/cgi.c:50 msgid "Allow local CGI" msgstr "Lokales CGI erlauben" -#: src/protocol/file/cgi.c:51 +#: src/protocol/file/cgi.c:52 msgid "Whether to execute local CGI scripts." msgstr "Gibt an, ob lokale CGI-Skripts ausgeführt werden." #. name: -#: src/protocol/file/cgi.c:56 +#: src/protocol/file/cgi.c:57 msgid "CGI" msgstr "" @@ -8607,7 +8608,7 @@ msgid "" msgstr "" #. name: -#: src/protocol/rewrite/rewrite.c:360 +#: src/protocol/rewrite/rewrite.c:348 msgid "URI rewrite" msgstr "URI Veränderung" @@ -8821,37 +8822,37 @@ msgstr "Überschreibe die Originaldatei" msgid "~Resume download of the original file" msgstr "Nehme Download der Originaldatei wieder auf" -#: src/session/download.c:1556 +#: src/session/download.c:1574 msgid "Unknown type" msgstr "Unbekannter Typ" -#: src/session/download.c:1581 +#: src/session/download.c:1599 #, fuzzy, c-format msgid "What would you like to do with the file '%s' (type: %s%s%s)?" msgstr "Soll die Datei '%s' (Typ: %s) angezeigt werden?" -#: src/session/download.c:1584 +#: src/session/download.c:1602 #, fuzzy, c-format msgid "What would you like to do with the file (type: %s%s%s)?" msgstr "Soll die Datei '%s' (Typ: %s) angezeigt werden?" -#: src/session/download.c:1612 +#: src/session/download.c:1630 #, no-c-format msgid "Program ('%' will be replaced by the filename)" msgstr "" -#: src/session/download.c:1616 +#: src/session/download.c:1634 #, fuzzy msgid "Block the terminal" msgstr "Bildschirm blockieren" -#: src/session/download.c:1622 +#: src/session/download.c:1640 #, c-format msgid "The file will be opened with the program '%s'." msgstr "" #. accelerator_context(src/session/download.c:do_type_query) -#: src/session/download.c:1643 +#: src/session/download.c:1661 #, fuzzy msgid "~Open" msgstr "Öffnen" diff --git a/po/el.po b/po/el.po index 3440942d..8401bced 100644 --- a/po/el.po +++ b/po/el.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: ELinks 0.5pre0.CVS\n" "Report-Msgid-Bugs-To: elinks-users@linuxfromscratch.org\n" -"POT-Creation-Date: 2020-06-26 19:00+0200\n" +"POT-Creation-Date: 2020-07-26 15:28+0200\n" "PO-Revision-Date: 2003-01-03 03:41+0100\n" "Last-Translator: Simos Xenitellis \n" "Language-Team: Greek \n" @@ -187,7 +187,7 @@ msgstr "Δεν επιτρέπεται κενό αλφαριθμητικό" #: src/dialogs/options.c:244 src/dialogs/options.c:323 src/mime/dialogs.c:133 #: src/protocol/auth/dialogs.c:160 src/protocol/bittorrent/dialogs.c:820 #: src/scripting/lua/core.c:402 src/scripting/lua/core.c:483 -#: src/session/download.c:840 src/session/download.c:1666 +#: src/session/download.c:840 src/session/download.c:1684 #: src/viewer/text/search.c:1937 #, fuzzy msgid "~Cancel" @@ -206,7 +206,7 @@ msgstr "" #: src/config/options.inc:1343 src/ecmascript/ecmascript.c:44 #: src/globhist/globhist.c:64 src/mime/backend/mailcap.c:93 #: src/mime/backend/mimetypes.c:52 src/network/ssl/ssl.c:129 -#: src/network/ssl/ssl.c:278 +#: src/network/ssl/ssl.c:282 #, fuzzy msgid "Enable" msgstr "όνομα" @@ -1997,7 +1997,7 @@ msgstr "" #. accelerator_context(src/config/dialogs.c:keybinding_buttons, src/config/dialogs.c:option_buttons, src/cookies/dialogs.c:cookie_buttons, src/formhist/dialogs.c:formhist_buttons, src/protocol/bittorrent/dialogs.c:bittorrent_query_callback, src/session/download.c:do_type_query, terminal_options) #: src/config/dialogs.c:505 src/config/dialogs.c:933 src/cookies/dialogs.c:543 #: src/dialogs/options.c:243 src/formhist/dialogs.c:214 -#: src/protocol/bittorrent/dialogs.c:807 src/session/download.c:1650 +#: src/protocol/bittorrent/dialogs.c:807 src/session/download.c:1668 #, fuzzy msgid "Sa~ve" msgstr "Αποθήκευση" @@ -4576,7 +4576,7 @@ msgid "Domain" msgstr "Πληροφορίες εγγράφου" #: src/cookies/dialogs.c:41 src/mime/backend/mailcap.c:97 -#: src/mime/backend/mimetypes.c:56 src/protocol/file/cgi.c:44 +#: src/mime/backend/mimetypes.c:56 src/protocol/file/cgi.c:45 msgid "Path" msgstr "" @@ -6348,26 +6348,27 @@ msgstr "Δεν υπάρχει πρόγραμμα" #: src/mime/backend/default.c:76 #, no-c-format msgid "" -"External viewer for this file type. '%' in this string will be substituted " -"by a file name. Do _not_ put single- or double-quotes around the % sign." +"External viewer for this file type. '%f' in this string will be substituted " +"by a file name, '%u' by its uri. Do _not_ put single- or double-quotes " +"around the % sign." msgstr "" -#: src/mime/backend/default.c:81 +#: src/mime/backend/default.c:82 #, fuzzy msgid "File extension associations" msgstr "Καταλήξεις αρχείων" -#: src/mime/backend/default.c:83 +#: src/mime/backend/default.c:84 msgid "Extension <-> MIME type association." msgstr "" -#: src/mime/backend/default.c:87 +#: src/mime/backend/default.c:88 msgid "" "MIME-type matching this file extension ('*' is used here in place of '.')." msgstr "" #. name: -#: src/mime/backend/default.c:219 +#: src/mime/backend/default.c:220 msgid "Option system" msgstr "" @@ -6497,24 +6498,24 @@ msgid "" "configuration of OpenSSL by the user." msgstr "" -#: src/network/ssl/ssl.c:121 +#: src/network/ssl/ssl.c:121 src/network/ssl/ssl.c:251 msgid "Use HTTPS by default" msgstr "" -#: src/network/ssl/ssl.c:123 +#: src/network/ssl/ssl.c:123 src/network/ssl/ssl.c:253 msgid "Use HTTPS when a URL scheme is not provided." msgstr "" -#: src/network/ssl/ssl.c:125 src/network/ssl/ssl.c:274 +#: src/network/ssl/ssl.c:125 src/network/ssl/ssl.c:278 msgid "Client Certificates" msgstr "" -#: src/network/ssl/ssl.c:127 src/network/ssl/ssl.c:276 +#: src/network/ssl/ssl.c:127 src/network/ssl/ssl.c:280 #, fuzzy msgid "X509 client certificate options." msgstr "Επιλογές τερματικού" -#: src/network/ssl/ssl.c:131 src/network/ssl/ssl.c:280 +#: src/network/ssl/ssl.c:131 src/network/ssl/ssl.c:284 msgid "" "Enable or not the sending of X509 client certificates to servers which " "request them." @@ -6538,12 +6539,12 @@ msgid "" "The database can be also shared with Mozilla browsers." msgstr "" -#: src/network/ssl/ssl.c:149 src/network/ssl/ssl.c:283 +#: src/network/ssl/ssl.c:149 src/network/ssl/ssl.c:287 #, fuzzy msgid "Certificate File" msgstr "εναπομείνων χρόνος" -#: src/network/ssl/ssl.c:151 src/network/ssl/ssl.c:285 +#: src/network/ssl/ssl.c:151 src/network/ssl/ssl.c:289 msgid "" "The location of a file containing the client certificate and unencrypted " "private key in PEM format. If unset, the file pointed to by the " @@ -6564,12 +6565,12 @@ msgstr "" #. * of binary packages should of course change the default to #. * suit their systems. #. * TODO: If the file name is relative, look in elinks_home? -#: src/network/ssl/ssl.c:259 +#: src/network/ssl/ssl.c:263 #, fuzzy msgid "Trusted CA file" msgstr "Γίνετε μεταφορά" -#: src/network/ssl/ssl.c:266 +#: src/network/ssl/ssl.c:270 msgid "" "The location of a file containing certificates of trusted certification " "authorities in PEM format. ELinks then trusts certificates issued by these " @@ -6580,11 +6581,11 @@ msgid "" msgstr "" #. name: -#: src/network/ssl/ssl.c:306 src/network/ssl/ssl.c:323 +#: src/network/ssl/ssl.c:310 src/network/ssl/ssl.c:327 msgid "SSL" msgstr "" -#: src/network/ssl/ssl.c:308 +#: src/network/ssl/ssl.c:312 #, fuzzy msgid "SSL options." msgstr "Αποθήκευση επιλογών" @@ -7526,7 +7527,7 @@ msgstr "" msgid "Information about the torrent" msgstr "Μεταφόρτωση εικόνας" -#: src/protocol/bittorrent/dialogs.c:782 src/session/download.c:1553 +#: src/protocol/bittorrent/dialogs.c:782 src/session/download.c:1571 msgid "What to do?" msgstr "Τί θέλετε να κάνετε;" @@ -7537,40 +7538,40 @@ msgid "Down~load" msgstr "Μεταφόρτωση" #. accelerator_context(src/protocol/bittorrent/dialogs.c:bittorrent_query_callback, src/session/download.c:do_type_query) -#: src/protocol/bittorrent/dialogs.c:810 src/session/download.c:1656 +#: src/protocol/bittorrent/dialogs.c:810 src/session/download.c:1674 #, fuzzy msgid "~Display" msgstr "Εμφάνιση" #. accelerator_context(src/protocol/bittorrent/dialogs.c:bittorrent_query_callback, src/session/download.c:do_type_query) -#: src/protocol/bittorrent/dialogs.c:814 src/session/download.c:1660 +#: src/protocol/bittorrent/dialogs.c:814 src/session/download.c:1678 msgid "Show ~header" msgstr "" -#: src/protocol/file/cgi.c:40 +#: src/protocol/file/cgi.c:41 #, fuzzy msgid "Local CGI" msgstr "αρχεία" -#: src/protocol/file/cgi.c:42 +#: src/protocol/file/cgi.c:43 #, fuzzy msgid "Local CGI specific options." msgstr "Δεν καθορίστηκε πρόγραμμα για" -#: src/protocol/file/cgi.c:46 +#: src/protocol/file/cgi.c:47 msgid "Colon separated list of directories, where CGI scripts are stored." msgstr "" -#: src/protocol/file/cgi.c:49 +#: src/protocol/file/cgi.c:50 msgid "Allow local CGI" msgstr "" -#: src/protocol/file/cgi.c:51 +#: src/protocol/file/cgi.c:52 msgid "Whether to execute local CGI scripts." msgstr "" #. name: -#: src/protocol/file/cgi.c:56 +#: src/protocol/file/cgi.c:57 msgid "CGI" msgstr "" @@ -8078,7 +8079,7 @@ msgid "" msgstr "" #. name: -#: src/protocol/rewrite/rewrite.c:360 +#: src/protocol/rewrite/rewrite.c:348 msgid "URI rewrite" msgstr "" @@ -8262,37 +8263,37 @@ msgstr "" msgid "~Resume download of the original file" msgstr "" -#: src/session/download.c:1556 +#: src/session/download.c:1574 msgid "Unknown type" msgstr "Άγνωστο είδος" -#: src/session/download.c:1581 +#: src/session/download.c:1599 #, c-format msgid "What would you like to do with the file '%s' (type: %s%s%s)?" msgstr "" -#: src/session/download.c:1584 +#: src/session/download.c:1602 #, c-format msgid "What would you like to do with the file (type: %s%s%s)?" msgstr "" -#: src/session/download.c:1612 +#: src/session/download.c:1630 #, no-c-format msgid "Program ('%' will be replaced by the filename)" msgstr "" -#: src/session/download.c:1616 +#: src/session/download.c:1634 #, fuzzy msgid "Block the terminal" msgstr "Τερματικό BeOS" -#: src/session/download.c:1622 +#: src/session/download.c:1640 #, c-format msgid "The file will be opened with the program '%s'." msgstr "" #. accelerator_context(src/session/download.c:do_type_query) -#: src/session/download.c:1643 +#: src/session/download.c:1661 #, fuzzy msgid "~Open" msgstr "Άνοιγμα" diff --git a/po/es.po b/po/es.po index 10f99140..127f4da2 100644 --- a/po/es.po +++ b/po/es.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: ELinks 0.5pre0.CVS\n" "Report-Msgid-Bugs-To: elinks-users@linuxfromscratch.org\n" -"POT-Creation-Date: 2020-06-26 19:00+0200\n" +"POT-Creation-Date: 2020-07-26 15:28+0200\n" "PO-Revision-Date: 2003-01-03 03:41+0100\n" "Last-Translator: David Mediavilla \n" "Language-Team: Spanish \n" @@ -188,7 +188,7 @@ msgstr "No se permite dejar el campo vacío" #: src/dialogs/options.c:244 src/dialogs/options.c:323 src/mime/dialogs.c:133 #: src/protocol/auth/dialogs.c:160 src/protocol/bittorrent/dialogs.c:820 #: src/scripting/lua/core.c:402 src/scripting/lua/core.c:483 -#: src/session/download.c:840 src/session/download.c:1666 +#: src/session/download.c:840 src/session/download.c:1684 #: src/viewer/text/search.c:1937 #, fuzzy msgid "~Cancel" @@ -207,7 +207,7 @@ msgstr "" #: src/config/options.inc:1343 src/ecmascript/ecmascript.c:44 #: src/globhist/globhist.c:64 src/mime/backend/mailcap.c:93 #: src/mime/backend/mimetypes.c:52 src/network/ssl/ssl.c:129 -#: src/network/ssl/ssl.c:278 +#: src/network/ssl/ssl.c:282 #, fuzzy msgid "Enable" msgstr "nombre" @@ -2007,7 +2007,7 @@ msgstr "" #. accelerator_context(src/config/dialogs.c:keybinding_buttons, src/config/dialogs.c:option_buttons, src/cookies/dialogs.c:cookie_buttons, src/formhist/dialogs.c:formhist_buttons, src/protocol/bittorrent/dialogs.c:bittorrent_query_callback, src/session/download.c:do_type_query, terminal_options) #: src/config/dialogs.c:505 src/config/dialogs.c:933 src/cookies/dialogs.c:543 #: src/dialogs/options.c:243 src/formhist/dialogs.c:214 -#: src/protocol/bittorrent/dialogs.c:807 src/session/download.c:1650 +#: src/protocol/bittorrent/dialogs.c:807 src/session/download.c:1668 #, fuzzy msgid "Sa~ve" msgstr "Grabar" @@ -4595,7 +4595,7 @@ msgid "Domain" msgstr "~Información del documento..." #: src/cookies/dialogs.c:41 src/mime/backend/mailcap.c:97 -#: src/mime/backend/mimetypes.c:56 src/protocol/file/cgi.c:44 +#: src/mime/backend/mimetypes.c:56 src/protocol/file/cgi.c:45 msgid "Path" msgstr "" @@ -6377,26 +6377,27 @@ msgstr "Sin programa" #: src/mime/backend/default.c:76 #, no-c-format msgid "" -"External viewer for this file type. '%' in this string will be substituted " -"by a file name. Do _not_ put single- or double-quotes around the % sign." +"External viewer for this file type. '%f' in this string will be substituted " +"by a file name, '%u' by its uri. Do _not_ put single- or double-quotes " +"around the % sign." msgstr "" -#: src/mime/backend/default.c:81 +#: src/mime/backend/default.c:82 #, fuzzy msgid "File extension associations" msgstr "~Extensiones de fichero" -#: src/mime/backend/default.c:83 +#: src/mime/backend/default.c:84 msgid "Extension <-> MIME type association." msgstr "" -#: src/mime/backend/default.c:87 +#: src/mime/backend/default.c:88 msgid "" "MIME-type matching this file extension ('*' is used here in place of '.')." msgstr "" #. name: -#: src/mime/backend/default.c:219 +#: src/mime/backend/default.c:220 msgid "Option system" msgstr "" @@ -6526,24 +6527,24 @@ msgid "" "configuration of OpenSSL by the user." msgstr "" -#: src/network/ssl/ssl.c:121 +#: src/network/ssl/ssl.c:121 src/network/ssl/ssl.c:251 msgid "Use HTTPS by default" msgstr "" -#: src/network/ssl/ssl.c:123 +#: src/network/ssl/ssl.c:123 src/network/ssl/ssl.c:253 msgid "Use HTTPS when a URL scheme is not provided." msgstr "" -#: src/network/ssl/ssl.c:125 src/network/ssl/ssl.c:274 +#: src/network/ssl/ssl.c:125 src/network/ssl/ssl.c:278 msgid "Client Certificates" msgstr "" -#: src/network/ssl/ssl.c:127 src/network/ssl/ssl.c:276 +#: src/network/ssl/ssl.c:127 src/network/ssl/ssl.c:280 #, fuzzy msgid "X509 client certificate options." msgstr "Opciones de terminal..." -#: src/network/ssl/ssl.c:131 src/network/ssl/ssl.c:280 +#: src/network/ssl/ssl.c:131 src/network/ssl/ssl.c:284 msgid "" "Enable or not the sending of X509 client certificates to servers which " "request them." @@ -6567,12 +6568,12 @@ msgid "" "The database can be also shared with Mozilla browsers." msgstr "" -#: src/network/ssl/ssl.c:149 src/network/ssl/ssl.c:283 +#: src/network/ssl/ssl.c:149 src/network/ssl/ssl.c:287 #, fuzzy msgid "Certificate File" msgstr "tiempo estimado" -#: src/network/ssl/ssl.c:151 src/network/ssl/ssl.c:285 +#: src/network/ssl/ssl.c:151 src/network/ssl/ssl.c:289 msgid "" "The location of a file containing the client certificate and unencrypted " "private key in PEM format. If unset, the file pointed to by the " @@ -6593,12 +6594,12 @@ msgstr "" #. * of binary packages should of course change the default to #. * suit their systems. #. * TODO: If the file name is relative, look in elinks_home? -#: src/network/ssl/ssl.c:259 +#: src/network/ssl/ssl.c:263 #, fuzzy msgid "Trusted CA file" msgstr "Transfiriendo" -#: src/network/ssl/ssl.c:266 +#: src/network/ssl/ssl.c:270 msgid "" "The location of a file containing certificates of trusted certification " "authorities in PEM format. ELinks then trusts certificates issued by these " @@ -6609,11 +6610,11 @@ msgid "" msgstr "" #. name: -#: src/network/ssl/ssl.c:306 src/network/ssl/ssl.c:323 +#: src/network/ssl/ssl.c:310 src/network/ssl/ssl.c:327 msgid "SSL" msgstr "" -#: src/network/ssl/ssl.c:308 +#: src/network/ssl/ssl.c:312 #, fuzzy msgid "SSL options." msgstr "~Grabar opciones" @@ -7554,7 +7555,7 @@ msgstr "" msgid "Information about the torrent" msgstr "Descargar ima~gen" -#: src/protocol/bittorrent/dialogs.c:782 src/session/download.c:1553 +#: src/protocol/bittorrent/dialogs.c:782 src/session/download.c:1571 msgid "What to do?" msgstr "¿Qué hago?" @@ -7565,40 +7566,40 @@ msgid "Down~load" msgstr "Descargar" #. accelerator_context(src/protocol/bittorrent/dialogs.c:bittorrent_query_callback, src/session/download.c:do_type_query) -#: src/protocol/bittorrent/dialogs.c:810 src/session/download.c:1656 +#: src/protocol/bittorrent/dialogs.c:810 src/session/download.c:1674 #, fuzzy msgid "~Display" msgstr "Ver en ELinks" #. accelerator_context(src/protocol/bittorrent/dialogs.c:bittorrent_query_callback, src/session/download.c:do_type_query) -#: src/protocol/bittorrent/dialogs.c:814 src/session/download.c:1660 +#: src/protocol/bittorrent/dialogs.c:814 src/session/download.c:1678 msgid "Show ~header" msgstr "" -#: src/protocol/file/cgi.c:40 +#: src/protocol/file/cgi.c:41 #, fuzzy msgid "Local CGI" msgstr "ficheros" -#: src/protocol/file/cgi.c:42 +#: src/protocol/file/cgi.c:43 #, fuzzy msgid "Local CGI specific options." msgstr "No hay programa especificado para" -#: src/protocol/file/cgi.c:46 +#: src/protocol/file/cgi.c:47 msgid "Colon separated list of directories, where CGI scripts are stored." msgstr "" -#: src/protocol/file/cgi.c:49 +#: src/protocol/file/cgi.c:50 msgid "Allow local CGI" msgstr "" -#: src/protocol/file/cgi.c:51 +#: src/protocol/file/cgi.c:52 msgid "Whether to execute local CGI scripts." msgstr "" #. name: -#: src/protocol/file/cgi.c:56 +#: src/protocol/file/cgi.c:57 msgid "CGI" msgstr "" @@ -8109,7 +8110,7 @@ msgid "" msgstr "" #. name: -#: src/protocol/rewrite/rewrite.c:360 +#: src/protocol/rewrite/rewrite.c:348 msgid "URI rewrite" msgstr "" @@ -8296,37 +8297,37 @@ msgstr "" msgid "~Resume download of the original file" msgstr "" -#: src/session/download.c:1556 +#: src/session/download.c:1574 msgid "Unknown type" msgstr "Tipo desconocido" -#: src/session/download.c:1581 +#: src/session/download.c:1599 #, c-format msgid "What would you like to do with the file '%s' (type: %s%s%s)?" msgstr "" -#: src/session/download.c:1584 +#: src/session/download.c:1602 #, c-format msgid "What would you like to do with the file (type: %s%s%s)?" msgstr "" -#: src/session/download.c:1612 +#: src/session/download.c:1630 #, no-c-format msgid "Program ('%' will be replaced by the filename)" msgstr "" -#: src/session/download.c:1616 +#: src/session/download.c:1634 #, fuzzy msgid "Block the terminal" msgstr "Terminal ~BeOS" -#: src/session/download.c:1622 +#: src/session/download.c:1640 #, c-format msgid "The file will be opened with the program '%s'." msgstr "" #. accelerator_context(src/session/download.c:do_type_query) -#: src/session/download.c:1643 +#: src/session/download.c:1661 #, fuzzy msgid "~Open" msgstr "Abrir con otro programa" diff --git a/po/et.po b/po/et.po index 8d3f0c3c..73054011 100644 --- a/po/et.po +++ b/po/et.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: ELinks 0.5pre0.CVS\n" "Report-Msgid-Bugs-To: elinks-users@linuxfromscratch.org\n" -"POT-Creation-Date: 2020-06-26 19:00+0200\n" +"POT-Creation-Date: 2020-07-26 15:28+0200\n" "PO-Revision-Date: 2003-01-03 03:41+0100\n" "Last-Translator: Taniel Kirikal \n" "Language-Team: Estonian \n" @@ -186,7 +186,7 @@ msgstr "Tühi string pole lubatud" #: src/dialogs/options.c:244 src/dialogs/options.c:323 src/mime/dialogs.c:133 #: src/protocol/auth/dialogs.c:160 src/protocol/bittorrent/dialogs.c:820 #: src/scripting/lua/core.c:402 src/scripting/lua/core.c:483 -#: src/session/download.c:840 src/session/download.c:1666 +#: src/session/download.c:840 src/session/download.c:1684 #: src/viewer/text/search.c:1937 #, fuzzy msgid "~Cancel" @@ -205,7 +205,7 @@ msgstr "" #: src/config/options.inc:1343 src/ecmascript/ecmascript.c:44 #: src/globhist/globhist.c:64 src/mime/backend/mailcap.c:93 #: src/mime/backend/mimetypes.c:52 src/network/ssl/ssl.c:129 -#: src/network/ssl/ssl.c:278 +#: src/network/ssl/ssl.c:282 #, fuzzy msgid "Enable" msgstr "nimi" @@ -1996,7 +1996,7 @@ msgstr "" #. accelerator_context(src/config/dialogs.c:keybinding_buttons, src/config/dialogs.c:option_buttons, src/cookies/dialogs.c:cookie_buttons, src/formhist/dialogs.c:formhist_buttons, src/protocol/bittorrent/dialogs.c:bittorrent_query_callback, src/session/download.c:do_type_query, terminal_options) #: src/config/dialogs.c:505 src/config/dialogs.c:933 src/cookies/dialogs.c:543 #: src/dialogs/options.c:243 src/formhist/dialogs.c:214 -#: src/protocol/bittorrent/dialogs.c:807 src/session/download.c:1650 +#: src/protocol/bittorrent/dialogs.c:807 src/session/download.c:1668 #, fuzzy msgid "Sa~ve" msgstr "Salvesta" @@ -4575,7 +4575,7 @@ msgid "Domain" msgstr "Lehekülje ~info" #: src/cookies/dialogs.c:41 src/mime/backend/mailcap.c:97 -#: src/mime/backend/mimetypes.c:56 src/protocol/file/cgi.c:44 +#: src/mime/backend/mimetypes.c:56 src/protocol/file/cgi.c:45 msgid "Path" msgstr "" @@ -6345,26 +6345,27 @@ msgstr "Pole programmi" #: src/mime/backend/default.c:76 #, no-c-format msgid "" -"External viewer for this file type. '%' in this string will be substituted " -"by a file name. Do _not_ put single- or double-quotes around the % sign." +"External viewer for this file type. '%f' in this string will be substituted " +"by a file name, '%u' by its uri. Do _not_ put single- or double-quotes " +"around the % sign." msgstr "" -#: src/mime/backend/default.c:81 +#: src/mime/backend/default.c:82 #, fuzzy msgid "File extension associations" msgstr "Faililai~endid" -#: src/mime/backend/default.c:83 +#: src/mime/backend/default.c:84 msgid "Extension <-> MIME type association." msgstr "" -#: src/mime/backend/default.c:87 +#: src/mime/backend/default.c:88 msgid "" "MIME-type matching this file extension ('*' is used here in place of '.')." msgstr "" #. name: -#: src/mime/backend/default.c:219 +#: src/mime/backend/default.c:220 msgid "Option system" msgstr "" @@ -6494,24 +6495,24 @@ msgid "" "configuration of OpenSSL by the user." msgstr "" -#: src/network/ssl/ssl.c:121 +#: src/network/ssl/ssl.c:121 src/network/ssl/ssl.c:251 msgid "Use HTTPS by default" msgstr "" -#: src/network/ssl/ssl.c:123 +#: src/network/ssl/ssl.c:123 src/network/ssl/ssl.c:253 msgid "Use HTTPS when a URL scheme is not provided." msgstr "" -#: src/network/ssl/ssl.c:125 src/network/ssl/ssl.c:274 +#: src/network/ssl/ssl.c:125 src/network/ssl/ssl.c:278 msgid "Client Certificates" msgstr "" -#: src/network/ssl/ssl.c:127 src/network/ssl/ssl.c:276 +#: src/network/ssl/ssl.c:127 src/network/ssl/ssl.c:280 #, fuzzy msgid "X509 client certificate options." msgstr "Terminali seaded" -#: src/network/ssl/ssl.c:131 src/network/ssl/ssl.c:280 +#: src/network/ssl/ssl.c:131 src/network/ssl/ssl.c:284 msgid "" "Enable or not the sending of X509 client certificates to servers which " "request them." @@ -6535,12 +6536,12 @@ msgid "" "The database can be also shared with Mozilla browsers." msgstr "" -#: src/network/ssl/ssl.c:149 src/network/ssl/ssl.c:283 +#: src/network/ssl/ssl.c:149 src/network/ssl/ssl.c:287 #, fuzzy msgid "Certificate File" msgstr "hinnatud aeg" -#: src/network/ssl/ssl.c:151 src/network/ssl/ssl.c:285 +#: src/network/ssl/ssl.c:151 src/network/ssl/ssl.c:289 msgid "" "The location of a file containing the client certificate and unencrypted " "private key in PEM format. If unset, the file pointed to by the " @@ -6561,12 +6562,12 @@ msgstr "" #. * of binary packages should of course change the default to #. * suit their systems. #. * TODO: If the file name is relative, look in elinks_home? -#: src/network/ssl/ssl.c:259 +#: src/network/ssl/ssl.c:263 #, fuzzy msgid "Trusted CA file" msgstr "Kannan üle" -#: src/network/ssl/ssl.c:266 +#: src/network/ssl/ssl.c:270 msgid "" "The location of a file containing certificates of trusted certification " "authorities in PEM format. ELinks then trusts certificates issued by these " @@ -6577,11 +6578,11 @@ msgid "" msgstr "" #. name: -#: src/network/ssl/ssl.c:306 src/network/ssl/ssl.c:323 +#: src/network/ssl/ssl.c:310 src/network/ssl/ssl.c:327 msgid "SSL" msgstr "" -#: src/network/ssl/ssl.c:308 +#: src/network/ssl/ssl.c:312 #, fuzzy msgid "SSL options." msgstr "~Salvesta parameetrid" @@ -7523,7 +7524,7 @@ msgstr "" msgid "Information about the torrent" msgstr "Laadi alla pilt" -#: src/protocol/bittorrent/dialogs.c:782 src/session/download.c:1553 +#: src/protocol/bittorrent/dialogs.c:782 src/session/download.c:1571 msgid "What to do?" msgstr "Mida teha?" @@ -7534,40 +7535,40 @@ msgid "Down~load" msgstr "Alla laadimine" #. accelerator_context(src/protocol/bittorrent/dialogs.c:bittorrent_query_callback, src/session/download.c:do_type_query) -#: src/protocol/bittorrent/dialogs.c:810 src/session/download.c:1656 +#: src/protocol/bittorrent/dialogs.c:810 src/session/download.c:1674 #, fuzzy msgid "~Display" msgstr "Näita" #. accelerator_context(src/protocol/bittorrent/dialogs.c:bittorrent_query_callback, src/session/download.c:do_type_query) -#: src/protocol/bittorrent/dialogs.c:814 src/session/download.c:1660 +#: src/protocol/bittorrent/dialogs.c:814 src/session/download.c:1678 msgid "Show ~header" msgstr "" -#: src/protocol/file/cgi.c:40 +#: src/protocol/file/cgi.c:41 #, fuzzy msgid "Local CGI" msgstr "faile" -#: src/protocol/file/cgi.c:42 +#: src/protocol/file/cgi.c:43 #, fuzzy msgid "Local CGI specific options." msgstr "Pole programmi märgitud" -#: src/protocol/file/cgi.c:46 +#: src/protocol/file/cgi.c:47 msgid "Colon separated list of directories, where CGI scripts are stored." msgstr "" -#: src/protocol/file/cgi.c:49 +#: src/protocol/file/cgi.c:50 msgid "Allow local CGI" msgstr "" -#: src/protocol/file/cgi.c:51 +#: src/protocol/file/cgi.c:52 msgid "Whether to execute local CGI scripts." msgstr "" #. name: -#: src/protocol/file/cgi.c:56 +#: src/protocol/file/cgi.c:57 msgid "CGI" msgstr "" @@ -8075,7 +8076,7 @@ msgid "" msgstr "" #. name: -#: src/protocol/rewrite/rewrite.c:360 +#: src/protocol/rewrite/rewrite.c:348 msgid "URI rewrite" msgstr "" @@ -8259,37 +8260,37 @@ msgstr "" msgid "~Resume download of the original file" msgstr "" -#: src/session/download.c:1556 +#: src/session/download.c:1574 msgid "Unknown type" msgstr "Tundmatu tüüp" -#: src/session/download.c:1581 +#: src/session/download.c:1599 #, c-format msgid "What would you like to do with the file '%s' (type: %s%s%s)?" msgstr "" -#: src/session/download.c:1584 +#: src/session/download.c:1602 #, c-format msgid "What would you like to do with the file (type: %s%s%s)?" msgstr "" -#: src/session/download.c:1612 +#: src/session/download.c:1630 #, no-c-format msgid "Program ('%' will be replaced by the filename)" msgstr "" -#: src/session/download.c:1616 +#: src/session/download.c:1634 #, fuzzy msgid "Block the terminal" msgstr "~BeOS-i terminal" -#: src/session/download.c:1622 +#: src/session/download.c:1640 #, c-format msgid "The file will be opened with the program '%s'." msgstr "" #. accelerator_context(src/session/download.c:do_type_query) -#: src/session/download.c:1643 +#: src/session/download.c:1661 #, fuzzy msgid "~Open" msgstr "Ava" diff --git a/po/fi.po b/po/fi.po index 4951b9bc..aec412fe 100644 --- a/po/fi.po +++ b/po/fi.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: ELinks 0.12.GIT\n" "Report-Msgid-Bugs-To: elinks-users@linuxfromscratch.org\n" -"POT-Creation-Date: 2020-06-26 19:00+0200\n" +"POT-Creation-Date: 2020-07-26 15:28+0200\n" "PO-Revision-Date: 2009-03-24 00:31+0200\n" "Last-Translator: Kalle Olavi Niemitalo \n" "Language-Team: Finnish \n" @@ -186,7 +186,7 @@ msgstr "Tyhjä merkkijono ei sallittu" #: src/dialogs/options.c:244 src/dialogs/options.c:323 src/mime/dialogs.c:133 #: src/protocol/auth/dialogs.c:160 src/protocol/bittorrent/dialogs.c:820 #: src/scripting/lua/core.c:402 src/scripting/lua/core.c:483 -#: src/session/download.c:840 src/session/download.c:1666 +#: src/session/download.c:840 src/session/download.c:1684 #: src/viewer/text/search.c:1937 #, fuzzy msgid "~Cancel" @@ -204,7 +204,7 @@ msgstr "Digitaalikello tilapalkissa." #: src/config/options.inc:1343 src/ecmascript/ecmascript.c:44 #: src/globhist/globhist.c:64 src/mime/backend/mailcap.c:93 #: src/mime/backend/mimetypes.c:52 src/network/ssl/ssl.c:129 -#: src/network/ssl/ssl.c:278 +#: src/network/ssl/ssl.c:282 msgid "Enable" msgstr "Ota käyttöön" @@ -1987,7 +1987,7 @@ msgstr "" #. accelerator_context(src/config/dialogs.c:keybinding_buttons, src/config/dialogs.c:option_buttons, src/cookies/dialogs.c:cookie_buttons, src/formhist/dialogs.c:formhist_buttons, src/protocol/bittorrent/dialogs.c:bittorrent_query_callback, src/session/download.c:do_type_query, terminal_options) #: src/config/dialogs.c:505 src/config/dialogs.c:933 src/cookies/dialogs.c:543 #: src/dialogs/options.c:243 src/formhist/dialogs.c:214 -#: src/protocol/bittorrent/dialogs.c:807 src/session/download.c:1650 +#: src/protocol/bittorrent/dialogs.c:807 src/session/download.c:1668 msgid "Sa~ve" msgstr "~Tallenna" @@ -4545,7 +4545,7 @@ msgid "Domain" msgstr "Verkkoalue" #: src/cookies/dialogs.c:41 src/mime/backend/mailcap.c:97 -#: src/mime/backend/mimetypes.c:56 src/protocol/file/cgi.c:44 +#: src/mime/backend/mimetypes.c:56 src/protocol/file/cgi.c:45 msgid "Path" msgstr "" @@ -6215,30 +6215,31 @@ msgid "Program" msgstr "Ohjelma" #: src/mime/backend/default.c:76 -#, no-c-format +#, fuzzy, no-c-format msgid "" -"External viewer for this file type. '%' in this string will be substituted " -"by a file name. Do _not_ put single- or double-quotes around the % sign." +"External viewer for this file type. '%f' in this string will be substituted " +"by a file name, '%u' by its uri. Do _not_ put single- or double-quotes " +"around the % sign." msgstr "" "Ulkoinen katseluohjelma tälle tiedostotyypille. Merkkijonossa oleva %-merkki " "korvataan tiedoston nimellä. _Älä_ laita %-merkin ympärille lainausmerkkejä " "äläkä puolilainausmerkkejä." -#: src/mime/backend/default.c:81 +#: src/mime/backend/default.c:82 msgid "File extension associations" msgstr "Tiedostopäätteiden kytkennät" -#: src/mime/backend/default.c:83 +#: src/mime/backend/default.c:84 msgid "Extension <-> MIME type association." msgstr "" -#: src/mime/backend/default.c:87 +#: src/mime/backend/default.c:88 msgid "" "MIME-type matching this file extension ('*' is used here in place of '.')." msgstr "" #. name: -#: src/mime/backend/default.c:219 +#: src/mime/backend/default.c:220 msgid "Option system" msgstr "Asetusjärjestelmä" @@ -6368,23 +6369,23 @@ msgid "" "configuration of OpenSSL by the user." msgstr "" -#: src/network/ssl/ssl.c:121 +#: src/network/ssl/ssl.c:121 src/network/ssl/ssl.c:251 msgid "Use HTTPS by default" msgstr "" -#: src/network/ssl/ssl.c:123 +#: src/network/ssl/ssl.c:123 src/network/ssl/ssl.c:253 msgid "Use HTTPS when a URL scheme is not provided." msgstr "" -#: src/network/ssl/ssl.c:125 src/network/ssl/ssl.c:274 +#: src/network/ssl/ssl.c:125 src/network/ssl/ssl.c:278 msgid "Client Certificates" msgstr "" -#: src/network/ssl/ssl.c:127 src/network/ssl/ssl.c:276 +#: src/network/ssl/ssl.c:127 src/network/ssl/ssl.c:280 msgid "X509 client certificate options." msgstr "X509-asiakasvarmenneasetukset." -#: src/network/ssl/ssl.c:131 src/network/ssl/ssl.c:280 +#: src/network/ssl/ssl.c:131 src/network/ssl/ssl.c:284 msgid "" "Enable or not the sending of X509 client certificates to servers which " "request them." @@ -6408,11 +6409,11 @@ msgid "" "The database can be also shared with Mozilla browsers." msgstr "" -#: src/network/ssl/ssl.c:149 src/network/ssl/ssl.c:283 +#: src/network/ssl/ssl.c:149 src/network/ssl/ssl.c:287 msgid "Certificate File" msgstr "Varmennetiedosto" -#: src/network/ssl/ssl.c:151 src/network/ssl/ssl.c:285 +#: src/network/ssl/ssl.c:151 src/network/ssl/ssl.c:289 msgid "" "The location of a file containing the client certificate and unencrypted " "private key in PEM format. If unset, the file pointed to by the " @@ -6433,11 +6434,11 @@ msgstr "" #. * of binary packages should of course change the default to #. * suit their systems. #. * TODO: If the file name is relative, look in elinks_home? -#: src/network/ssl/ssl.c:259 +#: src/network/ssl/ssl.c:263 msgid "Trusted CA file" msgstr "Luotetut varmentajat luetteleva tiedosto" -#: src/network/ssl/ssl.c:266 +#: src/network/ssl/ssl.c:270 msgid "" "The location of a file containing certificates of trusted certification " "authorities in PEM format. ELinks then trusts certificates issued by these " @@ -6448,11 +6449,11 @@ msgid "" msgstr "" #. name: -#: src/network/ssl/ssl.c:306 src/network/ssl/ssl.c:323 +#: src/network/ssl/ssl.c:310 src/network/ssl/ssl.c:327 msgid "SSL" msgstr "SSL" -#: src/network/ssl/ssl.c:308 +#: src/network/ssl/ssl.c:312 msgid "SSL options." msgstr "SSL-asetukset." @@ -7367,7 +7368,7 @@ msgstr "Mitä haluat tehdä tiedostolla \"%s\"?" msgid "Information about the torrent" msgstr "Näytä tietoja nykyisestä sivusta" -#: src/protocol/bittorrent/dialogs.c:782 src/session/download.c:1553 +#: src/protocol/bittorrent/dialogs.c:782 src/session/download.c:1571 msgid "What to do?" msgstr "Mitä tehdä?" @@ -7377,37 +7378,37 @@ msgid "Down~load" msgstr "~Lataa" #. accelerator_context(src/protocol/bittorrent/dialogs.c:bittorrent_query_callback, src/session/download.c:do_type_query) -#: src/protocol/bittorrent/dialogs.c:810 src/session/download.c:1656 +#: src/protocol/bittorrent/dialogs.c:810 src/session/download.c:1674 msgid "~Display" msgstr "~Näytä" #. accelerator_context(src/protocol/bittorrent/dialogs.c:bittorrent_query_callback, src/session/download.c:do_type_query) -#: src/protocol/bittorrent/dialogs.c:814 src/session/download.c:1660 +#: src/protocol/bittorrent/dialogs.c:814 src/session/download.c:1678 msgid "Show ~header" msgstr "Näytä ~otsake" -#: src/protocol/file/cgi.c:40 +#: src/protocol/file/cgi.c:41 msgid "Local CGI" msgstr "Paikallinen CGI" -#: src/protocol/file/cgi.c:42 +#: src/protocol/file/cgi.c:43 msgid "Local CGI specific options." msgstr "Paikallista CGI:tä koskevat asetukset." -#: src/protocol/file/cgi.c:46 +#: src/protocol/file/cgi.c:47 msgid "Colon separated list of directories, where CGI scripts are stored." msgstr "" -#: src/protocol/file/cgi.c:49 +#: src/protocol/file/cgi.c:50 msgid "Allow local CGI" msgstr "Salli paikallinen CGI" -#: src/protocol/file/cgi.c:51 +#: src/protocol/file/cgi.c:52 msgid "Whether to execute local CGI scripts." msgstr "" #. name: -#: src/protocol/file/cgi.c:56 +#: src/protocol/file/cgi.c:57 msgid "CGI" msgstr "" @@ -7918,7 +7919,7 @@ msgid "" msgstr "" #. name: -#: src/protocol/rewrite/rewrite.c:360 +#: src/protocol/rewrite/rewrite.c:348 msgid "URI rewrite" msgstr "" @@ -8110,36 +8111,36 @@ msgstr "~Kirjoita alkuperäisen tiedoston päälle" msgid "~Resume download of the original file" msgstr "~Jatka alkuperäisen tiedoston latausta" -#: src/session/download.c:1556 +#: src/session/download.c:1574 msgid "Unknown type" msgstr "Tuntematon tyyppi" -#: src/session/download.c:1581 +#: src/session/download.c:1599 #, c-format msgid "What would you like to do with the file '%s' (type: %s%s%s)?" msgstr "Mitä haluat tehdä tiedostolla \"%s\" (tyyppi: %s%s%s)?" -#: src/session/download.c:1584 +#: src/session/download.c:1602 #, c-format msgid "What would you like to do with the file (type: %s%s%s)?" msgstr "Mitä haluat tehdä tiedostolla (tyyppi: %s%s%s)?" -#: src/session/download.c:1612 +#: src/session/download.c:1630 #, no-c-format msgid "Program ('%' will be replaced by the filename)" msgstr "Ohjelma (\"%\" korvataan tiedoston nimellä)" -#: src/session/download.c:1616 +#: src/session/download.c:1634 msgid "Block the terminal" msgstr "Varaa pääte" -#: src/session/download.c:1622 +#: src/session/download.c:1640 #, c-format msgid "The file will be opened with the program '%s'." msgstr "Tiedosto avataan ohjelmalla \"%s\"." #. accelerator_context(src/session/download.c:do_type_query) -#: src/session/download.c:1643 +#: src/session/download.c:1661 msgid "~Open" msgstr "~Avaa" diff --git a/po/fr.po b/po/fr.po index 5f68c72b..259b2c37 100644 --- a/po/fr.po +++ b/po/fr.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: ELinks 0.12.GIT\n" "Report-Msgid-Bugs-To: elinks-users@linuxfromscratch.org\n" -"POT-Creation-Date: 2020-06-26 19:00+0200\n" +"POT-Creation-Date: 2020-07-26 15:28+0200\n" "PO-Revision-Date: 2009-06-02 23:58+0200\n" "Last-Translator: Mikael Berthe \n" "MIME-Version: 1.0\n" @@ -180,7 +180,7 @@ msgstr "Chaîne vide non autorisée" #: src/dialogs/options.c:244 src/dialogs/options.c:323 src/mime/dialogs.c:133 #: src/protocol/auth/dialogs.c:160 src/protocol/bittorrent/dialogs.c:820 #: src/scripting/lua/core.c:402 src/scripting/lua/core.c:483 -#: src/session/download.c:840 src/session/download.c:1666 +#: src/session/download.c:840 src/session/download.c:1684 #: src/viewer/text/search.c:1937 msgid "~Cancel" msgstr "~Annuler" @@ -197,7 +197,7 @@ msgstr "Horloge digitale dans la barre d'état." #: src/config/options.inc:1343 src/ecmascript/ecmascript.c:44 #: src/globhist/globhist.c:64 src/mime/backend/mailcap.c:93 #: src/mime/backend/mimetypes.c:52 src/network/ssl/ssl.c:129 -#: src/network/ssl/ssl.c:278 +#: src/network/ssl/ssl.c:282 msgid "Enable" msgstr "Activation" @@ -2038,7 +2038,7 @@ msgstr "Impossible d'ajouter une option ici." #. accelerator_context(src/config/dialogs.c:keybinding_buttons, src/config/dialogs.c:option_buttons, src/cookies/dialogs.c:cookie_buttons, src/formhist/dialogs.c:formhist_buttons, src/protocol/bittorrent/dialogs.c:bittorrent_query_callback, src/session/download.c:do_type_query, terminal_options) #: src/config/dialogs.c:505 src/config/dialogs.c:933 src/cookies/dialogs.c:543 #: src/dialogs/options.c:243 src/formhist/dialogs.c:214 -#: src/protocol/bittorrent/dialogs.c:807 src/session/download.c:1650 +#: src/protocol/bittorrent/dialogs.c:807 src/session/download.c:1668 msgid "Sa~ve" msgstr "Enre~gistrer" @@ -4941,7 +4941,7 @@ msgid "Domain" msgstr "Domaine" #: src/cookies/dialogs.c:41 src/mime/backend/mailcap.c:97 -#: src/mime/backend/mimetypes.c:56 src/protocol/file/cgi.c:44 +#: src/mime/backend/mimetypes.c:56 src/protocol/file/cgi.c:45 msgid "Path" msgstr "Chemin" @@ -6671,24 +6671,25 @@ msgid "Program" msgstr "Programme" #: src/mime/backend/default.c:76 -#, no-c-format +#, fuzzy, no-c-format msgid "" -"External viewer for this file type. '%' in this string will be substituted " -"by a file name. Do _not_ put single- or double-quotes around the % sign." +"External viewer for this file type. '%f' in this string will be substituted " +"by a file name, '%u' by its uri. Do _not_ put single- or double-quotes " +"around the % sign." msgstr "" "Visionneur externe pour ce type de fichier. '%' dans la chaîne sera remplacé " "par un nom de fichier. Ne _pas_ placer de simple ou doubles guillemets " "autour du signe %." -#: src/mime/backend/default.c:81 +#: src/mime/backend/default.c:82 msgid "File extension associations" msgstr "Associations des extensions de fichiers" -#: src/mime/backend/default.c:83 +#: src/mime/backend/default.c:84 msgid "Extension <-> MIME type association." msgstr "Association extension <-> type MIME." -#: src/mime/backend/default.c:87 +#: src/mime/backend/default.c:88 msgid "" "MIME-type matching this file extension ('*' is used here in place of '.')." msgstr "" @@ -6696,7 +6697,7 @@ msgstr "" "la place de '.')." #. name: -#: src/mime/backend/default.c:219 +#: src/mime/backend/default.c:220 msgid "Option system" msgstr "Système de configuration" @@ -6846,23 +6847,23 @@ msgstr "" "Vérifier le certificat SSL du serveur. Notez que cela nécessite une " "configuration particulière de OpenSSL par l'utilisateur." -#: src/network/ssl/ssl.c:121 +#: src/network/ssl/ssl.c:121 src/network/ssl/ssl.c:251 msgid "Use HTTPS by default" msgstr "" -#: src/network/ssl/ssl.c:123 +#: src/network/ssl/ssl.c:123 src/network/ssl/ssl.c:253 msgid "Use HTTPS when a URL scheme is not provided." msgstr "" -#: src/network/ssl/ssl.c:125 src/network/ssl/ssl.c:274 +#: src/network/ssl/ssl.c:125 src/network/ssl/ssl.c:278 msgid "Client Certificates" msgstr "Certificats du client" -#: src/network/ssl/ssl.c:127 src/network/ssl/ssl.c:276 +#: src/network/ssl/ssl.c:127 src/network/ssl/ssl.c:280 msgid "X509 client certificate options." msgstr "Options concernant les certificats X509 du client." -#: src/network/ssl/ssl.c:131 src/network/ssl/ssl.c:280 +#: src/network/ssl/ssl.c:131 src/network/ssl/ssl.c:284 msgid "" "Enable or not the sending of X509 client certificates to servers which " "request them." @@ -6897,11 +6898,11 @@ msgstr "" "d'environnement SSL_DIR. La base peut également être partagée avec les " "navigateurs Mozilla." -#: src/network/ssl/ssl.c:149 src/network/ssl/ssl.c:283 +#: src/network/ssl/ssl.c:149 src/network/ssl/ssl.c:287 msgid "Certificate File" msgstr "Fichier contenant le certificat" -#: src/network/ssl/ssl.c:151 src/network/ssl/ssl.c:285 +#: src/network/ssl/ssl.c:151 src/network/ssl/ssl.c:289 msgid "" "The location of a file containing the client certificate and unencrypted " "private key in PEM format. If unset, the file pointed to by the " @@ -6927,11 +6928,11 @@ msgstr "" #. * of binary packages should of course change the default to #. * suit their systems. #. * TODO: If the file name is relative, look in elinks_home? -#: src/network/ssl/ssl.c:259 +#: src/network/ssl/ssl.c:263 msgid "Trusted CA file" msgstr "Fichier de CA digne de confiance" -#: src/network/ssl/ssl.c:266 +#: src/network/ssl/ssl.c:270 msgid "" "The location of a file containing certificates of trusted certification " "authorities in PEM format. ELinks then trusts certificates issued by these " @@ -6949,11 +6950,11 @@ msgstr "" "OpenSSL." #. name: -#: src/network/ssl/ssl.c:306 src/network/ssl/ssl.c:323 +#: src/network/ssl/ssl.c:310 src/network/ssl/ssl.c:327 msgid "SSL" msgstr "SSL" -#: src/network/ssl/ssl.c:308 +#: src/network/ssl/ssl.c:312 msgid "SSL options." msgstr "Options SSL." @@ -7927,7 +7928,7 @@ msgstr "Que voulez-vous faire avec le fichier '%s' ?" msgid "Information about the torrent" msgstr "Informations sur le torrent" -#: src/protocol/bittorrent/dialogs.c:782 src/session/download.c:1553 +#: src/protocol/bittorrent/dialogs.c:782 src/session/download.c:1571 msgid "What to do?" msgstr "Que faire ?" @@ -7937,38 +7938,38 @@ msgid "Down~load" msgstr "Té~lécharger" #. accelerator_context(src/protocol/bittorrent/dialogs.c:bittorrent_query_callback, src/session/download.c:do_type_query) -#: src/protocol/bittorrent/dialogs.c:810 src/session/download.c:1656 +#: src/protocol/bittorrent/dialogs.c:810 src/session/download.c:1674 msgid "~Display" msgstr "A~fficher" #. accelerator_context(src/protocol/bittorrent/dialogs.c:bittorrent_query_callback, src/session/download.c:do_type_query) -#: src/protocol/bittorrent/dialogs.c:814 src/session/download.c:1660 +#: src/protocol/bittorrent/dialogs.c:814 src/session/download.c:1678 msgid "Show ~header" msgstr "~Montrer les en-têtes" -#: src/protocol/file/cgi.c:40 +#: src/protocol/file/cgi.c:41 msgid "Local CGI" msgstr "Scripts CGI locaux" -#: src/protocol/file/cgi.c:42 +#: src/protocol/file/cgi.c:43 msgid "Local CGI specific options." msgstr "Options des scripts CGI locaux." -#: src/protocol/file/cgi.c:46 +#: src/protocol/file/cgi.c:47 msgid "Colon separated list of directories, where CGI scripts are stored." msgstr "" "Liste des répertoires où sont les scripts CGI (séparée par des virgules)." -#: src/protocol/file/cgi.c:49 +#: src/protocol/file/cgi.c:50 msgid "Allow local CGI" msgstr "Autoriser les scripts CGI locaux" -#: src/protocol/file/cgi.c:51 +#: src/protocol/file/cgi.c:52 msgid "Whether to execute local CGI scripts." msgstr "Exécuter ou non les scripts CGI locaux." #. name: -#: src/protocol/file/cgi.c:56 +#: src/protocol/file/cgi.c:57 msgid "CGI" msgstr "CGI" @@ -8587,7 +8588,7 @@ msgstr "" "%% signifie '%'." #. name: -#: src/protocol/rewrite/rewrite.c:360 +#: src/protocol/rewrite/rewrite.c:348 msgid "URI rewrite" msgstr "Ré-écriture d'URI" @@ -8790,36 +8791,36 @@ msgstr "Écraser le fichier ~original" msgid "~Resume download of the original file" msgstr "~Reprendre le téléchargement du fichier original" -#: src/session/download.c:1556 +#: src/session/download.c:1574 msgid "Unknown type" msgstr "Type inconnu" -#: src/session/download.c:1581 +#: src/session/download.c:1599 #, c-format msgid "What would you like to do with the file '%s' (type: %s%s%s)?" msgstr "Que voulez-vous faire avec le fichier '%s' (type: %s%s%s) ?" -#: src/session/download.c:1584 +#: src/session/download.c:1602 #, c-format msgid "What would you like to do with the file (type: %s%s%s)?" msgstr "Que voulez-vous faire avec le fichier (type: %s%s%s) ?" -#: src/session/download.c:1612 +#: src/session/download.c:1630 #, no-c-format msgid "Program ('%' will be replaced by the filename)" msgstr "Programme ('%' sera remplacé par le nom du fichier)" -#: src/session/download.c:1616 +#: src/session/download.c:1634 msgid "Block the terminal" msgstr "Bloquer le terminal" -#: src/session/download.c:1622 +#: src/session/download.c:1640 #, c-format msgid "The file will be opened with the program '%s'." msgstr "Le fichier sera ouvert avec le programme '%s'." #. accelerator_context(src/session/download.c:do_type_query) -#: src/session/download.c:1643 +#: src/session/download.c:1661 msgid "~Open" msgstr "~Ouvrir" diff --git a/po/gl.po b/po/gl.po index 3b44689d..8abc1826 100644 --- a/po/gl.po +++ b/po/gl.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: ELinks 0.5pre0.CVS\n" "Report-Msgid-Bugs-To: elinks-users@linuxfromscratch.org\n" -"POT-Creation-Date: 2020-06-26 19:00+0200\n" +"POT-Creation-Date: 2020-07-26 15:28+0200\n" "PO-Revision-Date: 2003-01-03 03:41+0100\n" "Last-Translator: Alberto García \n" "Language-Team: Galician \n" @@ -186,7 +186,7 @@ msgstr "Non se permite unha cadea baleira" #: src/dialogs/options.c:244 src/dialogs/options.c:323 src/mime/dialogs.c:133 #: src/protocol/auth/dialogs.c:160 src/protocol/bittorrent/dialogs.c:820 #: src/scripting/lua/core.c:402 src/scripting/lua/core.c:483 -#: src/session/download.c:840 src/session/download.c:1666 +#: src/session/download.c:840 src/session/download.c:1684 #: src/viewer/text/search.c:1937 #, fuzzy msgid "~Cancel" @@ -205,7 +205,7 @@ msgstr "" #: src/config/options.inc:1343 src/ecmascript/ecmascript.c:44 #: src/globhist/globhist.c:64 src/mime/backend/mailcap.c:93 #: src/mime/backend/mimetypes.c:52 src/network/ssl/ssl.c:129 -#: src/network/ssl/ssl.c:278 +#: src/network/ssl/ssl.c:282 #, fuzzy msgid "Enable" msgstr "nome" @@ -1996,7 +1996,7 @@ msgstr "" #. accelerator_context(src/config/dialogs.c:keybinding_buttons, src/config/dialogs.c:option_buttons, src/cookies/dialogs.c:cookie_buttons, src/formhist/dialogs.c:formhist_buttons, src/protocol/bittorrent/dialogs.c:bittorrent_query_callback, src/session/download.c:do_type_query, terminal_options) #: src/config/dialogs.c:505 src/config/dialogs.c:933 src/cookies/dialogs.c:543 #: src/dialogs/options.c:243 src/formhist/dialogs.c:214 -#: src/protocol/bittorrent/dialogs.c:807 src/session/download.c:1650 +#: src/protocol/bittorrent/dialogs.c:807 src/session/download.c:1668 #, fuzzy msgid "Sa~ve" msgstr "Gardar" @@ -4575,7 +4575,7 @@ msgid "Domain" msgstr "~Información do documento" #: src/cookies/dialogs.c:41 src/mime/backend/mailcap.c:97 -#: src/mime/backend/mimetypes.c:56 src/protocol/file/cgi.c:44 +#: src/mime/backend/mimetypes.c:56 src/protocol/file/cgi.c:45 msgid "Path" msgstr "" @@ -6343,26 +6343,27 @@ msgstr "Sen programa" #: src/mime/backend/default.c:76 #, no-c-format msgid "" -"External viewer for this file type. '%' in this string will be substituted " -"by a file name. Do _not_ put single- or double-quotes around the % sign." +"External viewer for this file type. '%f' in this string will be substituted " +"by a file name, '%u' by its uri. Do _not_ put single- or double-quotes " +"around the % sign." msgstr "" -#: src/mime/backend/default.c:81 +#: src/mime/backend/default.c:82 #, fuzzy msgid "File extension associations" msgstr "~Extensións de ficheiros" -#: src/mime/backend/default.c:83 +#: src/mime/backend/default.c:84 msgid "Extension <-> MIME type association." msgstr "" -#: src/mime/backend/default.c:87 +#: src/mime/backend/default.c:88 msgid "" "MIME-type matching this file extension ('*' is used here in place of '.')." msgstr "" #. name: -#: src/mime/backend/default.c:219 +#: src/mime/backend/default.c:220 msgid "Option system" msgstr "" @@ -6492,24 +6493,24 @@ msgid "" "configuration of OpenSSL by the user." msgstr "" -#: src/network/ssl/ssl.c:121 +#: src/network/ssl/ssl.c:121 src/network/ssl/ssl.c:251 msgid "Use HTTPS by default" msgstr "" -#: src/network/ssl/ssl.c:123 +#: src/network/ssl/ssl.c:123 src/network/ssl/ssl.c:253 msgid "Use HTTPS when a URL scheme is not provided." msgstr "" -#: src/network/ssl/ssl.c:125 src/network/ssl/ssl.c:274 +#: src/network/ssl/ssl.c:125 src/network/ssl/ssl.c:278 msgid "Client Certificates" msgstr "" -#: src/network/ssl/ssl.c:127 src/network/ssl/ssl.c:276 +#: src/network/ssl/ssl.c:127 src/network/ssl/ssl.c:280 #, fuzzy msgid "X509 client certificate options." msgstr "Opcións de terminal" -#: src/network/ssl/ssl.c:131 src/network/ssl/ssl.c:280 +#: src/network/ssl/ssl.c:131 src/network/ssl/ssl.c:284 msgid "" "Enable or not the sending of X509 client certificates to servers which " "request them." @@ -6533,12 +6534,12 @@ msgid "" "The database can be also shared with Mozilla browsers." msgstr "" -#: src/network/ssl/ssl.c:149 src/network/ssl/ssl.c:283 +#: src/network/ssl/ssl.c:149 src/network/ssl/ssl.c:287 #, fuzzy msgid "Certificate File" msgstr "tempo estimado" -#: src/network/ssl/ssl.c:151 src/network/ssl/ssl.c:285 +#: src/network/ssl/ssl.c:151 src/network/ssl/ssl.c:289 msgid "" "The location of a file containing the client certificate and unencrypted " "private key in PEM format. If unset, the file pointed to by the " @@ -6559,12 +6560,12 @@ msgstr "" #. * of binary packages should of course change the default to #. * suit their systems. #. * TODO: If the file name is relative, look in elinks_home? -#: src/network/ssl/ssl.c:259 +#: src/network/ssl/ssl.c:263 #, fuzzy msgid "Trusted CA file" msgstr "Transferindo" -#: src/network/ssl/ssl.c:266 +#: src/network/ssl/ssl.c:270 msgid "" "The location of a file containing certificates of trusted certification " "authorities in PEM format. ELinks then trusts certificates issued by these " @@ -6575,11 +6576,11 @@ msgid "" msgstr "" #. name: -#: src/network/ssl/ssl.c:306 src/network/ssl/ssl.c:323 +#: src/network/ssl/ssl.c:310 src/network/ssl/ssl.c:327 msgid "SSL" msgstr "" -#: src/network/ssl/ssl.c:308 +#: src/network/ssl/ssl.c:312 #, fuzzy msgid "SSL options." msgstr "~Gardar opcións" @@ -7521,7 +7522,7 @@ msgstr "" msgid "Information about the torrent" msgstr "Descargar ~imaxe" -#: src/protocol/bittorrent/dialogs.c:782 src/session/download.c:1553 +#: src/protocol/bittorrent/dialogs.c:782 src/session/download.c:1571 msgid "What to do?" msgstr "¿Qué fago?" @@ -7532,40 +7533,40 @@ msgid "Down~load" msgstr "Descargar" #. accelerator_context(src/protocol/bittorrent/dialogs.c:bittorrent_query_callback, src/session/download.c:do_type_query) -#: src/protocol/bittorrent/dialogs.c:810 src/session/download.c:1656 +#: src/protocol/bittorrent/dialogs.c:810 src/session/download.c:1674 #, fuzzy msgid "~Display" msgstr "Mostrar" #. accelerator_context(src/protocol/bittorrent/dialogs.c:bittorrent_query_callback, src/session/download.c:do_type_query) -#: src/protocol/bittorrent/dialogs.c:814 src/session/download.c:1660 +#: src/protocol/bittorrent/dialogs.c:814 src/session/download.c:1678 msgid "Show ~header" msgstr "" -#: src/protocol/file/cgi.c:40 +#: src/protocol/file/cgi.c:41 #, fuzzy msgid "Local CGI" msgstr "ficheiros" -#: src/protocol/file/cgi.c:42 +#: src/protocol/file/cgi.c:43 #, fuzzy msgid "Local CGI specific options." msgstr "Sen programa especificado para" -#: src/protocol/file/cgi.c:46 +#: src/protocol/file/cgi.c:47 msgid "Colon separated list of directories, where CGI scripts are stored." msgstr "" -#: src/protocol/file/cgi.c:49 +#: src/protocol/file/cgi.c:50 msgid "Allow local CGI" msgstr "" -#: src/protocol/file/cgi.c:51 +#: src/protocol/file/cgi.c:52 msgid "Whether to execute local CGI scripts." msgstr "" #. name: -#: src/protocol/file/cgi.c:56 +#: src/protocol/file/cgi.c:57 msgid "CGI" msgstr "" @@ -8073,7 +8074,7 @@ msgid "" msgstr "" #. name: -#: src/protocol/rewrite/rewrite.c:360 +#: src/protocol/rewrite/rewrite.c:348 msgid "URI rewrite" msgstr "" @@ -8257,37 +8258,37 @@ msgstr "" msgid "~Resume download of the original file" msgstr "" -#: src/session/download.c:1556 +#: src/session/download.c:1574 msgid "Unknown type" msgstr "Tipo descoñecido" -#: src/session/download.c:1581 +#: src/session/download.c:1599 #, c-format msgid "What would you like to do with the file '%s' (type: %s%s%s)?" msgstr "" -#: src/session/download.c:1584 +#: src/session/download.c:1602 #, c-format msgid "What would you like to do with the file (type: %s%s%s)?" msgstr "" -#: src/session/download.c:1612 +#: src/session/download.c:1630 #, no-c-format msgid "Program ('%' will be replaced by the filename)" msgstr "" -#: src/session/download.c:1616 +#: src/session/download.c:1634 #, fuzzy msgid "Block the terminal" msgstr "Terminal de ~BeOS" -#: src/session/download.c:1622 +#: src/session/download.c:1640 #, c-format msgid "The file will be opened with the program '%s'." msgstr "" #. accelerator_context(src/session/download.c:do_type_query) -#: src/session/download.c:1643 +#: src/session/download.c:1661 #, fuzzy msgid "~Open" msgstr "Abrir" diff --git a/po/hr.po b/po/hr.po index c236d54e..904a76f7 100644 --- a/po/hr.po +++ b/po/hr.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: ELinks 0.5pre0.CVS\n" "Report-Msgid-Bugs-To: elinks-users@linuxfromscratch.org\n" -"POT-Creation-Date: 2020-06-26 19:00+0200\n" +"POT-Creation-Date: 2020-07-26 15:28+0200\n" "PO-Revision-Date: 2003-01-03 03:41+0100\n" "Last-Translator: Denis Lackovic \n" "Language-Team: Croatian \n" @@ -186,7 +186,7 @@ msgstr "Prazni niz znakova nije dozvoljen" #: src/dialogs/options.c:244 src/dialogs/options.c:323 src/mime/dialogs.c:133 #: src/protocol/auth/dialogs.c:160 src/protocol/bittorrent/dialogs.c:820 #: src/scripting/lua/core.c:402 src/scripting/lua/core.c:483 -#: src/session/download.c:840 src/session/download.c:1666 +#: src/session/download.c:840 src/session/download.c:1684 #: src/viewer/text/search.c:1937 #, fuzzy msgid "~Cancel" @@ -205,7 +205,7 @@ msgstr "" #: src/config/options.inc:1343 src/ecmascript/ecmascript.c:44 #: src/globhist/globhist.c:64 src/mime/backend/mailcap.c:93 #: src/mime/backend/mimetypes.c:52 src/network/ssl/ssl.c:129 -#: src/network/ssl/ssl.c:278 +#: src/network/ssl/ssl.c:282 #, fuzzy msgid "Enable" msgstr "ime" @@ -1996,7 +1996,7 @@ msgstr "" #. accelerator_context(src/config/dialogs.c:keybinding_buttons, src/config/dialogs.c:option_buttons, src/cookies/dialogs.c:cookie_buttons, src/formhist/dialogs.c:formhist_buttons, src/protocol/bittorrent/dialogs.c:bittorrent_query_callback, src/session/download.c:do_type_query, terminal_options) #: src/config/dialogs.c:505 src/config/dialogs.c:933 src/cookies/dialogs.c:543 #: src/dialogs/options.c:243 src/formhist/dialogs.c:214 -#: src/protocol/bittorrent/dialogs.c:807 src/session/download.c:1650 +#: src/protocol/bittorrent/dialogs.c:807 src/session/download.c:1668 #, fuzzy msgid "Sa~ve" msgstr "Spremi" @@ -4576,7 +4576,7 @@ msgid "Domain" msgstr "Podaci o dokumentu" #: src/cookies/dialogs.c:41 src/mime/backend/mailcap.c:97 -#: src/mime/backend/mimetypes.c:56 src/protocol/file/cgi.c:44 +#: src/mime/backend/mimetypes.c:56 src/protocol/file/cgi.c:45 msgid "Path" msgstr "" @@ -6343,26 +6343,27 @@ msgstr "Nema programa" #: src/mime/backend/default.c:76 #, no-c-format msgid "" -"External viewer for this file type. '%' in this string will be substituted " -"by a file name. Do _not_ put single- or double-quotes around the % sign." +"External viewer for this file type. '%f' in this string will be substituted " +"by a file name, '%u' by its uri. Do _not_ put single- or double-quotes " +"around the % sign." msgstr "" -#: src/mime/backend/default.c:81 +#: src/mime/backend/default.c:82 #, fuzzy msgid "File extension associations" msgstr "Nastavci ~datoteka" -#: src/mime/backend/default.c:83 +#: src/mime/backend/default.c:84 msgid "Extension <-> MIME type association." msgstr "" -#: src/mime/backend/default.c:87 +#: src/mime/backend/default.c:88 msgid "" "MIME-type matching this file extension ('*' is used here in place of '.')." msgstr "" #. name: -#: src/mime/backend/default.c:219 +#: src/mime/backend/default.c:220 msgid "Option system" msgstr "" @@ -6492,24 +6493,24 @@ msgid "" "configuration of OpenSSL by the user." msgstr "" -#: src/network/ssl/ssl.c:121 +#: src/network/ssl/ssl.c:121 src/network/ssl/ssl.c:251 msgid "Use HTTPS by default" msgstr "" -#: src/network/ssl/ssl.c:123 +#: src/network/ssl/ssl.c:123 src/network/ssl/ssl.c:253 msgid "Use HTTPS when a URL scheme is not provided." msgstr "" -#: src/network/ssl/ssl.c:125 src/network/ssl/ssl.c:274 +#: src/network/ssl/ssl.c:125 src/network/ssl/ssl.c:278 msgid "Client Certificates" msgstr "" -#: src/network/ssl/ssl.c:127 src/network/ssl/ssl.c:276 +#: src/network/ssl/ssl.c:127 src/network/ssl/ssl.c:280 #, fuzzy msgid "X509 client certificate options." msgstr "Opcije terminala" -#: src/network/ssl/ssl.c:131 src/network/ssl/ssl.c:280 +#: src/network/ssl/ssl.c:131 src/network/ssl/ssl.c:284 msgid "" "Enable or not the sending of X509 client certificates to servers which " "request them." @@ -6533,12 +6534,12 @@ msgid "" "The database can be also shared with Mozilla browsers." msgstr "" -#: src/network/ssl/ssl.c:149 src/network/ssl/ssl.c:283 +#: src/network/ssl/ssl.c:149 src/network/ssl/ssl.c:287 #, fuzzy msgid "Certificate File" msgstr "procijenjeno vrijeme" -#: src/network/ssl/ssl.c:151 src/network/ssl/ssl.c:285 +#: src/network/ssl/ssl.c:151 src/network/ssl/ssl.c:289 msgid "" "The location of a file containing the client certificate and unencrypted " "private key in PEM format. If unset, the file pointed to by the " @@ -6559,12 +6560,12 @@ msgstr "" #. * of binary packages should of course change the default to #. * suit their systems. #. * TODO: If the file name is relative, look in elinks_home? -#: src/network/ssl/ssl.c:259 +#: src/network/ssl/ssl.c:263 #, fuzzy msgid "Trusted CA file" msgstr "Prenosim" -#: src/network/ssl/ssl.c:266 +#: src/network/ssl/ssl.c:270 msgid "" "The location of a file containing certificates of trusted certification " "authorities in PEM format. ELinks then trusts certificates issued by these " @@ -6575,11 +6576,11 @@ msgid "" msgstr "" #. name: -#: src/network/ssl/ssl.c:306 src/network/ssl/ssl.c:323 +#: src/network/ssl/ssl.c:310 src/network/ssl/ssl.c:327 msgid "SSL" msgstr "" -#: src/network/ssl/ssl.c:308 +#: src/network/ssl/ssl.c:312 #, fuzzy msgid "SSL options." msgstr "~Sačuvaj opcije" @@ -7519,7 +7520,7 @@ msgstr "" msgid "Information about the torrent" msgstr "Skini sliku" -#: src/protocol/bittorrent/dialogs.c:782 src/session/download.c:1553 +#: src/protocol/bittorrent/dialogs.c:782 src/session/download.c:1571 msgid "What to do?" msgstr "Što napraviti?" @@ -7530,40 +7531,40 @@ msgid "Down~load" msgstr "Preuzmi" #. accelerator_context(src/protocol/bittorrent/dialogs.c:bittorrent_query_callback, src/session/download.c:do_type_query) -#: src/protocol/bittorrent/dialogs.c:810 src/session/download.c:1656 +#: src/protocol/bittorrent/dialogs.c:810 src/session/download.c:1674 #, fuzzy msgid "~Display" msgstr "Prikaži" #. accelerator_context(src/protocol/bittorrent/dialogs.c:bittorrent_query_callback, src/session/download.c:do_type_query) -#: src/protocol/bittorrent/dialogs.c:814 src/session/download.c:1660 +#: src/protocol/bittorrent/dialogs.c:814 src/session/download.c:1678 msgid "Show ~header" msgstr "" -#: src/protocol/file/cgi.c:40 +#: src/protocol/file/cgi.c:41 #, fuzzy msgid "Local CGI" msgstr "datoteke" -#: src/protocol/file/cgi.c:42 +#: src/protocol/file/cgi.c:43 #, fuzzy msgid "Local CGI specific options." msgstr "Nema programa za" -#: src/protocol/file/cgi.c:46 +#: src/protocol/file/cgi.c:47 msgid "Colon separated list of directories, where CGI scripts are stored." msgstr "" -#: src/protocol/file/cgi.c:49 +#: src/protocol/file/cgi.c:50 msgid "Allow local CGI" msgstr "" -#: src/protocol/file/cgi.c:51 +#: src/protocol/file/cgi.c:52 msgid "Whether to execute local CGI scripts." msgstr "" #. name: -#: src/protocol/file/cgi.c:56 +#: src/protocol/file/cgi.c:57 msgid "CGI" msgstr "" @@ -8071,7 +8072,7 @@ msgid "" msgstr "" #. name: -#: src/protocol/rewrite/rewrite.c:360 +#: src/protocol/rewrite/rewrite.c:348 msgid "URI rewrite" msgstr "" @@ -8255,37 +8256,37 @@ msgstr "" msgid "~Resume download of the original file" msgstr "" -#: src/session/download.c:1556 +#: src/session/download.c:1574 msgid "Unknown type" msgstr "Nepoznati tip" -#: src/session/download.c:1581 +#: src/session/download.c:1599 #, c-format msgid "What would you like to do with the file '%s' (type: %s%s%s)?" msgstr "" -#: src/session/download.c:1584 +#: src/session/download.c:1602 #, c-format msgid "What would you like to do with the file (type: %s%s%s)?" msgstr "" -#: src/session/download.c:1612 +#: src/session/download.c:1630 #, no-c-format msgid "Program ('%' will be replaced by the filename)" msgstr "" -#: src/session/download.c:1616 +#: src/session/download.c:1634 #, fuzzy msgid "Block the terminal" msgstr "~BeOS terminal" -#: src/session/download.c:1622 +#: src/session/download.c:1640 #, c-format msgid "The file will be opened with the program '%s'." msgstr "" #. accelerator_context(src/session/download.c:do_type_query) -#: src/session/download.c:1643 +#: src/session/download.c:1661 #, fuzzy msgid "~Open" msgstr "Otvoriti" diff --git a/po/hu.po b/po/hu.po index 4319193d..288a05cc 100644 --- a/po/hu.po +++ b/po/hu.po @@ -10,7 +10,7 @@ msgid "" msgstr "" "Project-Id-Version: hu\n" "Report-Msgid-Bugs-To: elinks-users@linuxfromscratch.org\n" -"POT-Creation-Date: 2020-06-26 19:00+0200\n" +"POT-Creation-Date: 2020-07-26 15:28+0200\n" "PO-Revision-Date: 2005-10-11 19:06+0000\n" "Last-Translator: \n" "Language-Team: \n" @@ -186,7 +186,7 @@ msgstr "Üres szöveg nem engedélyezett" #: src/dialogs/options.c:244 src/dialogs/options.c:323 src/mime/dialogs.c:133 #: src/protocol/auth/dialogs.c:160 src/protocol/bittorrent/dialogs.c:820 #: src/scripting/lua/core.c:402 src/scripting/lua/core.c:483 -#: src/session/download.c:840 src/session/download.c:1666 +#: src/session/download.c:840 src/session/download.c:1684 #: src/viewer/text/search.c:1937 msgid "~Cancel" msgstr "~Mégsem" @@ -203,7 +203,7 @@ msgstr "Digitális óra a státuszsorban." #: src/config/options.inc:1343 src/ecmascript/ecmascript.c:44 #: src/globhist/globhist.c:64 src/mime/backend/mailcap.c:93 #: src/mime/backend/mimetypes.c:52 src/network/ssl/ssl.c:129 -#: src/network/ssl/ssl.c:278 +#: src/network/ssl/ssl.c:282 msgid "Enable" msgstr "Engedélyezés" @@ -2067,7 +2067,7 @@ msgstr "Ide nem lehet beállítást hozzáadni." #. accelerator_context(src/config/dialogs.c:keybinding_buttons, src/config/dialogs.c:option_buttons, src/cookies/dialogs.c:cookie_buttons, src/formhist/dialogs.c:formhist_buttons, src/protocol/bittorrent/dialogs.c:bittorrent_query_callback, src/session/download.c:do_type_query, terminal_options) #: src/config/dialogs.c:505 src/config/dialogs.c:933 src/cookies/dialogs.c:543 #: src/dialogs/options.c:243 src/formhist/dialogs.c:214 -#: src/protocol/bittorrent/dialogs.c:807 src/session/download.c:1650 +#: src/protocol/bittorrent/dialogs.c:807 src/session/download.c:1668 msgid "Sa~ve" msgstr "Menté~s" @@ -4950,7 +4950,7 @@ msgid "Domain" msgstr "Domén" #: src/cookies/dialogs.c:41 src/mime/backend/mailcap.c:97 -#: src/mime/backend/mimetypes.c:56 src/protocol/file/cgi.c:44 +#: src/mime/backend/mimetypes.c:56 src/protocol/file/cgi.c:45 msgid "Path" msgstr "Útvonal" @@ -6674,21 +6674,22 @@ msgstr "Program" #: src/mime/backend/default.c:76 #, fuzzy, no-c-format msgid "" -"External viewer for this file type. '%' in this string will be substituted " -"by a file name. Do _not_ put single- or double-quotes around the % sign." +"External viewer for this file type. '%f' in this string will be substituted " +"by a file name, '%u' by its uri. Do _not_ put single- or double-quotes " +"around the % sign." msgstr "" "Külső megjelenítő ehhez a fájltípushoz. '%' ebben a sztringben\n" "a fáljnévre cserélődik." -#: src/mime/backend/default.c:81 +#: src/mime/backend/default.c:82 msgid "File extension associations" msgstr "Fájl kiterjesztés hozzárendelések" -#: src/mime/backend/default.c:83 +#: src/mime/backend/default.c:84 msgid "Extension <-> MIME type association." msgstr "Kiterjesztés <-> MIME típus hozzárendelés." -#: src/mime/backend/default.c:87 +#: src/mime/backend/default.c:88 #, fuzzy msgid "" "MIME-type matching this file extension ('*' is used here in place of '.')." @@ -6697,7 +6698,7 @@ msgstr "" "'*'-ot kell használni itt)." #. name: -#: src/mime/backend/default.c:219 +#: src/mime/backend/default.c:220 msgid "Option system" msgstr "Konfigurációs rendszer" @@ -6851,23 +6852,23 @@ msgstr "" "Ez az opció a felhasználótól az OpenSSL hozzáértő konfigurálását\n" "kívánja meg." -#: src/network/ssl/ssl.c:121 +#: src/network/ssl/ssl.c:121 src/network/ssl/ssl.c:251 msgid "Use HTTPS by default" msgstr "" -#: src/network/ssl/ssl.c:123 +#: src/network/ssl/ssl.c:123 src/network/ssl/ssl.c:253 msgid "Use HTTPS when a URL scheme is not provided." msgstr "" -#: src/network/ssl/ssl.c:125 src/network/ssl/ssl.c:274 +#: src/network/ssl/ssl.c:125 src/network/ssl/ssl.c:278 msgid "Client Certificates" msgstr "Kliens oldali tanúsítványok" -#: src/network/ssl/ssl.c:127 src/network/ssl/ssl.c:276 +#: src/network/ssl/ssl.c:127 src/network/ssl/ssl.c:280 msgid "X509 client certificate options." msgstr "X509 kliens oldali tanúsítványok" -#: src/network/ssl/ssl.c:131 src/network/ssl/ssl.c:280 +#: src/network/ssl/ssl.c:131 src/network/ssl/ssl.c:284 #, fuzzy msgid "" "Enable or not the sending of X509 client certificates to servers which " @@ -6894,11 +6895,11 @@ msgid "" "The database can be also shared with Mozilla browsers." msgstr "" -#: src/network/ssl/ssl.c:149 src/network/ssl/ssl.c:283 +#: src/network/ssl/ssl.c:149 src/network/ssl/ssl.c:287 msgid "Certificate File" msgstr "Tanúsítvány fájl" -#: src/network/ssl/ssl.c:151 src/network/ssl/ssl.c:285 +#: src/network/ssl/ssl.c:151 src/network/ssl/ssl.c:289 #, fuzzy msgid "" "The location of a file containing the client certificate and unencrypted " @@ -6927,12 +6928,12 @@ msgstr "" #. * of binary packages should of course change the default to #. * suit their systems. #. * TODO: If the file name is relative, look in elinks_home? -#: src/network/ssl/ssl.c:259 +#: src/network/ssl/ssl.c:263 #, fuzzy msgid "Trusted CA file" msgstr "Adatátviteli hiba" -#: src/network/ssl/ssl.c:266 +#: src/network/ssl/ssl.c:270 msgid "" "The location of a file containing certificates of trusted certification " "authorities in PEM format. ELinks then trusts certificates issued by these " @@ -6943,11 +6944,11 @@ msgid "" msgstr "" #. name: -#: src/network/ssl/ssl.c:306 src/network/ssl/ssl.c:323 +#: src/network/ssl/ssl.c:310 src/network/ssl/ssl.c:327 msgid "SSL" msgstr "SSL" -#: src/network/ssl/ssl.c:308 +#: src/network/ssl/ssl.c:312 msgid "SSL options." msgstr "SSL beállítások" @@ -7891,7 +7892,7 @@ msgstr "Mit tegyünk a '%s' fájllal? (típus: %s%s%s)?" msgid "Information about the torrent" msgstr "Információ az aktuális oldalról" -#: src/protocol/bittorrent/dialogs.c:782 src/session/download.c:1553 +#: src/protocol/bittorrent/dialogs.c:782 src/session/download.c:1571 msgid "What to do?" msgstr "Mit tegyünk?" @@ -7902,39 +7903,39 @@ msgid "Down~load" msgstr "Letöltés" #. accelerator_context(src/protocol/bittorrent/dialogs.c:bittorrent_query_callback, src/session/download.c:do_type_query) -#: src/protocol/bittorrent/dialogs.c:810 src/session/download.c:1656 +#: src/protocol/bittorrent/dialogs.c:810 src/session/download.c:1674 msgid "~Display" msgstr "Meg~jelenítés" #. accelerator_context(src/protocol/bittorrent/dialogs.c:bittorrent_query_callback, src/session/download.c:do_type_query) -#: src/protocol/bittorrent/dialogs.c:814 src/session/download.c:1660 +#: src/protocol/bittorrent/dialogs.c:814 src/session/download.c:1678 msgid "Show ~header" msgstr "Fejlé~c megjelenítése" -#: src/protocol/file/cgi.c:40 +#: src/protocol/file/cgi.c:41 msgid "Local CGI" msgstr "Helyi CGI" -#: src/protocol/file/cgi.c:42 +#: src/protocol/file/cgi.c:43 msgid "Local CGI specific options." msgstr "Helyi CGI-vel kapcsolatos beállítások." -#: src/protocol/file/cgi.c:46 +#: src/protocol/file/cgi.c:47 msgid "Colon separated list of directories, where CGI scripts are stored." msgstr "" "A CGI scriptek tárolására használt könyvtárak felsorolása, kettősponttal " "elválasztva." -#: src/protocol/file/cgi.c:49 +#: src/protocol/file/cgi.c:50 msgid "Allow local CGI" msgstr "Helyi CGI engedélyezése" -#: src/protocol/file/cgi.c:51 +#: src/protocol/file/cgi.c:52 msgid "Whether to execute local CGI scripts." msgstr "A helyi CGI scriptek futtatásának engedélyezése." #. name: -#: src/protocol/file/cgi.c:56 +#: src/protocol/file/cgi.c:57 msgid "CGI" msgstr "" @@ -8529,7 +8530,7 @@ msgid "" msgstr "" #. name: -#: src/protocol/rewrite/rewrite.c:360 +#: src/protocol/rewrite/rewrite.c:348 msgid "URI rewrite" msgstr "URI kiegészítés" @@ -8739,36 +8740,36 @@ msgstr "Az eredeti fájl f~elülírása" msgid "~Resume download of the original file" msgstr "A letöltés ~folytatása" -#: src/session/download.c:1556 +#: src/session/download.c:1574 msgid "Unknown type" msgstr "Ismeretlen fájlformátum" -#: src/session/download.c:1581 +#: src/session/download.c:1599 #, c-format msgid "What would you like to do with the file '%s' (type: %s%s%s)?" msgstr "Mit tegyünk a '%s' fájllal? (típus: %s%s%s)?" -#: src/session/download.c:1584 +#: src/session/download.c:1602 #, fuzzy, c-format msgid "What would you like to do with the file (type: %s%s%s)?" msgstr "Mit tegyünk a '%s' fájllal? (típus: %s%s%s)?" -#: src/session/download.c:1612 +#: src/session/download.c:1630 #, no-c-format msgid "Program ('%' will be replaced by the filename)" msgstr "Program (a '%' jel helyére a fájlnév helyettesítődik be)" -#: src/session/download.c:1616 +#: src/session/download.c:1634 msgid "Block the terminal" msgstr "Terminál zárolása" -#: src/session/download.c:1622 +#: src/session/download.c:1640 #, c-format msgid "The file will be opened with the program '%s'." msgstr "A fájlt a '%s' programmal fogjuk megnyitni." #. accelerator_context(src/session/download.c:do_type_query) -#: src/session/download.c:1643 +#: src/session/download.c:1661 msgid "~Open" msgstr "Me~gnyitás" diff --git a/po/id.po b/po/id.po index 92fe8c05..ad7bb976 100644 --- a/po/id.po +++ b/po/id.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: ELinks 0.5pre0.CVS\n" "Report-Msgid-Bugs-To: elinks-users@linuxfromscratch.org\n" -"POT-Creation-Date: 2020-06-26 19:00+0200\n" +"POT-Creation-Date: 2020-07-26 15:28+0200\n" "PO-Revision-Date: 2003-01-03 03:41+0100\n" "Last-Translator: Muhamad Faizal \n" "Language-Team: Indonesian \n" @@ -186,7 +186,7 @@ msgstr "Tidak boleh string kosong" #: src/dialogs/options.c:244 src/dialogs/options.c:323 src/mime/dialogs.c:133 #: src/protocol/auth/dialogs.c:160 src/protocol/bittorrent/dialogs.c:820 #: src/scripting/lua/core.c:402 src/scripting/lua/core.c:483 -#: src/session/download.c:840 src/session/download.c:1666 +#: src/session/download.c:840 src/session/download.c:1684 #: src/viewer/text/search.c:1937 #, fuzzy msgid "~Cancel" @@ -205,7 +205,7 @@ msgstr "" #: src/config/options.inc:1343 src/ecmascript/ecmascript.c:44 #: src/globhist/globhist.c:64 src/mime/backend/mailcap.c:93 #: src/mime/backend/mimetypes.c:52 src/network/ssl/ssl.c:129 -#: src/network/ssl/ssl.c:278 +#: src/network/ssl/ssl.c:282 #, fuzzy msgid "Enable" msgstr "nama" @@ -1996,7 +1996,7 @@ msgstr "" #. accelerator_context(src/config/dialogs.c:keybinding_buttons, src/config/dialogs.c:option_buttons, src/cookies/dialogs.c:cookie_buttons, src/formhist/dialogs.c:formhist_buttons, src/protocol/bittorrent/dialogs.c:bittorrent_query_callback, src/session/download.c:do_type_query, terminal_options) #: src/config/dialogs.c:505 src/config/dialogs.c:933 src/cookies/dialogs.c:543 #: src/dialogs/options.c:243 src/formhist/dialogs.c:214 -#: src/protocol/bittorrent/dialogs.c:807 src/session/download.c:1650 +#: src/protocol/bittorrent/dialogs.c:807 src/session/download.c:1668 #, fuzzy msgid "Sa~ve" msgstr "Simpan" @@ -4576,7 +4576,7 @@ msgid "Domain" msgstr "~Info dokumen" #: src/cookies/dialogs.c:41 src/mime/backend/mailcap.c:97 -#: src/mime/backend/mimetypes.c:56 src/protocol/file/cgi.c:44 +#: src/mime/backend/mimetypes.c:56 src/protocol/file/cgi.c:45 msgid "Path" msgstr "" @@ -6346,26 +6346,27 @@ msgstr "Ngga ada program" #: src/mime/backend/default.c:76 #, no-c-format msgid "" -"External viewer for this file type. '%' in this string will be substituted " -"by a file name. Do _not_ put single- or double-quotes around the % sign." +"External viewer for this file type. '%f' in this string will be substituted " +"by a file name, '%u' by its uri. Do _not_ put single- or double-quotes " +"around the % sign." msgstr "" -#: src/mime/backend/default.c:81 +#: src/mime/backend/default.c:82 #, fuzzy msgid "File extension associations" msgstr "~Ekstensi file" -#: src/mime/backend/default.c:83 +#: src/mime/backend/default.c:84 msgid "Extension <-> MIME type association." msgstr "" -#: src/mime/backend/default.c:87 +#: src/mime/backend/default.c:88 msgid "" "MIME-type matching this file extension ('*' is used here in place of '.')." msgstr "" #. name: -#: src/mime/backend/default.c:219 +#: src/mime/backend/default.c:220 msgid "Option system" msgstr "" @@ -6495,24 +6496,24 @@ msgid "" "configuration of OpenSSL by the user." msgstr "" -#: src/network/ssl/ssl.c:121 +#: src/network/ssl/ssl.c:121 src/network/ssl/ssl.c:251 msgid "Use HTTPS by default" msgstr "" -#: src/network/ssl/ssl.c:123 +#: src/network/ssl/ssl.c:123 src/network/ssl/ssl.c:253 msgid "Use HTTPS when a URL scheme is not provided." msgstr "" -#: src/network/ssl/ssl.c:125 src/network/ssl/ssl.c:274 +#: src/network/ssl/ssl.c:125 src/network/ssl/ssl.c:278 msgid "Client Certificates" msgstr "" -#: src/network/ssl/ssl.c:127 src/network/ssl/ssl.c:276 +#: src/network/ssl/ssl.c:127 src/network/ssl/ssl.c:280 #, fuzzy msgid "X509 client certificate options." msgstr "Opsi terminal" -#: src/network/ssl/ssl.c:131 src/network/ssl/ssl.c:280 +#: src/network/ssl/ssl.c:131 src/network/ssl/ssl.c:284 msgid "" "Enable or not the sending of X509 client certificates to servers which " "request them." @@ -6536,12 +6537,12 @@ msgid "" "The database can be also shared with Mozilla browsers." msgstr "" -#: src/network/ssl/ssl.c:149 src/network/ssl/ssl.c:283 +#: src/network/ssl/ssl.c:149 src/network/ssl/ssl.c:287 #, fuzzy msgid "Certificate File" msgstr "perkiraan selesai" -#: src/network/ssl/ssl.c:151 src/network/ssl/ssl.c:285 +#: src/network/ssl/ssl.c:151 src/network/ssl/ssl.c:289 msgid "" "The location of a file containing the client certificate and unencrypted " "private key in PEM format. If unset, the file pointed to by the " @@ -6562,12 +6563,12 @@ msgstr "" #. * of binary packages should of course change the default to #. * suit their systems. #. * TODO: If the file name is relative, look in elinks_home? -#: src/network/ssl/ssl.c:259 +#: src/network/ssl/ssl.c:263 #, fuzzy msgid "Trusted CA file" msgstr "Lagi transfer" -#: src/network/ssl/ssl.c:266 +#: src/network/ssl/ssl.c:270 msgid "" "The location of a file containing certificates of trusted certification " "authorities in PEM format. ELinks then trusts certificates issued by these " @@ -6578,11 +6579,11 @@ msgid "" msgstr "" #. name: -#: src/network/ssl/ssl.c:306 src/network/ssl/ssl.c:323 +#: src/network/ssl/ssl.c:310 src/network/ssl/ssl.c:327 msgid "SSL" msgstr "" -#: src/network/ssl/ssl.c:308 +#: src/network/ssl/ssl.c:312 #, fuzzy msgid "SSL options." msgstr "~Simpan opsi" @@ -7523,7 +7524,7 @@ msgstr "" msgid "Information about the torrent" msgstr "Download ima~ge" -#: src/protocol/bittorrent/dialogs.c:782 src/session/download.c:1553 +#: src/protocol/bittorrent/dialogs.c:782 src/session/download.c:1571 msgid "What to do?" msgstr "Apa yang harus dilakukan?" @@ -7534,40 +7535,40 @@ msgid "Down~load" msgstr "Download" #. accelerator_context(src/protocol/bittorrent/dialogs.c:bittorrent_query_callback, src/session/download.c:do_type_query) -#: src/protocol/bittorrent/dialogs.c:810 src/session/download.c:1656 +#: src/protocol/bittorrent/dialogs.c:810 src/session/download.c:1674 #, fuzzy msgid "~Display" msgstr "Tampilkan" #. accelerator_context(src/protocol/bittorrent/dialogs.c:bittorrent_query_callback, src/session/download.c:do_type_query) -#: src/protocol/bittorrent/dialogs.c:814 src/session/download.c:1660 +#: src/protocol/bittorrent/dialogs.c:814 src/session/download.c:1678 msgid "Show ~header" msgstr "" -#: src/protocol/file/cgi.c:40 +#: src/protocol/file/cgi.c:41 #, fuzzy msgid "Local CGI" msgstr "file" -#: src/protocol/file/cgi.c:42 +#: src/protocol/file/cgi.c:43 #, fuzzy msgid "Local CGI specific options." msgstr "Ngga ada program yang dispesifikasikan untuk" -#: src/protocol/file/cgi.c:46 +#: src/protocol/file/cgi.c:47 msgid "Colon separated list of directories, where CGI scripts are stored." msgstr "" -#: src/protocol/file/cgi.c:49 +#: src/protocol/file/cgi.c:50 msgid "Allow local CGI" msgstr "" -#: src/protocol/file/cgi.c:51 +#: src/protocol/file/cgi.c:52 msgid "Whether to execute local CGI scripts." msgstr "" #. name: -#: src/protocol/file/cgi.c:56 +#: src/protocol/file/cgi.c:57 msgid "CGI" msgstr "" @@ -8075,7 +8076,7 @@ msgid "" msgstr "" #. name: -#: src/protocol/rewrite/rewrite.c:360 +#: src/protocol/rewrite/rewrite.c:348 msgid "URI rewrite" msgstr "" @@ -8259,37 +8260,37 @@ msgstr "" msgid "~Resume download of the original file" msgstr "" -#: src/session/download.c:1556 +#: src/session/download.c:1574 msgid "Unknown type" msgstr "Tipe ngga dikenal" -#: src/session/download.c:1581 +#: src/session/download.c:1599 #, c-format msgid "What would you like to do with the file '%s' (type: %s%s%s)?" msgstr "" -#: src/session/download.c:1584 +#: src/session/download.c:1602 #, c-format msgid "What would you like to do with the file (type: %s%s%s)?" msgstr "" -#: src/session/download.c:1612 +#: src/session/download.c:1630 #, no-c-format msgid "Program ('%' will be replaced by the filename)" msgstr "" -#: src/session/download.c:1616 +#: src/session/download.c:1634 #, fuzzy msgid "Block the terminal" msgstr "Terminal a la ~BeOS" -#: src/session/download.c:1622 +#: src/session/download.c:1640 #, c-format msgid "The file will be opened with the program '%s'." msgstr "" #. accelerator_context(src/session/download.c:do_type_query) -#: src/session/download.c:1643 +#: src/session/download.c:1661 #, fuzzy msgid "~Open" msgstr "Buka" diff --git a/po/is.po b/po/is.po index 943ee474..c0244497 100644 --- a/po/is.po +++ b/po/is.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: ELinks 0.5pre0.CVS\n" "Report-Msgid-Bugs-To: elinks-users@linuxfromscratch.org\n" -"POT-Creation-Date: 2020-06-26 19:00+0200\n" +"POT-Creation-Date: 2020-07-26 15:28+0200\n" "PO-Revision-Date: 2003-01-03 03:41+0100\n" "Last-Translator: Armon Red \n" "Language-Team: Icelandic \n" @@ -186,7 +186,7 @@ msgstr "Tómur strengur óheimill" #: src/dialogs/options.c:244 src/dialogs/options.c:323 src/mime/dialogs.c:133 #: src/protocol/auth/dialogs.c:160 src/protocol/bittorrent/dialogs.c:820 #: src/scripting/lua/core.c:402 src/scripting/lua/core.c:483 -#: src/session/download.c:840 src/session/download.c:1666 +#: src/session/download.c:840 src/session/download.c:1684 #: src/viewer/text/search.c:1937 #, fuzzy msgid "~Cancel" @@ -205,7 +205,7 @@ msgstr "" #: src/config/options.inc:1343 src/ecmascript/ecmascript.c:44 #: src/globhist/globhist.c:64 src/mime/backend/mailcap.c:93 #: src/mime/backend/mimetypes.c:52 src/network/ssl/ssl.c:129 -#: src/network/ssl/ssl.c:278 +#: src/network/ssl/ssl.c:282 #, fuzzy msgid "Enable" msgstr "nafn" @@ -1996,7 +1996,7 @@ msgstr "" #. accelerator_context(src/config/dialogs.c:keybinding_buttons, src/config/dialogs.c:option_buttons, src/cookies/dialogs.c:cookie_buttons, src/formhist/dialogs.c:formhist_buttons, src/protocol/bittorrent/dialogs.c:bittorrent_query_callback, src/session/download.c:do_type_query, terminal_options) #: src/config/dialogs.c:505 src/config/dialogs.c:933 src/cookies/dialogs.c:543 #: src/dialogs/options.c:243 src/formhist/dialogs.c:214 -#: src/protocol/bittorrent/dialogs.c:807 src/session/download.c:1650 +#: src/protocol/bittorrent/dialogs.c:807 src/session/download.c:1668 #, fuzzy msgid "Sa~ve" msgstr "Vista" @@ -4575,7 +4575,7 @@ msgid "Domain" msgstr "~Uppl. skjals" #: src/cookies/dialogs.c:41 src/mime/backend/mailcap.c:97 -#: src/mime/backend/mimetypes.c:56 src/protocol/file/cgi.c:44 +#: src/mime/backend/mimetypes.c:56 src/protocol/file/cgi.c:45 msgid "Path" msgstr "" @@ -6343,26 +6343,27 @@ msgstr "Ekkert forrit" #: src/mime/backend/default.c:76 #, no-c-format msgid "" -"External viewer for this file type. '%' in this string will be substituted " -"by a file name. Do _not_ put single- or double-quotes around the % sign." +"External viewer for this file type. '%f' in this string will be substituted " +"by a file name, '%u' by its uri. Do _not_ put single- or double-quotes " +"around the % sign." msgstr "" -#: src/mime/backend/default.c:81 +#: src/mime/backend/default.c:82 #, fuzzy msgid "File extension associations" msgstr "Skráar~endingar" -#: src/mime/backend/default.c:83 +#: src/mime/backend/default.c:84 msgid "Extension <-> MIME type association." msgstr "" -#: src/mime/backend/default.c:87 +#: src/mime/backend/default.c:88 msgid "" "MIME-type matching this file extension ('*' is used here in place of '.')." msgstr "" #. name: -#: src/mime/backend/default.c:219 +#: src/mime/backend/default.c:220 msgid "Option system" msgstr "" @@ -6492,24 +6493,24 @@ msgid "" "configuration of OpenSSL by the user." msgstr "" -#: src/network/ssl/ssl.c:121 +#: src/network/ssl/ssl.c:121 src/network/ssl/ssl.c:251 msgid "Use HTTPS by default" msgstr "" -#: src/network/ssl/ssl.c:123 +#: src/network/ssl/ssl.c:123 src/network/ssl/ssl.c:253 msgid "Use HTTPS when a URL scheme is not provided." msgstr "" -#: src/network/ssl/ssl.c:125 src/network/ssl/ssl.c:274 +#: src/network/ssl/ssl.c:125 src/network/ssl/ssl.c:278 msgid "Client Certificates" msgstr "" -#: src/network/ssl/ssl.c:127 src/network/ssl/ssl.c:276 +#: src/network/ssl/ssl.c:127 src/network/ssl/ssl.c:280 #, fuzzy msgid "X509 client certificate options." msgstr "Stillingar skeljar" -#: src/network/ssl/ssl.c:131 src/network/ssl/ssl.c:280 +#: src/network/ssl/ssl.c:131 src/network/ssl/ssl.c:284 msgid "" "Enable or not the sending of X509 client certificates to servers which " "request them." @@ -6533,12 +6534,12 @@ msgid "" "The database can be also shared with Mozilla browsers." msgstr "" -#: src/network/ssl/ssl.c:149 src/network/ssl/ssl.c:283 +#: src/network/ssl/ssl.c:149 src/network/ssl/ssl.c:287 #, fuzzy msgid "Certificate File" msgstr "metinn tími" -#: src/network/ssl/ssl.c:151 src/network/ssl/ssl.c:285 +#: src/network/ssl/ssl.c:151 src/network/ssl/ssl.c:289 msgid "" "The location of a file containing the client certificate and unencrypted " "private key in PEM format. If unset, the file pointed to by the " @@ -6559,12 +6560,12 @@ msgstr "" #. * of binary packages should of course change the default to #. * suit their systems. #. * TODO: If the file name is relative, look in elinks_home? -#: src/network/ssl/ssl.c:259 +#: src/network/ssl/ssl.c:263 #, fuzzy msgid "Trusted CA file" msgstr "Flyt gögn" -#: src/network/ssl/ssl.c:266 +#: src/network/ssl/ssl.c:270 msgid "" "The location of a file containing certificates of trusted certification " "authorities in PEM format. ELinks then trusts certificates issued by these " @@ -6575,11 +6576,11 @@ msgid "" msgstr "" #. name: -#: src/network/ssl/ssl.c:306 src/network/ssl/ssl.c:323 +#: src/network/ssl/ssl.c:310 src/network/ssl/ssl.c:327 msgid "SSL" msgstr "" -#: src/network/ssl/ssl.c:308 +#: src/network/ssl/ssl.c:312 #, fuzzy msgid "SSL options." msgstr "V~ista stillingar" @@ -7519,7 +7520,7 @@ msgstr "" msgid "Information about the torrent" msgstr "Hlaða niður ~mynd" -#: src/protocol/bittorrent/dialogs.c:782 src/session/download.c:1553 +#: src/protocol/bittorrent/dialogs.c:782 src/session/download.c:1571 msgid "What to do?" msgstr "Hvað skal gera?" @@ -7530,40 +7531,40 @@ msgid "Down~load" msgstr "Niðurhlaða" #. accelerator_context(src/protocol/bittorrent/dialogs.c:bittorrent_query_callback, src/session/download.c:do_type_query) -#: src/protocol/bittorrent/dialogs.c:810 src/session/download.c:1656 +#: src/protocol/bittorrent/dialogs.c:810 src/session/download.c:1674 #, fuzzy msgid "~Display" msgstr "Sjá" #. accelerator_context(src/protocol/bittorrent/dialogs.c:bittorrent_query_callback, src/session/download.c:do_type_query) -#: src/protocol/bittorrent/dialogs.c:814 src/session/download.c:1660 +#: src/protocol/bittorrent/dialogs.c:814 src/session/download.c:1678 msgid "Show ~header" msgstr "" -#: src/protocol/file/cgi.c:40 +#: src/protocol/file/cgi.c:41 #, fuzzy msgid "Local CGI" msgstr "skrár" -#: src/protocol/file/cgi.c:42 +#: src/protocol/file/cgi.c:43 #, fuzzy msgid "Local CGI specific options." msgstr "Ekkert forrit skilgreint fyrir" -#: src/protocol/file/cgi.c:46 +#: src/protocol/file/cgi.c:47 msgid "Colon separated list of directories, where CGI scripts are stored." msgstr "" -#: src/protocol/file/cgi.c:49 +#: src/protocol/file/cgi.c:50 msgid "Allow local CGI" msgstr "" -#: src/protocol/file/cgi.c:51 +#: src/protocol/file/cgi.c:52 msgid "Whether to execute local CGI scripts." msgstr "" #. name: -#: src/protocol/file/cgi.c:56 +#: src/protocol/file/cgi.c:57 msgid "CGI" msgstr "" @@ -8071,7 +8072,7 @@ msgid "" msgstr "" #. name: -#: src/protocol/rewrite/rewrite.c:360 +#: src/protocol/rewrite/rewrite.c:348 msgid "URI rewrite" msgstr "" @@ -8255,37 +8256,37 @@ msgstr "" msgid "~Resume download of the original file" msgstr "" -#: src/session/download.c:1556 +#: src/session/download.c:1574 msgid "Unknown type" msgstr "Óþekkt gerð" -#: src/session/download.c:1581 +#: src/session/download.c:1599 #, c-format msgid "What would you like to do with the file '%s' (type: %s%s%s)?" msgstr "" -#: src/session/download.c:1584 +#: src/session/download.c:1602 #, c-format msgid "What would you like to do with the file (type: %s%s%s)?" msgstr "" -#: src/session/download.c:1612 +#: src/session/download.c:1630 #, no-c-format msgid "Program ('%' will be replaced by the filename)" msgstr "" -#: src/session/download.c:1616 +#: src/session/download.c:1634 #, fuzzy msgid "Block the terminal" msgstr "~BeOS skel" -#: src/session/download.c:1622 +#: src/session/download.c:1640 #, c-format msgid "The file will be opened with the program '%s'." msgstr "" #. accelerator_context(src/session/download.c:do_type_query) -#: src/session/download.c:1643 +#: src/session/download.c:1661 #, fuzzy msgid "~Open" msgstr "Opna" diff --git a/po/it.po b/po/it.po index 63646976..38e7f6ca 100644 --- a/po/it.po +++ b/po/it.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: ELinks 0.5pre0.CVS\n" "Report-Msgid-Bugs-To: elinks-users@linuxfromscratch.org\n" -"POT-Creation-Date: 2020-06-26 19:00+0200\n" +"POT-Creation-Date: 2020-07-26 15:28+0200\n" "PO-Revision-Date: 2003-07-21 00:32+0200\n" "Last-Translator: Fabio Bonelli \n" "Language-Team: Italian \n" @@ -184,7 +184,7 @@ msgstr "Stringa vuota non consentita" #: src/dialogs/options.c:244 src/dialogs/options.c:323 src/mime/dialogs.c:133 #: src/protocol/auth/dialogs.c:160 src/protocol/bittorrent/dialogs.c:820 #: src/scripting/lua/core.c:402 src/scripting/lua/core.c:483 -#: src/session/download.c:840 src/session/download.c:1666 +#: src/session/download.c:840 src/session/download.c:1684 #: src/viewer/text/search.c:1937 #, fuzzy msgid "~Cancel" @@ -204,7 +204,7 @@ msgstr "Colori titolo finestra di dialogo." #: src/config/options.inc:1343 src/ecmascript/ecmascript.c:44 #: src/globhist/globhist.c:64 src/mime/backend/mailcap.c:93 #: src/mime/backend/mimetypes.c:52 src/network/ssl/ssl.c:129 -#: src/network/ssl/ssl.c:278 +#: src/network/ssl/ssl.c:282 msgid "Enable" msgstr "Abilita" @@ -2085,7 +2085,7 @@ msgstr "Non si può aggiungere un'opzione qui." #. accelerator_context(src/config/dialogs.c:keybinding_buttons, src/config/dialogs.c:option_buttons, src/cookies/dialogs.c:cookie_buttons, src/formhist/dialogs.c:formhist_buttons, src/protocol/bittorrent/dialogs.c:bittorrent_query_callback, src/session/download.c:do_type_query, terminal_options) #: src/config/dialogs.c:505 src/config/dialogs.c:933 src/cookies/dialogs.c:543 #: src/dialogs/options.c:243 src/formhist/dialogs.c:214 -#: src/protocol/bittorrent/dialogs.c:807 src/session/download.c:1650 +#: src/protocol/bittorrent/dialogs.c:807 src/session/download.c:1668 #, fuzzy msgid "Sa~ve" msgstr "Salva" @@ -4962,7 +4962,7 @@ msgid "Domain" msgstr "Dominio" #: src/cookies/dialogs.c:41 src/mime/backend/mailcap.c:97 -#: src/mime/backend/mimetypes.c:56 src/protocol/file/cgi.c:44 +#: src/mime/backend/mimetypes.c:56 src/protocol/file/cgi.c:45 msgid "Path" msgstr "Percorso" @@ -6727,21 +6727,22 @@ msgstr "Programma" #: src/mime/backend/default.c:76 #, fuzzy, no-c-format msgid "" -"External viewer for this file type. '%' in this string will be substituted " -"by a file name. Do _not_ put single- or double-quotes around the % sign." +"External viewer for this file type. '%f' in this string will be substituted " +"by a file name, '%u' by its uri. Do _not_ put single- or double-quotes " +"around the % sign." msgstr "" "Visualizzatore esterno per questo tipo di file. In questa stringa '%'\n" "sarà sostituito dal nome del file." -#: src/mime/backend/default.c:81 +#: src/mime/backend/default.c:82 msgid "File extension associations" msgstr "Associazioni estensioni file" -#: src/mime/backend/default.c:83 +#: src/mime/backend/default.c:84 msgid "Extension <-> MIME type association." msgstr "Associazione Estensione <-> Tipo MIME." -#: src/mime/backend/default.c:87 +#: src/mime/backend/default.c:88 #, fuzzy msgid "" "MIME-type matching this file extension ('*' is used here in place of '.')." @@ -6750,7 +6751,7 @@ msgstr "" "al posto di '.')." #. name: -#: src/mime/backend/default.c:219 +#: src/mime/backend/default.c:220 msgid "Option system" msgstr "Sistema di configurazione" @@ -6906,23 +6907,23 @@ msgstr "" "Verifica il certificato SSL del peer. Si noti per questo\n" "serve una configurazione ulteriore di OpenSSL dall'utente." -#: src/network/ssl/ssl.c:121 +#: src/network/ssl/ssl.c:121 src/network/ssl/ssl.c:251 msgid "Use HTTPS by default" msgstr "" -#: src/network/ssl/ssl.c:123 +#: src/network/ssl/ssl.c:123 src/network/ssl/ssl.c:253 msgid "Use HTTPS when a URL scheme is not provided." msgstr "" -#: src/network/ssl/ssl.c:125 src/network/ssl/ssl.c:274 +#: src/network/ssl/ssl.c:125 src/network/ssl/ssl.c:278 msgid "Client Certificates" msgstr "Certificati del client" -#: src/network/ssl/ssl.c:127 src/network/ssl/ssl.c:276 +#: src/network/ssl/ssl.c:127 src/network/ssl/ssl.c:280 msgid "X509 client certificate options." msgstr "Opzioni certificati X509 del client." -#: src/network/ssl/ssl.c:131 src/network/ssl/ssl.c:280 +#: src/network/ssl/ssl.c:131 src/network/ssl/ssl.c:284 #, fuzzy msgid "" "Enable or not the sending of X509 client certificates to servers which " @@ -6949,11 +6950,11 @@ msgid "" "The database can be also shared with Mozilla browsers." msgstr "" -#: src/network/ssl/ssl.c:149 src/network/ssl/ssl.c:283 +#: src/network/ssl/ssl.c:149 src/network/ssl/ssl.c:287 msgid "Certificate File" msgstr "File di certificato" -#: src/network/ssl/ssl.c:151 src/network/ssl/ssl.c:285 +#: src/network/ssl/ssl.c:151 src/network/ssl/ssl.c:289 #, fuzzy msgid "" "The location of a file containing the client certificate and unencrypted " @@ -6981,12 +6982,12 @@ msgstr "" #. * of binary packages should of course change the default to #. * suit their systems. #. * TODO: If the file name is relative, look in elinks_home? -#: src/network/ssl/ssl.c:259 +#: src/network/ssl/ssl.c:263 #, fuzzy msgid "Trusted CA file" msgstr "Trasferimento" -#: src/network/ssl/ssl.c:266 +#: src/network/ssl/ssl.c:270 msgid "" "The location of a file containing certificates of trusted certification " "authorities in PEM format. ELinks then trusts certificates issued by these " @@ -6997,11 +6998,11 @@ msgid "" msgstr "" #. name: -#: src/network/ssl/ssl.c:306 src/network/ssl/ssl.c:323 +#: src/network/ssl/ssl.c:310 src/network/ssl/ssl.c:327 msgid "SSL" msgstr "SSL" -#: src/network/ssl/ssl.c:308 +#: src/network/ssl/ssl.c:312 msgid "SSL options." msgstr "Opzioni SSL." @@ -7956,7 +7957,7 @@ msgstr "Vuoi mostrare il file '%s' (tipo: %s)?" msgid "Information about the torrent" msgstr "Mostra informazioni sulla pagina corrente" -#: src/protocol/bittorrent/dialogs.c:782 src/session/download.c:1553 +#: src/protocol/bittorrent/dialogs.c:782 src/session/download.c:1571 msgid "What to do?" msgstr "Cosa fare?" @@ -7967,40 +7968,40 @@ msgid "Down~load" msgstr "Download" #. accelerator_context(src/protocol/bittorrent/dialogs.c:bittorrent_query_callback, src/session/download.c:do_type_query) -#: src/protocol/bittorrent/dialogs.c:810 src/session/download.c:1656 +#: src/protocol/bittorrent/dialogs.c:810 src/session/download.c:1674 #, fuzzy msgid "~Display" msgstr "Visualizza" #. accelerator_context(src/protocol/bittorrent/dialogs.c:bittorrent_query_callback, src/session/download.c:do_type_query) -#: src/protocol/bittorrent/dialogs.c:814 src/session/download.c:1660 +#: src/protocol/bittorrent/dialogs.c:814 src/session/download.c:1678 #, fuzzy msgid "Show ~header" msgstr "Mostra template" -#: src/protocol/file/cgi.c:40 +#: src/protocol/file/cgi.c:41 msgid "Local CGI" msgstr "CGI locali" -#: src/protocol/file/cgi.c:42 +#: src/protocol/file/cgi.c:43 msgid "Local CGI specific options." msgstr "Opzioni specifiche dei CGI locali." -#: src/protocol/file/cgi.c:46 +#: src/protocol/file/cgi.c:47 msgid "Colon separated list of directories, where CGI scripts are stored." msgstr "" "Lista di directory separate da due punti nelle quali cercare gli script CGI." -#: src/protocol/file/cgi.c:49 +#: src/protocol/file/cgi.c:50 msgid "Allow local CGI" msgstr "Consenti CGI locali" -#: src/protocol/file/cgi.c:51 +#: src/protocol/file/cgi.c:52 msgid "Whether to execute local CGI scripts." msgstr "Abilita esecuzione degli script CGI locali." #. name: -#: src/protocol/file/cgi.c:56 +#: src/protocol/file/cgi.c:57 msgid "CGI" msgstr "" @@ -8588,7 +8589,7 @@ msgid "" msgstr "" #. name: -#: src/protocol/rewrite/rewrite.c:360 +#: src/protocol/rewrite/rewrite.c:348 msgid "URI rewrite" msgstr "Riscrittura URI" @@ -8802,37 +8803,37 @@ msgstr "Sovrascrivi il file originale" msgid "~Resume download of the original file" msgstr "Riprendi download del file originale" -#: src/session/download.c:1556 +#: src/session/download.c:1574 msgid "Unknown type" msgstr "Tipo sconosciuto" -#: src/session/download.c:1581 +#: src/session/download.c:1599 #, fuzzy, c-format msgid "What would you like to do with the file '%s' (type: %s%s%s)?" msgstr "Vuoi mostrare il file '%s' (tipo: %s)?" -#: src/session/download.c:1584 +#: src/session/download.c:1602 #, fuzzy, c-format msgid "What would you like to do with the file (type: %s%s%s)?" msgstr "Vuoi mostrare il file '%s' (tipo: %s)?" -#: src/session/download.c:1612 +#: src/session/download.c:1630 #, no-c-format msgid "Program ('%' will be replaced by the filename)" msgstr "" -#: src/session/download.c:1616 +#: src/session/download.c:1634 #, fuzzy msgid "Block the terminal" msgstr "Blocca terminale" -#: src/session/download.c:1622 +#: src/session/download.c:1640 #, c-format msgid "The file will be opened with the program '%s'." msgstr "" #. accelerator_context(src/session/download.c:do_type_query) -#: src/session/download.c:1643 +#: src/session/download.c:1661 #, fuzzy msgid "~Open" msgstr "Apri" diff --git a/po/ja.po b/po/ja.po index e2100dab..c6e003c1 100644 --- a/po/ja.po +++ b/po/ja.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: ELinks 0.12.GIT\n" "Report-Msgid-Bugs-To: elinks-users@linuxfromscratch.org\n" -"POT-Creation-Date: 2020-06-26 19:00+0200\n" +"POT-Creation-Date: 2020-07-26 15:28+0200\n" "PO-Revision-Date: 2016-01-15 17:28+0900\n" "Last-Translator: KURASAWA Nozomu \n" "Language-Team: JAPANESE\n" @@ -180,7 +180,7 @@ msgstr "" #: src/dialogs/options.c:244 src/dialogs/options.c:323 src/mime/dialogs.c:133 #: src/protocol/auth/dialogs.c:160 src/protocol/bittorrent/dialogs.c:820 #: src/scripting/lua/core.c:402 src/scripting/lua/core.c:483 -#: src/session/download.c:840 src/session/download.c:1666 +#: src/session/download.c:840 src/session/download.c:1684 #: src/viewer/text/search.c:1937 msgid "~Cancel" msgstr "キャンセル(~C)" @@ -197,7 +197,7 @@ msgstr "ステータスバーのデジタル時計です。" #: src/config/options.inc:1343 src/ecmascript/ecmascript.c:44 #: src/globhist/globhist.c:64 src/mime/backend/mailcap.c:93 #: src/mime/backend/mimetypes.c:52 src/network/ssl/ssl.c:129 -#: src/network/ssl/ssl.c:278 +#: src/network/ssl/ssl.c:282 msgid "Enable" msgstr "有効" @@ -1894,7 +1894,7 @@ msgstr "" #. accelerator_context(src/config/dialogs.c:keybinding_buttons, src/config/dialogs.c:option_buttons, src/cookies/dialogs.c:cookie_buttons, src/formhist/dialogs.c:formhist_buttons, src/protocol/bittorrent/dialogs.c:bittorrent_query_callback, src/session/download.c:do_type_query, terminal_options) #: src/config/dialogs.c:505 src/config/dialogs.c:933 src/cookies/dialogs.c:543 #: src/dialogs/options.c:243 src/formhist/dialogs.c:214 -#: src/protocol/bittorrent/dialogs.c:807 src/session/download.c:1650 +#: src/protocol/bittorrent/dialogs.c:807 src/session/download.c:1668 msgid "Sa~ve" msgstr "保存(~V)" @@ -4383,7 +4383,7 @@ msgid "Domain" msgstr "" #: src/cookies/dialogs.c:41 src/mime/backend/mailcap.c:97 -#: src/mime/backend/mimetypes.c:56 src/protocol/file/cgi.c:44 +#: src/mime/backend/mimetypes.c:56 src/protocol/file/cgi.c:45 msgid "Path" msgstr "" @@ -6028,25 +6028,26 @@ msgstr "" #: src/mime/backend/default.c:76 #, no-c-format msgid "" -"External viewer for this file type. '%' in this string will be substituted " -"by a file name. Do _not_ put single- or double-quotes around the % sign." +"External viewer for this file type. '%f' in this string will be substituted " +"by a file name, '%u' by its uri. Do _not_ put single- or double-quotes " +"around the % sign." msgstr "" -#: src/mime/backend/default.c:81 +#: src/mime/backend/default.c:82 msgid "File extension associations" msgstr "" -#: src/mime/backend/default.c:83 +#: src/mime/backend/default.c:84 msgid "Extension <-> MIME type association." msgstr "" -#: src/mime/backend/default.c:87 +#: src/mime/backend/default.c:88 msgid "" "MIME-type matching this file extension ('*' is used here in place of '.')." msgstr "" #. name: -#: src/mime/backend/default.c:219 +#: src/mime/backend/default.c:220 msgid "Option system" msgstr "" @@ -6176,23 +6177,23 @@ msgid "" "configuration of OpenSSL by the user." msgstr "" -#: src/network/ssl/ssl.c:121 +#: src/network/ssl/ssl.c:121 src/network/ssl/ssl.c:251 msgid "Use HTTPS by default" msgstr "" -#: src/network/ssl/ssl.c:123 +#: src/network/ssl/ssl.c:123 src/network/ssl/ssl.c:253 msgid "Use HTTPS when a URL scheme is not provided." msgstr "" -#: src/network/ssl/ssl.c:125 src/network/ssl/ssl.c:274 +#: src/network/ssl/ssl.c:125 src/network/ssl/ssl.c:278 msgid "Client Certificates" msgstr "" -#: src/network/ssl/ssl.c:127 src/network/ssl/ssl.c:276 +#: src/network/ssl/ssl.c:127 src/network/ssl/ssl.c:280 msgid "X509 client certificate options." msgstr "" -#: src/network/ssl/ssl.c:131 src/network/ssl/ssl.c:280 +#: src/network/ssl/ssl.c:131 src/network/ssl/ssl.c:284 msgid "" "Enable or not the sending of X509 client certificates to servers which " "request them." @@ -6215,11 +6216,11 @@ msgid "" "The database can be also shared with Mozilla browsers." msgstr "" -#: src/network/ssl/ssl.c:149 src/network/ssl/ssl.c:283 +#: src/network/ssl/ssl.c:149 src/network/ssl/ssl.c:287 msgid "Certificate File" msgstr "" -#: src/network/ssl/ssl.c:151 src/network/ssl/ssl.c:285 +#: src/network/ssl/ssl.c:151 src/network/ssl/ssl.c:289 msgid "" "The location of a file containing the client certificate and unencrypted " "private key in PEM format. If unset, the file pointed to by the " @@ -6240,11 +6241,11 @@ msgstr "" #. * of binary packages should of course change the default to #. * suit their systems. #. * TODO: If the file name is relative, look in elinks_home? -#: src/network/ssl/ssl.c:259 +#: src/network/ssl/ssl.c:263 msgid "Trusted CA file" msgstr "" -#: src/network/ssl/ssl.c:266 +#: src/network/ssl/ssl.c:270 msgid "" "The location of a file containing certificates of trusted certification " "authorities in PEM format. ELinks then trusts certificates issued by these " @@ -6255,11 +6256,11 @@ msgid "" msgstr "" #. name: -#: src/network/ssl/ssl.c:306 src/network/ssl/ssl.c:323 +#: src/network/ssl/ssl.c:310 src/network/ssl/ssl.c:327 msgid "SSL" msgstr "SSL" -#: src/network/ssl/ssl.c:308 +#: src/network/ssl/ssl.c:312 msgid "SSL options." msgstr "SSL のオプションです。" @@ -7139,7 +7140,7 @@ msgstr "" msgid "Information about the torrent" msgstr "" -#: src/protocol/bittorrent/dialogs.c:782 src/session/download.c:1553 +#: src/protocol/bittorrent/dialogs.c:782 src/session/download.c:1571 msgid "What to do?" msgstr "" @@ -7149,37 +7150,37 @@ msgid "Down~load" msgstr "" #. accelerator_context(src/protocol/bittorrent/dialogs.c:bittorrent_query_callback, src/session/download.c:do_type_query) -#: src/protocol/bittorrent/dialogs.c:810 src/session/download.c:1656 +#: src/protocol/bittorrent/dialogs.c:810 src/session/download.c:1674 msgid "~Display" msgstr "表示(~D)" #. accelerator_context(src/protocol/bittorrent/dialogs.c:bittorrent_query_callback, src/session/download.c:do_type_query) -#: src/protocol/bittorrent/dialogs.c:814 src/session/download.c:1660 +#: src/protocol/bittorrent/dialogs.c:814 src/session/download.c:1678 msgid "Show ~header" msgstr "" -#: src/protocol/file/cgi.c:40 +#: src/protocol/file/cgi.c:41 msgid "Local CGI" msgstr "" -#: src/protocol/file/cgi.c:42 +#: src/protocol/file/cgi.c:43 msgid "Local CGI specific options." msgstr "" -#: src/protocol/file/cgi.c:46 +#: src/protocol/file/cgi.c:47 msgid "Colon separated list of directories, where CGI scripts are stored." msgstr "" -#: src/protocol/file/cgi.c:49 +#: src/protocol/file/cgi.c:50 msgid "Allow local CGI" msgstr "" -#: src/protocol/file/cgi.c:51 +#: src/protocol/file/cgi.c:52 msgid "Whether to execute local CGI scripts." msgstr "" #. name: -#: src/protocol/file/cgi.c:56 +#: src/protocol/file/cgi.c:57 msgid "CGI" msgstr "CGI" @@ -7679,7 +7680,7 @@ msgid "" msgstr "" #. name: -#: src/protocol/rewrite/rewrite.c:360 +#: src/protocol/rewrite/rewrite.c:348 msgid "URI rewrite" msgstr "" @@ -7860,36 +7861,36 @@ msgstr "" msgid "~Resume download of the original file" msgstr "" -#: src/session/download.c:1556 +#: src/session/download.c:1574 msgid "Unknown type" msgstr "" -#: src/session/download.c:1581 +#: src/session/download.c:1599 #, c-format msgid "What would you like to do with the file '%s' (type: %s%s%s)?" msgstr "" -#: src/session/download.c:1584 +#: src/session/download.c:1602 #, c-format msgid "What would you like to do with the file (type: %s%s%s)?" msgstr "" -#: src/session/download.c:1612 +#: src/session/download.c:1630 #, no-c-format msgid "Program ('%' will be replaced by the filename)" msgstr "" -#: src/session/download.c:1616 +#: src/session/download.c:1634 msgid "Block the terminal" msgstr "" -#: src/session/download.c:1622 +#: src/session/download.c:1640 #, c-format msgid "The file will be opened with the program '%s'." msgstr "" #. accelerator_context(src/session/download.c:do_type_query) -#: src/session/download.c:1643 +#: src/session/download.c:1661 msgid "~Open" msgstr "開く(~O)" diff --git a/po/lt.po b/po/lt.po index 09471cd6..4e3370ee 100644 --- a/po/lt.po +++ b/po/lt.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: ELinks 0.5pre0.CVS\n" "Report-Msgid-Bugs-To: elinks-users@linuxfromscratch.org\n" -"POT-Creation-Date: 2020-06-26 19:00+0200\n" +"POT-Creation-Date: 2020-07-26 15:28+0200\n" "PO-Revision-Date: 2003-01-03 03:41+0100\n" "Last-Translator: Aurimas Mikalauskas \n" "Language-Team: Lithuanian \n" @@ -186,7 +186,7 @@ msgstr "Eilutė negali būti tuščia" #: src/dialogs/options.c:244 src/dialogs/options.c:323 src/mime/dialogs.c:133 #: src/protocol/auth/dialogs.c:160 src/protocol/bittorrent/dialogs.c:820 #: src/scripting/lua/core.c:402 src/scripting/lua/core.c:483 -#: src/session/download.c:840 src/session/download.c:1666 +#: src/session/download.c:840 src/session/download.c:1684 #: src/viewer/text/search.c:1937 #, fuzzy msgid "~Cancel" @@ -205,7 +205,7 @@ msgstr "" #: src/config/options.inc:1343 src/ecmascript/ecmascript.c:44 #: src/globhist/globhist.c:64 src/mime/backend/mailcap.c:93 #: src/mime/backend/mimetypes.c:52 src/network/ssl/ssl.c:129 -#: src/network/ssl/ssl.c:278 +#: src/network/ssl/ssl.c:282 #, fuzzy msgid "Enable" msgstr "vardas" @@ -1996,7 +1996,7 @@ msgstr "" #. accelerator_context(src/config/dialogs.c:keybinding_buttons, src/config/dialogs.c:option_buttons, src/cookies/dialogs.c:cookie_buttons, src/formhist/dialogs.c:formhist_buttons, src/protocol/bittorrent/dialogs.c:bittorrent_query_callback, src/session/download.c:do_type_query, terminal_options) #: src/config/dialogs.c:505 src/config/dialogs.c:933 src/cookies/dialogs.c:543 #: src/dialogs/options.c:243 src/formhist/dialogs.c:214 -#: src/protocol/bittorrent/dialogs.c:807 src/session/download.c:1650 +#: src/protocol/bittorrent/dialogs.c:807 src/session/download.c:1668 #, fuzzy msgid "Sa~ve" msgstr "Išsaugoti" @@ -4575,7 +4575,7 @@ msgid "Domain" msgstr "~Informacija apie dokumentą" #: src/cookies/dialogs.c:41 src/mime/backend/mailcap.c:97 -#: src/mime/backend/mimetypes.c:56 src/protocol/file/cgi.c:44 +#: src/mime/backend/mimetypes.c:56 src/protocol/file/cgi.c:45 msgid "Path" msgstr "" @@ -6342,26 +6342,27 @@ msgstr "Nėr programos" #: src/mime/backend/default.c:76 #, no-c-format msgid "" -"External viewer for this file type. '%' in this string will be substituted " -"by a file name. Do _not_ put single- or double-quotes around the % sign." +"External viewer for this file type. '%f' in this string will be substituted " +"by a file name, '%u' by its uri. Do _not_ put single- or double-quotes " +"around the % sign." msgstr "" -#: src/mime/backend/default.c:81 +#: src/mime/backend/default.c:82 #, fuzzy msgid "File extension associations" msgstr "Failų plėtiniai" -#: src/mime/backend/default.c:83 +#: src/mime/backend/default.c:84 msgid "Extension <-> MIME type association." msgstr "" -#: src/mime/backend/default.c:87 +#: src/mime/backend/default.c:88 msgid "" "MIME-type matching this file extension ('*' is used here in place of '.')." msgstr "" #. name: -#: src/mime/backend/default.c:219 +#: src/mime/backend/default.c:220 msgid "Option system" msgstr "" @@ -6491,24 +6492,24 @@ msgid "" "configuration of OpenSSL by the user." msgstr "" -#: src/network/ssl/ssl.c:121 +#: src/network/ssl/ssl.c:121 src/network/ssl/ssl.c:251 msgid "Use HTTPS by default" msgstr "" -#: src/network/ssl/ssl.c:123 +#: src/network/ssl/ssl.c:123 src/network/ssl/ssl.c:253 msgid "Use HTTPS when a URL scheme is not provided." msgstr "" -#: src/network/ssl/ssl.c:125 src/network/ssl/ssl.c:274 +#: src/network/ssl/ssl.c:125 src/network/ssl/ssl.c:278 msgid "Client Certificates" msgstr "" -#: src/network/ssl/ssl.c:127 src/network/ssl/ssl.c:276 +#: src/network/ssl/ssl.c:127 src/network/ssl/ssl.c:280 #, fuzzy msgid "X509 client certificate options." msgstr "Terminalo opcijos" -#: src/network/ssl/ssl.c:131 src/network/ssl/ssl.c:280 +#: src/network/ssl/ssl.c:131 src/network/ssl/ssl.c:284 msgid "" "Enable or not the sending of X509 client certificates to servers which " "request them." @@ -6532,12 +6533,12 @@ msgid "" "The database can be also shared with Mozilla browsers." msgstr "" -#: src/network/ssl/ssl.c:149 src/network/ssl/ssl.c:283 +#: src/network/ssl/ssl.c:149 src/network/ssl/ssl.c:287 #, fuzzy msgid "Certificate File" msgstr "numatytas laikas" -#: src/network/ssl/ssl.c:151 src/network/ssl/ssl.c:285 +#: src/network/ssl/ssl.c:151 src/network/ssl/ssl.c:289 msgid "" "The location of a file containing the client certificate and unencrypted " "private key in PEM format. If unset, the file pointed to by the " @@ -6558,12 +6559,12 @@ msgstr "" #. * of binary packages should of course change the default to #. * suit their systems. #. * TODO: If the file name is relative, look in elinks_home? -#: src/network/ssl/ssl.c:259 +#: src/network/ssl/ssl.c:263 #, fuzzy msgid "Trusted CA file" msgstr "Siunčiam" -#: src/network/ssl/ssl.c:266 +#: src/network/ssl/ssl.c:270 msgid "" "The location of a file containing certificates of trusted certification " "authorities in PEM format. ELinks then trusts certificates issued by these " @@ -6574,11 +6575,11 @@ msgid "" msgstr "" #. name: -#: src/network/ssl/ssl.c:306 src/network/ssl/ssl.c:323 +#: src/network/ssl/ssl.c:310 src/network/ssl/ssl.c:327 msgid "SSL" msgstr "" -#: src/network/ssl/ssl.c:308 +#: src/network/ssl/ssl.c:312 #, fuzzy msgid "SSL options." msgstr "Iš~saugoti pakeitimus" @@ -7518,7 +7519,7 @@ msgstr "" msgid "Information about the torrent" msgstr "Parsiųsti paveikslėlį" -#: src/protocol/bittorrent/dialogs.c:782 src/session/download.c:1553 +#: src/protocol/bittorrent/dialogs.c:782 src/session/download.c:1571 msgid "What to do?" msgstr "Ką daryti?" @@ -7529,40 +7530,40 @@ msgid "Down~load" msgstr "Parsisiųsk" #. accelerator_context(src/protocol/bittorrent/dialogs.c:bittorrent_query_callback, src/session/download.c:do_type_query) -#: src/protocol/bittorrent/dialogs.c:810 src/session/download.c:1656 +#: src/protocol/bittorrent/dialogs.c:810 src/session/download.c:1674 #, fuzzy msgid "~Display" msgstr "Parodyti" #. accelerator_context(src/protocol/bittorrent/dialogs.c:bittorrent_query_callback, src/session/download.c:do_type_query) -#: src/protocol/bittorrent/dialogs.c:814 src/session/download.c:1660 +#: src/protocol/bittorrent/dialogs.c:814 src/session/download.c:1678 msgid "Show ~header" msgstr "" -#: src/protocol/file/cgi.c:40 +#: src/protocol/file/cgi.c:41 #, fuzzy msgid "Local CGI" msgstr "failai" -#: src/protocol/file/cgi.c:42 +#: src/protocol/file/cgi.c:43 #, fuzzy msgid "Local CGI specific options." msgstr "Nėr programos" -#: src/protocol/file/cgi.c:46 +#: src/protocol/file/cgi.c:47 msgid "Colon separated list of directories, where CGI scripts are stored." msgstr "" -#: src/protocol/file/cgi.c:49 +#: src/protocol/file/cgi.c:50 msgid "Allow local CGI" msgstr "" -#: src/protocol/file/cgi.c:51 +#: src/protocol/file/cgi.c:52 msgid "Whether to execute local CGI scripts." msgstr "" #. name: -#: src/protocol/file/cgi.c:56 +#: src/protocol/file/cgi.c:57 msgid "CGI" msgstr "" @@ -8070,7 +8071,7 @@ msgid "" msgstr "" #. name: -#: src/protocol/rewrite/rewrite.c:360 +#: src/protocol/rewrite/rewrite.c:348 msgid "URI rewrite" msgstr "" @@ -8254,37 +8255,37 @@ msgstr "" msgid "~Resume download of the original file" msgstr "" -#: src/session/download.c:1556 +#: src/session/download.c:1574 msgid "Unknown type" msgstr "Nežinomas tipas" -#: src/session/download.c:1581 +#: src/session/download.c:1599 #, c-format msgid "What would you like to do with the file '%s' (type: %s%s%s)?" msgstr "" -#: src/session/download.c:1584 +#: src/session/download.c:1602 #, c-format msgid "What would you like to do with the file (type: %s%s%s)?" msgstr "" -#: src/session/download.c:1612 +#: src/session/download.c:1630 #, no-c-format msgid "Program ('%' will be replaced by the filename)" msgstr "" -#: src/session/download.c:1616 +#: src/session/download.c:1634 #, fuzzy msgid "Block the terminal" msgstr "~BeOS terminalas" -#: src/session/download.c:1622 +#: src/session/download.c:1640 #, c-format msgid "The file will be opened with the program '%s'." msgstr "" #. accelerator_context(src/session/download.c:do_type_query) -#: src/session/download.c:1643 +#: src/session/download.c:1661 #, fuzzy msgid "~Open" msgstr "Atidaryti" diff --git a/po/nb.po b/po/nb.po index 8b74a741..2da6a821 100644 --- a/po/nb.po +++ b/po/nb.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: ELinks 0.5pre0.CVS\n" "Report-Msgid-Bugs-To: elinks-users@linuxfromscratch.org\n" -"POT-Creation-Date: 2020-06-26 19:00+0200\n" +"POT-Creation-Date: 2020-07-26 15:28+0200\n" "PO-Revision-Date: 2003-01-03 03:41+0100\n" "Last-Translator: Simen Graaten \n" "Language-Team: Norwegian \n" @@ -186,7 +186,7 @@ msgstr "Tom tekststreng er ikke tillatt" #: src/dialogs/options.c:244 src/dialogs/options.c:323 src/mime/dialogs.c:133 #: src/protocol/auth/dialogs.c:160 src/protocol/bittorrent/dialogs.c:820 #: src/scripting/lua/core.c:402 src/scripting/lua/core.c:483 -#: src/session/download.c:840 src/session/download.c:1666 +#: src/session/download.c:840 src/session/download.c:1684 #: src/viewer/text/search.c:1937 #, fuzzy msgid "~Cancel" @@ -205,7 +205,7 @@ msgstr "" #: src/config/options.inc:1343 src/ecmascript/ecmascript.c:44 #: src/globhist/globhist.c:64 src/mime/backend/mailcap.c:93 #: src/mime/backend/mimetypes.c:52 src/network/ssl/ssl.c:129 -#: src/network/ssl/ssl.c:278 +#: src/network/ssl/ssl.c:282 #, fuzzy msgid "Enable" msgstr "Navn" @@ -1996,7 +1996,7 @@ msgstr "" #. accelerator_context(src/config/dialogs.c:keybinding_buttons, src/config/dialogs.c:option_buttons, src/cookies/dialogs.c:cookie_buttons, src/formhist/dialogs.c:formhist_buttons, src/protocol/bittorrent/dialogs.c:bittorrent_query_callback, src/session/download.c:do_type_query, terminal_options) #: src/config/dialogs.c:505 src/config/dialogs.c:933 src/cookies/dialogs.c:543 #: src/dialogs/options.c:243 src/formhist/dialogs.c:214 -#: src/protocol/bittorrent/dialogs.c:807 src/session/download.c:1650 +#: src/protocol/bittorrent/dialogs.c:807 src/session/download.c:1668 #, fuzzy msgid "Sa~ve" msgstr "Lagre" @@ -4576,7 +4576,7 @@ msgid "Domain" msgstr "Dokument-~informasjon" #: src/cookies/dialogs.c:41 src/mime/backend/mailcap.c:97 -#: src/mime/backend/mimetypes.c:56 src/protocol/file/cgi.c:44 +#: src/mime/backend/mimetypes.c:56 src/protocol/file/cgi.c:45 msgid "Path" msgstr "" @@ -6343,26 +6343,27 @@ msgstr "Ingen program" #: src/mime/backend/default.c:76 #, no-c-format msgid "" -"External viewer for this file type. '%' in this string will be substituted " -"by a file name. Do _not_ put single- or double-quotes around the % sign." +"External viewer for this file type. '%f' in this string will be substituted " +"by a file name, '%u' by its uri. Do _not_ put single- or double-quotes " +"around the % sign." msgstr "" -#: src/mime/backend/default.c:81 +#: src/mime/backend/default.c:82 #, fuzzy msgid "File extension associations" msgstr "Fil-~etternavn" -#: src/mime/backend/default.c:83 +#: src/mime/backend/default.c:84 msgid "Extension <-> MIME type association." msgstr "" -#: src/mime/backend/default.c:87 +#: src/mime/backend/default.c:88 msgid "" "MIME-type matching this file extension ('*' is used here in place of '.')." msgstr "" #. name: -#: src/mime/backend/default.c:219 +#: src/mime/backend/default.c:220 msgid "Option system" msgstr "" @@ -6492,24 +6493,24 @@ msgid "" "configuration of OpenSSL by the user." msgstr "" -#: src/network/ssl/ssl.c:121 +#: src/network/ssl/ssl.c:121 src/network/ssl/ssl.c:251 msgid "Use HTTPS by default" msgstr "" -#: src/network/ssl/ssl.c:123 +#: src/network/ssl/ssl.c:123 src/network/ssl/ssl.c:253 msgid "Use HTTPS when a URL scheme is not provided." msgstr "" -#: src/network/ssl/ssl.c:125 src/network/ssl/ssl.c:274 +#: src/network/ssl/ssl.c:125 src/network/ssl/ssl.c:278 msgid "Client Certificates" msgstr "" -#: src/network/ssl/ssl.c:127 src/network/ssl/ssl.c:276 +#: src/network/ssl/ssl.c:127 src/network/ssl/ssl.c:280 #, fuzzy msgid "X509 client certificate options." msgstr "Terminal-innstillinger" -#: src/network/ssl/ssl.c:131 src/network/ssl/ssl.c:280 +#: src/network/ssl/ssl.c:131 src/network/ssl/ssl.c:284 msgid "" "Enable or not the sending of X509 client certificates to servers which " "request them." @@ -6533,12 +6534,12 @@ msgid "" "The database can be also shared with Mozilla browsers." msgstr "" -#: src/network/ssl/ssl.c:149 src/network/ssl/ssl.c:283 +#: src/network/ssl/ssl.c:149 src/network/ssl/ssl.c:287 #, fuzzy msgid "Certificate File" msgstr "beregnet tid" -#: src/network/ssl/ssl.c:151 src/network/ssl/ssl.c:285 +#: src/network/ssl/ssl.c:151 src/network/ssl/ssl.c:289 msgid "" "The location of a file containing the client certificate and unencrypted " "private key in PEM format. If unset, the file pointed to by the " @@ -6559,12 +6560,12 @@ msgstr "" #. * of binary packages should of course change the default to #. * suit their systems. #. * TODO: If the file name is relative, look in elinks_home? -#: src/network/ssl/ssl.c:259 +#: src/network/ssl/ssl.c:263 #, fuzzy msgid "Trusted CA file" msgstr "Overfører" -#: src/network/ssl/ssl.c:266 +#: src/network/ssl/ssl.c:270 msgid "" "The location of a file containing certificates of trusted certification " "authorities in PEM format. ELinks then trusts certificates issued by these " @@ -6575,11 +6576,11 @@ msgid "" msgstr "" #. name: -#: src/network/ssl/ssl.c:306 src/network/ssl/ssl.c:323 +#: src/network/ssl/ssl.c:310 src/network/ssl/ssl.c:327 msgid "SSL" msgstr "" -#: src/network/ssl/ssl.c:308 +#: src/network/ssl/ssl.c:312 #, fuzzy msgid "SSL options." msgstr "Lagre inn~stillinger" @@ -7519,7 +7520,7 @@ msgstr "" msgid "Information about the torrent" msgstr "Hent bilde" -#: src/protocol/bittorrent/dialogs.c:782 src/session/download.c:1553 +#: src/protocol/bittorrent/dialogs.c:782 src/session/download.c:1571 msgid "What to do?" msgstr "Hva skal jeg gjøre?" @@ -7530,40 +7531,40 @@ msgid "Down~load" msgstr "Last ned" #. accelerator_context(src/protocol/bittorrent/dialogs.c:bittorrent_query_callback, src/session/download.c:do_type_query) -#: src/protocol/bittorrent/dialogs.c:810 src/session/download.c:1656 +#: src/protocol/bittorrent/dialogs.c:810 src/session/download.c:1674 #, fuzzy msgid "~Display" msgstr "Vis" #. accelerator_context(src/protocol/bittorrent/dialogs.c:bittorrent_query_callback, src/session/download.c:do_type_query) -#: src/protocol/bittorrent/dialogs.c:814 src/session/download.c:1660 +#: src/protocol/bittorrent/dialogs.c:814 src/session/download.c:1678 msgid "Show ~header" msgstr "" -#: src/protocol/file/cgi.c:40 +#: src/protocol/file/cgi.c:41 #, fuzzy msgid "Local CGI" msgstr "filer" -#: src/protocol/file/cgi.c:42 +#: src/protocol/file/cgi.c:43 #, fuzzy msgid "Local CGI specific options." msgstr "Ingen program er tilordnet" -#: src/protocol/file/cgi.c:46 +#: src/protocol/file/cgi.c:47 msgid "Colon separated list of directories, where CGI scripts are stored." msgstr "" -#: src/protocol/file/cgi.c:49 +#: src/protocol/file/cgi.c:50 msgid "Allow local CGI" msgstr "" -#: src/protocol/file/cgi.c:51 +#: src/protocol/file/cgi.c:52 msgid "Whether to execute local CGI scripts." msgstr "" #. name: -#: src/protocol/file/cgi.c:56 +#: src/protocol/file/cgi.c:57 msgid "CGI" msgstr "" @@ -8071,7 +8072,7 @@ msgid "" msgstr "" #. name: -#: src/protocol/rewrite/rewrite.c:360 +#: src/protocol/rewrite/rewrite.c:348 msgid "URI rewrite" msgstr "" @@ -8255,37 +8256,37 @@ msgstr "" msgid "~Resume download of the original file" msgstr "" -#: src/session/download.c:1556 +#: src/session/download.c:1574 msgid "Unknown type" msgstr "Ukjent type" -#: src/session/download.c:1581 +#: src/session/download.c:1599 #, c-format msgid "What would you like to do with the file '%s' (type: %s%s%s)?" msgstr "" -#: src/session/download.c:1584 +#: src/session/download.c:1602 #, c-format msgid "What would you like to do with the file (type: %s%s%s)?" msgstr "" -#: src/session/download.c:1612 +#: src/session/download.c:1630 #, no-c-format msgid "Program ('%' will be replaced by the filename)" msgstr "" -#: src/session/download.c:1616 +#: src/session/download.c:1634 #, fuzzy msgid "Block the terminal" msgstr "~BeOS-terminal" -#: src/session/download.c:1622 +#: src/session/download.c:1640 #, c-format msgid "The file will be opened with the program '%s'." msgstr "" #. accelerator_context(src/session/download.c:do_type_query) -#: src/session/download.c:1643 +#: src/session/download.c:1661 #, fuzzy msgid "~Open" msgstr "Åpne" diff --git a/po/nl.po b/po/nl.po index bb765b7b..f1ab188b 100644 --- a/po/nl.po +++ b/po/nl.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: ELinks 0.5pre0.CVS\n" "Report-Msgid-Bugs-To: elinks-users@linuxfromscratch.org\n" -"POT-Creation-Date: 2020-06-26 19:00+0200\n" +"POT-Creation-Date: 2020-07-26 15:28+0200\n" "PO-Revision-Date: 2003-01-03 03:41+0100\n" "Last-Translator: Stefan de Groot \n" "Language-Team: Dutch \n" @@ -186,7 +186,7 @@ msgstr "Lege string niet toegestaan" #: src/dialogs/options.c:244 src/dialogs/options.c:323 src/mime/dialogs.c:133 #: src/protocol/auth/dialogs.c:160 src/protocol/bittorrent/dialogs.c:820 #: src/scripting/lua/core.c:402 src/scripting/lua/core.c:483 -#: src/session/download.c:840 src/session/download.c:1666 +#: src/session/download.c:840 src/session/download.c:1684 #: src/viewer/text/search.c:1937 #, fuzzy msgid "~Cancel" @@ -205,7 +205,7 @@ msgstr "" #: src/config/options.inc:1343 src/ecmascript/ecmascript.c:44 #: src/globhist/globhist.c:64 src/mime/backend/mailcap.c:93 #: src/mime/backend/mimetypes.c:52 src/network/ssl/ssl.c:129 -#: src/network/ssl/ssl.c:278 +#: src/network/ssl/ssl.c:282 #, fuzzy msgid "Enable" msgstr "naam" @@ -1996,7 +1996,7 @@ msgstr "" #. accelerator_context(src/config/dialogs.c:keybinding_buttons, src/config/dialogs.c:option_buttons, src/cookies/dialogs.c:cookie_buttons, src/formhist/dialogs.c:formhist_buttons, src/protocol/bittorrent/dialogs.c:bittorrent_query_callback, src/session/download.c:do_type_query, terminal_options) #: src/config/dialogs.c:505 src/config/dialogs.c:933 src/cookies/dialogs.c:543 #: src/dialogs/options.c:243 src/formhist/dialogs.c:214 -#: src/protocol/bittorrent/dialogs.c:807 src/session/download.c:1650 +#: src/protocol/bittorrent/dialogs.c:807 src/session/download.c:1668 #, fuzzy msgid "Sa~ve" msgstr "Opslaan" @@ -4576,7 +4576,7 @@ msgid "Domain" msgstr "Document ~info" #: src/cookies/dialogs.c:41 src/mime/backend/mailcap.c:97 -#: src/mime/backend/mimetypes.c:56 src/protocol/file/cgi.c:44 +#: src/mime/backend/mimetypes.c:56 src/protocol/file/cgi.c:45 msgid "Path" msgstr "" @@ -6344,26 +6344,27 @@ msgstr "Geen programma" #: src/mime/backend/default.c:76 #, no-c-format msgid "" -"External viewer for this file type. '%' in this string will be substituted " -"by a file name. Do _not_ put single- or double-quotes around the % sign." +"External viewer for this file type. '%f' in this string will be substituted " +"by a file name, '%u' by its uri. Do _not_ put single- or double-quotes " +"around the % sign." msgstr "" -#: src/mime/backend/default.c:81 +#: src/mime/backend/default.c:82 #, fuzzy msgid "File extension associations" msgstr "Bestands ~extensie" -#: src/mime/backend/default.c:83 +#: src/mime/backend/default.c:84 msgid "Extension <-> MIME type association." msgstr "" -#: src/mime/backend/default.c:87 +#: src/mime/backend/default.c:88 msgid "" "MIME-type matching this file extension ('*' is used here in place of '.')." msgstr "" #. name: -#: src/mime/backend/default.c:219 +#: src/mime/backend/default.c:220 msgid "Option system" msgstr "" @@ -6493,24 +6494,24 @@ msgid "" "configuration of OpenSSL by the user." msgstr "" -#: src/network/ssl/ssl.c:121 +#: src/network/ssl/ssl.c:121 src/network/ssl/ssl.c:251 msgid "Use HTTPS by default" msgstr "" -#: src/network/ssl/ssl.c:123 +#: src/network/ssl/ssl.c:123 src/network/ssl/ssl.c:253 msgid "Use HTTPS when a URL scheme is not provided." msgstr "" -#: src/network/ssl/ssl.c:125 src/network/ssl/ssl.c:274 +#: src/network/ssl/ssl.c:125 src/network/ssl/ssl.c:278 msgid "Client Certificates" msgstr "" -#: src/network/ssl/ssl.c:127 src/network/ssl/ssl.c:276 +#: src/network/ssl/ssl.c:127 src/network/ssl/ssl.c:280 #, fuzzy msgid "X509 client certificate options." msgstr "Terminal opties" -#: src/network/ssl/ssl.c:131 src/network/ssl/ssl.c:280 +#: src/network/ssl/ssl.c:131 src/network/ssl/ssl.c:284 msgid "" "Enable or not the sending of X509 client certificates to servers which " "request them." @@ -6534,12 +6535,12 @@ msgid "" "The database can be also shared with Mozilla browsers." msgstr "" -#: src/network/ssl/ssl.c:149 src/network/ssl/ssl.c:283 +#: src/network/ssl/ssl.c:149 src/network/ssl/ssl.c:287 #, fuzzy msgid "Certificate File" msgstr "geschatte tijd" -#: src/network/ssl/ssl.c:151 src/network/ssl/ssl.c:285 +#: src/network/ssl/ssl.c:151 src/network/ssl/ssl.c:289 msgid "" "The location of a file containing the client certificate and unencrypted " "private key in PEM format. If unset, the file pointed to by the " @@ -6560,12 +6561,12 @@ msgstr "" #. * of binary packages should of course change the default to #. * suit their systems. #. * TODO: If the file name is relative, look in elinks_home? -#: src/network/ssl/ssl.c:259 +#: src/network/ssl/ssl.c:263 #, fuzzy msgid "Trusted CA file" msgstr "Overzetten" -#: src/network/ssl/ssl.c:266 +#: src/network/ssl/ssl.c:270 msgid "" "The location of a file containing certificates of trusted certification " "authorities in PEM format. ELinks then trusts certificates issued by these " @@ -6576,11 +6577,11 @@ msgid "" msgstr "" #. name: -#: src/network/ssl/ssl.c:306 src/network/ssl/ssl.c:323 +#: src/network/ssl/ssl.c:310 src/network/ssl/ssl.c:327 msgid "SSL" msgstr "" -#: src/network/ssl/ssl.c:308 +#: src/network/ssl/ssl.c:312 #, fuzzy msgid "SSL options." msgstr "Options op~slaan" @@ -7521,7 +7522,7 @@ msgstr "" msgid "Information about the torrent" msgstr "Download afbeeldin~g" -#: src/protocol/bittorrent/dialogs.c:782 src/session/download.c:1553 +#: src/protocol/bittorrent/dialogs.c:782 src/session/download.c:1571 msgid "What to do?" msgstr "Wat wil je doen?" @@ -7532,40 +7533,40 @@ msgid "Down~load" msgstr "Download" #. accelerator_context(src/protocol/bittorrent/dialogs.c:bittorrent_query_callback, src/session/download.c:do_type_query) -#: src/protocol/bittorrent/dialogs.c:810 src/session/download.c:1656 +#: src/protocol/bittorrent/dialogs.c:810 src/session/download.c:1674 #, fuzzy msgid "~Display" msgstr "Weergeven" #. accelerator_context(src/protocol/bittorrent/dialogs.c:bittorrent_query_callback, src/session/download.c:do_type_query) -#: src/protocol/bittorrent/dialogs.c:814 src/session/download.c:1660 +#: src/protocol/bittorrent/dialogs.c:814 src/session/download.c:1678 msgid "Show ~header" msgstr "" -#: src/protocol/file/cgi.c:40 +#: src/protocol/file/cgi.c:41 #, fuzzy msgid "Local CGI" msgstr "bestanden" -#: src/protocol/file/cgi.c:42 +#: src/protocol/file/cgi.c:43 #, fuzzy msgid "Local CGI specific options." msgstr "Geen programma gespecificieerd voor" -#: src/protocol/file/cgi.c:46 +#: src/protocol/file/cgi.c:47 msgid "Colon separated list of directories, where CGI scripts are stored." msgstr "" -#: src/protocol/file/cgi.c:49 +#: src/protocol/file/cgi.c:50 msgid "Allow local CGI" msgstr "" -#: src/protocol/file/cgi.c:51 +#: src/protocol/file/cgi.c:52 msgid "Whether to execute local CGI scripts." msgstr "" #. name: -#: src/protocol/file/cgi.c:56 +#: src/protocol/file/cgi.c:57 msgid "CGI" msgstr "" @@ -8073,7 +8074,7 @@ msgid "" msgstr "" #. name: -#: src/protocol/rewrite/rewrite.c:360 +#: src/protocol/rewrite/rewrite.c:348 msgid "URI rewrite" msgstr "" @@ -8257,37 +8258,37 @@ msgstr "" msgid "~Resume download of the original file" msgstr "" -#: src/session/download.c:1556 +#: src/session/download.c:1574 msgid "Unknown type" msgstr "Onbekend type" -#: src/session/download.c:1581 +#: src/session/download.c:1599 #, c-format msgid "What would you like to do with the file '%s' (type: %s%s%s)?" msgstr "" -#: src/session/download.c:1584 +#: src/session/download.c:1602 #, c-format msgid "What would you like to do with the file (type: %s%s%s)?" msgstr "" -#: src/session/download.c:1612 +#: src/session/download.c:1630 #, no-c-format msgid "Program ('%' will be replaced by the filename)" msgstr "" -#: src/session/download.c:1616 +#: src/session/download.c:1634 #, fuzzy msgid "Block the terminal" msgstr "~BeOS terminal" -#: src/session/download.c:1622 +#: src/session/download.c:1640 #, c-format msgid "The file will be opened with the program '%s'." msgstr "" #. accelerator_context(src/session/download.c:do_type_query) -#: src/session/download.c:1643 +#: src/session/download.c:1661 #, fuzzy msgid "~Open" msgstr "Openen" diff --git a/po/pl.po b/po/pl.po index c2483da1..fea41d7e 100644 --- a/po/pl.po +++ b/po/pl.po @@ -11,7 +11,7 @@ msgid "" msgstr "" "Project-Id-Version: ELinks 0.13.GIT\n" "Report-Msgid-Bugs-To: elinks-users@linuxfromscratch.org\n" -"POT-Creation-Date: 2020-06-26 19:00+0200\n" +"POT-Creation-Date: 2020-07-26 15:28+0200\n" "PO-Revision-Date: 2009-03-13 16:00+0100\n" "Last-Translator: Witold Filipczyk \n" "Language-Team: Polish \n" @@ -187,7 +187,7 @@ msgstr "Musisz wpisać jakieś wyrażenie" #: src/dialogs/options.c:244 src/dialogs/options.c:323 src/mime/dialogs.c:133 #: src/protocol/auth/dialogs.c:160 src/protocol/bittorrent/dialogs.c:820 #: src/scripting/lua/core.c:402 src/scripting/lua/core.c:483 -#: src/session/download.c:840 src/session/download.c:1666 +#: src/session/download.c:840 src/session/download.c:1684 #: src/viewer/text/search.c:1937 msgid "~Cancel" msgstr "~Anuluj" @@ -205,7 +205,7 @@ msgstr "Cyfrowy zegar w pasku statusu." #: src/config/options.inc:1343 src/ecmascript/ecmascript.c:44 #: src/globhist/globhist.c:64 src/mime/backend/mailcap.c:93 #: src/mime/backend/mimetypes.c:52 src/network/ssl/ssl.c:129 -#: src/network/ssl/ssl.c:278 +#: src/network/ssl/ssl.c:282 msgid "Enable" msgstr "Włącz" @@ -2040,7 +2040,7 @@ msgstr "Nie można dodać tu opcji." #. accelerator_context(src/config/dialogs.c:keybinding_buttons, src/config/dialogs.c:option_buttons, src/cookies/dialogs.c:cookie_buttons, src/formhist/dialogs.c:formhist_buttons, src/protocol/bittorrent/dialogs.c:bittorrent_query_callback, src/session/download.c:do_type_query, terminal_options) #: src/config/dialogs.c:505 src/config/dialogs.c:933 src/cookies/dialogs.c:543 #: src/dialogs/options.c:243 src/formhist/dialogs.c:214 -#: src/protocol/bittorrent/dialogs.c:807 src/session/download.c:1650 +#: src/protocol/bittorrent/dialogs.c:807 src/session/download.c:1668 msgid "Sa~ve" msgstr "~Zapisz" @@ -5003,7 +5003,7 @@ msgid "Domain" msgstr "Domena" #: src/cookies/dialogs.c:41 src/mime/backend/mailcap.c:97 -#: src/mime/backend/mimetypes.c:56 src/protocol/file/cgi.c:44 +#: src/mime/backend/mimetypes.c:56 src/protocol/file/cgi.c:45 msgid "Path" msgstr "Ścieżka" @@ -6767,22 +6767,24 @@ msgstr "Program" #: src/mime/backend/default.c:76 #, no-c-format msgid "" -"External viewer for this file type. '%' in this string will be substituted " -"by a file name. Do _not_ put single- or double-quotes around the % sign." +"External viewer for this file type. '%f' in this string will be substituted " +"by a file name, '%u' by its uri. Do _not_ put single- or double-quotes " +"around the % sign." msgstr "" -"Zewnętrzna przeglądarka dla tego typu plików. '%' w łańcuchu zostanie " -"zastąpiony nazwą pliku." +"Zewnętrzna przeglądarka dla tego typu plików. '%f' w łańcuchu zostanie " +"zastąpiony nazwą pliku a '%u' jego uri. NIE otaczaj znaku % apostrofami ani " +"cudzysłowami." # -#: src/mime/backend/default.c:81 +#: src/mime/backend/default.c:82 msgid "File extension associations" msgstr "Skojarzenia rozszerzeń plików" -#: src/mime/backend/default.c:83 +#: src/mime/backend/default.c:84 msgid "Extension <-> MIME type association." msgstr "Rozszerzenie <-> skojarzenie typu MIME." -#: src/mime/backend/default.c:87 +#: src/mime/backend/default.c:88 msgid "" "MIME-type matching this file extension ('*' is used here in place of '.')." msgstr "" @@ -6790,7 +6792,7 @@ msgstr "" "zamiast '.')." #. name: -#: src/mime/backend/default.c:219 +#: src/mime/backend/default.c:220 msgid "Option system" msgstr "System konfiguracyjny" @@ -6936,24 +6938,24 @@ msgstr "" "Sprawdzaj certyfikaty SSL sieci. Wiedz, że wymaga to skonfigurowania OpenSSL " "przez użytkownika." -#: src/network/ssl/ssl.c:121 +#: src/network/ssl/ssl.c:121 src/network/ssl/ssl.c:251 msgid "Use HTTPS by default" msgstr "Używaj HTTPS domyślnie" -#: src/network/ssl/ssl.c:123 +#: src/network/ssl/ssl.c:123 src/network/ssl/ssl.c:253 msgid "Use HTTPS when a URL scheme is not provided." msgstr "Używaj HTTPS, gdy żaden protokół nie jest podany." -#: src/network/ssl/ssl.c:125 src/network/ssl/ssl.c:274 +#: src/network/ssl/ssl.c:125 src/network/ssl/ssl.c:278 msgid "Client Certificates" msgstr "Certyfikaty klienta" # -#: src/network/ssl/ssl.c:127 src/network/ssl/ssl.c:276 +#: src/network/ssl/ssl.c:127 src/network/ssl/ssl.c:280 msgid "X509 client certificate options." msgstr "Ustawienia dotyczące certyfikatów X509." -#: src/network/ssl/ssl.c:131 src/network/ssl/ssl.c:280 +#: src/network/ssl/ssl.c:131 src/network/ssl/ssl.c:284 msgid "" "Enable or not the sending of X509 client certificates to servers which " "request them." @@ -6985,11 +6987,11 @@ msgstr "" "Położenie bazy NSS można zmienić ustawiając zmienną środowiskową SSL_DIR. " "Baza może być także współdzielona z Mozillą." -#: src/network/ssl/ssl.c:149 src/network/ssl/ssl.c:283 +#: src/network/ssl/ssl.c:149 src/network/ssl/ssl.c:287 msgid "Certificate File" msgstr "Plik certyfikatów" -#: src/network/ssl/ssl.c:151 src/network/ssl/ssl.c:285 +#: src/network/ssl/ssl.c:151 src/network/ssl/ssl.c:289 msgid "" "The location of a file containing the client certificate and unencrypted " "private key in PEM format. If unset, the file pointed to by the " @@ -7015,11 +7017,11 @@ msgstr "" #. * of binary packages should of course change the default to #. * suit their systems. #. * TODO: If the file name is relative, look in elinks_home? -#: src/network/ssl/ssl.c:259 +#: src/network/ssl/ssl.c:263 msgid "Trusted CA file" msgstr "Plik zaufanych CA" -#: src/network/ssl/ssl.c:266 +#: src/network/ssl/ssl.c:270 msgid "" "The location of a file containing certificates of trusted certification " "authorities in PEM format. ELinks then trusts certificates issued by these " @@ -7036,12 +7038,12 @@ msgstr "" "odniosły skutek. Opcja ta dotyczy GnuTLS, a nie OpenSSL." #. name: -#: src/network/ssl/ssl.c:306 src/network/ssl/ssl.c:323 +#: src/network/ssl/ssl.c:310 src/network/ssl/ssl.c:327 msgid "SSL" msgstr "SSL" # -#: src/network/ssl/ssl.c:308 +#: src/network/ssl/ssl.c:312 msgid "SSL options." msgstr "Ustawienia SSL." @@ -8042,7 +8044,7 @@ msgstr "Co chcesz zrobić z plikiem '%s'?" msgid "Information about the torrent" msgstr "Informacje o potoku" -#: src/protocol/bittorrent/dialogs.c:782 src/session/download.c:1553 +#: src/protocol/bittorrent/dialogs.c:782 src/session/download.c:1571 msgid "What to do?" msgstr "Co mam zrobić?" @@ -8052,40 +8054,40 @@ msgid "Down~load" msgstr "~Pobierz" #. accelerator_context(src/protocol/bittorrent/dialogs.c:bittorrent_query_callback, src/session/download.c:do_type_query) -#: src/protocol/bittorrent/dialogs.c:810 src/session/download.c:1656 +#: src/protocol/bittorrent/dialogs.c:810 src/session/download.c:1674 msgid "~Display" msgstr "~Wyświetl" #. accelerator_context(src/protocol/bittorrent/dialogs.c:bittorrent_query_callback, src/session/download.c:do_type_query) -#: src/protocol/bittorrent/dialogs.c:814 src/session/download.c:1660 +#: src/protocol/bittorrent/dialogs.c:814 src/session/download.c:1678 msgid "Show ~header" msgstr "Pokaż ~nagłówek" # -#: src/protocol/file/cgi.c:40 +#: src/protocol/file/cgi.c:41 msgid "Local CGI" msgstr "Lokalne CGI" -#: src/protocol/file/cgi.c:42 +#: src/protocol/file/cgi.c:43 msgid "Local CGI specific options." msgstr "Ustawienia dotyczące lokalnych skryptów CGI." -#: src/protocol/file/cgi.c:46 +#: src/protocol/file/cgi.c:47 msgid "Colon separated list of directories, where CGI scripts are stored." msgstr "" "Oddzielona dwukropkami lista katalogów, w których są\n" "umieszczone skrypty CGI." -#: src/protocol/file/cgi.c:49 +#: src/protocol/file/cgi.c:50 msgid "Allow local CGI" msgstr "Pozwolenie na wykonywanie skryptów CGI" -#: src/protocol/file/cgi.c:51 +#: src/protocol/file/cgi.c:52 msgid "Whether to execute local CGI scripts." msgstr "Czy uruchamiać lokalne skrypty CGI." #. name: -#: src/protocol/file/cgi.c:56 +#: src/protocol/file/cgi.c:57 msgid "CGI" msgstr "CGI" @@ -8694,7 +8696,7 @@ msgstr "" "%% oznacza '%'" #. name: -#: src/protocol/rewrite/rewrite.c:360 +#: src/protocol/rewrite/rewrite.c:348 msgid "URI rewrite" msgstr "Przepisywanie URI" @@ -8899,37 +8901,37 @@ msgstr "Nadpisz ~oryginalny plik" msgid "~Resume download of the original file" msgstr "Wznów pobie~ranie oryginalnego pliku" -#: src/session/download.c:1556 +#: src/session/download.c:1574 msgid "Unknown type" msgstr "Nieznany typ" -#: src/session/download.c:1581 +#: src/session/download.c:1599 #, c-format msgid "What would you like to do with the file '%s' (type: %s%s%s)?" msgstr "Co chcesz zrobić z plikiem '%s' (typu %s%s%s)?" -#: src/session/download.c:1584 +#: src/session/download.c:1602 #, c-format msgid "What would you like to do with the file (type: %s%s%s)?" msgstr "Co chcesz zrobić z plikiem (typu %s%s%s)?" -#: src/session/download.c:1612 +#: src/session/download.c:1630 #, no-c-format msgid "Program ('%' will be replaced by the filename)" msgstr "Program ('%' zostanie zastąpione nazwą pliku)" # -#: src/session/download.c:1616 +#: src/session/download.c:1634 msgid "Block the terminal" msgstr "Blokowanie terminala" -#: src/session/download.c:1622 +#: src/session/download.c:1640 #, c-format msgid "The file will be opened with the program '%s'." msgstr "Plik zostanie otwarty przy użyciu programu '%s'." #. accelerator_context(src/session/download.c:do_type_query) -#: src/session/download.c:1643 +#: src/session/download.c:1661 msgid "~Open" msgstr "~Otwórz" diff --git a/po/pt.po b/po/pt.po index 3d91125e..842b4cd9 100644 --- a/po/pt.po +++ b/po/pt.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: ELinks 0.5pre0.CVS\n" "Report-Msgid-Bugs-To: elinks-users@linuxfromscratch.org\n" -"POT-Creation-Date: 2020-06-26 19:00+0200\n" +"POT-Creation-Date: 2020-07-26 15:28+0200\n" "PO-Revision-Date: 2003-01-03 03:41+0100\n" "Last-Translator: Andre Valente \n" "Language-Team: Portuguese \n" @@ -187,7 +187,7 @@ msgstr "Não é permitida uma sequência de caracteres vazia" #: src/dialogs/options.c:244 src/dialogs/options.c:323 src/mime/dialogs.c:133 #: src/protocol/auth/dialogs.c:160 src/protocol/bittorrent/dialogs.c:820 #: src/scripting/lua/core.c:402 src/scripting/lua/core.c:483 -#: src/session/download.c:840 src/session/download.c:1666 +#: src/session/download.c:840 src/session/download.c:1684 #: src/viewer/text/search.c:1937 #, fuzzy msgid "~Cancel" @@ -206,7 +206,7 @@ msgstr "" #: src/config/options.inc:1343 src/ecmascript/ecmascript.c:44 #: src/globhist/globhist.c:64 src/mime/backend/mailcap.c:93 #: src/mime/backend/mimetypes.c:52 src/network/ssl/ssl.c:129 -#: src/network/ssl/ssl.c:278 +#: src/network/ssl/ssl.c:282 #, fuzzy msgid "Enable" msgstr "nome" @@ -2011,7 +2011,7 @@ msgstr "Não pode adicionar esta opção aqui" #. accelerator_context(src/config/dialogs.c:keybinding_buttons, src/config/dialogs.c:option_buttons, src/cookies/dialogs.c:cookie_buttons, src/formhist/dialogs.c:formhist_buttons, src/protocol/bittorrent/dialogs.c:bittorrent_query_callback, src/session/download.c:do_type_query, terminal_options) #: src/config/dialogs.c:505 src/config/dialogs.c:933 src/cookies/dialogs.c:543 #: src/dialogs/options.c:243 src/formhist/dialogs.c:214 -#: src/protocol/bittorrent/dialogs.c:807 src/session/download.c:1650 +#: src/protocol/bittorrent/dialogs.c:807 src/session/download.c:1668 #, fuzzy msgid "Sa~ve" msgstr "Salvar" @@ -4606,7 +4606,7 @@ msgid "Domain" msgstr "~Informação sobre o documento" #: src/cookies/dialogs.c:41 src/mime/backend/mailcap.c:97 -#: src/mime/backend/mimetypes.c:56 src/protocol/file/cgi.c:44 +#: src/mime/backend/mimetypes.c:56 src/protocol/file/cgi.c:45 msgid "Path" msgstr "" @@ -6388,26 +6388,27 @@ msgstr "Nenhum programa" #: src/mime/backend/default.c:76 #, no-c-format msgid "" -"External viewer for this file type. '%' in this string will be substituted " -"by a file name. Do _not_ put single- or double-quotes around the % sign." +"External viewer for this file type. '%f' in this string will be substituted " +"by a file name, '%u' by its uri. Do _not_ put single- or double-quotes " +"around the % sign." msgstr "" -#: src/mime/backend/default.c:81 +#: src/mime/backend/default.c:82 #, fuzzy msgid "File extension associations" msgstr "~Extensões de ficheiro" -#: src/mime/backend/default.c:83 +#: src/mime/backend/default.c:84 msgid "Extension <-> MIME type association." msgstr "" -#: src/mime/backend/default.c:87 +#: src/mime/backend/default.c:88 msgid "" "MIME-type matching this file extension ('*' is used here in place of '.')." msgstr "" #. name: -#: src/mime/backend/default.c:219 +#: src/mime/backend/default.c:220 msgid "Option system" msgstr "" @@ -6537,24 +6538,24 @@ msgid "" "configuration of OpenSSL by the user." msgstr "" -#: src/network/ssl/ssl.c:121 +#: src/network/ssl/ssl.c:121 src/network/ssl/ssl.c:251 msgid "Use HTTPS by default" msgstr "" -#: src/network/ssl/ssl.c:123 +#: src/network/ssl/ssl.c:123 src/network/ssl/ssl.c:253 msgid "Use HTTPS when a URL scheme is not provided." msgstr "" -#: src/network/ssl/ssl.c:125 src/network/ssl/ssl.c:274 +#: src/network/ssl/ssl.c:125 src/network/ssl/ssl.c:278 msgid "Client Certificates" msgstr "" -#: src/network/ssl/ssl.c:127 src/network/ssl/ssl.c:276 +#: src/network/ssl/ssl.c:127 src/network/ssl/ssl.c:280 #, fuzzy msgid "X509 client certificate options." msgstr "Opções do Terminal" -#: src/network/ssl/ssl.c:131 src/network/ssl/ssl.c:280 +#: src/network/ssl/ssl.c:131 src/network/ssl/ssl.c:284 msgid "" "Enable or not the sending of X509 client certificates to servers which " "request them." @@ -6578,12 +6579,12 @@ msgid "" "The database can be also shared with Mozilla browsers." msgstr "" -#: src/network/ssl/ssl.c:149 src/network/ssl/ssl.c:283 +#: src/network/ssl/ssl.c:149 src/network/ssl/ssl.c:287 #, fuzzy msgid "Certificate File" msgstr "tempo estimado" -#: src/network/ssl/ssl.c:151 src/network/ssl/ssl.c:285 +#: src/network/ssl/ssl.c:151 src/network/ssl/ssl.c:289 msgid "" "The location of a file containing the client certificate and unencrypted " "private key in PEM format. If unset, the file pointed to by the " @@ -6604,12 +6605,12 @@ msgstr "" #. * of binary packages should of course change the default to #. * suit their systems. #. * TODO: If the file name is relative, look in elinks_home? -#: src/network/ssl/ssl.c:259 +#: src/network/ssl/ssl.c:263 #, fuzzy msgid "Trusted CA file" msgstr "A transferir" -#: src/network/ssl/ssl.c:266 +#: src/network/ssl/ssl.c:270 msgid "" "The location of a file containing certificates of trusted certification " "authorities in PEM format. ELinks then trusts certificates issued by these " @@ -6620,11 +6621,11 @@ msgid "" msgstr "" #. name: -#: src/network/ssl/ssl.c:306 src/network/ssl/ssl.c:323 +#: src/network/ssl/ssl.c:310 src/network/ssl/ssl.c:327 msgid "SSL" msgstr "" -#: src/network/ssl/ssl.c:308 +#: src/network/ssl/ssl.c:312 #, fuzzy msgid "SSL options." msgstr "~Salvar opções" @@ -7566,7 +7567,7 @@ msgstr "" msgid "Information about the torrent" msgstr "D~ownload da imagem" -#: src/protocol/bittorrent/dialogs.c:782 src/session/download.c:1553 +#: src/protocol/bittorrent/dialogs.c:782 src/session/download.c:1571 msgid "What to do?" msgstr "O que fazer?" @@ -7577,41 +7578,41 @@ msgid "Down~load" msgstr "Download" #. accelerator_context(src/protocol/bittorrent/dialogs.c:bittorrent_query_callback, src/session/download.c:do_type_query) -#: src/protocol/bittorrent/dialogs.c:810 src/session/download.c:1656 +#: src/protocol/bittorrent/dialogs.c:810 src/session/download.c:1674 #, fuzzy msgid "~Display" msgstr "Mostar" #. accelerator_context(src/protocol/bittorrent/dialogs.c:bittorrent_query_callback, src/session/download.c:do_type_query) -#: src/protocol/bittorrent/dialogs.c:814 src/session/download.c:1660 +#: src/protocol/bittorrent/dialogs.c:814 src/session/download.c:1678 #, fuzzy msgid "Show ~header" msgstr "Sem cabeçalho de informação" -#: src/protocol/file/cgi.c:40 +#: src/protocol/file/cgi.c:41 #, fuzzy msgid "Local CGI" msgstr "arquivosfiles" -#: src/protocol/file/cgi.c:42 +#: src/protocol/file/cgi.c:43 #, fuzzy msgid "Local CGI specific options." msgstr "Nenhum programa foi especificado para" -#: src/protocol/file/cgi.c:46 +#: src/protocol/file/cgi.c:47 msgid "Colon separated list of directories, where CGI scripts are stored." msgstr "" -#: src/protocol/file/cgi.c:49 +#: src/protocol/file/cgi.c:50 msgid "Allow local CGI" msgstr "" -#: src/protocol/file/cgi.c:51 +#: src/protocol/file/cgi.c:52 msgid "Whether to execute local CGI scripts." msgstr "" #. name: -#: src/protocol/file/cgi.c:56 +#: src/protocol/file/cgi.c:57 msgid "CGI" msgstr "" @@ -8124,7 +8125,7 @@ msgid "" msgstr "" #. name: -#: src/protocol/rewrite/rewrite.c:360 +#: src/protocol/rewrite/rewrite.c:348 msgid "URI rewrite" msgstr "" @@ -8311,37 +8312,37 @@ msgstr "" msgid "~Resume download of the original file" msgstr "" -#: src/session/download.c:1556 +#: src/session/download.c:1574 msgid "Unknown type" msgstr "Tipo desconhecido" -#: src/session/download.c:1581 +#: src/session/download.c:1599 #, c-format msgid "What would you like to do with the file '%s' (type: %s%s%s)?" msgstr "" -#: src/session/download.c:1584 +#: src/session/download.c:1602 #, c-format msgid "What would you like to do with the file (type: %s%s%s)?" msgstr "" -#: src/session/download.c:1612 +#: src/session/download.c:1630 #, no-c-format msgid "Program ('%' will be replaced by the filename)" msgstr "" -#: src/session/download.c:1616 +#: src/session/download.c:1634 #, fuzzy msgid "Block the terminal" msgstr "Terminal do ~BeOS" -#: src/session/download.c:1622 +#: src/session/download.c:1640 #, c-format msgid "The file will be opened with the program '%s'." msgstr "" #. accelerator_context(src/session/download.c:do_type_query) -#: src/session/download.c:1643 +#: src/session/download.c:1661 #, fuzzy msgid "~Open" msgstr "Abrir" diff --git a/po/pt_BR.po b/po/pt_BR.po index 32417c0e..cadd3483 100644 --- a/po/pt_BR.po +++ b/po/pt_BR.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: ELinks 0.5pre0.CVS\n" "Report-Msgid-Bugs-To: elinks-users@linuxfromscratch.org\n" -"POT-Creation-Date: 2020-06-26 19:00+0200\n" +"POT-Creation-Date: 2020-07-26 15:28+0200\n" "PO-Revision-Date: 2003-01-03 03:41+0100\n" "Last-Translator: Andre Valente \n" "Language-Team: Brazilian Portuguese \n" @@ -188,7 +188,7 @@ msgstr "Não é permitido sequência de caracteres vazia" #: src/dialogs/options.c:244 src/dialogs/options.c:323 src/mime/dialogs.c:133 #: src/protocol/auth/dialogs.c:160 src/protocol/bittorrent/dialogs.c:820 #: src/scripting/lua/core.c:402 src/scripting/lua/core.c:483 -#: src/session/download.c:840 src/session/download.c:1666 +#: src/session/download.c:840 src/session/download.c:1684 #: src/viewer/text/search.c:1937 #, fuzzy msgid "~Cancel" @@ -207,7 +207,7 @@ msgstr "" #: src/config/options.inc:1343 src/ecmascript/ecmascript.c:44 #: src/globhist/globhist.c:64 src/mime/backend/mailcap.c:93 #: src/mime/backend/mimetypes.c:52 src/network/ssl/ssl.c:129 -#: src/network/ssl/ssl.c:278 +#: src/network/ssl/ssl.c:282 #, fuzzy msgid "Enable" msgstr "nome" @@ -2004,7 +2004,7 @@ msgstr "" #. accelerator_context(src/config/dialogs.c:keybinding_buttons, src/config/dialogs.c:option_buttons, src/cookies/dialogs.c:cookie_buttons, src/formhist/dialogs.c:formhist_buttons, src/protocol/bittorrent/dialogs.c:bittorrent_query_callback, src/session/download.c:do_type_query, terminal_options) #: src/config/dialogs.c:505 src/config/dialogs.c:933 src/cookies/dialogs.c:543 #: src/dialogs/options.c:243 src/formhist/dialogs.c:214 -#: src/protocol/bittorrent/dialogs.c:807 src/session/download.c:1650 +#: src/protocol/bittorrent/dialogs.c:807 src/session/download.c:1668 #, fuzzy msgid "Sa~ve" msgstr "Salvar" @@ -4590,7 +4590,7 @@ msgid "Domain" msgstr "~Informação sobre o documento" #: src/cookies/dialogs.c:41 src/mime/backend/mailcap.c:97 -#: src/mime/backend/mimetypes.c:56 src/protocol/file/cgi.c:44 +#: src/mime/backend/mimetypes.c:56 src/protocol/file/cgi.c:45 msgid "Path" msgstr "" @@ -6369,26 +6369,27 @@ msgstr "Nenhum programa" #: src/mime/backend/default.c:76 #, no-c-format msgid "" -"External viewer for this file type. '%' in this string will be substituted " -"by a file name. Do _not_ put single- or double-quotes around the % sign." +"External viewer for this file type. '%f' in this string will be substituted " +"by a file name, '%u' by its uri. Do _not_ put single- or double-quotes " +"around the % sign." msgstr "" -#: src/mime/backend/default.c:81 +#: src/mime/backend/default.c:82 #, fuzzy msgid "File extension associations" msgstr "~Extensões de arquivo" -#: src/mime/backend/default.c:83 +#: src/mime/backend/default.c:84 msgid "Extension <-> MIME type association." msgstr "" -#: src/mime/backend/default.c:87 +#: src/mime/backend/default.c:88 msgid "" "MIME-type matching this file extension ('*' is used here in place of '.')." msgstr "" #. name: -#: src/mime/backend/default.c:219 +#: src/mime/backend/default.c:220 msgid "Option system" msgstr "" @@ -6518,24 +6519,24 @@ msgid "" "configuration of OpenSSL by the user." msgstr "" -#: src/network/ssl/ssl.c:121 +#: src/network/ssl/ssl.c:121 src/network/ssl/ssl.c:251 msgid "Use HTTPS by default" msgstr "" -#: src/network/ssl/ssl.c:123 +#: src/network/ssl/ssl.c:123 src/network/ssl/ssl.c:253 msgid "Use HTTPS when a URL scheme is not provided." msgstr "" -#: src/network/ssl/ssl.c:125 src/network/ssl/ssl.c:274 +#: src/network/ssl/ssl.c:125 src/network/ssl/ssl.c:278 msgid "Client Certificates" msgstr "" -#: src/network/ssl/ssl.c:127 src/network/ssl/ssl.c:276 +#: src/network/ssl/ssl.c:127 src/network/ssl/ssl.c:280 #, fuzzy msgid "X509 client certificate options." msgstr "Opções do Terminal" -#: src/network/ssl/ssl.c:131 src/network/ssl/ssl.c:280 +#: src/network/ssl/ssl.c:131 src/network/ssl/ssl.c:284 msgid "" "Enable or not the sending of X509 client certificates to servers which " "request them." @@ -6559,12 +6560,12 @@ msgid "" "The database can be also shared with Mozilla browsers." msgstr "" -#: src/network/ssl/ssl.c:149 src/network/ssl/ssl.c:283 +#: src/network/ssl/ssl.c:149 src/network/ssl/ssl.c:287 #, fuzzy msgid "Certificate File" msgstr "tempo estimado" -#: src/network/ssl/ssl.c:151 src/network/ssl/ssl.c:285 +#: src/network/ssl/ssl.c:151 src/network/ssl/ssl.c:289 msgid "" "The location of a file containing the client certificate and unencrypted " "private key in PEM format. If unset, the file pointed to by the " @@ -6585,12 +6586,12 @@ msgstr "" #. * of binary packages should of course change the default to #. * suit their systems. #. * TODO: If the file name is relative, look in elinks_home? -#: src/network/ssl/ssl.c:259 +#: src/network/ssl/ssl.c:263 #, fuzzy msgid "Trusted CA file" msgstr "Transferindo" -#: src/network/ssl/ssl.c:266 +#: src/network/ssl/ssl.c:270 msgid "" "The location of a file containing certificates of trusted certification " "authorities in PEM format. ELinks then trusts certificates issued by these " @@ -6601,11 +6602,11 @@ msgid "" msgstr "" #. name: -#: src/network/ssl/ssl.c:306 src/network/ssl/ssl.c:323 +#: src/network/ssl/ssl.c:310 src/network/ssl/ssl.c:327 msgid "SSL" msgstr "" -#: src/network/ssl/ssl.c:308 +#: src/network/ssl/ssl.c:312 #, fuzzy msgid "SSL options." msgstr "~Salvar opções" @@ -7546,7 +7547,7 @@ msgstr "" msgid "Information about the torrent" msgstr "Download da ima~gem" -#: src/protocol/bittorrent/dialogs.c:782 src/session/download.c:1553 +#: src/protocol/bittorrent/dialogs.c:782 src/session/download.c:1571 msgid "What to do?" msgstr "Fazer o que?" @@ -7557,40 +7558,40 @@ msgid "Down~load" msgstr "Download" #. accelerator_context(src/protocol/bittorrent/dialogs.c:bittorrent_query_callback, src/session/download.c:do_type_query) -#: src/protocol/bittorrent/dialogs.c:810 src/session/download.c:1656 +#: src/protocol/bittorrent/dialogs.c:810 src/session/download.c:1674 #, fuzzy msgid "~Display" msgstr "Exibir" #. accelerator_context(src/protocol/bittorrent/dialogs.c:bittorrent_query_callback, src/session/download.c:do_type_query) -#: src/protocol/bittorrent/dialogs.c:814 src/session/download.c:1660 +#: src/protocol/bittorrent/dialogs.c:814 src/session/download.c:1678 msgid "Show ~header" msgstr "" -#: src/protocol/file/cgi.c:40 +#: src/protocol/file/cgi.c:41 #, fuzzy msgid "Local CGI" msgstr "arquivosfiles" -#: src/protocol/file/cgi.c:42 +#: src/protocol/file/cgi.c:43 #, fuzzy msgid "Local CGI specific options." msgstr "Nenhum programa foi especificado para" -#: src/protocol/file/cgi.c:46 +#: src/protocol/file/cgi.c:47 msgid "Colon separated list of directories, where CGI scripts are stored." msgstr "" -#: src/protocol/file/cgi.c:49 +#: src/protocol/file/cgi.c:50 msgid "Allow local CGI" msgstr "" -#: src/protocol/file/cgi.c:51 +#: src/protocol/file/cgi.c:52 msgid "Whether to execute local CGI scripts." msgstr "" #. name: -#: src/protocol/file/cgi.c:56 +#: src/protocol/file/cgi.c:57 msgid "CGI" msgstr "" @@ -8100,7 +8101,7 @@ msgid "" msgstr "" #. name: -#: src/protocol/rewrite/rewrite.c:360 +#: src/protocol/rewrite/rewrite.c:348 msgid "URI rewrite" msgstr "" @@ -8284,37 +8285,37 @@ msgstr "" msgid "~Resume download of the original file" msgstr "" -#: src/session/download.c:1556 +#: src/session/download.c:1574 msgid "Unknown type" msgstr "Tipo desconhecido" -#: src/session/download.c:1581 +#: src/session/download.c:1599 #, c-format msgid "What would you like to do with the file '%s' (type: %s%s%s)?" msgstr "" -#: src/session/download.c:1584 +#: src/session/download.c:1602 #, c-format msgid "What would you like to do with the file (type: %s%s%s)?" msgstr "" -#: src/session/download.c:1612 +#: src/session/download.c:1630 #, no-c-format msgid "Program ('%' will be replaced by the filename)" msgstr "" -#: src/session/download.c:1616 +#: src/session/download.c:1634 #, fuzzy msgid "Block the terminal" msgstr "Terminal do ~BeOS" -#: src/session/download.c:1622 +#: src/session/download.c:1640 #, c-format msgid "The file will be opened with the program '%s'." msgstr "" #. accelerator_context(src/session/download.c:do_type_query) -#: src/session/download.c:1643 +#: src/session/download.c:1661 #, fuzzy msgid "~Open" msgstr "Abrir" diff --git a/po/ro.po b/po/ro.po index 3d0a5084..3f9adedc 100644 --- a/po/ro.po +++ b/po/ro.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: ELinks 0.5pre0.CVS\n" "Report-Msgid-Bugs-To: elinks-users@linuxfromscratch.org\n" -"POT-Creation-Date: 2020-06-26 19:00+0200\n" +"POT-Creation-Date: 2020-07-26 15:28+0200\n" "PO-Revision-Date: 2003-01-03 03:41+0100\n" "Last-Translator: Ionel Mugurel Ciobica \n" "Language-Team: Romanian \n" @@ -186,7 +186,7 @@ msgstr "Șir vid neacceptabil" #: src/dialogs/options.c:244 src/dialogs/options.c:323 src/mime/dialogs.c:133 #: src/protocol/auth/dialogs.c:160 src/protocol/bittorrent/dialogs.c:820 #: src/scripting/lua/core.c:402 src/scripting/lua/core.c:483 -#: src/session/download.c:840 src/session/download.c:1666 +#: src/session/download.c:840 src/session/download.c:1684 #: src/viewer/text/search.c:1937 #, fuzzy msgid "~Cancel" @@ -205,7 +205,7 @@ msgstr "" #: src/config/options.inc:1343 src/ecmascript/ecmascript.c:44 #: src/globhist/globhist.c:64 src/mime/backend/mailcap.c:93 #: src/mime/backend/mimetypes.c:52 src/network/ssl/ssl.c:129 -#: src/network/ssl/ssl.c:278 +#: src/network/ssl/ssl.c:282 #, fuzzy msgid "Enable" msgstr "Nume" @@ -1996,7 +1996,7 @@ msgstr "" #. accelerator_context(src/config/dialogs.c:keybinding_buttons, src/config/dialogs.c:option_buttons, src/cookies/dialogs.c:cookie_buttons, src/formhist/dialogs.c:formhist_buttons, src/protocol/bittorrent/dialogs.c:bittorrent_query_callback, src/session/download.c:do_type_query, terminal_options) #: src/config/dialogs.c:505 src/config/dialogs.c:933 src/cookies/dialogs.c:543 #: src/dialogs/options.c:243 src/formhist/dialogs.c:214 -#: src/protocol/bittorrent/dialogs.c:807 src/session/download.c:1650 +#: src/protocol/bittorrent/dialogs.c:807 src/session/download.c:1668 #, fuzzy msgid "Sa~ve" msgstr "Salvează" @@ -4576,7 +4576,7 @@ msgid "Domain" msgstr "~Informații despre document" #: src/cookies/dialogs.c:41 src/mime/backend/mailcap.c:97 -#: src/mime/backend/mimetypes.c:56 src/protocol/file/cgi.c:44 +#: src/mime/backend/mimetypes.c:56 src/protocol/file/cgi.c:45 msgid "Path" msgstr "" @@ -6344,26 +6344,27 @@ msgstr "Nici un program" #: src/mime/backend/default.c:76 #, no-c-format msgid "" -"External viewer for this file type. '%' in this string will be substituted " -"by a file name. Do _not_ put single- or double-quotes around the % sign." +"External viewer for this file type. '%f' in this string will be substituted " +"by a file name, '%u' by its uri. Do _not_ put single- or double-quotes " +"around the % sign." msgstr "" -#: src/mime/backend/default.c:81 +#: src/mime/backend/default.c:82 #, fuzzy msgid "File extension associations" msgstr "~Extensia fișierelor" -#: src/mime/backend/default.c:83 +#: src/mime/backend/default.c:84 msgid "Extension <-> MIME type association." msgstr "" -#: src/mime/backend/default.c:87 +#: src/mime/backend/default.c:88 msgid "" "MIME-type matching this file extension ('*' is used here in place of '.')." msgstr "" #. name: -#: src/mime/backend/default.c:219 +#: src/mime/backend/default.c:220 msgid "Option system" msgstr "" @@ -6493,24 +6494,24 @@ msgid "" "configuration of OpenSSL by the user." msgstr "" -#: src/network/ssl/ssl.c:121 +#: src/network/ssl/ssl.c:121 src/network/ssl/ssl.c:251 msgid "Use HTTPS by default" msgstr "" -#: src/network/ssl/ssl.c:123 +#: src/network/ssl/ssl.c:123 src/network/ssl/ssl.c:253 msgid "Use HTTPS when a URL scheme is not provided." msgstr "" -#: src/network/ssl/ssl.c:125 src/network/ssl/ssl.c:274 +#: src/network/ssl/ssl.c:125 src/network/ssl/ssl.c:278 msgid "Client Certificates" msgstr "" -#: src/network/ssl/ssl.c:127 src/network/ssl/ssl.c:276 +#: src/network/ssl/ssl.c:127 src/network/ssl/ssl.c:280 #, fuzzy msgid "X509 client certificate options." msgstr "Opțiuni de terminal" -#: src/network/ssl/ssl.c:131 src/network/ssl/ssl.c:280 +#: src/network/ssl/ssl.c:131 src/network/ssl/ssl.c:284 msgid "" "Enable or not the sending of X509 client certificates to servers which " "request them." @@ -6534,12 +6535,12 @@ msgid "" "The database can be also shared with Mozilla browsers." msgstr "" -#: src/network/ssl/ssl.c:149 src/network/ssl/ssl.c:283 +#: src/network/ssl/ssl.c:149 src/network/ssl/ssl.c:287 #, fuzzy msgid "Certificate File" msgstr "Timp estimat" -#: src/network/ssl/ssl.c:151 src/network/ssl/ssl.c:285 +#: src/network/ssl/ssl.c:151 src/network/ssl/ssl.c:289 msgid "" "The location of a file containing the client certificate and unencrypted " "private key in PEM format. If unset, the file pointed to by the " @@ -6560,12 +6561,12 @@ msgstr "" #. * of binary packages should of course change the default to #. * suit their systems. #. * TODO: If the file name is relative, look in elinks_home? -#: src/network/ssl/ssl.c:259 +#: src/network/ssl/ssl.c:263 #, fuzzy msgid "Trusted CA file" msgstr "Transfer" -#: src/network/ssl/ssl.c:266 +#: src/network/ssl/ssl.c:270 msgid "" "The location of a file containing certificates of trusted certification " "authorities in PEM format. ELinks then trusts certificates issued by these " @@ -6576,11 +6577,11 @@ msgid "" msgstr "" #. name: -#: src/network/ssl/ssl.c:306 src/network/ssl/ssl.c:323 +#: src/network/ssl/ssl.c:310 src/network/ssl/ssl.c:327 msgid "SSL" msgstr "" -#: src/network/ssl/ssl.c:308 +#: src/network/ssl/ssl.c:312 #, fuzzy msgid "SSL options." msgstr "~Salvează opțiunile" @@ -7521,7 +7522,7 @@ msgstr "" msgid "Information about the torrent" msgstr "Descarcă ima~ginea" -#: src/protocol/bittorrent/dialogs.c:782 src/session/download.c:1553 +#: src/protocol/bittorrent/dialogs.c:782 src/session/download.c:1571 msgid "What to do?" msgstr "Ce să fac?" @@ -7532,40 +7533,40 @@ msgid "Down~load" msgstr "Încarcă" #. accelerator_context(src/protocol/bittorrent/dialogs.c:bittorrent_query_callback, src/session/download.c:do_type_query) -#: src/protocol/bittorrent/dialogs.c:810 src/session/download.c:1656 +#: src/protocol/bittorrent/dialogs.c:810 src/session/download.c:1674 #, fuzzy msgid "~Display" msgstr "Arată" #. accelerator_context(src/protocol/bittorrent/dialogs.c:bittorrent_query_callback, src/session/download.c:do_type_query) -#: src/protocol/bittorrent/dialogs.c:814 src/session/download.c:1660 +#: src/protocol/bittorrent/dialogs.c:814 src/session/download.c:1678 msgid "Show ~header" msgstr "" -#: src/protocol/file/cgi.c:40 +#: src/protocol/file/cgi.c:41 #, fuzzy msgid "Local CGI" msgstr "Fișier(e)" -#: src/protocol/file/cgi.c:42 +#: src/protocol/file/cgi.c:43 #, fuzzy msgid "Local CGI specific options." msgstr "Program nespecificat pentru" -#: src/protocol/file/cgi.c:46 +#: src/protocol/file/cgi.c:47 msgid "Colon separated list of directories, where CGI scripts are stored." msgstr "" -#: src/protocol/file/cgi.c:49 +#: src/protocol/file/cgi.c:50 msgid "Allow local CGI" msgstr "" -#: src/protocol/file/cgi.c:51 +#: src/protocol/file/cgi.c:52 msgid "Whether to execute local CGI scripts." msgstr "" #. name: -#: src/protocol/file/cgi.c:56 +#: src/protocol/file/cgi.c:57 msgid "CGI" msgstr "" @@ -8073,7 +8074,7 @@ msgid "" msgstr "" #. name: -#: src/protocol/rewrite/rewrite.c:360 +#: src/protocol/rewrite/rewrite.c:348 msgid "URI rewrite" msgstr "" @@ -8257,37 +8258,37 @@ msgstr "" msgid "~Resume download of the original file" msgstr "" -#: src/session/download.c:1556 +#: src/session/download.c:1574 msgid "Unknown type" msgstr "Tip necunoscut" -#: src/session/download.c:1581 +#: src/session/download.c:1599 #, c-format msgid "What would you like to do with the file '%s' (type: %s%s%s)?" msgstr "" -#: src/session/download.c:1584 +#: src/session/download.c:1602 #, c-format msgid "What would you like to do with the file (type: %s%s%s)?" msgstr "" -#: src/session/download.c:1612 +#: src/session/download.c:1630 #, no-c-format msgid "Program ('%' will be replaced by the filename)" msgstr "" -#: src/session/download.c:1616 +#: src/session/download.c:1634 #, fuzzy msgid "Block the terminal" msgstr "Terminal ~BeOS" -#: src/session/download.c:1622 +#: src/session/download.c:1640 #, c-format msgid "The file will be opened with the program '%s'." msgstr "" #. accelerator_context(src/session/download.c:do_type_query) -#: src/session/download.c:1643 +#: src/session/download.c:1661 #, fuzzy msgid "~Open" msgstr "Deschide" diff --git a/po/ru.po b/po/ru.po index 11420012..73c93790 100644 --- a/po/ru.po +++ b/po/ru.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: ELinks 0.5pre0.CVS\n" "Report-Msgid-Bugs-To: elinks-users@linuxfromscratch.org\n" -"POT-Creation-Date: 2020-06-26 19:00+0200\n" +"POT-Creation-Date: 2020-07-26 15:28+0200\n" "PO-Revision-Date: 2003-01-03 03:41+0100\n" "Last-Translator: Dmitry M. Klimov \n" "Language-Team: Russian \n" @@ -190,7 +190,7 @@ msgstr "Пустые строки не допускаются" #: src/dialogs/options.c:244 src/dialogs/options.c:323 src/mime/dialogs.c:133 #: src/protocol/auth/dialogs.c:160 src/protocol/bittorrent/dialogs.c:820 #: src/scripting/lua/core.c:402 src/scripting/lua/core.c:483 -#: src/session/download.c:840 src/session/download.c:1666 +#: src/session/download.c:840 src/session/download.c:1684 #: src/viewer/text/search.c:1937 #, fuzzy msgid "~Cancel" @@ -209,7 +209,7 @@ msgstr "" #: src/config/options.inc:1343 src/ecmascript/ecmascript.c:44 #: src/globhist/globhist.c:64 src/mime/backend/mailcap.c:93 #: src/mime/backend/mimetypes.c:52 src/network/ssl/ssl.c:129 -#: src/network/ssl/ssl.c:278 +#: src/network/ssl/ssl.c:282 #, fuzzy msgid "Enable" msgstr "метка" @@ -2005,7 +2005,7 @@ msgstr "" #. accelerator_context(src/config/dialogs.c:keybinding_buttons, src/config/dialogs.c:option_buttons, src/cookies/dialogs.c:cookie_buttons, src/formhist/dialogs.c:formhist_buttons, src/protocol/bittorrent/dialogs.c:bittorrent_query_callback, src/session/download.c:do_type_query, terminal_options) #: src/config/dialogs.c:505 src/config/dialogs.c:933 src/cookies/dialogs.c:543 #: src/dialogs/options.c:243 src/formhist/dialogs.c:214 -#: src/protocol/bittorrent/dialogs.c:807 src/session/download.c:1650 +#: src/protocol/bittorrent/dialogs.c:807 src/session/download.c:1668 #, fuzzy msgid "Sa~ve" msgstr "Сохранить" @@ -4591,7 +4591,7 @@ msgid "Domain" msgstr "Информация о документе" #: src/cookies/dialogs.c:41 src/mime/backend/mailcap.c:97 -#: src/mime/backend/mimetypes.c:56 src/protocol/file/cgi.c:44 +#: src/mime/backend/mimetypes.c:56 src/protocol/file/cgi.c:45 msgid "Path" msgstr "" @@ -6366,26 +6366,27 @@ msgstr "Нет программы" #: src/mime/backend/default.c:76 #, no-c-format msgid "" -"External viewer for this file type. '%' in this string will be substituted " -"by a file name. Do _not_ put single- or double-quotes around the % sign." +"External viewer for this file type. '%f' in this string will be substituted " +"by a file name, '%u' by its uri. Do _not_ put single- or double-quotes " +"around the % sign." msgstr "" -#: src/mime/backend/default.c:81 +#: src/mime/backend/default.c:82 #, fuzzy msgid "File extension associations" msgstr "Расширения файлов" -#: src/mime/backend/default.c:83 +#: src/mime/backend/default.c:84 msgid "Extension <-> MIME type association." msgstr "" -#: src/mime/backend/default.c:87 +#: src/mime/backend/default.c:88 msgid "" "MIME-type matching this file extension ('*' is used here in place of '.')." msgstr "" #. name: -#: src/mime/backend/default.c:219 +#: src/mime/backend/default.c:220 msgid "Option system" msgstr "" @@ -6515,24 +6516,24 @@ msgid "" "configuration of OpenSSL by the user." msgstr "" -#: src/network/ssl/ssl.c:121 +#: src/network/ssl/ssl.c:121 src/network/ssl/ssl.c:251 msgid "Use HTTPS by default" msgstr "" -#: src/network/ssl/ssl.c:123 +#: src/network/ssl/ssl.c:123 src/network/ssl/ssl.c:253 msgid "Use HTTPS when a URL scheme is not provided." msgstr "" -#: src/network/ssl/ssl.c:125 src/network/ssl/ssl.c:274 +#: src/network/ssl/ssl.c:125 src/network/ssl/ssl.c:278 msgid "Client Certificates" msgstr "" -#: src/network/ssl/ssl.c:127 src/network/ssl/ssl.c:276 +#: src/network/ssl/ssl.c:127 src/network/ssl/ssl.c:280 #, fuzzy msgid "X509 client certificate options." msgstr "Настройки терминала" -#: src/network/ssl/ssl.c:131 src/network/ssl/ssl.c:280 +#: src/network/ssl/ssl.c:131 src/network/ssl/ssl.c:284 msgid "" "Enable or not the sending of X509 client certificates to servers which " "request them." @@ -6556,12 +6557,12 @@ msgid "" "The database can be also shared with Mozilla browsers." msgstr "" -#: src/network/ssl/ssl.c:149 src/network/ssl/ssl.c:283 +#: src/network/ssl/ssl.c:149 src/network/ssl/ssl.c:287 #, fuzzy msgid "Certificate File" msgstr "Ожидаемое время" -#: src/network/ssl/ssl.c:151 src/network/ssl/ssl.c:285 +#: src/network/ssl/ssl.c:151 src/network/ssl/ssl.c:289 msgid "" "The location of a file containing the client certificate and unencrypted " "private key in PEM format. If unset, the file pointed to by the " @@ -6582,12 +6583,12 @@ msgstr "" #. * of binary packages should of course change the default to #. * suit their systems. #. * TODO: If the file name is relative, look in elinks_home? -#: src/network/ssl/ssl.c:259 +#: src/network/ssl/ssl.c:263 #, fuzzy msgid "Trusted CA file" msgstr "Пересылка" -#: src/network/ssl/ssl.c:266 +#: src/network/ssl/ssl.c:270 msgid "" "The location of a file containing certificates of trusted certification " "authorities in PEM format. ELinks then trusts certificates issued by these " @@ -6598,11 +6599,11 @@ msgid "" msgstr "" #. name: -#: src/network/ssl/ssl.c:306 src/network/ssl/ssl.c:323 +#: src/network/ssl/ssl.c:310 src/network/ssl/ssl.c:327 msgid "SSL" msgstr "" -#: src/network/ssl/ssl.c:308 +#: src/network/ssl/ssl.c:312 #, fuzzy msgid "SSL options." msgstr "Сохранить настройки" @@ -7543,7 +7544,7 @@ msgstr "" msgid "Information about the torrent" msgstr "Скачать изображение" -#: src/protocol/bittorrent/dialogs.c:782 src/session/download.c:1553 +#: src/protocol/bittorrent/dialogs.c:782 src/session/download.c:1571 msgid "What to do?" msgstr "Что делать?" @@ -7554,40 +7555,40 @@ msgid "Down~load" msgstr "Закачка" #. accelerator_context(src/protocol/bittorrent/dialogs.c:bittorrent_query_callback, src/session/download.c:do_type_query) -#: src/protocol/bittorrent/dialogs.c:810 src/session/download.c:1656 +#: src/protocol/bittorrent/dialogs.c:810 src/session/download.c:1674 #, fuzzy msgid "~Display" msgstr "Отобразить" #. accelerator_context(src/protocol/bittorrent/dialogs.c:bittorrent_query_callback, src/session/download.c:do_type_query) -#: src/protocol/bittorrent/dialogs.c:814 src/session/download.c:1660 +#: src/protocol/bittorrent/dialogs.c:814 src/session/download.c:1678 msgid "Show ~header" msgstr "" -#: src/protocol/file/cgi.c:40 +#: src/protocol/file/cgi.c:41 #, fuzzy msgid "Local CGI" msgstr "файлов" -#: src/protocol/file/cgi.c:42 +#: src/protocol/file/cgi.c:43 #, fuzzy msgid "Local CGI specific options." msgstr "Не указана программа для" -#: src/protocol/file/cgi.c:46 +#: src/protocol/file/cgi.c:47 msgid "Colon separated list of directories, where CGI scripts are stored." msgstr "" -#: src/protocol/file/cgi.c:49 +#: src/protocol/file/cgi.c:50 msgid "Allow local CGI" msgstr "" -#: src/protocol/file/cgi.c:51 +#: src/protocol/file/cgi.c:52 msgid "Whether to execute local CGI scripts." msgstr "" #. name: -#: src/protocol/file/cgi.c:56 +#: src/protocol/file/cgi.c:57 msgid "CGI" msgstr "" @@ -8097,7 +8098,7 @@ msgid "" msgstr "" #. name: -#: src/protocol/rewrite/rewrite.c:360 +#: src/protocol/rewrite/rewrite.c:348 msgid "URI rewrite" msgstr "" @@ -8281,37 +8282,37 @@ msgstr "" msgid "~Resume download of the original file" msgstr "" -#: src/session/download.c:1556 +#: src/session/download.c:1574 msgid "Unknown type" msgstr "Неизвестный тип" -#: src/session/download.c:1581 +#: src/session/download.c:1599 #, c-format msgid "What would you like to do with the file '%s' (type: %s%s%s)?" msgstr "" -#: src/session/download.c:1584 +#: src/session/download.c:1602 #, c-format msgid "What would you like to do with the file (type: %s%s%s)?" msgstr "" -#: src/session/download.c:1612 +#: src/session/download.c:1630 #, no-c-format msgid "Program ('%' will be replaced by the filename)" msgstr "" -#: src/session/download.c:1616 +#: src/session/download.c:1634 #, fuzzy msgid "Block the terminal" msgstr "Терминал BeOS" -#: src/session/download.c:1622 +#: src/session/download.c:1640 #, c-format msgid "The file will be opened with the program '%s'." msgstr "" #. accelerator_context(src/session/download.c:do_type_query) -#: src/session/download.c:1643 +#: src/session/download.c:1661 #, fuzzy msgid "~Open" msgstr "Открыть" diff --git a/po/sk.po b/po/sk.po index 83d37a3f..80eb27da 100644 --- a/po/sk.po +++ b/po/sk.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: ELinks 0.5pre0.CVS\n" "Report-Msgid-Bugs-To: elinks-users@linuxfromscratch.org\n" -"POT-Creation-Date: 2020-06-26 19:00+0200\n" +"POT-Creation-Date: 2020-07-26 15:28+0200\n" "PO-Revision-Date: 2004-02-13 19:07+0100\n" "Last-Translator: Peter Samek \n" "Language-Team: Slovak \n" @@ -184,7 +184,7 @@ msgstr "Prázdny reťazec je neprípustný!" #: src/dialogs/options.c:244 src/dialogs/options.c:323 src/mime/dialogs.c:133 #: src/protocol/auth/dialogs.c:160 src/protocol/bittorrent/dialogs.c:820 #: src/scripting/lua/core.c:402 src/scripting/lua/core.c:483 -#: src/session/download.c:840 src/session/download.c:1666 +#: src/session/download.c:840 src/session/download.c:1684 #: src/viewer/text/search.c:1937 #, fuzzy msgid "~Cancel" @@ -204,7 +204,7 @@ msgstr "Farba titulku dialógového okna." #: src/config/options.inc:1343 src/ecmascript/ecmascript.c:44 #: src/globhist/globhist.c:64 src/mime/backend/mailcap.c:93 #: src/mime/backend/mimetypes.c:52 src/network/ssl/ssl.c:129 -#: src/network/ssl/ssl.c:278 +#: src/network/ssl/ssl.c:282 msgid "Enable" msgstr "Zapnúť" @@ -2051,7 +2051,7 @@ msgstr "Do tejto zložky nemôžem pridať novú voľbu." #. accelerator_context(src/config/dialogs.c:keybinding_buttons, src/config/dialogs.c:option_buttons, src/cookies/dialogs.c:cookie_buttons, src/formhist/dialogs.c:formhist_buttons, src/protocol/bittorrent/dialogs.c:bittorrent_query_callback, src/session/download.c:do_type_query, terminal_options) #: src/config/dialogs.c:505 src/config/dialogs.c:933 src/cookies/dialogs.c:543 #: src/dialogs/options.c:243 src/formhist/dialogs.c:214 -#: src/protocol/bittorrent/dialogs.c:807 src/session/download.c:1650 +#: src/protocol/bittorrent/dialogs.c:807 src/session/download.c:1668 #, fuzzy msgid "Sa~ve" msgstr "Uložiť" @@ -4824,7 +4824,7 @@ msgid "Domain" msgstr "Doména" #: src/cookies/dialogs.c:41 src/mime/backend/mailcap.c:97 -#: src/mime/backend/mimetypes.c:56 src/protocol/file/cgi.c:44 +#: src/mime/backend/mimetypes.c:56 src/protocol/file/cgi.c:45 msgid "Path" msgstr "Cesta" @@ -6566,25 +6566,26 @@ msgstr "Program" #: src/mime/backend/default.c:76 #, no-c-format msgid "" -"External viewer for this file type. '%' in this string will be substituted " -"by a file name. Do _not_ put single- or double-quotes around the % sign." +"External viewer for this file type. '%f' in this string will be substituted " +"by a file name, '%u' by its uri. Do _not_ put single- or double-quotes " +"around the % sign." msgstr "" -#: src/mime/backend/default.c:81 +#: src/mime/backend/default.c:82 msgid "File extension associations" msgstr "Asociácie prípon súborov" -#: src/mime/backend/default.c:83 +#: src/mime/backend/default.c:84 msgid "Extension <-> MIME type association." msgstr "" -#: src/mime/backend/default.c:87 +#: src/mime/backend/default.c:88 msgid "" "MIME-type matching this file extension ('*' is used here in place of '.')." msgstr "" #. name: -#: src/mime/backend/default.c:219 +#: src/mime/backend/default.c:220 msgid "Option system" msgstr "" @@ -6714,23 +6715,23 @@ msgid "" "configuration of OpenSSL by the user." msgstr "" -#: src/network/ssl/ssl.c:121 +#: src/network/ssl/ssl.c:121 src/network/ssl/ssl.c:251 msgid "Use HTTPS by default" msgstr "" -#: src/network/ssl/ssl.c:123 +#: src/network/ssl/ssl.c:123 src/network/ssl/ssl.c:253 msgid "Use HTTPS when a URL scheme is not provided." msgstr "" -#: src/network/ssl/ssl.c:125 src/network/ssl/ssl.c:274 +#: src/network/ssl/ssl.c:125 src/network/ssl/ssl.c:278 msgid "Client Certificates" msgstr "" -#: src/network/ssl/ssl.c:127 src/network/ssl/ssl.c:276 +#: src/network/ssl/ssl.c:127 src/network/ssl/ssl.c:280 msgid "X509 client certificate options." msgstr "Nastavenia klientskeho X509 certifikátu." -#: src/network/ssl/ssl.c:131 src/network/ssl/ssl.c:280 +#: src/network/ssl/ssl.c:131 src/network/ssl/ssl.c:284 msgid "" "Enable or not the sending of X509 client certificates to servers which " "request them." @@ -6754,11 +6755,11 @@ msgid "" "The database can be also shared with Mozilla browsers." msgstr "" -#: src/network/ssl/ssl.c:149 src/network/ssl/ssl.c:283 +#: src/network/ssl/ssl.c:149 src/network/ssl/ssl.c:287 msgid "Certificate File" msgstr "Súbor s certifikátom" -#: src/network/ssl/ssl.c:151 src/network/ssl/ssl.c:285 +#: src/network/ssl/ssl.c:151 src/network/ssl/ssl.c:289 msgid "" "The location of a file containing the client certificate and unencrypted " "private key in PEM format. If unset, the file pointed to by the " @@ -6779,12 +6780,12 @@ msgstr "" #. * of binary packages should of course change the default to #. * suit their systems. #. * TODO: If the file name is relative, look in elinks_home? -#: src/network/ssl/ssl.c:259 +#: src/network/ssl/ssl.c:263 #, fuzzy msgid "Trusted CA file" msgstr "Prenášam" -#: src/network/ssl/ssl.c:266 +#: src/network/ssl/ssl.c:270 msgid "" "The location of a file containing certificates of trusted certification " "authorities in PEM format. ELinks then trusts certificates issued by these " @@ -6795,11 +6796,11 @@ msgid "" msgstr "" #. name: -#: src/network/ssl/ssl.c:306 src/network/ssl/ssl.c:323 +#: src/network/ssl/ssl.c:310 src/network/ssl/ssl.c:327 msgid "SSL" msgstr "SSL" -#: src/network/ssl/ssl.c:308 +#: src/network/ssl/ssl.c:312 msgid "SSL options." msgstr "Nastavenie SSL." @@ -7747,7 +7748,7 @@ msgstr "Nenašiel som odkaz obsahujúci text: '%s'." msgid "Information about the torrent" msgstr "Zobraziť informácie o aktuálnej stránke" -#: src/protocol/bittorrent/dialogs.c:782 src/session/download.c:1553 +#: src/protocol/bittorrent/dialogs.c:782 src/session/download.c:1571 msgid "What to do?" msgstr "Čo mám teda robiť?" @@ -7758,39 +7759,39 @@ msgid "Down~load" msgstr "Sťahovanie" #. accelerator_context(src/protocol/bittorrent/dialogs.c:bittorrent_query_callback, src/session/download.c:do_type_query) -#: src/protocol/bittorrent/dialogs.c:810 src/session/download.c:1656 +#: src/protocol/bittorrent/dialogs.c:810 src/session/download.c:1674 #, fuzzy msgid "~Display" msgstr "Zobraziť" #. accelerator_context(src/protocol/bittorrent/dialogs.c:bittorrent_query_callback, src/session/download.c:do_type_query) -#: src/protocol/bittorrent/dialogs.c:814 src/session/download.c:1660 +#: src/protocol/bittorrent/dialogs.c:814 src/session/download.c:1678 #, fuzzy msgid "Show ~header" msgstr "Zobrazovať šablóny" -#: src/protocol/file/cgi.c:40 +#: src/protocol/file/cgi.c:41 msgid "Local CGI" msgstr "Lokálne CGI skripty" -#: src/protocol/file/cgi.c:42 +#: src/protocol/file/cgi.c:43 msgid "Local CGI specific options." msgstr "Nastavenie spúšťania lokálnych CGI skriptov." -#: src/protocol/file/cgi.c:46 +#: src/protocol/file/cgi.c:47 msgid "Colon separated list of directories, where CGI scripts are stored." msgstr "Zoznam adresárov (oddelených dvojbodkou), kde sú uložené CGI skripty." -#: src/protocol/file/cgi.c:49 +#: src/protocol/file/cgi.c:50 msgid "Allow local CGI" msgstr "Povoliť lokálne CGI skripty" -#: src/protocol/file/cgi.c:51 +#: src/protocol/file/cgi.c:52 msgid "Whether to execute local CGI scripts." msgstr "Povolenie spúšťania lokálnych CGI skriptov." #. name: -#: src/protocol/file/cgi.c:56 +#: src/protocol/file/cgi.c:57 msgid "CGI" msgstr "" @@ -8360,7 +8361,7 @@ msgid "" msgstr "" #. name: -#: src/protocol/rewrite/rewrite.c:360 +#: src/protocol/rewrite/rewrite.c:348 msgid "URI rewrite" msgstr "" @@ -8565,37 +8566,37 @@ msgstr "Nastaviť pôvodný čas" msgid "~Resume download of the original file" msgstr "Pokúsiť sa obnoviť sťahovanie aktuálneho odkazu" -#: src/session/download.c:1556 +#: src/session/download.c:1574 msgid "Unknown type" msgstr "Neznámy typ" -#: src/session/download.c:1581 +#: src/session/download.c:1599 #, c-format msgid "What would you like to do with the file '%s' (type: %s%s%s)?" msgstr "" -#: src/session/download.c:1584 +#: src/session/download.c:1602 #, fuzzy, c-format msgid "What would you like to do with the file (type: %s%s%s)?" msgstr "Nenašiel som odkaz obsahujúci text: '%s'." -#: src/session/download.c:1612 +#: src/session/download.c:1630 #, no-c-format msgid "Program ('%' will be replaced by the filename)" msgstr "" -#: src/session/download.c:1616 +#: src/session/download.c:1634 #, fuzzy msgid "Block the terminal" msgstr "Zablokovať terminál" -#: src/session/download.c:1622 +#: src/session/download.c:1640 #, c-format msgid "The file will be opened with the program '%s'." msgstr "" #. accelerator_context(src/session/download.c:do_type_query) -#: src/session/download.c:1643 +#: src/session/download.c:1661 #, fuzzy msgid "~Open" msgstr "Otvoriť" diff --git a/po/sr.po b/po/sr.po index d511292d..e8ee3036 100644 --- a/po/sr.po +++ b/po/sr.po @@ -4,7 +4,7 @@ msgid "" msgstr "" "Project-Id-Version: ELinks 0.10.6.CVS\n" "Report-Msgid-Bugs-To: elinks-users@linuxfromscratch.org\n" -"POT-Creation-Date: 2020-06-26 19:00+0200\n" +"POT-Creation-Date: 2020-07-26 15:28+0200\n" "PO-Revision-Date: 2005-09-21 16:20+0200\n" "Last-Translator: Strahinya Radich (Страхиња Радић) \n" "Language-Team: Serbian \n" @@ -178,7 +178,7 @@ msgstr "Празна ниска није дозвољена" #: src/dialogs/options.c:244 src/dialogs/options.c:323 src/mime/dialogs.c:133 #: src/protocol/auth/dialogs.c:160 src/protocol/bittorrent/dialogs.c:820 #: src/scripting/lua/core.c:402 src/scripting/lua/core.c:483 -#: src/session/download.c:840 src/session/download.c:1666 +#: src/session/download.c:840 src/session/download.c:1684 #: src/viewer/text/search.c:1937 msgid "~Cancel" msgstr "~Поништи" @@ -195,7 +195,7 @@ msgstr "Дигитални сат у реду стања." #: src/config/options.inc:1343 src/ecmascript/ecmascript.c:44 #: src/globhist/globhist.c:64 src/mime/backend/mailcap.c:93 #: src/mime/backend/mimetypes.c:52 src/network/ssl/ssl.c:129 -#: src/network/ssl/ssl.c:278 +#: src/network/ssl/ssl.c:282 msgid "Enable" msgstr "Активирај" @@ -2075,7 +2075,7 @@ msgstr "Овде не могу да додам избор." #. accelerator_context(src/config/dialogs.c:keybinding_buttons, src/config/dialogs.c:option_buttons, src/cookies/dialogs.c:cookie_buttons, src/formhist/dialogs.c:formhist_buttons, src/protocol/bittorrent/dialogs.c:bittorrent_query_callback, src/session/download.c:do_type_query, terminal_options) #: src/config/dialogs.c:505 src/config/dialogs.c:933 src/cookies/dialogs.c:543 #: src/dialogs/options.c:243 src/formhist/dialogs.c:214 -#: src/protocol/bittorrent/dialogs.c:807 src/session/download.c:1650 +#: src/protocol/bittorrent/dialogs.c:807 src/session/download.c:1668 msgid "Sa~ve" msgstr "Сачува~ј" @@ -5058,7 +5058,7 @@ msgid "Domain" msgstr "Домен" #: src/cookies/dialogs.c:41 src/mime/backend/mailcap.c:97 -#: src/mime/backend/mimetypes.c:56 src/protocol/file/cgi.c:44 +#: src/mime/backend/mimetypes.c:56 src/protocol/file/cgi.c:45 msgid "Path" msgstr "Путања" @@ -6806,21 +6806,22 @@ msgstr "Програм" #: src/mime/backend/default.c:76 #, fuzzy, no-c-format msgid "" -"External viewer for this file type. '%' in this string will be substituted " -"by a file name. Do _not_ put single- or double-quotes around the % sign." +"External viewer for this file type. '%f' in this string will be substituted " +"by a file name, '%u' by its uri. Do _not_ put single- or double-quotes " +"around the % sign." msgstr "" "Спољашњи прегледач за ову врсту датотека. ,,%`` у овој нисци\n" "ће бити замењено називом датотеке." -#: src/mime/backend/default.c:81 +#: src/mime/backend/default.c:82 msgid "File extension associations" msgstr "Придружења наставака датотека" -#: src/mime/backend/default.c:83 +#: src/mime/backend/default.c:84 msgid "Extension <-> MIME type association." msgstr "Придружења наставак <-> врста MIME-а." -#: src/mime/backend/default.c:87 +#: src/mime/backend/default.c:88 #, fuzzy msgid "" "MIME-type matching this file extension ('*' is used here in place of '.')." @@ -6829,7 +6830,7 @@ msgstr "" "користи уместо ,,.``)." #. name: -#: src/mime/backend/default.c:219 +#: src/mime/backend/default.c:220 msgid "Option system" msgstr "Систем избора" @@ -6988,23 +6989,23 @@ msgstr "" "захтева позамашну количину подешавања OpenSSL-а од стране\n" "корисника." -#: src/network/ssl/ssl.c:121 +#: src/network/ssl/ssl.c:121 src/network/ssl/ssl.c:251 msgid "Use HTTPS by default" msgstr "" -#: src/network/ssl/ssl.c:123 +#: src/network/ssl/ssl.c:123 src/network/ssl/ssl.c:253 msgid "Use HTTPS when a URL scheme is not provided." msgstr "" -#: src/network/ssl/ssl.c:125 src/network/ssl/ssl.c:274 +#: src/network/ssl/ssl.c:125 src/network/ssl/ssl.c:278 msgid "Client Certificates" msgstr "Клијентске потврде" -#: src/network/ssl/ssl.c:127 src/network/ssl/ssl.c:276 +#: src/network/ssl/ssl.c:127 src/network/ssl/ssl.c:280 msgid "X509 client certificate options." msgstr "Избори X509 клијентске потврде." -#: src/network/ssl/ssl.c:131 src/network/ssl/ssl.c:280 +#: src/network/ssl/ssl.c:131 src/network/ssl/ssl.c:284 #, fuzzy msgid "" "Enable or not the sending of X509 client certificates to servers which " @@ -7031,11 +7032,11 @@ msgid "" "The database can be also shared with Mozilla browsers." msgstr "" -#: src/network/ssl/ssl.c:149 src/network/ssl/ssl.c:283 +#: src/network/ssl/ssl.c:149 src/network/ssl/ssl.c:287 msgid "Certificate File" msgstr "Датотека са потврдама" -#: src/network/ssl/ssl.c:151 src/network/ssl/ssl.c:285 +#: src/network/ssl/ssl.c:151 src/network/ssl/ssl.c:289 #, fuzzy msgid "" "The location of a file containing the client certificate and unencrypted " @@ -7064,12 +7065,12 @@ msgstr "" #. * of binary packages should of course change the default to #. * suit their systems. #. * TODO: If the file name is relative, look in elinks_home? -#: src/network/ssl/ssl.c:259 +#: src/network/ssl/ssl.c:263 #, fuzzy msgid "Trusted CA file" msgstr "Пренос није успео" -#: src/network/ssl/ssl.c:266 +#: src/network/ssl/ssl.c:270 msgid "" "The location of a file containing certificates of trusted certification " "authorities in PEM format. ELinks then trusts certificates issued by these " @@ -7080,11 +7081,11 @@ msgid "" msgstr "" #. name: -#: src/network/ssl/ssl.c:306 src/network/ssl/ssl.c:323 +#: src/network/ssl/ssl.c:310 src/network/ssl/ssl.c:327 msgid "SSL" msgstr "SSL" -#: src/network/ssl/ssl.c:308 +#: src/network/ssl/ssl.c:312 msgid "SSL options." msgstr "Избори SSL-а." @@ -8040,7 +8041,7 @@ msgstr "Да ли бисте желели да прикажем датотеку msgid "Information about the torrent" msgstr "Приказивање података о текућој страници" -#: src/protocol/bittorrent/dialogs.c:782 src/session/download.c:1553 +#: src/protocol/bittorrent/dialogs.c:782 src/session/download.c:1571 msgid "What to do?" msgstr "Шта да радим?" @@ -8051,39 +8052,39 @@ msgid "Down~load" msgstr "Преузимање" #. accelerator_context(src/protocol/bittorrent/dialogs.c:bittorrent_query_callback, src/session/download.c:do_type_query) -#: src/protocol/bittorrent/dialogs.c:810 src/session/download.c:1656 +#: src/protocol/bittorrent/dialogs.c:810 src/session/download.c:1674 msgid "~Display" msgstr "Прика~жи" #. accelerator_context(src/protocol/bittorrent/dialogs.c:bittorrent_query_callback, src/session/download.c:do_type_query) -#: src/protocol/bittorrent/dialogs.c:814 src/session/download.c:1660 +#: src/protocol/bittorrent/dialogs.c:814 src/session/download.c:1678 msgid "Show ~header" msgstr "Прикажи ~заглавље" -#: src/protocol/file/cgi.c:40 +#: src/protocol/file/cgi.c:41 msgid "Local CGI" msgstr "Локални CGI" -#: src/protocol/file/cgi.c:42 +#: src/protocol/file/cgi.c:43 msgid "Local CGI specific options." msgstr "Избори у вези са локалним CGI-јем." -#: src/protocol/file/cgi.c:46 +#: src/protocol/file/cgi.c:47 msgid "Colon separated list of directories, where CGI scripts are stored." msgstr "" "Списак директоријума у којима су смештени CGI списи,\n" "раздвојених двотачкама." -#: src/protocol/file/cgi.c:49 +#: src/protocol/file/cgi.c:50 msgid "Allow local CGI" msgstr "Дозвољавање локалног CGI-ја" -#: src/protocol/file/cgi.c:51 +#: src/protocol/file/cgi.c:52 msgid "Whether to execute local CGI scripts." msgstr "Да ли ће извршавати локалне CGI списе." #. name: -#: src/protocol/file/cgi.c:56 +#: src/protocol/file/cgi.c:57 msgid "CGI" msgstr "" @@ -8718,7 +8719,7 @@ msgid "" msgstr "" #. name: -#: src/protocol/rewrite/rewrite.c:360 +#: src/protocol/rewrite/rewrite.c:348 msgid "URI rewrite" msgstr "Мењање УРИ-ја" @@ -8931,37 +8932,37 @@ msgstr "Препи~ши преко првобитне датотеке" msgid "~Resume download of the original file" msgstr "Настави преузи~мање оригиналне датотеке" -#: src/session/download.c:1556 +#: src/session/download.c:1574 msgid "Unknown type" msgstr "Непозната врста" -#: src/session/download.c:1581 +#: src/session/download.c:1599 #, fuzzy, c-format msgid "What would you like to do with the file '%s' (type: %s%s%s)?" msgstr "Да ли бисте желели да прикажем датотеку ,,%s`` (врсте %s)?" -#: src/session/download.c:1584 +#: src/session/download.c:1602 #, fuzzy, c-format msgid "What would you like to do with the file (type: %s%s%s)?" msgstr "Да ли бисте желели да прикажем датотеку ,,%s`` (врсте %s)?" -#: src/session/download.c:1612 +#: src/session/download.c:1630 #, no-c-format msgid "Program ('%' will be replaced by the filename)" msgstr "" -#: src/session/download.c:1616 +#: src/session/download.c:1634 #, fuzzy msgid "Block the terminal" msgstr "Блокирање терминала" -#: src/session/download.c:1622 +#: src/session/download.c:1640 #, c-format msgid "The file will be opened with the program '%s'." msgstr "" #. accelerator_context(src/session/download.c:do_type_query) -#: src/session/download.c:1643 +#: src/session/download.c:1661 msgid "~Open" msgstr "~Отвори" diff --git a/po/sv.po b/po/sv.po index b844e0f3..cf36e75b 100644 --- a/po/sv.po +++ b/po/sv.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: ELinks 0.5pre0.CVS\n" "Report-Msgid-Bugs-To: elinks-users@linuxfromscratch.org\n" -"POT-Creation-Date: 2020-06-26 19:00+0200\n" +"POT-Creation-Date: 2020-07-26 15:28+0200\n" "PO-Revision-Date: 2003-01-03 03:41+0100\n" "Last-Translator: Martin Norback \n" "Language-Team: Swedish \n" @@ -187,7 +187,7 @@ msgstr "Tom sträng ej tillåten" #: src/dialogs/options.c:244 src/dialogs/options.c:323 src/mime/dialogs.c:133 #: src/protocol/auth/dialogs.c:160 src/protocol/bittorrent/dialogs.c:820 #: src/scripting/lua/core.c:402 src/scripting/lua/core.c:483 -#: src/session/download.c:840 src/session/download.c:1666 +#: src/session/download.c:840 src/session/download.c:1684 #: src/viewer/text/search.c:1937 #, fuzzy msgid "~Cancel" @@ -206,7 +206,7 @@ msgstr "" #: src/config/options.inc:1343 src/ecmascript/ecmascript.c:44 #: src/globhist/globhist.c:64 src/mime/backend/mailcap.c:93 #: src/mime/backend/mimetypes.c:52 src/network/ssl/ssl.c:129 -#: src/network/ssl/ssl.c:278 +#: src/network/ssl/ssl.c:282 #, fuzzy msgid "Enable" msgstr "Namn" @@ -1997,7 +1997,7 @@ msgstr "" #. accelerator_context(src/config/dialogs.c:keybinding_buttons, src/config/dialogs.c:option_buttons, src/cookies/dialogs.c:cookie_buttons, src/formhist/dialogs.c:formhist_buttons, src/protocol/bittorrent/dialogs.c:bittorrent_query_callback, src/session/download.c:do_type_query, terminal_options) #: src/config/dialogs.c:505 src/config/dialogs.c:933 src/cookies/dialogs.c:543 #: src/dialogs/options.c:243 src/formhist/dialogs.c:214 -#: src/protocol/bittorrent/dialogs.c:807 src/session/download.c:1650 +#: src/protocol/bittorrent/dialogs.c:807 src/session/download.c:1668 #, fuzzy msgid "Sa~ve" msgstr "Spara" @@ -4576,7 +4576,7 @@ msgid "Domain" msgstr "Dokument~information" #: src/cookies/dialogs.c:41 src/mime/backend/mailcap.c:97 -#: src/mime/backend/mimetypes.c:56 src/protocol/file/cgi.c:44 +#: src/mime/backend/mimetypes.c:56 src/protocol/file/cgi.c:45 msgid "Path" msgstr "" @@ -6345,26 +6345,27 @@ msgstr "Inget program" #: src/mime/backend/default.c:76 #, no-c-format msgid "" -"External viewer for this file type. '%' in this string will be substituted " -"by a file name. Do _not_ put single- or double-quotes around the % sign." +"External viewer for this file type. '%f' in this string will be substituted " +"by a file name, '%u' by its uri. Do _not_ put single- or double-quotes " +"around the % sign." msgstr "" -#: src/mime/backend/default.c:81 +#: src/mime/backend/default.c:82 #, fuzzy msgid "File extension associations" msgstr "Filänd~elser" -#: src/mime/backend/default.c:83 +#: src/mime/backend/default.c:84 msgid "Extension <-> MIME type association." msgstr "" -#: src/mime/backend/default.c:87 +#: src/mime/backend/default.c:88 msgid "" "MIME-type matching this file extension ('*' is used here in place of '.')." msgstr "" #. name: -#: src/mime/backend/default.c:219 +#: src/mime/backend/default.c:220 msgid "Option system" msgstr "" @@ -6494,24 +6495,24 @@ msgid "" "configuration of OpenSSL by the user." msgstr "" -#: src/network/ssl/ssl.c:121 +#: src/network/ssl/ssl.c:121 src/network/ssl/ssl.c:251 msgid "Use HTTPS by default" msgstr "" -#: src/network/ssl/ssl.c:123 +#: src/network/ssl/ssl.c:123 src/network/ssl/ssl.c:253 msgid "Use HTTPS when a URL scheme is not provided." msgstr "" -#: src/network/ssl/ssl.c:125 src/network/ssl/ssl.c:274 +#: src/network/ssl/ssl.c:125 src/network/ssl/ssl.c:278 msgid "Client Certificates" msgstr "" -#: src/network/ssl/ssl.c:127 src/network/ssl/ssl.c:276 +#: src/network/ssl/ssl.c:127 src/network/ssl/ssl.c:280 #, fuzzy msgid "X509 client certificate options." msgstr "Terminalalternativ" -#: src/network/ssl/ssl.c:131 src/network/ssl/ssl.c:280 +#: src/network/ssl/ssl.c:131 src/network/ssl/ssl.c:284 msgid "" "Enable or not the sending of X509 client certificates to servers which " "request them." @@ -6535,12 +6536,12 @@ msgid "" "The database can be also shared with Mozilla browsers." msgstr "" -#: src/network/ssl/ssl.c:149 src/network/ssl/ssl.c:283 +#: src/network/ssl/ssl.c:149 src/network/ssl/ssl.c:287 #, fuzzy msgid "Certificate File" msgstr "uppskattad tid" -#: src/network/ssl/ssl.c:151 src/network/ssl/ssl.c:285 +#: src/network/ssl/ssl.c:151 src/network/ssl/ssl.c:289 msgid "" "The location of a file containing the client certificate and unencrypted " "private key in PEM format. If unset, the file pointed to by the " @@ -6561,12 +6562,12 @@ msgstr "" #. * of binary packages should of course change the default to #. * suit their systems. #. * TODO: If the file name is relative, look in elinks_home? -#: src/network/ssl/ssl.c:259 +#: src/network/ssl/ssl.c:263 #, fuzzy msgid "Trusted CA file" msgstr "Skickar" -#: src/network/ssl/ssl.c:266 +#: src/network/ssl/ssl.c:270 msgid "" "The location of a file containing certificates of trusted certification " "authorities in PEM format. ELinks then trusts certificates issued by these " @@ -6577,11 +6578,11 @@ msgid "" msgstr "" #. name: -#: src/network/ssl/ssl.c:306 src/network/ssl/ssl.c:323 +#: src/network/ssl/ssl.c:310 src/network/ssl/ssl.c:327 msgid "SSL" msgstr "" -#: src/network/ssl/ssl.c:308 +#: src/network/ssl/ssl.c:312 #, fuzzy msgid "SSL options." msgstr "~Spara alternativ" @@ -7523,7 +7524,7 @@ msgstr "" msgid "Information about the torrent" msgstr "Hämta bild" -#: src/protocol/bittorrent/dialogs.c:782 src/session/download.c:1553 +#: src/protocol/bittorrent/dialogs.c:782 src/session/download.c:1571 msgid "What to do?" msgstr "Vad skall jag göra?" @@ -7534,40 +7535,40 @@ msgid "Down~load" msgstr "Hämta" #. accelerator_context(src/protocol/bittorrent/dialogs.c:bittorrent_query_callback, src/session/download.c:do_type_query) -#: src/protocol/bittorrent/dialogs.c:810 src/session/download.c:1656 +#: src/protocol/bittorrent/dialogs.c:810 src/session/download.c:1674 #, fuzzy msgid "~Display" msgstr "Visa" #. accelerator_context(src/protocol/bittorrent/dialogs.c:bittorrent_query_callback, src/session/download.c:do_type_query) -#: src/protocol/bittorrent/dialogs.c:814 src/session/download.c:1660 +#: src/protocol/bittorrent/dialogs.c:814 src/session/download.c:1678 msgid "Show ~header" msgstr "" -#: src/protocol/file/cgi.c:40 +#: src/protocol/file/cgi.c:41 #, fuzzy msgid "Local CGI" msgstr "filer" -#: src/protocol/file/cgi.c:42 +#: src/protocol/file/cgi.c:43 #, fuzzy msgid "Local CGI specific options." msgstr "Inget program angett för" -#: src/protocol/file/cgi.c:46 +#: src/protocol/file/cgi.c:47 msgid "Colon separated list of directories, where CGI scripts are stored." msgstr "" -#: src/protocol/file/cgi.c:49 +#: src/protocol/file/cgi.c:50 msgid "Allow local CGI" msgstr "" -#: src/protocol/file/cgi.c:51 +#: src/protocol/file/cgi.c:52 msgid "Whether to execute local CGI scripts." msgstr "" #. name: -#: src/protocol/file/cgi.c:56 +#: src/protocol/file/cgi.c:57 msgid "CGI" msgstr "" @@ -8075,7 +8076,7 @@ msgid "" msgstr "" #. name: -#: src/protocol/rewrite/rewrite.c:360 +#: src/protocol/rewrite/rewrite.c:348 msgid "URI rewrite" msgstr "" @@ -8259,37 +8260,37 @@ msgstr "" msgid "~Resume download of the original file" msgstr "" -#: src/session/download.c:1556 +#: src/session/download.c:1574 msgid "Unknown type" msgstr "Okänd typ" -#: src/session/download.c:1581 +#: src/session/download.c:1599 #, c-format msgid "What would you like to do with the file '%s' (type: %s%s%s)?" msgstr "" -#: src/session/download.c:1584 +#: src/session/download.c:1602 #, c-format msgid "What would you like to do with the file (type: %s%s%s)?" msgstr "" -#: src/session/download.c:1612 +#: src/session/download.c:1630 #, no-c-format msgid "Program ('%' will be replaced by the filename)" msgstr "" -#: src/session/download.c:1616 +#: src/session/download.c:1634 #, fuzzy msgid "Block the terminal" msgstr "~BeOS-terminal" -#: src/session/download.c:1622 +#: src/session/download.c:1640 #, c-format msgid "The file will be opened with the program '%s'." msgstr "" #. accelerator_context(src/session/download.c:do_type_query) -#: src/session/download.c:1643 +#: src/session/download.c:1661 #, fuzzy msgid "~Open" msgstr "Öppna" diff --git a/po/tr.po b/po/tr.po index c2057acc..ceae9217 100644 --- a/po/tr.po +++ b/po/tr.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: ELinks 0.5pre0.CVS\n" "Report-Msgid-Bugs-To: elinks-users@linuxfromscratch.org\n" -"POT-Creation-Date: 2020-06-26 19:00+0200\n" +"POT-Creation-Date: 2020-07-26 15:28+0200\n" "PO-Revision-Date: 2003-01-03 03:41+0100\n" "Last-Translator: Baris Metin \n" "Language-Team: Turkish \n" @@ -186,7 +186,7 @@ msgstr "Boş söz dizimine izin verilmiyor" #: src/dialogs/options.c:244 src/dialogs/options.c:323 src/mime/dialogs.c:133 #: src/protocol/auth/dialogs.c:160 src/protocol/bittorrent/dialogs.c:820 #: src/scripting/lua/core.c:402 src/scripting/lua/core.c:483 -#: src/session/download.c:840 src/session/download.c:1666 +#: src/session/download.c:840 src/session/download.c:1684 #: src/viewer/text/search.c:1937 #, fuzzy msgid "~Cancel" @@ -205,7 +205,7 @@ msgstr "" #: src/config/options.inc:1343 src/ecmascript/ecmascript.c:44 #: src/globhist/globhist.c:64 src/mime/backend/mailcap.c:93 #: src/mime/backend/mimetypes.c:52 src/network/ssl/ssl.c:129 -#: src/network/ssl/ssl.c:278 +#: src/network/ssl/ssl.c:282 #, fuzzy msgid "Enable" msgstr "isim" @@ -1996,7 +1996,7 @@ msgstr "" #. accelerator_context(src/config/dialogs.c:keybinding_buttons, src/config/dialogs.c:option_buttons, src/cookies/dialogs.c:cookie_buttons, src/formhist/dialogs.c:formhist_buttons, src/protocol/bittorrent/dialogs.c:bittorrent_query_callback, src/session/download.c:do_type_query, terminal_options) #: src/config/dialogs.c:505 src/config/dialogs.c:933 src/cookies/dialogs.c:543 #: src/dialogs/options.c:243 src/formhist/dialogs.c:214 -#: src/protocol/bittorrent/dialogs.c:807 src/session/download.c:1650 +#: src/protocol/bittorrent/dialogs.c:807 src/session/download.c:1668 #, fuzzy msgid "Sa~ve" msgstr "Kaydet" @@ -4575,7 +4575,7 @@ msgid "Domain" msgstr "~Belge bilgisi" #: src/cookies/dialogs.c:41 src/mime/backend/mailcap.c:97 -#: src/mime/backend/mimetypes.c:56 src/protocol/file/cgi.c:44 +#: src/mime/backend/mimetypes.c:56 src/protocol/file/cgi.c:45 msgid "Path" msgstr "" @@ -6343,26 +6343,27 @@ msgstr "Program yok" #: src/mime/backend/default.c:76 #, no-c-format msgid "" -"External viewer for this file type. '%' in this string will be substituted " -"by a file name. Do _not_ put single- or double-quotes around the % sign." +"External viewer for this file type. '%f' in this string will be substituted " +"by a file name, '%u' by its uri. Do _not_ put single- or double-quotes " +"around the % sign." msgstr "" -#: src/mime/backend/default.c:81 +#: src/mime/backend/default.c:82 #, fuzzy msgid "File extension associations" msgstr "Dosya ~uzantıları" -#: src/mime/backend/default.c:83 +#: src/mime/backend/default.c:84 msgid "Extension <-> MIME type association." msgstr "" -#: src/mime/backend/default.c:87 +#: src/mime/backend/default.c:88 msgid "" "MIME-type matching this file extension ('*' is used here in place of '.')." msgstr "" #. name: -#: src/mime/backend/default.c:219 +#: src/mime/backend/default.c:220 msgid "Option system" msgstr "" @@ -6492,24 +6493,24 @@ msgid "" "configuration of OpenSSL by the user." msgstr "" -#: src/network/ssl/ssl.c:121 +#: src/network/ssl/ssl.c:121 src/network/ssl/ssl.c:251 msgid "Use HTTPS by default" msgstr "" -#: src/network/ssl/ssl.c:123 +#: src/network/ssl/ssl.c:123 src/network/ssl/ssl.c:253 msgid "Use HTTPS when a URL scheme is not provided." msgstr "" -#: src/network/ssl/ssl.c:125 src/network/ssl/ssl.c:274 +#: src/network/ssl/ssl.c:125 src/network/ssl/ssl.c:278 msgid "Client Certificates" msgstr "" -#: src/network/ssl/ssl.c:127 src/network/ssl/ssl.c:276 +#: src/network/ssl/ssl.c:127 src/network/ssl/ssl.c:280 #, fuzzy msgid "X509 client certificate options." msgstr "Terminal seçenekleri" -#: src/network/ssl/ssl.c:131 src/network/ssl/ssl.c:280 +#: src/network/ssl/ssl.c:131 src/network/ssl/ssl.c:284 msgid "" "Enable or not the sending of X509 client certificates to servers which " "request them." @@ -6533,12 +6534,12 @@ msgid "" "The database can be also shared with Mozilla browsers." msgstr "" -#: src/network/ssl/ssl.c:149 src/network/ssl/ssl.c:283 +#: src/network/ssl/ssl.c:149 src/network/ssl/ssl.c:287 #, fuzzy msgid "Certificate File" msgstr "Hesaplanan zaman" -#: src/network/ssl/ssl.c:151 src/network/ssl/ssl.c:285 +#: src/network/ssl/ssl.c:151 src/network/ssl/ssl.c:289 msgid "" "The location of a file containing the client certificate and unencrypted " "private key in PEM format. If unset, the file pointed to by the " @@ -6559,12 +6560,12 @@ msgstr "" #. * of binary packages should of course change the default to #. * suit their systems. #. * TODO: If the file name is relative, look in elinks_home? -#: src/network/ssl/ssl.c:259 +#: src/network/ssl/ssl.c:263 #, fuzzy msgid "Trusted CA file" msgstr "Transfer ediliyor" -#: src/network/ssl/ssl.c:266 +#: src/network/ssl/ssl.c:270 msgid "" "The location of a file containing certificates of trusted certification " "authorities in PEM format. ELinks then trusts certificates issued by these " @@ -6575,11 +6576,11 @@ msgid "" msgstr "" #. name: -#: src/network/ssl/ssl.c:306 src/network/ssl/ssl.c:323 +#: src/network/ssl/ssl.c:310 src/network/ssl/ssl.c:327 msgid "SSL" msgstr "" -#: src/network/ssl/ssl.c:308 +#: src/network/ssl/ssl.c:312 #, fuzzy msgid "SSL options." msgstr "Seçenekleri ka~ydet" @@ -7519,7 +7520,7 @@ msgstr "" msgid "Information about the torrent" msgstr "Resmi in~dir" -#: src/protocol/bittorrent/dialogs.c:782 src/session/download.c:1553 +#: src/protocol/bittorrent/dialogs.c:782 src/session/download.c:1571 msgid "What to do?" msgstr "Ne yapacaksınız?" @@ -7530,40 +7531,40 @@ msgid "Down~load" msgstr "İndir" #. accelerator_context(src/protocol/bittorrent/dialogs.c:bittorrent_query_callback, src/session/download.c:do_type_query) -#: src/protocol/bittorrent/dialogs.c:810 src/session/download.c:1656 +#: src/protocol/bittorrent/dialogs.c:810 src/session/download.c:1674 #, fuzzy msgid "~Display" msgstr "Görüntüle" #. accelerator_context(src/protocol/bittorrent/dialogs.c:bittorrent_query_callback, src/session/download.c:do_type_query) -#: src/protocol/bittorrent/dialogs.c:814 src/session/download.c:1660 +#: src/protocol/bittorrent/dialogs.c:814 src/session/download.c:1678 msgid "Show ~header" msgstr "" -#: src/protocol/file/cgi.c:40 +#: src/protocol/file/cgi.c:41 #, fuzzy msgid "Local CGI" msgstr "dosyalar" -#: src/protocol/file/cgi.c:42 +#: src/protocol/file/cgi.c:43 #, fuzzy msgid "Local CGI specific options." msgstr "Program belirlenmemiş:" -#: src/protocol/file/cgi.c:46 +#: src/protocol/file/cgi.c:47 msgid "Colon separated list of directories, where CGI scripts are stored." msgstr "" -#: src/protocol/file/cgi.c:49 +#: src/protocol/file/cgi.c:50 msgid "Allow local CGI" msgstr "" -#: src/protocol/file/cgi.c:51 +#: src/protocol/file/cgi.c:52 msgid "Whether to execute local CGI scripts." msgstr "" #. name: -#: src/protocol/file/cgi.c:56 +#: src/protocol/file/cgi.c:57 msgid "CGI" msgstr "" @@ -8071,7 +8072,7 @@ msgid "" msgstr "" #. name: -#: src/protocol/rewrite/rewrite.c:360 +#: src/protocol/rewrite/rewrite.c:348 msgid "URI rewrite" msgstr "" @@ -8255,37 +8256,37 @@ msgstr "" msgid "~Resume download of the original file" msgstr "" -#: src/session/download.c:1556 +#: src/session/download.c:1574 msgid "Unknown type" msgstr "Bilinmeyen tür" -#: src/session/download.c:1581 +#: src/session/download.c:1599 #, c-format msgid "What would you like to do with the file '%s' (type: %s%s%s)?" msgstr "" -#: src/session/download.c:1584 +#: src/session/download.c:1602 #, c-format msgid "What would you like to do with the file (type: %s%s%s)?" msgstr "" -#: src/session/download.c:1612 +#: src/session/download.c:1630 #, no-c-format msgid "Program ('%' will be replaced by the filename)" msgstr "" -#: src/session/download.c:1616 +#: src/session/download.c:1634 #, fuzzy msgid "Block the terminal" msgstr "~BeOS terminali" -#: src/session/download.c:1622 +#: src/session/download.c:1640 #, c-format msgid "The file will be opened with the program '%s'." msgstr "" #. accelerator_context(src/session/download.c:do_type_query) -#: src/session/download.c:1643 +#: src/session/download.c:1661 #, fuzzy msgid "~Open" msgstr "Aç" diff --git a/po/uk.po b/po/uk.po index c541ebd2..cb45d88e 100644 --- a/po/uk.po +++ b/po/uk.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: ELinks 0.5pre0.CVS\n" "Report-Msgid-Bugs-To: elinks-users@linuxfromscratch.org\n" -"POT-Creation-Date: 2020-06-26 19:00+0200\n" +"POT-Creation-Date: 2020-07-26 15:28+0200\n" "PO-Revision-Date: 2003-01-03 03:41+0100\n" "Last-Translator: Dmitry Pinchukov \n" "Language-Team: Ukrainian \n" @@ -202,7 +202,7 @@ msgstr "Порожні рядки неприпустимі" #: src/dialogs/options.c:244 src/dialogs/options.c:323 src/mime/dialogs.c:133 #: src/protocol/auth/dialogs.c:160 src/protocol/bittorrent/dialogs.c:820 #: src/scripting/lua/core.c:402 src/scripting/lua/core.c:483 -#: src/session/download.c:840 src/session/download.c:1666 +#: src/session/download.c:840 src/session/download.c:1684 #: src/viewer/text/search.c:1937 #, fuzzy msgid "~Cancel" @@ -221,7 +221,7 @@ msgstr "" #: src/config/options.inc:1343 src/ecmascript/ecmascript.c:44 #: src/globhist/globhist.c:64 src/mime/backend/mailcap.c:93 #: src/mime/backend/mimetypes.c:52 src/network/ssl/ssl.c:129 -#: src/network/ssl/ssl.c:278 +#: src/network/ssl/ssl.c:282 #, fuzzy msgid "Enable" msgstr "ім'я" @@ -2020,7 +2020,7 @@ msgstr "Тут неможливо додати опцію." #. accelerator_context(src/config/dialogs.c:keybinding_buttons, src/config/dialogs.c:option_buttons, src/cookies/dialogs.c:cookie_buttons, src/formhist/dialogs.c:formhist_buttons, src/protocol/bittorrent/dialogs.c:bittorrent_query_callback, src/session/download.c:do_type_query, terminal_options) #: src/config/dialogs.c:505 src/config/dialogs.c:933 src/cookies/dialogs.c:543 #: src/dialogs/options.c:243 src/formhist/dialogs.c:214 -#: src/protocol/bittorrent/dialogs.c:807 src/session/download.c:1650 +#: src/protocol/bittorrent/dialogs.c:807 src/session/download.c:1668 #, fuzzy msgid "Sa~ve" msgstr "Зберегти" @@ -4613,7 +4613,7 @@ msgid "Domain" msgstr "Інформація про документ" #: src/cookies/dialogs.c:41 src/mime/backend/mailcap.c:97 -#: src/mime/backend/mimetypes.c:56 src/protocol/file/cgi.c:44 +#: src/mime/backend/mimetypes.c:56 src/protocol/file/cgi.c:45 msgid "Path" msgstr "" @@ -6418,26 +6418,27 @@ msgstr "Немає програми" #: src/mime/backend/default.c:76 #, no-c-format msgid "" -"External viewer for this file type. '%' in this string will be substituted " -"by a file name. Do _not_ put single- or double-quotes around the % sign." +"External viewer for this file type. '%f' in this string will be substituted " +"by a file name, '%u' by its uri. Do _not_ put single- or double-quotes " +"around the % sign." msgstr "" -#: src/mime/backend/default.c:81 +#: src/mime/backend/default.c:82 #, fuzzy msgid "File extension associations" msgstr "Розширення файлів" -#: src/mime/backend/default.c:83 +#: src/mime/backend/default.c:84 msgid "Extension <-> MIME type association." msgstr "" -#: src/mime/backend/default.c:87 +#: src/mime/backend/default.c:88 msgid "" "MIME-type matching this file extension ('*' is used here in place of '.')." msgstr "" #. name: -#: src/mime/backend/default.c:219 +#: src/mime/backend/default.c:220 msgid "Option system" msgstr "" @@ -6567,24 +6568,24 @@ msgid "" "configuration of OpenSSL by the user." msgstr "" -#: src/network/ssl/ssl.c:121 +#: src/network/ssl/ssl.c:121 src/network/ssl/ssl.c:251 msgid "Use HTTPS by default" msgstr "" -#: src/network/ssl/ssl.c:123 +#: src/network/ssl/ssl.c:123 src/network/ssl/ssl.c:253 msgid "Use HTTPS when a URL scheme is not provided." msgstr "" -#: src/network/ssl/ssl.c:125 src/network/ssl/ssl.c:274 +#: src/network/ssl/ssl.c:125 src/network/ssl/ssl.c:278 msgid "Client Certificates" msgstr "" -#: src/network/ssl/ssl.c:127 src/network/ssl/ssl.c:276 +#: src/network/ssl/ssl.c:127 src/network/ssl/ssl.c:280 #, fuzzy msgid "X509 client certificate options." msgstr "Параметри термiналу" -#: src/network/ssl/ssl.c:131 src/network/ssl/ssl.c:280 +#: src/network/ssl/ssl.c:131 src/network/ssl/ssl.c:284 msgid "" "Enable or not the sending of X509 client certificates to servers which " "request them." @@ -6608,12 +6609,12 @@ msgid "" "The database can be also shared with Mozilla browsers." msgstr "" -#: src/network/ssl/ssl.c:149 src/network/ssl/ssl.c:283 +#: src/network/ssl/ssl.c:149 src/network/ssl/ssl.c:287 #, fuzzy msgid "Certificate File" msgstr "Очікуваний час" -#: src/network/ssl/ssl.c:151 src/network/ssl/ssl.c:285 +#: src/network/ssl/ssl.c:151 src/network/ssl/ssl.c:289 msgid "" "The location of a file containing the client certificate and unencrypted " "private key in PEM format. If unset, the file pointed to by the " @@ -6634,12 +6635,12 @@ msgstr "" #. * of binary packages should of course change the default to #. * suit their systems. #. * TODO: If the file name is relative, look in elinks_home? -#: src/network/ssl/ssl.c:259 +#: src/network/ssl/ssl.c:263 #, fuzzy msgid "Trusted CA file" msgstr "Передача" -#: src/network/ssl/ssl.c:266 +#: src/network/ssl/ssl.c:270 msgid "" "The location of a file containing certificates of trusted certification " "authorities in PEM format. ELinks then trusts certificates issued by these " @@ -6650,11 +6651,11 @@ msgid "" msgstr "" #. name: -#: src/network/ssl/ssl.c:306 src/network/ssl/ssl.c:323 +#: src/network/ssl/ssl.c:310 src/network/ssl/ssl.c:327 msgid "SSL" msgstr "" -#: src/network/ssl/ssl.c:308 +#: src/network/ssl/ssl.c:312 #, fuzzy msgid "SSL options." msgstr "Зберегти параметри" @@ -7602,7 +7603,7 @@ msgstr "" msgid "Information about the torrent" msgstr "Показати інформацію про поточну сторінку" -#: src/protocol/bittorrent/dialogs.c:782 src/session/download.c:1553 +#: src/protocol/bittorrent/dialogs.c:782 src/session/download.c:1571 msgid "What to do?" msgstr "Що робити?" @@ -7613,40 +7614,40 @@ msgid "Down~load" msgstr "Завантаження" #. accelerator_context(src/protocol/bittorrent/dialogs.c:bittorrent_query_callback, src/session/download.c:do_type_query) -#: src/protocol/bittorrent/dialogs.c:810 src/session/download.c:1656 +#: src/protocol/bittorrent/dialogs.c:810 src/session/download.c:1674 #, fuzzy msgid "~Display" msgstr "Показати" #. accelerator_context(src/protocol/bittorrent/dialogs.c:bittorrent_query_callback, src/session/download.c:do_type_query) -#: src/protocol/bittorrent/dialogs.c:814 src/session/download.c:1660 +#: src/protocol/bittorrent/dialogs.c:814 src/session/download.c:1678 msgid "Show ~header" msgstr "" -#: src/protocol/file/cgi.c:40 +#: src/protocol/file/cgi.c:41 #, fuzzy msgid "Local CGI" msgstr "файлів" -#: src/protocol/file/cgi.c:42 +#: src/protocol/file/cgi.c:43 #, fuzzy msgid "Local CGI specific options." msgstr "Не вказано програму для" -#: src/protocol/file/cgi.c:46 +#: src/protocol/file/cgi.c:47 msgid "Colon separated list of directories, where CGI scripts are stored." msgstr "" -#: src/protocol/file/cgi.c:49 +#: src/protocol/file/cgi.c:50 msgid "Allow local CGI" msgstr "" -#: src/protocol/file/cgi.c:51 +#: src/protocol/file/cgi.c:52 msgid "Whether to execute local CGI scripts." msgstr "" #. name: -#: src/protocol/file/cgi.c:56 +#: src/protocol/file/cgi.c:57 msgid "CGI" msgstr "" @@ -8156,7 +8157,7 @@ msgid "" msgstr "" #. name: -#: src/protocol/rewrite/rewrite.c:360 +#: src/protocol/rewrite/rewrite.c:348 msgid "URI rewrite" msgstr "" @@ -8343,37 +8344,37 @@ msgstr "" msgid "~Resume download of the original file" msgstr "Спробувати відновити завантаження поточного посилання" -#: src/session/download.c:1556 +#: src/session/download.c:1574 msgid "Unknown type" msgstr "Невідомий тип" -#: src/session/download.c:1581 +#: src/session/download.c:1599 #, c-format msgid "What would you like to do with the file '%s' (type: %s%s%s)?" msgstr "" -#: src/session/download.c:1584 +#: src/session/download.c:1602 #, c-format msgid "What would you like to do with the file (type: %s%s%s)?" msgstr "" -#: src/session/download.c:1612 +#: src/session/download.c:1630 #, no-c-format msgid "Program ('%' will be replaced by the filename)" msgstr "" -#: src/session/download.c:1616 +#: src/session/download.c:1634 #, fuzzy msgid "Block the terminal" msgstr "Термінал BeOS" -#: src/session/download.c:1622 +#: src/session/download.c:1640 #, c-format msgid "The file will be opened with the program '%s'." msgstr "" #. accelerator_context(src/session/download.c:do_type_query) -#: src/session/download.c:1643 +#: src/session/download.c:1661 #, fuzzy msgid "~Open" msgstr "Відкрити" From 911155a862761a48ac977759f9d76ae3ff770f91 Mon Sep 17 00:00:00 2001 From: Witold Filipczyk Date: Mon, 27 Jul 2020 22:38:54 +0200 Subject: [PATCH 003/179] [clipboard] Added "ui.clipboard_file" to add text to the system clipboard. ui.clipboard_file is filename of the clipboard file. This file can be a named pipe. See contrib/clipboard/clip.sh how to set up copying to clipboard using socat and xclip. Just run clip.sh (it will be running in a loop) before starting elinks and set ui.clipboard_file = "~/.elinks/clipboard.fifo". --- contrib/clipboard/clip.sh | 8 ++++++++ src/config/options.inc | 4 ++++ src/osdep/osdep.c | 22 ++++++++++++++++++++++ 3 files changed, 34 insertions(+) create mode 100755 contrib/clipboard/clip.sh diff --git a/contrib/clipboard/clip.sh b/contrib/clipboard/clip.sh new file mode 100755 index 00000000..9398f98d --- /dev/null +++ b/contrib/clipboard/clip.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +trap exit SIGTERM SIGINT + +while true +do + socat -u PIPE:$HOME/.elinks/clipboard.fifo EXEC:"xclip -sel clip" +done diff --git a/src/config/options.inc b/src/config/options.inc index a31ee5ce..b77b7add 100644 --- a/src/config/options.inc +++ b/src/config/options.inc @@ -1459,6 +1459,10 @@ static union option_info config_options_info[] = { N_("Keep the session active even if the last terminal " "exits.")), + INIT_OPT_STRING("ui", N_("Clipboard file"), + "clipboard_file", 0, "", + N_("Filename of the clipboard file.")), + #ifdef HAVE_STRFTIME INIT_OPT_STRING("ui", N_("Date format"), "date_format", 0, "%b %e %H:%M", diff --git a/src/osdep/osdep.c b/src/osdep/osdep.c index b355d5d1..934e14b7 100644 --- a/src/osdep/osdep.c +++ b/src/osdep/osdep.c @@ -67,11 +67,13 @@ #include "elinks.h" +#include "config/options.h" #include "main/select.h" #include "osdep/osdep.h" #include "osdep/signals.h" #include "terminal/terminal.h" #include "util/conv.h" +#include "util/file.h" #include "util/memory.h" #include "util/string.h" @@ -403,6 +405,26 @@ get_clipboard_text(void) void set_clipboard_text(unsigned char *data) { + unsigned char *f = get_opt_str("ui.clipboard_file", NULL); + + if (f && *f) { + unsigned char *filename = expand_tilde(f); + + if (filename) { +#ifdef HAVE_ACCESS + if (access(filename, W_OK) >= 0) { + FILE *out = fopen(filename, "a"); + + if (out) { + fputs(data, out); + fclose(out); + } + } +#endif + mem_free(filename); + } + } + /* GNU Screen's clipboard */ if (is_gnuscreen()) { struct string str; From e5725787655db49aceab7b93d85625bd4a566d84 Mon Sep 17 00:00:00 2001 From: Witold Filipczyk Date: Fri, 31 Jul 2020 14:28:34 +0200 Subject: [PATCH 004/179] [clipboard] Without HAVE_ACCESS this fragment does not make sense. --- src/osdep/osdep.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/osdep/osdep.c b/src/osdep/osdep.c index 934e14b7..a8369094 100644 --- a/src/osdep/osdep.c +++ b/src/osdep/osdep.c @@ -405,13 +405,13 @@ get_clipboard_text(void) void set_clipboard_text(unsigned char *data) { +#ifdef HAVE_ACCESS unsigned char *f = get_opt_str("ui.clipboard_file", NULL); if (f && *f) { unsigned char *filename = expand_tilde(f); if (filename) { -#ifdef HAVE_ACCESS if (access(filename, W_OK) >= 0) { FILE *out = fopen(filename, "a"); @@ -420,10 +420,10 @@ set_clipboard_text(unsigned char *data) fclose(out); } } -#endif mem_free(filename); } } +#endif /* GNU Screen's clipboard */ if (is_gnuscreen()) { From 79560c32060fd4cb30bc833b16e819fd4a191cc1 Mon Sep 17 00:00:00 2001 From: Witold Filipczyk Date: Fri, 31 Jul 2020 14:43:36 +0200 Subject: [PATCH 005/179] [options] Changed text for ui.clipboard_file --- src/config/options.inc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/config/options.inc b/src/config/options.inc index b77b7add..4a0c8658 100644 --- a/src/config/options.inc +++ b/src/config/options.inc @@ -1459,9 +1459,11 @@ static union option_info config_options_info[] = { N_("Keep the session active even if the last terminal " "exits.")), - INIT_OPT_STRING("ui", N_("Clipboard file"), + INIT_OPT_STRING("ui", N_("Clipboard filename"), "clipboard_file", 0, "", - N_("Filename of the clipboard file.")), + N_("The filename of the clipboard. The 'copy-clipboard' action will append to it. " + "This file can be also a named pipe. See contrib/clipboard/clip.sh for sample " + "implementation. Note this file must exists before copying to the clipboard.")), #ifdef HAVE_STRFTIME INIT_OPT_STRING("ui", N_("Date format"), From 87c25bc6883784537262f9eef98758f893cdbf66 Mon Sep 17 00:00:00 2001 From: Witold Filipczyk Date: Fri, 31 Jul 2020 14:51:20 +0200 Subject: [PATCH 006/179] [po] update --- po/af.po | 27 ++++++++++++++++++++------- po/be.po | 27 ++++++++++++++++++++------- po/bg.po | 27 ++++++++++++++++++++------- po/ca.po | 27 ++++++++++++++++++++------- po/cs.po | 31 ++++++++++++++++++++++++------- po/da.po | 31 ++++++++++++++++++++++++------- po/de.po | 31 ++++++++++++++++++++++++------- po/el.po | 27 ++++++++++++++++++++------- po/es.po | 27 ++++++++++++++++++++------- po/et.po | 27 ++++++++++++++++++++------- po/fi.po | 31 ++++++++++++++++++++++++------- po/fr.po | 31 ++++++++++++++++++++++++------- po/gl.po | 27 ++++++++++++++++++++------- po/hr.po | 27 ++++++++++++++++++++------- po/hu.po | 31 ++++++++++++++++++++++++------- po/id.po | 27 ++++++++++++++++++++------- po/is.po | 27 ++++++++++++++++++++------- po/it.po | 31 ++++++++++++++++++++++++------- po/ja.po | 26 +++++++++++++++++++------- po/lt.po | 27 ++++++++++++++++++++------- po/nb.po | 27 ++++++++++++++++++++------- po/nl.po | 27 ++++++++++++++++++++------- po/pl.po | 34 +++++++++++++++++++++++++++------- po/pt.po | 27 ++++++++++++++++++++------- po/pt_BR.po | 27 ++++++++++++++++++++------- po/ro.po | 27 ++++++++++++++++++++------- po/ru.po | 27 ++++++++++++++++++++------- po/sk.po | 31 ++++++++++++++++++++++++------- po/sr.po | 31 ++++++++++++++++++++++++------- po/sv.po | 27 ++++++++++++++++++++------- po/tr.po | 27 ++++++++++++++++++++------- po/uk.po | 31 ++++++++++++++++++++++++------- 32 files changed, 686 insertions(+), 224 deletions(-) diff --git a/po/af.po b/po/af.po index 40226523..751d9adc 100644 --- a/po/af.po +++ b/po/af.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: 0.12\n" "Report-Msgid-Bugs-To: elinks-users@linuxfromscratch.org\n" -"POT-Creation-Date: 2020-07-26 15:28+0200\n" +"POT-Creation-Date: 2020-07-31 14:44+0200\n" "PO-Revision-Date: 2006-09-25 17:13+0200\n" "Last-Translator: Friedel Wolff \n" "Language-Team: \n" @@ -4224,28 +4224,41 @@ msgstr "" msgid "Keep the session active even if the last terminal exits." msgstr "" -#: src/config/options.inc:1463 +#: src/config/options.inc:1462 +#, fuzzy +msgid "Clipboard filename" +msgstr "%ld lêer" + +#: src/config/options.inc:1464 +msgid "" +"The filename of the clipboard. The 'copy-clipboard' action will append to " +"it. This file can be also a named pipe. See contrib/clipboard/clip.sh for " +"sample implementation. Note this file must exists before copying to the " +"clipboard." +msgstr "" + +#: src/config/options.inc:1469 msgid "Date format" msgstr "Datumformaat" -#: src/config/options.inc:1465 +#: src/config/options.inc:1471 msgid "Date format to use in dialogs. See strftime(3)." msgstr "Datumformaat om in dialoë te gebruik. Sien strftime(3)." #. date added -#: src/config/options.inc:1470 +#: src/config/options.inc:1476 msgid "Disable mouse" msgstr "" -#: src/config/options.inc:1472 +#: src/config/options.inc:1478 msgid "Disable mouse. Changes take effect at the next elinks restart." msgstr "" -#: src/config/options.inc:1476 +#: src/config/options.inc:1482 msgid "Set window title" msgstr "Stel venstertitel" -#: src/config/options.inc:1478 +#: src/config/options.inc:1484 msgid "" "Set the window title when running in a windowing environment in an xterm-" "like terminal. This way the document's title is shown on the window titlebar." diff --git a/po/be.po b/po/be.po index ca0a93de..92522443 100644 --- a/po/be.po +++ b/po/be.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: ELinks 0.5pre0.CVS\n" "Report-Msgid-Bugs-To: elinks-users@linuxfromscratch.org\n" -"POT-Creation-Date: 2020-07-26 15:28+0200\n" +"POT-Creation-Date: 2020-07-31 14:44+0200\n" "PO-Revision-Date: 2003-01-03 03:41+0100\n" "Last-Translator: Yevgeny Gromov \n" "Language-Team: Belarusian \n" @@ -4403,30 +4403,43 @@ msgstr "" msgid "Keep the session active even if the last terminal exits." msgstr "" -#: src/config/options.inc:1463 +#: src/config/options.inc:1462 +#, fuzzy +msgid "Clipboard filename" +msgstr "файлаў" + +#: src/config/options.inc:1464 +msgid "" +"The filename of the clipboard. The 'copy-clipboard' action will append to " +"it. This file can be also a named pipe. See contrib/clipboard/clip.sh for " +"sample implementation. Note this file must exists before copying to the " +"clipboard." +msgstr "" + +#: src/config/options.inc:1469 #, fuzzy msgid "Date format" msgstr "Выгрузка файла" -#: src/config/options.inc:1465 +#: src/config/options.inc:1471 msgid "Date format to use in dialogs. See strftime(3)." msgstr "" #. date added -#: src/config/options.inc:1470 +#: src/config/options.inc:1476 msgid "Disable mouse" msgstr "" -#: src/config/options.inc:1472 +#: src/config/options.inc:1478 msgid "Disable mouse. Changes take effect at the next elinks restart." msgstr "" -#: src/config/options.inc:1476 +#: src/config/options.inc:1482 #, fuzzy msgid "Set window title" msgstr "Загаловак спасылкі" -#: src/config/options.inc:1478 +#: src/config/options.inc:1484 msgid "" "Set the window title when running in a windowing environment in an xterm-" "like terminal. This way the document's title is shown on the window titlebar." diff --git a/po/bg.po b/po/bg.po index 569eb1fa..2470af8d 100644 --- a/po/bg.po +++ b/po/bg.po @@ -10,7 +10,7 @@ msgid "" msgstr "" "Project-Id-Version: ELinks 0.5pre0.CVS\n" "Report-Msgid-Bugs-To: elinks-users@linuxfromscratch.org\n" -"POT-Creation-Date: 2020-07-26 15:28+0200\n" +"POT-Creation-Date: 2020-07-31 14:44+0200\n" "PO-Revision-Date: 2003-01-03 03:41+0100\n" "Last-Translator: Dimitar Dimitrov \n" "Language-Team: Bulgarian \n" @@ -4430,30 +4430,43 @@ msgstr "" msgid "Keep the session active even if the last terminal exits." msgstr "" -#: src/config/options.inc:1463 +#: src/config/options.inc:1462 +#, fuzzy +msgid "Clipboard filename" +msgstr "файла" + +#: src/config/options.inc:1464 +msgid "" +"The filename of the clipboard. The 'copy-clipboard' action will append to " +"it. This file can be also a named pipe. See contrib/clipboard/clip.sh for " +"sample implementation. Note this file must exists before copying to the " +"clipboard." +msgstr "" + +#: src/config/options.inc:1469 #, fuzzy msgid "Date format" msgstr "Качване (upload) на файл" -#: src/config/options.inc:1465 +#: src/config/options.inc:1471 msgid "Date format to use in dialogs. See strftime(3)." msgstr "" #. date added -#: src/config/options.inc:1470 +#: src/config/options.inc:1476 msgid "Disable mouse" msgstr "" -#: src/config/options.inc:1472 +#: src/config/options.inc:1478 msgid "Disable mouse. Changes take effect at the next elinks restart." msgstr "" -#: src/config/options.inc:1476 +#: src/config/options.inc:1482 #, fuzzy msgid "Set window title" msgstr "Заглавие на връзката" -#: src/config/options.inc:1478 +#: src/config/options.inc:1484 msgid "" "Set the window title when running in a windowing environment in an xterm-" "like terminal. This way the document's title is shown on the window titlebar." diff --git a/po/ca.po b/po/ca.po index e50d4ada..650bf083 100644 --- a/po/ca.po +++ b/po/ca.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: ELinks 0.5pre0.CVS\n" "Report-Msgid-Bugs-To: elinks-users@linuxfromscratch.org\n" -"POT-Creation-Date: 2020-07-26 15:28+0200\n" +"POT-Creation-Date: 2020-07-31 14:44+0200\n" "PO-Revision-Date: 2003-01-03 03:41+0100\n" "Last-Translator: Carles Sadurní Anguita \n" "Language-Team: Catalan \n" @@ -4377,29 +4377,42 @@ msgstr "" msgid "Keep the session active even if the last terminal exits." msgstr "" -#: src/config/options.inc:1463 +#: src/config/options.inc:1462 +#, fuzzy +msgid "Clipboard filename" +msgstr "fitxers" + +#: src/config/options.inc:1464 +msgid "" +"The filename of the clipboard. The 'copy-clipboard' action will append to " +"it. This file can be also a named pipe. See contrib/clipboard/clip.sh for " +"sample implementation. Note this file must exists before copying to the " +"clipboard." +msgstr "" + +#: src/config/options.inc:1469 #, fuzzy msgid "Date format" msgstr "Trametre fitxer" -#: src/config/options.inc:1465 +#: src/config/options.inc:1471 msgid "Date format to use in dialogs. See strftime(3)." msgstr "" #. date added -#: src/config/options.inc:1470 +#: src/config/options.inc:1476 msgid "Disable mouse" msgstr "" -#: src/config/options.inc:1472 +#: src/config/options.inc:1478 msgid "Disable mouse. Changes take effect at the next elinks restart." msgstr "" -#: src/config/options.inc:1476 +#: src/config/options.inc:1482 msgid "Set window title" msgstr "" -#: src/config/options.inc:1478 +#: src/config/options.inc:1484 msgid "" "Set the window title when running in a windowing environment in an xterm-" "like terminal. This way the document's title is shown on the window titlebar." diff --git a/po/cs.po b/po/cs.po index ccfaf5f8..df922dfc 100644 --- a/po/cs.po +++ b/po/cs.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: ELinks 0.5pre0.CVS\n" "Report-Msgid-Bugs-To: elinks-users@linuxfromscratch.org\n" -"POT-Creation-Date: 2020-07-26 15:28+0200\n" +"POT-Creation-Date: 2020-07-31 14:44+0200\n" "PO-Revision-Date: 2005-01-04 00:42+0100\n" "Last-Translator: Petr Baudis \n" "Language-Team: Czech \n" @@ -4640,30 +4640,43 @@ msgstr "Rozlišovat velikost písmen" msgid "Keep the session active even if the last terminal exits." msgstr "" -#: src/config/options.inc:1463 +#: src/config/options.inc:1462 +#, fuzzy +msgid "Clipboard filename" +msgstr "Lokální soubory" + +#: src/config/options.inc:1464 +msgid "" +"The filename of the clipboard. The 'copy-clipboard' action will append to " +"it. This file can be also a named pipe. See contrib/clipboard/clip.sh for " +"sample implementation. Note this file must exists before copying to the " +"clipboard." +msgstr "" + +#: src/config/options.inc:1469 msgid "Date format" msgstr "Formát datumu" -#: src/config/options.inc:1465 +#: src/config/options.inc:1471 msgid "Date format to use in dialogs. See strftime(3)." msgstr "" "Formát datumu, který se má použít v dialozích.\n" "Viz dokumentaci k strftime(3)." #. date added -#: src/config/options.inc:1470 +#: src/config/options.inc:1476 msgid "Disable mouse" msgstr "" -#: src/config/options.inc:1472 +#: src/config/options.inc:1478 msgid "Disable mouse. Changes take effect at the next elinks restart." msgstr "" -#: src/config/options.inc:1476 +#: src/config/options.inc:1482 msgid "Set window title" msgstr "Nastavovat titulek okna" -#: src/config/options.inc:1478 +#: src/config/options.inc:1484 #, fuzzy msgid "" "Set the window title when running in a windowing environment in an xterm-" @@ -9216,6 +9229,10 @@ msgstr "Titulek" msgid "Viewer" msgstr "~Zobrazení" +#, fuzzy +#~ msgid "Filename of the clipboard file." +#~ msgstr "Vložit text ze schránky" + #, fuzzy #~ msgid "FSP specific options." #~ msgstr "Nastavení FTP." diff --git a/po/da.po b/po/da.po index b86f457e..2e948325 100644 --- a/po/da.po +++ b/po/da.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: ELinks 0.10.CVS\n" "Report-Msgid-Bugs-To: elinks-users@linuxfromscratch.org\n" -"POT-Creation-Date: 2020-07-26 15:28+0200\n" +"POT-Creation-Date: 2020-07-31 14:44+0200\n" "PO-Revision-Date: 2005-06-12 02:00+0200\n" "Last-Translator: Jonas Fonseca \n" "Language-Team: Danish \n" @@ -4797,28 +4797,41 @@ msgstr "Hold sessionen aktiv" msgid "Keep the session active even if the last terminal exits." msgstr "Hold sessionen aktiv selv hvis den sidste terminal afslutter." -#: src/config/options.inc:1463 +#: src/config/options.inc:1462 +#, fuzzy +msgid "Clipboard filename" +msgstr "%ld fil" + +#: src/config/options.inc:1464 +msgid "" +"The filename of the clipboard. The 'copy-clipboard' action will append to " +"it. This file can be also a named pipe. See contrib/clipboard/clip.sh for " +"sample implementation. Note this file must exists before copying to the " +"clipboard." +msgstr "" + +#: src/config/options.inc:1469 msgid "Date format" msgstr "Datoformat" -#: src/config/options.inc:1465 +#: src/config/options.inc:1471 msgid "Date format to use in dialogs. See strftime(3)." msgstr "Datoformat i dialoger. Se strftime(3)." #. date added -#: src/config/options.inc:1470 +#: src/config/options.inc:1476 msgid "Disable mouse" msgstr "" -#: src/config/options.inc:1472 +#: src/config/options.inc:1478 msgid "Disable mouse. Changes take effect at the next elinks restart." msgstr "" -#: src/config/options.inc:1476 +#: src/config/options.inc:1482 msgid "Set window title" msgstr "Sæt vinduestitel" -#: src/config/options.inc:1478 +#: src/config/options.inc:1484 #, fuzzy msgid "" "Set the window title when running in a windowing environment in an xterm-" @@ -9384,6 +9397,10 @@ msgstr "Stopur" msgid "Viewer" msgstr "Fremviser" +#, fuzzy +#~ msgid "Filename of the clipboard file." +#~ msgstr "Kopiér tekst fra klippebord" + #~ msgid "FSP specific options." #~ msgstr "FSP-specifikke indstillinger." diff --git a/po/de.po b/po/de.po index da986fde..366fbc42 100644 --- a/po/de.po +++ b/po/de.po @@ -10,7 +10,7 @@ msgid "" msgstr "" "Project-Id-Version: ELinks 0.9.CVS\n" "Report-Msgid-Bugs-To: elinks-users@linuxfromscratch.org\n" -"POT-Creation-Date: 2020-07-26 15:28+0200\n" +"POT-Creation-Date: 2020-07-31 14:44+0200\n" "PO-Revision-Date: 2005-06-14 20:52+0200\n" "Last-Translator: Jens Seidel \n" "Language-Team: German \n" @@ -4749,28 +4749,41 @@ msgstr "Groß-/Kleinschreibung beachten" msgid "Keep the session active even if the last terminal exits." msgstr "" -#: src/config/options.inc:1463 +#: src/config/options.inc:1462 +#, fuzzy +msgid "Clipboard filename" +msgstr "Lokale Datei" + +#: src/config/options.inc:1464 +msgid "" +"The filename of the clipboard. The 'copy-clipboard' action will append to " +"it. This file can be also a named pipe. See contrib/clipboard/clip.sh for " +"sample implementation. Note this file must exists before copying to the " +"clipboard." +msgstr "" + +#: src/config/options.inc:1469 msgid "Date format" msgstr "Datums-Format" -#: src/config/options.inc:1465 +#: src/config/options.inc:1471 msgid "Date format to use in dialogs. See strftime(3)." msgstr "Datums-Format zur Benutzung in Dialogen. Siehe strftime()" #. date added -#: src/config/options.inc:1470 +#: src/config/options.inc:1476 msgid "Disable mouse" msgstr "" -#: src/config/options.inc:1472 +#: src/config/options.inc:1478 msgid "Disable mouse. Changes take effect at the next elinks restart." msgstr "" -#: src/config/options.inc:1476 +#: src/config/options.inc:1482 msgid "Set window title" msgstr "Fenstertitel setzen" -#: src/config/options.inc:1478 +#: src/config/options.inc:1484 #, fuzzy msgid "" "Set the window title when running in a windowing environment in an xterm-" @@ -9388,6 +9401,10 @@ msgstr "Titel" msgid "Viewer" msgstr "~Anzeige" +#, fuzzy +#~ msgid "Filename of the clipboard file." +#~ msgstr "Text aus der Zwischenablage einfügen" + #, fuzzy #~ msgid "FSP specific options." #~ msgstr "FTP-spezifische Optionen." diff --git a/po/el.po b/po/el.po index 8401bced..00a2bdf0 100644 --- a/po/el.po +++ b/po/el.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: ELinks 0.5pre0.CVS\n" "Report-Msgid-Bugs-To: elinks-users@linuxfromscratch.org\n" -"POT-Creation-Date: 2020-07-26 15:28+0200\n" +"POT-Creation-Date: 2020-07-31 14:44+0200\n" "PO-Revision-Date: 2003-01-03 03:41+0100\n" "Last-Translator: Simos Xenitellis \n" "Language-Team: Greek \n" @@ -4377,29 +4377,42 @@ msgstr "" msgid "Keep the session active even if the last terminal exits." msgstr "" -#: src/config/options.inc:1463 +#: src/config/options.inc:1462 +#, fuzzy +msgid "Clipboard filename" +msgstr "αρχεία" + +#: src/config/options.inc:1464 +msgid "" +"The filename of the clipboard. The 'copy-clipboard' action will append to " +"it. This file can be also a named pipe. See contrib/clipboard/clip.sh for " +"sample implementation. Note this file must exists before copying to the " +"clipboard." +msgstr "" + +#: src/config/options.inc:1469 #, fuzzy msgid "Date format" msgstr "Ανέβασμα αρχείου" -#: src/config/options.inc:1465 +#: src/config/options.inc:1471 msgid "Date format to use in dialogs. See strftime(3)." msgstr "" #. date added -#: src/config/options.inc:1470 +#: src/config/options.inc:1476 msgid "Disable mouse" msgstr "" -#: src/config/options.inc:1472 +#: src/config/options.inc:1478 msgid "Disable mouse. Changes take effect at the next elinks restart." msgstr "" -#: src/config/options.inc:1476 +#: src/config/options.inc:1482 msgid "Set window title" msgstr "" -#: src/config/options.inc:1478 +#: src/config/options.inc:1484 msgid "" "Set the window title when running in a windowing environment in an xterm-" "like terminal. This way the document's title is shown on the window titlebar." diff --git a/po/es.po b/po/es.po index 127f4da2..c283f510 100644 --- a/po/es.po +++ b/po/es.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: ELinks 0.5pre0.CVS\n" "Report-Msgid-Bugs-To: elinks-users@linuxfromscratch.org\n" -"POT-Creation-Date: 2020-07-26 15:28+0200\n" +"POT-Creation-Date: 2020-07-31 14:44+0200\n" "PO-Revision-Date: 2003-01-03 03:41+0100\n" "Last-Translator: David Mediavilla \n" "Language-Team: Spanish \n" @@ -4395,30 +4395,43 @@ msgstr "" msgid "Keep the session active even if the last terminal exits." msgstr "" -#: src/config/options.inc:1463 +#: src/config/options.inc:1462 +#, fuzzy +msgid "Clipboard filename" +msgstr "ficheros" + +#: src/config/options.inc:1464 +msgid "" +"The filename of the clipboard. The 'copy-clipboard' action will append to " +"it. This file can be also a named pipe. See contrib/clipboard/clip.sh for " +"sample implementation. Note this file must exists before copying to the " +"clipboard." +msgstr "" + +#: src/config/options.inc:1469 #, fuzzy msgid "Date format" msgstr "Enviar fichero" -#: src/config/options.inc:1465 +#: src/config/options.inc:1471 msgid "Date format to use in dialogs. See strftime(3)." msgstr "" #. date added -#: src/config/options.inc:1470 +#: src/config/options.inc:1476 msgid "Disable mouse" msgstr "" -#: src/config/options.inc:1472 +#: src/config/options.inc:1478 msgid "Disable mouse. Changes take effect at the next elinks restart." msgstr "" -#: src/config/options.inc:1476 +#: src/config/options.inc:1482 #, fuzzy msgid "Set window title" msgstr "Título del enlace" -#: src/config/options.inc:1478 +#: src/config/options.inc:1484 msgid "" "Set the window title when running in a windowing environment in an xterm-" "like terminal. This way the document's title is shown on the window titlebar." diff --git a/po/et.po b/po/et.po index 73054011..0ab35e22 100644 --- a/po/et.po +++ b/po/et.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: ELinks 0.5pre0.CVS\n" "Report-Msgid-Bugs-To: elinks-users@linuxfromscratch.org\n" -"POT-Creation-Date: 2020-07-26 15:28+0200\n" +"POT-Creation-Date: 2020-07-31 14:44+0200\n" "PO-Revision-Date: 2003-01-03 03:41+0100\n" "Last-Translator: Taniel Kirikal \n" "Language-Team: Estonian \n" @@ -4376,29 +4376,42 @@ msgstr "" msgid "Keep the session active even if the last terminal exits." msgstr "" -#: src/config/options.inc:1463 +#: src/config/options.inc:1462 +#, fuzzy +msgid "Clipboard filename" +msgstr "faile" + +#: src/config/options.inc:1464 +msgid "" +"The filename of the clipboard. The 'copy-clipboard' action will append to " +"it. This file can be also a named pipe. See contrib/clipboard/clip.sh for " +"sample implementation. Note this file must exists before copying to the " +"clipboard." +msgstr "" + +#: src/config/options.inc:1469 #, fuzzy msgid "Date format" msgstr "Faili üles laadimine" -#: src/config/options.inc:1465 +#: src/config/options.inc:1471 msgid "Date format to use in dialogs. See strftime(3)." msgstr "" #. date added -#: src/config/options.inc:1470 +#: src/config/options.inc:1476 msgid "Disable mouse" msgstr "" -#: src/config/options.inc:1472 +#: src/config/options.inc:1478 msgid "Disable mouse. Changes take effect at the next elinks restart." msgstr "" -#: src/config/options.inc:1476 +#: src/config/options.inc:1482 msgid "Set window title" msgstr "" -#: src/config/options.inc:1478 +#: src/config/options.inc:1484 msgid "" "Set the window title when running in a windowing environment in an xterm-" "like terminal. This way the document's title is shown on the window titlebar." diff --git a/po/fi.po b/po/fi.po index aec412fe..eed7579b 100644 --- a/po/fi.po +++ b/po/fi.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: ELinks 0.12.GIT\n" "Report-Msgid-Bugs-To: elinks-users@linuxfromscratch.org\n" -"POT-Creation-Date: 2020-07-26 15:28+0200\n" +"POT-Creation-Date: 2020-07-31 14:44+0200\n" "PO-Revision-Date: 2009-03-24 00:31+0200\n" "Last-Translator: Kalle Olavi Niemitalo \n" "Language-Team: Finnish \n" @@ -4355,28 +4355,41 @@ msgstr "Jätä istunto aktiiviseksi" msgid "Keep the session active even if the last terminal exits." msgstr "" -#: src/config/options.inc:1463 +#: src/config/options.inc:1462 +#, fuzzy +msgid "Clipboard filename" +msgstr "%ld tiedosto" + +#: src/config/options.inc:1464 +msgid "" +"The filename of the clipboard. The 'copy-clipboard' action will append to " +"it. This file can be also a named pipe. See contrib/clipboard/clip.sh for " +"sample implementation. Note this file must exists before copying to the " +"clipboard." +msgstr "" + +#: src/config/options.inc:1469 msgid "Date format" msgstr "Päiväyksen muoto" -#: src/config/options.inc:1465 +#: src/config/options.inc:1471 msgid "Date format to use in dialogs. See strftime(3)." msgstr "" #. date added -#: src/config/options.inc:1470 +#: src/config/options.inc:1476 msgid "Disable mouse" msgstr "" -#: src/config/options.inc:1472 +#: src/config/options.inc:1478 msgid "Disable mouse. Changes take effect at the next elinks restart." msgstr "" -#: src/config/options.inc:1476 +#: src/config/options.inc:1482 msgid "Set window title" msgstr "Aseta ikkunan otsikko" -#: src/config/options.inc:1478 +#: src/config/options.inc:1484 msgid "" "Set the window title when running in a windowing environment in an xterm-" "like terminal. This way the document's title is shown on the window titlebar." @@ -8655,6 +8668,10 @@ msgstr "Ajastin" msgid "Viewer" msgstr "" +#, fuzzy +#~ msgid "Filename of the clipboard file." +#~ msgstr "Liitä teksti leikepöydältä" + #, fuzzy #~ msgid "FSP specific options." #~ msgstr "Ei ohjelmaa osoitettu" diff --git a/po/fr.po b/po/fr.po index 259b2c37..cafb02c3 100644 --- a/po/fr.po +++ b/po/fr.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: ELinks 0.12.GIT\n" "Report-Msgid-Bugs-To: elinks-users@linuxfromscratch.org\n" -"POT-Creation-Date: 2020-07-26 15:28+0200\n" +"POT-Creation-Date: 2020-07-31 14:44+0200\n" "PO-Revision-Date: 2009-06-02 23:58+0200\n" "Last-Translator: Mikael Berthe \n" "MIME-Version: 1.0\n" @@ -4730,28 +4730,41 @@ msgstr "Garder la session active" msgid "Keep the session active even if the last terminal exits." msgstr "Garder la session active même si le dernier terminal est clos." -#: src/config/options.inc:1463 +#: src/config/options.inc:1462 +#, fuzzy +msgid "Clipboard filename" +msgstr "%ld fichier" + +#: src/config/options.inc:1464 +msgid "" +"The filename of the clipboard. The 'copy-clipboard' action will append to " +"it. This file can be also a named pipe. See contrib/clipboard/clip.sh for " +"sample implementation. Note this file must exists before copying to the " +"clipboard." +msgstr "" + +#: src/config/options.inc:1469 msgid "Date format" msgstr "Format des dates" -#: src/config/options.inc:1465 +#: src/config/options.inc:1471 msgid "Date format to use in dialogs. See strftime(3)." msgstr "Format utilisé pour les dates dans les dialogues. Voir strftime(3)." #. date added -#: src/config/options.inc:1470 +#: src/config/options.inc:1476 msgid "Disable mouse" msgstr "" -#: src/config/options.inc:1472 +#: src/config/options.inc:1478 msgid "Disable mouse. Changes take effect at the next elinks restart." msgstr "" -#: src/config/options.inc:1476 +#: src/config/options.inc:1482 msgid "Set window title" msgstr "Modifier le titre de la fenêtre" -#: src/config/options.inc:1478 +#: src/config/options.inc:1484 msgid "" "Set the window title when running in a windowing environment in an xterm-" "like terminal. This way the document's title is shown on the window titlebar." @@ -9354,6 +9367,10 @@ msgstr "Chronomètre" msgid "Viewer" msgstr "Visionneur" +#, fuzzy +#~ msgid "Filename of the clipboard file." +#~ msgstr "Coller le texte du tampon" + #~ msgid "SEE" #~ msgstr "SEE" diff --git a/po/gl.po b/po/gl.po index 8abc1826..904c283a 100644 --- a/po/gl.po +++ b/po/gl.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: ELinks 0.5pre0.CVS\n" "Report-Msgid-Bugs-To: elinks-users@linuxfromscratch.org\n" -"POT-Creation-Date: 2020-07-26 15:28+0200\n" +"POT-Creation-Date: 2020-07-31 14:44+0200\n" "PO-Revision-Date: 2003-01-03 03:41+0100\n" "Last-Translator: Alberto García \n" "Language-Team: Galician \n" @@ -4376,29 +4376,42 @@ msgstr "" msgid "Keep the session active even if the last terminal exits." msgstr "" -#: src/config/options.inc:1463 +#: src/config/options.inc:1462 +#, fuzzy +msgid "Clipboard filename" +msgstr "ficheiros" + +#: src/config/options.inc:1464 +msgid "" +"The filename of the clipboard. The 'copy-clipboard' action will append to " +"it. This file can be also a named pipe. See contrib/clipboard/clip.sh for " +"sample implementation. Note this file must exists before copying to the " +"clipboard." +msgstr "" + +#: src/config/options.inc:1469 #, fuzzy msgid "Date format" msgstr "Enviar ficheiro" -#: src/config/options.inc:1465 +#: src/config/options.inc:1471 msgid "Date format to use in dialogs. See strftime(3)." msgstr "" #. date added -#: src/config/options.inc:1470 +#: src/config/options.inc:1476 msgid "Disable mouse" msgstr "" -#: src/config/options.inc:1472 +#: src/config/options.inc:1478 msgid "Disable mouse. Changes take effect at the next elinks restart." msgstr "" -#: src/config/options.inc:1476 +#: src/config/options.inc:1482 msgid "Set window title" msgstr "" -#: src/config/options.inc:1478 +#: src/config/options.inc:1484 msgid "" "Set the window title when running in a windowing environment in an xterm-" "like terminal. This way the document's title is shown on the window titlebar." diff --git a/po/hr.po b/po/hr.po index 904a76f7..8382a7c7 100644 --- a/po/hr.po +++ b/po/hr.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: ELinks 0.5pre0.CVS\n" "Report-Msgid-Bugs-To: elinks-users@linuxfromscratch.org\n" -"POT-Creation-Date: 2020-07-26 15:28+0200\n" +"POT-Creation-Date: 2020-07-31 14:44+0200\n" "PO-Revision-Date: 2003-01-03 03:41+0100\n" "Last-Translator: Denis Lackovic \n" "Language-Team: Croatian \n" @@ -4377,29 +4377,42 @@ msgstr "" msgid "Keep the session active even if the last terminal exits." msgstr "" -#: src/config/options.inc:1463 +#: src/config/options.inc:1462 +#, fuzzy +msgid "Clipboard filename" +msgstr "datoteke" + +#: src/config/options.inc:1464 +msgid "" +"The filename of the clipboard. The 'copy-clipboard' action will append to " +"it. This file can be also a named pipe. See contrib/clipboard/clip.sh for " +"sample implementation. Note this file must exists before copying to the " +"clipboard." +msgstr "" + +#: src/config/options.inc:1469 #, fuzzy msgid "Date format" msgstr "Pošalji datoteku" -#: src/config/options.inc:1465 +#: src/config/options.inc:1471 msgid "Date format to use in dialogs. See strftime(3)." msgstr "" #. date added -#: src/config/options.inc:1470 +#: src/config/options.inc:1476 msgid "Disable mouse" msgstr "" -#: src/config/options.inc:1472 +#: src/config/options.inc:1478 msgid "Disable mouse. Changes take effect at the next elinks restart." msgstr "" -#: src/config/options.inc:1476 +#: src/config/options.inc:1482 msgid "Set window title" msgstr "" -#: src/config/options.inc:1478 +#: src/config/options.inc:1484 msgid "" "Set the window title when running in a windowing environment in an xterm-" "like terminal. This way the document's title is shown on the window titlebar." diff --git a/po/hu.po b/po/hu.po index 288a05cc..f72f7cd2 100644 --- a/po/hu.po +++ b/po/hu.po @@ -10,7 +10,7 @@ msgid "" msgstr "" "Project-Id-Version: hu\n" "Report-Msgid-Bugs-To: elinks-users@linuxfromscratch.org\n" -"POT-Creation-Date: 2020-07-26 15:28+0200\n" +"POT-Creation-Date: 2020-07-31 14:44+0200\n" "PO-Revision-Date: 2005-10-11 19:06+0000\n" "Last-Translator: \n" "Language-Team: \n" @@ -4731,30 +4731,43 @@ msgstr "Kis/nagybetű érzékeny" msgid "Keep the session active even if the last terminal exits." msgstr "" -#: src/config/options.inc:1463 +#: src/config/options.inc:1462 +#, fuzzy +msgid "Clipboard filename" +msgstr "%d fájl" + +#: src/config/options.inc:1464 +msgid "" +"The filename of the clipboard. The 'copy-clipboard' action will append to " +"it. This file can be also a named pipe. See contrib/clipboard/clip.sh for " +"sample implementation. Note this file must exists before copying to the " +"clipboard." +msgstr "" + +#: src/config/options.inc:1469 msgid "Date format" msgstr "Dátumformátum" -#: src/config/options.inc:1465 +#: src/config/options.inc:1471 msgid "Date format to use in dialogs. See strftime(3)." msgstr "" "A dialógusablakokban használt dátumformátum. Lásd az\n" "strftime(3) man oldalt." #. date added -#: src/config/options.inc:1470 +#: src/config/options.inc:1476 msgid "Disable mouse" msgstr "" -#: src/config/options.inc:1472 +#: src/config/options.inc:1478 msgid "Disable mouse. Changes take effect at the next elinks restart." msgstr "" -#: src/config/options.inc:1476 +#: src/config/options.inc:1482 msgid "Set window title" msgstr "Ablakfejléc címének beállítása" -#: src/config/options.inc:1478 +#: src/config/options.inc:1484 #, fuzzy msgid "" "Set the window title when running in a windowing environment in an xterm-" @@ -9297,6 +9310,10 @@ msgstr "Cím" msgid "Viewer" msgstr "~Nézet" +#, fuzzy +#~ msgid "Filename of the clipboard file." +#~ msgstr "Szöveg beszúrása a vágólapról" + #, fuzzy #~ msgid "FSP specific options." #~ msgstr "FTP specifikus beállítások." diff --git a/po/id.po b/po/id.po index ad7bb976..c3c59d0f 100644 --- a/po/id.po +++ b/po/id.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: ELinks 0.5pre0.CVS\n" "Report-Msgid-Bugs-To: elinks-users@linuxfromscratch.org\n" -"POT-Creation-Date: 2020-07-26 15:28+0200\n" +"POT-Creation-Date: 2020-07-31 14:44+0200\n" "PO-Revision-Date: 2003-01-03 03:41+0100\n" "Last-Translator: Muhamad Faizal \n" "Language-Team: Indonesian \n" @@ -4377,29 +4377,42 @@ msgstr "" msgid "Keep the session active even if the last terminal exits." msgstr "" -#: src/config/options.inc:1463 +#: src/config/options.inc:1462 +#, fuzzy +msgid "Clipboard filename" +msgstr "file" + +#: src/config/options.inc:1464 +msgid "" +"The filename of the clipboard. The 'copy-clipboard' action will append to " +"it. This file can be also a named pipe. See contrib/clipboard/clip.sh for " +"sample implementation. Note this file must exists before copying to the " +"clipboard." +msgstr "" + +#: src/config/options.inc:1469 #, fuzzy msgid "Date format" msgstr "Upload file" -#: src/config/options.inc:1465 +#: src/config/options.inc:1471 msgid "Date format to use in dialogs. See strftime(3)." msgstr "" #. date added -#: src/config/options.inc:1470 +#: src/config/options.inc:1476 msgid "Disable mouse" msgstr "" -#: src/config/options.inc:1472 +#: src/config/options.inc:1478 msgid "Disable mouse. Changes take effect at the next elinks restart." msgstr "" -#: src/config/options.inc:1476 +#: src/config/options.inc:1482 msgid "Set window title" msgstr "" -#: src/config/options.inc:1478 +#: src/config/options.inc:1484 msgid "" "Set the window title when running in a windowing environment in an xterm-" "like terminal. This way the document's title is shown on the window titlebar." diff --git a/po/is.po b/po/is.po index c0244497..b9640e2d 100644 --- a/po/is.po +++ b/po/is.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: ELinks 0.5pre0.CVS\n" "Report-Msgid-Bugs-To: elinks-users@linuxfromscratch.org\n" -"POT-Creation-Date: 2020-07-26 15:28+0200\n" +"POT-Creation-Date: 2020-07-31 14:44+0200\n" "PO-Revision-Date: 2003-01-03 03:41+0100\n" "Last-Translator: Armon Red \n" "Language-Team: Icelandic \n" @@ -4376,29 +4376,42 @@ msgstr "" msgid "Keep the session active even if the last terminal exits." msgstr "" -#: src/config/options.inc:1463 +#: src/config/options.inc:1462 +#, fuzzy +msgid "Clipboard filename" +msgstr "skrár" + +#: src/config/options.inc:1464 +msgid "" +"The filename of the clipboard. The 'copy-clipboard' action will append to " +"it. This file can be also a named pipe. See contrib/clipboard/clip.sh for " +"sample implementation. Note this file must exists before copying to the " +"clipboard." +msgstr "" + +#: src/config/options.inc:1469 #, fuzzy msgid "Date format" msgstr "Upphlöðun skráar" -#: src/config/options.inc:1465 +#: src/config/options.inc:1471 msgid "Date format to use in dialogs. See strftime(3)." msgstr "" #. date added -#: src/config/options.inc:1470 +#: src/config/options.inc:1476 msgid "Disable mouse" msgstr "" -#: src/config/options.inc:1472 +#: src/config/options.inc:1478 msgid "Disable mouse. Changes take effect at the next elinks restart." msgstr "" -#: src/config/options.inc:1476 +#: src/config/options.inc:1482 msgid "Set window title" msgstr "" -#: src/config/options.inc:1478 +#: src/config/options.inc:1484 msgid "" "Set the window title when running in a windowing environment in an xterm-" "like terminal. This way the document's title is shown on the window titlebar." diff --git a/po/it.po b/po/it.po index 38e7f6ca..1941c5b5 100644 --- a/po/it.po +++ b/po/it.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: ELinks 0.5pre0.CVS\n" "Report-Msgid-Bugs-To: elinks-users@linuxfromscratch.org\n" -"POT-Creation-Date: 2020-07-26 15:28+0200\n" +"POT-Creation-Date: 2020-07-31 14:44+0200\n" "PO-Revision-Date: 2003-07-21 00:32+0200\n" "Last-Translator: Fabio Bonelli \n" "Language-Team: Italian \n" @@ -4748,29 +4748,42 @@ msgstr "Considera minuscole/maiuscole" msgid "Keep the session active even if the last terminal exits." msgstr "" -#: src/config/options.inc:1463 +#: src/config/options.inc:1462 +#, fuzzy +msgid "Clipboard filename" +msgstr "File locali" + +#: src/config/options.inc:1464 +msgid "" +"The filename of the clipboard. The 'copy-clipboard' action will append to " +"it. This file can be also a named pipe. See contrib/clipboard/clip.sh for " +"sample implementation. Note this file must exists before copying to the " +"clipboard." +msgstr "" + +#: src/config/options.inc:1469 #, fuzzy msgid "Date format" msgstr "Formato file" -#: src/config/options.inc:1465 +#: src/config/options.inc:1471 msgid "Date format to use in dialogs. See strftime(3)." msgstr "" #. date added -#: src/config/options.inc:1470 +#: src/config/options.inc:1476 msgid "Disable mouse" msgstr "" -#: src/config/options.inc:1472 +#: src/config/options.inc:1478 msgid "Disable mouse. Changes take effect at the next elinks restart." msgstr "" -#: src/config/options.inc:1476 +#: src/config/options.inc:1482 msgid "Set window title" msgstr "Imposta titolo della finestra" -#: src/config/options.inc:1478 +#: src/config/options.inc:1484 #, fuzzy msgid "" "Set the window title when running in a windowing environment in an xterm-" @@ -9368,6 +9381,10 @@ msgstr "Titolo" msgid "Viewer" msgstr "~Visualizza" +#, fuzzy +#~ msgid "Filename of the clipboard file." +#~ msgstr "Incolla testo dalla clipboard" + #, fuzzy #~ msgid "FSP specific options." #~ msgstr "Opzioni specifiche di FTP." diff --git a/po/ja.po b/po/ja.po index c6e003c1..d89de1ba 100644 --- a/po/ja.po +++ b/po/ja.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: ELinks 0.12.GIT\n" "Report-Msgid-Bugs-To: elinks-users@linuxfromscratch.org\n" -"POT-Creation-Date: 2020-07-26 15:28+0200\n" +"POT-Creation-Date: 2020-07-31 14:44+0200\n" "PO-Revision-Date: 2016-01-15 17:28+0900\n" "Last-Translator: KURASAWA Nozomu \n" "Language-Team: JAPANESE\n" @@ -4190,28 +4190,40 @@ msgstr "" msgid "Keep the session active even if the last terminal exits." msgstr "" -#: src/config/options.inc:1463 +#: src/config/options.inc:1462 +msgid "Clipboard filename" +msgstr "" + +#: src/config/options.inc:1464 +msgid "" +"The filename of the clipboard. The 'copy-clipboard' action will append to " +"it. This file can be also a named pipe. See contrib/clipboard/clip.sh for " +"sample implementation. Note this file must exists before copying to the " +"clipboard." +msgstr "" + +#: src/config/options.inc:1469 msgid "Date format" msgstr "" -#: src/config/options.inc:1465 +#: src/config/options.inc:1471 msgid "Date format to use in dialogs. See strftime(3)." msgstr "" #. date added -#: src/config/options.inc:1470 +#: src/config/options.inc:1476 msgid "Disable mouse" msgstr "" -#: src/config/options.inc:1472 +#: src/config/options.inc:1478 msgid "Disable mouse. Changes take effect at the next elinks restart." msgstr "" -#: src/config/options.inc:1476 +#: src/config/options.inc:1482 msgid "Set window title" msgstr "" -#: src/config/options.inc:1478 +#: src/config/options.inc:1484 msgid "" "Set the window title when running in a windowing environment in an xterm-" "like terminal. This way the document's title is shown on the window titlebar." diff --git a/po/lt.po b/po/lt.po index 4e3370ee..f03203cf 100644 --- a/po/lt.po +++ b/po/lt.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: ELinks 0.5pre0.CVS\n" "Report-Msgid-Bugs-To: elinks-users@linuxfromscratch.org\n" -"POT-Creation-Date: 2020-07-26 15:28+0200\n" +"POT-Creation-Date: 2020-07-31 14:44+0200\n" "PO-Revision-Date: 2003-01-03 03:41+0100\n" "Last-Translator: Aurimas Mikalauskas \n" "Language-Team: Lithuanian \n" @@ -4376,29 +4376,42 @@ msgstr "" msgid "Keep the session active even if the last terminal exits." msgstr "" -#: src/config/options.inc:1463 +#: src/config/options.inc:1462 +#, fuzzy +msgid "Clipboard filename" +msgstr "failai" + +#: src/config/options.inc:1464 +msgid "" +"The filename of the clipboard. The 'copy-clipboard' action will append to " +"it. This file can be also a named pipe. See contrib/clipboard/clip.sh for " +"sample implementation. Note this file must exists before copying to the " +"clipboard." +msgstr "" + +#: src/config/options.inc:1469 #, fuzzy msgid "Date format" msgstr "Nusiųsti failą" -#: src/config/options.inc:1465 +#: src/config/options.inc:1471 msgid "Date format to use in dialogs. See strftime(3)." msgstr "" #. date added -#: src/config/options.inc:1470 +#: src/config/options.inc:1476 msgid "Disable mouse" msgstr "" -#: src/config/options.inc:1472 +#: src/config/options.inc:1478 msgid "Disable mouse. Changes take effect at the next elinks restart." msgstr "" -#: src/config/options.inc:1476 +#: src/config/options.inc:1482 msgid "Set window title" msgstr "" -#: src/config/options.inc:1478 +#: src/config/options.inc:1484 msgid "" "Set the window title when running in a windowing environment in an xterm-" "like terminal. This way the document's title is shown on the window titlebar." diff --git a/po/nb.po b/po/nb.po index 2da6a821..fbac70fe 100644 --- a/po/nb.po +++ b/po/nb.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: ELinks 0.5pre0.CVS\n" "Report-Msgid-Bugs-To: elinks-users@linuxfromscratch.org\n" -"POT-Creation-Date: 2020-07-26 15:28+0200\n" +"POT-Creation-Date: 2020-07-31 14:44+0200\n" "PO-Revision-Date: 2003-01-03 03:41+0100\n" "Last-Translator: Simen Graaten \n" "Language-Team: Norwegian \n" @@ -4377,29 +4377,42 @@ msgstr "" msgid "Keep the session active even if the last terminal exits." msgstr "" -#: src/config/options.inc:1463 +#: src/config/options.inc:1462 +#, fuzzy +msgid "Clipboard filename" +msgstr "filer" + +#: src/config/options.inc:1464 +msgid "" +"The filename of the clipboard. The 'copy-clipboard' action will append to " +"it. This file can be also a named pipe. See contrib/clipboard/clip.sh for " +"sample implementation. Note this file must exists before copying to the " +"clipboard." +msgstr "" + +#: src/config/options.inc:1469 #, fuzzy msgid "Date format" msgstr "Last opp fil" -#: src/config/options.inc:1465 +#: src/config/options.inc:1471 msgid "Date format to use in dialogs. See strftime(3)." msgstr "" #. date added -#: src/config/options.inc:1470 +#: src/config/options.inc:1476 msgid "Disable mouse" msgstr "" -#: src/config/options.inc:1472 +#: src/config/options.inc:1478 msgid "Disable mouse. Changes take effect at the next elinks restart." msgstr "" -#: src/config/options.inc:1476 +#: src/config/options.inc:1482 msgid "Set window title" msgstr "" -#: src/config/options.inc:1478 +#: src/config/options.inc:1484 msgid "" "Set the window title when running in a windowing environment in an xterm-" "like terminal. This way the document's title is shown on the window titlebar." diff --git a/po/nl.po b/po/nl.po index f1ab188b..9d0b6d54 100644 --- a/po/nl.po +++ b/po/nl.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: ELinks 0.5pre0.CVS\n" "Report-Msgid-Bugs-To: elinks-users@linuxfromscratch.org\n" -"POT-Creation-Date: 2020-07-26 15:28+0200\n" +"POT-Creation-Date: 2020-07-31 14:44+0200\n" "PO-Revision-Date: 2003-01-03 03:41+0100\n" "Last-Translator: Stefan de Groot \n" "Language-Team: Dutch \n" @@ -4377,29 +4377,42 @@ msgstr "" msgid "Keep the session active even if the last terminal exits." msgstr "" -#: src/config/options.inc:1463 +#: src/config/options.inc:1462 +#, fuzzy +msgid "Clipboard filename" +msgstr "bestanden" + +#: src/config/options.inc:1464 +msgid "" +"The filename of the clipboard. The 'copy-clipboard' action will append to " +"it. This file can be also a named pipe. See contrib/clipboard/clip.sh for " +"sample implementation. Note this file must exists before copying to the " +"clipboard." +msgstr "" + +#: src/config/options.inc:1469 #, fuzzy msgid "Date format" msgstr "Bestand upload" -#: src/config/options.inc:1465 +#: src/config/options.inc:1471 msgid "Date format to use in dialogs. See strftime(3)." msgstr "" #. date added -#: src/config/options.inc:1470 +#: src/config/options.inc:1476 msgid "Disable mouse" msgstr "" -#: src/config/options.inc:1472 +#: src/config/options.inc:1478 msgid "Disable mouse. Changes take effect at the next elinks restart." msgstr "" -#: src/config/options.inc:1476 +#: src/config/options.inc:1482 msgid "Set window title" msgstr "" -#: src/config/options.inc:1478 +#: src/config/options.inc:1484 msgid "" "Set the window title when running in a windowing environment in an xterm-" "like terminal. This way the document's title is shown on the window titlebar." diff --git a/po/pl.po b/po/pl.po index fea41d7e..f44d9381 100644 --- a/po/pl.po +++ b/po/pl.po @@ -11,7 +11,7 @@ msgid "" msgstr "" "Project-Id-Version: ELinks 0.13.GIT\n" "Report-Msgid-Bugs-To: elinks-users@linuxfromscratch.org\n" -"POT-Creation-Date: 2020-07-26 15:28+0200\n" +"POT-Creation-Date: 2020-07-31 14:44+0200\n" "PO-Revision-Date: 2009-03-13 16:00+0100\n" "Last-Translator: Witold Filipczyk \n" "Language-Team: Polish \n" @@ -4786,30 +4786,46 @@ msgstr "Utrzymuj aktywną sesję" msgid "Keep the session active even if the last terminal exits." msgstr "Utrzymuj sesję nawet po zamknięciu ostatniego terminala." +#: src/config/options.inc:1462 +msgid "Clipboard filename" +msgstr "Nazwa pliku schowka" + +#: src/config/options.inc:1464 +msgid "" +"The filename of the clipboard. The 'copy-clipboard' action will append to " +"it. This file can be also a named pipe. See contrib/clipboard/clip.sh for " +"sample implementation. Note this file must exists before copying to the " +"clipboard." +msgstr "" +"Nazwa pliku schowka. Akcja 'copy-clipboard' będzie dodawała treść do " +"tego pliku. Ten plik może być też typu FIFO. Zobacz przykładową " +"implementację w contrib/clipboard/clip.sh. Plik ten musi istnieć przed " +"rozpoczęciem kopiowania do schowka." + # -#: src/config/options.inc:1463 +#: src/config/options.inc:1469 msgid "Date format" msgstr "Format daty" -#: src/config/options.inc:1465 +#: src/config/options.inc:1471 msgid "Date format to use in dialogs. See strftime(3)." msgstr "Format daty używany w dialog. Zobacz strftime(3)." #. date added -#: src/config/options.inc:1470 +#: src/config/options.inc:1476 msgid "Disable mouse" msgstr "Wyłącz obsługę myszy" -#: src/config/options.inc:1472 +#: src/config/options.inc:1478 msgid "Disable mouse. Changes take effect at the next elinks restart." msgstr "Wyłącz obsługę myszy. Zmiana odniesie skutek po restarcie ELinksa." # -#: src/config/options.inc:1476 +#: src/config/options.inc:1482 msgid "Set window title" msgstr "Ustalenie tytułu okna" -#: src/config/options.inc:1478 +#: src/config/options.inc:1484 msgid "" "Set the window title when running in a windowing environment in an xterm-" "like terminal. This way the document's title is shown on the window titlebar." @@ -9464,6 +9480,10 @@ msgstr "Stoper" msgid "Viewer" msgstr "Przeglądarka" +#, fuzzy +#~ msgid "Filename of the clipboard file." +#~ msgstr "Wstaw tekst ze schowka" + #~ msgid "SEE" #~ msgstr "SEE" diff --git a/po/pt.po b/po/pt.po index 842b4cd9..fe195327 100644 --- a/po/pt.po +++ b/po/pt.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: ELinks 0.5pre0.CVS\n" "Report-Msgid-Bugs-To: elinks-users@linuxfromscratch.org\n" -"POT-Creation-Date: 2020-07-26 15:28+0200\n" +"POT-Creation-Date: 2020-07-31 14:44+0200\n" "PO-Revision-Date: 2003-01-03 03:41+0100\n" "Last-Translator: Andre Valente \n" "Language-Team: Portuguese \n" @@ -4406,30 +4406,43 @@ msgstr "" msgid "Keep the session active even if the last terminal exits." msgstr "" -#: src/config/options.inc:1463 +#: src/config/options.inc:1462 +#, fuzzy +msgid "Clipboard filename" +msgstr "arquivosfiles" + +#: src/config/options.inc:1464 +msgid "" +"The filename of the clipboard. The 'copy-clipboard' action will append to " +"it. This file can be also a named pipe. See contrib/clipboard/clip.sh for " +"sample implementation. Note this file must exists before copying to the " +"clipboard." +msgstr "" + +#: src/config/options.inc:1469 #, fuzzy msgid "Date format" msgstr "Upload de ficheiro" -#: src/config/options.inc:1465 +#: src/config/options.inc:1471 msgid "Date format to use in dialogs. See strftime(3)." msgstr "" #. date added -#: src/config/options.inc:1470 +#: src/config/options.inc:1476 msgid "Disable mouse" msgstr "" -#: src/config/options.inc:1472 +#: src/config/options.inc:1478 msgid "Disable mouse. Changes take effect at the next elinks restart." msgstr "" -#: src/config/options.inc:1476 +#: src/config/options.inc:1482 #, fuzzy msgid "Set window title" msgstr "Título do link" -#: src/config/options.inc:1478 +#: src/config/options.inc:1484 msgid "" "Set the window title when running in a windowing environment in an xterm-" "like terminal. This way the document's title is shown on the window titlebar." diff --git a/po/pt_BR.po b/po/pt_BR.po index cadd3483..9979e6e3 100644 --- a/po/pt_BR.po +++ b/po/pt_BR.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: ELinks 0.5pre0.CVS\n" "Report-Msgid-Bugs-To: elinks-users@linuxfromscratch.org\n" -"POT-Creation-Date: 2020-07-26 15:28+0200\n" +"POT-Creation-Date: 2020-07-31 14:44+0200\n" "PO-Revision-Date: 2003-01-03 03:41+0100\n" "Last-Translator: Andre Valente \n" "Language-Team: Brazilian Portuguese \n" @@ -4390,30 +4390,43 @@ msgstr "" msgid "Keep the session active even if the last terminal exits." msgstr "" -#: src/config/options.inc:1463 +#: src/config/options.inc:1462 +#, fuzzy +msgid "Clipboard filename" +msgstr "arquivosfiles" + +#: src/config/options.inc:1464 +msgid "" +"The filename of the clipboard. The 'copy-clipboard' action will append to " +"it. This file can be also a named pipe. See contrib/clipboard/clip.sh for " +"sample implementation. Note this file must exists before copying to the " +"clipboard." +msgstr "" + +#: src/config/options.inc:1469 #, fuzzy msgid "Date format" msgstr "Upload de arquivo" -#: src/config/options.inc:1465 +#: src/config/options.inc:1471 msgid "Date format to use in dialogs. See strftime(3)." msgstr "" #. date added -#: src/config/options.inc:1470 +#: src/config/options.inc:1476 msgid "Disable mouse" msgstr "" -#: src/config/options.inc:1472 +#: src/config/options.inc:1478 msgid "Disable mouse. Changes take effect at the next elinks restart." msgstr "" -#: src/config/options.inc:1476 +#: src/config/options.inc:1482 #, fuzzy msgid "Set window title" msgstr "Titulo do link" -#: src/config/options.inc:1478 +#: src/config/options.inc:1484 msgid "" "Set the window title when running in a windowing environment in an xterm-" "like terminal. This way the document's title is shown on the window titlebar." diff --git a/po/ro.po b/po/ro.po index 3f9adedc..e25d6890 100644 --- a/po/ro.po +++ b/po/ro.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: ELinks 0.5pre0.CVS\n" "Report-Msgid-Bugs-To: elinks-users@linuxfromscratch.org\n" -"POT-Creation-Date: 2020-07-26 15:28+0200\n" +"POT-Creation-Date: 2020-07-31 14:44+0200\n" "PO-Revision-Date: 2003-01-03 03:41+0100\n" "Last-Translator: Ionel Mugurel Ciobica \n" "Language-Team: Romanian \n" @@ -4377,29 +4377,42 @@ msgstr "" msgid "Keep the session active even if the last terminal exits." msgstr "" -#: src/config/options.inc:1463 +#: src/config/options.inc:1462 +#, fuzzy +msgid "Clipboard filename" +msgstr "Fișier(e)" + +#: src/config/options.inc:1464 +msgid "" +"The filename of the clipboard. The 'copy-clipboard' action will append to " +"it. This file can be also a named pipe. See contrib/clipboard/clip.sh for " +"sample implementation. Note this file must exists before copying to the " +"clipboard." +msgstr "" + +#: src/config/options.inc:1469 #, fuzzy msgid "Date format" msgstr "Încărcare de fișier" -#: src/config/options.inc:1465 +#: src/config/options.inc:1471 msgid "Date format to use in dialogs. See strftime(3)." msgstr "" #. date added -#: src/config/options.inc:1470 +#: src/config/options.inc:1476 msgid "Disable mouse" msgstr "" -#: src/config/options.inc:1472 +#: src/config/options.inc:1478 msgid "Disable mouse. Changes take effect at the next elinks restart." msgstr "" -#: src/config/options.inc:1476 +#: src/config/options.inc:1482 msgid "Set window title" msgstr "" -#: src/config/options.inc:1478 +#: src/config/options.inc:1484 msgid "" "Set the window title when running in a windowing environment in an xterm-" "like terminal. This way the document's title is shown on the window titlebar." diff --git a/po/ru.po b/po/ru.po index 73c93790..e9c78b69 100644 --- a/po/ru.po +++ b/po/ru.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: ELinks 0.5pre0.CVS\n" "Report-Msgid-Bugs-To: elinks-users@linuxfromscratch.org\n" -"POT-Creation-Date: 2020-07-26 15:28+0200\n" +"POT-Creation-Date: 2020-07-31 14:44+0200\n" "PO-Revision-Date: 2003-01-03 03:41+0100\n" "Last-Translator: Dmitry M. Klimov \n" "Language-Team: Russian \n" @@ -4391,30 +4391,43 @@ msgstr "" msgid "Keep the session active even if the last terminal exits." msgstr "" -#: src/config/options.inc:1463 +#: src/config/options.inc:1462 +#, fuzzy +msgid "Clipboard filename" +msgstr "файлов" + +#: src/config/options.inc:1464 +msgid "" +"The filename of the clipboard. The 'copy-clipboard' action will append to " +"it. This file can be also a named pipe. See contrib/clipboard/clip.sh for " +"sample implementation. Note this file must exists before copying to the " +"clipboard." +msgstr "" + +#: src/config/options.inc:1469 #, fuzzy msgid "Date format" msgstr "Выгрузка файла" -#: src/config/options.inc:1465 +#: src/config/options.inc:1471 msgid "Date format to use in dialogs. See strftime(3)." msgstr "" #. date added -#: src/config/options.inc:1470 +#: src/config/options.inc:1476 msgid "Disable mouse" msgstr "" -#: src/config/options.inc:1472 +#: src/config/options.inc:1478 msgid "Disable mouse. Changes take effect at the next elinks restart." msgstr "" -#: src/config/options.inc:1476 +#: src/config/options.inc:1482 #, fuzzy msgid "Set window title" msgstr "Заголовок ссылки" -#: src/config/options.inc:1478 +#: src/config/options.inc:1484 msgid "" "Set the window title when running in a windowing environment in an xterm-" "like terminal. This way the document's title is shown on the window titlebar." diff --git a/po/sk.po b/po/sk.po index 80eb27da..a9fd6ceb 100644 --- a/po/sk.po +++ b/po/sk.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: ELinks 0.5pre0.CVS\n" "Report-Msgid-Bugs-To: elinks-users@linuxfromscratch.org\n" -"POT-Creation-Date: 2020-07-26 15:28+0200\n" +"POT-Creation-Date: 2020-07-31 14:44+0200\n" "PO-Revision-Date: 2004-02-13 19:07+0100\n" "Last-Translator: Peter Samek \n" "Language-Team: Slovak \n" @@ -4632,29 +4632,42 @@ msgstr "Rozlišovať veľkosť písmen" msgid "Keep the session active even if the last terminal exits." msgstr "" -#: src/config/options.inc:1463 +#: src/config/options.inc:1462 +#, fuzzy +msgid "Clipboard filename" +msgstr "súborov" + +#: src/config/options.inc:1464 +msgid "" +"The filename of the clipboard. The 'copy-clipboard' action will append to " +"it. This file can be also a named pipe. See contrib/clipboard/clip.sh for " +"sample implementation. Note this file must exists before copying to the " +"clipboard." +msgstr "" + +#: src/config/options.inc:1469 #, fuzzy msgid "Date format" msgstr "Formát súboru" -#: src/config/options.inc:1465 +#: src/config/options.inc:1471 msgid "Date format to use in dialogs. See strftime(3)." msgstr "" #. date added -#: src/config/options.inc:1470 +#: src/config/options.inc:1476 msgid "Disable mouse" msgstr "" -#: src/config/options.inc:1472 +#: src/config/options.inc:1478 msgid "Disable mouse. Changes take effect at the next elinks restart." msgstr "" -#: src/config/options.inc:1476 +#: src/config/options.inc:1482 msgid "Set window title" msgstr "Nastaviť titulok okna" -#: src/config/options.inc:1478 +#: src/config/options.inc:1484 msgid "" "Set the window title when running in a windowing environment in an xterm-" "like terminal. This way the document's title is shown on the window titlebar." @@ -9113,6 +9126,10 @@ msgstr "Titulok" msgid "Viewer" msgstr "~Zobrazenie" +#, fuzzy +#~ msgid "Filename of the clipboard file." +#~ msgstr "Vložiť text zo schránky" + #, fuzzy #~ msgid "FSP specific options." #~ msgstr "Nastavenie FTP." diff --git a/po/sr.po b/po/sr.po index e8ee3036..3cbc5c31 100644 --- a/po/sr.po +++ b/po/sr.po @@ -4,7 +4,7 @@ msgid "" msgstr "" "Project-Id-Version: ELinks 0.10.6.CVS\n" "Report-Msgid-Bugs-To: elinks-users@linuxfromscratch.org\n" -"POT-Creation-Date: 2020-07-26 15:28+0200\n" +"POT-Creation-Date: 2020-07-31 14:44+0200\n" "PO-Revision-Date: 2005-09-21 16:20+0200\n" "Last-Translator: Strahinya Radich (Страхиња Радић) \n" "Language-Team: Serbian \n" @@ -4838,28 +4838,41 @@ msgstr "Разликовање малих и великих слова" msgid "Keep the session active even if the last terminal exits." msgstr "" -#: src/config/options.inc:1463 +#: src/config/options.inc:1462 +#, fuzzy +msgid "Clipboard filename" +msgstr "Локалне датотеке" + +#: src/config/options.inc:1464 +msgid "" +"The filename of the clipboard. The 'copy-clipboard' action will append to " +"it. This file can be also a named pipe. See contrib/clipboard/clip.sh for " +"sample implementation. Note this file must exists before copying to the " +"clipboard." +msgstr "" + +#: src/config/options.inc:1469 msgid "Date format" msgstr "Формат датума" -#: src/config/options.inc:1465 +#: src/config/options.inc:1471 msgid "Date format to use in dialogs. See strftime(3)." msgstr "Формат датума у дијалозима. Погледајте strftime(3)." #. date added -#: src/config/options.inc:1470 +#: src/config/options.inc:1476 msgid "Disable mouse" msgstr "" -#: src/config/options.inc:1472 +#: src/config/options.inc:1478 msgid "Disable mouse. Changes take effect at the next elinks restart." msgstr "" -#: src/config/options.inc:1476 +#: src/config/options.inc:1482 msgid "Set window title" msgstr "Постављање наслова прозора" -#: src/config/options.inc:1478 +#: src/config/options.inc:1484 #, fuzzy msgid "" "Set the window title when running in a windowing environment in an xterm-" @@ -9497,6 +9510,10 @@ msgstr "Наслов" msgid "Viewer" msgstr "П~оглед" +#, fuzzy +#~ msgid "Filename of the clipboard file." +#~ msgstr "Лепљење текста из клипборда" + #, fuzzy #~ msgid "FSP specific options." #~ msgstr "Избори у вези за FTP-ом." diff --git a/po/sv.po b/po/sv.po index cf36e75b..9d3ad617 100644 --- a/po/sv.po +++ b/po/sv.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: ELinks 0.5pre0.CVS\n" "Report-Msgid-Bugs-To: elinks-users@linuxfromscratch.org\n" -"POT-Creation-Date: 2020-07-26 15:28+0200\n" +"POT-Creation-Date: 2020-07-31 14:44+0200\n" "PO-Revision-Date: 2003-01-03 03:41+0100\n" "Last-Translator: Martin Norback \n" "Language-Team: Swedish \n" @@ -4377,29 +4377,42 @@ msgstr "" msgid "Keep the session active even if the last terminal exits." msgstr "" -#: src/config/options.inc:1463 +#: src/config/options.inc:1462 +#, fuzzy +msgid "Clipboard filename" +msgstr "filer" + +#: src/config/options.inc:1464 +msgid "" +"The filename of the clipboard. The 'copy-clipboard' action will append to " +"it. This file can be also a named pipe. See contrib/clipboard/clip.sh for " +"sample implementation. Note this file must exists before copying to the " +"clipboard." +msgstr "" + +#: src/config/options.inc:1469 #, fuzzy msgid "Date format" msgstr "Filsändning" -#: src/config/options.inc:1465 +#: src/config/options.inc:1471 msgid "Date format to use in dialogs. See strftime(3)." msgstr "" #. date added -#: src/config/options.inc:1470 +#: src/config/options.inc:1476 msgid "Disable mouse" msgstr "" -#: src/config/options.inc:1472 +#: src/config/options.inc:1478 msgid "Disable mouse. Changes take effect at the next elinks restart." msgstr "" -#: src/config/options.inc:1476 +#: src/config/options.inc:1482 msgid "Set window title" msgstr "" -#: src/config/options.inc:1478 +#: src/config/options.inc:1484 msgid "" "Set the window title when running in a windowing environment in an xterm-" "like terminal. This way the document's title is shown on the window titlebar." diff --git a/po/tr.po b/po/tr.po index ceae9217..3ae0d0dd 100644 --- a/po/tr.po +++ b/po/tr.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: ELinks 0.5pre0.CVS\n" "Report-Msgid-Bugs-To: elinks-users@linuxfromscratch.org\n" -"POT-Creation-Date: 2020-07-26 15:28+0200\n" +"POT-Creation-Date: 2020-07-31 14:44+0200\n" "PO-Revision-Date: 2003-01-03 03:41+0100\n" "Last-Translator: Baris Metin \n" "Language-Team: Turkish \n" @@ -4376,29 +4376,42 @@ msgstr "" msgid "Keep the session active even if the last terminal exits." msgstr "" -#: src/config/options.inc:1463 +#: src/config/options.inc:1462 +#, fuzzy +msgid "Clipboard filename" +msgstr "dosyalar" + +#: src/config/options.inc:1464 +msgid "" +"The filename of the clipboard. The 'copy-clipboard' action will append to " +"it. This file can be also a named pipe. See contrib/clipboard/clip.sh for " +"sample implementation. Note this file must exists before copying to the " +"clipboard." +msgstr "" + +#: src/config/options.inc:1469 #, fuzzy msgid "Date format" msgstr "Dosya yükle" -#: src/config/options.inc:1465 +#: src/config/options.inc:1471 msgid "Date format to use in dialogs. See strftime(3)." msgstr "" #. date added -#: src/config/options.inc:1470 +#: src/config/options.inc:1476 msgid "Disable mouse" msgstr "" -#: src/config/options.inc:1472 +#: src/config/options.inc:1478 msgid "Disable mouse. Changes take effect at the next elinks restart." msgstr "" -#: src/config/options.inc:1476 +#: src/config/options.inc:1482 msgid "Set window title" msgstr "" -#: src/config/options.inc:1478 +#: src/config/options.inc:1484 msgid "" "Set the window title when running in a windowing environment in an xterm-" "like terminal. This way the document's title is shown on the window titlebar." diff --git a/po/uk.po b/po/uk.po index cb45d88e..d961aa5b 100644 --- a/po/uk.po +++ b/po/uk.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: ELinks 0.5pre0.CVS\n" "Report-Msgid-Bugs-To: elinks-users@linuxfromscratch.org\n" -"POT-Creation-Date: 2020-07-26 15:28+0200\n" +"POT-Creation-Date: 2020-07-31 14:44+0200\n" "PO-Revision-Date: 2003-01-03 03:41+0100\n" "Last-Translator: Dmitry Pinchukov \n" "Language-Team: Ukrainian \n" @@ -4413,30 +4413,43 @@ msgstr "" msgid "Keep the session active even if the last terminal exits." msgstr "" -#: src/config/options.inc:1463 +#: src/config/options.inc:1462 +#, fuzzy +msgid "Clipboard filename" +msgstr "файлів" + +#: src/config/options.inc:1464 +msgid "" +"The filename of the clipboard. The 'copy-clipboard' action will append to " +"it. This file can be also a named pipe. See contrib/clipboard/clip.sh for " +"sample implementation. Note this file must exists before copying to the " +"clipboard." +msgstr "" + +#: src/config/options.inc:1469 #, fuzzy msgid "Date format" msgstr "Посилання файлу (upload)" -#: src/config/options.inc:1465 +#: src/config/options.inc:1471 msgid "Date format to use in dialogs. See strftime(3)." msgstr "" #. date added -#: src/config/options.inc:1470 +#: src/config/options.inc:1476 msgid "Disable mouse" msgstr "" -#: src/config/options.inc:1472 +#: src/config/options.inc:1478 msgid "Disable mouse. Changes take effect at the next elinks restart." msgstr "" -#: src/config/options.inc:1476 +#: src/config/options.inc:1482 #, fuzzy msgid "Set window title" msgstr "Назва посилання" -#: src/config/options.inc:1478 +#: src/config/options.inc:1484 msgid "" "Set the window title when running in a windowing environment in an xterm-" "like terminal. This way the document's title is shown on the window titlebar." @@ -8900,6 +8913,10 @@ msgstr "Назва" msgid "Viewer" msgstr "Вигляд" +#, fuzzy +#~ msgid "Filename of the clipboard file." +#~ msgstr "Вставити текст з буферу" + #, fuzzy #~ msgid "FSP specific options." #~ msgstr "Не вказано програму для" From fa27bb0e235314465df0d8dad2e67c335412dacb Mon Sep 17 00:00:00 2001 From: Witold Filipczyk Date: Fri, 31 Jul 2020 15:03:49 +0200 Subject: [PATCH 007/179] [NEWS] Info about 0.13.4 --- NEWS | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/NEWS b/NEWS index a2dd6b44..893a4362 100644 --- a/NEWS +++ b/NEWS @@ -5,6 +5,18 @@ You can see the complete list of recent changes, bugfixes and new features in the https://github.com/rkd77/felinks.git[gitweb interface]. See the ChangeLog file for details. +ELinks 0.13.4: +-------------------- + +Released on 2020-07-31. + +* fixed segfault with gnutls. introduced in 0.13.3 +* updated smart and dumb prefixes to https. Thanks Guido Cella. PR #54 +* added the st terminal to config options. PR #55 +* doc updates PR #57 +* also pass the uri as %u to external handler. Thanks sgerwk. PR #58 +* added the ui.clipboard_file config option + ELinks 0.13.3: -------------------- From 6a960a9fb9382a2d571862ea5bc78f3c155c476b Mon Sep 17 00:00:00 2001 From: Witold Filipczyk Date: Sat, 1 Aug 2020 23:25:21 +0200 Subject: [PATCH 008/179] [viewer] New action mark-clipboard. Refs #10 Possibility to mark rectangle for clipboard. User may bind keys to move-cursor-up, move-cursor-down, move-cursor-left, move-cursor-right and mark-clipboard. mark-clipboard is tristate. First triggerred, it remembers left top corner of rectangle. Now you can move cursor. Second time triggerred, remembers right bottom corner of rectangle. Third time, it clears selection. The copy-clipboard action was changed. Now if the clipboard rectangle is marked, it copies this rectangle. If not, the current link. --- src/config/actions-main.inc | 3 +- src/config/options.inc | 3 + src/document/document.h | 9 ++ src/viewer/action.c | 6 +- src/viewer/text/draw.c | 31 +++++++ src/viewer/text/view.c | 164 +++++++++++++++++++++++++++++++++++- src/viewer/text/view.h | 4 + 7 files changed, 217 insertions(+), 3 deletions(-) diff --git a/src/config/actions-main.inc b/src/config/actions-main.inc index 56a754f9..5eed37ae 100644 --- a/src/config/actions-main.inc +++ b/src/config/actions-main.inc @@ -16,7 +16,7 @@ ACTION_(MAIN, "cache-manager", CACHE_MANAGER, N__("Open cache manager"), 0), ACTION_(MAIN, "cache-minimize", CACHE_MINIMIZE, N__("Free unused cache entries"), 0), ACTION_(MAIN, "cookie-manager", COOKIE_MANAGER, N__("Open cookie manager"), 0), ACTION_(MAIN, "cookies-load", COOKIES_LOAD, N__("Reload cookies file"), ACTION_RESTRICT_ANONYMOUS), -ACTION_(MAIN, "copy-clipboard", COPY_CLIPBOARD, N__("Copy text to clipboard"), ACTION_REQUIRE_VIEW_STATE | ACTION_REQUIRE_LOCATION | ACTION_JUMP_TO_LINK | ACTION_REQUIRE_LINK), +ACTION_(MAIN, "copy-clipboard", COPY_CLIPBOARD, N__("Copy text to clipboard"), ACTION_REQUIRE_VIEW_STATE | ACTION_REQUIRE_LOCATION), ACTION_(MAIN, "document-info", DOCUMENT_INFO, N__("Show information about the current page"), ACTION_JUMP_TO_LINK), ACTION_(MAIN, "download-manager", DOWNLOAD_MANAGER, N__("Open download manager"), 0), ACTION_(MAIN, "exmode", EXMODE, N__("Enter ex-mode (command line)"), 0), @@ -51,6 +51,7 @@ ACTION_(MAIN, "link-info", LINK_INFO, N__("Show information about current link") ACTION_(MAIN, "link-menu", LINK_MENU, N__("Open the link context menu"), ACTION_REQUIRE_VIEW_STATE | ACTION_JUMP_TO_LINK | ACTION_REQUIRE_LINK), ACTION_(MAIN, "link-form-menu", LINK_FORM_MENU, N__("Open the form fields menu"), ACTION_REQUIRE_VIEW_STATE | ACTION_JUMP_TO_LINK | ACTION_REQUIRE_LINK | ACTION_REQUIRE_FORM), ACTION_(MAIN, "lua-console", LUA_CONSOLE, N__("Open a Lua console"), ACTION_RESTRICT_ANONYMOUS), +ACTION_(MAIN, "mark-clipboard", MARK_CLIPBOARD, N__("Mark a corner of the clipboard rectangle"), ACTION_REQUIRE_VIEW_STATE | ACTION_REQUIRE_LOCATION), ACTION_(MAIN, "mark-goto", MARK_GOTO, N__("Go at a specified mark"), ACTION_REQUIRE_VIEW_STATE), ACTION_(MAIN, "mark-set", MARK_SET, N__("Set a mark"), ACTION_REQUIRE_VIEW_STATE), ACTION_(MAIN, "menu", MENU, N__("Activate the menu"), 0), diff --git a/src/config/options.inc b/src/config/options.inc index 4a0c8658..5840fcf4 100644 --- a/src/config/options.inc +++ b/src/config/options.inc @@ -1284,6 +1284,9 @@ static union option_info config_options_info[] = { "separator", "brown", "white", "gray", "white", N_("Tab separator colors.")), + INIT_OPT_COLORS("", N_("Clipboard"), + "clipboard", "lime", "green", "white", "green", + N_("Clipboard highlight colors.")), INIT_OPT_COLORS("", N_("Searched strings"), "searched", "black", "lime", "black", "white", diff --git a/src/document/document.h b/src/document/document.h index b19f2464..5d9da917 100644 --- a/src/document/document.h +++ b/src/document/document.h @@ -42,6 +42,12 @@ enum cp_status { CP_STATUS_IGNORED }; +/** Clipboard state */ +enum clipboard_status { + CLIPBOARD_NONE, + CLIPBOARD_FIRST_POINT, + CLIPBOARD_SECOND_POINT +}; struct point { int x, y; @@ -265,6 +271,9 @@ struct document { enum cp_status cp_status; unsigned int links_sorted:1; /**< whether links are already sorted */ + + struct el_box clipboard_box; + enum clipboard_status clipboard_status; }; #define document_has_frames(document_) ((document_) && (document_)->frame_desc) diff --git a/src/viewer/action.c b/src/viewer/action.c index 7c8d268f..734f8166 100644 --- a/src/viewer/action.c +++ b/src/viewer/action.c @@ -166,7 +166,7 @@ do_action(struct session *ses, enum main_action action_id, int verbose) break; case ACT_MAIN_COPY_CLIPBOARD: - status = copy_current_link_to_clipboard(ses, doc_view, 0); + status = copy_to_clipboard(ses, doc_view); break; case ACT_MAIN_DOCUMENT_INFO: @@ -317,6 +317,10 @@ do_action(struct session *ses, enum main_action action_id, int verbose) #endif break; + case ACT_MAIN_MARK_CLIPBOARD: + status = mark_clipboard(ses, doc_view); + break; + case ACT_MAIN_MARK_SET: #ifdef CONFIG_MARKS ses->kbdprefix.mark = KP_MARK_SET; diff --git a/src/viewer/text/draw.c b/src/viewer/text/draw.c index a38a0426..cd251ddb 100644 --- a/src/viewer/text/draw.c +++ b/src/viewer/text/draw.c @@ -165,6 +165,36 @@ draw_frame_lines(struct terminal *term, struct frameset_desc *frameset_desc, } } +static void +draw_clipboard(struct terminal *term, struct document_view *doc_view) +{ + struct document *document = doc_view->document; + struct color_pair *color; + int starty, startx, endy, endx, x, y, xoffset, yoffset; + + assert(term && doc_view); + if_assert_failed return; + + if (!document->clipboard_box.height || !document->clipboard_box.width) { + return; + } + + color = get_bfu_color(term, "clipboard"); + xoffset = doc_view->box.x - doc_view->vs->x; + yoffset = doc_view->box.y - doc_view->vs->y; + + starty = int_max(0, document->clipboard_box.y + yoffset); + endy = int_min(doc_view->box.height, document->clipboard_box.y + document->clipboard_box.height + yoffset); + startx = int_max(0, document->clipboard_box.x + xoffset); + endx = int_min(doc_view->box.width, document->clipboard_box.x + document->clipboard_box.width + xoffset); + + for (y = starty; y <= endy; ++y) { + for (x = startx; x <= endx; ++x) { + draw_char_color(term, x, y, color); + } + } +} + static void draw_view_status(struct session *ses, struct document_view *doc_view, int active) { @@ -173,6 +203,7 @@ draw_view_status(struct session *ses, struct document_view *doc_view, int active draw_forms(term, doc_view); if (active) { draw_searched(term, doc_view); + draw_clipboard(term, doc_view); draw_current_link(ses, doc_view); } } diff --git a/src/viewer/text/view.c b/src/viewer/text/view.c index b3affe08..5160d837 100644 --- a/src/viewer/text/view.c +++ b/src/viewer/text/view.c @@ -60,6 +60,8 @@ #include "viewer/text/view.h" #include "viewer/text/vs.h" +static enum frame_event_status move_clipboard_pos(struct session *ses, struct document_view *view, enum frame_event_status status); + void detach_formatted(struct document_view *doc_view) { @@ -602,15 +604,18 @@ move_cursor(struct session *ses, struct document_view *doc_view, int x, int y) return status; } + static enum frame_event_status move_cursor_rel_count(struct session *ses, struct document_view *view, int rx, int ry, int count) { + enum frame_event_status status; int x, y; x = ses->tab->x + rx*count; y = ses->tab->y + ry*count; - return move_cursor(ses, view, x, y); + status = move_cursor(ses, view, x, y); + return move_clipboard_pos(ses, view, status); } static enum frame_event_status @@ -949,6 +954,152 @@ move_cursor_line_start(struct session *ses, struct document_view *doc_view) return move_cursor_rel(ses, doc_view, -x, 0); } +static enum frame_event_status +move_clipboard_pos(struct session *ses, struct document_view *view, enum frame_event_status status) +{ + struct document *document = view->document; + int xoffset, yoffset, x, y; + + if (!document || document->clipboard_status != CLIPBOARD_FIRST_POINT) { + return status; + } + + xoffset = view->vs->x - view->box.x; + yoffset = view->vs->y - view->box.y; + x = ses->tab->x + xoffset; + y = ses->tab->y + yoffset; + + if (document->clipboard_box.x == x && document->clipboard_box.y == y) { + return status; + } + + if (document->clipboard_box.x > x || document->clipboard_box.y > y) { + return status; + } + + document->clipboard_box.height = y - document->clipboard_box.y; + document->clipboard_box.width = x - document->clipboard_box.x; + + return FRAME_EVENT_REFRESH; +} + +static enum frame_event_status +copy_to_clipboard2(struct document_view *doc_view) +{ + struct document *document = doc_view->document; + struct string data; + int starty, endy, startx, y; + int utf8; + + if (!document->clipboard_box.height || !document->clipboard_box.width) { + return FRAME_EVENT_OK; + } + + if (!init_string(&data)) { + return FRAME_EVENT_OK; + } + + starty = document->clipboard_box.y; + endy = int_min(document->clipboard_box.y + document->clipboard_box.height, document->height - 1); + startx = document->clipboard_box.x; + utf8 = document->options.utf8; + + for (y = starty; y <= endy; y++) { + int endx = int_min(document->clipboard_box.x + document->clipboard_box.width, document->data[y].length); + int x; + + for (x = startx; x < endx; x++) { +#ifdef CONFIG_UTF8 + unicode_val_T c; +#else + unsigned char c; +#endif + c = document->data[y].chars[x].data; + +#ifdef CONFIG_UTF8 + if (utf8 && c == UCS_NO_CHAR) { + /* This is the second cell of + * a double-cell character. */ + continue; + } +#endif + +#ifdef CONFIG_UTF8 + if (utf8) { + if (!isscreensafe_ucs(c)) c = ' '; + } else { + if (!isscreensafe(c)) c = ' '; + } +#else + if (!isscreensafe(c)) c = ' '; +#endif + +#ifdef CONFIG_UTF8 + if (utf8) { + add_to_string(&data, encode_utf8(c)); + } else { + add_char_to_string(&data, c); + } +#else + add_char_to_string(&data, c); +#endif + } + add_char_to_string(&data, '\n'); + } + + set_clipboard_text(data.source); + done_string(&data); + + return FRAME_EVENT_OK; + +} + +enum frame_event_status +mark_clipboard(struct session *ses, struct document_view *doc_view) +{ + struct document *document = doc_view->document; + + int xoffset = doc_view->vs->x - doc_view->box.x; + int yoffset = doc_view->vs->y - doc_view->box.y; + int x = ses->tab->x + xoffset; + int y = ses->tab->y + yoffset; + + switch (document->clipboard_status) + { + case CLIPBOARD_NONE: + document->clipboard_box.x = x; + document->clipboard_box.y = y; + document->clipboard_box.height = 0; + document->clipboard_box.width = 0; + document->clipboard_status = CLIPBOARD_FIRST_POINT; + + return FRAME_EVENT_OK; + + case CLIPBOARD_FIRST_POINT: + if (document->clipboard_box.x == x && document->clipboard_box.y == y) { + return FRAME_EVENT_OK; + } + if (document->clipboard_box.x > x || document->clipboard_box.y > y) { + return FRAME_EVENT_OK; + } + document->clipboard_box.height = y - document->clipboard_box.y; + document->clipboard_box.width = x - document->clipboard_box.x; + document->clipboard_status = CLIPBOARD_SECOND_POINT; + + return FRAME_EVENT_REFRESH; + + case CLIPBOARD_SECOND_POINT: + document->clipboard_box.x = 0; + document->clipboard_box.y = 0; + document->clipboard_box.height = 0; + document->clipboard_box.width = 0; + document->clipboard_status = CLIPBOARD_NONE; + + return FRAME_EVENT_REFRESH; + } + return FRAME_EVENT_OK; +} + enum frame_event_status copy_current_link_to_clipboard(struct session *ses, struct document_view *doc_view, @@ -975,6 +1126,17 @@ copy_current_link_to_clipboard(struct session *ses, return FRAME_EVENT_OK; } +enum frame_event_status +copy_to_clipboard(struct session *ses, struct document_view *doc_view) +{ + if (doc_view && doc_view->document + && doc_view->document->clipboard_box.height + && doc_view->document->clipboard_box.width) { + return copy_to_clipboard2(doc_view); + } + + return copy_current_link_to_clipboard(ses, doc_view, 0); +} int try_jump_to_link_number(struct session *ses, struct document_view *doc_view) diff --git a/src/viewer/text/view.h b/src/viewer/text/view.h index c598608b..5934b15b 100644 --- a/src/viewer/text/view.h +++ b/src/viewer/text/view.h @@ -76,6 +76,10 @@ enum frame_event_status copy_current_link_to_clipboard(struct session *ses, struct document_view *doc_view, int xxx); +enum frame_event_status copy_to_clipboard(struct session *ses, struct document_view *doc_view); + +enum frame_event_status mark_clipboard(struct session *ses, struct document_view *doc_view); + /** If the user has provided a numeric prefix, jump to the link * with that number as its index. */ int try_jump_to_link_number(struct session *ses, From b6ec0c64d589b4b42d6ee17779effe3e1d820168 Mon Sep 17 00:00:00 2001 From: Witold Filipczyk Date: Sun, 2 Aug 2020 15:41:35 +0200 Subject: [PATCH 009/179] [clipboard] Fixes. --- src/viewer/text/draw.c | 4 ++-- src/viewer/text/view.c | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/viewer/text/draw.c b/src/viewer/text/draw.c index cd251ddb..3b349203 100644 --- a/src/viewer/text/draw.c +++ b/src/viewer/text/draw.c @@ -188,8 +188,8 @@ draw_clipboard(struct terminal *term, struct document_view *doc_view) startx = int_max(0, document->clipboard_box.x + xoffset); endx = int_min(doc_view->box.width, document->clipboard_box.x + document->clipboard_box.width + xoffset); - for (y = starty; y <= endy; ++y) { - for (x = startx; x <= endx; ++x) { + for (y = starty; y < endy; ++y) { + for (x = startx; x < endx; ++x) { draw_char_color(term, x, y, color); } } diff --git a/src/viewer/text/view.c b/src/viewer/text/view.c index 5160d837..9def2375 100644 --- a/src/viewer/text/view.c +++ b/src/viewer/text/view.c @@ -977,8 +977,8 @@ move_clipboard_pos(struct session *ses, struct document_view *view, enum frame_e return status; } - document->clipboard_box.height = y - document->clipboard_box.y; - document->clipboard_box.width = x - document->clipboard_box.x; + document->clipboard_box.height = y - document->clipboard_box.y + 1; + document->clipboard_box.width = x - document->clipboard_box.x + 1; return FRAME_EVENT_REFRESH; } @@ -1069,8 +1069,8 @@ mark_clipboard(struct session *ses, struct document_view *doc_view) case CLIPBOARD_NONE: document->clipboard_box.x = x; document->clipboard_box.y = y; - document->clipboard_box.height = 0; - document->clipboard_box.width = 0; + document->clipboard_box.height = 1; + document->clipboard_box.width = 1; document->clipboard_status = CLIPBOARD_FIRST_POINT; return FRAME_EVENT_OK; @@ -1082,8 +1082,8 @@ mark_clipboard(struct session *ses, struct document_view *doc_view) if (document->clipboard_box.x > x || document->clipboard_box.y > y) { return FRAME_EVENT_OK; } - document->clipboard_box.height = y - document->clipboard_box.y; - document->clipboard_box.width = x - document->clipboard_box.x; + document->clipboard_box.height = y - document->clipboard_box.y + 1; + document->clipboard_box.width = x - document->clipboard_box.x + 1; document->clipboard_status = CLIPBOARD_SECOND_POINT; return FRAME_EVENT_REFRESH; From 9fd79ec508dba068c1477e59f8e9cdc371b216f8 Mon Sep 17 00:00:00 2001 From: Witold Filipczyk Date: Sun, 2 Aug 2020 16:20:08 +0200 Subject: [PATCH 010/179] [clipboard] Show last line --- src/viewer/text/draw.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/viewer/text/draw.c b/src/viewer/text/draw.c index 3b349203..fdbc1630 100644 --- a/src/viewer/text/draw.c +++ b/src/viewer/text/draw.c @@ -183,8 +183,8 @@ draw_clipboard(struct terminal *term, struct document_view *doc_view) xoffset = doc_view->box.x - doc_view->vs->x; yoffset = doc_view->box.y - doc_view->vs->y; - starty = int_max(0, document->clipboard_box.y + yoffset); - endy = int_min(doc_view->box.height, document->clipboard_box.y + document->clipboard_box.height + yoffset); + starty = int_max(doc_view->box.y, document->clipboard_box.y + yoffset); + endy = int_min(doc_view->box.y + doc_view->box.height, document->clipboard_box.y + document->clipboard_box.height + yoffset); startx = int_max(0, document->clipboard_box.x + xoffset); endx = int_min(doc_view->box.width, document->clipboard_box.x + document->clipboard_box.width + xoffset); From 53002765c4a9c266ccce3f6e3174772037f6d7c0 Mon Sep 17 00:00:00 2001 From: Witold Filipczyk Date: Sun, 2 Aug 2020 16:24:00 +0200 Subject: [PATCH 011/179] [clipboard] Off by one. --- src/viewer/text/view.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/viewer/text/view.c b/src/viewer/text/view.c index 9def2375..fd283f81 100644 --- a/src/viewer/text/view.c +++ b/src/viewer/text/view.c @@ -1000,11 +1000,11 @@ copy_to_clipboard2(struct document_view *doc_view) } starty = document->clipboard_box.y; - endy = int_min(document->clipboard_box.y + document->clipboard_box.height, document->height - 1); + endy = int_min(document->clipboard_box.y + document->clipboard_box.height, document->height); startx = document->clipboard_box.x; utf8 = document->options.utf8; - for (y = starty; y <= endy; y++) { + for (y = starty; y < endy; y++) { int endx = int_min(document->clipboard_box.x + document->clipboard_box.width, document->data[y].length); int x; From f88e7c60816883bdde8dfc342a84a81791a232b1 Mon Sep 17 00:00:00 2001 From: Felix Janda Date: Sun, 2 Aug 2020 17:42:47 -0400 Subject: [PATCH 012/179] Fix compilation with gcc-10 Fixes the errors x86_64-pc-linux-gnu-ld: hooks.o:(.bss+0x0): multiple definition of `erb_module'; core.o:(.bss+0x0): first defined here x86_64-pc-linux-gnu-ld: ruby.o:(.bss+0x0): multiple definition of `erb_module'; core.o:(.bss+0x0): first defined here Bug: https://bugs.gentoo.org/730658 --- src/scripting/ruby/core.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/scripting/ruby/core.h b/src/scripting/ruby/core.h index f75745d9..74b66cd9 100644 --- a/src/scripting/ruby/core.h +++ b/src/scripting/ruby/core.h @@ -21,7 +21,7 @@ struct session; #define RB_ERRINFO (ruby_errinfo) #endif -VALUE erb_module; +extern VALUE erb_module; void alert_ruby_error(struct session *ses, unsigned char *msg); void erb_report_error(struct session *ses, int state); From ed9322551065d31f0bce01d2dfbed2d8a2531d48 Mon Sep 17 00:00:00 2001 From: Witold Filipczyk Date: Mon, 3 Aug 2020 17:22:21 +0200 Subject: [PATCH 013/179] [draw] Refresh all page, when clipboard buffer is drawn. --- src/viewer/text/draw.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/viewer/text/draw.c b/src/viewer/text/draw.c index fdbc1630..1e6b6590 100644 --- a/src/viewer/text/draw.c +++ b/src/viewer/text/draw.c @@ -193,6 +193,8 @@ draw_clipboard(struct terminal *term, struct document_view *doc_view) draw_char_color(term, x, y, color); } } + doc_view->last_x = doc_view->last_y = -1; + } static void From effb18d31f4c48483471b1ae0db3c1f8c1da7080 Mon Sep 17 00:00:00 2001 From: Witold Filipczyk Date: Mon, 3 Aug 2020 18:27:25 +0200 Subject: [PATCH 014/179] [clipboard] Allow to change rectangle in both directions --- src/viewer/text/draw.c | 20 +++++++++++--- src/viewer/text/view.c | 61 ++++++++++++++++++++---------------------- 2 files changed, 46 insertions(+), 35 deletions(-) diff --git a/src/viewer/text/draw.c b/src/viewer/text/draw.c index 1e6b6590..8e9b4fef 100644 --- a/src/viewer/text/draw.c +++ b/src/viewer/text/draw.c @@ -175,7 +175,7 @@ draw_clipboard(struct terminal *term, struct document_view *doc_view) assert(term && doc_view); if_assert_failed return; - if (!document->clipboard_box.height || !document->clipboard_box.width) { + if (document->clipboard_status == CLIPBOARD_NONE) { return; } @@ -188,8 +188,22 @@ draw_clipboard(struct terminal *term, struct document_view *doc_view) startx = int_max(0, document->clipboard_box.x + xoffset); endx = int_min(doc_view->box.width, document->clipboard_box.x + document->clipboard_box.width + xoffset); - for (y = starty; y < endy; ++y) { - for (x = startx; x < endx; ++x) { + if (endy < starty) { + int tmp = endy; + + endy = starty; + starty = tmp; + } + + if (endx < startx) { + int tmp = endx; + + endx = startx; + startx = tmp; + } + + for (y = starty; y <= endy; ++y) { + for (x = startx; x <= endx; ++x) { draw_char_color(term, x, y, color); } } diff --git a/src/viewer/text/view.c b/src/viewer/text/view.c index fd283f81..6ee5e57a 100644 --- a/src/viewer/text/view.c +++ b/src/viewer/text/view.c @@ -969,16 +969,8 @@ move_clipboard_pos(struct session *ses, struct document_view *view, enum frame_e x = ses->tab->x + xoffset; y = ses->tab->y + yoffset; - if (document->clipboard_box.x == x && document->clipboard_box.y == y) { - return status; - } - - if (document->clipboard_box.x > x || document->clipboard_box.y > y) { - return status; - } - - document->clipboard_box.height = y - document->clipboard_box.y + 1; - document->clipboard_box.width = x - document->clipboard_box.x + 1; + document->clipboard_box.height = y - document->clipboard_box.y; + document->clipboard_box.width = x - document->clipboard_box.x; return FRAME_EVENT_REFRESH; } @@ -988,10 +980,10 @@ copy_to_clipboard2(struct document_view *doc_view) { struct document *document = doc_view->document; struct string data; - int starty, endy, startx, y; + int starty, endy, startx, y, endx; int utf8; - if (!document->clipboard_box.height || !document->clipboard_box.width) { + if (document->clipboard_status == CLIPBOARD_NONE) { return FRAME_EVENT_OK; } @@ -999,16 +991,29 @@ copy_to_clipboard2(struct document_view *doc_view) return FRAME_EVENT_OK; } - starty = document->clipboard_box.y; - endy = int_min(document->clipboard_box.y + document->clipboard_box.height, document->height); - startx = document->clipboard_box.x; + if (document->clipboard_box.height >= 0) { + starty = document->clipboard_box.y; + endy = int_min(document->clipboard_box.y + document->clipboard_box.height, document->height); + } else { + endy = document->clipboard_box.y; + starty = int_max(document->clipboard_box.y + document->clipboard_box.height, 0); + } + + if (document->clipboard_box.width >= 0) { + startx = document->clipboard_box.x; + endx = document->clipboard_box.x + document->clipboard_box.width; + } else { + endx = document->clipboard_box.x; + startx = int_max(document->clipboard_box.x + document->clipboard_box.width, 0); + } + utf8 = document->options.utf8; - for (y = starty; y < endy; y++) { - int endx = int_min(document->clipboard_box.x + document->clipboard_box.width, document->data[y].length); + for (y = starty; y <= endy; y++) { + int ex = int_min(endx, document->data[y].length - 1); int x; - for (x = startx; x < endx; x++) { + for (x = startx; x <= ex; x++) { #ifdef CONFIG_UTF8 unicode_val_T c; #else @@ -1069,21 +1074,15 @@ mark_clipboard(struct session *ses, struct document_view *doc_view) case CLIPBOARD_NONE: document->clipboard_box.x = x; document->clipboard_box.y = y; - document->clipboard_box.height = 1; - document->clipboard_box.width = 1; + document->clipboard_box.height = 0; + document->clipboard_box.width = 0; document->clipboard_status = CLIPBOARD_FIRST_POINT; - return FRAME_EVENT_OK; + return FRAME_EVENT_REFRESH; case CLIPBOARD_FIRST_POINT: - if (document->clipboard_box.x == x && document->clipboard_box.y == y) { - return FRAME_EVENT_OK; - } - if (document->clipboard_box.x > x || document->clipboard_box.y > y) { - return FRAME_EVENT_OK; - } - document->clipboard_box.height = y - document->clipboard_box.y + 1; - document->clipboard_box.width = x - document->clipboard_box.x + 1; + document->clipboard_box.height = y - document->clipboard_box.y; + document->clipboard_box.width = x - document->clipboard_box.x; document->clipboard_status = CLIPBOARD_SECOND_POINT; return FRAME_EVENT_REFRESH; @@ -1129,9 +1128,7 @@ copy_current_link_to_clipboard(struct session *ses, enum frame_event_status copy_to_clipboard(struct session *ses, struct document_view *doc_view) { - if (doc_view && doc_view->document - && doc_view->document->clipboard_box.height - && doc_view->document->clipboard_box.width) { + if (doc_view && doc_view->document && doc_view->document->clipboard_status != CLIPBOARD_NONE) { return copy_to_clipboard2(doc_view); } From 4bdf5fbbc488084485e455d1b68879a48a98d5ff Mon Sep 17 00:00:00 2001 From: Witold Filipczyk Date: Mon, 3 Aug 2020 18:56:26 +0200 Subject: [PATCH 015/179] [clipboard] Fixes --- src/viewer/text/draw.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/viewer/text/draw.c b/src/viewer/text/draw.c index 8e9b4fef..9ae45f34 100644 --- a/src/viewer/text/draw.c +++ b/src/viewer/text/draw.c @@ -185,8 +185,8 @@ draw_clipboard(struct terminal *term, struct document_view *doc_view) starty = int_max(doc_view->box.y, document->clipboard_box.y + yoffset); endy = int_min(doc_view->box.y + doc_view->box.height, document->clipboard_box.y + document->clipboard_box.height + yoffset); - startx = int_max(0, document->clipboard_box.x + xoffset); - endx = int_min(doc_view->box.width, document->clipboard_box.x + document->clipboard_box.width + xoffset); + startx = int_max(doc_view->box.x, document->clipboard_box.x + xoffset); + endx = int_min(doc_view->box.x + doc_view->box.width, document->clipboard_box.x + document->clipboard_box.width + xoffset); if (endy < starty) { int tmp = endy; From ee38fea126bee19c5d2548bb216bdb2c26e14a91 Mon Sep 17 00:00:00 2001 From: Witold Filipczyk Date: Mon, 3 Aug 2020 23:16:43 +0200 Subject: [PATCH 016/179] [unicode] Code to calculate cell widths of unicode characters taken from konsole. Refs #60 --- src/intl/Makefile | 2 +- src/intl/charsets.c | 3 + src/intl/width.c | 160 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 164 insertions(+), 1 deletion(-) create mode 100644 src/intl/width.c diff --git a/src/intl/Makefile b/src/intl/Makefile index 596c61d7..444e49a8 100644 --- a/src/intl/Makefile +++ b/src/intl/Makefile @@ -3,6 +3,6 @@ include $(top_builddir)/Makefile.config SUBDIRS-$(CONFIG_NLS) += gettext -OBJS = charsets.o +OBJS = charsets.o width.o include $(top_srcdir)/Makefile.lib diff --git a/src/intl/charsets.c b/src/intl/charsets.c index 5b30c855..b8db4621 100644 --- a/src/intl/charsets.c +++ b/src/intl/charsets.c @@ -607,6 +607,8 @@ invalid_arg: * @return 2 for double-width glyph, 1 for others. * 0 for unprintable glyphs (like 0x200e: "LEFT-TO-RIGHT MARK") */ + +#if 0 NONSTATIC_INLINE int unicode_to_cell(unicode_val_T c) { @@ -630,6 +632,7 @@ unicode_to_cell(unicode_val_T c) return 1; } +#endif /* Fold the case of a Unicode character, so that hotkeys in labels can * be compared case-insensitively. It is unspecified whether the diff --git a/src/intl/width.c b/src/intl/width.c new file mode 100644 index 00000000..e68adb1e --- /dev/null +++ b/src/intl/width.c @@ -0,0 +1,160 @@ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "elinks.h" + +#include "intl/charsets.h" + +/* + This file is part of Konsole, a terminal emulator for KDE. + + Copyright 2018 by Mariusz Glebocki + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301 USA. +*/ + + +struct Range { + uint first, last; +}; + +struct RangeLut { + int8_t width; + const struct Range * const lut; + int size; +}; + +enum { + InvalidWidth = INT8_MIN +}; + + +static const int8_t DIRECT_LUT[] = { + 0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, +}; + + +static const struct Range LUT_NONPRINTABLE[] = { + {0x00d800,0x00dfff}, +}; + +static const struct Range LUT_2[] = { + {0x001100,0x00115f},{0x00231a,0x00231b},{0x002329,0x00232a},{0x0023e9,0x0023ec},{0x0023f0,0x0023f0},{0x0023f3,0x0023f3},{0x0025fd,0x0025fe},{0x002614,0x002615}, + {0x002648,0x002653},{0x00267f,0x00267f},{0x002693,0x002693},{0x0026a1,0x0026a1},{0x0026aa,0x0026ab},{0x0026bd,0x0026be},{0x0026c4,0x0026c5},{0x0026ce,0x0026ce}, + {0x0026d4,0x0026d4},{0x0026ea,0x0026ea},{0x0026f2,0x0026f3},{0x0026f5,0x0026f5},{0x0026fa,0x0026fa},{0x0026fd,0x0026fd},{0x002705,0x002705},{0x00270a,0x00270b}, + {0x002728,0x002728},{0x00274c,0x00274c},{0x00274e,0x00274e},{0x002753,0x002755},{0x002757,0x002757},{0x002795,0x002797},{0x0027b0,0x0027b0},{0x0027bf,0x0027bf}, + {0x002b1b,0x002b1c},{0x002b50,0x002b50},{0x002b55,0x002b55},{0x002e80,0x002e99},{0x002e9b,0x002ef3},{0x002f00,0x002fd5},{0x002ff0,0x002ffb},{0x003000,0x003029}, + {0x00302e,0x00303e},{0x003041,0x003096},{0x00309b,0x0030ff},{0x003105,0x00312f},{0x003131,0x00318e},{0x003190,0x0031ba},{0x0031c0,0x0031e3},{0x0031f0,0x00321e}, + {0x003220,0x003247},{0x003250,0x0032fe},{0x003300,0x004dbf},{0x004e00,0x00a48c},{0x00a490,0x00a4c6},{0x00a960,0x00a97c},{0x00ac00,0x00d7a3},{0x00f900,0x00faff}, + {0x00fe10,0x00fe19},{0x00fe30,0x00fe52},{0x00fe54,0x00fe66},{0x00fe68,0x00fe6b},{0x00ff01,0x00ff60},{0x00ffe0,0x00ffe6},{0x016fe0,0x016fe1},{0x017000,0x0187f1}, + {0x018800,0x018af2},{0x01b000,0x01b11e},{0x01b170,0x01b2fb},{0x01f004,0x01f004},{0x01f0cf,0x01f0cf},{0x01f18e,0x01f18e},{0x01f191,0x01f19a},{0x01f1e6,0x01f202}, + {0x01f210,0x01f23b},{0x01f240,0x01f248},{0x01f250,0x01f251},{0x01f260,0x01f265},{0x01f300,0x01f320},{0x01f32d,0x01f335},{0x01f337,0x01f37c},{0x01f37e,0x01f393}, + {0x01f3a0,0x01f3ca},{0x01f3cf,0x01f3d3},{0x01f3e0,0x01f3f0},{0x01f3f4,0x01f3f4},{0x01f3f8,0x01f43e},{0x01f440,0x01f440},{0x01f442,0x01f4fc},{0x01f4ff,0x01f53d}, + {0x01f54b,0x01f54e},{0x01f550,0x01f567},{0x01f57a,0x01f57a},{0x01f595,0x01f596},{0x01f5a4,0x01f5a4},{0x01f5fb,0x01f64f},{0x01f680,0x01f6c5},{0x01f6cc,0x01f6cc}, + {0x01f6d0,0x01f6d2},{0x01f6eb,0x01f6ec},{0x01f6f4,0x01f6f9},{0x01f910,0x01f93e},{0x01f940,0x01f970},{0x01f973,0x01f976},{0x01f97a,0x01f97a},{0x01f97c,0x01f9a2}, + {0x01f9b0,0x01f9b9},{0x01f9c0,0x01f9c2},{0x01f9d0,0x01f9ff},{0x020000,0x02fffd},{0x030000,0x03fffd}, +}; + +static const struct Range LUT_0[] = { + {0x000300,0x00036f},{0x000483,0x000489},{0x000591,0x0005bd},{0x0005bf,0x0005bf},{0x0005c1,0x0005c2},{0x0005c4,0x0005c5},{0x0005c7,0x0005c7},{0x000600,0x000605}, + {0x000610,0x00061a},{0x00061c,0x00061c},{0x00064b,0x00065f},{0x000670,0x000670},{0x0006d6,0x0006dd},{0x0006df,0x0006e4},{0x0006e7,0x0006e8},{0x0006ea,0x0006ed}, + {0x00070f,0x00070f},{0x000711,0x000711},{0x000730,0x00074a},{0x0007a6,0x0007b0},{0x0007eb,0x0007f3},{0x0007fd,0x0007fd},{0x000816,0x000819},{0x00081b,0x000823}, + {0x000825,0x000827},{0x000829,0x00082d},{0x000859,0x00085b},{0x0008d3,0x000902},{0x00093a,0x00093a},{0x00093c,0x00093c},{0x000941,0x000948},{0x00094d,0x00094d}, + {0x000951,0x000957},{0x000962,0x000963},{0x000981,0x000981},{0x0009bc,0x0009bc},{0x0009c1,0x0009c4},{0x0009cd,0x0009cd},{0x0009e2,0x0009e3},{0x0009fe,0x0009fe}, + {0x000a01,0x000a02},{0x000a3c,0x000a3c},{0x000a41,0x000a42},{0x000a47,0x000a48},{0x000a4b,0x000a4d},{0x000a51,0x000a51},{0x000a70,0x000a71},{0x000a75,0x000a75}, + {0x000a81,0x000a82},{0x000abc,0x000abc},{0x000ac1,0x000ac5},{0x000ac7,0x000ac8},{0x000acd,0x000acd},{0x000ae2,0x000ae3},{0x000afa,0x000aff},{0x000b01,0x000b01}, + {0x000b3c,0x000b3c},{0x000b3f,0x000b3f},{0x000b41,0x000b44},{0x000b4d,0x000b4d},{0x000b56,0x000b56},{0x000b62,0x000b63},{0x000b82,0x000b82},{0x000bc0,0x000bc0}, + {0x000bcd,0x000bcd},{0x000c00,0x000c00},{0x000c04,0x000c04},{0x000c3e,0x000c40},{0x000c46,0x000c48},{0x000c4a,0x000c4d},{0x000c55,0x000c56},{0x000c62,0x000c63}, + {0x000c81,0x000c81},{0x000cbc,0x000cbc},{0x000cbf,0x000cbf},{0x000cc6,0x000cc6},{0x000ccc,0x000ccd},{0x000ce2,0x000ce3},{0x000d00,0x000d01},{0x000d3b,0x000d3c}, + {0x000d41,0x000d44},{0x000d4d,0x000d4d},{0x000d62,0x000d63},{0x000dca,0x000dca},{0x000dd2,0x000dd4},{0x000dd6,0x000dd6},{0x000e31,0x000e31},{0x000e34,0x000e3a}, + {0x000e47,0x000e4e},{0x000eb1,0x000eb1},{0x000eb4,0x000eb9},{0x000ebb,0x000ebc},{0x000ec8,0x000ecd},{0x000f18,0x000f19},{0x000f35,0x000f35},{0x000f37,0x000f37}, + {0x000f39,0x000f39},{0x000f71,0x000f7e},{0x000f80,0x000f84},{0x000f86,0x000f87},{0x000f8d,0x000f97},{0x000f99,0x000fbc},{0x000fc6,0x000fc6},{0x00102d,0x001030}, + {0x001032,0x001037},{0x001039,0x00103a},{0x00103d,0x00103e},{0x001058,0x001059},{0x00105e,0x001060},{0x001071,0x001074},{0x001082,0x001082},{0x001085,0x001086}, + {0x00108d,0x00108d},{0x00109d,0x00109d},{0x001160,0x001160},{0x00135d,0x00135f},{0x001712,0x001714},{0x001732,0x001734},{0x001752,0x001753},{0x001772,0x001773}, + {0x0017b4,0x0017b5},{0x0017b7,0x0017bd},{0x0017c6,0x0017c6},{0x0017c9,0x0017d3},{0x0017dd,0x0017dd},{0x00180b,0x00180e},{0x001885,0x001886},{0x0018a9,0x0018a9}, + {0x001920,0x001922},{0x001927,0x001928},{0x001932,0x001932},{0x001939,0x00193b},{0x001a17,0x001a18},{0x001a1b,0x001a1b},{0x001a56,0x001a56},{0x001a58,0x001a5e}, + {0x001a60,0x001a60},{0x001a62,0x001a62},{0x001a65,0x001a6c},{0x001a73,0x001a7c},{0x001a7f,0x001a7f},{0x001ab0,0x001abe},{0x001b00,0x001b03},{0x001b34,0x001b34}, + {0x001b36,0x001b3a},{0x001b3c,0x001b3c},{0x001b42,0x001b42},{0x001b6b,0x001b73},{0x001b80,0x001b81},{0x001ba2,0x001ba5},{0x001ba8,0x001ba9},{0x001bab,0x001bad}, + {0x001be6,0x001be6},{0x001be8,0x001be9},{0x001bed,0x001bed},{0x001bef,0x001bf1},{0x001c2c,0x001c33},{0x001c36,0x001c37},{0x001cd0,0x001cd2},{0x001cd4,0x001ce0}, + {0x001ce2,0x001ce8},{0x001ced,0x001ced},{0x001cf4,0x001cf4},{0x001cf8,0x001cf9},{0x001dc0,0x001df9},{0x001dfb,0x001dff},{0x00200b,0x00200f},{0x00202a,0x00202e}, + {0x002060,0x002064},{0x002066,0x00206f},{0x0020d0,0x0020f0},{0x002cef,0x002cf1},{0x002d7f,0x002d7f},{0x002de0,0x002dff},{0x00302a,0x00302d},{0x003099,0x00309a}, + {0x00a66f,0x00a672},{0x00a674,0x00a67d},{0x00a69e,0x00a69f},{0x00a6f0,0x00a6f1},{0x00a802,0x00a802},{0x00a806,0x00a806},{0x00a80b,0x00a80b},{0x00a825,0x00a826}, + {0x00a8c4,0x00a8c5},{0x00a8e0,0x00a8f1},{0x00a8ff,0x00a8ff},{0x00a926,0x00a92d},{0x00a947,0x00a951},{0x00a980,0x00a982},{0x00a9b3,0x00a9b3},{0x00a9b6,0x00a9b9}, + {0x00a9bc,0x00a9bc},{0x00a9e5,0x00a9e5},{0x00aa29,0x00aa2e},{0x00aa31,0x00aa32},{0x00aa35,0x00aa36},{0x00aa43,0x00aa43},{0x00aa4c,0x00aa4c},{0x00aa7c,0x00aa7c}, + {0x00aab0,0x00aab0},{0x00aab2,0x00aab4},{0x00aab7,0x00aab8},{0x00aabe,0x00aabf},{0x00aac1,0x00aac1},{0x00aaec,0x00aaed},{0x00aaf6,0x00aaf6},{0x00abe5,0x00abe5}, + {0x00abe8,0x00abe8},{0x00abed,0x00abed},{0x00fb1e,0x00fb1e},{0x00fe00,0x00fe0f},{0x00fe20,0x00fe2f},{0x00feff,0x00feff},{0x00fff9,0x00fffb},{0x0101fd,0x0101fd}, + {0x0102e0,0x0102e0},{0x010376,0x01037a},{0x010a01,0x010a03},{0x010a05,0x010a06},{0x010a0c,0x010a0f},{0x010a38,0x010a3a},{0x010a3f,0x010a3f},{0x010ae5,0x010ae6}, + {0x010d24,0x010d27},{0x010f46,0x010f50},{0x011001,0x011001},{0x011038,0x011046},{0x01107f,0x011081},{0x0110b3,0x0110b6},{0x0110b9,0x0110ba},{0x0110bd,0x0110bd}, + {0x0110cd,0x0110cd},{0x011100,0x011102},{0x011127,0x01112b},{0x01112d,0x011134},{0x011173,0x011173},{0x011180,0x011181},{0x0111b6,0x0111be},{0x0111c9,0x0111cc}, + {0x01122f,0x011231},{0x011234,0x011234},{0x011236,0x011237},{0x01123e,0x01123e},{0x0112df,0x0112df},{0x0112e3,0x0112ea},{0x011300,0x011301},{0x01133b,0x01133c}, + {0x011340,0x011340},{0x011366,0x01136c},{0x011370,0x011374},{0x011438,0x01143f},{0x011442,0x011444},{0x011446,0x011446},{0x01145e,0x01145e},{0x0114b3,0x0114b8}, + {0x0114ba,0x0114ba},{0x0114bf,0x0114c0},{0x0114c2,0x0114c3},{0x0115b2,0x0115b5},{0x0115bc,0x0115bd},{0x0115bf,0x0115c0},{0x0115dc,0x0115dd},{0x011633,0x01163a}, + {0x01163d,0x01163d},{0x01163f,0x011640},{0x0116ab,0x0116ab},{0x0116ad,0x0116ad},{0x0116b0,0x0116b5},{0x0116b7,0x0116b7},{0x01171d,0x01171f},{0x011722,0x011725}, + {0x011727,0x01172b},{0x01182f,0x011837},{0x011839,0x01183a},{0x011a01,0x011a0a},{0x011a33,0x011a38},{0x011a3b,0x011a3e},{0x011a47,0x011a47},{0x011a51,0x011a56}, + {0x011a59,0x011a5b},{0x011a8a,0x011a96},{0x011a98,0x011a99},{0x011c30,0x011c36},{0x011c38,0x011c3d},{0x011c3f,0x011c3f},{0x011c92,0x011ca7},{0x011caa,0x011cb0}, + {0x011cb2,0x011cb3},{0x011cb5,0x011cb6},{0x011d31,0x011d36},{0x011d3a,0x011d3a},{0x011d3c,0x011d3d},{0x011d3f,0x011d45},{0x011d47,0x011d47},{0x011d90,0x011d91}, + {0x011d95,0x011d95},{0x011d97,0x011d97},{0x011ef3,0x011ef4},{0x016af0,0x016af4},{0x016b30,0x016b36},{0x016f8f,0x016f92},{0x01bc9d,0x01bc9e},{0x01bca0,0x01bca3}, + {0x01d167,0x01d169},{0x01d173,0x01d182},{0x01d185,0x01d18b},{0x01d1aa,0x01d1ad},{0x01d242,0x01d244},{0x01da00,0x01da36},{0x01da3b,0x01da6c},{0x01da75,0x01da75}, + {0x01da84,0x01da84},{0x01da9b,0x01da9f},{0x01daa1,0x01daaf},{0x01e000,0x01e006},{0x01e008,0x01e018},{0x01e01b,0x01e021},{0x01e023,0x01e024},{0x01e026,0x01e02a}, + {0x01e8d0,0x01e8d6},{0x01e944,0x01e94a},{0x0e0001,0x0e0001},{0x0e0020,0x0e007f},{0x0e0100,0x0e01ef}, +}; + + +static const struct RangeLut RANGE_LUT_LIST[] = { + {-1, LUT_NONPRINTABLE, 1}, + { 2, LUT_2 , 109}, + { 0, LUT_0 , 325}, + { 1, NULL , 1}, +}; +static const int RANGE_LUT_LIST_SIZE = 4; + + +int +unicode_to_cell(unicode_val_T ucs4) +{ + const struct RangeLut *rl; + + if (ucs4 < sizeof(DIRECT_LUT)) { + return DIRECT_LUT[ucs4]; + } + + for (rl = RANGE_LUT_LIST; rl->lut != NULL; ++rl) { + int l = 0; + int r = rl->size - 1; + + while(l <= r) { + const int m = (l + r) / 2; + + if (rl->lut[m].last < ucs4) { + l = m + 1; + } else if(rl->lut[m].first > ucs4) { + r = m - 1; + } else { + return rl->width; + } + } + } + + return RANGE_LUT_LIST[RANGE_LUT_LIST_SIZE - 1].width; +} From 964530422a22923617db78258a259f122341f569 Mon Sep 17 00:00:00 2001 From: Witold Filipczyk Date: Tue, 4 Aug 2020 16:07:19 +0200 Subject: [PATCH 017/179] [clipboard] Allow to enter the clipboard mode only with cursor routing. Refs #59 --- src/viewer/text/view.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/viewer/text/view.c b/src/viewer/text/view.c index 6ee5e57a..cda02fbf 100644 --- a/src/viewer/text/view.c +++ b/src/viewer/text/view.c @@ -1069,6 +1069,10 @@ mark_clipboard(struct session *ses, struct document_view *doc_view) int x = ses->tab->x + xoffset; int y = ses->tab->y + yoffset; + if (ses->navigate_mode != NAVIGATE_CURSOR_ROUTING) { + return FRAME_EVENT_OK; + } + switch (document->clipboard_status) { case CLIPBOARD_NONE: From bec41b6e2fa42d2280294619abd153889e7e5e6a Mon Sep 17 00:00:00 2001 From: Witold Filipczyk Date: Tue, 4 Aug 2020 19:22:31 +0200 Subject: [PATCH 018/179] [clip] Page down overlaps sometimes. --- src/viewer/text/draw.c | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/src/viewer/text/draw.c b/src/viewer/text/draw.c index 9ae45f34..a2e7703e 100644 --- a/src/viewer/text/draw.c +++ b/src/viewer/text/draw.c @@ -183,23 +183,25 @@ draw_clipboard(struct terminal *term, struct document_view *doc_view) xoffset = doc_view->box.x - doc_view->vs->x; yoffset = doc_view->box.y - doc_view->vs->y; - starty = int_max(doc_view->box.y, document->clipboard_box.y + yoffset); - endy = int_min(doc_view->box.y + doc_view->box.height, document->clipboard_box.y + document->clipboard_box.height + yoffset); - startx = int_max(doc_view->box.x, document->clipboard_box.x + xoffset); - endx = int_min(doc_view->box.x + doc_view->box.width, document->clipboard_box.x + document->clipboard_box.width + xoffset); - if (endy < starty) { - int tmp = endy; - - endy = starty; - starty = tmp; + if (document->clipboard_box.height >= 0) { + starty = int_max(doc_view->box.y, document->clipboard_box.y + yoffset); + endy = int_min(doc_view->box.y + doc_view->box.height, + document->clipboard_box.y + document->clipboard_box.height + yoffset); + } else { + endy = int_max(doc_view->box.y, document->clipboard_box.y + yoffset); + starty = int_min(doc_view->box.y + doc_view->box.height, + document->clipboard_box.y + document->clipboard_box.height + yoffset); } - if (endx < startx) { - int tmp = endx; - - endx = startx; - startx = tmp; + if (document->clipboard_box.width >= 0) { + startx = int_max(doc_view->box.x, document->clipboard_box.x + xoffset); + endx = int_min(doc_view->box.x + doc_view->box.width, + document->clipboard_box.x + document->clipboard_box.width + xoffset); + } else { + endx = int_max(doc_view->box.x, document->clipboard_box.x + xoffset); + startx = int_min(doc_view->box.x + doc_view->box.width, + document->clipboard_box.x + document->clipboard_box.width + xoffset); } for (y = starty; y <= endy; ++y) { From 8b8f57ed757591a6b653ca000eef589cb47e6fe0 Mon Sep 17 00:00:00 2001 From: Witold Filipczyk Date: Sun, 9 Aug 2020 17:45:22 +0200 Subject: [PATCH 019/179] [python] If page encoding is not "utf-8", encode it twice in pre_format_html_hook. Once to utf-8 before pre_format_html_hook, and second time to the original encoding after python script execution. I know it is inefficient, but computers are quite fast nowadays. --- src/scripting/python/hooks.c | 137 ++++++++++++++++++++++++++++++++--- 1 file changed, 128 insertions(+), 9 deletions(-) diff --git a/src/scripting/python/hooks.c b/src/scripting/python/hooks.c index 62b8e0bc..7cba0733 100644 --- a/src/scripting/python/hooks.c +++ b/src/scripting/python/hooks.c @@ -7,6 +7,7 @@ #define PY_SSIZE_T_CLEAN #include +#include #include #include @@ -14,6 +15,7 @@ #include "cache/cache.h" #include "main/event.h" +#include "protocol/header.h" #include "protocol/uri.h" #include "scripting/python/core.h" #include "session/session.h" @@ -79,6 +81,60 @@ script_hook_url(va_list ap, void *data) return EVENT_HOOK_STATUS_NEXT; } +static int +get_codepage(unsigned char *head) +{ + int cp_index = -1; + unsigned char *part = head; + + if (!head) { + goto none; + } + while (cp_index == -1) { + unsigned char *ct_charset; + /* scan_http_equiv() appends the meta http-equiv directives to + * the protocol header before this function is called, but the + * HTTP Content-Type header has precedence, so the HTTP header + * will be used if it exists and the meta header is only used + * as a fallback. See bug 983. */ + unsigned char *a = parse_header(part, "Content-Type", &part); + + if (!a) break; + + parse_header_param(a, "charset", &ct_charset, 0); + if (ct_charset) { + cp_index = get_cp_index(ct_charset); + mem_free(ct_charset); + } + mem_free(a); + } + + if (cp_index == -1) { + unsigned char *a = parse_header(head, "Content-Charset", NULL); + + if (a) { + cp_index = get_cp_index(a); + mem_free(a); + } + } + + if (cp_index == -1) { + unsigned char *a = parse_header(head, "Charset", NULL); + + if (a) { + cp_index = get_cp_index(a); + mem_free(a); + } + } + +none: + if (cp_index == -1) { + cp_index = get_cp_index("System"); + } + + return cp_index; +} + /* Call a Python hook for a pre-format-html event. */ static enum evhook_status @@ -88,9 +144,10 @@ script_hook_pre_format_html(va_list ap, void *data) struct cache_entry *cached = va_arg(ap, struct cache_entry *); struct fragment *fragment = get_cache_fragment(cached); unsigned char *url = struri(cached->uri); + int codepage = get_codepage(cached->head); char *method = "pre_format_html_hook"; struct session *saved_python_ses = python_ses; - PyObject *result; + PyObject *result = NULL; int success = 0; evhook_use_params(ses && cached); @@ -101,8 +158,39 @@ script_hook_pre_format_html(va_list ap, void *data) python_ses = ses; - result = PyObject_CallMethod(python_hooks, method, "ss#", url, - fragment->data, fragment->length); + if (!is_cp_utf8(codepage)) { + size_t iconv_res; + size_t ileft; + size_t oleft; + char *inbuf, *outbuf; + char *utf8_data = mem_alloc(fragment->length * 8); + iconv_t cd; + + if (!utf8_data) { + goto error; + } + cd = iconv_open("utf-8", get_cp_mime_name(codepage)); + if (cd == (iconv_t)-1) { + mem_free(utf8_data); + goto error; + } + inbuf = fragment->data; + outbuf = utf8_data; + ileft = fragment->length; + oleft = fragment->length * 8; + iconv_res = iconv(cd, &inbuf, &ileft, &outbuf, &oleft); + + if (iconv_res == -1) { + mem_free(utf8_data); + goto error; + } + iconv_close(cd); + + result = PyObject_CallMethod(python_hooks, method, "ss#", url, utf8_data, fragment->length * 8 - oleft); + mem_free(utf8_data); + } else { + result = PyObject_CallMethod(python_hooks, method, "ss#", url, fragment->data, fragment->length); + } if (!result) goto error; if (result != Py_None) { @@ -114,12 +202,43 @@ script_hook_pre_format_html(va_list ap, void *data) goto error; } - /* This assumes the Py_ssize_t len is not too large to - * fit in the off_t parameter of normalize_cache_entry(). - * add_fragment() itself seems to assume the same thing, - * and there is no standard OFF_MAX macro against which - * ELinks could check the value. */ - (void) add_fragment(cached, 0, str, len); + if (!is_cp_utf8(codepage)) { + size_t iconv_res; + size_t ileft; + size_t oleft; + char *inbuf, *outbuf; + char *dec_data = mem_alloc(len * 4); + iconv_t cd; + + if (!dec_data) { + goto error; + } + cd = iconv_open(get_cp_mime_name(codepage), "utf-8"); + if (cd == (iconv_t)-1) { + mem_free(dec_data); + goto error; + } + inbuf = str; + outbuf = dec_data; + ileft = len; + oleft = len * 4; + iconv_res = iconv(cd, &inbuf, &ileft, &outbuf, &oleft); + + if (iconv_res == -1) { + mem_free(dec_data); + goto error; + } + iconv_close(cd); + (void) add_fragment(cached, 0, dec_data, len * 4 - oleft); + mem_free(dec_data); + } else { + /* This assumes the Py_ssize_t len is not too large to + * fit in the off_t parameter of normalize_cache_entry(). + * add_fragment() itself seems to assume the same thing, + * and there is no standard OFF_MAX macro against which + * ELinks could check the value. */ + (void) add_fragment(cached, 0, str, len); + } normalize_cache_entry(cached, len); } From 3e85e37909f2698442f843ecfdfd626c543e1076 Mon Sep 17 00:00:00 2001 From: Witold Filipczyk Date: Sun, 9 Aug 2020 19:46:50 +0200 Subject: [PATCH 020/179] [intl] width.c compilable only with CONFIG_UTF8 --- src/intl/Makefile | 4 +++- src/intl/charsets.c | 1 - 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/intl/Makefile b/src/intl/Makefile index 444e49a8..182d730a 100644 --- a/src/intl/Makefile +++ b/src/intl/Makefile @@ -3,6 +3,8 @@ include $(top_builddir)/Makefile.config SUBDIRS-$(CONFIG_NLS) += gettext -OBJS = charsets.o width.o +OBJS = charsets.o + +OBJS-$(CONFIG_UTF8) += width.o include $(top_srcdir)/Makefile.lib diff --git a/src/intl/charsets.c b/src/intl/charsets.c index b8db4621..ecbc7b27 100644 --- a/src/intl/charsets.c +++ b/src/intl/charsets.c @@ -88,7 +88,6 @@ struct codepage_desc { * functions can be called from other translation units. */ NONSTATIC_INLINE unsigned char *encode_utf8(unicode_val_T u); NONSTATIC_INLINE int utf8charlen(const unsigned char *p); -NONSTATIC_INLINE int unicode_to_cell(unicode_val_T c); NONSTATIC_INLINE unicode_val_T utf8_to_unicode(unsigned char **string, const unsigned char *end); From f2557c9885b244d4abdad8428c91584906194640 Mon Sep 17 00:00:00 2001 From: Witold Filipczyk Date: Sun, 9 Aug 2020 19:50:19 +0200 Subject: [PATCH 021/179] [python] Compilation warning --- src/scripting/python/hooks.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/scripting/python/hooks.c b/src/scripting/python/hooks.c index 7cba0733..4615e188 100644 --- a/src/scripting/python/hooks.c +++ b/src/scripting/python/hooks.c @@ -218,7 +218,7 @@ script_hook_pre_format_html(va_list ap, void *data) mem_free(dec_data); goto error; } - inbuf = str; + inbuf = (char *)str; outbuf = dec_data; ileft = len; oleft = len * 4; From 87eef617a6255051d09b2600cb36a942ec0d4600 Mon Sep 17 00:00:00 2001 From: Witold Filipczyk Date: Sat, 22 Aug 2020 15:25:30 +0200 Subject: [PATCH 022/179] [Makefile.lib] Changed build options for tcc compatibility --- Makefile.lib | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile.lib b/Makefile.lib index 364768d0..9b7ca3e8 100644 --- a/Makefile.lib +++ b/Makefile.lib @@ -53,7 +53,7 @@ ecmd = @$(if $($(mquiet)cmd_$(1)),printf "%-38s " $(call quoteverbose,$($(mquiet quiet_cmd_compile = ' [$(CC_COLOR)CC$(END_COLOR)] $(RELPATH)$@' masq_cmd_compile = $(COMPILE) -o $(@) -c $< $(2) - cmd_compile = $(COMPILE) -o $(@) -Wp,-MD,.deps/$(*F).pp -c $< $(2) + cmd_compile = $(COMPILE) -o $(@) -MD -MF .deps/$(*F).pp -c $< $(2) # Rule to compile a set of .o files into one .o file quiet_cmd_ld_objs = " [$(LD_COLOR)LD$(END_COLOR)] $(RELPATH)$@" From 5169f78a4a9d744a19eb4056c45e98dfbb752836 Mon Sep 17 00:00:00 2001 From: Witold Filipczyk Date: Fri, 28 Aug 2020 12:29:31 +0200 Subject: [PATCH 023/179] [python] Sample google redirect --- contrib/python/hooks.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/contrib/python/hooks.py b/contrib/python/hooks.py index 415a420f..310a6549 100644 --- a/contrib/python/hooks.py +++ b/contrib/python/hooks.py @@ -24,6 +24,7 @@ quit_hook() -- Clean up before ELinks exits. """ import elinks +from urllib.parse import urlparse, parse_qs from importlib import reload dumbprefixes = { @@ -74,9 +75,12 @@ def follow_url_hook(url): url -- The URL of the link. """ - google_redirect = 'http://www.google.com/url?sa=D&q=' + google_redirect = 'https://www.google.com/url?' if url.startswith(google_redirect): - return url.replace(google_redirect, '') + try: + return parse_qs(urlparse(url).query)['q'][0] + except: + pass def pre_format_html_hook(url, html): """Rewrite the body of a document before it's formatted. From 9e42f86242e8ae06281be6dc85c19ea0b662e4c5 Mon Sep 17 00:00:00 2001 From: Witold Filipczyk Date: Sun, 30 Aug 2020 16:29:40 +0200 Subject: [PATCH 024/179] [NEWS] Info about 0.13.5 --- NEWS | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/NEWS b/NEWS index 893a4362..df0d8042 100644 --- a/NEWS +++ b/NEWS @@ -5,6 +5,17 @@ You can see the complete list of recent changes, bugfixes and new features in the https://github.com/rkd77/felinks.git[gitweb interface]. See the ChangeLog file for details. +ELinks 0.13.5 +-------------------- + +Released on 2020-08-30 + +* added clipboard selection using keyboard. #59 +* fixed drawing menus over emoji characters. #60 +* encoding to utf-8 and decoding back in python's pre_format_html_hook + +This is likely the last release of 0.13.x series. + ELinks 0.13.4: -------------------- From 9e08ea995a0353ae78470c344b68fcefa38b64b3 Mon Sep 17 00:00:00 2001 From: Felix Janda Date: Thu, 3 Sep 2020 12:44:43 -0400 Subject: [PATCH 025/179] docs: generate pdfs using dblatex --- Makefile.config.in | 4 ++-- configure.ac | 16 ++++++++-------- doc/Makefile | 10 +++++----- doc/README | 4 ++-- 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/Makefile.config.in b/Makefile.config.in index 679ff5d3..0b3bbce5 100644 --- a/Makefile.config.in +++ b/Makefile.config.in @@ -69,7 +69,7 @@ INTLBISON = @INTLBISON@ INTLLIBS = @INTLLIBS@ INTLOBJS = @INTLOBJS@ INTL_LIBTOOL_SUFFIX_PREFIX = @INTL_LIBTOOL_SUFFIX_PREFIX@ -JW = @JW@ +DBLATEX = @DBLATEX@ LIBDIR = @LIBDIR@ LIBDOM_CFLAGS = @LIBDOM_CFLAGS@ LIBDOM_LIBS = @LIBDOM_LIBS@ @@ -139,7 +139,7 @@ CONFIG_HTML_HIGHLIGHT = @CONFIG_HTML_HIGHLIGHT@ CONFIG_IDN = @CONFIG_IDN@ CONFIG_INTERLINK = @CONFIG_INTERLINK@ CONFIG_IPV6 = @CONFIG_IPV6@ -CONFIG_JW = @CONFIG_JW@ +CONFIG_DBLATEX = @CONFIG_DBLATEX@ CONFIG_LEDS = @CONFIG_LEDS@ CONFIG_LIBDOM = @CONFIG_LIBDOM@ CONFIG_LZMA = @CONFIG_LZMA@ diff --git a/configure.ac b/configure.ac index a8ed4aff..30bc4c05 100644 --- a/configure.ac +++ b/configure.ac @@ -74,7 +74,7 @@ PKG_PROG_PKG_CONFIG CONFIG_ASCIIDOC="no" CONFIG_POD2HTML="no" CONFIG_XMLTO="no" -CONFIG_JW="no" +CONFIG_DBLATEX="no" if test "x$CONFIG_DOC" != xno; then AC_PATH_PROGS(PYTHON3, "python3") @@ -91,10 +91,10 @@ if test "x$CONFIG_DOC" != xno; then EL_CONFIG(MAN_XMLTO, [man (groff)]) fi - AC_PATH_PROGS(JW, "jw") - if test "x$JW" != "x"; then - EL_CONFIG(CONFIG_JW, [JadeWrapper]) - EL_CONFIG(MANUAL_JW, [PDF]) + AC_PATH_PROGS(DBLATEX, "dblatex") + if test "x$DBLATEX" != "x"; then + EL_CONFIG(CONFIG_DBLATEX, [dblatex]) + EL_CONFIG(MANUAL_DBLATEX, [PDF]) fi AC_PATH_PROGS(POD2HTML, "pod2html") @@ -114,10 +114,10 @@ AC_SUBST(CONFIG_ASCIIDOC) AC_SUBST(CONFIG_DOXYGEN) AC_SUBST(CONFIG_POD2HTML) AC_SUBST(CONFIG_XMLTO) -AC_SUBST(CONFIG_JW) +AC_SUBST(CONFIG_DBLATEX) -EL_CONFIG_DEPENDS(CONFIG_DOC, [CONFIG_ASCIIDOC CONFIG_XMLTO CONFIG_JW CONFIG_POD2HTML], [Documentation Tools]) -EL_CONFIG_DEPENDS(CONFIG_MANUAL, [MANUAL_ASCIIDOC MANUAL_XMLTO MANUAL_JW], [Manual Formats]) +EL_CONFIG_DEPENDS(CONFIG_DOC, [CONFIG_ASCIIDOC CONFIG_XMLTO CONFIG_DBLATEX CONFIG_POD2HTML], [Documentation Tools]) +EL_CONFIG_DEPENDS(CONFIG_MANUAL, [MANUAL_ASCIIDOC MANUAL_XMLTO MANUAL_DBLATEX], [Manual Formats]) EL_CONFIG_DEPENDS(CONFIG_MANPAGE, [MAN_ASCIIDOC MAN_XMLTO], [Man Page Formats]) EL_CONFIG_DEPENDS(CONFIG_APIDOCS, [CONFIG_DOXYGEN], [API Documentation]) diff --git a/doc/Makefile b/doc/Makefile index f4f5418d..2698118f 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -54,8 +54,8 @@ MAN_DOCS-$(CONFIG_XMLTO) += \ elinks.conf.5 \ elinkskeys.5 -# Use jw for generating PDF, since xmlto seems to freak out. -PDF_DOCS-$(CONFIG_JW) += \ +# Use dblatex for generating PDF +PDF_DOCS-$(CONFIG_DBLATEX) += \ manual.pdf API_DOCS-$(CONFIG_DOXYGEN) += \ @@ -146,8 +146,8 @@ option-%.frag.xhtml: $(ELINKS) $(HELP2XML) ############################################################################# # Build commands and macros - quiet_cmd_jw = ' [$(LINK_COLOR)JW$(END_COLOR)] $(RELPATH)$@' - cmd_jw = $(JW) -b $(2) $< + quiet_cmd_dblatex = ' [$(LINK_COLOR)DBLATEX$(END_COLOR)] $(RELPATH)$@' + cmd_dblatex = $(DBLATEX) $< quiet_cmd_xmlto = ' [$(LINK_COLOR)XMLTO$(END_COLOR)] $(RELPATH)$@' cmd_xmlto = $(XMLTO) -o $(call outdir) $(3) $(2) $< @@ -203,7 +203,7 @@ elinks.conf.5.html: option-config.frag.xhtml $(call cmd,xmlto,html) %.pdf: %.xml - $(call cmd,jw,pdf) + $(call cmd,dblatex) %.html: %.pod $(call cmd,pod2html) diff --git a/doc/README b/doc/README index 64efce07..70a05926 100644 --- a/doc/README +++ b/doc/README @@ -76,7 +76,7 @@ The following tools are used for generating documentation in various formats: - python: interpreter for asciidoc, which is the basic tool for lifting the .txt files to other formats. - xmlto: used for outputting chunked HTML and man pages. - - jw: used for pdf documents. + - dblatex: used for pdf documents. - pod2html: used for perl docs. All these tools are checked by configure, thus to successfully build all the @@ -89,7 +89,7 @@ manual formats (with tool requirements listed): - HTML one-file (asciidoc) - HTML chunked / multiple files (asciidoc + xmlto) - - PDF (asciidoc + jw) + - PDF (asciidoc + dblatex) and the following man page formats: From 5f87bdbcb2e37030584e2579b04bb1a8418b0fee Mon Sep 17 00:00:00 2001 From: Witold Filipczyk Date: Sat, 5 Sep 2020 22:02:16 +0200 Subject: [PATCH 026/179] [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. --- config2.h.in | 967 ++++++++++++++++++++++++ git-dirty.sh | 9 + meson.build | 751 ++++++++++++++++++ meson_options.txt | 63 ++ src/bfu/meson.build | 5 + src/bookmarks/backend/meson.build | 5 + src/bookmarks/meson.build | 2 + src/cache/meson.build | 1 + src/config/meson.build | 1 + src/cookies/dialogs.c | 3 + src/cookies/meson.build | 23 + src/dialogs/meson.build | 4 + src/document/css/meson.build | 1 + src/document/dom/meson.build | 1 + src/document/html/meson.build | 3 + src/document/html/parser/meson.build | 1 + src/document/libdom/meson.build | 2 + src/document/meson.build | 12 + src/document/plain/meson.build | 1 + src/dom/css/meson.build | 1 + src/dom/meson.build | 5 + src/dom/sgml/docbook/meson.build | 1 + src/dom/sgml/html/meson.build | 1 + src/dom/sgml/meson.build | 5 + src/dom/sgml/rss/meson.build | 1 + src/dom/sgml/xbel/meson.build | 1 + src/ecmascript/meson.build | 19 + src/ecmascript/spidermonkey/meson.build | 6 + src/encoding/bzip2.c | 4 +- src/encoding/deflate.c | 2 - src/encoding/meson.build | 17 + src/encoding/zstd.c | 2 - src/formhist/meson.build | 1 + src/globhist/meson.build | 1 + src/intl/gettext/meson.build | 82 ++ src/intl/meson.build | 8 + src/main/meson.build | 4 + src/meson.build | 91 +++ src/mime/backend/meson.build | 22 + src/mime/meson.build | 2 + src/network/meson.build | 4 + src/network/ssl/meson.build | 4 + src/osdep/beos/meson.build | 1 + src/osdep/meson.build | 19 + src/osdep/os2/meson.build | 1 + src/osdep/riscos/meson.build | 1 + src/osdep/unix/meson.build | 1 + src/osdep/win32/meson.build | 1 + src/protocol/auth/meson.build | 3 + src/protocol/bittorrent/meson.build | 4 + src/protocol/file/meson.build | 4 + src/protocol/finger/meson.build | 1 + src/protocol/fsp/meson.build | 1 + src/protocol/ftp/meson.build | 8 + src/protocol/gopher/meson.build | 1 + src/protocol/http/meson.build | 4 + src/protocol/meson.build | 32 + src/protocol/nntp/meson.build | 1 + src/protocol/rewrite/meson.build | 1 + src/protocol/smb/meson.build | 1 + src/scripting/guile/meson.build | 2 + src/scripting/lua/meson.build | 2 + src/scripting/meson.build | 19 + src/scripting/perl/meson.build | 3 + src/scripting/python/meson.build | 3 + src/scripting/ruby/meson.build | 2 + src/scripting/smjs/meson.build | 5 + src/session/meson.build | 1 + src/terminal/meson.build | 7 + src/util/meson.build | 25 + src/viewer/dump/meson.build | 1 + src/viewer/meson.build | 3 + src/viewer/text/meson.build | 7 + 73 files changed, 2298 insertions(+), 6 deletions(-) create mode 100644 config2.h.in create mode 100755 git-dirty.sh create mode 100644 meson.build create mode 100644 meson_options.txt create mode 100644 src/bfu/meson.build create mode 100644 src/bookmarks/backend/meson.build create mode 100644 src/bookmarks/meson.build create mode 100644 src/cache/meson.build create mode 100644 src/config/meson.build create mode 100644 src/cookies/meson.build create mode 100644 src/dialogs/meson.build create mode 100644 src/document/css/meson.build create mode 100644 src/document/dom/meson.build create mode 100644 src/document/html/meson.build create mode 100644 src/document/html/parser/meson.build create mode 100644 src/document/libdom/meson.build create mode 100644 src/document/meson.build create mode 100644 src/document/plain/meson.build create mode 100644 src/dom/css/meson.build create mode 100644 src/dom/meson.build create mode 100644 src/dom/sgml/docbook/meson.build create mode 100644 src/dom/sgml/html/meson.build create mode 100644 src/dom/sgml/meson.build create mode 100644 src/dom/sgml/rss/meson.build create mode 100644 src/dom/sgml/xbel/meson.build create mode 100644 src/ecmascript/meson.build create mode 100644 src/ecmascript/spidermonkey/meson.build create mode 100644 src/encoding/meson.build create mode 100644 src/formhist/meson.build create mode 100644 src/globhist/meson.build create mode 100644 src/intl/gettext/meson.build create mode 100644 src/intl/meson.build create mode 100644 src/main/meson.build create mode 100644 src/meson.build create mode 100644 src/mime/backend/meson.build create mode 100644 src/mime/meson.build create mode 100644 src/network/meson.build create mode 100644 src/network/ssl/meson.build create mode 100644 src/osdep/beos/meson.build create mode 100644 src/osdep/meson.build create mode 100644 src/osdep/os2/meson.build create mode 100644 src/osdep/riscos/meson.build create mode 100644 src/osdep/unix/meson.build create mode 100644 src/osdep/win32/meson.build create mode 100644 src/protocol/auth/meson.build create mode 100644 src/protocol/bittorrent/meson.build create mode 100644 src/protocol/file/meson.build create mode 100644 src/protocol/finger/meson.build create mode 100644 src/protocol/fsp/meson.build create mode 100644 src/protocol/ftp/meson.build create mode 100644 src/protocol/gopher/meson.build create mode 100644 src/protocol/http/meson.build create mode 100644 src/protocol/meson.build create mode 100644 src/protocol/nntp/meson.build create mode 100644 src/protocol/rewrite/meson.build create mode 100644 src/protocol/smb/meson.build create mode 100644 src/scripting/guile/meson.build create mode 100644 src/scripting/lua/meson.build create mode 100644 src/scripting/meson.build create mode 100644 src/scripting/perl/meson.build create mode 100644 src/scripting/python/meson.build create mode 100644 src/scripting/ruby/meson.build create mode 100644 src/scripting/smjs/meson.build create mode 100644 src/session/meson.build create mode 100644 src/terminal/meson.build create mode 100644 src/util/meson.build create mode 100644 src/viewer/dump/meson.build create mode 100644 src/viewer/meson.build create mode 100644 src/viewer/text/meson.build diff --git a/config2.h.in b/config2.h.in new file mode 100644 index 00000000..5327988d --- /dev/null +++ b/config2.h.in @@ -0,0 +1,967 @@ +/* Directory containing default config */ +#define CONFDIR "@CONFDIR@" + +/* Define if you want: 256 colors support */ +#mesondefine CONFIG_256_COLORS + +/* Define if you want: 88 colors support */ +#mesondefine CONFIG_88_COLORS + +/* Define if you want: API Documentation support */ +#mesondefine CONFIG_APIDOCS + +/* Define if you want: AsciiDoc support */ +#mesondefine CONFIG_ASCIIDOC + +/* Define if you want: Backtrace support */ +#mesondefine CONFIG_BACKTRACE + +/* Define if you want: BitTorrent protocol support */ +#mesondefine CONFIG_BITTORRENT + +/* Define if you want: Bookmarks support */ +#mesondefine CONFIG_BOOKMARKS + +/* Define if you want: brotli support */ +#mesondefine CONFIG_BROTLI + +/* Define if you want: bzlib support */ +#mesondefine CONFIG_BZIP2 + +/* Define if you want: Local CGI support */ +#mesondefine CONFIG_CGI + +/* Define if you want: Combining characters support */ +#mesondefine CONFIG_COMBINE + +/* Define if you want: Cookies support */ +#mesondefine CONFIG_COOKIES + +/* Define if you want: Cascading Style Sheets support */ +#mesondefine CONFIG_CSS + +/* Define if you want: Data protocol support */ +#mesondefine CONFIG_DATA + +/* Define if you want: Debug mode support */ +#mesondefine CONFIG_DEBUG + +/* Define if you want: Documentation Tools support */ +#mesondefine CONFIG_DOC + +/* Define if you want: DOM engine support */ +#mesondefine CONFIG_DOM + +/* Define if you want: Doxygen support */ +#mesondefine CONFIG_DOXYGEN + +/* Define if you want: ECMAScript (JavaScript) support */ +#mesondefine CONFIG_ECMASCRIPT + +/* Define if you want: SpiderMonkey document scripting support */ +#mesondefine CONFIG_ECMASCRIPT_SMJS + +/* Define if you want: ECMAScript heartbeat support support */ +#mesondefine CONFIG_ECMASCRIPT_SMJS_HEARTBEAT + +/* Define if you want: Exmode interface support */ +#mesondefine CONFIG_EXMODE + +/* Define if you want: Fast mode support */ +#mesondefine CONFIG_FASTMEM + +/* Define if you want: Finger protocol support */ +#mesondefine CONFIG_FINGER + +/* Define if you want: Form history support */ +#mesondefine CONFIG_FORMHIST + +/* Define if you want: FSP protocol support */ +#mesondefine CONFIG_FSP + +/* Define if you want: FTP protocol support */ +#mesondefine CONFIG_FTP + +/* Define if you want: Global history support */ +#mesondefine CONFIG_GLOBHIST + +/* Define if you want: GNUTLS support */ +#mesondefine CONFIG_GNUTLS + +/* Define if you want: Gopher protocol support */ +#mesondefine CONFIG_GOPHER + +/* Define if you want: gpm support */ +#mesondefine CONFIG_GPM + +/* Define if you want: GssApi support */ +#mesondefine CONFIG_GSSAPI + +/* Define if you want: zlib support */ +#mesondefine CONFIG_GZIP + +/* Define if you want: HTML highlighting support */ +#mesondefine CONFIG_HTML_HIGHLIGHT + +/* Define if you want: idn support */ +#mesondefine CONFIG_IDN + +/* Define if you want: interlinking support */ +#mesondefine CONFIG_INTERLINK + +/* Define if you want: IPv6 support */ +#mesondefine CONFIG_IPV6 + +/* Define if you want: DBLATEX support */ +#mesondefine CONFIG_DBLATEX + +/* Define if you want: LEDs support */ +#mesondefine CONFIG_LEDS + +/* Define as 1 to use the libdom library. */ +#mesondefine CONFIG_LIBDOM + +/* Define if you want: libev support */ +#mesondefine CONFIG_LIBEV + +/* Define if you want: libevent support */ +#mesondefine CONFIG_LIBEVENT + +/* Define if you want: lzma support */ +#mesondefine CONFIG_LZMA + +/* Define if you want: Mailcap support */ +#mesondefine CONFIG_MAILCAP + +/* Define if you want: Man Page Formats support */ +#mesondefine CONFIG_MANPAGE + +/* Define if you want: Manual Formats support */ +#mesondefine CONFIG_MANUAL + +/* Define if you want: Marks support */ +#mesondefine CONFIG_MARKS + +/* Define if you want: Mimetypes files support */ +#mesondefine CONFIG_MIMETYPES + +/* Define if you want: Mouse handling support */ +#mesondefine CONFIG_MOUSE + +/* Define to 1 if translation of program messages to the user's native + language is requested. */ +#mesondefine CONFIG_NLS + +/* Define if you want: NNTP protocol support */ +#mesondefine CONFIG_NNTP + +/* Define if you want: No root exec support */ +#mesondefine CONFIG_NO_ROOT_EXEC + +/* Define if you want: nss_compat_ossl support */ +#mesondefine CONFIG_NSS_COMPAT_OSSL + +/* Define if you want: OpenSSL support */ +#mesondefine CONFIG_OPENSSL + +/* Define if you want: BEOS support */ +#mesondefine CONFIG_OS_BEOS + +/* Define if you want: EMX support */ +#mesondefine CONFIG_OS_OS2 + +/* Define if you want: RISCOS support */ +#mesondefine CONFIG_OS_RISCOS + +/* Define if you want: UNIX support */ +#mesondefine CONFIG_OS_UNIX + +/* Define if you want: WIN32 support */ +#mesondefine CONFIG_OS_WIN32 + +/* Define if you want: Own libc stubs support */ +#mesondefine CONFIG_OWN_LIBC + +/* Define if using Perl 5.8.8 or later, where the "POPpx" macro no longer + needs an "n_a" variable like it did in 5.8.7 */ +#mesondefine CONFIG_PERL_POPPX_WITHOUT_N_A + +/* Define if you want: Pod2HTML support */ +#mesondefine CONFIG_POD2HTML + +/* Define if you want: Browser scripting support */ +#mesondefine CONFIG_SCRIPTING + +/* Define if you want: Guile support */ +#mesondefine CONFIG_SCRIPTING_GUILE + +/* Define if you want: Lua support */ +#mesondefine CONFIG_SCRIPTING_LUA + +/* Define if you want: Perl support */ +#mesondefine CONFIG_SCRIPTING_PERL + +/* Define if you want: Python3 support */ +#mesondefine CONFIG_SCRIPTING_PYTHON + +/* Define if you want: Ruby support */ +#mesondefine CONFIG_SCRIPTING_RUBY + +/* Define if you want: SpiderMonkey support */ +#mesondefine CONFIG_SCRIPTING_SPIDERMONKEY + +/* Define if you want: Small binary support */ +#mesondefine CONFIG_SMALL + +/* Define if you want: Samba protocol support */ +#mesondefine CONFIG_SMB + +/* Define if you want: SSL support */ +#mesondefine CONFIG_SSL + +/* Define if you want: BSD sysmouse support */ +#mesondefine CONFIG_SYSMOUSE + +/* Define if you want: terminfo support */ +#mesondefine CONFIG_TERMINFO + +/* Define as 1 to use the TRE library for regular expression searching. This + requires the header file. If you define CONFIG_UTF8 too, then + wchar_t must be exactly 32-bit so that it matches unicode_val_T. */ +#mesondefine CONFIG_TRE + +/* Define if you want: true color support */ +#mesondefine CONFIG_TRUE_COLOR + +/* Define if you want: URI rewriting support */ +#mesondefine CONFIG_URI_REWRITE + +/* Define if you want: UTF-8 support */ +#mesondefine CONFIG_UTF8 + +/* Define if you want: XBEL bookmarks support */ +#mesondefine CONFIG_XBEL_BOOKMARKS + +/* Define if you want: XmlTo support */ +#mesondefine CONFIG_XMLTO + +/* Define if you want: zstd support */ +#mesondefine CONFIG_ZSTD + +/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP + systems. This function is required for `alloca.c' support on those systems. + */ +#undef CRAY_STACKSEG_END + +/* Define to 1 if using `alloca.c'. */ +#undef C_ALLOCA + +/* Define to 1 if you have the `access' function. */ +#mesondefine HAVE_ACCESS + +/* Define if you have struct addrinfo */ +#mesondefine HAVE_ADDRINFO + +/* Define to 1 if you have the `alarm' function. */ +#mesondefine HAVE_ALARM + +/* Define to 1 if you have `alloca', as a function or macro. */ +#mesondefine HAVE_ALLOCA + +/* Define to 1 if you have and it should be used (not on Ultrix). + */ +#mesondefine HAVE_ALLOCA_H + +/* Define to 1 if you have the header file. */ +#mesondefine HAVE_ARGZ_H + +/* Define to 1 if you have the header file. */ +#mesondefine HAVE_ARPA_INET_H + +/* Define to 1 if you have the `ASN1_STRING_get0_data' function. */ +#mesondefine HAVE_ASN1_STRING_GET0_DATA + +/* Define to 1 if you have the `asprintf' function. */ +#mesondefine HAVE_ASPRINTF + +/* Define to 1 if you have the `atoll' function. */ +#mesondefine HAVE_ATOLL + +/* Define to 1 if you have the `bcopy' function. */ +#mesondefine HAVE_BCOPY + +/* Define if you have _beginthread() */ +#mesondefine HAVE_BEGINTHREAD + +/* Define to 1 if you have the header file. */ +#mesondefine HAVE_BROTLI_DECODE_H + +/* Define to 1 if you have the header file. */ +#mesondefine HAVE_BZLIB_H + +/* Define if you have C99 compliant vsnprintf() */ +#mesondefine HAVE_C99_VSNPRINTF + +/* Define to 1 if you have the `chmod' function. */ +#mesondefine HAVE_CHMOD + +/* Define to 1 if you have the `clock_gettime' function. */ +#mesondefine HAVE_CLOCK_GETTIME + +/* Define to 1 if you have the `cygwin_conv_to_full_win32_path' function. */ +#mesondefine HAVE_CYGWIN_CONV_TO_FULL_WIN32_PATH + +/* Define to 1 if you have the header file, and it defines `DIR'. + */ +#mesondefine HAVE_DIRENT_H + +/* Define to 1 if you have the `event_base_free' function. */ +#mesondefine HAVE_EVENT_BASE_FREE + +/* Define to 1 if you have the `event_base_get_method' function. */ +#mesondefine HAVE_EVENT_BASE_GET_METHOD + +/* Define to 1 if you have the `event_base_new' function. */ +#mesondefine HAVE_EVENT_BASE_NEW + +/* Define to 1 if you have the `event_base_set' function. */ +#mesondefine HAVE_EVENT_BASE_SET + +/* Define to 1 if you have the `event_config_set_flag' function. */ +#mesondefine HAVE_EVENT_CONFIG_SET_FLAG + +/* Define to 1 if you have the `event_get_method' function. */ +#mesondefine HAVE_EVENT_GET_METHOD + +/* Define to 1 if you have the `event_get_struct_event_size' function. */ +#mesondefine HAVE_EVENT_GET_STRUCT_EVENT_SIZE + +/* Define to 1 if you have the `event_get_version' function. */ +#mesondefine HAVE_EVENT_GET_VERSION + +/* Define to 1 if you have the header file. */ +#mesondefine HAVE_EVENT_H + +/* Define to 1 if you have the `event_reinit' function. */ +#mesondefine HAVE_EVENT_REINIT + +/* Define to 1 if you have the header file. */ +#mesondefine HAVE_EV_EVENT_H + +/* Define to 1 if you have the header file. */ +#mesondefine HAVE_EXECINFO_H + +/* Define to 1 if you have the header file. */ +#mesondefine HAVE_EXPAT_H + +/* Define to 1 if you have the header file. */ +#mesondefine HAVE_FCNTL_H + +/* Define to 1 if you have the `feof_unlocked' function. */ +#mesondefine HAVE_FEOF_UNLOCKED + +/* Define to 1 if you have the `fflush' function. */ +#mesondefine HAVE_FFLUSH + +/* Define to 1 if you have the `fgets_unlocked' function. */ +#mesondefine HAVE_FGETS_UNLOCKED + +/* Define to 1 if you have the `fork' function. */ +#mesondefine HAVE_FORK + +/* Define to 1 if you have the `fpathconf' function. */ +#mesondefine HAVE_FPATHCONF + +/* Define to 1 if you have the `fseeko' function. */ +#mesondefine HAVE_FSEEKO + +/* Define to 1 if you have the header file. */ +#mesondefine HAVE_FSPLIB_H + +/* Define to 1 if you have the `fsync' function. */ +#mesondefine HAVE_FSYNC + +/* Define to 1 if you have the `ftello' function. */ +#mesondefine HAVE_FTELLO + +/* Define to 1 if you have the `getcwd' function. */ +#mesondefine HAVE_GETCWD + +/* Define to 1 if you have the `getegid' function. */ +#mesondefine HAVE_GETEGID + +/* Define to 1 if you have the `geteuid' function. */ +#mesondefine HAVE_GETEUID + +/* Define to 1 if you have the `getgid' function. */ +#mesondefine HAVE_GETGID + +/* Define to 1 if you have the `gethostbyaddr' function. */ +#mesondefine HAVE_GETHOSTBYADDR + +/* Define to 1 if you have the `getifaddrs' function. */ +#mesondefine HAVE_GETIFADDRS + +/* Define to 1 if you have the `getpagesize' function. */ +#mesondefine HAVE_GETPAGESIZE + +/* Define to 1 if you have the `getpgid' function. */ +#mesondefine HAVE_GETPGID + +/* Define to 1 if you have the `getpgrp' function. */ +#mesondefine HAVE_GETPGRP + +/* Define to 1 if you have the `getpid' function. */ +#mesondefine HAVE_GETPID + +/* Define to 1 if you have the `getpwnam' function. */ +#mesondefine HAVE_GETPWNAM + +/* Define to 1 if you have the `gettimeofday' function. */ +#mesondefine HAVE_GETTIMEOFDAY + +/* Define to 1 if you have the `getuid' function. */ +#mesondefine HAVE_GETUID + +/* Define to 1 if you have the `gnutls_certificate_set_x509_system_trust' + function. */ +#mesondefine HAVE_GNUTLS_CERTIFICATE_SET_X509_SYSTEM_TRUST + +/* Define to 1 if you have the `gnutls_priority_set_direct' function. */ +#mesondefine HAVE_GNUTLS_PRIORITY_SET_DIRECT + +/* Define to 1 if you have the header file. */ +#mesondefine HAVE_GPM_H + +/* Define to 1 if you have the `herror' function. */ +#mesondefine HAVE_HERROR + +/* Define if you have the iconv() function. */ +#mesondefine HAVE_ICONV + +/* Define to 1 if you have the header file. */ +#mesondefine HAVE_IDNA_H + +/* Define to 1 if you have the header file. */ +#mesondefine HAVE_IFADDRS_H + +/* Define to 1 if you have the `index' function. */ +#mesondefine HAVE_INDEX + +/* Define to 1 if you have the `inet_ntop' function. */ +#mesondefine HAVE_INET_NTOP + +/* Define to 1 if you have the `inet_pton' function. */ +#mesondefine HAVE_INET_PTON + +/* Define if you have int32_t */ +#mesondefine HAVE_INT32_T + +/* Define to 1 if you have the header file. */ +#mesondefine HAVE_INTTYPES_H + +/* Define to 1 if you have the header file. */ +#mesondefine HAVE_IO_H + +/* Define to 1 if you have the `isdigit' function. */ +#mesondefine HAVE_ISDIGIT + +/* Define to 1 if you have the `JS_ReportAllocationOverflow' function. */ +#mesondefine HAVE_JS_REPORTALLOCATIONOVERFLOW + +/* Define to 1 if you have the `JS_SetBranchCallback' function. */ +#mesondefine HAVE_JS_SETBRANCHCALLBACK + +/* Define to 1 if you have the `JS_TriggerOperationCallback' function. */ +#mesondefine HAVE_JS_TRIGGEROPERATIONCALLBACK + +/* Define to 1 if you have the `kill' function. */ +#mesondefine HAVE_KILL + +/* Define if you have and nl_langinfo(CODESET). */ +#mesondefine HAVE_LANGINFO_CODESET + +/* Define to 1 if you have the header file. */ +#mesondefine HAVE_LAUXLIB_H + +/* Define if your file defines LC_MESSAGES. */ +#mesondefine HAVE_LC_MESSAGES + +/* Define to 1 if you have the `dl' library (-ldl). */ +#mesondefine HAVE_LIBDL + +/* Define to 1 if you have the `ev' library (-lev). */ +#mesondefine HAVE_LIBEV + +/* Define to 1 if you have the `event' library (-levent). */ +#mesondefine HAVE_LIBEVENT + +/* Define to 1 if you have the header file. */ +#mesondefine HAVE_LIBEV_EVENT_H + +/* Define to 1 if you have the `nsl' library (-lnsl). */ +#mesondefine HAVE_LIBNSL + +/* Define to 1 if you have the `nss_compat_ossl' library (-lnss_compat_ossl). + */ +#mesondefine HAVE_LIBNSS_COMPAT_OSSL + +/* Define to 1 if you have the header file. */ +#mesondefine HAVE_LIBSMBCLIENT_H + +/* Define to 1 if you have the `socket' library (-lsocket). */ +#mesondefine HAVE_LIBSOCKET + +/* Define to 1 if you have the header file. */ +#mesondefine HAVE_LIMITS_H + +/* Define to 1 if you have the header file. */ +#mesondefine HAVE_LOCALE_H + +/* Define if you have long long */ +#mesondefine HAVE_LONG_LONG + +/* Define to 1 if you have the header file. */ +#mesondefine HAVE_LZMA_H + +/* Define to 1 if you have the header file. */ +#mesondefine HAVE_MACHINE_CONSOLE_H + +/* Define to 1 if you have the header file. */ +#mesondefine HAVE_MALLOC_H + +/* Define to 1 if you have the `memmove' function. */ +#mesondefine HAVE_MEMMOVE + +/* Define to 1 if you have the header file. */ +#mesondefine HAVE_MEMORY_H + +/* Define to 1 if you have the `mempcpy' function. */ +#mesondefine HAVE_MEMPCPY + +/* Define to 1 if you have the `memrchr' function. */ +#mesondefine HAVE_MEMRCHR + +/* Define to 1 if you have a working `mmap' system call. */ +#mesondefine HAVE_MMAP + +/* Define if you have MouOpen() */ +#mesondefine HAVE_MOUOPEN + +/* Define to 1 if you have the `mremap' function. */ +#mesondefine HAVE_MREMAP + +/* Define to 1 if you have the `munmap' function. */ +#mesondefine HAVE_MUNMAP + +/* Define to 1 if you have the header file, and it defines `DIR'. */ +#mesondefine HAVE_NDIR_H + +/* Define to 1 if you have the header file. */ +#mesondefine HAVE_NETDB_H + +/* Define to 1 if you have the header file. */ +#mesondefine HAVE_NETINET_IN6_VAR_H + +/* Define to 1 if you have the header file. */ +#mesondefine HAVE_NETINET_IN_H + +/* Define to 1 if you have the header file. */ +#mesondefine HAVE_NETINET_IN_SYSTEM_H + +/* Define to 1 if you have the header file. */ +#mesondefine HAVE_NETINET_IN_SYSTM_H + +/* Define to 1 if you have the header file. */ +#mesondefine HAVE_NETINET_IP_H + +/* Define to 1 if you have the header file. */ +#mesondefine HAVE_NET_IF_H + +/* Define to 1 if you have the header file. */ +#mesondefine HAVE_NL_TYPES_H + +/* Define to 1 if you have the header + file. */ +#mesondefine HAVE_NSS_COMPAT_OSSL_NSS_COMPAT_OSSL_H + +/* Define if you have off_t */ +#mesondefine HAVE_OFF_T + +/* Define to 1 if you have the `poll' function. */ +#mesondefine HAVE_POLL + +/* Define to 1 if you have the header file. */ +#mesondefine HAVE_POLL_H + +/* Define to 1 if you have the `popen' function. */ +#mesondefine HAVE_POPEN + +/* Define to 1 if you have the `putenv' function. */ +#mesondefine HAVE_PUTENV + +/* Define to 1 if you have the header file. */ +#mesondefine HAVE_PWD_H + +/* Define to 1 if you have the `raise' function. */ +#mesondefine HAVE_RAISE + +/* Define to 1 if you have the `RAND_bytes' function. */ +#mesondefine HAVE_RAND_BYTES + +/* Define to 1 if you have the `rb_errinfo' function. */ +#mesondefine HAVE_RB_ERRINFO + +/* Define if you have _read_kbd() */ +#mesondefine HAVE_READ_KBD + +/* Define if you have struct sockaddr_in6 */ +#mesondefine HAVE_SA_IN6 + +/* Define if you have struct sockaddr_storage */ +#mesondefine HAVE_SA_STORAGE + +/* Define if you have _SC_PAGE_SIZE */ +#mesondefine HAVE_SC_PAGE_SIZE + +/* Define to 1 if you have the `setenv' function. */ +#mesondefine HAVE_SETENV + +/* Define to 1 if you have the `setitimer' function. */ +#mesondefine HAVE_SETITIMER + +/* Define to 1 if you have the `setlocale' function. */ +#mesondefine HAVE_SETLOCALE + +/* Define to 1 if you have the `setpgid' function. */ +#mesondefine HAVE_SETPGID + +/* Define to 1 if you have the `setpgrp' function. */ +#mesondefine HAVE_SETPGRP + +/* Define to 1 if you have the `sigaction' function. */ +#mesondefine HAVE_SIGACTION + +/* Define to 1 if you have the header file. */ +#mesondefine HAVE_SIGACTION_H + +/* Define to 1 if you have the `snprintf' function. */ +#mesondefine HAVE_SNPRINTF + +/* Define to 1 if you have the header file. */ +#mesondefine HAVE_STDDEF_H + +/* Define to 1 if you have the header file. */ +#mesondefine HAVE_STDINT_H + +/* Define to 1 if you have the header file. */ +#mesondefine HAVE_STDLIB_H + +/* Define to 1 if you have the `stpcpy' function. */ +#mesondefine HAVE_STPCPY + +/* Define to 1 if you have the `strcasecmp' function. */ +#mesondefine HAVE_STRCASECMP + +/* Define to 1 if you have the `strcasestr' function. */ +#mesondefine HAVE_STRCASESTR + +/* Define to 1 if you have the `strchr' function. */ +#mesondefine HAVE_STRCHR + +/* Define to 1 if you have the `strdup' function. */ +#mesondefine HAVE_STRDUP + +/* Define to 1 if you have the `strerror' function. */ +#mesondefine HAVE_STRERROR + +/* Define to 1 if you have the `strftime' function. */ +#mesondefine HAVE_STRFTIME + +/* Define to 1 if you have the header file. */ +#mesondefine HAVE_STRINGS_H + +/* Define to 1 if you have the header file. */ +#mesondefine HAVE_STRING_H + +/* Define to 1 if you have the `strncasecmp' function. */ +#mesondefine HAVE_STRNCASECMP + +/* Define to 1 if you have the `strptime' function. */ +#mesondefine HAVE_STRPTIME + +/* Define to 1 if you have the `strrchr' function. */ +#mesondefine HAVE_STRRCHR + +/* Define to 1 if you have the `strstr' function. */ +#mesondefine HAVE_STRSTR + +/* Define to 1 if you have the `strtoul' function. */ +#mesondefine HAVE_STRTOUL + +/* Define to 1 if you have the header file. */ +#mesondefine HAVE_SYS_CONSIO_H + +/* Define to 1 if you have the header file. */ +#mesondefine HAVE_SYS_CYGWIN_H + +/* Define to 1 if you have the header file, and it defines `DIR'. + */ +#mesondefine HAVE_SYS_DIR_H + +/* Define to 1 if you have the header file. */ +#mesondefine HAVE_SYS_FMUTEX_H + +/* Define to 1 if you have the header file. */ +#mesondefine HAVE_SYS_IOCTL_H + +/* Define to 1 if you have the header file, and it defines `DIR'. + */ +#mesondefine HAVE_SYS_NDIR_H + +/* Define to 1 if you have the header file. */ +#mesondefine HAVE_SYS_PARAM_H + +/* Define to 1 if you have the header file. */ +#mesondefine HAVE_SYS_RESOURCE_H + +/* Define to 1 if you have the header file. */ +#mesondefine HAVE_SYS_SELECT_H + +/* Define to 1 if you have the header file. */ +#mesondefine HAVE_SYS_SOCKET_H + +/* Define to 1 if you have the header file. */ +#mesondefine HAVE_SYS_SOCKIO_H + +/* Define to 1 if you have the header file. */ +#mesondefine HAVE_SYS_STAT_H + +/* Define to 1 if you have the header file. */ +#mesondefine HAVE_SYS_TIME_H + +/* Define to 1 if you have the header file. */ +#mesondefine HAVE_SYS_TYPES_H + +/* Define to 1 if you have the header file. */ +#mesondefine HAVE_SYS_UN_H + +/* Define to 1 if you have the header file. */ +#mesondefine HAVE_SYS_UTSNAME_H + +/* Define to 1 if you have that is POSIX.1 compatible. */ +#mesondefine HAVE_SYS_WAIT_H + +/* Define to 1 if you have the header file. */ +#mesondefine HAVE_TERMIOS_H + +/* Define to 1 if you have the header file. */ +#mesondefine HAVE_TERM_H + +/* Define to 1 if you have the `timegm' function. */ +#mesondefine HAVE_TIMEGM + +/* Define to 1 if you have the header file. */ +#mesondefine HAVE_TIME_H + +/* Define to 1 if you have the `tsearch' function. */ +#mesondefine HAVE_TSEARCH + +/* Define if you have typeof */ +#mesondefine HAVE_TYPEOF + +/* Define if you have uint16_t */ +#mesondefine HAVE_UINT16_T + +/* Define if you have uint32_t */ +#mesondefine HAVE_UINT32_T + +/* Define to 1 if you have the `uname' function. */ +#mesondefine HAVE_UNAME + +/* Define to 1 if you have the header file. */ +#mesondefine HAVE_UNISTD_H + +/* Define to 1 if you have the `unsetenv' function. */ +#mesondefine HAVE_UNSETENV + +/* Define if you have variadic macros */ +#mesondefine HAVE_VARIADIC_MACROS + +/* Define to 1 if you have the `vasprintf' function. */ +#mesondefine HAVE_VASPRINTF + +/* Define to 1 if you have the `vsnprintf' function. */ +#mesondefine HAVE_VSNPRINTF + +/* Define to 1 if you have the header file. */ +#mesondefine HAVE_WCHAR_H + +/* Define to 1 if you have the header file. */ +#mesondefine HAVE_WCTYPE_H + +/* Define to 1 if you have the `wcwidth' function. */ +#mesondefine HAVE_WCWIDTH + +/* Define to 1 if you have the header file. */ +#mesondefine HAVE_WINDOWS_H + +/* Define to 1 if you have the header file. */ +#mesondefine HAVE_WS2TCPIP_H + +/* Define if you have X11 for restoring window titles */ +#mesondefine HAVE_X11 + +/* Define to 1 if you have the header file. */ +#mesondefine HAVE_ZLIB_H + +/* Define to 1 if you have the header file. */ +#mesondefine HAVE_ZSTD_H + +/* Define to 1 if you have the `__argz_count' function. */ +#mesondefine HAVE___ARGZ_COUNT + +/* Define to 1 if you have the `__argz_next' function. */ +#mesondefine HAVE___ARGZ_NEXT + +/* Define to 1 if you have the `__argz_stringify' function. */ +#mesondefine HAVE___ARGZ_STRINGIFY + +/* Define as const if the declaration of iconv() needs const. */ +#mesondefine ICONV_CONST + +/* Directory containing libraries */ +#define LIBDIR "@LIBDIR@" + +/* Directory containing locales */ +#define LOCALEDIR "@LOCALEDIR@" + +/* Define if you want: HTML (one file) support */ +#undef MANUAL_ASCIIDOC + +/* Define if you want: PDF support */ +#undef MANUAL_JW + +/* Define if you want: HTML (multiple files) support */ +#undef MANUAL_XMLTO + +/* Define if you want: HTML support */ +#undef MAN_ASCIIDOC + +/* Define if you want: man (groff) support */ +#undef MAN_XMLTO + +/* Define as inline if the compiler lets you declare a function without + inline, then define it with inline, and have that definition refer to + identifiers with internal linkage. This is allowed by C99 6.7.4p6 and + 6.7.4p3 together. Otherwise define as nothing. */ +#define NONSTATIC_INLINE @NONSTATIC_INLINE@ + +/* Package version */ +#define PACKAGE "@PACKAGE@" + +/* Define to the address where bug reports for this package should be sent. */ +#undef PACKAGE_BUGREPORT + +/* Define to the full name of this package. */ +#undef PACKAGE_NAME + +/* Define to the full name and version of this package. */ +#undef PACKAGE_STRING + +/* Define to the one symbol short name of this package. */ +#undef PACKAGE_TARNAME + +/* Define to the home page for this package. */ +#undef PACKAGE_URL + +/* Define to the version of this package. */ +#undef PACKAGE_VERSION + +/* The size of `char', as computed by sizeof. */ +#define SIZEOF_CHAR @SIZEOF_CHAR@ + +/* The size of `int', as computed by sizeof. */ +#define SIZEOF_INT @SIZEOF_INT@ + +/* The size of `long', as computed by sizeof. */ +#define SIZEOF_LONG @SIZEOF_LONG@ + +/* The size of `long long', as computed by sizeof. */ +#define SIZEOF_LONG_LONG @SIZEOF_LONG_LONG@ + +/* The size of `off_t', as computed by sizeof. */ +#define SIZEOF_OFF_T @SIZEOF_OFF_T@ + +/* The size of `short', as computed by sizeof. */ +#define SIZEOF_SHORT @SIZEOF_SHORT@ + +/* If using the C implementation of alloca, define if you know the + direction of stack growth for your system; otherwise it will be + automatically deduced at runtime. + STACK_DIRECTION > 0 => grows toward higher addresses + STACK_DIRECTION < 0 => grows toward lower addresses + STACK_DIRECTION = 0 => direction of growth unknown */ +#undef STACK_DIRECTION + +/* Define to 1 if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* Define to 1 if you can safely include both and . */ +#define TIME_WITH_SYS_TIME 1 + +/* Define to 1 if your declares `struct tm'. */ +#undef TM_IN_SYS_TIME + +/* Enable extensions on AIX 3, Interix. */ +#ifndef _ALL_SOURCE +# undef _ALL_SOURCE +#endif +/* Enable GNU extensions on systems that have them. */ +#ifndef _GNU_SOURCE +# undef _GNU_SOURCE +#endif +/* Enable threading extensions on Solaris. */ +#ifndef _POSIX_PTHREAD_SEMANTICS +# undef _POSIX_PTHREAD_SEMANTICS +#endif +/* Enable extensions on HP NonStop. */ +#ifndef _TANDEM_SOURCE +# undef _TANDEM_SOURCE +#endif +/* Enable general extensions on Solaris. */ +#ifndef __EXTENSIONS__ +# undef __EXTENSIONS__ +#endif + + +/* Package version */ +#define VERSION "@version@" + +/* Define if you have XFree under OS/2 */ +#undef X2 + +/* How to invoke XTerm */ +#undef XTERM + +/* Define as 1 if you are using Tiny C Compiler with the GNU C Library, and + of glibc would otherwise override the alloca macro defined in + of TCC. If of glibc sees the _ALLOCA_H macro, it + assumes it has already been included, and does not redefine alloca. This + might not work in future glibc versions though, because the names of the + #include guard macros are not documented. The incompatibility has been + reported to the tinycc-devel mailing list on 2008-07-14. If a future + version of TCC provides an of its own, this hack won't be + needed. */ +#undef _ALLOCA_H + +/* Enable large inode numbers on Mac OS X 10.5. */ +#ifndef _DARWIN_USE_64_BIT_INODE +# define _DARWIN_USE_64_BIT_INODE 1 +#endif + +/* Define to 1 if on MINIX. */ +#undef _MINIX + +/* Define to 2 if the system does not provide POSIX.1 features except with + this defined. */ diff --git a/git-dirty.sh b/git-dirty.sh new file mode 100755 index 00000000..a35ab425 --- /dev/null +++ b/git-dirty.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +cd "$MESON_SOURCE_ROOT" + +for line in $(git diff-index HEAD 2>/dev/null) +do + echo '-dirty' + exit 0 +done diff --git a/meson.build b/meson.build new file mode 100644 index 00000000..3487032a --- /dev/null +++ b/meson.build @@ -0,0 +1,751 @@ +project('felinks', 'c', version:'0.14.GIT', license:'GPLv2') +srcs=[] + +srcdir = meson.source_root() + +txt = run_command('git', '--git-dir=' + srcdir + '/.git', 'rev-parse', 'HEAD').stdout().strip() +dirty = run_command(srcdir + '/git-dirty.sh').stdout().strip() +add_global_arguments('-DBUILD_ID="' + txt + dirty + '"', language : 'c') + +conf_data = configuration_data() +conf_data.set('version', '0.14.GIT') +conf_data.set('PACKAGE', 'elinks') + + +conf_data.set('CONFIG_LARGEFILE', get_option('largefile')) +conf_data.set('CONFIG_BOOKMARKS', get_option('bookmarks')) +conf_data.set('CONFIG_XBEL_BOOKMARKS', get_option('xbel')) +conf_data.set('CONFIG_SCRIPTING_SPIDERMONKEY', get_option('sm-scripting')) +conf_data.set10('CONFIG_NLS', get_option('nls')) + +conf_data.set('CONFIG_COOKIES', get_option('cookies')) +conf_data.set('CONFIG_FORMHIST', get_option('formhist')) +conf_data.set('CONFIG_GLOBHIST', get_option('globhist')) +conf_data.set('CONFIG_MAILCAP', get_option('mailcap')) +conf_data.set('CONFIG_MIMETYPES', get_option('mimetypes')) +conf_data.set('CONFIG_IPV6', get_option('ipv6')) +conf_data.set10('CONFIG_BITTORRENT', get_option('bittorrent')) +conf_data.set('CONFIG_DATA', get_option('data')) + +conf_data.set('CONFIG_URI_REWRITE', get_option('uri-rewrite')) +conf_data.set('CONFIG_CGI', get_option('cgi')) +conf_data.set('CONFIG_FINGER', get_option('finger')) +conf_data.set('CONFIG_FSP', get_option('fsp')) +conf_data.set('CONFIG_FTP', get_option('ftp')) +conf_data.set('CONFIG_GOPHER', get_option('gopher')) +conf_data.set('CONFIG_NNTP', get_option('nntp')) +conf_data.set('CONFIG_SMB', get_option('smb')) +conf_data.set('CONFIG_MOUSE', get_option('mouse')) +conf_data.set('CONFIG_SYSMOUSE', get_option('sysmouse')) +conf_data.set('CONFIG_88_COLORS', get_option('88-colors')) + +conf_data.set('CONFIG_256_COLORS', get_option('256-colors')) +conf_data.set('CONFIG_TRUE_COLOR', get_option('true-color')) +conf_data.set('CONFIG_EXMODE', get_option('exmode')) +conf_data.set('CONFIG_LEDS', get_option('leds')) +conf_data.set('CONFIG_MARKS', get_option('marks')) +conf_data.set10('CONFIG_CSS', get_option('css')) +conf_data.set('CONFIG_DOM', get_option('html-highlight')) + +conf_data.set('CONFIG_BACKTRACE', get_option('backtrace')) +conf_data.set('CONFIG_NO_ROOT', get_option('no-root')) +conf_data.set('CONFIG_DEBUG', get_option('withdebug')) +conf_data.set('CONFIG_FASTMEM', get_option('fastmem')) +conf_data.set('CONFIG_OWN_LIBC', get_option('own-libc')) +conf_data.set('CONFIG_SMALL', get_option('small')) +conf_data.set('CONFIG_UTF8', get_option('utf-8')) +conf_data.set('CONFIG_COMBINING', get_option('combining')) + +conf_data.set('CONFIG_XTERM', get_option('xterm')) +conf_data.set('CONFIG_GPM', get_option('gpm')) +conf_data.set('CONFIG_TERMINFO', get_option('terminfo')) +conf_data.set('CONFIG_GZIP', get_option('zlib')) +conf_data.set('CONFIG_BZIP2', get_option('bzlib')) +conf_data.set('CONFIG_BROTLI', get_option('brotli')) + +conf_data.set('CONFIG_ZSTD', get_option('zstd')) +conf_data.set('CONFIG_IDN', get_option('idn')) +conf_data.set('CONFIG_LZMA', get_option('lzma')) +conf_data.set('CONFIG_GSSAPI', get_option('gssapi')) +conf_data.set('CONFIG_ECMASCRIPT_SMJS', get_option('spidermonkey')) +conf_data.set('CONFIG_SCRIPTING_GUILE', get_option('guile')) +conf_data.set('CONFIG_SCRIPTING_PERL', get_option('perl')) +conf_data.set('CONFIG_SCRIPTING_PYTHON', get_option('python')) + +luapkg = get_option('luapkg') +if luapkg != '' + conf_data.set('CONFIG_SCRIPTING_LUA', true) +else + conf_data.set('CONFIG_SCRIPTING_LUA', false) +endif + +conf_data.set('CONFIG_TRE', get_option('tre')) +conf_data.set('CONFIG_SCRIPTING_RUBY', get_option('ruby')) +conf_data.set('CONFIG_GNUTLS', get_option('gnutls')) +conf_data.set('CONFIG_OPENSSL', get_option('openssl')) +conf_data.set('CONFIG_LIBEV', get_option('libev')) +conf_data.set('CONFIG_LIBEVENT', get_option('libevent')) +conf_data.set('CONFIG_X', get_option('x')) +conf_data.set('CONFIG_LIBDOM', get_option('libdom')) + +#CONFIG_BOOKMARKS=true +#CONFIG_XBEL_BOOKMARKS=true +#CONFIG_COOKIES=true +#CONFIG_DOM=true +conf_data.set('CONFIG_ECMASCRIPT', true) +#CONFIG_ECMASCRIPT_SMJS', true) +conf_data.set('CONFIG_ECMASCRIPT_SMJS_HEARTBEAT', true) +#CONFIG_FORMHIST', true) +#CONFIG_GLOBHIST', true) +conf_data.set('CONFIG_SCRIPTING', true) +#CONFIG_SCRIPTING_GUILE', false) +#conf_data.set('CONFIG_SCRIPTING_LUA', true) +#CONFIG_SCRIPTING_PERL', false) +#CONFIG_SCRIPTING_PYTHON', false) +#CONFIG_SCRIPTING_RUBY', false) +#CONFIG_SCRIPTING_SPIDERMONKEY', false) +#CONFIG_LEDS', true) +#CONFIG_EXMODE', false) +#CONFIG_CSS', true) +#CONFIG_LIBDOM', false) +#CONFIG_BROTLI', true) +#CONFIG_BZIP2', true) +#CONFIG_GZIP', true) +#CONFIG_LZMA', false) +#CONFIG_ZSTD', true) +#CONFIG_NLS', true) +#CONFIG_UTF8', true) +#CONFIG_MAILCAP', true) +#CONFIG_MIMETYPES', true) + +system = host_machine.system() +if system == 'haiku' + conf_data.set('CONFIG_OS_BEOS', true) +else + conf_data.set('CONFIG_OS_BEOS', false) +endif + +if system == 'windows' + conf_data.set('CONFIG_OS_WIN32', true) +else + conf_data.set('CONFIG_OS_WIN32', false) +endif + +if system != 'haiku' and system != 'windows' + conf_data.set10('CONFIG_OS_UNIX', true) +else + conf_data.set10('CONFIG_OS_UNIX', false) +endif + +conf_data.set('CONFIG_SSL', true) +conf_data.set('CONFIG_OS_OS2', false) +conf_data.set('CONFIG_OS_RISCOS', false) + +# AC_HEADER_DIRENT +conf_data.set10('HAVE_DIRENT_H', 1) +# AC_HEADER_SYS_WAIT +conf_data.set10('HAVE_SYS_WAIT_H', 1) +# AC_HEADER_TIME +conf_data.set10('TIME_WITH_SYS_TIME', 1) +conf_data.set10('HAVE_SYS_TIME_H', 1) + +compiler = meson.get_compiler('c') + +conf_data.set10('HAVE_WCHAR_H', compiler.has_header('wchar.h')) +conf_data.set10('HAVE_WCTYPE_H', compiler.has_header('wctype.h')) +conf_data.set10('HAVE_FCNTL_H', compiler.has_header('fcntl.h')) +conf_data.set10('HAVE_LIMITS_H', compiler.has_header('limits.h')) +conf_data.set10('HAVE_TIME_H', compiler.has_header('time.h')) +conf_data.set10('HAVE_UNISTD_H', compiler.has_header('unistd.h')) +conf_data.set10('HAVE_SIGACTION_H', compiler.has_header('sigaction.h')) +conf_data.set10('HAVE_ARPA_INET_H', compiler.has_header('arpa/inet.h')) +conf_data.set10('HAVE_NETINET_IN_SYSTM_H', compiler.has_header('netinet/in_systm.h')) +conf_data.set10('HAVE_NETINET_IN_SYSTEM_H', compiler.has_header('netinet/in_system.h')) +conf_data.set10('HAVE_NETINET_IP_H', compiler.has_header('netinet/ip.h')) +conf_data.set10('HAVE_NETDB_H', compiler.has_header('netdb.h')) + +conf_data.set10('HAVE_NETINET_IN_H', compiler.has_header('netinet/in.h')) +conf_data.set10('HAVE_NETINET_IN6_VAR_H', compiler.has_header('netinet/in6_var.h')) +conf_data.set10('HAVE_IFADDRS_H', compiler.has_header('ifaddrs.h')) +conf_data.set('HAVE_SYS_CYGWIN_H', compiler.has_header('sys/cygwin.h')) +conf_data.set('HAVE_IO_H', compiler.has_header('io.h')) +conf_data.set10('HAVE_SYS_FMUTEX_H', compiler.has_header('sys/fmutex.h')) +conf_data.set10('HAVE_SYS_IOCTL_H', compiler.has_header('sys/ioctl.h')) +conf_data.set10('HAVE_SYS_SOCKIO_H', compiler.has_header('sys/sockio.h')) +conf_data.set10('HAVE_SYS_RESOURCE_H', compiler.has_header('sys/resource.h')) +conf_data.set10('HAVE_SYS_SELECT_H', compiler.has_header('sys/select.h')) +conf_data.set10('HAVE_SYS_SOCKET_H', compiler.has_header('sys/socket.h')) +conf_data.set10('HAVE_SYS_TIME_H', compiler.has_header('sys/time.h')) +conf_data.set10('HAVE_SYS_UTSNAME_H', compiler.has_header('sys/utsname.h')) +conf_data.set10('HAVE_NET_IF_H', compiler.has_header('net/if.h')) + +conf_data.set10('HAVE_STDINT_H', compiler.has_header('stdint.h')) +conf_data.set10('HAVE_INTTYPES_H', compiler.has_header('inttypes.h')) +conf_data.set10('HAVE_LOCALE_H', compiler.has_header('locale.h')) +conf_data.set10('HAVE_PWD_H', compiler.has_header('pwd.h')) +conf_data.set10('HAVE_TERMIOS_H', compiler.has_header('termios.h')) +conf_data.set10('HAVE_POLL_H', compiler.has_header('poll.h')) + +conf_data.set10('HAVE_SYS_TYPES_H', compiler.has_header('sys/types.h')) +conf_data.set10('HAVE_GPM_H', compiler.has_header('gpm.h')) +conf_data.set('HAVE_IDNA_H', compiler.has_header('idna.h')) + +conf_data.set('HAVE_EVENT_H', compiler.has_header('event.h')) + +conf_data.set10('HAVE_STDLIB_H', compiler.has_header('stdlib.h')) +conf_data.set10('HAVE_STRING_H', compiler.has_header('string.h')) +conf_data.set10('HAVE_ALLOCA_H', compiler.has_header('alloca.h')) + +deps = [] +if conf_data.get('CONFIG_GZIP') + zdeps = dependency('zlib') + if not zdeps.found() + error('zlib not found') + endif + deps += zdeps +endif + +if conf_data.get('CONFIG_TRE') + tredeps = dependency('tre') + if not tredeps.found() + error('tre not found') + endif + deps += tredeps +endif + +if conf_data.get('CONFIG_LIBEVENT') + eventdeps = dependency('libevent') + if not eventdeps.found() + error('libevent not found') + endif + deps += eventdeps + conf_data.set('HAVE_LIBEVENT', true) +else + eventdeps = [] +endif + +if conf_data.get('CONFIG_OPENSSL') + ssldeps = dependency('openssl') + if not ssldeps.found() + error('openssl not found') + endif + deps += ssldeps + conf_data.set('USE_OPENSSL', true) +else + ssldeps = [] +endif + +gnutlsdeps = [] +if conf_data.get('CONFIG_GNUTLS') + gnutlsdeps = dependency('gnutls') + if not gnutlsdeps.found() + error('gnutls not found') + endif + libgcryptdeps = dependency('libgcrypt') + if not libgcryptdeps.found() + error('libgcrypt not found') + endif + deps += gnutlsdeps + deps += libgcryptdeps +endif + +if conf_data.get('CONFIG_BROTLI') + brotlideps = dependency('libbrotlidec') + if not brotlideps.found() + error('brotli not found') + endif + deps += brotlideps +endif + +if conf_data.get('CONFIG_ZSTD') + zstddeps = dependency('libzstd') + if not zstddeps.found() + error('zstd not found') + endif + deps += zstddeps +endif + +if conf_data.get('CONFIG_IDN') + idndeps = dependency('libidn') + if not idndeps.found() + error('idn not found') + endif + deps += idndeps +endif + +if conf_data.get('CONFIG_X') + x11deps = dependency('X11') + if not x11deps.found() + error('x11 not found') + endif + deps += x11deps +endif + +if conf_data.get('CONFIG_BZIP2') + bz2deps = dependency('bzip2') + if not bz2deps.found() + error('bz2 not found') + endif + deps += bz2deps +endif + +if conf_data.get('CONFIG_ECMASCRIPT') + mozjsdeps = dependency('mozjs-17.0') + if not mozjsdeps.found() + error('mozjs-17.0 not found') + endif + deps += mozjsdeps +endif + +if conf_data.get('CONFIG_SCRIPTING_LUA') + luadeps = dependency(luapkg) + if not luadeps.found() + error('lua not found') + endif + deps += luadeps +endif + +if conf_data.get('CONFIG_XBEL_BOOKMARKS') + expatdeps = dependency('expat') + if not expatdeps.found() + error('expat not found') + endif + deps += expatdeps +endif + +if conf_data.get('CONFIG_GPM') + cc = meson.get_compiler('c') + libgpmdeps = cc.find_library('gpm') + if not libgpmdeps.found() + error('gpm not found') + endif + deps += libgpmdeps +endif + +if conf_data.get('CONFIG_LIBDOM') + domdeps = dependency('libdom') + if not domdeps.found() + error('libdom not found') + endif + deps += domdeps +endif + +if conf_data.get('CONFIG_SCRIPTING_PYTHON') + python3deps = dependency('python3-embed') + if not python3deps.found() + error('python3 not found') + endif + deps += python3deps +endif + +rubydeps = [] +if conf_data.get('CONFIG_SCRIPTING_RUBY') + rubydeps = dependency('ruby-2.6') + if not rubydeps.found() + error('ruby not found') + endif + deps += rubydeps +endif + +guiledeps = [] +if conf_data.get('CONFIG_SCRIPTING_GUILE') + guiledeps = dependency('guile-2.2') + if not guiledeps.found() + error('guile not found') + endif + deps += guiledeps +endif + +eh = '' + +if conf_data.get('CONFIG_LIBEV') + conf_data.set('HAVE_LIBEV_EVENT_H', compiler.has_header('libev/event.h')) + eh = '#include ' +elif conf_data.get('CONFIG_LIBEVENT') + eh = '#include ' +endif + +if compiler.has_header('sys/un.h') + conf_data.set('CONFIG_INTERLINK', true) + conf_data.set10('HAVE_SYS_UN_H', true) +else + conf_data.set('CONFIG_INTERLINK', false) +endif + +#AC_STRUCT_TM +#AC_C_CONST +#AC_C_INLINE + +conf_data.set('NONSTATIC_INLINE', 'inline') + +#AC_SYS_LARGEFILE + +#AC_TYPE_SIZE_T +#AC_TYPE_OFF_T +#EL_CHECK_TYPE(ssize_t, int) + +conf_data.set10('HAVE_LONG_LONG', 1) +conf_data.set10('HAVE_OFF_T', 1) +conf_data.set10('HAVE_INT32_T', 1) +conf_data.set10('HAVE_UINT32_T', 1) +conf_data.set10('HAVE_UINT16_T', 1) +conf_data.set10('HAVE_VARIADIC_MACROS', 1) + +#AC_FUNC_MEMCMP +#AC_FUNC_MMAP + +conf_data.set10('HAVE_MMAP', 1) + +if compiler.has_function('strftime', prefix: '#include ') + conf_data.set10('HAVE_STRFTIME', 1) +endif + +if compiler.has_function('strptime', prefix: '#include ', args: '-D_XOPEN_SOURCE') + conf_data.set10('HAVE_STRPTIME', 1) +endif + +if compiler.has_function('atoll', prefix : '#include ') + conf_data.set10('HAVE_ATOLL', 1) +endif + +if compiler.has_function('gethostbyaddr', prefix : '#include ') + conf_data.set10('HAVE_GETHOSTBYADDR', 1) +endif + +if compiler.has_function('herror', prefix : '#include ') + conf_data.set10('HAVE_HERROR', 1) +endif + +if compiler.has_function('strerror', prefix : '#include ') + conf_data.set10('HAVE_STRERROR', 1) +endif + +if compiler.has_function('popen', prefix : '#include ') + conf_data.set10('HAVE_POPEN', 1) +endif + +if compiler.has_function('uname', prefix : '#include ') + conf_data.set10('HAVE_UNAME', 1) +endif + +if compiler.has_function('access', prefix : '#include ') + conf_data.set10('HAVE_ACCESS', 1) +endif + +if compiler.has_function('chmod', prefix : '#include ') + conf_data.set10('HAVE_CHMOD', 1) +endif + +if compiler.has_function('alarm', prefix : '#include ') + conf_data.set10('HAVE_ALARM', 1) +endif + +if compiler.has_function('timegm', prefix : '#include ') + conf_data.set10('HAVE_TIMEGM', 1) +endif + +if compiler.has_function('mremap', prefix : '#include ', args: '-D_GNU_SOURCE') + conf_data.set10('HAVE_MREMAP', 1) +endif + +if compiler.has_function('strcasecmp', prefix : '#include ') + conf_data.set10('HAVE_STRCASECMP', 1) +endif + +if compiler.has_function('strncasecmp', prefix : '#include ') + conf_data.set10('HAVE_STRNCASECMP', 1) +endif + +if compiler.has_function('strcasestr', prefix : '#include ', args: '-D_GNU_SOURCE') + conf_data.set10('HAVE_STRCASESTR', 1) +endif + +if compiler.has_function('strstr', prefix : '#include ') + conf_data.set10('HAVE_STRSTR', 1) +endif + +if compiler.has_function('strchr', prefix : '#include ') + conf_data.set10('HAVE_STRCHR', 1) +endif + +if compiler.has_function('strrchr', prefix : '#include ') + conf_data.set10('HAVE_STRRCHR', 1) +endif + +if compiler.has_function('memmove', prefix : '#include ') + conf_data.set10('HAVE_MEMMOVE', 1) +endif + +if compiler.has_function('bcopy', prefix : '#include ') + conf_data.set10('HAVE_BCOPY', 1) +endif + +if compiler.has_function('stpcpy', prefix : '#include ') + conf_data.set10('HAVE_STPCPY', 1) +endif + +if compiler.has_function('strdup', prefix : '#include ') + conf_data.set10('HAVE_STRDUP', 1) +endif + +if compiler.has_function('index', prefix : '#include ') + conf_data.set10('HAVE_INDEX', 1) +endif + +if compiler.has_function('isdigit', prefix : '#include ') + conf_data.set10('HAVE_ISDIGIT', 1) +endif + +if compiler.has_function('mempcpy', prefix : '#include ') + conf_data.set10('HAVE_MEMPCPY', 1) +endif + +if compiler.has_function('memrchr', prefix : '#include ', args: '-D_GNU_SOURCE') + conf_data.set10('HAVE_MEMRCHR', 1) +endif + +if compiler.has_function('snprintf', prefix : '#include ') + conf_data.set10('HAVE_SNPRINTF', 1) +endif + +if compiler.has_function('vsnprintf', prefix : '#include ') + conf_data.set10('HAVE_VSNPRINTF', 1) +endif + +if compiler.has_function('asprintf', prefix : '#include ', args: '-D_GNU_SOURCE') + conf_data.set10('HAVE_ASPRINTF', 1) +endif + +if compiler.has_function('vasprintf', prefix : '#include ', args: '-D_GNU_SOURCE') + conf_data.set10('HAVE_VASPRINTF', 1) +endif + +if compiler.has_function('getifaddrs', prefix : '#include ') + conf_data.set10('HAVE_GETIFADDRS', 1) +endif + +if compiler.has_function('getpwnam', prefix : '#include ') + conf_data.set10('HAVE_GETPWNAM', 1) +endif + +if compiler.has_function('inet_pton', prefix : '#include ') + conf_data.set10('HAVE_INET_PTON', 1) +endif + +if compiler.has_function('inet_ntop', prefix : '#include ') + conf_data.set10('HAVE_INET_NTOP', 1) +endif + +if compiler.has_function('fflush', prefix : '#include ') + conf_data.set10('HAVE_FFLUSH', 1) +endif + +if compiler.has_function('fsync', prefix : '#include ') + conf_data.set10('HAVE_FSYNC', 1) +endif + +if compiler.has_function('fseeko', prefix : '#include ') + conf_data.set10('HAVE_FSEEKO', 1) +endif + +if compiler.has_function('ftello', prefix : '#include ') + conf_data.set10('HAVE_FTELLO', 1) +endif + +if compiler.has_function('sigaction', prefix : '#include ') + conf_data.set10('HAVE_SIGACTION', 1) +endif + +if compiler.has_function('gettimeofday', prefix : '#include ') + conf_data.set10('HAVE_GETTIMEOFDAY', 1) +endif + +if compiler.has_function('clock_gettime', prefix : '#include ') + conf_data.set10('HAVE_CLOCK_GETTIME', 1) +endif + +if compiler.has_function('setitimer', prefix : '#include ') + conf_data.set10('HAVE_SETITIMER', 1) +endif + +if compiler.has_function('setenv', prefix : '#include ') + conf_data.set10('HAVE_SETENV', 1) + conf_data.set('HAVE_SETENV_OR_PUTENV', true) +endif + +if compiler.has_function('putenv', prefix : '#include ') + conf_data.set10('HAVE_PUTENV', 1) + conf_data.set('HAVE_SETENV_OR_PUTENV', true) +endif + +if compiler.has_function('unsetenv', prefix : '#include ') + conf_data.set10('HAVE_UNSETENV', 1) +endif + +if compiler.has_function('getuid', prefix : '#include ') + conf_data.set10('HAVE_GETUID', 1) +endif + +if compiler.has_function('geteuid', prefix : '#include ') + conf_data.set10('HAVE_GETEUID', 1) +endif + +if compiler.has_function('wcwidth', prefix : '#include ', args: '-D_XOPEN_SOURCE') + conf_data.set10('HAVE_WCWIDTH', 1) +endif + +if compiler.has_function('fork', prefix : '#include ') + conf_data.set10('HAVE_FORK', 1) +endif + +if compiler.has_function('getpid', prefix : '#include ') + conf_data.set10('HAVE_GETPID', 1) +endif + +if compiler.has_function('setpgid', prefix : '#include ') + conf_data.set10('HAVE_SETPGID', 1) +endif + +if compiler.has_function('getpgid', prefix : '#include ') + conf_data.set10('HAVE_GETPGID', 1) +endif + +if compiler.has_function('setpgrp', prefix : '#include ') + conf_data.set10('HAVE_SETPGRP', 1) +endif + +if compiler.has_function('getpgrp', prefix : '#include ') + conf_data.set10('HAVE_GETPGRP', 1) +endif + +if compiler.has_function('raise', prefix : '#include ') + conf_data.set10('HAVE_RAISE', 1) +endif + +if compiler.has_function('kill', prefix : '#include ') + conf_data.set10('HAVE_KILL', 1) +endif + +if compiler.has_function('fpathconf', prefix : '#include ') + conf_data.set10('HAVE_FPATHCONF', 1) +endif + +if compiler.has_function('poll', prefix : '#include ') + conf_data.set10('HAVE_POLL', 1) +endif + +if compiler.has_function('event_base_set', prefix: eh, dependencies: eventdeps) + conf_data.set('HAVE_EVENT_BASE_SET', 1) +endif + +if compiler.has_function('event_get_version', prefix: eh, dependencies: eventdeps) + conf_data.set('HAVE_EVENT_GET_VERSION', 1) +endif + +if compiler.has_function('event_get_method', prefix : eh, dependencies: eventdeps) + conf_data.set('HAVE_EVENT_GET_METHD', 1) +endif + +if compiler.has_function('event_base_free', prefix : eh, dependencies: eventdeps) + conf_data.set('HAVE_EVENT_BASE_FREE', 1) +endif + +if compiler.has_function('event_base_new', prefix : eh, dependencies: eventdeps) + conf_data.set('HAVE_EVENT_BASE_NEW', 1) +endif + +if compiler.has_function('event_reinit', prefix : eh, dependencies: eventdeps) + conf_data.set('HAVE_EVENT_REINIT', 1) +endif + +if compiler.has_function('event_base_get_method', prefix : eh, dependencies: eventdeps) + conf_data.set('HAVE_EVENT_BASE_GET_METHOD', 1) +endif + +if compiler.has_function('event_reinit', prefix : eh, dependencies: eventdeps) + conf_data.set('HAVE_EVENT_REINIT', 1) +endif + +if compiler.has_function('event_config_set_flag', prefix : eh, dependencies: eventdeps) + conf_data.set('HAVE_EVENT_CONFIG_SET_FLAG', 1) +endif + +if compiler.has_function('event_get_struct_event_size', prefix : eh, dependencies: eventdeps) + conf_data.set('HAVE_EVENT_GET_STRUCT_EVENT_SIZE', 1) +endif + +if compiler.has_function('RAND_bytes', prefix: '#include ', dependencies: ssldeps) + conf_data.set('HAVE_RAND_BYTES', 1) +endif + +if compiler.has_function('ASN1_STRING_get0_data', prefix: '#include ', dependencies: ssldeps) + conf_data.set('HAVE_ASN1_STRING_GET0_DATA', 1) +endif + +if compiler.has_function('nl_langinfo', prefix: '#include ') + conf_data.set('HAVE_LANGINFO_CODESET', 1) +endif + +if compiler.has_function('iconv', prefix: '#include ') + conf_data.set('HAVE_ICONV', 1) +endif + +if compiler.has_function('alloca', prefix: '#include ') + conf_data.set('HAVE_ALLOCA', 1) +endif + +if compiler.has_function('rb_errinfo', prefix: '#include ', dependencies: rubydeps) + conf_data.set('HAVE_RB_ERRINFO', 1) +endif + +if compiler.has_function('gnutls_priority_set_direct', prefix: '#include ', dependencies: gnutlsdeps) + conf_data.set('HAVE_GNUTLS_PRIORITY_SET_DIRECT', 1) +endif + +if compiler.has_function('gnutls_certificate_set_x509_system_trust', prefix: '#include ', dependencies: gnutlsdeps) + conf_data.set('HAVE_GNUTLS_CERTIFICATE_SET_X509_SYSTEM_TRUST', 1) +endif + +conf_data.set('ICONV_CONST', true) + +conf_data.set('CONFDIR', get_option('prefix') / get_option('sysconfdir')/'elinks') +conf_data.set('LIBDIR', get_option('prefix') / 'lib') +conf_data.set('LOCALEDIR', get_option('prefix') / 'share/locale') + +conf_data.set('HAVE_SA_STORAGE', true) + +conf_data.set('SIZEOF_CHAR', compiler.sizeof('char')) +conf_data.set('SIZEOF_SHORT', compiler.sizeof('short')) +conf_data.set('SIZEOF_INT', compiler.sizeof('int')) +conf_data.set('SIZEOF_LONG', compiler.sizeof('long')) +conf_data.set('SIZEOF_LONG_LONG', compiler.sizeof('long long')) +conf_data.set('SIZEOF_OFF_T', compiler.sizeof('off_t')) + + +#AC_CHECK_FUNCS([cygwin_conv_to_full_win32_path]) + +#CONFIG_BITTORRENT', true) +#CONFIG_FINGER', false) +#CONFIG_FSP', false) +#CONFIG_FTP', true) +#CONFIG_GOPHER', true) +#CONFIG_NNTP', false) +#CONFIG_SMB', false) +#CONFIG_URI_REWRITE', true) +#CONFIG_CGI', true) +#CONFIG_GSSAPI', false) +#CONFIG_DATA', true) +#CONFIG_MOUSE', true) +#CONFIG_TERMINFO', false) +#CONFIG_SMALL', false) +#CONFIG_DEBUG', false) +#CONFIG_OWN_LIBC', false) +conf_data.set('CONFIG_GNUTLS_OPENSSL_COMPAT', false) +#CONFIG_OPENSSL', true) +#CONFIG_MARKS', true) + +configure_file(input : 'config2.h.in', + output : 'config.h', + configuration : conf_data) + +subdir('src') diff --git a/meson_options.txt b/meson_options.txt new file mode 100644 index 00000000..e0e6ec6f --- /dev/null +++ b/meson_options.txt @@ -0,0 +1,63 @@ +option('largefile', type: 'boolean', value: true, description: 'support for large files') +option('bookmarks', type: 'boolean', value: true, description: 'bookmark support') +option('xbel', type: 'boolean', value: true, description: 'XBEL bookmark support (requires expat)') +option('sm-scripting', type: 'boolean', value: true, description: 'ECMAScript browser scripting (requires Spidermonkey)') +option('nls', type: 'boolean', value: true, description: 'Native Language Support') +option('cookies', type: 'boolean', value: true, description: 'cookie support') +option('formhist', type: 'boolean', value: true, description: 'form history support') +option('globhist', type: 'boolean', value: true, description: 'global history support') +option('mailcap', type: 'boolean', value: true, description: 'mailcap support') +option('mimetypes', type: 'boolean', value: true, description: 'mimetypes files support') +option('ipv6', type: 'boolean', value: true, description: 'IPv6 support') +option('bittorrent', type: 'boolean', value: false, description: 'BitTorrent protocol support') +option('data', type: 'boolean', value: true, description: 'data protocol support') +option('uri-rewrite', type: 'boolean', value: true, description: 'URI rewrite support') +option('cgi', type: 'boolean', value: false, description: 'local CGI support') +option('finger', type: 'boolean', value: false, description: 'finger protocol support') +option('fsp', type: 'boolean', value: false, description: 'FSP protocol support') +option('ftp', type: 'boolean', value: true, description: 'ftp protocol support') +option('gopher', type: 'boolean', value: false, description: 'gopher protocol support') +option('nntp', type: 'boolean', value: false, description: 'nntp protocol support') +option('smb', type: 'boolean', value: false, description: 'Samba protocol support') +option('mouse', type: 'boolean', value: true, description: 'mouse support') +option('sysmouse', type: 'boolean', value: false, description: 'BSD sysmouse support') +option('88-colors', type: 'boolean', value: false, description: '88 color support') +option('256-colors', type: 'boolean', value: false, description: '256 color support') +option('true-color', type: 'boolean', value: false, description: 'true color support') +option('exmode', type: 'boolean', value: false, description: 'exmode (CLI) interface') +option('leds', type: 'boolean', value: true, description: 'LEDs support') +option('marks', type: 'boolean', value: true, description: 'document marks support') +option('css', type: 'boolean', value: true, description: 'Cascading Style Sheet support') +option('html-highlight', type: 'boolean', value: false, description: 'HTML highlighting using DOM engine') +option('backtrace', type: 'boolean', value: true, description: 'backtrace support') +option('no-root', type: 'boolean', value: false, description: 'prevention of usage by root') +option('withdebug', type: 'boolean', value: false, description: 'leak debug and internal error checking') +option('fastmem', type: 'boolean', value: false, description: 'direct use of system allocation functions, not usable with debug enabled') +option('own-libc', type: 'boolean', value: false, description: 'force use of internal functions instead of those of system libc') +option('small', type: 'boolean', value: false, description: 'reduce binary size as far as possible (but see the bottom of doc/small.txt!)') +option('utf-8', type: 'boolean', value: true, description: 'UTF-8 support') +option('combining', type: 'boolean', value: false, description: 'support Unicode combining characters (experimental)') + +option('xterm', type: 'boolean', value: false, description: 'how to invoke the X terminal emulator') +option('gpm', type: 'boolean', value: true, description: 'gpm (mouse) support') +option('terminfo', type: 'boolean', value: false, description: 'terminfo support') +option('zlib', type: 'boolean', value: true, description: 'zlib support') +option('bzlib', type: 'boolean', value: true, description: 'bzip2 support') +option('brotli', type: 'boolean', value: false, description: 'brotli support') +option('zstd', type: 'boolean', value: false, description: 'zstd support') +option('idn', type: 'boolean', value: true, description: 'international domain names support') +option('lzma', type: 'boolean', value: false, description: 'lzma encoding support') +option('gssapi', type: 'boolean', value: false, description: 'GSSAPI support') +option('spidermonkey', type: 'boolean', value: true, description: 'SpiderMonkey Mozilla JavaScript engine support') +option('guile', type: 'boolean', value: false, description: 'Guile support') +option('perl', type: 'boolean', value: false, description: 'Perl5 support') +option('python', type: 'boolean', value: false, description: 'Python3 support') +option('luapkg', type: 'string', value:'', description: 'Lua version') +option('tre', type: 'boolean', value: true, description: 'TRE regex search support') +option('ruby', type: 'boolean', value: false, description: 'Ruby support') +option('gnutls', type: 'boolean', value: false, description: 'GNUTLS SSL support') +option('openssl', type: 'boolean', value: true, description: 'OpenSSL support') +option('libev', type: 'boolean', value: false, description: 'compile with libev (libevent compatibility mode)') +option('libevent', type: 'boolean', value: false, description: 'compile with libevent. Note that libev has precedence') +option('x', type: 'boolean', value: false, description: 'use the X Window System') +option('libdom', type: 'boolean', value: false, description: 'libdom') diff --git a/src/bfu/meson.build b/src/bfu/meson.build new file mode 100644 index 00000000..24025bdf --- /dev/null +++ b/src/bfu/meson.build @@ -0,0 +1,5 @@ +srcs += files('button.c', 'checkbox.c', 'dialog.c', 'group.c', 'hierbox.c', 'hotkey.c', 'inpfield.c', 'inphist.c', 'listbox.c', + 'listmenu.c', 'menu.c', 'msgbox.c', 'style.c', 'text.c', 'widget.c') +if conf_data.get('CONFIG_LEDS') + srcs += files('leds.c') +endif diff --git a/src/bookmarks/backend/meson.build b/src/bookmarks/backend/meson.build new file mode 100644 index 00000000..88840b52 --- /dev/null +++ b/src/bookmarks/backend/meson.build @@ -0,0 +1,5 @@ +if conf_data.get('CONFIG_XBEL_BOOKMARKS') + srcs += files('xbel.c') +endif +srcs += files('common.c', 'default.c') + diff --git a/src/bookmarks/meson.build b/src/bookmarks/meson.build new file mode 100644 index 00000000..55fed0be --- /dev/null +++ b/src/bookmarks/meson.build @@ -0,0 +1,2 @@ +subdir('backend') +srcs += files('bookmarks.c', 'dialogs.c') diff --git a/src/cache/meson.build b/src/cache/meson.build new file mode 100644 index 00000000..4da62631 --- /dev/null +++ b/src/cache/meson.build @@ -0,0 +1 @@ +srcs += files('cache.c', 'dialogs.c') diff --git a/src/config/meson.build b/src/config/meson.build new file mode 100644 index 00000000..cdc173b6 --- /dev/null +++ b/src/config/meson.build @@ -0,0 +1 @@ +srcs += files('cmdline.c', 'conf.c', 'dialogs.c', 'domain.c', 'home.c', 'kbdbind.c', 'options.c', 'opttypes.c', 'timer.c', 'urlhist.c') diff --git a/src/cookies/dialogs.c b/src/cookies/dialogs.c index 5590f6d0..093ac044 100644 --- a/src/cookies/dialogs.c +++ b/src/cookies/dialogs.c @@ -1,4 +1,7 @@ /* Cookie-related dialogs */ +#ifndef _XOPEN_SOURCE +#define _XOPEN_SOURCE +#endif #ifdef HAVE_CONFIG_H #include "config.h" diff --git a/src/cookies/meson.build b/src/cookies/meson.build new file mode 100644 index 00000000..1c7341b4 --- /dev/null +++ b/src/cookies/meson.build @@ -0,0 +1,23 @@ +srcs += files('cookies.c', 'dialogs.c', 'path.c', 'parser.c') +#PROG = parsetst +# +#TEST_PROGS = \ +# cookies-t$(EXEEXT) + +#TESTDEPS = path.o + + +#PARSETSTDEPS = \ +# $(top_builddir)/src/util/error.o \ +# $(top_builddir)/src/util/string.o + +#ifdef CONFIG_DEBUG +#PARSETSTDEPS += $(top_builddir)/src/util/memdebug.o +#endif + +#parsetst: $(PARSETSTDEPS) parser.o parsetst.o +# $(call cmd,link) +# +#CLEAN += parsetst.o +# +#include $(top_srcdir)/Makefile.lib diff --git a/src/dialogs/meson.build b/src/dialogs/meson.build new file mode 100644 index 00000000..59ff3e3f --- /dev/null +++ b/src/dialogs/meson.build @@ -0,0 +1,4 @@ +if conf_data.get('CONFIG_EXMODE') + srcs += files('exmode.c') +endif +srcs += files('document.c', 'download.c', 'edit.c', 'info.c', 'menu.c', 'options.c', 'progress.c', 'status.c') diff --git a/src/document/css/meson.build b/src/document/css/meson.build new file mode 100644 index 00000000..7fb1519f --- /dev/null +++ b/src/document/css/meson.build @@ -0,0 +1 @@ +srcs += files('apply.c', 'css.c', 'parser.c', 'property.c', 'scanner.c', 'stylesheet.c', 'value.c') diff --git a/src/document/dom/meson.build b/src/document/dom/meson.build new file mode 100644 index 00000000..50c1618b --- /dev/null +++ b/src/document/dom/meson.build @@ -0,0 +1 @@ +srcs += files('renderer.c', 'rss.c', 'source.c', 'util.c') diff --git a/src/document/html/meson.build b/src/document/html/meson.build new file mode 100644 index 00000000..53093012 --- /dev/null +++ b/src/document/html/meson.build @@ -0,0 +1,3 @@ +subdir('parser') +#test +srcs += files('frames.c', 'parse-meta-refresh.c', 'parser.c', 'renderer.c', 'tables.c') diff --git a/src/document/html/parser/meson.build b/src/document/html/parser/meson.build new file mode 100644 index 00000000..e367b2c9 --- /dev/null +++ b/src/document/html/parser/meson.build @@ -0,0 +1 @@ +srcs += files('forms.c', 'general.c', 'link.c', 'parse.c', 'stack.c', 'table.c') diff --git a/src/document/libdom/meson.build b/src/document/libdom/meson.build new file mode 100644 index 00000000..c9768007 --- /dev/null +++ b/src/document/libdom/meson.build @@ -0,0 +1,2 @@ +#INCLUDES += $(LIBDOM_CFLAGS) +srcs += files('renderer.c') diff --git a/src/document/meson.build b/src/document/meson.build new file mode 100644 index 00000000..65d29271 --- /dev/null +++ b/src/document/meson.build @@ -0,0 +1,12 @@ +if conf_data.get('CONFIG_CSS') == 1 + subdir('css') +endif +if conf_data.get('CONFIG_DOM') + subdir('dom') +endif +if conf_data.get('CONFIG_LIBDOM') + subdir('libdom') +endif +subdir('html') +subdir('plain') +srcs += files('docdata.c', 'document.c', 'format.c', 'forms.c', 'options.c', 'refresh.c', 'renderer.c') diff --git a/src/document/plain/meson.build b/src/document/plain/meson.build new file mode 100644 index 00000000..6a2e1242 --- /dev/null +++ b/src/document/plain/meson.build @@ -0,0 +1 @@ +srcs += files('renderer.c') diff --git a/src/dom/css/meson.build b/src/dom/css/meson.build new file mode 100644 index 00000000..06902e36 --- /dev/null +++ b/src/dom/css/meson.build @@ -0,0 +1 @@ +srcs += files('scanner.c') diff --git a/src/dom/meson.build b/src/dom/meson.build new file mode 100644 index 00000000..e9d5ff1f --- /dev/null +++ b/src/dom/meson.build @@ -0,0 +1,5 @@ +#SUBDIRS = css sgml test +subdir('css') +subdir('sgml') +srcs += files('configuration.c', 'node.c', 'select.c', 'stack.c', 'scanner.c') +#SUBDIRS-$(CONFIG_DEBUG) += test diff --git a/src/dom/sgml/docbook/meson.build b/src/dom/sgml/docbook/meson.build new file mode 100644 index 00000000..b41ce85a --- /dev/null +++ b/src/dom/sgml/docbook/meson.build @@ -0,0 +1 @@ +srcs += files('docbook.c') diff --git a/src/dom/sgml/html/meson.build b/src/dom/sgml/html/meson.build new file mode 100644 index 00000000..9343a266 --- /dev/null +++ b/src/dom/sgml/html/meson.build @@ -0,0 +1 @@ +srcs += files('html.c') diff --git a/src/dom/sgml/meson.build b/src/dom/sgml/meson.build new file mode 100644 index 00000000..7d289dee --- /dev/null +++ b/src/dom/sgml/meson.build @@ -0,0 +1,5 @@ +subdir('docbook') +subdir('html') +subdir('rss') +subdir('xbel') +srcs += files('dump.c', 'parser.c', 'scanner.c', 'sgml.c') diff --git a/src/dom/sgml/rss/meson.build b/src/dom/sgml/rss/meson.build new file mode 100644 index 00000000..565948cf --- /dev/null +++ b/src/dom/sgml/rss/meson.build @@ -0,0 +1 @@ +srcs += files('rss.c') diff --git a/src/dom/sgml/xbel/meson.build b/src/dom/sgml/xbel/meson.build new file mode 100644 index 00000000..9aab64c9 --- /dev/null +++ b/src/dom/sgml/xbel/meson.build @@ -0,0 +1 @@ +srcs += files('xbel.c') diff --git a/src/ecmascript/meson.build b/src/ecmascript/meson.build new file mode 100644 index 00000000..8b9d01cd --- /dev/null +++ b/src/ecmascript/meson.build @@ -0,0 +1,19 @@ +#INCLUDES += $(SPIDERMONKEY_CFLAGS) +if conf_data.get('CONFIG_ECMASCRIPT_SMJS') + subdir('spidermonkey') + srcs += files('spidermonkey.c') +endif + +if conf_data.get('CONFIG_ECMASCRIPT_SMJS') + CONFIG_ANY_SPIDERMONKEY = true +elif conf_data.get('CONFIG_SCRIPTING_SPIDERMONKEY') + CONFIG_ANY_SPIDERMONKEY = true +else + CONFIG_ANY_SPIDERMONKEY = false +endif + +if CONFIG_ANY_SPIDERMONKEY + srcs += files('spidermonkey-shared.c') +endif + +srcs += files('ecmascript.c') diff --git a/src/ecmascript/spidermonkey/meson.build b/src/ecmascript/spidermonkey/meson.build new file mode 100644 index 00000000..2eaecc44 --- /dev/null +++ b/src/ecmascript/spidermonkey/meson.build @@ -0,0 +1,6 @@ +#INCLUDES += $(SPIDERMONKEY_CFLAGS) + +if conf_data.get('CONFIG_ECMASCRIPT_SMJS_HEARTBEAT') + srcs += files('heartbeat.c') +endif +srcs += files('document.c', 'form.c', 'location.c', 'navigator.c', 'unibar.c', 'window.c') diff --git a/src/encoding/bzip2.c b/src/encoding/bzip2.c index 8fcfbd7b..9de17cc5 100644 --- a/src/encoding/bzip2.c +++ b/src/encoding/bzip2.c @@ -9,9 +9,9 @@ #ifdef HAVE_UNISTD_H #include #endif -#ifdef HAVE_BZLIB_H + #include /* Everything needs this after stdio.h */ -#endif + #include #include "elinks.h" diff --git a/src/encoding/deflate.c b/src/encoding/deflate.c index 975c2a87..7969752c 100644 --- a/src/encoding/deflate.c +++ b/src/encoding/deflate.c @@ -9,9 +9,7 @@ #ifdef HAVE_UNISTD_H #include #endif -#ifdef HAVE_ZLIB_H #include -#endif #include #include "elinks.h" diff --git a/src/encoding/meson.build b/src/encoding/meson.build new file mode 100644 index 00000000..415600f1 --- /dev/null +++ b/src/encoding/meson.build @@ -0,0 +1,17 @@ +if conf_data.get('CONFIG_BROTLI') + srcs += files('brotli.c') +endif +if conf_data.get('CONFIG_BZIP2') + srcs += files('bzip2.c') +endif +if conf_data.get('CONFIG_GZIP') + srcs += files('deflate.c') +endif +if conf_data.get('CONFIG_LZMA') + srcs += files('lzma.c') +endif +if conf_data.get('CONFIG_ZSTD') + srcs += files('zstd.c') +endif + +srcs += files('encoding.c') diff --git a/src/encoding/zstd.c b/src/encoding/zstd.c index 5db6dcdf..665f8c83 100644 --- a/src/encoding/zstd.c +++ b/src/encoding/zstd.c @@ -10,9 +10,7 @@ #ifdef HAVE_UNISTD_H #include #endif -#ifdef HAVE_ZSTD_H #include -#endif #include #include "elinks.h" diff --git a/src/formhist/meson.build b/src/formhist/meson.build new file mode 100644 index 00000000..aef1e0e9 --- /dev/null +++ b/src/formhist/meson.build @@ -0,0 +1 @@ +srcs += files('formhist.c', 'dialogs.c') diff --git a/src/globhist/meson.build b/src/globhist/meson.build new file mode 100644 index 00000000..b363736f --- /dev/null +++ b/src/globhist/meson.build @@ -0,0 +1 @@ +srcs += files('globhist.c', 'dialogs.c') diff --git a/src/intl/gettext/meson.build b/src/intl/gettext/meson.build new file mode 100644 index 00000000..1ffd2e11 --- /dev/null +++ b/src/intl/gettext/meson.build @@ -0,0 +1,82 @@ +#localedir = $(datadir)/locale +#builddir = $(top_builddir)/src/intl/gettext +#CFLAGS += $(GETTEXT_CFLAGS) + +srcs += files('bindtextdom.c', 'dcgettext.c', 'dcigettext.c', 'dcngettext.c', 'dgettext.c', 'dngettext.c', 'explodename.c', + 'finddomain.c', 'gettext.c', 'intl-compat.c', 'l10nflist.c', 'libintl.c', 'loadmsgcat.c', 'localcharset.c', + 'localealias.c', 'ngettext.c', 'plural.c', 'textdomain.c') + + +# $(builddir)/charset.alias: $(srcdir)config.charset +##$(builddir)/charset.alias: $(srcdir)config.charset +## $(SHELL) $(srcdir)config.charset '$(host)' > $@.new +## mv $@.new $@ + +# FIXME: Building plural.c from plural.y on the fly doesn't work + +##YACC = $(INTLBISON) -y -d +##YFLAGS = --name-prefix=gettext__ +##plural.c: plural.y +##.SUFFIXES: .y .c +##.y.c: +## $(YACC) $(YFLAGS) --output $@ $< +## rm -f $*.h + +##install-local: $(builddir)/charset.alias all +## @if test '$(CONFIG_NLS)' = yes; then \ +## temp=$(DESTDIR)$(libdir)/t-charset.alias; \ +## dest=$(DESTDIR)$(libdir)/charset.alias; \ +## if test -f $(DESTDIR)$(libdir)/charset.alias; then \ +## orig=$(DESTDIR)$(libdir)/charset.alias; \ +## sed -f ref-add.sed $$orig > $$temp; \ +## $(INSTALL_DATA) $$temp $$dest; \ +## rm -f $$temp; \ +## else \ +## if test $(GLIBC21) = no; then \ +## $(MKINSTALLDIRS) $(DESTDIR)$(libdir); \ +## orig=charset.alias; \ +## sed -f ref-add.sed $$orig > $$temp; \ +## $(INSTALL_DATA) $$temp $$dest; \ +## rm -f $$temp; \ +## fi; \ +## fi; \ +## $(MKINSTALLDIRS) $(DESTDIR)$(localedir); \ +## test -f $(DESTDIR)$(localedir)/locale.alias \ +## && orig=$(DESTDIR)$(localedir)/locale.alias \ +## || orig=$(srcdir)locale.alias; \ +## temp=$(DESTDIR)$(localedir)/t-locale.alias; \ +## dest=$(DESTDIR)$(localedir)/locale.alias; \ +## sed -f ref-add.sed $$orig > $$temp; \ +## $(INSTALL_DATA) $$temp $$dest; \ +## rm -f $$temp; \ +## else \ +## : ; \ +## fi + +##uninstall-local: +## @if test '$(CONFIG_NLS)' = yes; then \ +## if test -f $(DESTDIR)$(libdir)/charset.alias; then \ +## temp=$(DESTDIR)$(libdir)/t-charset.alias; \ +## dest=$(DESTDIR)$(libdir)/charset.alias; \ +## sed -f ref-del.sed $$dest > $$temp; \ +## if grep '^# Packages using this file: $$' $$temp > /dev/null; then \ +## rm -f $$dest; \ +## else \ +## $(INSTALL_DATA) $$temp $$dest; \ +## fi; \ +## rm -f $$temp; \ +## fi; \ +## if test -f $(DESTDIR)$(localedir)/locale.alias; then \ +## temp=$(DESTDIR)$(localedir)/t-locale.alias; \ +## dest=$(DESTDIR)$(localedir)/locale.alias; \ +## sed -f ref-del.sed $$dest > $$temp; \ +## if grep '^# Packages using this file: $$' $$temp > /dev/null; then \ +## rm -f $$dest; \ +## else \ +## $(INSTALL_DATA) $$temp $$dest; \ +## fi; \ +## rm -f $$temp; \ +## fi; \ +## else \ +## : ; \ +## fi diff --git a/src/intl/meson.build b/src/intl/meson.build new file mode 100644 index 00000000..d1dd250b --- /dev/null +++ b/src/intl/meson.build @@ -0,0 +1,8 @@ +if conf_data.get('CONFIG_NLS') == 1 + subdir('gettext') +endif +srcs += files('charsets.c') + +if conf_data.get('CONFIG_UTF8') + srcs += files('width.c') +endif diff --git a/src/main/meson.build b/src/main/meson.build new file mode 100644 index 00000000..4c5e8bee --- /dev/null +++ b/src/main/meson.build @@ -0,0 +1,4 @@ +if conf_data.get('CONFIG_INTERLINK') + srcs += files('interlink.c') +endif +srcs += files('event.c', 'main.c', 'module.c', 'select.c', 'timer.c', 'version.c') diff --git a/src/meson.build b/src/meson.build new file mode 100644 index 00000000..2ea78592 --- /dev/null +++ b/src/meson.build @@ -0,0 +1,91 @@ +if conf_data.get('CONFIG_BOOKMARKS') + subdir('bookmarks') +endif +if conf_data.get('CONFIG_COOKIES') + subdir('cookies') +endif +if conf_data.get('CONFIG_DOM') + subdir('dom') +endif +if conf_data.get('CONFIG_ECMASCRIPT') + subdir('ecmascript') +endif +if conf_data.get('CONFIG_FORMHIST') + subdir('formhist') +endif +if conf_data.get('CONFIG_GLOBHIST') + subdir('globhist') +endif +if conf_data.get('CONFIG_SCRIPTING') + subdir('scripting') +endif + +subdir('bfu') +subdir('cache') +subdir('config') +subdir('dialogs') +subdir('document') +subdir('encoding') +subdir('intl') +subdir('main') +subdir('mime') +subdir('network') +subdir('osdep') +subdir('protocol') +subdir('session') +subdir('terminal') +subdir('util') +subdir('viewer') + +# Get the GIT HEAD ID if possible +##ifdef GIT +##GITDESC = $(shell $(GIT) --git-dir=$(top_srcdir)/.git rev-parse HEAD 2>/dev/null) +##WTDIRTY = $(shell cd "$(top_srcdir)" && $(GIT) diff-index HEAD 2>/dev/null) +##BUILD_ID = $(subst elinks-,,$(GITDESC))$(if $(WTDIRTY),-dirty) +##endif +##INCLUDES += -DBUILD_ID="\"$(BUILD_ID)\"" + +srcs += files('vernum.c') + +incs = include_directories('..', '.', '/usr/include/luajit-2.0') + +extra_args = ['-DHAVE_CONFIG_H', '-fno-strict-aliasing', '-Wno-pointer-sign', '-Wno-builtin-declaration-mismatch', '-Wno-address'] + + +##deps= [zdeps, ltredeps, eventdeps, ssldeps, brotlideps, zstddeps, idndeps, x11deps, bz2deps, mozjsdeps, luadeps, xmldeps, libgpm, domdeps] + +#libs = ['-ltre', '-Wl,--as-needed', '-Wl,--no-copy-dt-needed-entries', +# '-Wl,-z,relro', '-Wl,-z,combreloc', '-lX11', '-levent', '-lssl', '-lcrypto', '-ldl', '-lgpm', '-lz', '-lbz2', +# '-lbrotlidec', '-lzstd', '-lidn', '-lexpat', '-lmozjs-17.0'] + +elinks = executable( + 'elinks', srcs, + include_directories: incs, + dependencies: deps, + c_args : extra_args + ) + +##elinks$(EXEEXT): $(LIB_O_NAME) vernum.o +## $(call cmd,link) + +# Place the TAGS file in the source directory so that, if the same +# source is built for different configurations in different build +# directories, one doesn't have to remember which of those build +# directories has the most recent TAGS. +##TAGS: +## cd $(firstword $(srcdir) .) \ +## && find . \( -name "*.[ch]" -o -name "*.inc" \) -print \ +## | etags --regex='{c}/\(?:static \)?INIT_LIST_OF([^,]*,[ \t]*\([[:alnum:]_]+\))/\1/' \ +## --regex='{c}/struct_hierbox_browser(\n[ \t]*\([[:alnum:]_]+\),/\1/m' \ +## --regex='{c}/^ACTION_(\([[:alnum:]_]+\),[^,]*,[ \t]*\([[:alnum:]_]+\),/ACT_\1_\2/' \ +## --language=c - + +##tags: +## cd $(firstword $(srcdir) .) \ +## && find . \( -name "*.[ch]" -o -name "*.inc" \) -print \ +## | ctags -L - + +##.PHONY: TAGS tags + +##PROGS = elinks$(EXEEXT) +##CLEAN = vernum.o TAGS tags diff --git a/src/mime/backend/meson.build b/src/mime/backend/meson.build new file mode 100644 index 00000000..a00f3cc3 --- /dev/null +++ b/src/mime/backend/meson.build @@ -0,0 +1,22 @@ +if conf_data.get('CONFIG_MAILCAP') + srcs += files('mailcap.c') +endif +if conf_data.get('CONFIG_MIMETYPES') + srcs += files('mimetypes.c') +endif + +srcs += files('common.c', 'default.c') + +##TEST_PROGS = \ +## mailcap-cache$(EXEEXT) + +# The dependencies are a bit funny here! I don't know why. Just remember to +# make clean before making the test. --jonas +##mailcap-cache.o: $(top_srcdir)/src/mime/backend/mailcap.c +## $(call cmd,compile,-DTEST_MAILCAP) + +##TESTDEPS = \ +## common.o \ +## $(top_builddir)/src/osdep/osdep.o + +##TESTDEPS-$(CONFIG_NLS) += $(top_builddir)/src/intl/gettext/lib.o diff --git a/src/mime/meson.build b/src/mime/meson.build new file mode 100644 index 00000000..becbc168 --- /dev/null +++ b/src/mime/meson.build @@ -0,0 +1,2 @@ +subdir('backend') +srcs += files('dialogs.c', 'mime.c') diff --git a/src/network/meson.build b/src/network/meson.build new file mode 100644 index 00000000..f0a854d4 --- /dev/null +++ b/src/network/meson.build @@ -0,0 +1,4 @@ +if conf_data.get('CONFIG_SSL') + subdir('ssl') +endif +srcs += files('connection.c', 'dns.c', 'progress.c', 'socket.c', 'state.c') diff --git a/src/network/ssl/meson.build b/src/network/ssl/meson.build new file mode 100644 index 00000000..9453506d --- /dev/null +++ b/src/network/ssl/meson.build @@ -0,0 +1,4 @@ +#INCLUDES += $(GNUTLS_CFLAGS) $(OPENSSL_CFLAGS) $(LIBGCRYPT_CFLAGS) + +#SUBDIRS = test +srcs += files('match-hostname.c', 'ssl.c', 'socket.c') diff --git a/src/osdep/beos/meson.build b/src/osdep/beos/meson.build new file mode 100644 index 00000000..75d70091 --- /dev/null +++ b/src/osdep/beos/meson.build @@ -0,0 +1 @@ +srcs += files('beos.c', 'overrides.c') diff --git a/src/osdep/meson.build b/src/osdep/meson.build new file mode 100644 index 00000000..5b7087da --- /dev/null +++ b/src/osdep/meson.build @@ -0,0 +1,19 @@ +#INCLUDES += $(X_CFLAGS) + +if conf_data.get('CONFIG_OS_BEOS') + subdir('beos') +endif +if conf_data.get('CONFIG_OS_OS2') + subdir('os2') +endif +if conf_data.get('CONFIG_OS_RISCOS') + subdir('riscos') +endif +if conf_data.get('CONFIG_OS_UNIX') == 1 + subdir('unix') +endif +if conf_data.get('CONFIG_OS_WIN32') + subdir('win32') +endif + +srcs += files('getifaddrs.c', 'newwin.c', 'osdep.c', 'signals.c', 'stub.c', 'sysname.c') diff --git a/src/osdep/os2/meson.build b/src/osdep/os2/meson.build new file mode 100644 index 00000000..53ec6ccc --- /dev/null +++ b/src/osdep/os2/meson.build @@ -0,0 +1 @@ +srcs += files('os2.c') diff --git a/src/osdep/riscos/meson.build b/src/osdep/riscos/meson.build new file mode 100644 index 00000000..a6d316ae --- /dev/null +++ b/src/osdep/riscos/meson.build @@ -0,0 +1 @@ +srcs += files('riscos.c') diff --git a/src/osdep/unix/meson.build b/src/osdep/unix/meson.build new file mode 100644 index 00000000..c761cea6 --- /dev/null +++ b/src/osdep/unix/meson.build @@ -0,0 +1 @@ +srcs += files('unix.c', 'bsd.c') diff --git a/src/osdep/win32/meson.build b/src/osdep/win32/meson.build new file mode 100644 index 00000000..97b72bf8 --- /dev/null +++ b/src/osdep/win32/meson.build @@ -0,0 +1 @@ +srcs += files('overrides.c', 'vt100.c', 'win32.c') diff --git a/src/protocol/auth/meson.build b/src/protocol/auth/meson.build new file mode 100644 index 00000000..e29faaf2 --- /dev/null +++ b/src/protocol/auth/meson.build @@ -0,0 +1,3 @@ +#INCLUDES += $(GNUTLS_CFLAGS) $(OPENSSL_CFLAGS) + +srcs += files('auth.c', 'dialogs.c', 'digest.c') diff --git a/src/protocol/bittorrent/meson.build b/src/protocol/bittorrent/meson.build new file mode 100644 index 00000000..3a805574 --- /dev/null +++ b/src/protocol/bittorrent/meson.build @@ -0,0 +1,4 @@ +#INCLUDES += $(GNUTLS_CFLAGS) $(OPENSSL_CFLAGS) + +srcs += files('bencoding.c', 'bittorrent.c', 'common.c', 'connection.c', 'dialogs.c', 'peerconnect.c', + 'peerwire.c', 'piececache.c', 'tracker.c') diff --git a/src/protocol/file/meson.build b/src/protocol/file/meson.build new file mode 100644 index 00000000..8fdf0054 --- /dev/null +++ b/src/protocol/file/meson.build @@ -0,0 +1,4 @@ +if conf_data.get('CONFIG_CGI') + srcs += files('cgi.c') +endif +srcs += files('file.c', 'mailcap.c') diff --git a/src/protocol/finger/meson.build b/src/protocol/finger/meson.build new file mode 100644 index 00000000..4c5bdb36 --- /dev/null +++ b/src/protocol/finger/meson.build @@ -0,0 +1 @@ +srcs += files('finger.c') diff --git a/src/protocol/fsp/meson.build b/src/protocol/fsp/meson.build new file mode 100644 index 00000000..d9c60d9f --- /dev/null +++ b/src/protocol/fsp/meson.build @@ -0,0 +1 @@ +srcs += files('fsp.c') diff --git a/src/protocol/ftp/meson.build b/src/protocol/ftp/meson.build new file mode 100644 index 00000000..a1243553 --- /dev/null +++ b/src/protocol/ftp/meson.build @@ -0,0 +1,8 @@ +srcs += files('ftp.c', 'parse.c') + +#TEST_PROGS = \ +# ftp-parser$(EXEEXT) + +#TESTDEPS = \ +# $(top_builddir)/src/protocol/date.o \ +# $(top_builddir)/src/protocol/ftp/parse.o diff --git a/src/protocol/gopher/meson.build b/src/protocol/gopher/meson.build new file mode 100644 index 00000000..a6e1c67e --- /dev/null +++ b/src/protocol/gopher/meson.build @@ -0,0 +1 @@ +srcs += files('gopher.c') diff --git a/src/protocol/http/meson.build b/src/protocol/http/meson.build new file mode 100644 index 00000000..fd75c077 --- /dev/null +++ b/src/protocol/http/meson.build @@ -0,0 +1,4 @@ +if conf_data.get('CONFIG_GSSAPI') + srcs += files('http_negotiate.c') +endif +srcs += files('blacklist.c', 'codes.c', 'http.c', 'post.c') diff --git a/src/protocol/meson.build b/src/protocol/meson.build new file mode 100644 index 00000000..cf433bda --- /dev/null +++ b/src/protocol/meson.build @@ -0,0 +1,32 @@ +if conf_data.get('CONFIG_BITTORRENT') == 1 + subdir('bittorrent') +endif +if conf_data.get('CONFIG_FINGER') + subdir('finger') +endif +if conf_data.get('CONFIG_FSP') + subdir('fsp') +endif +if conf_data.get('CONFIG_FTP') + subdir('ftp') +endif +if conf_data.get('CONFIG_GOPHER') + subdir('gopher') +endif +if conf_data.get('CONFIG_NNTP') + subdir('nntp') +endif +if conf_data.get('CONFIG_SMB') + subdir('smb') +endif +if conf_data.get('CONFIG_URI_REWRITE') + subdir('rewrite') +endif +subdir('auth') +subdir('file') +subdir('http') + +if conf_data.get('CONFIG_DATA') + srcs += files('data.c') +endif +srcs += files('about.c', 'common.c', 'date.c', 'header.c', 'protocol.c', 'proxy.c', 'uri.c', 'user.c') diff --git a/src/protocol/nntp/meson.build b/src/protocol/nntp/meson.build new file mode 100644 index 00000000..75b8e254 --- /dev/null +++ b/src/protocol/nntp/meson.build @@ -0,0 +1 @@ +srcs += files('nntp.c', 'connection.c', 'response.c') diff --git a/src/protocol/rewrite/meson.build b/src/protocol/rewrite/meson.build new file mode 100644 index 00000000..347f5d64 --- /dev/null +++ b/src/protocol/rewrite/meson.build @@ -0,0 +1 @@ +srcs += files('rewrite.c') diff --git a/src/protocol/smb/meson.build b/src/protocol/smb/meson.build new file mode 100644 index 00000000..87b21d50 --- /dev/null +++ b/src/protocol/smb/meson.build @@ -0,0 +1 @@ +srcs += files('smb2.c') diff --git a/src/scripting/guile/meson.build b/src/scripting/guile/meson.build new file mode 100644 index 00000000..5d2854b8 --- /dev/null +++ b/src/scripting/guile/meson.build @@ -0,0 +1,2 @@ +#INCLUDES += $(GUILE_CFLAGS) +srcs += files('guile.c', 'hooks.c', 'core.c') diff --git a/src/scripting/lua/meson.build b/src/scripting/lua/meson.build new file mode 100644 index 00000000..a83fb693 --- /dev/null +++ b/src/scripting/lua/meson.build @@ -0,0 +1,2 @@ +#INCLUDES += $(LUA_CFLAGS) +srcs += files('lua.c', 'hooks.c', 'core.c') diff --git a/src/scripting/meson.build b/src/scripting/meson.build new file mode 100644 index 00000000..36e5b13c --- /dev/null +++ b/src/scripting/meson.build @@ -0,0 +1,19 @@ +if conf_data.get('CONFIG_SCRIPTING_GUILE') + subdir('guile') +endif +if conf_data.get('CONFIG_SCRIPTING_LUA') + subdir('lua') +endif +if conf_data.get('CONFIG_SCRIPTING_PERL') + subdir('perl') +endif +if conf_data.get('CONFIG_SCRIPTING_PYTHON') + subdir('python') +endif +if conf_data.get('CONFIG_SCRIPTING_RUBY') + subdir('ruby') +endif +if conf_data.get('CONFIG_SCRIPTING_SPIDERMONKEY') + subdir('smjs') +endif +srcs += files('scripting.c') diff --git a/src/scripting/perl/meson.build b/src/scripting/perl/meson.build new file mode 100644 index 00000000..61fe456b --- /dev/null +++ b/src/scripting/perl/meson.build @@ -0,0 +1,3 @@ +#INCLUDES += $(PERL_CFLAGS) + +srcs += files('perl.c', 'hooks.c', 'core.c') diff --git a/src/scripting/python/meson.build b/src/scripting/python/meson.build new file mode 100644 index 00000000..d594deee --- /dev/null +++ b/src/scripting/python/meson.build @@ -0,0 +1,3 @@ +#INCLUDES += $(PYTHON_CFLAGS) + +srcs += files('core.c', 'dialogs.c', 'document.c', 'hooks.c', 'keybinding.c', 'load.c', 'menu.c', 'open.c', 'python.c') diff --git a/src/scripting/ruby/meson.build b/src/scripting/ruby/meson.build new file mode 100644 index 00000000..00ad93ef --- /dev/null +++ b/src/scripting/ruby/meson.build @@ -0,0 +1,2 @@ +#INCLUDES += $(RUBY_CFLAGS) +srcs += files('ruby.c', 'hooks.c', 'core.c') diff --git a/src/scripting/smjs/meson.build b/src/scripting/smjs/meson.build new file mode 100644 index 00000000..59cc7c1a --- /dev/null +++ b/src/scripting/smjs/meson.build @@ -0,0 +1,5 @@ +#INCLUDES += $(SPIDERMONKEY_CFLAGS) + +srcs += files('smjs.c', 'core.c', 'global_object.c', 'hooks.c', 'elinks_object.c', 'cache_object.c', + 'view_state_object.c', 'action_object.c', 'bookmarks.c', 'globhist.c', 'keybinding.c', 'load_uri.c', + 'session_object.c', 'terminal_object.c') diff --git a/src/session/meson.build b/src/session/meson.build new file mode 100644 index 00000000..30b97669 --- /dev/null +++ b/src/session/meson.build @@ -0,0 +1 @@ +srcs += files('download.c', 'history.c', 'location.c', 'session.c', 'task.c') diff --git a/src/terminal/meson.build b/src/terminal/meson.build new file mode 100644 index 00000000..093d751d --- /dev/null +++ b/src/terminal/meson.build @@ -0,0 +1,7 @@ +if conf_data.get('CONFIG_MOUSE') + srcs += files('mouse.c') +endif +if conf_data.get('CONFIG_TERMINFO') + srcs += files('terminfo.c') +endif +srcs += files('color.c', 'draw.c', 'event.c', 'hardio.c', 'kbd.c', 'screen.c', 'tab.c', 'terminal.c', 'window.c') diff --git a/src/util/meson.build b/src/util/meson.build new file mode 100644 index 00000000..ccd1c0d3 --- /dev/null +++ b/src/util/meson.build @@ -0,0 +1,25 @@ +#INCLUDES += $(GNUTLS_CFLAGS) $(OPENSSL_CFLAGS) + +if not conf_data.get('CONFIG_SMALL') + srcs += files('fastfind.c') +endif +if conf_data.get('CONFIG_CSS') == 1 + srcs += files('scanner.c') +endif +if conf_data.get('CONFIG_DEBUG') + srcs += files('memdebug.c') +endif +if conf_data.get('CONFIG_DOM') + srcs += files('scanner.c') +endif +if conf_data.get('CONFIG_OWN_LIBC') or (not conf_data.get('CONFIG_GNUTLS_OPENSSL_COMPAT') and not conf_data.get('CONFIG_OPENSSL')) + srcs += files('md5.c') +endif +if conf_data.get('CONFIG_BITTORRENT') == 1 + if conf_data.get('CONFIG_OWN_LIBC') or not conf_data.get('CONFIG_OPENSSL') + srcs += files('sha1.c') + endif +endif + +srcs += files('base64.c', 'color.c', 'conv.c', 'env.c', 'error.c', 'file.c', 'hash.c', + 'memlist.c', 'memory.c', 'random.c', 'secsave.c', 'snprintf.c', 'string.c', 'time.c') diff --git a/src/viewer/dump/meson.build b/src/viewer/dump/meson.build new file mode 100644 index 00000000..f0167c5e --- /dev/null +++ b/src/viewer/dump/meson.build @@ -0,0 +1 @@ +srcs += files('dump.c') diff --git a/src/viewer/meson.build b/src/viewer/meson.build new file mode 100644 index 00000000..c74665a5 --- /dev/null +++ b/src/viewer/meson.build @@ -0,0 +1,3 @@ +subdir('dump') +subdir('text') +srcs += files('action.c', 'timer.c', 'viewer.c') diff --git a/src/viewer/text/meson.build b/src/viewer/text/meson.build new file mode 100644 index 00000000..effeb0c8 --- /dev/null +++ b/src/viewer/text/meson.build @@ -0,0 +1,7 @@ +#INCLUDES += $(TRE_CFLAGS) + +if conf_data.get('CONFIG_MARKS') + srcs += files('marks.c') +endif + +srcs += files('draw.c', 'form.c', 'link.c', 'search.c', 'textarea.c', 'view.c', 'vs.c') From 08e31072439ffedce7799813188a001092b39b65 Mon Sep 17 00:00:00 2001 From: Witold Filipczyk Date: Sun, 6 Sep 2020 11:30:57 +0200 Subject: [PATCH 027/179] [meson] Do not hardcode path luajit --- src/meson.build | 44 ++------------------------------------------ 1 file changed, 2 insertions(+), 42 deletions(-) diff --git a/src/meson.build b/src/meson.build index 2ea78592..ff2893ca 100644 --- a/src/meson.build +++ b/src/meson.build @@ -37,55 +37,15 @@ subdir('terminal') subdir('util') subdir('viewer') -# Get the GIT HEAD ID if possible -##ifdef GIT -##GITDESC = $(shell $(GIT) --git-dir=$(top_srcdir)/.git rev-parse HEAD 2>/dev/null) -##WTDIRTY = $(shell cd "$(top_srcdir)" && $(GIT) diff-index HEAD 2>/dev/null) -##BUILD_ID = $(subst elinks-,,$(GITDESC))$(if $(WTDIRTY),-dirty) -##endif -##INCLUDES += -DBUILD_ID="\"$(BUILD_ID)\"" - srcs += files('vernum.c') -incs = include_directories('..', '.', '/usr/include/luajit-2.0') +incs = include_directories('..', '.') extra_args = ['-DHAVE_CONFIG_H', '-fno-strict-aliasing', '-Wno-pointer-sign', '-Wno-builtin-declaration-mismatch', '-Wno-address'] - -##deps= [zdeps, ltredeps, eventdeps, ssldeps, brotlideps, zstddeps, idndeps, x11deps, bz2deps, mozjsdeps, luadeps, xmldeps, libgpm, domdeps] - -#libs = ['-ltre', '-Wl,--as-needed', '-Wl,--no-copy-dt-needed-entries', -# '-Wl,-z,relro', '-Wl,-z,combreloc', '-lX11', '-levent', '-lssl', '-lcrypto', '-ldl', '-lgpm', '-lz', '-lbz2', -# '-lbrotlidec', '-lzstd', '-lidn', '-lexpat', '-lmozjs-17.0'] - elinks = executable( 'elinks', srcs, include_directories: incs, dependencies: deps, c_args : extra_args - ) - -##elinks$(EXEEXT): $(LIB_O_NAME) vernum.o -## $(call cmd,link) - -# Place the TAGS file in the source directory so that, if the same -# source is built for different configurations in different build -# directories, one doesn't have to remember which of those build -# directories has the most recent TAGS. -##TAGS: -## cd $(firstword $(srcdir) .) \ -## && find . \( -name "*.[ch]" -o -name "*.inc" \) -print \ -## | etags --regex='{c}/\(?:static \)?INIT_LIST_OF([^,]*,[ \t]*\([[:alnum:]_]+\))/\1/' \ -## --regex='{c}/struct_hierbox_browser(\n[ \t]*\([[:alnum:]_]+\),/\1/m' \ -## --regex='{c}/^ACTION_(\([[:alnum:]_]+\),[^,]*,[ \t]*\([[:alnum:]_]+\),/ACT_\1_\2/' \ -## --language=c - - -##tags: -## cd $(firstword $(srcdir) .) \ -## && find . \( -name "*.[ch]" -o -name "*.inc" \) -print \ -## | ctags -L - - -##.PHONY: TAGS tags - -##PROGS = elinks$(EXEEXT) -##CLEAN = vernum.o TAGS tags +) From a87c959e998034b9cdee170fc0518adaec434dd0 Mon Sep 17 00:00:00 2001 From: Witold Filipczyk Date: Sun, 6 Sep 2020 16:54:23 +0200 Subject: [PATCH 028/179] [meson] Added po/LINGUAS and po/POTFILES --- meson.build | 1 + po/LINGUAS | 1 + po/POTFILES | 631 +++++++++++++++++++++++++++++++++++++++++++++++++ po/meson.build | 8 + 4 files changed, 641 insertions(+) create mode 100644 po/LINGUAS create mode 100644 po/POTFILES create mode 100644 po/meson.build diff --git a/meson.build b/meson.build index 3487032a..daf929e8 100644 --- a/meson.build +++ b/meson.build @@ -748,4 +748,5 @@ configure_file(input : 'config2.h.in', output : 'config.h', configuration : conf_data) +subdir('po') subdir('src') diff --git a/po/LINGUAS b/po/LINGUAS new file mode 100644 index 00000000..1f4a1145 --- /dev/null +++ b/po/LINGUAS @@ -0,0 +1 @@ +af be bg ca cs da de el es et fi fr gl hr hu id is it ja lt nb nl pl pt_BR pt ro ru sk sr sv tr uk diff --git a/po/POTFILES b/po/POTFILES new file mode 100644 index 00000000..4006788f --- /dev/null +++ b/po/POTFILES @@ -0,0 +1,631 @@ +src/bfu/button.c +src/bfu/button.h +src/bfu/checkbox.c +src/bfu/checkbox.h +src/bfu/common.h +src/bfu/dialog.c +src/bfu/dialog.h +src/bfu/group.c +src/bfu/group.h +src/bfu/hierbox.c +src/bfu/hierbox.h +src/bfu/hotkey.c +src/bfu/hotkey.h +src/bfu/inpfield.c +src/bfu/inpfield.h +src/bfu/inphist.c +src/bfu/inphist.h +src/bfu/leds.c +src/bfu/leds.h +src/bfu/listbox.c +src/bfu/listbox.h +src/bfu/listmenu.c +src/bfu/listmenu.h +src/bfu/menu.c +src/bfu/menu.h +src/bfu/msgbox.c +src/bfu/msgbox.h +src/bfu/style.c +src/bfu/style.h +src/bfu/text.c +src/bfu/text.h +src/bfu/widget.c +src/bfu/widget.h +src/bookmarks/backend/common.c +src/bookmarks/backend/common.h +src/bookmarks/backend/default.c +src/bookmarks/backend/default.h +src/bookmarks/backend/xbel.c +src/bookmarks/backend/xbel.h +src/bookmarks/bookmarks.c +src/bookmarks/bookmarks.h +src/bookmarks/dialogs.c +src/bookmarks/dialogs.h +src/cache/cache.c +src/cache/cache.h +src/cache/dialogs.c +src/cache/dialogs.h +src/config/actions-edit.inc +src/config/actions-main.inc +src/config/actions-menu.inc +src/config/cmdline.c +src/config/cmdline.h +src/config/conf.c +src/config/conf.h +src/config/dialogs.c +src/config/dialogs.h +src/config/domain.c +src/config/domain.h +src/config/home.c +src/config/home.h +src/config/kbdbind.c +src/config/kbdbind.h +src/config/options.c +src/config/options.h +src/config/options.inc +src/config/opttypes.c +src/config/opttypes.h +src/config/timer.c +src/config/timer.h +src/config/urlhist.c +src/config/urlhist.h +src/cookies/cookies-t.c +src/cookies/cookies.c +src/cookies/cookies.h +src/cookies/dialogs.c +src/cookies/dialogs.h +src/cookies/parser.c +src/cookies/parser.h +src/cookies/parsetst.c +src/cookies/path.c +src/cookies/path.h +src/dialogs/document.c +src/dialogs/document.h +src/dialogs/download.c +src/dialogs/download.h +src/dialogs/edit.c +src/dialogs/edit.h +src/dialogs/exmode.c +src/dialogs/exmode.h +src/dialogs/info.c +src/dialogs/info.h +src/dialogs/menu.c +src/dialogs/menu.h +src/dialogs/options.c +src/dialogs/options.h +src/dialogs/progress.c +src/dialogs/progress.h +src/dialogs/status.c +src/dialogs/status.h +src/document/css/apply.c +src/document/css/apply.h +src/document/css/css.c +src/document/css/css.h +src/document/css/parser.c +src/document/css/parser.h +src/document/css/property.c +src/document/css/property.h +src/document/css/scanner.c +src/document/css/scanner.h +src/document/css/stylesheet.c +src/document/css/stylesheet.h +src/document/css/value.c +src/document/css/value.h +src/document/docdata.c +src/document/docdata.h +src/document/document.c +src/document/document.h +src/document/dom/renderer.c +src/document/dom/renderer.h +src/document/dom/rss.c +src/document/dom/rss.h +src/document/dom/source.c +src/document/dom/source.h +src/document/dom/util.c +src/document/dom/util.h +src/document/format.c +src/document/format.h +src/document/forms.c +src/document/forms.h +src/document/html/frames.c +src/document/html/frames.h +src/document/html/internal.h +src/document/html/parse-meta-refresh.c +src/document/html/parse-meta-refresh.h +src/document/html/parser.c +src/document/html/parser.h +src/document/html/parser/forms.c +src/document/html/parser/forms.h +src/document/html/parser/general.c +src/document/html/parser/general.h +src/document/html/parser/link.c +src/document/html/parser/link.h +src/document/html/parser/parse.c +src/document/html/parser/parse.h +src/document/html/parser/stack.c +src/document/html/parser/stack.h +src/document/html/parser/table.c +src/document/html/parser/table.h +src/document/html/renderer.c +src/document/html/renderer.h +src/document/html/tables.c +src/document/html/tables.h +src/document/html/test/parse-meta-refresh-test.c +src/document/html/test/test-parse-meta-refresh +src/document/libdom/renderer.c +src/document/libdom/renderer.h +src/document/options.c +src/document/options.h +src/document/plain/renderer.c +src/document/plain/renderer.h +src/document/refresh.c +src/document/refresh.h +src/document/renderer.c +src/document/renderer.h +src/document/view.h +src/dom/code.h +src/dom/configuration.c +src/dom/configuration.h +src/dom/css/scanner.c +src/dom/css/scanner.h +src/dom/node.c +src/dom/node.h +src/dom/scanner.c +src/dom/scanner.h +src/dom/select.c +src/dom/select.h +src/dom/sgml/docbook/attribute.inc +src/dom/sgml/docbook/docbook.c +src/dom/sgml/docbook/docbook.h +src/dom/sgml/docbook/element.inc +src/dom/sgml/dump.c +src/dom/sgml/dump.h +src/dom/sgml/html/attribute.inc +src/dom/sgml/html/element.inc +src/dom/sgml/html/html.c +src/dom/sgml/html/html.h +src/dom/sgml/parser.c +src/dom/sgml/parser.h +src/dom/sgml/rss/attribute.inc +src/dom/sgml/rss/element.inc +src/dom/sgml/rss/rss.c +src/dom/sgml/rss/rss.h +src/dom/sgml/scanner.c +src/dom/sgml/scanner.h +src/dom/sgml/sgml.c +src/dom/sgml/sgml.h +src/dom/sgml/xbel/attribute.inc +src/dom/sgml/xbel/element.inc +src/dom/sgml/xbel/xbel.c +src/dom/sgml/xbel/xbel.h +src/dom/stack.c +src/dom/stack.h +src/dom/string.h +src/dom/test/dom-select.c +src/dom/test/html-mangle.c +src/dom/test/sgml-parser.c +src/dom/test/test-dom-configuration-basic +src/dom/test/test-sgml-dump-basic +src/dom/test/test-sgml-parser-basic +src/ecmascript/ecmascript.c +src/ecmascript/ecmascript.h +src/ecmascript/spidermonkey-shared.c +src/ecmascript/spidermonkey-shared.h +src/ecmascript/spidermonkey.c +src/ecmascript/spidermonkey.h +src/ecmascript/spidermonkey/document.c +src/ecmascript/spidermonkey/document.h +src/ecmascript/spidermonkey/form.c +src/ecmascript/spidermonkey/form.h +src/ecmascript/spidermonkey/heartbeat.c +src/ecmascript/spidermonkey/heartbeat.h +src/ecmascript/spidermonkey/location.c +src/ecmascript/spidermonkey/location.h +src/ecmascript/spidermonkey/navigator.c +src/ecmascript/spidermonkey/navigator.h +src/ecmascript/spidermonkey/unibar.c +src/ecmascript/spidermonkey/unibar.h +src/ecmascript/spidermonkey/util.h +src/ecmascript/spidermonkey/window.c +src/ecmascript/spidermonkey/window.h +src/elinks.h +src/encoding/brotli.c +src/encoding/brotli.h +src/encoding/bzip2.c +src/encoding/bzip2.h +src/encoding/deflate.c +src/encoding/deflate.h +src/encoding/encoding.c +src/encoding/encoding.h +src/encoding/lzma.c +src/encoding/lzma.h +src/encoding/zstd.c +src/encoding/zstd.h +src/formhist/dialogs.c +src/formhist/dialogs.h +src/formhist/formhist.c +src/formhist/formhist.h +src/globhist/dialogs.c +src/globhist/dialogs.h +src/globhist/globhist.c +src/globhist/globhist.h +src/intl/charsets.c +src/intl/charsets.h +src/intl/codepage.inc +src/intl/entity.inc +src/intl/gettext/bindtextdom.c +src/intl/gettext/dcgettext.c +src/intl/gettext/dcigettext.c +src/intl/gettext/dcngettext.c +src/intl/gettext/dgettext.c +src/intl/gettext/dngettext.c +src/intl/gettext/explodename.c +src/intl/gettext/finddomain.c +src/intl/gettext/gettext.c +src/intl/gettext/gettext.h +src/intl/gettext/gettextP.h +src/intl/gettext/hash-string.h +src/intl/gettext/intl-compat.c +src/intl/gettext/l10nflist.c +src/intl/gettext/libgettext.h +src/intl/gettext/libgnuintl.h +src/intl/gettext/libintl.c +src/intl/gettext/libintl.h +src/intl/gettext/loadinfo.h +src/intl/gettext/loadmsgcat.c +src/intl/gettext/localcharset.c +src/intl/gettext/localealias.c +src/intl/gettext/ngettext.c +src/intl/gettext/plural.c +src/intl/gettext/textdomain.c +src/intl/test/utf8-step-test.c +src/intl/uni_7b.inc +src/intl/width.c +src/main/event.c +src/main/event.h +src/main/interlink.c +src/main/interlink.h +src/main/main.c +src/main/main.h +src/main/module.c +src/main/module.h +src/main/object.h +src/main/select.c +src/main/select.h +src/main/timer.c +src/main/timer.h +src/main/version.c +src/main/version.h +src/mime/backend/common.c +src/mime/backend/common.h +src/mime/backend/default.c +src/mime/backend/default.h +src/mime/backend/mailcap.c +src/mime/backend/mailcap.h +src/mime/backend/mimetypes.c +src/mime/backend/mimetypes.h +src/mime/dialogs.c +src/mime/dialogs.h +src/mime/mime.c +src/mime/mime.h +src/network/connection.c +src/network/connection.h +src/network/dns.c +src/network/dns.h +src/network/progress.c +src/network/progress.h +src/network/socket.c +src/network/socket.h +src/network/ssl/match-hostname.c +src/network/ssl/match-hostname.h +src/network/ssl/socket.c +src/network/ssl/socket.h +src/network/ssl/ssl.c +src/network/ssl/ssl.h +src/network/ssl/test/match-hostname-test.c +src/network/state.c +src/network/state.h +src/osdep/ascii.h +src/osdep/beos/beos.c +src/osdep/beos/beos.h +src/osdep/beos/overrides.c +src/osdep/beos/overrides.h +src/osdep/beos/sysinfo.h +src/osdep/generic.h +src/osdep/getifaddrs.c +src/osdep/getifaddrs.h +src/osdep/newwin.c +src/osdep/newwin.h +src/osdep/os2/os2.c +src/osdep/os2/os2.h +src/osdep/os2/sysinfo.h +src/osdep/osdep.c +src/osdep/osdep.h +src/osdep/riscos/riscos.c +src/osdep/riscos/riscos.h +src/osdep/riscos/sysinfo.h +src/osdep/signals.c +src/osdep/signals.h +src/osdep/stat.h +src/osdep/stub.c +src/osdep/stub.h +src/osdep/sysname.c +src/osdep/sysname.h +src/osdep/system.h +src/osdep/types.h +src/osdep/unix/bsd.c +src/osdep/unix/sysinfo.h +src/osdep/unix/unix.c +src/osdep/unix/unix.h +src/osdep/win32/overrides.c +src/osdep/win32/overrides.h +src/osdep/win32/sysinfo.h +src/osdep/win32/vt100.c +src/osdep/win32/vt100.h +src/osdep/win32/win32.c +src/osdep/win32/win32.h +src/protocol/about.c +src/protocol/about.h +src/protocol/auth/auth.c +src/protocol/auth/auth.h +src/protocol/auth/dialogs.c +src/protocol/auth/dialogs.h +src/protocol/auth/digest.c +src/protocol/auth/digest.h +src/protocol/bittorrent/bencoding.c +src/protocol/bittorrent/bencoding.h +src/protocol/bittorrent/bittorrent.c +src/protocol/bittorrent/bittorrent.h +src/protocol/bittorrent/common.c +src/protocol/bittorrent/common.h +src/protocol/bittorrent/connection.c +src/protocol/bittorrent/connection.h +src/protocol/bittorrent/dialogs.c +src/protocol/bittorrent/dialogs.h +src/protocol/bittorrent/peerconnect.c +src/protocol/bittorrent/peerconnect.h +src/protocol/bittorrent/peerwire.c +src/protocol/bittorrent/peerwire.h +src/protocol/bittorrent/piececache.c +src/protocol/bittorrent/piececache.h +src/protocol/bittorrent/tracker.c +src/protocol/bittorrent/tracker.h +src/protocol/common.c +src/protocol/common.h +src/protocol/data.c +src/protocol/data.h +src/protocol/date.c +src/protocol/date.h +src/protocol/file/cgi.c +src/protocol/file/cgi.h +src/protocol/file/file.c +src/protocol/file/file.h +src/protocol/file/mailcap.c +src/protocol/file/mailcap.h +src/protocol/finger/finger.c +src/protocol/finger/finger.h +src/protocol/fsp/fsp.c +src/protocol/fsp/fsp.h +src/protocol/ftp/ftp-parser.c +src/protocol/ftp/ftp.c +src/protocol/ftp/ftp.h +src/protocol/ftp/parse.c +src/protocol/ftp/parse.h +src/protocol/gopher/gopher.c +src/protocol/gopher/gopher.h +src/protocol/header.c +src/protocol/header.h +src/protocol/http/blacklist.c +src/protocol/http/blacklist.h +src/protocol/http/codes.c +src/protocol/http/codes.h +src/protocol/http/http.c +src/protocol/http/http.h +src/protocol/http/http_negotiate.c +src/protocol/http/http_negotiate.h +src/protocol/http/post.c +src/protocol/http/post.h +src/protocol/nntp/codes.h +src/protocol/nntp/connection.c +src/protocol/nntp/connection.h +src/protocol/nntp/nntp.c +src/protocol/nntp/nntp.h +src/protocol/nntp/response.c +src/protocol/nntp/response.h +src/protocol/protocol.c +src/protocol/protocol.h +src/protocol/proxy.c +src/protocol/proxy.h +src/protocol/rewrite/rewrite.c +src/protocol/rewrite/rewrite.h +src/protocol/smb/smb.h +src/protocol/smb/smb2.c +src/protocol/test/stub.c +src/protocol/test/uri-test.c +src/protocol/uri.c +src/protocol/uri.h +src/protocol/user.c +src/protocol/user.h +src/scripting/guile/core.c +src/scripting/guile/core.h +src/scripting/guile/guile.c +src/scripting/guile/guile.h +src/scripting/guile/hooks.c +src/scripting/guile/hooks.h +src/scripting/lua/core.c +src/scripting/lua/core.h +src/scripting/lua/hooks.c +src/scripting/lua/hooks.h +src/scripting/lua/lua.c +src/scripting/lua/lua.h +src/scripting/perl/core.c +src/scripting/perl/core.h +src/scripting/perl/hooks.c +src/scripting/perl/hooks.h +src/scripting/perl/perl.c +src/scripting/perl/perl.h +src/scripting/python/core.c +src/scripting/python/core.h +src/scripting/python/dialogs.c +src/scripting/python/dialogs.h +src/scripting/python/document.c +src/scripting/python/document.h +src/scripting/python/hooks.c +src/scripting/python/hooks.h +src/scripting/python/keybinding.c +src/scripting/python/keybinding.h +src/scripting/python/load.c +src/scripting/python/load.h +src/scripting/python/menu.c +src/scripting/python/menu.h +src/scripting/python/open.c +src/scripting/python/open.h +src/scripting/python/python.c +src/scripting/python/python.h +src/scripting/ruby/core.c +src/scripting/ruby/core.h +src/scripting/ruby/hooks.c +src/scripting/ruby/hooks.h +src/scripting/ruby/ruby.c +src/scripting/ruby/ruby.h +src/scripting/scripting.c +src/scripting/scripting.h +src/scripting/smjs/action_object.c +src/scripting/smjs/action_object.h +src/scripting/smjs/bookmarks.c +src/scripting/smjs/bookmarks.h +src/scripting/smjs/cache_object.c +src/scripting/smjs/cache_object.h +src/scripting/smjs/core.c +src/scripting/smjs/core.h +src/scripting/smjs/elinks_object.c +src/scripting/smjs/elinks_object.h +src/scripting/smjs/global_object.c +src/scripting/smjs/global_object.h +src/scripting/smjs/globhist.c +src/scripting/smjs/globhist.h +src/scripting/smjs/hooks.c +src/scripting/smjs/hooks.h +src/scripting/smjs/keybinding.c +src/scripting/smjs/keybinding.h +src/scripting/smjs/load_uri.c +src/scripting/smjs/load_uri.h +src/scripting/smjs/session_object.c +src/scripting/smjs/session_object.h +src/scripting/smjs/smjs.c +src/scripting/smjs/smjs.h +src/scripting/smjs/terminal_object.c +src/scripting/smjs/terminal_object.h +src/scripting/smjs/view_state_object.c +src/scripting/smjs/view_state_object.h +src/session/download.c +src/session/download.h +src/session/history.c +src/session/history.h +src/session/location.c +src/session/location.h +src/session/session.c +src/session/session.h +src/session/task.c +src/session/task.h +src/setup.h +src/terminal/color.c +src/terminal/color.h +src/terminal/draw.c +src/terminal/draw.h +src/terminal/event.c +src/terminal/event.h +src/terminal/hardio.c +src/terminal/hardio.h +src/terminal/itrm.h +src/terminal/kbd.c +src/terminal/kbd.h +src/terminal/key.inc +src/terminal/mouse.c +src/terminal/mouse.h +src/terminal/palette.inc +src/terminal/screen.c +src/terminal/screen.h +src/terminal/tab.c +src/terminal/tab.h +src/terminal/terminal.c +src/terminal/terminal.h +src/terminal/terminfo.c +src/terminal/terminfo.h +src/terminal/window.c +src/terminal/window.h +src/util/align.h +src/util/base64.c +src/util/base64.h +src/util/bitfield.h +src/util/box.h +src/util/color.c +src/util/color.h +src/util/color.inc +src/util/color_s.inc +src/util/conv.c +src/util/conv.h +src/util/env.c +src/util/env.h +src/util/error.c +src/util/error.h +src/util/fastfind.c +src/util/fastfind.h +src/util/file.c +src/util/file.h +src/util/hash.c +src/util/hash.h +src/util/lists.h +src/util/math.h +src/util/md5.c +src/util/md5.h +src/util/memdebug.c +src/util/memdebug.h +src/util/memlist.c +src/util/memlist.h +src/util/memory.c +src/util/memory.h +src/util/profile.h +src/util/random.c +src/util/random.h +src/util/scanner.c +src/util/scanner.h +src/util/secsave.c +src/util/secsave.h +src/util/sha1.c +src/util/sha1.h +src/util/snprintf.c +src/util/snprintf.h +src/util/string.c +src/util/string.h +src/util/test.h +src/util/time.c +src/util/time.h +src/vernum.c +src/vernum.h +src/viewer/action.c +src/viewer/action.h +src/viewer/dump/dump-color-mode.h +src/viewer/dump/dump-specialized.h +src/viewer/dump/dump.c +src/viewer/dump/dump.h +src/viewer/text/draw.c +src/viewer/text/draw.h +src/viewer/text/form.c +src/viewer/text/form.h +src/viewer/text/link.c +src/viewer/text/link.h +src/viewer/text/marks.c +src/viewer/text/marks.h +src/viewer/text/search.c +src/viewer/text/search.h +src/viewer/text/textarea.c +src/viewer/text/textarea.h +src/viewer/text/view.c +src/viewer/text/view.h +src/viewer/text/vs.c +src/viewer/text/vs.h +src/viewer/timer.c +src/viewer/timer.h +src/viewer/viewer.c +src/viewer/viewer.h diff --git a/po/meson.build b/po/meson.build new file mode 100644 index 00000000..e278475e --- /dev/null +++ b/po/meson.build @@ -0,0 +1,8 @@ +if conf_data.get('CONFIG_NLS') == 1 + i18n = import('i18n') + # define GETTEXT_PACKAGE + add_project_arguments('-DGETTEXT_PACKAGE="elinks"', language:'c') + i18n.gettext('elinks', + args: '--directory=' + meson.source_root() + ) +endif From 34d1adbf8cae06d8fa7c98d388c90b87de677f2c Mon Sep 17 00:00:00 2001 From: Witold Filipczyk Date: Mon, 7 Sep 2020 17:08:06 +0200 Subject: [PATCH 029/179] [meson] version -> VERSION --- config2.h.in | 2 +- meson.build | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/config2.h.in b/config2.h.in index 5327988d..b6288e93 100644 --- a/config2.h.in +++ b/config2.h.in @@ -936,7 +936,7 @@ /* Package version */ -#define VERSION "@version@" +#define VERSION "@VERSION@" /* Define if you have XFree under OS/2 */ #undef X2 diff --git a/meson.build b/meson.build index daf929e8..2440c959 100644 --- a/meson.build +++ b/meson.build @@ -8,7 +8,7 @@ dirty = run_command(srcdir + '/git-dirty.sh').stdout().strip() add_global_arguments('-DBUILD_ID="' + txt + dirty + '"', language : 'c') conf_data = configuration_data() -conf_data.set('version', '0.14.GIT') +conf_data.set('VERSION', '0.14.GIT') conf_data.set('PACKAGE', 'elinks') From 2a16aa91fec56559c6369f4bd4d703c1cf6817de Mon Sep 17 00:00:00 2001 From: Witold Filipczyk Date: Mon, 7 Sep 2020 17:48:37 +0200 Subject: [PATCH 030/179] [meson] Generate elinks.spec and changes in contrib --- configure.ac | 1 - contrib/conv/.gitignore | 1 - contrib/conv/{w3m2links.awk.in => w3m2links.awk} | 2 +- contrib/elinks.spec.in | 2 +- meson.build | 6 +++++- 5 files changed, 7 insertions(+), 5 deletions(-) rename contrib/conv/{w3m2links.awk.in => w3m2links.awk} (97%) mode change 100644 => 100755 diff --git a/configure.ac b/configure.ac index 30bc4c05..1252672e 100644 --- a/configure.ac +++ b/configure.ac @@ -1868,7 +1868,6 @@ AC_CONFIG_FILES([ \ Makefile.config \ contrib/elinks.spec \ contrib/lua/hooks.lua \ - contrib/conv/w3m2links.awk \ doc/Doxyfile \ doc/man/man1/elinks.1 \ src/intl/gettext/ref-add.sed \ diff --git a/contrib/conv/.gitignore b/contrib/conv/.gitignore index 43022620..e69de29b 100644 --- a/contrib/conv/.gitignore +++ b/contrib/conv/.gitignore @@ -1 +0,0 @@ -w3m2links.awk diff --git a/contrib/conv/w3m2links.awk.in b/contrib/conv/w3m2links.awk old mode 100644 new mode 100755 similarity index 97% rename from contrib/conv/w3m2links.awk.in rename to contrib/conv/w3m2links.awk index b5fa34af..f0033f4c --- a/contrib/conv/w3m2links.awk.in +++ b/contrib/conv/w3m2links.awk @@ -1,4 +1,4 @@ -#!@AWK@ -f +#!/bin/awk -f # # This converts w3m bookmarks.html to ELinks bookmarks.lst used by the Lua # based bookmarks handling (NOT the internal one!). diff --git a/contrib/elinks.spec.in b/contrib/elinks.spec.in index 361536bd..c4cc2e1b 100644 --- a/contrib/elinks.spec.in +++ b/contrib/elinks.spec.in @@ -193,7 +193,7 @@ rm -rf $RPM_BUILD_ROOT * Thu Apr 04 2002 pasky@ucw.cz - Changed some stuff so that it's now ready for inclusion.. -* Sat Mar 16 2002 zimon (t) iki fi +* Sat Mar 16 2002 zimon (ät) iki fi - Made my own elinks.spec file as the one I found with Google didn't work how I wanted diff --git a/meson.build b/meson.build index 2440c959..dc2110b6 100644 --- a/meson.build +++ b/meson.build @@ -708,7 +708,10 @@ endif conf_data.set('ICONV_CONST', true) -conf_data.set('CONFDIR', get_option('prefix') / get_option('sysconfdir')/'elinks') +sysconfdir = get_option('prefix') / get_option('sysconfdir')/'elinks' +conf_data.set('CONFDIR', sysconfdir) +conf_data.set('sysconfdir', sysconfdir) +conf_data.set('SOMETHING', '@SOMETHING@') conf_data.set('LIBDIR', get_option('prefix') / 'lib') conf_data.set('LOCALEDIR', get_option('prefix') / 'share/locale') @@ -750,3 +753,4 @@ configure_file(input : 'config2.h.in', subdir('po') subdir('src') +subdir('contrib') From 62419b105401d77499228ffc9c399c25c1d66be3 Mon Sep 17 00:00:00 2001 From: Witold Filipczyk Date: Wed, 9 Sep 2020 18:08:17 +0200 Subject: [PATCH 031/179] [ctrl_z] Added code links-based for ctrl-z and fg. Refs #65 --- src/osdep/signals.c | 32 +++++++++++++++++++++++++++++++- src/setup.h | 2 ++ 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/src/osdep/signals.c b/src/osdep/signals.c index b2632a53..aa4e2245 100644 --- a/src/osdep/signals.c +++ b/src/osdep/signals.c @@ -20,6 +20,7 @@ #include "main/main.h" #include "main/select.h" +#include "main/timer.h" #include "main/version.h" #include "osdep/signals.h" #include "terminal/kbd.h" @@ -63,16 +64,21 @@ sig_ign(void *x) } #endif +static void poll_fg(void *); +static struct timer *fg_poll_timer = NULL; + #if defined(SIGTSTP) || defined(SIGTTIN) static void sig_tstp(struct terminal *term) { #ifdef SIGSTOP + pid_t newpid; pid_t pid = getpid(); block_itrm(); #if defined (SIGCONT) && defined(SIGTTOU) - if (!fork()) { + newpid = fork(); + if (!newpid) { sleep(1); kill(pid, SIGCONT); /* Use _exit() rather than exit(), so that atexit @@ -85,9 +91,33 @@ sig_tstp(struct terminal *term) #endif raise(SIGSTOP); #endif + if (fg_poll_timer != NULL) kill_timer(&fg_poll_timer); + install_timer(&fg_poll_timer, FG_POLL_TIME, poll_fg, term); } #endif +static void +poll_fg(void *t_) +{ + struct terminal *t = (struct terminal *)t_; + int r ; + + fg_poll_timer = NULL; + r = unblock_itrm(); + if (r == -1) { + install_timer(&fg_poll_timer, FG_POLL_TIME, poll_fg, t); + } +#if 0 + if (r == -2) { + /* This will unblock externally spawned viewer, if it exists */ +#ifdef SIGCONT + EINTRLOOP(r, kill(0, SIGCONT)); +#endif + } +#endif +} + + #ifdef SIGCONT static void sig_cont(struct terminal *term) diff --git a/src/setup.h b/src/setup.h index 381cdb36..37bf7cdc 100644 --- a/src/setup.h +++ b/src/setup.h @@ -115,4 +115,6 @@ * to fit in the screen, with this much extra space. Try 4. */ #define TABLE_LINE_PADDING -1 +#define FG_POLL_TIME 500 + #endif From 9a96f3b77a0e6f6b7eadd90ab089eb80da3cb230 Mon Sep 17 00:00:00 2001 From: Witold Filipczyk Date: Fri, 11 Sep 2020 20:52:59 +0200 Subject: [PATCH 032/179] [meson] bzip2 not available as pkg-config nor cmake on Debian --- meson_options.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meson_options.txt b/meson_options.txt index e0e6ec6f..8358a380 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -42,7 +42,7 @@ option('xterm', type: 'boolean', value: false, description: 'how to invoke the X option('gpm', type: 'boolean', value: true, description: 'gpm (mouse) support') option('terminfo', type: 'boolean', value: false, description: 'terminfo support') option('zlib', type: 'boolean', value: true, description: 'zlib support') -option('bzlib', type: 'boolean', value: true, description: 'bzip2 support') +option('bzlib', type: 'boolean', value: false, description: 'bzip2 support') option('brotli', type: 'boolean', value: false, description: 'brotli support') option('zstd', type: 'boolean', value: false, description: 'zstd support') option('idn', type: 'boolean', value: true, description: 'international domain names support') From ec7869c7226823e6f44bc7e197dc42419dbe79a8 Mon Sep 17 00:00:00 2001 From: Witold Filipczyk Date: Fri, 11 Sep 2020 21:05:26 +0200 Subject: [PATCH 033/179] [meson] Disable spidermonkey (not in Debian), enabled bittorent. --- meson.build | 9 +++++++-- meson_options.txt | 6 +++--- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/meson.build b/meson.build index dc2110b6..fb7e78b4 100644 --- a/meson.build +++ b/meson.build @@ -92,8 +92,11 @@ conf_data.set('CONFIG_LIBDOM', get_option('libdom')) #CONFIG_XBEL_BOOKMARKS=true #CONFIG_COOKIES=true #CONFIG_DOM=true -conf_data.set('CONFIG_ECMASCRIPT', true) -#CONFIG_ECMASCRIPT_SMJS', true) +if conf_data.get('CONFIG_SCRIPTING_SPIDERMONKEY') or conf_data.get('CONFIG_ECMASCRIPT_SMJS') + conf_data.set('CONFIG_ECMASCRIPT', true) +else + conf_data.set('CONFIG_ECMASCRIPT', false) +endif conf_data.set('CONFIG_ECMASCRIPT_SMJS_HEARTBEAT', true) #CONFIG_FORMHIST', true) #CONFIG_GLOBHIST', true) @@ -712,6 +715,7 @@ sysconfdir = get_option('prefix') / get_option('sysconfdir')/'elinks' conf_data.set('CONFDIR', sysconfdir) conf_data.set('sysconfdir', sysconfdir) conf_data.set('SOMETHING', '@SOMETHING@') +conf_data.set('api_srcdir', srcdir + '/src') conf_data.set('LIBDIR', get_option('prefix') / 'lib') conf_data.set('LOCALEDIR', get_option('prefix') / 'share/locale') @@ -754,3 +758,4 @@ configure_file(input : 'config2.h.in', subdir('po') subdir('src') subdir('contrib') +#subdir('doc') diff --git a/meson_options.txt b/meson_options.txt index 8358a380..65b3601d 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -1,7 +1,7 @@ option('largefile', type: 'boolean', value: true, description: 'support for large files') option('bookmarks', type: 'boolean', value: true, description: 'bookmark support') option('xbel', type: 'boolean', value: true, description: 'XBEL bookmark support (requires expat)') -option('sm-scripting', type: 'boolean', value: true, description: 'ECMAScript browser scripting (requires Spidermonkey)') +option('sm-scripting', type: 'boolean', value: false, description: 'ECMAScript browser scripting (requires Spidermonkey)') option('nls', type: 'boolean', value: true, description: 'Native Language Support') option('cookies', type: 'boolean', value: true, description: 'cookie support') option('formhist', type: 'boolean', value: true, description: 'form history support') @@ -9,7 +9,7 @@ option('globhist', type: 'boolean', value: true, description: 'global history su option('mailcap', type: 'boolean', value: true, description: 'mailcap support') option('mimetypes', type: 'boolean', value: true, description: 'mimetypes files support') option('ipv6', type: 'boolean', value: true, description: 'IPv6 support') -option('bittorrent', type: 'boolean', value: false, description: 'BitTorrent protocol support') +option('bittorrent', type: 'boolean', value: true, description: 'BitTorrent protocol support') option('data', type: 'boolean', value: true, description: 'data protocol support') option('uri-rewrite', type: 'boolean', value: true, description: 'URI rewrite support') option('cgi', type: 'boolean', value: false, description: 'local CGI support') @@ -48,7 +48,7 @@ option('zstd', type: 'boolean', value: false, description: 'zstd support') option('idn', type: 'boolean', value: true, description: 'international domain names support') option('lzma', type: 'boolean', value: false, description: 'lzma encoding support') option('gssapi', type: 'boolean', value: false, description: 'GSSAPI support') -option('spidermonkey', type: 'boolean', value: true, description: 'SpiderMonkey Mozilla JavaScript engine support') +option('spidermonkey', type: 'boolean', value: false, description: 'SpiderMonkey Mozilla JavaScript engine support') option('guile', type: 'boolean', value: false, description: 'Guile support') option('perl', type: 'boolean', value: false, description: 'Perl5 support') option('python', type: 'boolean', value: false, description: 'Python3 support') From 30400f73673916fb1679e3d1e2796e1f7f9c4641 Mon Sep 17 00:00:00 2001 From: Witold Filipczyk Date: Fri, 11 Sep 2020 21:08:34 +0200 Subject: [PATCH 034/179] [meson] Added contrib --- contrib/lua/meson.build | 3 +++ contrib/meson.build | 4 ++++ 2 files changed, 7 insertions(+) create mode 100644 contrib/lua/meson.build create mode 100644 contrib/meson.build diff --git a/contrib/lua/meson.build b/contrib/lua/meson.build new file mode 100644 index 00000000..f63f24c8 --- /dev/null +++ b/contrib/lua/meson.build @@ -0,0 +1,3 @@ +configure_file(input : 'hooks.lua.in', + output : 'hooks.lua', + configuration : conf_data) diff --git a/contrib/meson.build b/contrib/meson.build new file mode 100644 index 00000000..41260ab6 --- /dev/null +++ b/contrib/meson.build @@ -0,0 +1,4 @@ +configure_file(input : 'elinks.spec.in', + output : 'elinks.spec', + configuration : conf_data) +subdir('lua') From cfe8916d4ba746e6010888b20fac1c0e09de5a02 Mon Sep 17 00:00:00 2001 From: Witold Filipczyk Date: Sat, 12 Sep 2020 18:29:23 +0200 Subject: [PATCH 035/179] [meson] fsp --- meson.build | 5 +++++ meson_options.txt | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/meson.build b/meson.build index fb7e78b4..4ad4fc50 100644 --- a/meson.build +++ b/meson.build @@ -359,6 +359,11 @@ if conf_data.get('CONFIG_SCRIPTING_GUILE') deps += guiledeps endif +if conf_data.get('CONFIG_FSP') + fspdeps = compiler.find_library('fsplib') + deps += fspdeps +endif + eh = '' if conf_data.get('CONFIG_LIBEV') diff --git a/meson_options.txt b/meson_options.txt index 65b3601d..3d3b9060 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -14,7 +14,7 @@ option('data', type: 'boolean', value: true, description: 'data protocol support option('uri-rewrite', type: 'boolean', value: true, description: 'URI rewrite support') option('cgi', type: 'boolean', value: false, description: 'local CGI support') option('finger', type: 'boolean', value: false, description: 'finger protocol support') -option('fsp', type: 'boolean', value: false, description: 'FSP protocol support') +option('fsp', type: 'boolean', value: true, description: 'FSP protocol support') option('ftp', type: 'boolean', value: true, description: 'ftp protocol support') option('gopher', type: 'boolean', value: false, description: 'gopher protocol support') option('nntp', type: 'boolean', value: false, description: 'nntp protocol support') From deefa7eb8a0da26cc73b4e29fff89b052ac43056 Mon Sep 17 00:00:00 2001 From: Witold Filipczyk Date: Sat, 12 Sep 2020 18:41:31 +0200 Subject: [PATCH 036/179] [meson] Removed some ifs. They were not used --- meson.build | 60 +---------------------------------------------------- 1 file changed, 1 insertion(+), 59 deletions(-) diff --git a/meson.build b/meson.build index 4ad4fc50..c80182bb 100644 --- a/meson.build +++ b/meson.build @@ -202,25 +202,16 @@ conf_data.set10('HAVE_ALLOCA_H', compiler.has_header('alloca.h')) deps = [] if conf_data.get('CONFIG_GZIP') zdeps = dependency('zlib') - if not zdeps.found() - error('zlib not found') - endif deps += zdeps endif if conf_data.get('CONFIG_TRE') tredeps = dependency('tre') - if not tredeps.found() - error('tre not found') - endif deps += tredeps endif if conf_data.get('CONFIG_LIBEVENT') eventdeps = dependency('libevent') - if not eventdeps.found() - error('libevent not found') - endif deps += eventdeps conf_data.set('HAVE_LIBEVENT', true) else @@ -229,9 +220,6 @@ endif if conf_data.get('CONFIG_OPENSSL') ssldeps = dependency('openssl') - if not ssldeps.found() - error('openssl not found') - endif deps += ssldeps conf_data.set('USE_OPENSSL', true) else @@ -241,121 +229,75 @@ endif gnutlsdeps = [] if conf_data.get('CONFIG_GNUTLS') gnutlsdeps = dependency('gnutls') - if not gnutlsdeps.found() - error('gnutls not found') - endif libgcryptdeps = dependency('libgcrypt') - if not libgcryptdeps.found() - error('libgcrypt not found') - endif deps += gnutlsdeps deps += libgcryptdeps endif if conf_data.get('CONFIG_BROTLI') brotlideps = dependency('libbrotlidec') - if not brotlideps.found() - error('brotli not found') - endif deps += brotlideps endif if conf_data.get('CONFIG_ZSTD') zstddeps = dependency('libzstd') - if not zstddeps.found() - error('zstd not found') - endif deps += zstddeps endif if conf_data.get('CONFIG_IDN') idndeps = dependency('libidn') - if not idndeps.found() - error('idn not found') - endif deps += idndeps endif if conf_data.get('CONFIG_X') x11deps = dependency('X11') - if not x11deps.found() - error('x11 not found') - endif deps += x11deps endif if conf_data.get('CONFIG_BZIP2') bz2deps = dependency('bzip2') - if not bz2deps.found() - error('bz2 not found') - endif deps += bz2deps endif if conf_data.get('CONFIG_ECMASCRIPT') mozjsdeps = dependency('mozjs-17.0') - if not mozjsdeps.found() - error('mozjs-17.0 not found') - endif deps += mozjsdeps endif if conf_data.get('CONFIG_SCRIPTING_LUA') luadeps = dependency(luapkg) - if not luadeps.found() - error('lua not found') - endif deps += luadeps endif if conf_data.get('CONFIG_XBEL_BOOKMARKS') expatdeps = dependency('expat') - if not expatdeps.found() - error('expat not found') - endif deps += expatdeps endif if conf_data.get('CONFIG_GPM') - cc = meson.get_compiler('c') - libgpmdeps = cc.find_library('gpm') - if not libgpmdeps.found() - error('gpm not found') - endif + libgpmdeps = compiler.find_library('gpm') deps += libgpmdeps endif if conf_data.get('CONFIG_LIBDOM') domdeps = dependency('libdom') - if not domdeps.found() - error('libdom not found') - endif deps += domdeps endif if conf_data.get('CONFIG_SCRIPTING_PYTHON') python3deps = dependency('python3-embed') - if not python3deps.found() - error('python3 not found') - endif deps += python3deps endif rubydeps = [] if conf_data.get('CONFIG_SCRIPTING_RUBY') rubydeps = dependency('ruby-2.6') - if not rubydeps.found() - error('ruby not found') - endif deps += rubydeps endif guiledeps = [] if conf_data.get('CONFIG_SCRIPTING_GUILE') guiledeps = dependency('guile-2.2') - if not guiledeps.found() - error('guile not found') - endif deps += guiledeps endif From 5dc8c56b2dfbedfc5dd5f8b77ae31c62505cda9f Mon Sep 17 00:00:00 2001 From: Witold Filipczyk Date: Sun, 13 Sep 2020 16:12:57 +0200 Subject: [PATCH 037/179] [meson] Fixed bittorrent build --- meson.build | 2 +- src/dialogs/download.c | 16 ++++++++-------- src/protocol/meson.build | 2 +- src/util/meson.build | 2 +- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/meson.build b/meson.build index c80182bb..2e014508 100644 --- a/meson.build +++ b/meson.build @@ -24,7 +24,7 @@ conf_data.set('CONFIG_GLOBHIST', get_option('globhist')) conf_data.set('CONFIG_MAILCAP', get_option('mailcap')) conf_data.set('CONFIG_MIMETYPES', get_option('mimetypes')) conf_data.set('CONFIG_IPV6', get_option('ipv6')) -conf_data.set10('CONFIG_BITTORRENT', get_option('bittorrent')) +conf_data.set('CONFIG_BITTORRENT', get_option('bittorrent')) conf_data.set('CONFIG_DATA', get_option('data')) conf_data.set('CONFIG_URI_REWRITE', get_option('uri-rewrite')) diff --git a/src/dialogs/download.c b/src/dialogs/download.c index a2338cbd..38a53fc7 100644 --- a/src/dialogs/download.c +++ b/src/dialogs/download.c @@ -70,7 +70,7 @@ dlg_set_notify(struct dialog_data *dlg_data, struct widget_data *widget_data) if (!file_download->external_handler) file_download->term = dlg_data->win->term; -#if CONFIG_BITTORRENT +#ifdef CONFIG_BITTORRENT if (file_download->uri->protocol == PROTOCOL_BITTORRENT) set_bittorrent_notify_on_completion(&file_download->download, file_download->term); @@ -95,7 +95,7 @@ push_delete_button(struct dialog_data *dlg_data, struct widget_data *widget_data struct file_download *file_download = dlg_data->dlg->udata; file_download->delete_ = 1; -#if CONFIG_BITTORRENT +#ifdef CONFIG_BITTORRENT if (file_download->uri->protocol == PROTOCOL_BITTORRENT) set_bittorrent_files_for_deletion(&file_download->download); #endif @@ -139,7 +139,7 @@ download_dialog_layouter(struct dialog_data *dlg_data) unsigned char *msg = get_download_msg(download, term, 1, 1, "\n"); int show_meter = (download_is_progressing(download) && download->progress->size >= 0); -#if CONFIG_BITTORRENT +#ifdef CONFIG_BITTORRENT int bittorrent = (file_download->uri->protocol == PROTOCOL_BITTORRENT && (show_meter || is_in_state(download->state, S_RESUME))); #endif @@ -172,7 +172,7 @@ download_dialog_layouter(struct dialog_data *dlg_data) y++; if (show_meter) y += 2; -#if CONFIG_BITTORRENT +#ifdef CONFIG_BITTORRENT if (bittorrent) y += 2; #endif dlg_format_text_do(dlg_data, msg, 0, &y, w, &rw, @@ -208,7 +208,7 @@ download_dialog_layouter(struct dialog_data *dlg_data) y++; } -#if CONFIG_BITTORRENT +#ifdef CONFIG_BITTORRENT if (bittorrent) { y++; draw_bittorrent_piece_progress(download, term, x, y, w, NULL, NULL); @@ -238,7 +238,7 @@ display_download(struct terminal *term, struct file_download *file_download, if (!is_in_downloads_list(file_download)) return; -#if CONFIG_BITTORRENT +#ifdef CONFIG_BITTORRENT #define DOWNLOAD_WIDGETS_COUNT 5 #else #define DOWNLOAD_WIDGETS_COUNT 4 @@ -259,7 +259,7 @@ display_download(struct terminal *term, struct file_download *file_download, add_dlg_button(dlg, _("~Background", term), B_ENTER | B_ESC, dlg_undisplay_download, NULL); add_dlg_button(dlg, _("Background with ~notify", term), B_ENTER | B_ESC, dlg_set_notify, NULL); -#if CONFIG_BITTORRENT +#ifdef CONFIG_BITTORRENT if (file_download->uri->protocol == PROTOCOL_BITTORRENT) add_dlg_button(dlg, _("~Info", term), B_ENTER | B_ESC, dlg_show_bittorrent_info, NULL); #endif @@ -272,7 +272,7 @@ display_download(struct terminal *term, struct file_download *file_download, add_dlg_button(dlg, _("Abort and ~delete file", term), 0, push_delete_button, NULL); } -#if CONFIG_BITTORRENT +#ifdef CONFIG_BITTORRENT add_dlg_end(dlg, DOWNLOAD_WIDGETS_COUNT - !!file_download->external_handler - (file_download->uri->protocol != PROTOCOL_BITTORRENT)); #else diff --git a/src/protocol/meson.build b/src/protocol/meson.build index cf433bda..b83c51d4 100644 --- a/src/protocol/meson.build +++ b/src/protocol/meson.build @@ -1,4 +1,4 @@ -if conf_data.get('CONFIG_BITTORRENT') == 1 +if conf_data.get('CONFIG_BITTORRENT') subdir('bittorrent') endif if conf_data.get('CONFIG_FINGER') diff --git a/src/util/meson.build b/src/util/meson.build index ccd1c0d3..a270aa83 100644 --- a/src/util/meson.build +++ b/src/util/meson.build @@ -15,7 +15,7 @@ endif if conf_data.get('CONFIG_OWN_LIBC') or (not conf_data.get('CONFIG_GNUTLS_OPENSSL_COMPAT') and not conf_data.get('CONFIG_OPENSSL')) srcs += files('md5.c') endif -if conf_data.get('CONFIG_BITTORRENT') == 1 +if conf_data.get('CONFIG_BITTORRENT') if conf_data.get('CONFIG_OWN_LIBC') or not conf_data.get('CONFIG_OPENSSL') srcs += files('sha1.c') endif From d6ccb1813bc7a794a0c6424dd0b3b629d15e57fe Mon Sep 17 00:00:00 2001 From: sgerwk Date: Sun, 26 Jul 2020 09:27:14 +0200 Subject: [PATCH 038/179] update the "What to do?" dialog to the new format with %f for the file --- src/mime/backend/mailcap.c | 4 ++-- src/session/download.c | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/mime/backend/mailcap.c b/src/mime/backend/mailcap.c index c6689da8..37a6d430 100644 --- a/src/mime/backend/mailcap.c +++ b/src/mime/backend/mailcap.c @@ -517,7 +517,7 @@ format_command(unsigned char *command, unsigned char *type, int copiousoutput) command++; if (!strncmp(command, "%s'", 3)) { command += 3; - add_char_to_string(&cmd, '%'); + add_to_string(&cmd, "%f"); } else { add_char_to_string(&cmd, '\''); } @@ -530,7 +530,7 @@ format_command(unsigned char *command, unsigned char *type, int copiousoutput) return NULL; } else if (*command == 's') { - add_char_to_string(&cmd, '%'); + add_to_string(&cmd, "%f"); } else if (*command == 't') { if (!type) { diff --git a/src/session/download.c b/src/session/download.c index 97552f6b..f70904fb 100644 --- a/src/session/download.c +++ b/src/session/download.c @@ -1627,7 +1627,9 @@ do_type_query(struct type_query *type_query, unsigned char *ct, struct mime_hand } /* xgettext:no-c-format */ - add_dlg_field(dlg, _("Program ('%' will be replaced by the filename)", term), + add_dlg_field(dlg, + _("Program ('%f' will be replaced by the filename, " + "'%u' by the uri)", term), 0, 0, NULL, MAX_STR_LEN, field, NULL); type_query->external_handler = field; From acd2650d59e7b545b77d8a6108fc10a5879fe11b Mon Sep 17 00:00:00 2001 From: Witold Filipczyk Date: Mon, 14 Sep 2020 20:11:53 +0200 Subject: [PATCH 039/179] [meson] X11 --- meson.build | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/meson.build b/meson.build index 2e014508..840ede63 100644 --- a/meson.build +++ b/meson.build @@ -249,9 +249,11 @@ if conf_data.get('CONFIG_IDN') deps += idndeps endif +conf_data.set('HAVE_X11', false) if conf_data.get('CONFIG_X') - x11deps = dependency('X11') + x11deps = dependency('x11') deps += x11deps + conf_data.set('HAVE_X11', compiler.has_header('X11/Xlib.h')) endif if conf_data.get('CONFIG_BZIP2') From 3d78cd12643e27c9837107e8bb29fb927b32407a Mon Sep 17 00:00:00 2001 From: Witold Filipczyk Date: Mon, 14 Sep 2020 23:01:03 +0200 Subject: [PATCH 040/179] [data] base64 decoded not encoded. Refs #67 --- src/protocol/data.c | 5 +++-- src/util/base64.c | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/protocol/data.c b/src/protocol/data.c index 42dea5aa..eca79896 100644 --- a/src/protocol/data.c +++ b/src/protocol/data.c @@ -118,6 +118,7 @@ data_protocol_handler(struct connection *conn) struct cache_entry *cached = get_cache_entry(uri); unsigned char *data_start, *data; int base64 = 0; + int datalen = 0; if (!cached) { abort_connection(conn, connection_state(S_OUT_OF_MEM)); @@ -141,7 +142,7 @@ data_protocol_handler(struct connection *conn) } if (base64) { - unsigned char *decoded = base64_encode(data); + unsigned char *decoded = base64_decode_bin(data, strlen(data), &datalen); if (!decoded) { abort_connection(conn, connection_state(S_OUT_OF_MEM)); @@ -155,7 +156,7 @@ data_protocol_handler(struct connection *conn) { /* Use strlen() to get the correct decoded length */ - int datalen = strlen(data); + if (!datalen) datalen = strlen(data); add_fragment(cached, conn->from, data, datalen); conn->from += datalen; diff --git a/src/util/base64.c b/src/util/base64.c index 8046cc9c..7fafa208 100644 --- a/src/util/base64.c +++ b/src/util/base64.c @@ -63,9 +63,9 @@ base64_encode_bin(register unsigned char *in, int inlen, int *outlen) return outstr; } -/* Base64 decoding is used only with the CONFIG_FORMHIST or CONFIG_GSSAPI +/* Base64 decoding is used only with the CONFIG_FORMHIST, CONFIG_GSSAPI or CONFIG_DATA feature, so i'll #ifdef it */ -#if defined(CONFIG_FORMHIST) || defined(CONFIG_GSSAPI) +#if defined(CONFIG_FORMHIST) || defined(CONFIG_GSSAPI) || defined(CONFIG_DATA) unsigned char * base64_decode(register unsigned char *in) From d731d5901df384ff6c4fa5befcb198ecefead4eb Mon Sep 17 00:00:00 2001 From: Witold Filipczyk Date: Tue, 15 Sep 2020 08:32:49 +0200 Subject: [PATCH 041/179] [data] Small rewrite. --- src/protocol/data.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/src/protocol/data.c b/src/protocol/data.c index eca79896..cffdf973 100644 --- a/src/protocol/data.c +++ b/src/protocol/data.c @@ -118,7 +118,8 @@ data_protocol_handler(struct connection *conn) struct cache_entry *cached = get_cache_entry(uri); unsigned char *data_start, *data; int base64 = 0; - int datalen = 0; + int decodedlen = 0; + int datalen; if (!cached) { abort_connection(conn, connection_state(S_OUT_OF_MEM)); @@ -135,14 +136,15 @@ data_protocol_handler(struct connection *conn) /* Allocate the data string because URI decoding will possibly modify * it. */ - data = memacpy(data_start, uri->datalen - (data_start - uri->data)); + datalen = uri->datalen - (data_start - uri->data); + data = memacpy(data_start, datalen); if (!data) { abort_connection(conn, connection_state(S_OUT_OF_MEM)); return; } if (base64) { - unsigned char *decoded = base64_decode_bin(data, strlen(data), &datalen); + unsigned char *decoded = base64_decode_bin(data, datalen, &decodedlen); if (!decoded) { abort_connection(conn, connection_state(S_OUT_OF_MEM)); @@ -152,16 +154,12 @@ data_protocol_handler(struct connection *conn) mem_free_set(&data, decoded); } else { decode_uri(data); - } - - { /* Use strlen() to get the correct decoded length */ - if (!datalen) datalen = strlen(data); - - add_fragment(cached, conn->from, data, datalen); - conn->from += datalen; + decodedlen = strlen(data); } + add_fragment(cached, conn->from, data, decodedlen); + conn->from += decodedlen; mem_free(data); abort_connection(conn, connection_state(S_OK)); From 23b346d353b60c30ed3641cda86aa931b64feaf2 Mon Sep 17 00:00:00 2001 From: Witold Filipczyk Date: Tue, 15 Sep 2020 21:22:41 +0200 Subject: [PATCH 042/179] [base64] This if is not needed --- src/util/base64.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/util/base64.c b/src/util/base64.c index 7fafa208..1fe34b81 100644 --- a/src/util/base64.c +++ b/src/util/base64.c @@ -63,10 +63,6 @@ base64_encode_bin(register unsigned char *in, int inlen, int *outlen) return outstr; } -/* Base64 decoding is used only with the CONFIG_FORMHIST, CONFIG_GSSAPI or CONFIG_DATA - feature, so i'll #ifdef it */ -#if defined(CONFIG_FORMHIST) || defined(CONFIG_GSSAPI) || defined(CONFIG_DATA) - unsigned char * base64_decode(register unsigned char *in) { @@ -159,5 +155,3 @@ decode_error: mem_free(outstr); return NULL; } - -#endif /* CONFIG_FORMHIST */ From 881bb981279bc9f0503719de1da39044e67606cc Mon Sep 17 00:00:00 2001 From: Witold Filipczyk Date: Thu, 17 Sep 2020 18:39:53 +0200 Subject: [PATCH 043/179] [meson] elinks installable --- src/meson.build | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/meson.build b/src/meson.build index ff2893ca..b7dfb704 100644 --- a/src/meson.build +++ b/src/meson.build @@ -47,5 +47,6 @@ elinks = executable( 'elinks', srcs, include_directories: incs, dependencies: deps, - c_args : extra_args + c_args: extra_args, + install: true ) From 5ad989ad43e25f018cd3f5e39de778a9b55fb340 Mon Sep 17 00:00:00 2001 From: Witold Filipczyk Date: Fri, 18 Sep 2020 10:23:00 +0200 Subject: [PATCH 044/179] [search] Do not scroll horizontally, when searched text is visible on screen. Refs #68 --- src/viewer/text/search.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/viewer/text/search.c b/src/viewer/text/search.c index 30ee9bc4..31354024 100644 --- a/src/viewer/text/search.c +++ b/src/viewer/text/search.c @@ -1360,7 +1360,9 @@ move_search_number(struct session *ses, struct document_view *doc_view, int numb x = pt[number].x; y = pt[number].y; - horizontal_scroll_extended(ses, doc_view, x - doc_view->vs->x, 0); + if (!col_is_in_box(&doc_view->box, x)) { + horizontal_scroll_extended(ses, doc_view, x - doc_view->vs->x, 0); + } vertical_scroll(ses, doc_view, y - doc_view->vs->y); return ret; From 3590191086807029108904a182215ae129126077 Mon Sep 17 00:00:00 2001 From: Witold Filipczyk Date: Fri, 18 Sep 2020 20:21:37 +0200 Subject: [PATCH 045/179] [search] Take into account vertical_overlap in vertical_scrolling to found text. Refs #68 --- src/viewer/text/search.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/viewer/text/search.c b/src/viewer/text/search.c index 31354024..af6986ea 100644 --- a/src/viewer/text/search.c +++ b/src/viewer/text/search.c @@ -1339,7 +1339,7 @@ static enum find_error move_search_number(struct session *ses, struct document_view *doc_view, int number) { struct point *pt; - int x, y; + int x, y, step; enum find_error ret = FIND_ERROR_NONE; if (number < 0) { @@ -1363,7 +1363,8 @@ move_search_number(struct session *ses, struct document_view *doc_view, int numb if (!col_is_in_box(&doc_view->box, x)) { horizontal_scroll_extended(ses, doc_view, x - doc_view->vs->x, 0); } - vertical_scroll(ses, doc_view, y - doc_view->vs->y); + step = y - doc_view->vs->y - get_opt_int("document.browse.scrolling.vertical_overlap", ses); + vertical_scroll(ses, doc_view, step); return ret; } From fefe69f9a5b0f06407352a8c3759d9fbd4b08922 Mon Sep 17 00:00:00 2001 From: Witold Filipczyk Date: Fri, 18 Sep 2020 21:58:28 +0200 Subject: [PATCH 046/179] [uri] For data protocol datalen might be bigger than 65356 bytes. Refs #67 --- src/protocol/uri.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/protocol/uri.h b/src/protocol/uri.h index dc70ad21..295e5109 100644 --- a/src/protocol/uri.h +++ b/src/protocol/uri.h @@ -76,7 +76,7 @@ struct uri { unsigned int passwordlen:16; unsigned int hostlen:16; unsigned int portlen:8; - unsigned int datalen:16; + unsigned int datalen; unsigned int fragmentlen:16; /* Flags */ From 70b8e214a9cf1a2f2545315fee0c6327b3954aec Mon Sep 17 00:00:00 2001 From: sgerwk Date: Sat, 19 Sep 2020 10:11:09 +0200 Subject: [PATCH 047/179] do not display downloads of protocol "data:" --- src/dialogs/download.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/dialogs/download.c b/src/dialogs/download.c index 38a53fc7..761f3d28 100644 --- a/src/dialogs/download.c +++ b/src/dialogs/download.c @@ -238,6 +238,9 @@ display_download(struct terminal *term, struct file_download *file_download, if (!is_in_downloads_list(file_download)) return; + if (file_download->uri->protocol == PROTOCOL_DATA) + return; + #ifdef CONFIG_BITTORRENT #define DOWNLOAD_WIDGETS_COUNT 5 #else From 267948b2e82b7d9813113986b394167beff9dabf Mon Sep 17 00:00:00 2001 From: Witold Filipczyk Date: Sat, 19 Sep 2020 19:30:47 +0200 Subject: [PATCH 048/179] [data] Premature optimisation. One memacpy less for base64 encoded data. --- src/protocol/data.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/protocol/data.c b/src/protocol/data.c index cffdf973..ec4ad3aa 100644 --- a/src/protocol/data.c +++ b/src/protocol/data.c @@ -116,7 +116,7 @@ data_protocol_handler(struct connection *conn) { struct uri *uri = conn->uri; struct cache_entry *cached = get_cache_entry(uri); - unsigned char *data_start, *data; + unsigned char *data_start, *data = NULL; int base64 = 0; int decodedlen = 0; int datalen; @@ -137,14 +137,8 @@ data_protocol_handler(struct connection *conn) /* Allocate the data string because URI decoding will possibly modify * it. */ datalen = uri->datalen - (data_start - uri->data); - data = memacpy(data_start, datalen); - if (!data) { - abort_connection(conn, connection_state(S_OUT_OF_MEM)); - return; - } - if (base64) { - unsigned char *decoded = base64_decode_bin(data, datalen, &decodedlen); + unsigned char *decoded = base64_decode_bin(data_start, datalen, &decodedlen); if (!decoded) { abort_connection(conn, connection_state(S_OUT_OF_MEM)); @@ -153,6 +147,12 @@ data_protocol_handler(struct connection *conn) mem_free_set(&data, decoded); } else { + data = memacpy(data_start, datalen); + + if (!data) { + abort_connection(conn, connection_state(S_OUT_OF_MEM)); + return; + } decode_uri(data); /* Use strlen() to get the correct decoded length */ decodedlen = strlen(data); From b7b0b28ea859028eaf42a6aeb8152cf28ec86ab7 Mon Sep 17 00:00:00 2001 From: Witold Filipczyk Date: Sat, 19 Sep 2020 19:40:38 +0200 Subject: [PATCH 049/179] [data] Moved comment to more appropriate place. --- src/protocol/data.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/protocol/data.c b/src/protocol/data.c index ec4ad3aa..be280f6f 100644 --- a/src/protocol/data.c +++ b/src/protocol/data.c @@ -134,8 +134,6 @@ data_protocol_handler(struct connection *conn) return; } - /* Allocate the data string because URI decoding will possibly modify - * it. */ datalen = uri->datalen - (data_start - uri->data); if (base64) { unsigned char *decoded = base64_decode_bin(data_start, datalen, &decodedlen); @@ -147,6 +145,8 @@ data_protocol_handler(struct connection *conn) mem_free_set(&data, decoded); } else { + /* Allocate the data string because URI decoding will possibly modify + * it. */ data = memacpy(data_start, datalen); if (!data) { From c8acb75bcd415ce4f301fde496c3022c3b07cc91 Mon Sep 17 00:00:00 2001 From: Witold Filipczyk Date: Sat, 19 Sep 2020 21:48:53 +0200 Subject: [PATCH 050/179] [pre] Wrap text in pre (SHIFT-w by default). Refs #69 --- src/document/html/renderer.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/document/html/renderer.c b/src/document/html/renderer.c index aca4046c..d0ed0c10 100644 --- a/src/document/html/renderer.c +++ b/src/document/html/renderer.c @@ -1907,7 +1907,7 @@ put_chars(struct html_context *html_context, unsigned char *chars, int charslen) renderer_context.nobreak = 0; - if (!(html_context->options->wrap || html_is_preformatted())) { + if (html_context->options->wrap || !html_is_preformatted()) { while (part->cx > overlap(par_format) && part->cx > par_format.leftmargin) { int x = split_line(html_context); @@ -1928,9 +1928,7 @@ put_chars(struct html_context *html_context, unsigned char *chars, int charslen) int_lower_bound(&part->max_width, part->xa + par_format.leftmargin + par_format.rightmargin - (chars[charslen - 1] == ' ' - && !html_is_preformatted())); - return; - + && (html_context->options->wrap || !html_is_preformatted()))); } #undef overlap From 3f8de99828798804fe4fe0bc5372a5474d16cc6c Mon Sep 17 00:00:00 2001 From: Witold Filipczyk Date: Sun, 20 Sep 2020 22:20:27 +0200 Subject: [PATCH 051/179] [pod2hml] podchecker reported some errors about hooks.pl --- contrib/perl/hooks.pl | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/contrib/perl/hooks.pl b/contrib/perl/hooks.pl index afbc971d..7d8771f1 100644 --- a/contrib/perl/hooks.pl +++ b/contrib/perl/hooks.pl @@ -100,6 +100,7 @@ powerful. =over +=item I: The function I is called when the hook is triggered, taking the target URL and current URL as its two arguments. It returns the final target URL. @@ -1077,6 +1078,7 @@ These hooks effect a URL before ELinks has a chance to load it. =over +=item I: The function I is called when the hook is triggered, taking the target URL as its only argument. It returns the final target URL. @@ -1147,6 +1149,7 @@ available. =over +=item I: The function I is called when the hook is triggered, taking the document's URL and the HTML source as its two arguments. It returns the rewritten HTML code. @@ -1252,6 +1255,7 @@ you want to use some anonymizer for access to certain sites. =over +=item I: The function I is called when the hook is triggered, taking the target URL as its only argument. It returns the proxy URL, empty string to use no proxy or I to use the default proxy URL. @@ -1290,6 +1294,7 @@ stuff. =over +=item I: The function I is called when the hook is triggered, taking no arguments nor returning anything. ('cause, you know, what would be the point?) From 0f59f669ac16d9a111f40340847c24d93f8166f9 Mon Sep 17 00:00:00 2001 From: Witold Filipczyk Date: Mon, 21 Sep 2020 17:57:40 +0200 Subject: [PATCH 052/179] [meson] doc/perl.html and doc/perl-hooks.html custom targets --- doc/meson.build | 17 +++++++++++++++++ meson.build | 2 +- 2 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 doc/meson.build diff --git a/doc/meson.build b/doc/meson.build new file mode 100644 index 00000000..5ad9ecd7 --- /dev/null +++ b/doc/meson.build @@ -0,0 +1,17 @@ +configure_file(input : 'Doxyfile.in', + output : 'Doxyfile', + configuration : conf_data) + +pod2html = find_program('pod2html', required: false) + +if pod2html.found() + custom_target('perl.html', + input: ['perl.pod'], + output: ['perl.html'], + command: [pod2html, '--outfile=@OUTPUT@', '--infile=@INPUT@']) + + custom_target('perl-hooks.html', + input: ['../contrib/perl/hooks.pl'], + output: ['perl-hooks.html'], + command: [pod2html, '--outfile=@OUTPUT@', '--infile=@INPUT@']) +endif diff --git a/meson.build b/meson.build index 840ede63..90210338 100644 --- a/meson.build +++ b/meson.build @@ -707,4 +707,4 @@ configure_file(input : 'config2.h.in', subdir('po') subdir('src') subdir('contrib') -#subdir('doc') +subdir('doc') From cbbd6e5bd22e856a611b7eb907336f07b3350fe8 Mon Sep 17 00:00:00 2001 From: Witold Filipczyk Date: Mon, 21 Sep 2020 21:54:35 +0200 Subject: [PATCH 053/179] [meson] html target in doc --- doc/meson.build | 113 +++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 111 insertions(+), 2 deletions(-) diff --git a/doc/meson.build b/doc/meson.build index 5ad9ecd7..2e968021 100644 --- a/doc/meson.build +++ b/doc/meson.build @@ -4,14 +4,123 @@ configure_file(input : 'Doxyfile.in', pod2html = find_program('pod2html', required: false) +perl_html = [] +perl_hooks_html = [] + if pod2html.found() - custom_target('perl.html', + perl_html = custom_target('perl.html', input: ['perl.pod'], output: ['perl.html'], command: [pod2html, '--outfile=@OUTPUT@', '--infile=@INPUT@']) - custom_target('perl-hooks.html', + perl_hooks_html = custom_target('perl-hooks.html', input: ['../contrib/perl/hooks.pl'], output: ['perl-hooks.html'], command: [pod2html, '--outfile=@OUTPUT@', '--infile=@INPUT@']) endif + +features_txt = custom_target('features.txt', + input: ['../features.conf'], + output: 'features.txt', + capture: true, + command: ['@CURRENT_SOURCE_DIR@/tools/conf2doc', '@INPUT@']) + +keymap_actions_txt = custom_target('keymap-actions.txt', + input: ['../src/config/kbdbind.c'], + output: 'keymap-actions.txt', + capture: true, + command: ['@CURRENT_SOURCE_DIR@/tools/keys2doc', '@INPUT@', 'keymap-actions.txt']) + +keymap_defaults_txt = custom_target('keymap-defaults.txt', + input: ['../src/config/kbdbind.c'], + output: 'keymap-defaults.txt', + capture: true, + command: ['@CURRENT_SOURCE_DIR@/tools/keys2doc', '@INPUT@', 'keymap-defaults.txt']) + +option_command_frag_xml = custom_target('option-command.frag.xml', + input: [], + output: 'option-command.frag.xml', + command: ['LC_ALL=C', 'LANGUAGE=en', '@CURRENT_SOURCE_DIR@/tools/help2xml', elinks, '@OUTPUT@']) + +option_config_frag_xml = custom_target('option-config.frag.xml', + input: [], + output: 'option-config.frag.xml', + command: ['LC_ALL=C', 'LANGUAGE=en', '@CURRENT_SOURCE_DIR@/tools/help2xml', elinks, '@OUTPUT@']) + +option_command_frag_xhtml = custom_target('option-command.frag.xhtml', + input: [], + output: 'option-command.frag.xhtml', + command: ['LC_ALL=C', 'LANGUAGE=en', '@CURRENT_SOURCE_DIR@/tools/help2xml', elinks, '@OUTPUT@']) + +option_config_frag_xhtml = custom_target('option-config.frag.xhtml', + input: [], + output: 'option-config.frag.xhtml', + command: ['LC_ALL=C', 'LANGUAGE=en', '@CURRENT_SOURCE_DIR@/tools/help2xml', elinks, '@OUTPUT@']) + +elinks_1_html = custom_target('elinks.1.html', + input: 'elinks.1.txt', + output: 'elinks.1.html', + depends: option_command_frag_xhtml, + command: ['@CURRENT_SOURCE_DIR@/tools/asciidoc/asciidoc.py', + '--no-conf', '-f', '@CURRENT_SOURCE_DIR@/tools/asciidoc/asciidoc.conf', + '-f', '@CURRENT_SOURCE_DIR@/tools/asciidoc/xhtml11.conf', + '-f', '@CURRENT_SOURCE_DIR@/asciidoc.conf', + '-a', 'builddir='+meson.current_build_dir()+'/', + '-a', 'elinks_version='+meson.project_version(), + '-b', 'xhtml11', + '--unsafe', '-o', '@OUTPUT@', '@INPUT@']) + +elinks_conf_5_html = custom_target('elinks.conf.5.html', + input: 'elinks.conf.5.txt', + output: 'elinks.conf.5.html', + depends: option_config_frag_xhtml, + command: ['@CURRENT_SOURCE_DIR@/tools/asciidoc/asciidoc.py', + '--no-conf', '-f', '@CURRENT_SOURCE_DIR@/tools/asciidoc/asciidoc.conf', + '-f', '@CURRENT_SOURCE_DIR@/tools/asciidoc/xhtml11.conf', + '-f', '@CURRENT_SOURCE_DIR@/asciidoc.conf', + '-a', 'builddir='+meson.current_build_dir()+'/', + '-a', 'elinks_version='+meson.project_version(), + '-b', 'xhtml11', + '--unsafe', '-o', '@OUTPUT@', '@INPUT@']) + +elinkskeys_5_html = custom_target('elinkskeys.5.html', + input: 'elinkskeys.5.txt', + output: 'elinkskeys.5.html', + depends: [keymap_actions_txt, keymap_defaults_txt], + command: ['@CURRENT_SOURCE_DIR@/tools/asciidoc/asciidoc.py', + '--no-conf', '-f', '@CURRENT_SOURCE_DIR@/tools/asciidoc/asciidoc.conf', + '-f', '@CURRENT_SOURCE_DIR@/tools/asciidoc/xhtml11.conf', + '-f', '@CURRENT_SOURCE_DIR@/asciidoc.conf', + '-a', 'builddir='+meson.current_build_dir()+'/', + '-a', 'elinks_version='+meson.project_version(), + '-b', 'xhtml11', + '--unsafe', '-o', '@OUTPUT@', '@INPUT@']) + +hacking_html = custom_target('hacking.html', + input: 'hacking.txt', + output: 'hacking.html', + command: ['@CURRENT_SOURCE_DIR@/tools/asciidoc/asciidoc.py', + '--no-conf', '-f', '@CURRENT_SOURCE_DIR@/tools/asciidoc/asciidoc.conf', + '-f', '@CURRENT_SOURCE_DIR@/tools/asciidoc/xhtml11.conf', + '-f', '@CURRENT_SOURCE_DIR@/asciidoc.conf', + '-a', 'builddir='+meson.current_build_dir()+'/', + '-a', 'elinks_version='+meson.project_version(), + '-b', 'xhtml11', + '--unsafe', '-o', '@OUTPUT@', '@INPUT@']) + +manual_html = custom_target('manual.html', + input: 'manual.txt', + output: 'manual.html', + depends: features_txt, + command: ['@CURRENT_SOURCE_DIR@/tools/asciidoc/asciidoc.py', + '--no-conf', '-f', '@CURRENT_SOURCE_DIR@/tools/asciidoc/asciidoc.conf', + '-f', '@CURRENT_SOURCE_DIR@/tools/asciidoc/xhtml11.conf', + '-f', '@CURRENT_SOURCE_DIR@/asciidoc.conf', + '-a', 'builddir='+meson.current_build_dir()+'/', + '-a', 'elinks_version='+meson.project_version(), + '-b', 'xhtml11', + '--unsafe', '-o', '@OUTPUT@', '@INPUT@']) + +txt = alias_target('txt', features_txt, keymap_actions_txt, keymap_defaults_txt) +alias_target('xml', option_command_frag_xml, option_config_frag_xml, option_command_frag_xhtml, option_config_frag_xhtml) +alias_target('html', perl_html, perl_hooks_html, elinks_1_html, elinks_conf_5_html, elinkskeys_5_html, hacking_html, manual_html) From 211f79807eff06b1178fd6d1163c6fe3b98c4f03 Mon Sep 17 00:00:00 2001 From: Witold Filipczyk Date: Tue, 22 Sep 2020 19:54:22 +0200 Subject: [PATCH 054/179] [meson] build manual.pdf --- doc/meson.build | 79 ++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 78 insertions(+), 1 deletion(-) diff --git a/doc/meson.build b/doc/meson.build index 2e968021..38b60a22 100644 --- a/doc/meson.build +++ b/doc/meson.build @@ -3,6 +3,7 @@ configure_file(input : 'Doxyfile.in', configuration : conf_data) pod2html = find_program('pod2html', required: false) +dblatex = find_program('dblatex', required: false) perl_html = [] perl_hooks_html = [] @@ -121,6 +122,82 @@ manual_html = custom_target('manual.html', '-b', 'xhtml11', '--unsafe', '-o', '@OUTPUT@', '@INPUT@']) +elinks_1_xml = custom_target('elinks.1.xml', + input: 'elinks.1.txt', + output: 'elinks.1.xml', + depends: option_command_frag_xml, + command: ['@CURRENT_SOURCE_DIR@/tools/asciidoc/asciidoc.py', + '--no-conf', '-f', '@CURRENT_SOURCE_DIR@/tools/asciidoc/asciidoc.conf', + '-f', '@CURRENT_SOURCE_DIR@/tools/asciidoc/docbook.conf', + '-f', '@CURRENT_SOURCE_DIR@/asciidoc.conf', + '-a', 'builddir='+meson.current_build_dir()+'/', + '-a', 'elinks_version='+meson.project_version(), + '-b', 'docbook', + '--unsafe', '-o', '@OUTPUT@', '@INPUT@']) + +elinks_conf_5_xml = custom_target('elinks.conf.5.xml', + input: 'elinks.conf.5.txt', + output: 'elinks.conf.5.xml', + depends: option_config_frag_xml, + command: ['@CURRENT_SOURCE_DIR@/tools/asciidoc/asciidoc.py', + '--no-conf', '-f', '@CURRENT_SOURCE_DIR@/tools/asciidoc/asciidoc.conf', + '-f', '@CURRENT_SOURCE_DIR@/tools/asciidoc/docbook.conf', + '-f', '@CURRENT_SOURCE_DIR@/asciidoc.conf', + '-a', 'builddir='+meson.current_build_dir()+'/', + '-a', 'elinks_version='+meson.project_version(), + '-b', 'docbook', + '--unsafe', '-o', '@OUTPUT@', '@INPUT@']) + +elinkskeys_5_xml = custom_target('elinkskeys.5.xml', + input: 'elinkskeys.5.txt', + output: 'elinkskeys.5.xml', + depends: [keymap_actions_txt, keymap_defaults_txt], + command: ['@CURRENT_SOURCE_DIR@/tools/asciidoc/asciidoc.py', + '--no-conf', '-f', '@CURRENT_SOURCE_DIR@/tools/asciidoc/asciidoc.conf', + '-f', '@CURRENT_SOURCE_DIR@/tools/asciidoc/docbook.conf', + '-f', '@CURRENT_SOURCE_DIR@/asciidoc.conf', + '-a', 'builddir='+meson.current_build_dir()+'/', + '-a', 'elinks_version='+meson.project_version(), + '-b', 'docbook', + '--unsafe', '-o', '@OUTPUT@', '@INPUT@']) + +hacking_xml = custom_target('hacking.xml', + input: 'hacking.txt', + output: 'hacking.xml', + command: ['@CURRENT_SOURCE_DIR@/tools/asciidoc/asciidoc.py', + '--no-conf', '-f', '@CURRENT_SOURCE_DIR@/tools/asciidoc/asciidoc.conf', + '-f', '@CURRENT_SOURCE_DIR@/tools/asciidoc/docbook.conf', + '-f', '@CURRENT_SOURCE_DIR@/asciidoc.conf', + '-a', 'builddir='+meson.current_build_dir()+'/', + '-a', 'elinks_version='+meson.project_version(), + '-b', 'docbook', + '--unsafe', '-o', '@OUTPUT@', '@INPUT@']) + +manual_xml = custom_target('manual.xml', + input: 'manual.txt', + output: 'manual.xml', + depends: features_txt, + command: ['@CURRENT_SOURCE_DIR@/tools/asciidoc/asciidoc.py', + '--no-conf', '-f', '@CURRENT_SOURCE_DIR@/tools/asciidoc/asciidoc.conf', + '-f', '@CURRENT_SOURCE_DIR@/tools/asciidoc/docbook.conf', + '-f', '@CURRENT_SOURCE_DIR@/asciidoc.conf', + '-a', 'builddir='+meson.current_build_dir()+'/', + '-a', 'elinks_version='+meson.project_version(), + '-b', 'docbook', + '--unsafe', '-o', '@OUTPUT@', '@INPUT@']) + +manual_pdf = [] + +if dblatex.found() + manual_pdf = custom_target('manual.pdf', + input: [], + output: 'manual.pdf', + depends: manual_xml, + command: [dblatex, meson.current_build_dir() + '/manual.xml']) +endif + txt = alias_target('txt', features_txt, keymap_actions_txt, keymap_defaults_txt) -alias_target('xml', option_command_frag_xml, option_config_frag_xml, option_command_frag_xhtml, option_config_frag_xhtml) +alias_target('xml', option_command_frag_xml, option_config_frag_xml, option_command_frag_xhtml, option_config_frag_xhtml, + elinks_1_xml, elinks_conf_5_xml, elinkskeys_5_xml, hacking_xml, manual_xml) alias_target('html', perl_html, perl_hooks_html, elinks_1_html, elinks_conf_5_html, elinkskeys_5_html, hacking_html, manual_html) +alias_target('pdf', manual_xml, manual_pdf) From ea35e1f3e664a5444b6ca0902647f7fc414a2cf4 Mon Sep 17 00:00:00 2001 From: Witold Filipczyk Date: Wed, 23 Sep 2020 17:23:06 +0200 Subject: [PATCH 055/179] [meson] build man pages --- doc/meson.build | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/doc/meson.build b/doc/meson.build index 38b60a22..d0bf8857 100644 --- a/doc/meson.build +++ b/doc/meson.build @@ -4,6 +4,7 @@ configure_file(input : 'Doxyfile.in', pod2html = find_program('pod2html', required: false) dblatex = find_program('dblatex', required: false) +xmlto = find_program('xmlto', required: false) perl_html = [] perl_hooks_html = [] @@ -133,6 +134,7 @@ elinks_1_xml = custom_target('elinks.1.xml', '-a', 'builddir='+meson.current_build_dir()+'/', '-a', 'elinks_version='+meson.project_version(), '-b', 'docbook', + '-d', 'manpage', '--unsafe', '-o', '@OUTPUT@', '@INPUT@']) elinks_conf_5_xml = custom_target('elinks.conf.5.xml', @@ -146,6 +148,7 @@ elinks_conf_5_xml = custom_target('elinks.conf.5.xml', '-a', 'builddir='+meson.current_build_dir()+'/', '-a', 'elinks_version='+meson.project_version(), '-b', 'docbook', + '-d', 'manpage', '--unsafe', '-o', '@OUTPUT@', '@INPUT@']) elinkskeys_5_xml = custom_target('elinkskeys.5.xml', @@ -159,8 +162,33 @@ elinkskeys_5_xml = custom_target('elinkskeys.5.xml', '-a', 'builddir='+meson.current_build_dir()+'/', '-a', 'elinks_version='+meson.project_version(), '-b', 'docbook', + '-d', 'manpage', '--unsafe', '-o', '@OUTPUT@', '@INPUT@']) +elinks_1 = [] +elinks_conf_5 = [] +elinkskeys_5 = [] + +if xmlto.found() + elinks_1 = custom_target('elinks.1', + input: [], + output: 'elinks.1', + depends: elinks_1_xml, + command: [xmlto, '-o', meson.current_build_dir(), 'man', meson.current_build_dir()+'/elinks.1.xml']) + + elinks_conf_5 = custom_target('elinks.conf.5', + input: [], + output: 'elinks.conf.5', + depends: elinks_conf_5_xml, + command: [xmlto, '-o', meson.current_build_dir(), 'man', meson.current_build_dir()+'/elinks.conf.5.xml']) + + elinkskeys_5 = custom_target('elinkskeys.5', + input: [], + output: 'elinkskeys.5', + depends: elinkskeys_5_xml, + command: [xmlto, '-o', meson.current_build_dir(), 'man', meson.current_build_dir()+'/elinkskeys.5.xml']) +endif + hacking_xml = custom_target('hacking.xml', input: 'hacking.txt', output: 'hacking.xml', @@ -201,3 +229,4 @@ alias_target('xml', option_command_frag_xml, option_config_frag_xml, option_comm elinks_1_xml, elinks_conf_5_xml, elinkskeys_5_xml, hacking_xml, manual_xml) alias_target('html', perl_html, perl_hooks_html, elinks_1_html, elinks_conf_5_html, elinkskeys_5_html, hacking_html, manual_html) alias_target('pdf', manual_xml, manual_pdf) +alias_target('man', elinks_1, elinks_conf_5, elinkskeys_5) From 76fe703cbae679b3503e1386aedbe37391318c6b Mon Sep 17 00:00:00 2001 From: Witold Filipczyk Date: Wed, 23 Sep 2020 17:31:57 +0200 Subject: [PATCH 056/179] [meson] Build manual.html-chunked --- doc/meson.build | 58 ++++++++++++++++++++++++++++--------------------- 1 file changed, 33 insertions(+), 25 deletions(-) diff --git a/doc/meson.build b/doc/meson.build index d0bf8857..2a97b710 100644 --- a/doc/meson.build +++ b/doc/meson.build @@ -165,30 +165,6 @@ elinkskeys_5_xml = custom_target('elinkskeys.5.xml', '-d', 'manpage', '--unsafe', '-o', '@OUTPUT@', '@INPUT@']) -elinks_1 = [] -elinks_conf_5 = [] -elinkskeys_5 = [] - -if xmlto.found() - elinks_1 = custom_target('elinks.1', - input: [], - output: 'elinks.1', - depends: elinks_1_xml, - command: [xmlto, '-o', meson.current_build_dir(), 'man', meson.current_build_dir()+'/elinks.1.xml']) - - elinks_conf_5 = custom_target('elinks.conf.5', - input: [], - output: 'elinks.conf.5', - depends: elinks_conf_5_xml, - command: [xmlto, '-o', meson.current_build_dir(), 'man', meson.current_build_dir()+'/elinks.conf.5.xml']) - - elinkskeys_5 = custom_target('elinkskeys.5', - input: [], - output: 'elinkskeys.5', - depends: elinkskeys_5_xml, - command: [xmlto, '-o', meson.current_build_dir(), 'man', meson.current_build_dir()+'/elinkskeys.5.xml']) -endif - hacking_xml = custom_target('hacking.xml', input: 'hacking.txt', output: 'hacking.xml', @@ -214,6 +190,37 @@ manual_xml = custom_target('manual.xml', '-b', 'docbook', '--unsafe', '-o', '@OUTPUT@', '@INPUT@']) +elinks_1 = [] +elinks_conf_5 = [] +elinkskeys_5 = [] +manual_html_chunked = [] + +if xmlto.found() + elinks_1 = custom_target('elinks.1', + input: [], + output: 'elinks.1', + depends: elinks_1_xml, + command: [xmlto, '-o', meson.current_build_dir(), 'man', meson.current_build_dir()+'/elinks.1.xml']) + + elinks_conf_5 = custom_target('elinks.conf.5', + input: [], + output: 'elinks.conf.5', + depends: elinks_conf_5_xml, + command: [xmlto, '-o', meson.current_build_dir(), 'man', meson.current_build_dir()+'/elinks.conf.5.xml']) + + elinkskeys_5 = custom_target('elinkskeys.5', + input: [], + output: 'elinkskeys.5', + depends: elinkskeys_5_xml, + command: [xmlto, '-o', meson.current_build_dir(), 'man', meson.current_build_dir()+'/elinkskeys.5.xml']) + + manual_html_chunked = custom_target('manual.html-chunked', + input: [], + output: 'manual.html-chunked', + depends: manual_xml, + command: [xmlto, '-o', meson.current_build_dir() + '/manual.html-chunked', 'html', meson.current_build_dir()+'/manual.xml']) +endif + manual_pdf = [] if dblatex.found() @@ -227,6 +234,7 @@ endif txt = alias_target('txt', features_txt, keymap_actions_txt, keymap_defaults_txt) alias_target('xml', option_command_frag_xml, option_config_frag_xml, option_command_frag_xhtml, option_config_frag_xhtml, elinks_1_xml, elinks_conf_5_xml, elinkskeys_5_xml, hacking_xml, manual_xml) -alias_target('html', perl_html, perl_hooks_html, elinks_1_html, elinks_conf_5_html, elinkskeys_5_html, hacking_html, manual_html) +alias_target('html', perl_html, perl_hooks_html, elinks_1_html, elinks_conf_5_html, elinkskeys_5_html, hacking_html, manual_html, + manual_html_chunked) alias_target('pdf', manual_xml, manual_pdf) alias_target('man', elinks_1, elinks_conf_5, elinkskeys_5) From a0d136051d5d23db6b6c6b871d948be7623e9d08 Mon Sep 17 00:00:00 2001 From: Witold Filipczyk Date: Wed, 23 Sep 2020 18:05:08 +0200 Subject: [PATCH 057/179] [meson] build api using doxygen --- doc/Doxyfile.in | 2 +- doc/meson.build | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/doc/Doxyfile.in b/doc/Doxyfile.in index 6e5c8df4..b1b3a76c 100644 --- a/doc/Doxyfile.in +++ b/doc/Doxyfile.in @@ -7,7 +7,7 @@ DOXYFILE_ENCODING = UTF-8 PROJECT_NAME = ELinks PROJECT_NUMBER = @VERSION@ -OUTPUT_DIRECTORY = api +OUTPUT_DIRECTORY = $(OUTPUT_DIRECTORY)api CREATE_SUBDIRS = NO OUTPUT_LANGUAGE = English BRIEF_MEMBER_DESC = YES diff --git a/doc/meson.build b/doc/meson.build index 2a97b710..c064a2d1 100644 --- a/doc/meson.build +++ b/doc/meson.build @@ -2,8 +2,9 @@ configure_file(input : 'Doxyfile.in', output : 'Doxyfile', configuration : conf_data) -pod2html = find_program('pod2html', required: false) dblatex = find_program('dblatex', required: false) +doxygen = find_program('doxygen', required: false) +pod2html = find_program('pod2html', required: false) xmlto = find_program('xmlto', required: false) perl_html = [] @@ -231,6 +232,14 @@ if dblatex.found() command: [dblatex, meson.current_build_dir() + '/manual.xml']) endif +doxygen_api = [] +if doxygen.found() + doxygen_api = custom_target('api', + input: [], + output: 'api', + command: ['OUTPUT_DIRECTORY='+meson.current_build_dir()+'/', doxygen, meson.current_build_dir()+'/Doxyfile']) +endif + txt = alias_target('txt', features_txt, keymap_actions_txt, keymap_defaults_txt) alias_target('xml', option_command_frag_xml, option_config_frag_xml, option_command_frag_xhtml, option_config_frag_xhtml, elinks_1_xml, elinks_conf_5_xml, elinkskeys_5_xml, hacking_xml, manual_xml) From 516cee7706ead99fc988fa615c8f17c5cc6e4f11 Mon Sep 17 00:00:00 2001 From: sgerwk Date: Sat, 26 Sep 2020 20:12:44 +0200 Subject: [PATCH 058/179] truncate data: uri passed to the external viewer --- src/session/download.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/session/download.c b/src/session/download.c index f70904fb..29862a1a 100644 --- a/src/session/download.c +++ b/src/session/download.c @@ -1035,6 +1035,7 @@ subst_file(unsigned char *prog, unsigned char *file, unsigned char *uri) * data from stdin instead of a file. */ int input = 1; char *replace, *original = "% "; + int truncate; if (!init_string(&name)) return NULL; @@ -1048,10 +1049,14 @@ subst_file(unsigned char *prog, unsigned char *file, unsigned char *uri) if (*prog == '%') { prog++; + truncate = 0; if (*prog == 'f' || *prog == ' ' || *prog == '\0') replace = file; - else if (*prog == 'u') + else if (*prog == 'u') { replace = uri; + if (! memcmp(uri, "data:", strlen("data:"))) + truncate = 1; + } else if (*prog == '%') replace = "%"; else { @@ -1073,7 +1078,13 @@ subst_file(unsigned char *prog, unsigned char *file, unsigned char *uri) cygwin_conv_to_full_win32_path(replace, new_path); add_to_string(&name, new_path); #else - add_shell_quoted_to_string(&name, replace, strlen(replace)); + if (! truncate) + add_shell_quoted_to_string(&name, replace, + strlen(replace)); + else { + add_shell_quoted_to_string(&name, replace, 40); + add_shell_quoted_to_string(&name, "...", 3); + } #endif prog++; } From ae38be0fe03a7f8722a7512e7086b2037bff5034 Mon Sep 17 00:00:00 2001 From: sgerwk Date: Sun, 27 Sep 2020 00:40:07 +0200 Subject: [PATCH 059/179] use sizeof instead of strlen for two constant strings --- src/session/download.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/session/download.c b/src/session/download.c index 29862a1a..1a1a3765 100644 --- a/src/session/download.c +++ b/src/session/download.c @@ -1054,7 +1054,7 @@ subst_file(unsigned char *prog, unsigned char *file, unsigned char *uri) replace = file; else if (*prog == 'u') { replace = uri; - if (! memcmp(uri, "data:", strlen("data:"))) + if (!memcmp(uri, "data:", sizeof("data:") - 1)) truncate = 1; } else if (*prog == '%') @@ -1083,7 +1083,8 @@ subst_file(unsigned char *prog, unsigned char *file, unsigned char *uri) strlen(replace)); else { add_shell_quoted_to_string(&name, replace, 40); - add_shell_quoted_to_string(&name, "...", 3); + add_shell_quoted_to_string(&name, + "...", sizeof("...") - 1); } #endif prog++; From 794e0078e7866ea2a4bb8253e9614e1d8ee6aa1a Mon Sep 17 00:00:00 2001 From: sgerwk Date: Sun, 27 Sep 2020 19:31:14 +0200 Subject: [PATCH 060/179] do not truncate a data: uri already shorter than 40 chars --- src/session/download.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/session/download.c b/src/session/download.c index 1a1a3765..c3ad1d7d 100644 --- a/src/session/download.c +++ b/src/session/download.c @@ -1036,6 +1036,7 @@ subst_file(unsigned char *prog, unsigned char *file, unsigned char *uri) int input = 1; char *replace, *original = "% "; int truncate; + int tlen = 40; if (!init_string(&name)) return NULL; @@ -1078,11 +1079,12 @@ subst_file(unsigned char *prog, unsigned char *file, unsigned char *uri) cygwin_conv_to_full_win32_path(replace, new_path); add_to_string(&name, new_path); #else - if (! truncate) - add_shell_quoted_to_string(&name, replace, - strlen(replace)); + if (! truncate || strlen(replace) <= tlen) + add_shell_quoted_to_string(&name, + replace, strlen(replace)); else { - add_shell_quoted_to_string(&name, replace, 40); + add_shell_quoted_to_string(&name, + replace, tlen); add_shell_quoted_to_string(&name, "...", sizeof("...") - 1); } From 90a141be2b0aa79bbc18976da7809921eea43d4e Mon Sep 17 00:00:00 2001 From: sgerwk Date: Mon, 28 Sep 2020 20:10:55 +0200 Subject: [PATCH 061/179] meaningful default save name for data: uri content --- src/protocol/uri.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/protocol/uri.c b/src/protocol/uri.c index 2271892b..56fbe0cf 100644 --- a/src/protocol/uri.c +++ b/src/protocol/uri.c @@ -611,6 +611,14 @@ add_uri_to_string(struct string *string, const struct uri *uri, if (!uri->datalen) return string; + if (uri->protocol == PROTOCOL_DATA) { + char *e; + add_bytes_to_string(string, + "data", sizeof("data") - 1); + e = get_extension_from_uri((struct uri *) uri); + return add_bytes_to_string(string, e, strlen(e)); + } + for (pos = filename; *pos && !end_of_dir(*pos); pos++) if (wants(URI_FILENAME) && is_uri_dir_sep(uri, *pos)) filename = pos + 1; @@ -1316,6 +1324,10 @@ get_translated_uri(unsigned char *uristring, unsigned char *cwd) return uri; } +#define ADD_EXTENSION_FROM_TYPE(string, type, ext) \ + if (!memcmp(uri->data, type ";", sizeof(type ";") - 1) || \ + !memcmp(uri->data, type ",", sizeof(type ",") - 1)) \ + return strdup("." ext); unsigned char * get_extension_from_uri(struct uri *uri) @@ -1326,6 +1338,15 @@ get_extension_from_uri(struct uri *uri) assert(pos); + if (uri->protocol == PROTOCOL_DATA) { + ADD_EXTENSION_FROM_TYPE(uri->data, "image/gif", "gif") + ADD_EXTENSION_FROM_TYPE(uri->data, "image/jpeg", "jpg") + ADD_EXTENSION_FROM_TYPE(uri->data, "image/png", "png") + ADD_EXTENSION_FROM_TYPE(uri->data, "text/plain", "txt") + ADD_EXTENSION_FROM_TYPE(uri->data, "text/html", "html") + return ""; + } + for (; *pos && !end_of_dir(*pos); pos++) { if (!afterslash && !extension && *pos == '.') { extension = pos; From 526b0d0ff914900bb962a61816f5b5f7c5588be0 Mon Sep 17 00:00:00 2001 From: sgerwk Date: Tue, 29 Sep 2020 11:36:36 +0200 Subject: [PATCH 062/179] use appropriate functions for string allocation and concatenation --- src/protocol/uri.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/protocol/uri.c b/src/protocol/uri.c index 56fbe0cf..1078531d 100644 --- a/src/protocol/uri.c +++ b/src/protocol/uri.c @@ -613,10 +613,11 @@ add_uri_to_string(struct string *string, const struct uri *uri, if (uri->protocol == PROTOCOL_DATA) { char *e; - add_bytes_to_string(string, - "data", sizeof("data") - 1); + add_to_string(string, "data"); e = get_extension_from_uri((struct uri *) uri); - return add_bytes_to_string(string, e, strlen(e)); + add_to_string(string, e); + mem_free(e); + return string; } for (pos = filename; *pos && !end_of_dir(*pos); pos++) @@ -1327,7 +1328,7 @@ get_translated_uri(unsigned char *uristring, unsigned char *cwd) #define ADD_EXTENSION_FROM_TYPE(string, type, ext) \ if (!memcmp(uri->data, type ";", sizeof(type ";") - 1) || \ !memcmp(uri->data, type ",", sizeof(type ",") - 1)) \ - return strdup("." ext); + return stracpy("." ext); unsigned char * get_extension_from_uri(struct uri *uri) @@ -1344,7 +1345,7 @@ get_extension_from_uri(struct uri *uri) ADD_EXTENSION_FROM_TYPE(uri->data, "image/png", "png") ADD_EXTENSION_FROM_TYPE(uri->data, "text/plain", "txt") ADD_EXTENSION_FROM_TYPE(uri->data, "text/html", "html") - return ""; + return stracpy(""); } for (; *pos && !end_of_dir(*pos); pos++) { From 2d80e93146a902c0fa133d5df93fc58933d245b3 Mon Sep 17 00:00:00 2001 From: Witold Filipczyk Date: Tue, 29 Sep 2020 11:59:11 +0200 Subject: [PATCH 063/179] [uri] Check for null. Closes #72 --- src/protocol/uri.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/protocol/uri.c b/src/protocol/uri.c index 1078531d..b92d6057 100644 --- a/src/protocol/uri.c +++ b/src/protocol/uri.c @@ -615,8 +615,11 @@ add_uri_to_string(struct string *string, const struct uri *uri, char *e; add_to_string(string, "data"); e = get_extension_from_uri((struct uri *) uri); - add_to_string(string, e); - mem_free(e); + + if (e) { + add_to_string(string, e); + mem_free(e); + } return string; } From 0c337dd30adc63092ebede52e7d529f59f36f91d Mon Sep 17 00:00:00 2001 From: Witold Filipczyk Date: Wed, 30 Sep 2020 19:58:13 +0200 Subject: [PATCH 064/179] [meson] Added elinks as the first dependency to make sure dependencies are not empty --- doc/meson.build | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/doc/meson.build b/doc/meson.build index c064a2d1..1da7c5db 100644 --- a/doc/meson.build +++ b/doc/meson.build @@ -240,10 +240,10 @@ if doxygen.found() command: ['OUTPUT_DIRECTORY='+meson.current_build_dir()+'/', doxygen, meson.current_build_dir()+'/Doxyfile']) endif -txt = alias_target('txt', features_txt, keymap_actions_txt, keymap_defaults_txt) -alias_target('xml', option_command_frag_xml, option_config_frag_xml, option_command_frag_xhtml, option_config_frag_xhtml, +txt = alias_target('txt', elinks, features_txt, keymap_actions_txt, keymap_defaults_txt) +alias_target('xml', elinks, option_command_frag_xml, option_config_frag_xml, option_command_frag_xhtml, option_config_frag_xhtml, elinks_1_xml, elinks_conf_5_xml, elinkskeys_5_xml, hacking_xml, manual_xml) -alias_target('html', perl_html, perl_hooks_html, elinks_1_html, elinks_conf_5_html, elinkskeys_5_html, hacking_html, manual_html, +alias_target('html', elinks, perl_html, perl_hooks_html, elinks_1_html, elinks_conf_5_html, elinkskeys_5_html, hacking_html, manual_html, manual_html_chunked) -alias_target('pdf', manual_xml, manual_pdf) -alias_target('man', elinks_1, elinks_conf_5, elinkskeys_5) +alias_target('pdf', elinks, manual_xml, manual_pdf) +alias_target('man', elinks, elinks_1, elinks_conf_5, elinkskeys_5) From 1f57e72212b7d4c66b6c48ea4055498f08b03fa8 Mon Sep 17 00:00:00 2001 From: Witold Filipczyk Date: Mon, 5 Oct 2020 20:14:55 +0200 Subject: [PATCH 065/179] [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. --- configure.ac | 15 +-- contrib/smjs/smartprefixes_classic.js | 2 +- contrib/smjs/smartprefixes_common.js | 16 +-- meson.build | 35 ++--- src/bfu/button.h | 8 ++ src/bfu/checkbox.h | 8 ++ src/bfu/common.h | 8 ++ src/bfu/dialog.h | 7 + src/bfu/group.h | 8 ++ src/bfu/hierbox.h | 8 ++ src/bfu/hotkey.h | 8 ++ src/bfu/inpfield.h | 7 + src/bfu/inphist.h | 8 ++ src/bfu/leds.h | 9 ++ src/bfu/listbox.h | 8 ++ src/bfu/listmenu.h | 8 ++ src/bfu/menu.h | 8 ++ src/bfu/msgbox.h | 7 + src/bfu/style.h | 8 ++ src/bfu/text.h | 8 ++ src/bfu/widget.h | 7 + src/bookmarks/backend/common.h | 8 ++ src/bookmarks/backend/default.h | 8 ++ src/bookmarks/backend/xbel.h | 8 ++ src/bookmarks/bookmarks.h | 8 ++ src/bookmarks/dialogs.h | 8 ++ src/cache/cache.h | 8 ++ src/cache/dialogs.h | 8 ++ src/config/cmdline.h | 8 ++ src/config/conf.h | 8 ++ src/config/dialogs.h | 8 ++ src/config/domain.h | 8 ++ src/config/home.h | 8 ++ src/config/kbdbind.h | 8 ++ src/config/options.h | 8 ++ src/config/opttypes.h | 8 ++ src/config/timer.h | 8 ++ src/config/urlhist.h | 8 ++ src/cookies/cookies.h | 8 ++ src/cookies/dialogs.h | 8 ++ src/cookies/parser.h | 8 ++ src/cookies/path.c | 1 + src/cookies/path.h | 8 ++ src/dialogs/document.h | 8 ++ src/dialogs/download.h | 8 ++ src/dialogs/edit.h | 8 ++ src/dialogs/exmode.h | 8 ++ src/dialogs/info.h | 8 ++ src/dialogs/menu.h | 8 ++ src/dialogs/options.h | 8 ++ src/dialogs/progress.c | 1 + src/dialogs/progress.h | 8 ++ src/dialogs/status.h | 8 ++ src/document/css/apply.h | 8 ++ src/document/css/css.h | 8 ++ src/document/css/parser.h | 9 ++ src/document/css/property.h | 8 ++ src/document/css/scanner.h | 8 ++ src/document/css/stylesheet.h | 8 ++ src/document/css/value.h | 8 ++ src/document/docdata.h | 8 ++ src/document/document.h | 8 ++ src/document/dom/renderer.h | 8 ++ src/document/dom/rss.h | 7 + src/document/dom/source.h | 7 + src/document/dom/util.h | 7 + src/document/format.h | 8 ++ src/document/forms.h | 8 ++ src/document/html/frames.h | 8 ++ src/document/html/internal.h | 8 ++ src/document/html/parse-meta-refresh.h | 8 ++ src/document/html/parser.h | 8 ++ src/document/html/parser/forms.h | 8 ++ src/document/html/parser/general.h | 8 ++ src/document/html/parser/link.h | 8 ++ src/document/html/parser/parse.h | 8 ++ src/document/html/parser/stack.h | 8 ++ src/document/html/parser/table.h | 8 ++ src/document/html/renderer.h | 9 ++ src/document/html/tables.h | 8 ++ src/document/libdom/renderer.h | 8 ++ src/document/options.h | 9 ++ src/document/plain/renderer.h | 8 ++ src/document/refresh.h | 8 ++ src/document/renderer.c | 2 +- src/document/renderer.h | 8 ++ src/document/view.h | 7 + src/dom/code.h | 8 ++ src/dom/configuration.h | 8 ++ src/dom/css/scanner.h | 8 ++ src/dom/node.h | 8 ++ src/dom/scanner.h | 8 ++ src/dom/select.h | 7 + src/dom/sgml/docbook/docbook.h | 8 ++ src/dom/sgml/dump.h | 8 ++ src/dom/sgml/html/html.h | 8 ++ src/dom/sgml/parser.h | 8 ++ src/dom/sgml/rss/rss.h | 8 ++ src/dom/sgml/scanner.h | 8 ++ src/dom/sgml/sgml.h | 8 ++ src/dom/sgml/xbel/xbel.h | 8 ++ src/dom/stack.h | 8 ++ src/dom/string.h | 8 ++ src/ecmascript/ecmascript.h | 4 - src/ecmascript/empty.cpp | 0 src/ecmascript/meson.build | 2 +- src/ecmascript/spidermonkey-shared.c | 2 +- src/ecmascript/spidermonkey-shared.h | 4 +- src/ecmascript/spidermonkey.c | 76 +++-------- src/ecmascript/spidermonkey/Makefile | 4 +- src/ecmascript/spidermonkey/document.c | 26 ++-- src/ecmascript/spidermonkey/form.c | 169 ++++++++++++------------ src/ecmascript/spidermonkey/location.c | 12 +- src/ecmascript/spidermonkey/meson.build | 5 +- src/ecmascript/spidermonkey/navigator.c | 26 ++-- src/ecmascript/spidermonkey/unibar.c | 12 +- src/ecmascript/spidermonkey/window.c | 44 +++--- src/encoding/brotli.h | 8 ++ src/encoding/bzip2.h | 8 ++ src/encoding/deflate.h | 8 ++ src/encoding/encoding.h | 8 ++ src/encoding/lzma.h | 8 ++ src/encoding/zstd.h | 8 ++ src/formhist/dialogs.h | 8 ++ src/formhist/formhist.h | 8 ++ src/globhist/dialogs.h | 8 ++ src/globhist/globhist.h | 8 ++ src/intl/charsets.h | 8 ++ src/intl/gettext/dcigettext.c | 1 + src/intl/gettext/gettext.h | 8 ++ src/intl/gettext/gettextP.h | 9 ++ src/intl/gettext/libgettext.h | 8 ++ src/intl/gettext/libgnuintl.h | 8 ++ src/intl/gettext/libintl.h | 8 ++ src/intl/gettext/loadinfo.h | 8 ++ src/intl/uni_7b.inc | 2 +- src/main/event.h | 7 + src/main/interlink.h | 8 ++ src/main/main.c | 1 + src/main/main.h | 8 ++ src/main/module.h | 8 ++ src/main/object.h | 8 ++ src/main/select.h | 9 ++ src/main/timer.h | 8 ++ src/main/version.h | 8 ++ src/meson.build | 2 +- src/mime/backend/common.h | 8 ++ src/mime/backend/default.h | 8 ++ src/mime/backend/mailcap.h | 8 ++ src/mime/backend/mimetypes.h | 8 ++ src/mime/dialogs.h | 8 ++ src/mime/mime.h | 8 ++ src/network/connection.h | 8 ++ src/network/dns.h | 8 ++ src/network/progress.h | 8 ++ src/network/socket.h | 8 ++ src/network/ssl/match-hostname.h | 8 ++ src/network/ssl/socket.h | 9 ++ src/network/ssl/ssl.h | 11 +- src/network/state.h | 8 ++ src/osdep/beos/beos.h | 8 ++ src/osdep/beos/overrides.h | 8 ++ src/osdep/beos/sysinfo.h | 8 ++ src/osdep/generic.h | 15 ++- src/osdep/getifaddrs.h | 8 ++ src/osdep/newwin.h | 8 ++ src/osdep/os2/os2.h | 8 ++ src/osdep/os2/sysinfo.h | 8 ++ src/osdep/osdep.h | 16 +++ src/osdep/riscos/sysinfo.h | 9 ++ src/osdep/signals.h | 8 ++ src/osdep/stub.h | 8 ++ src/osdep/sysname.h | 8 ++ src/osdep/unix/sysinfo.h | 8 ++ src/osdep/win32/overrides.h | 7 + src/osdep/win32/vt100.h | 8 ++ src/osdep/win32/win32.h | 8 ++ src/protocol/about.h | 8 ++ src/protocol/auth/auth.h | 8 ++ src/protocol/auth/dialogs.h | 8 ++ src/protocol/auth/digest.h | 8 ++ src/protocol/bittorrent/bencoding.h | 8 ++ src/protocol/bittorrent/bittorrent.h | 8 ++ src/protocol/bittorrent/common.h | 15 ++- src/protocol/bittorrent/connection.h | 8 ++ src/protocol/bittorrent/dialogs.c | 1 + src/protocol/bittorrent/dialogs.h | 8 ++ src/protocol/bittorrent/peerconnect.h | 8 ++ src/protocol/bittorrent/peerwire.h | 8 ++ src/protocol/bittorrent/piececache.h | 8 ++ src/protocol/bittorrent/tracker.h | 8 ++ src/protocol/common.h | 8 ++ src/protocol/data.h | 8 ++ src/protocol/date.h | 8 ++ src/protocol/file/cgi.h | 8 ++ src/protocol/file/file.h | 8 ++ src/protocol/file/mailcap.h | 8 ++ src/protocol/finger/finger.h | 7 + src/protocol/fsp/fsp.c | 8 ++ src/protocol/fsp/fsp.h | 8 ++ src/protocol/ftp/ftp.h | 8 ++ src/protocol/ftp/parse.h | 8 ++ src/protocol/gopher/gopher.h | 7 + src/protocol/header.h | 8 ++ src/protocol/http/blacklist.h | 8 ++ src/protocol/http/codes.h | 8 ++ src/protocol/http/http.h | 8 ++ src/protocol/http/http_negotiate.h | 7 + src/protocol/http/post.h | 8 ++ src/protocol/nntp/connection.h | 8 ++ src/protocol/nntp/nntp.h | 8 ++ src/protocol/nntp/response.h | 8 ++ src/protocol/protocol.h | 8 ++ src/protocol/proxy.h | 8 ++ src/protocol/rewrite/rewrite.h | 8 ++ src/protocol/smb/smb.h | 9 ++ src/protocol/uri.h | 8 ++ src/protocol/user.h | 8 ++ src/scripting/guile/core.h | 8 ++ src/scripting/guile/guile.h | 8 ++ src/scripting/guile/hooks.h | 8 ++ src/scripting/lua/core.c | 20 +++ src/scripting/lua/core.h | 8 ++ src/scripting/lua/hooks.c | 20 +++ src/scripting/lua/hooks.h | 8 ++ src/scripting/lua/lua.h | 8 ++ src/scripting/perl/core.h | 8 ++ src/scripting/perl/hooks.h | 8 ++ src/scripting/perl/perl.h | 8 ++ src/scripting/python/core.h | 8 ++ src/scripting/python/dialogs.c | 1 + src/scripting/python/dialogs.h | 8 ++ src/scripting/python/document.c | 1 + src/scripting/python/document.h | 8 ++ src/scripting/python/hooks.h | 8 ++ src/scripting/python/keybinding.c | 3 +- src/scripting/python/keybinding.h | 8 ++ src/scripting/python/load.c | 1 + src/scripting/python/load.h | 8 ++ src/scripting/python/menu.c | 1 + src/scripting/python/menu.h | 8 ++ src/scripting/python/open.c | 1 + src/scripting/python/open.h | 8 ++ src/scripting/python/python.h | 8 ++ src/scripting/ruby/core.h | 12 +- src/scripting/ruby/hooks.h | 8 ++ src/scripting/ruby/ruby.h | 8 ++ src/scripting/scripting.h | 8 ++ src/scripting/smjs/action_object.c | 30 +++-- src/scripting/smjs/bookmarks.c | 60 +++++---- src/scripting/smjs/cache_object.c | 49 +++---- src/scripting/smjs/core.c | 5 +- src/scripting/smjs/elinks_object.c | 43 +++--- src/scripting/smjs/global_object.c | 11 +- src/scripting/smjs/globhist.c | 64 ++++----- src/scripting/smjs/keybinding.c | 30 +++-- src/scripting/smjs/session_object.c | 64 +++++---- src/scripting/smjs/terminal_object.c | 26 ++-- src/scripting/smjs/view_state_object.c | 29 ++-- src/session/download.h | 8 ++ src/session/history.h | 8 ++ src/session/location.h | 8 ++ src/session/session.h | 8 ++ src/session/task.h | 8 ++ src/terminal/color.h | 9 ++ src/terminal/draw.h | 8 ++ src/terminal/event.h | 7 + src/terminal/hardio.h | 8 ++ src/terminal/itrm.h | 7 + src/terminal/kbd.h | 7 + src/terminal/mouse.h | 7 + src/terminal/screen.h | 7 + src/terminal/tab.h | 8 ++ src/terminal/terminal.h | 8 ++ src/terminal/terminfo.h | 9 ++ src/terminal/window.c | 2 +- src/terminal/window.h | 10 +- src/util/base64.h | 8 ++ src/util/bitfield.h | 9 +- src/util/box.h | 7 + src/util/color.h | 8 ++ src/util/conv.h | 8 ++ src/util/env.h | 7 + src/util/error.h | 17 +++ src/util/fastfind.h | 8 ++ src/util/file.h | 8 ++ src/util/hash.h | 8 ++ src/util/lists.h | 7 + src/util/math.h | 7 + src/util/md5.h | 9 ++ src/util/memdebug.h | 8 ++ src/util/memlist.h | 8 ++ src/util/memory.h | 8 ++ src/util/profile.h | 9 ++ src/util/random.h | 8 ++ src/util/scanner.h | 8 ++ src/util/secsave.h | 8 ++ src/util/sha1.h | 9 ++ src/util/snprintf.h | 14 ++ src/util/string.h | 8 ++ src/util/test.h | 8 ++ src/util/time.h | 8 ++ src/viewer/action.h | 8 ++ src/viewer/dump/dump-color-mode.h | 11 ++ src/viewer/dump/dump-specialized.h | 8 ++ src/viewer/dump/dump.c | 1 + src/viewer/dump/dump.h | 8 ++ src/viewer/text/draw.h | 8 ++ src/viewer/text/form.h | 8 ++ src/viewer/text/link.h | 8 ++ src/viewer/text/marks.h | 8 ++ src/viewer/text/search.c | 11 +- src/viewer/text/search.h | 8 ++ src/viewer/text/textarea.h | 8 ++ src/viewer/text/view.h | 8 ++ src/viewer/text/vs.h | 8 ++ src/viewer/timer.h | 8 ++ src/viewer/viewer.h | 8 ++ 318 files changed, 2677 insertions(+), 462 deletions(-) create mode 100644 src/ecmascript/empty.cpp diff --git a/configure.ac b/configure.ac index 1252672e..e1b5dd44 100644 --- a/configure.ac +++ b/configure.ac @@ -60,6 +60,7 @@ echo "Feature summary:" > features.log # =================================================================== AC_PROG_CC +AC_PROG_CXX AC_CHECK_TOOL([LD], [ld]) AC_PROG_AWK AC_PATH_PROGS(AWK, "$AWK") @@ -611,17 +612,18 @@ case "$with_spidermonkey" in ;; esac -for package in mozjs-17.0; do +for package in mozjs-24; do if test -n "$CONFIG_SPIDERMONKEY"; then break else - AC_MSG_CHECKING([for SpiderMonkey (mozjs-17.0) in pkg-config $package]) + AC_MSG_CHECKING([for SpiderMonkey (mozjs-24) in pkg-config $package]) if $PKG_CONFIG --cflags --libs $package > /dev/null 2>&AS_MESSAGE_LOG_FD; then SPIDERMONKEY_LIBS="$($PKG_CONFIG --libs $package)" SPIDERMONKEY_CFLAGS="$($PKG_CONFIG --cflags $package)" LIBS="$SPIDERMONKEY_LIBS $LIBS_X" CFLAGS="$CFLAGS_X $SPIDERMONKEY_CFLAGS" CPPFLAGS="$CPPFLAGS_X $SPIDERMONKEY_CFLAGS" + AC_LANG_PUSH([C++]) AC_LINK_IFELSE( [AC_LANG_PROGRAM([[ /* mozilla-js.pc may have -DXP_UNIX or similar in Cflags. @@ -635,6 +637,7 @@ for package in mozjs-17.0; do AC_MSG_RESULT([yes])], [# Leave CONFIG_SPIDERMONKEY blank, to continue the search. AC_MSG_RESULT([found but unusable])]) + AC_LANG_POP([C++]) else AC_MSG_RESULT([no]) fi @@ -646,14 +649,6 @@ if test -z "$CONFIG_SPIDERMONKEY"; then CONFIG_SPIDERMONKEY=no fi -if test "$CONFIG_SPIDERMONKEY" = "yes"; then - # LIBS, CFLAGS, and CPPFLAGS still include the SpiderMonkey options. - AC_CHECK_FUNCS([JS_ReportAllocationOverflow]) - AC_CHECK_FUNCS([JS_SetBranchCallback]) - AC_CHECK_FUNCS([JS_TriggerOperationCallback], [HAVE_JS_TRIGGEROPERATIONCALLBACK=yes]) -elif test -n "$with_spidermonkey" && test "x$with_spidermonkey" != "xno"; then - AC_MSG_WARN([SpiderMonkey was not found even though you specified --with-spidermonkey.]) -fi EL_RESTORE_FLAGS if test "x$CONFIG_SPIDERMONKEY" = xyes; then diff --git a/contrib/smjs/smartprefixes_classic.js b/contrib/smjs/smartprefixes_classic.js index 848bcd86..3b489bda 100644 --- a/contrib/smjs/smartprefixes_classic.js +++ b/contrib/smjs/smartprefixes_classic.js @@ -44,7 +44,7 @@ var smartprefixes = { sdp: "http://www.slashdot.org/search.pl?query=%s&op=polls", sdj: "http://www.slashdot.org/search.pl?query=%s&op=journals", dbug: "http://bugs.debian.org/%s", - dix: "http://dix.osola.com/index.de.php?trans=1&search=%s", + //dix: "http://dix.osola.com/index.de.php?trans=1&search=%s", dixgram: "http://dix.osola.com/v.php?language=german&search=%s", dpkg: "http://packages.debian.org/%s", emacs: "http://www.emacswiki.org/cgi-bin/wiki.pl?search=%s", diff --git a/contrib/smjs/smartprefixes_common.js b/contrib/smjs/smartprefixes_common.js index aaebfa4f..945bad6e 100644 --- a/contrib/smjs/smartprefixes_common.js +++ b/contrib/smjs/smartprefixes_common.js @@ -102,15 +102,15 @@ function gmane (url) } /* javascript:bugzilla('http://bugzilla.elinks.cz/', "%s"); */ -function bugzilla (base_url, arguments) +function bugzilla (base_url, args) { - if (!arguments || arguments == '') return base_url; + if (!args || args == '') return base_url; - if (arguments.match(/^[\d]+$/)) - return base_url + 'show_bug.cgi?id=' + arguments; + if (args.match(/^[\d]+$/)) + return base_url + 'show_bug.cgi?id=' + args; return base_url + 'buglist.cgi?short_desc_type=allwordssubstr' - + '&short_desc=' + escape(arguments); + + '&short_desc=' + escape(args); } /* javascript:babelfish("%s"); */ @@ -130,18 +130,18 @@ function babelfish (url) "Deutsch": 'de', "english": 'en', "french": 'fr', - "fran\231ais": 'fr', + "fran\x99ais": 'fr', "greek": 'el', "italian": 'it', "italiano": 'it', "japanese": 'ja', "korean": 'ko', "portuguese": 'pt', - "portugu\234s": 'pt', + "portugu\x9Cs": 'pt', "russian": 'ru', "spanish": 'es', "espanol": 'es', - "espa\241ol": 'es', + "espa\xA1ol": 'es', }; var parts = url.match(/^(\S+)\s+(\S+)\s*(.*)/); diff --git a/meson.build b/meson.build index 90210338..2cdebf09 100644 --- a/meson.build +++ b/meson.build @@ -1,4 +1,4 @@ -project('felinks', 'c', version:'0.14.GIT', license:'GPLv2') +project('felinks', ['c','cpp'], version:'0.14.GIT', license:'GPLv2') srcs=[] srcdir = meson.source_root() @@ -92,12 +92,15 @@ conf_data.set('CONFIG_LIBDOM', get_option('libdom')) #CONFIG_XBEL_BOOKMARKS=true #CONFIG_COOKIES=true #CONFIG_DOM=true -if conf_data.get('CONFIG_SCRIPTING_SPIDERMONKEY') or conf_data.get('CONFIG_ECMASCRIPT_SMJS') +if conf_data.get('CONFIG_SCRIPTING_SPIDERMONKEY') == 1 or conf_data.get('CONFIG_ECMASCRIPT_SMJS') conf_data.set('CONFIG_ECMASCRIPT', true) else conf_data.set('CONFIG_ECMASCRIPT', false) endif conf_data.set('CONFIG_ECMASCRIPT_SMJS_HEARTBEAT', true) + + + #CONFIG_FORMHIST', true) #CONFIG_GLOBHIST', true) conf_data.set('CONFIG_SCRIPTING', true) @@ -154,6 +157,12 @@ conf_data.set10('HAVE_SYS_TIME_H', 1) compiler = meson.get_compiler('c') +if conf_data.get('CONFIG_ECMASCRIPT') + extracflags = ['-xc++', '-fpermissive'] +else + extracflags = [] +endif + conf_data.set10('HAVE_WCHAR_H', compiler.has_header('wchar.h')) conf_data.set10('HAVE_WCTYPE_H', compiler.has_header('wctype.h')) conf_data.set10('HAVE_FCNTL_H', compiler.has_header('fcntl.h')) @@ -262,7 +271,7 @@ if conf_data.get('CONFIG_BZIP2') endif if conf_data.get('CONFIG_ECMASCRIPT') - mozjsdeps = dependency('mozjs-17.0') + mozjsdeps = dependency('mozjs-24') deps += mozjsdeps endif @@ -328,7 +337,11 @@ endif #AC_C_CONST #AC_C_INLINE -conf_data.set('NONSTATIC_INLINE', 'inline') +if conf_data.get('CONFIG_ECMASCRIPT') + conf_data.set('NONSTATIC_INLINE', '') +else + conf_data.set('NONSTATIC_INLINE', 'inline') +endif #AC_SYS_LARGEFILE @@ -412,17 +425,9 @@ if compiler.has_function('strcasestr', prefix : '#include ', args: '-D conf_data.set10('HAVE_STRCASESTR', 1) endif -if compiler.has_function('strstr', prefix : '#include ') - conf_data.set10('HAVE_STRSTR', 1) -endif - -if compiler.has_function('strchr', prefix : '#include ') - conf_data.set10('HAVE_STRCHR', 1) -endif - -if compiler.has_function('strrchr', prefix : '#include ') - conf_data.set10('HAVE_STRRCHR', 1) -endif +conf_data.set10('HAVE_STRSTR', 1) +conf_data.set10('HAVE_STRCHR', 1) +conf_data.set10('HAVE_STRRCHR', 1) if compiler.has_function('memmove', prefix : '#include ') conf_data.set10('HAVE_MEMMOVE', 1) diff --git a/src/bfu/button.h b/src/bfu/button.h index 8fb14ed5..74f7dbe4 100644 --- a/src/bfu/button.h +++ b/src/bfu/button.h @@ -4,6 +4,10 @@ #include "bfu/common.h" #include "util/align.h" +#ifdef __cplusplus +extern "C" { +#endif + struct dialog; struct dialog_data; struct terminal; @@ -92,4 +96,8 @@ void add_dlg_button_do(struct dialog *dlg, unsigned char *text, int flags, widge extern const struct widget_ops button_ops; void dlg_format_buttons(struct dialog_data *, struct widget_data *, int, int, int *, int, int *, enum format_align, int); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/bfu/checkbox.h b/src/bfu/checkbox.h index f18faeef..b91c833b 100644 --- a/src/bfu/checkbox.h +++ b/src/bfu/checkbox.h @@ -1,6 +1,10 @@ #ifndef EL__BFU_CHECKBOX_H #define EL__BFU_CHECKBOX_H +#ifdef __cplusplus +extern "C" { +#endif + struct dialog; struct dialog_data; struct terminal; @@ -39,4 +43,8 @@ dlg_format_checkbox(struct dialog_data *dlg_data, #define widget_has_group(widget_data) ((widget_data)->widget->type == WIDGET_CHECKBOX \ ? (widget_data)->widget->info.checkbox.gid : -1) +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/bfu/common.h b/src/bfu/common.h index a1fd368e..fc16b0bf 100644 --- a/src/bfu/common.h +++ b/src/bfu/common.h @@ -1,6 +1,10 @@ #ifndef EL__BFU_COMMON_H #define EL__BFU_COMMON_H +#ifdef __cplusplus +extern "C" { +#endif + struct dialog_data; struct widget_data; @@ -47,4 +51,8 @@ enum widget_type { }; +#ifdef __cplusplus +} +#endif + #endif /* EL__BFU_COMMON_H */ diff --git a/src/bfu/dialog.h b/src/bfu/dialog.h index ceeb67a5..7ede125a 100644 --- a/src/bfu/dialog.h +++ b/src/bfu/dialog.h @@ -8,6 +8,9 @@ #include "terminal/window.h" /* dialog_data->win->term is so common that... */ #include "util/memlist.h" +#ifdef __cplusplus +extern "C" { +#endif struct dialog_data; struct term_event; @@ -222,4 +225,8 @@ struct widget_data *select_widget_by_id(struct dialog_data *dlg_data, int i); assert(n == (dlg)->number_of_widgets); \ } while (0) +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/bfu/group.h b/src/bfu/group.h index bd284500..f05e1a04 100644 --- a/src/bfu/group.h +++ b/src/bfu/group.h @@ -1,6 +1,10 @@ #ifndef EL__BFU_GROUP_H #define EL__BFU_GROUP_H +#ifdef __cplusplus +extern "C" { +#endif + struct dialog_data; struct terminal; struct widget_data; @@ -11,4 +15,8 @@ void dlg_format_group(struct dialog_data *dlg_data, void group_layouter(struct dialog_data *); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/bfu/hierbox.h b/src/bfu/hierbox.h index a489ab04..56fbd841 100644 --- a/src/bfu/hierbox.h +++ b/src/bfu/hierbox.h @@ -5,6 +5,10 @@ #include "bfu/listbox.h" #include "util/lists.h" +#ifdef __cplusplus +extern "C" { +#endif + struct session; /** BFU hierbox browser button */ @@ -146,4 +150,8 @@ widget_handler_status_T push_hierbox_delete_button(struct dialog_data *dlg_data, widget_handler_status_T push_hierbox_clear_button(struct dialog_data *dlg_data, struct widget_data *button); widget_handler_status_T push_hierbox_search_button(struct dialog_data *dlg_data, struct widget_data *button); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/bfu/hotkey.h b/src/bfu/hotkey.h index 24a8352c..6e1a6079 100644 --- a/src/bfu/hotkey.h +++ b/src/bfu/hotkey.h @@ -5,6 +5,10 @@ #include "terminal/kbd.h" +#ifdef __cplusplus +extern "C" { +#endif + struct menu; struct terminal; @@ -18,4 +22,8 @@ void refresh_hotkeys(struct terminal *term, struct menu *menu); int check_hotkeys(struct menu *menu, term_event_char_T hotkey, struct terminal *term); int check_not_so_hot_keys(struct menu *menu, term_event_char_T key, struct terminal *term); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/bfu/inpfield.h b/src/bfu/inpfield.h index eca314a3..668b218f 100644 --- a/src/bfu/inpfield.h +++ b/src/bfu/inpfield.h @@ -6,6 +6,9 @@ #include "util/lists.h" #include "util/align.h" +#ifdef __cplusplus +extern "C" { +#endif struct dialog; struct dialog_data; @@ -115,4 +118,8 @@ input_field_line(struct session *ses, unsigned char *prompt, void *data, #define widget_is_textfield(widget_data) ((widget_data)->widget->type == WIDGET_FIELD \ || (widget_data)->widget->type == WIDGET_FIELD_PASS) +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/bfu/inphist.h b/src/bfu/inphist.h index d7a5ecf0..8e6acd5b 100644 --- a/src/bfu/inphist.h +++ b/src/bfu/inphist.h @@ -3,6 +3,10 @@ #include "util/lists.h" +#ifdef __cplusplus +extern "C" { +#endif + struct dialog_data; @@ -58,4 +62,8 @@ int save_input_history(struct input_history *history, unsigned char *filename); void dlg_set_history(struct widget_data *); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/bfu/leds.h b/src/bfu/leds.h index 4ed6c65f..c778bc77 100644 --- a/src/bfu/leds.h +++ b/src/bfu/leds.h @@ -6,6 +6,10 @@ #include "main/module.h" #include "util/color.h" +#ifdef __cplusplus +extern "C" { +#endif + struct session; struct terminal; @@ -50,4 +54,9 @@ unsigned char get_led_value(struct led *led); void unset_led_value(struct led *led); #endif + +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/bfu/listbox.h b/src/bfu/listbox.h index 2a1356c6..c43d753c 100644 --- a/src/bfu/listbox.h +++ b/src/bfu/listbox.h @@ -4,6 +4,10 @@ #include "util/align.h" #include "util/lists.h" +#ifdef __cplusplus +extern "C" { +#endif + struct dialog; struct listbox_data; struct listbox_item; @@ -144,4 +148,8 @@ struct listbox_data *get_listbox_widget_data(struct widget_data *widget_data); #define get_dlg_listbox_data(dlg_data) \ get_listbox_widget_data(dlg_data->widgets_data) +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/bfu/listmenu.h b/src/bfu/listmenu.h index 3b2b22b2..d738ecf0 100644 --- a/src/bfu/listmenu.h +++ b/src/bfu/listmenu.h @@ -2,6 +2,10 @@ #ifndef EL__BFU_LISTMENU_H #define EL__BFU_LISTMENU_H +#ifdef __cplusplus +extern "C" { +#endif + struct session; struct string; struct terminal; @@ -20,4 +24,8 @@ void menu_labels(struct menu_item *m, unsigned char *base, unsigned char **lbls) void do_select_submenu(struct terminal *term, void *menu_, void *ses_); void free_menu(struct menu_item *m); +#ifdef __cplusplus +} +#endif + #endif /* EL__BFU_LISTMENU_H */ diff --git a/src/bfu/menu.h b/src/bfu/menu.h index 7be48814..39025772 100644 --- a/src/bfu/menu.h +++ b/src/bfu/menu.h @@ -4,6 +4,10 @@ #include "config/kbdbind.h" #include "util/box.h" +#ifdef __cplusplus +extern "C" { +#endif + struct terminal; struct window; @@ -177,4 +181,8 @@ void do_menu_selected(struct terminal *, struct menu_item *, void *, int, int); void do_mainmenu(struct terminal *, struct menu_item *, void *, int); void deselect_mainmenu(struct terminal *term, struct menu *menu); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/bfu/msgbox.h b/src/bfu/msgbox.h index 2e06fe8a..1df93772 100644 --- a/src/bfu/msgbox.h +++ b/src/bfu/msgbox.h @@ -4,6 +4,10 @@ #include "util/align.h" #include "util/memlist.h" +#ifdef __cplusplus +extern "C" { +#endif + struct terminal; @@ -133,5 +137,8 @@ info_box(struct terminal *term, enum msgbox_flags flags, unsigned char *title, enum format_align align, unsigned char *text); +#ifdef __cplusplus +} +#endif #endif diff --git a/src/bfu/style.h b/src/bfu/style.h index e9cbb95f..7dce1173 100644 --- a/src/bfu/style.h +++ b/src/bfu/style.h @@ -1,6 +1,10 @@ #ifndef EL__BFU_STYLE_H #define EL__BFU_STYLE_H +#ifdef __cplusplus +extern "C" { +#endif + struct color_pair; struct terminal; @@ -27,4 +31,8 @@ get_bfu_color(struct terminal *term, unsigned char *stylename); */ void done_bfu_colors(void); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/bfu/text.h b/src/bfu/text.h index 469a94e1..ddb520de 100644 --- a/src/bfu/text.h +++ b/src/bfu/text.h @@ -3,6 +3,10 @@ #include "util/color.h" +#ifdef __cplusplus +extern "C" { +#endif + struct dialog; struct dialog_data; struct terminal; @@ -60,4 +64,8 @@ dlg_format_text(struct dialog_data *dlg_data, struct widget_data *widget_data, && (widget_data)->info.text.lines > 0 \ && (widget_data)->box.height < (widget_data)->info.text.lines) +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/bfu/widget.h b/src/bfu/widget.h index 49c06f01..7a9c7df8 100644 --- a/src/bfu/widget.h +++ b/src/bfu/widget.h @@ -16,6 +16,10 @@ #include "util/lists.h" #include "util/box.h" +#ifdef __cplusplus +extern "C" { +#endif + struct dialog_data; @@ -87,5 +91,8 @@ widget_is_focusable(struct widget_data *widget_data) } } +#ifdef __cplusplus +} +#endif #endif diff --git a/src/bookmarks/backend/common.h b/src/bookmarks/backend/common.h index f406aa3c..5abdef24 100644 --- a/src/bookmarks/backend/common.h +++ b/src/bookmarks/backend/common.h @@ -6,6 +6,10 @@ #include "util/lists.h" #include "util/secsave.h" +#ifdef __cplusplus +extern "C" { +#endif + struct bookmarks_backend { /* Order matters here. --Zas. */ unsigned char *(*filename)(int); @@ -16,4 +20,8 @@ struct bookmarks_backend { void bookmarks_read(void); void bookmarks_write(LIST_OF(struct bookmark) *); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/bookmarks/backend/default.h b/src/bookmarks/backend/default.h index b11416d9..0d86d8a9 100644 --- a/src/bookmarks/backend/default.h +++ b/src/bookmarks/backend/default.h @@ -4,6 +4,14 @@ #include "bookmarks/backend/common.h" +#ifdef __cplusplus +extern "C" { +#endif + extern struct bookmarks_backend default_bookmarks_backend; +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/bookmarks/backend/xbel.h b/src/bookmarks/backend/xbel.h index 85f6f536..78c66027 100644 --- a/src/bookmarks/backend/xbel.h +++ b/src/bookmarks/backend/xbel.h @@ -3,6 +3,14 @@ #include "bookmarks/backend/common.h" +#ifdef __cplusplus +extern "C" { +#endif + extern struct bookmarks_backend xbel_bookmarks_backend; +#ifdef __cplusplus +} +#endif + #endif /* !EL__BOOKMARKS_BACKEND_XBEL_H */ diff --git a/src/bookmarks/bookmarks.h b/src/bookmarks/bookmarks.h index 55f2d283..ea30370b 100644 --- a/src/bookmarks/bookmarks.h +++ b/src/bookmarks/bookmarks.h @@ -5,6 +5,10 @@ #include "main/object.h" #include "util/lists.h" +#ifdef __cplusplus +extern "C" { +#endif + struct listbox_item; struct terminal; @@ -57,4 +61,8 @@ int update_bookmark(struct bookmark *, int, unsigned char *, unsigned char *); void open_bookmark_folder(struct session *ses, unsigned char *foldername); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/bookmarks/dialogs.h b/src/bookmarks/dialogs.h index 9f0b1bbd..7b987d74 100644 --- a/src/bookmarks/dialogs.h +++ b/src/bookmarks/dialogs.h @@ -6,6 +6,10 @@ #include "terminal/terminal.h" #include "session/session.h" +#ifdef __cplusplus +extern "C" { +#endif + extern struct hierbox_browser bookmark_browser; /* Launch the bookmark manager */ @@ -35,4 +39,8 @@ void bookmark_terminal_tabs_dialog(struct terminal *term); /* Free search memorization */ void free_last_searched_bookmark(void); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/cache/cache.h b/src/cache/cache.h index de064277..7ff59adb 100644 --- a/src/cache/cache.h +++ b/src/cache/cache.h @@ -5,6 +5,10 @@ #include "util/lists.h" #include "util/time.h" +#ifdef __cplusplus +extern "C" { +#endif + struct listbox_item; struct uri; @@ -149,4 +153,8 @@ int get_cache_entry_count(void); int get_cache_entry_used_count(void); int get_cache_entry_loading_count(void); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/cache/dialogs.h b/src/cache/dialogs.h index e3e41b3e..fd2d944b 100644 --- a/src/cache/dialogs.h +++ b/src/cache/dialogs.h @@ -3,10 +3,18 @@ #include "bfu/hierbox.h" +#ifdef __cplusplus +extern "C" { +#endif + struct session; struct terminal; extern struct hierbox_browser cache_browser; void cache_manager(struct session *); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/config/cmdline.h b/src/config/cmdline.h index 4ed39042..5d96c648 100644 --- a/src/config/cmdline.h +++ b/src/config/cmdline.h @@ -4,7 +4,15 @@ #include "main/main.h" #include "util/lists.h" +#ifdef __cplusplus +extern "C" { +#endif + enum retval parse_options(int, unsigned char *[], LIST_OF(struct string_list_item) *); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/config/conf.h b/src/config/conf.h index 05f548c8..173a5d20 100644 --- a/src/config/conf.h +++ b/src/config/conf.h @@ -4,6 +4,10 @@ #include "terminal/terminal.h" #include "util/string.h" +#ifdef __cplusplus +extern "C" { +#endif + enum parse_error { ERROR_NONE, ERROR_COMMAND, @@ -28,4 +32,8 @@ create_config_string(unsigned char *prefix, unsigned char *name); struct string *wrap_option_desc(struct string *out, const unsigned char *src, const struct string *indent, int maxwidth); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/config/dialogs.h b/src/config/dialogs.h index 60ec88f7..fd361478 100644 --- a/src/config/dialogs.h +++ b/src/config/dialogs.h @@ -7,6 +7,10 @@ #include "terminal/terminal.h" #include "util/memlist.h" +#ifdef __cplusplus +extern "C" { +#endif + extern struct hierbox_browser option_browser; extern struct hierbox_browser keybinding_browser; @@ -20,4 +24,8 @@ void init_keybinding_listboxes(struct keymap keymap_table[], const struct action_list actions[]); void done_keybinding_listboxes(void); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/config/domain.h b/src/config/domain.h index 726201af..09b20a88 100644 --- a/src/config/domain.h +++ b/src/config/domain.h @@ -4,6 +4,10 @@ #include "config/options.h" #include "util/lists.h" +#ifdef __cplusplus +extern "C" { +#endif + struct session; @@ -26,4 +30,8 @@ struct option *get_domain_option_from_session(unsigned char *, void done_domain_trees(void); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/config/home.h b/src/config/home.h index 6a48936f..a59b499f 100644 --- a/src/config/home.h +++ b/src/config/home.h @@ -1,10 +1,18 @@ #ifndef EL__CONFIG_HOME_H #define EL__CONFIG_HOME_H +#ifdef __cplusplus +extern "C" { +#endif + extern unsigned char *elinks_home; extern int first_use; void init_home(void); void done_home(void); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/config/kbdbind.h b/src/config/kbdbind.h index 8facc190..f46ce9d2 100644 --- a/src/config/kbdbind.h +++ b/src/config/kbdbind.h @@ -7,6 +7,10 @@ #include "terminal/terminal.h" #include "util/string.h" +#ifdef __cplusplus +extern "C" { +#endif + struct listbox_item; struct module; @@ -199,4 +203,8 @@ void add_actions_to_string(struct string *string, action_id_T actions[], extern struct module kbdbind_module; +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/config/options.h b/src/config/options.h index 10b074bb..234f7cb4 100644 --- a/src/config/options.h +++ b/src/config/options.h @@ -8,6 +8,10 @@ #include "util/memory.h" #include "util/string.h" +#ifdef __cplusplus +extern "C" { +#endif + /* TODO: We should provide some generic mechanism for options caching. */ /* Fix namespace clash on Cygwin. */ @@ -555,4 +559,8 @@ enum verbose_level { VERBOSE_LEVELS, }; +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/config/opttypes.h b/src/config/opttypes.h index 65ef11f4..fa377034 100644 --- a/src/config/opttypes.h +++ b/src/config/opttypes.h @@ -4,6 +4,10 @@ #include "config/options.h" #include "util/string.h" +#ifdef __cplusplus +extern "C" { +#endif + struct option_type_info { unsigned char *name; unsigned char *(*cmdline)(struct option *, unsigned char ***, int *); @@ -22,4 +26,8 @@ extern int commandline; unsigned char *get_option_type_name(enum option_type type); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/config/timer.h b/src/config/timer.h index c7904f06..ecf99693 100644 --- a/src/config/timer.h +++ b/src/config/timer.h @@ -1,8 +1,16 @@ #ifndef EL__CONFIG_TIMER_H #define EL__CONFIG_TIMER_H +#ifdef __cplusplus +extern "C" { +#endif + struct module; extern struct module periodic_saving_module; +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/config/urlhist.h b/src/config/urlhist.h index 9054b60e..78e11f2b 100644 --- a/src/config/urlhist.h +++ b/src/config/urlhist.h @@ -3,9 +3,17 @@ #include "bfu/inphist.h" +#ifdef __cplusplus +extern "C" { +#endif + struct module; extern struct input_history goto_url_history; extern struct module goto_url_history_module; +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/cookies/cookies.h b/src/cookies/cookies.h index c8b8e38c..7bbcc180 100644 --- a/src/cookies/cookies.h +++ b/src/cookies/cookies.h @@ -16,6 +16,10 @@ #include "util/string.h" #include "util/time.h" +#ifdef __cplusplus +extern "C" { +#endif + struct listbox_item; struct terminal; @@ -66,4 +70,8 @@ struct string *send_cookies_js(struct uri *uri); extern struct module cookies_module; +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/cookies/dialogs.h b/src/cookies/dialogs.h index 8896d3f1..d4f6bd15 100644 --- a/src/cookies/dialogs.h +++ b/src/cookies/dialogs.h @@ -6,10 +6,18 @@ #include "terminal/terminal.h" #include "util/lists.h" +#ifdef __cplusplus +extern "C" { +#endif + extern LIST_OF(struct cookie) cookie_queries; void accept_cookie_dialog(struct session *ses, void *data); extern struct hierbox_browser cookie_browser; void cookie_manager(struct session *); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/cookies/parser.h b/src/cookies/parser.h index d9e832cc..a29b8847 100644 --- a/src/cookies/parser.h +++ b/src/cookies/parser.h @@ -1,6 +1,10 @@ #ifndef EL__COOKIES_PARSER_H #define EL__COOKIES_PARSER_H +#ifdef __cplusplus +extern "C" { +#endif + struct cookie_str { unsigned char *str; unsigned char *nam_end, *val_start, *val_end; @@ -8,4 +12,8 @@ struct cookie_str { struct cookie_str *parse_cookie_str(struct cookie_str *cstr, unsigned char *str); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/cookies/path.c b/src/cookies/path.c index 406d3d26..5a27d387 100644 --- a/src/cookies/path.c +++ b/src/cookies/path.c @@ -1,6 +1,7 @@ /* Cookie path matching */ #include +#include "cookies/path.h" int is_path_prefix(unsigned char *cookiepath, unsigned char *requestpath) diff --git a/src/cookies/path.h b/src/cookies/path.h index c6e065ee..4036046c 100644 --- a/src/cookies/path.h +++ b/src/cookies/path.h @@ -1,6 +1,14 @@ #ifndef EL__COOKIES_PATH_H #define EL__COOKIES_PATH_H +#ifdef __cplusplus +extern "C" { +#endif + int is_path_prefix(unsigned char *d, unsigned char *s); +#ifdef __cplusplus +} +#endif + #endif \ No newline at end of file diff --git a/src/dialogs/document.h b/src/dialogs/document.h index e6c41706..6765cb21 100644 --- a/src/dialogs/document.h +++ b/src/dialogs/document.h @@ -3,10 +3,18 @@ #include "session/session.h" +#ifdef __cplusplus +extern "C" { +#endif + void nowhere_box(struct terminal *term, unsigned char *title); void link_info_dialog(struct session *ses); void document_info_dialog(struct session *); void cached_header_dialog(struct session *ses, struct cache_entry *cached); void protocol_header_dialog(struct session *); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/dialogs/download.h b/src/dialogs/download.h index 6b10add4..a1a1cfa2 100644 --- a/src/dialogs/download.h +++ b/src/dialogs/download.h @@ -1,6 +1,10 @@ #ifndef EL__DIALOGS_DOWNLOAD_H #define EL__DIALOGS_DOWNLOAD_H +#ifdef __cplusplus +extern "C" { +#endif + struct file_download; struct session; struct terminal; @@ -11,4 +15,8 @@ void done_download_display(struct file_download *file_download); void display_download(struct terminal *, struct file_download *, struct session *); void download_manager(struct session *ses); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/dialogs/edit.h b/src/dialogs/edit.h index c368863d..19de5cc7 100644 --- a/src/dialogs/edit.h +++ b/src/dialogs/edit.h @@ -5,6 +5,10 @@ #include "session/session.h" #include "terminal/terminal.h" +#ifdef __cplusplus +extern "C" { +#endif + enum edit_dialog_type { EDIT_DLG_SEARCH, /* search dialog */ EDIT_DLG_ADD /* edit/add dialog */ @@ -17,4 +21,8 @@ void do_edit_dialog(struct terminal *, int, unsigned char *, void when_cancel(struct dialog *), void *, enum edit_dialog_type); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/dialogs/exmode.h b/src/dialogs/exmode.h index 6adf4861..00401f90 100644 --- a/src/dialogs/exmode.h +++ b/src/dialogs/exmode.h @@ -3,10 +3,18 @@ #include "main/module.h" +#ifdef __cplusplus +extern "C" { +#endif + struct session; extern struct module exmode_module; void exmode_start(struct session *ses); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/dialogs/info.h b/src/dialogs/info.h index 37d2d689..2b28ce17 100644 --- a/src/dialogs/info.h +++ b/src/dialogs/info.h @@ -1,6 +1,10 @@ #ifndef EL__DIALOGS_INFO_H #define EL__DIALOGS_INFO_H +#ifdef __cplusplus +extern "C" { +#endif + struct session; struct terminal; @@ -11,4 +15,8 @@ void menu_copying(struct terminal *, void *, void *); void resource_info(struct terminal *term); void memory_inf(struct terminal *, void *, struct session *); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/dialogs/menu.h b/src/dialogs/menu.h index c5848c60..f5a26eed 100644 --- a/src/dialogs/menu.h +++ b/src/dialogs/menu.h @@ -7,6 +7,10 @@ #include "terminal/terminal.h" #include "viewer/action.h" +#ifdef __cplusplus +extern "C" { +#endif + struct document_view; struct open_in_new; struct session; @@ -57,4 +61,8 @@ void auto_complete_file(struct terminal *term, int no_elevator, unsigned char *path, menu_func_T file_func, menu_func_T dir_func, void *data); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/dialogs/options.h b/src/dialogs/options.h index cb74f031..700b7e0b 100644 --- a/src/dialogs/options.h +++ b/src/dialogs/options.h @@ -4,9 +4,17 @@ #include "session/session.h" #include "terminal/terminal.h" +#ifdef __cplusplus +extern "C" { +#endif + void charset_list(struct terminal *, void *, void *); void terminal_options(struct terminal *, void *, struct session *); void menu_language_list(struct terminal *, void *, void *); void resize_terminal_dialog(struct terminal *term); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/dialogs/progress.c b/src/dialogs/progress.c index 8c74444a..8519414c 100644 --- a/src/dialogs/progress.c +++ b/src/dialogs/progress.c @@ -7,6 +7,7 @@ #include "elinks.h" #include "bfu/dialog.h" +#include "dialogs/progress.h" #include "intl/gettext/libintl.h" #include "network/progress.h" #include "terminal/draw.h" diff --git a/src/dialogs/progress.h b/src/dialogs/progress.h index f97503dd..6abcee07 100644 --- a/src/dialogs/progress.h +++ b/src/dialogs/progress.h @@ -1,6 +1,10 @@ #ifndef EL__DIALOGS_PROGRESS_H #define EL__DIALOGS_PROGRESS_H +#ifdef __cplusplus +extern "C" { +#endif + struct progress; struct terminal; @@ -20,4 +24,8 @@ draw_progress_bar(struct progress *progress, struct terminal *term, int x, int y, int width, unsigned char *text, struct color_pair *meter_color); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/dialogs/status.h b/src/dialogs/status.h index 0c92dc4b..fc4bd78f 100644 --- a/src/dialogs/status.h +++ b/src/dialogs/status.h @@ -1,6 +1,10 @@ #ifndef EL__DIALOGS_STATUS_H #define EL__DIALOGS_STATUS_H +#ifdef __cplusplus +extern "C" { +#endif + struct download; struct session; struct terminal; @@ -13,4 +17,8 @@ unsigned char * get_download_msg(struct download *download, struct terminal *term, int wide, int full, unsigned char *separator); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/document/css/apply.h b/src/document/css/apply.h index c5e2fa7f..0a2f2948 100644 --- a/src/document/css/apply.h +++ b/src/document/css/apply.h @@ -7,6 +7,10 @@ #include "util/lists.h" +#ifdef __cplusplus +extern "C" { +#endif + struct css_stylesheet; struct html_context; struct html_element; @@ -33,4 +37,8 @@ css_apply(struct html_context *html_context, struct html_element *element, struct css_stylesheet *css, LIST_OF(struct html_element) *html_stack); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/document/css/css.h b/src/document/css/css.h index 7d5e0f92..e608816e 100644 --- a/src/document/css/css.h +++ b/src/document/css/css.h @@ -2,6 +2,10 @@ #ifndef EL__DOCUMENT_CSS_CSS_H #define EL__DOCUMENT_CSS_CSS_H +#ifdef __cplusplus +extern "C" { +#endif + struct css_stylesheet; struct module; struct uri; @@ -26,4 +30,8 @@ void import_css(struct css_stylesheet *css, struct uri *uri); int supports_css_media_type(const unsigned char *optstr, const unsigned char *token, size_t token_length); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/document/css/parser.h b/src/document/css/parser.h index 67d00e21..ed678900 100644 --- a/src/document/css/parser.h +++ b/src/document/css/parser.h @@ -6,6 +6,11 @@ #define EL__DOCUMENT_CSS_PARSER_H #include "util/lists.h" + +#ifdef __cplusplus +extern "C" { +#endif + struct scanner; struct css_stylesheet; struct uri; @@ -25,4 +30,8 @@ void css_parse_properties(LIST_OF(struct css_property) *props, void css_parse_stylesheet(struct css_stylesheet *css, struct uri *base_uri, const unsigned char *string, const unsigned char *end); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/document/css/property.h b/src/document/css/property.h index 27535b22..daa8be62 100644 --- a/src/document/css/property.h +++ b/src/document/css/property.h @@ -8,6 +8,10 @@ #include "util/color.h" #include "util/lists.h" +#ifdef __cplusplus +extern "C" { +#endif + enum css_property_type { CSS_PT_NONE, CSS_PT_BACKGROUND, @@ -137,4 +141,8 @@ struct css_property_info { /** This table contains info about all the known CSS properties. */ extern struct css_property_info css_property_info[]; +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/document/css/scanner.h b/src/document/css/scanner.h index 5db7d853..b8b851e6 100644 --- a/src/document/css/scanner.h +++ b/src/document/css/scanner.h @@ -4,6 +4,10 @@ #include "util/scanner.h" +#ifdef __cplusplus +extern "C" { +#endif + /** The various token types and what they contain. Patterns taken from * the flex scanner declarations in the CSS 2 Specification. * @@ -115,4 +119,8 @@ check_css_precedence(int type, int skipto) return get_css_precedence(type) < get_css_precedence(skipto); } +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/document/css/stylesheet.h b/src/document/css/stylesheet.h index d97ea499..9a1c303f 100644 --- a/src/document/css/stylesheet.h +++ b/src/document/css/stylesheet.h @@ -5,6 +5,10 @@ #include "protocol/uri.h" #include "util/lists.h" +#ifdef __cplusplus +extern "C" { +#endif + /* #define DEBUG_CSS */ /** @file @@ -195,4 +199,8 @@ void del_css_selector_from_set(struct css_selector *); void dump_css_selector_tree(struct css_selector_set *set); #endif +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/document/css/value.h b/src/document/css/value.h index 96ab9b5e..97dc4976 100644 --- a/src/document/css/value.h +++ b/src/document/css/value.h @@ -8,6 +8,9 @@ #include "document/css/property.h" #include "document/css/scanner.h" +#ifdef __cplusplus +extern "C" { +#endif /** This function takes a value of a specified type from the given * scanner and converts it to a reasonable struct css_property-ready @@ -65,4 +68,9 @@ int css_parse_text_align_value(struct css_property_info *propinfo, int css_parse_white_space_value(struct css_property_info *propinfo, union css_property_value *value, struct scanner *scanner); + +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/document/docdata.h b/src/document/docdata.h index 1606966f..07714f2d 100644 --- a/src/document/docdata.h +++ b/src/document/docdata.h @@ -4,6 +4,10 @@ #include "document/document.h" #include "util/memory.h" +#ifdef __cplusplus +extern "C" { +#endif + #define LINES_GRANULARITY 0x7F #define LINE_GRANULARITY 0x0F #define LINK_GRANULARITY 0x7F @@ -17,4 +21,8 @@ struct line *realloc_lines(struct document *document, int y); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/document/document.h b/src/document/document.h index 5d9da917..a44872fe 100644 --- a/src/document/document.h +++ b/src/document/document.h @@ -10,6 +10,10 @@ #include "util/lists.h" #include "util/box.h" +#ifdef __cplusplus +extern "C" { +#endif + struct cache_entry; struct document_refresh; struct el_form_control; @@ -319,4 +323,8 @@ extern struct module document_module; int find_tag(struct document *document, unsigned char *name, int namelen); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/document/dom/renderer.h b/src/document/dom/renderer.h index ebb95c9c..5ef91bf8 100644 --- a/src/document/dom/renderer.h +++ b/src/document/dom/renderer.h @@ -2,10 +2,18 @@ #ifndef EL__DOCUMENT_DOM_RENDERER_H #define EL__DOCUMENT_DOM_RENDERER_H +#ifdef __cplusplus +extern "C" { +#endif + struct cache_entry; struct document; struct string; void render_dom_document(struct cache_entry *cached, struct document *document, struct string *buffer); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/document/dom/rss.h b/src/document/dom/rss.h index 1f07f787..8b7c40e6 100644 --- a/src/document/dom/rss.h +++ b/src/document/dom/rss.h @@ -4,10 +4,17 @@ #include "dom/stack.h" +#ifdef __cplusplus +extern "C" { +#endif #define RSS_CONFIG_FLAGS \ (DOM_CONFIG_NORMALIZE_WHITESPACE | DOM_CONFIG_NORMALIZE_CHARACTERS) extern struct dom_stack_context_info dom_rss_renderer_context_info; +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/document/dom/source.h b/src/document/dom/source.h index 01b49224..5cd2a87f 100644 --- a/src/document/dom/source.h +++ b/src/document/dom/source.h @@ -4,7 +4,14 @@ #include "dom/stack.h" +#ifdef __cplusplus +extern "C" { +#endif extern struct dom_stack_context_info dom_source_renderer_context_info; +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/document/dom/util.h b/src/document/dom/util.h index 1827c52a..2857c7bf 100644 --- a/src/document/dom/util.h +++ b/src/document/dom/util.h @@ -12,6 +12,9 @@ #include "intl/charsets.h" #include "terminal/draw.h" +#ifdef __cplusplus +extern "C" { +#endif struct document; struct uri; @@ -51,4 +54,8 @@ void render_dom_text(struct dom_renderer *renderer, struct screen_char *template struct link *add_dom_link(struct dom_renderer *renderer, unsigned char *string, int length, unsigned char *uristring, int urilength); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/document/format.h b/src/document/format.h index 1c824f43..447764d2 100644 --- a/src/document/format.h +++ b/src/document/format.h @@ -3,6 +3,10 @@ #include "util/color.h" +#ifdef __cplusplus +extern "C" { +#endif + struct document_options; struct screen_char; @@ -35,5 +39,9 @@ struct text_style { void get_screen_char_template(struct screen_char *template_, struct document_options *options, struct text_style style); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/document/forms.h b/src/document/forms.h index 9d2e3146..55bfaebc 100644 --- a/src/document/forms.h +++ b/src/document/forms.h @@ -3,6 +3,10 @@ #include "util/lists.h" +#ifdef __cplusplus +extern "C" { +#endif + struct document; struct menu_item; @@ -119,4 +123,8 @@ int has_form_submit(struct form *form); int get_form_control_link(struct document *document, struct el_form_control *fc); void done_form_control(struct el_form_control *fc); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/document/html/frames.h b/src/document/html/frames.h index f2ce8aa1..67a41ac8 100644 --- a/src/document/html/frames.h +++ b/src/document/html/frames.h @@ -4,6 +4,10 @@ #include "util/box.h" +#ifdef __cplusplus +extern "C" { +#endif + struct document_options; struct session; struct uri; @@ -48,4 +52,8 @@ void format_frames(struct session *ses, struct frameset_desc *fsd, struct docume void parse_frame_widths(unsigned char *str, int max_value, int pixels_per_char, int **new_values, int *new_values_count); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/document/html/internal.h b/src/document/html/internal.h index ff2224e2..eaec3c20 100644 --- a/src/document/html/internal.h +++ b/src/document/html/internal.h @@ -6,6 +6,10 @@ #include "document/html/parser.h" #include "util/lists.h" +#ifdef __cplusplus +extern "C" { +#endif + struct document_options; struct uri; @@ -145,4 +149,8 @@ void import_css_stylesheet(struct css_stylesheet *css, struct uri *base_uri, const unsigned char *unterminated_url, int len); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/document/html/parse-meta-refresh.h b/src/document/html/parse-meta-refresh.h index d81409d3..103ce036 100644 --- a/src/document/html/parse-meta-refresh.h +++ b/src/document/html/parse-meta-refresh.h @@ -1,6 +1,10 @@ #ifndef EL__DOCUMENT_HTML_PARSE_META_REFRESH_H #define EL__DOCUMENT_HTML_PARSE_META_REFRESH_H +#ifdef __cplusplus +extern "C" { +#endif + /** Parses a \ element. * * @param[in] content @@ -18,4 +22,8 @@ int html_parse_meta_refresh(const unsigned char *content, unsigned long *delay, unsigned char **url); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/document/html/parser.h b/src/document/html/parser.h index 7631278a..b957687f 100644 --- a/src/document/html/parser.h +++ b/src/document/html/parser.h @@ -10,6 +10,10 @@ #include "util/color.h" #include "util/lists.h" +#ifdef __cplusplus +extern "C" { +#endif + struct document_options; struct el_form_control; struct frameset_desc; @@ -205,4 +209,8 @@ void ln_break(struct html_context *html_context, int n); int get_color(struct html_context *html_context, unsigned char *a, unsigned char *c, color_T *rgb); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/document/html/parser/forms.h b/src/document/html/parser/forms.h index 8515ee7b..e0dfa9f3 100644 --- a/src/document/html/parser/forms.h +++ b/src/document/html/parser/forms.h @@ -4,6 +4,10 @@ #include "document/html/parser/parse.h" +#ifdef __cplusplus +extern "C" { +#endif + struct html_context; element_handler_T html_button; @@ -13,4 +17,8 @@ element_handler_T html_select; element_handler_T html_option; element_handler_T html_textarea; +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/document/html/parser/general.h b/src/document/html/parser/general.h index 5c25b595..d6985c73 100644 --- a/src/document/html/parser/general.h +++ b/src/document/html/parser/general.h @@ -4,6 +4,10 @@ #include "document/html/parser/parse.h" +#ifdef __cplusplus +extern "C" { +#endif + element_handler_T html_address; element_handler_T html_base; element_handler_T html_blockquote; @@ -61,4 +65,8 @@ element_handler_T html_xmp_close; void html_apply_canvas_bgcolor(struct html_context *); void html_handle_body_meta(struct html_context *, unsigned char *, unsigned char *); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/document/html/parser/link.h b/src/document/html/parser/link.h index 9b087e87..5b5c900e 100644 --- a/src/document/html/parser/link.h +++ b/src/document/html/parser/link.h @@ -4,6 +4,10 @@ #include "document/html/parser/parse.h" +#ifdef __cplusplus +extern "C" { +#endif + struct html_context; void put_link_line(unsigned char *prefix, unsigned char *linkname, unsigned char *link, unsigned char *target, struct html_context *html_context); @@ -19,4 +23,8 @@ element_handler_T html_audio; element_handler_T html_video; element_handler_T html_embed; +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/document/html/parser/parse.h b/src/document/html/parser/parse.h index 1e53149e..50fbdd4a 100644 --- a/src/document/html/parser/parse.h +++ b/src/document/html/parser/parse.h @@ -2,6 +2,10 @@ #ifndef EL__DOCUMENT_HTML_PARSER_PARSE_H #define EL__DOCUMENT_HTML_PARSER_PARSE_H +#ifdef __cplusplus +extern "C" { +#endif + struct html_context; struct document_options; struct part; @@ -76,4 +80,8 @@ int supports_html_media_attr(const unsigned char *media); void free_tags_lookup(void); void init_tags_lookup(void); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/document/html/parser/stack.h b/src/document/html/parser/stack.h index 754166f7..5ff77700 100644 --- a/src/document/html/parser/stack.h +++ b/src/document/html/parser/stack.h @@ -4,6 +4,10 @@ #include "document/html/parser.h" +#ifdef __cplusplus +extern "C" { +#endif + struct html_context; struct html_element *search_html_stack(struct html_context *html_context, @@ -20,4 +24,8 @@ void kill_html_stack_until(struct html_context *html_context, int ls, ...); /* void dump_html_stack(struct html_context *html_context); */ +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/document/html/parser/table.h b/src/document/html/parser/table.h index a97481a9..8926696e 100644 --- a/src/document/html/parser/table.h +++ b/src/document/html/parser/table.h @@ -4,6 +4,10 @@ #include "util/color.h" +#ifdef __cplusplus +extern "C" { +#endif + struct html_context; struct part; @@ -122,4 +126,8 @@ parse_table(unsigned char *html, unsigned char *eof, unsigned char **end, void free_table(struct table *table); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/document/html/renderer.h b/src/document/html/renderer.h index d27a63ce..c503e849 100644 --- a/src/document/html/renderer.h +++ b/src/document/html/renderer.h @@ -4,6 +4,10 @@ #include "document/document.h" +#ifdef __cplusplus +extern "C" { +#endif + struct el_box; struct cache_entry; struct html_context; @@ -70,4 +74,9 @@ struct part *format_html_part(struct html_context *html_context, unsigned char * int dec2qwerty(int num, unsigned char *link_sym, const unsigned char *key, int base); int qwerty2dec(const unsigned char *link_sym, const unsigned char *key, int base); + +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/document/html/tables.h b/src/document/html/tables.h index 84745b50..84007a9a 100644 --- a/src/document/html/tables.h +++ b/src/document/html/tables.h @@ -2,8 +2,16 @@ #ifndef EL__DOCUMENT_HTML_TABLES_H #define EL__DOCUMENT_HTML_TABLES_H +#ifdef __cplusplus +extern "C" { +#endif + struct html_context; void format_table(unsigned char *, unsigned char *, unsigned char *, unsigned char **, struct html_context *); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/document/libdom/renderer.h b/src/document/libdom/renderer.h index b489b6ba..0445fc7a 100644 --- a/src/document/libdom/renderer.h +++ b/src/document/libdom/renderer.h @@ -2,10 +2,18 @@ #ifndef EL__DOCUMENT_LIBDOM_RENDERER_H #define EL__DOCUMENT_LIBDOM_RENDERER_H +#ifdef __cplusplus +extern "C" { +#endif + struct cache_entry; struct document; struct string; void render_source_document(struct cache_entry *cached, struct document *document, struct string *buffer); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/document/options.h b/src/document/options.h index 60dc67ca..0743df83 100644 --- a/src/document/options.h +++ b/src/document/options.h @@ -6,6 +6,10 @@ #include "util/color.h" #include "util/box.h" +#ifdef __cplusplus +extern "C" { +#endif + struct session; /** Active link coloring options */ @@ -144,6 +148,7 @@ struct document_options { #ifdef CONFIG_UTF8 unsigned int utf8:1; #endif /* CONFIG_UTF8 */ + unsigned int dump:1; /** Active link coloring. * This is mostly here to make use of this option cache so * link drawing is faster. --jonas */ @@ -182,4 +187,8 @@ int compare_opt(struct document_options *o1, struct document_options *o2); * and redraws the document. */ void toggle_document_option(struct session *ses, unsigned char *option_name); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/document/plain/renderer.h b/src/document/plain/renderer.h index 9cb93f60..d95e9ccd 100644 --- a/src/document/plain/renderer.h +++ b/src/document/plain/renderer.h @@ -2,10 +2,18 @@ #ifndef EL__DOCUMENT_PLAIN_RENDERER_H #define EL__DOCUMENT_PLAIN_RENDERER_H +#ifdef __cplusplus +extern "C" { +#endif + struct cache_entry; struct document; struct string; void render_plain_document(struct cache_entry *cached, struct document *document, struct string *buffer); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/document/refresh.h b/src/document/refresh.h index 2d8732cd..c9af5ef1 100644 --- a/src/document/refresh.h +++ b/src/document/refresh.h @@ -3,6 +3,10 @@ #include "main/timer.h" /* timer_id_T */ +#ifdef __cplusplus +extern "C" { +#endif + struct session; struct uri; @@ -18,4 +22,8 @@ void done_document_refresh(struct document_refresh *refresh); void kill_document_refresh(struct document_refresh *refresh); void start_document_refreshes(struct session *ses); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/document/renderer.c b/src/document/renderer.c index 234c7ad6..e49b4abc 100644 --- a/src/document/renderer.c +++ b/src/document/renderer.c @@ -388,7 +388,7 @@ render_document(struct view_state *vs, struct document_view *doc_view, #ifdef CONFIG_ECMASCRIPT if (!vs->ecmascript_fragile) assert(vs->ecmascript); - if (!options->gradual_rerendering) { + if (!options->dump && !options->gradual_rerendering) { /* We also reset the state if the underlying document changed * from the last time we did the snippets. This may be * triggered i.e. when redrawing a document which has been diff --git a/src/document/renderer.h b/src/document/renderer.h index 350d7964..884c79b8 100644 --- a/src/document/renderer.h +++ b/src/document/renderer.h @@ -3,6 +3,10 @@ #include "document/document.h" +#ifdef __cplusplus +extern "C" { +#endif + struct conv_table; struct document_options; struct document_view; @@ -15,4 +19,8 @@ void render_document_frames(struct session *ses, int no_cache); struct conv_table *get_convert_table(unsigned char *head, int to_cp, int default_cp, int *from_cp, enum cp_status *cp_status, int ignore_server_cp); void sort_links(struct document *document); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/document/view.h b/src/document/view.h index cb514ab7..253b9c02 100644 --- a/src/document/view.h +++ b/src/document/view.h @@ -5,6 +5,9 @@ #include "util/lists.h" #include "util/box.h" +#ifdef __cplusplus +extern "C" { +#endif struct document; struct view_state; @@ -38,4 +41,8 @@ struct document_view { && (doc_view)->vs->current_link < (doc_view)->document->nlinks) \ ? &(doc_view)->document->links[(doc_view)->vs->current_link] : NULL) +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/dom/code.h b/src/dom/code.h index 3a58ca0f..a8bcc98f 100644 --- a/src/dom/code.h +++ b/src/dom/code.h @@ -1,6 +1,10 @@ #ifndef EL_DOM_CODE_H #define EL_DOM_CODE_H +#ifdef __cplusplus +extern "C" { +#endif + /** DOM status, error, and exception codes * * These enum values are used for return codes throughout the DOM engine. @@ -76,4 +80,8 @@ enum dom_code { DOM_CODE_TYPE_MISMATCH_ERR = 17, }; +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/dom/configuration.h b/src/dom/configuration.h index 2661cbf5..dfe2364d 100644 --- a/src/dom/configuration.h +++ b/src/dom/configuration.h @@ -1,6 +1,10 @@ #ifndef EL__DOM_CONFIGURATION_H #define EL__DOM_CONFIGURATION_H +#ifdef __cplusplus +extern "C" { +#endif + struct dom_node; struct dom_stack; @@ -92,4 +96,8 @@ add_dom_config_normalizer(struct dom_stack *stack, struct dom_config *config, enum dom_config_flag parse_dom_config(unsigned char *flaglist, unsigned char separator); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/dom/css/scanner.h b/src/dom/css/scanner.h index 3d3173db..894529cc 100644 --- a/src/dom/css/scanner.h +++ b/src/dom/css/scanner.h @@ -3,6 +3,10 @@ #include "dom/scanner.h" +#ifdef __cplusplus +extern "C" { +#endif + /* The various token types and what they contain. Patterns taken from * the flex scanner declarations in the CSS 2 Specification. */ enum css_token_type { @@ -108,4 +112,8 @@ check_css_precedence(int type, int skipto) return get_css_precedence(type) < get_css_precedence(skipto); } +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/dom/node.h b/src/dom/node.h index 90dc3f73..3bb2b4c0 100644 --- a/src/dom/node.h +++ b/src/dom/node.h @@ -58,6 +58,10 @@ #include "dom/string.h" +#ifdef __cplusplus +extern "C" { +#endif + struct dom_node_list; struct dom_document; @@ -475,4 +479,8 @@ get_dom_node_list_by_type(struct dom_node *parent, enum dom_node_type type) #define get_dom_node_list(parent, node) \ get_dom_node_list_by_type(parent, (node)->type) +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/dom/scanner.h b/src/dom/scanner.h index 9e830422..ece2705e 100644 --- a/src/dom/scanner.h +++ b/src/dom/scanner.h @@ -4,6 +4,10 @@ #include "dom/string.h" #include "util/error.h" +#ifdef __cplusplus +extern "C" { +#endif + /* Define if you want a talking scanner */ /* #define DEBUG_DOM_SCANNER */ @@ -292,4 +296,8 @@ end_dom_token_scanning(struct dom_scanner *scanner, struct dom_scanner_token *en return get_dom_scanner_token(scanner); } +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/dom/select.h b/src/dom/select.h index e794e1f5..ee8f3799 100644 --- a/src/dom/select.h +++ b/src/dom/select.h @@ -3,6 +3,9 @@ #include "dom/node.h" +#ifdef __cplusplus +extern "C" { +#endif /* FIXME: Namespaces; *|E */ @@ -354,4 +357,8 @@ select_dom_nodes(struct dom_select *select, struct dom_node *root); * +------------------------------------------------------------------------------------+ */ +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/dom/sgml/docbook/docbook.h b/src/dom/sgml/docbook/docbook.h index 879b3427..693e39a8 100644 --- a/src/dom/sgml/docbook/docbook.h +++ b/src/dom/sgml/docbook/docbook.h @@ -4,6 +4,10 @@ #include "dom/stack.h" #include "dom/sgml/sgml.h" +#ifdef __cplusplus +extern "C" { +#endif + extern struct sgml_info sgml_docbook_info; #define DOCBOOK_(node, name, flags) \ @@ -27,4 +31,8 @@ enum docbook_attribute_type { #undef DOCBOOK_ +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/dom/sgml/dump.h b/src/dom/sgml/dump.h index ac21a85a..fad6b157 100644 --- a/src/dom/sgml/dump.h +++ b/src/dom/sgml/dump.h @@ -3,10 +3,18 @@ #include +#ifdef __cplusplus +extern "C" { +#endif + struct dom_stack; struct dom_stack_context; struct dom_stack_context * add_sgml_file_dumper(struct dom_stack *stack, FILE *file); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/dom/sgml/html/html.h b/src/dom/sgml/html/html.h index 31747dde..b2c91baa 100644 --- a/src/dom/sgml/html/html.h +++ b/src/dom/sgml/html/html.h @@ -3,6 +3,10 @@ #include "dom/sgml/sgml.h" +#ifdef __cplusplus +extern "C" { +#endif + extern struct sgml_info sgml_html_info; #undef VERSION @@ -28,4 +32,8 @@ enum html_attribute_type { #undef HTML_ #undef HTM2_ +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/dom/sgml/parser.h b/src/dom/sgml/parser.h index 4c338d50..fba7a541 100644 --- a/src/dom/sgml/parser.h +++ b/src/dom/sgml/parser.h @@ -7,6 +7,10 @@ #include "dom/sgml/sgml.h" #include "dom/scanner.h" +#ifdef __cplusplus +extern "C" { +#endif + struct sgml_parser; struct string; struct uri; @@ -144,4 +148,8 @@ parse_sgml(struct sgml_parser *parser, unsigned char *buf, size_t bufsize, int c */ unsigned int get_sgml_parser_line_number(struct sgml_parser *parser); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/dom/sgml/rss/rss.h b/src/dom/sgml/rss/rss.h index ea04c39e..690b1459 100644 --- a/src/dom/sgml/rss/rss.h +++ b/src/dom/sgml/rss/rss.h @@ -3,6 +3,10 @@ #include "dom/sgml/sgml.h" +#ifdef __cplusplus +extern "C" { +#endif + extern struct sgml_info sgml_rss_info; #define RSS_(node, name, flags) SGML_NODE_INFO_TYPE(RSS, node, name) @@ -25,4 +29,8 @@ enum rss_attribute_type { #undef RSS_ +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/dom/sgml/scanner.h b/src/dom/sgml/scanner.h index 7c3edcfd..a531dfdd 100644 --- a/src/dom/sgml/scanner.h +++ b/src/dom/sgml/scanner.h @@ -3,6 +3,10 @@ #include "dom/scanner.h" +#ifdef __cplusplus +extern "C" { +#endif + enum sgml_token_type { /* Char tokens: */ @@ -87,4 +91,8 @@ extern struct dom_scanner_info sgml_scanner_info; #define skip_sgml_tokens(scanner, type) \ skip_dom_scanner_tokens(scanner, type, get_sgml_precedence(type)) +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/dom/sgml/sgml.h b/src/dom/sgml/sgml.h index f7b8048c..24d372eb 100644 --- a/src/dom/sgml/sgml.h +++ b/src/dom/sgml/sgml.h @@ -6,6 +6,10 @@ #include "dom/node.h" #include "dom/string.h" +#ifdef __cplusplus +extern "C" { +#endif + /* The flags stored in the attribute sgml node info data */ /* TODO: Other potential flags (there can be only 16) * @@ -91,4 +95,8 @@ struct sgml_info { struct sgml_info *get_sgml_info(enum sgml_document_type doctype); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/dom/sgml/xbel/xbel.h b/src/dom/sgml/xbel/xbel.h index 493c4940..fe11d243 100644 --- a/src/dom/sgml/xbel/xbel.h +++ b/src/dom/sgml/xbel/xbel.h @@ -3,6 +3,10 @@ #include "dom/sgml/sgml.h" +#ifdef __cplusplus +extern "C" { +#endif + extern struct sgml_info sgml_xbel_info; #define XBEL_(node, name, flags) SGML_NODE_INFO_TYPE(XBEL, node, name) @@ -25,4 +29,8 @@ enum xbel_attribute_type { #undef XBEL_ +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/dom/stack.h b/src/dom/stack.h index 3c230ef4..5a60b649 100644 --- a/src/dom/stack.h +++ b/src/dom/stack.h @@ -47,6 +47,10 @@ #include "util/error.h" #include "util/hash.h" +#ifdef __cplusplus +extern "C" { +#endif + struct dom_stack; /** DOM stack callback @@ -334,4 +338,8 @@ search_dom_stack(struct dom_stack *stack, enum dom_node_type type, * to the stack. */ void walk_dom_nodes(struct dom_stack *stack, struct dom_node *root); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/dom/string.h b/src/dom/string.h index f6032538..441c0f98 100644 --- a/src/dom/string.h +++ b/src/dom/string.h @@ -4,6 +4,10 @@ #include "util/conv.h" #include "util/memory.h" +#ifdef __cplusplus +extern "C" { +#endif + /* For now DOM has it's own little string library. Mostly because there are * some memory overhead associated with util/string's block-based allocation * scheme which is optimized for building strings and quickly dispose of it. @@ -74,4 +78,8 @@ add_to_dom_string(struct dom_string *string, unsigned char *str, size_t len) #define isquote(c) ((c) == '"' || (c) == '\'') +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/ecmascript/ecmascript.h b/src/ecmascript/ecmascript.h index 8bf25de2..55273fad 100644 --- a/src/ecmascript/ecmascript.h +++ b/src/ecmascript/ecmascript.h @@ -32,11 +32,7 @@ struct ecmascript_interpreter { /* The code evaluated by setTimeout() */ struct string code; -#if defined(CONFIG_ECMASCRIPT_SMJS_HEARTBEAT) struct heartbeat *heartbeat; -#elif defined(HAVE_JS_SETBRANCHCALLBACK) - time_t exec_start; -#endif /* This is a cross-rerenderings accumulator of * @document.onload_snippets (see its description for juicy details). diff --git a/src/ecmascript/empty.cpp b/src/ecmascript/empty.cpp new file mode 100644 index 00000000..e69de29b diff --git a/src/ecmascript/meson.build b/src/ecmascript/meson.build index 8b9d01cd..af4aec2b 100644 --- a/src/ecmascript/meson.build +++ b/src/ecmascript/meson.build @@ -13,7 +13,7 @@ else endif if CONFIG_ANY_SPIDERMONKEY - srcs += files('spidermonkey-shared.c') + srcs += files('spidermonkey-shared.c', 'empty.cpp') endif srcs += files('ecmascript.c') diff --git a/src/ecmascript/spidermonkey-shared.c b/src/ecmascript/spidermonkey-shared.c index 61b22e69..d23922dd 100644 --- a/src/ecmascript/spidermonkey-shared.c +++ b/src/ecmascript/spidermonkey-shared.c @@ -44,7 +44,7 @@ spidermonkey_runtime_addref(void) assert(spidermonkey_empty_context == NULL); if_assert_failed return 0; - spidermonkey_runtime = JS_NewRuntime(4L * 1024L * 1024L); + spidermonkey_runtime = JS_NewRuntime(4L * 1024L * 1024L, JS_USE_HELPER_THREADS); if (!spidermonkey_runtime) return 0; spidermonkey_empty_context = JS_NewContext(spidermonkey_runtime, diff --git a/src/ecmascript/spidermonkey-shared.h b/src/ecmascript/spidermonkey-shared.h index 72ea1049..74e709ad 100644 --- a/src/ecmascript/spidermonkey-shared.h +++ b/src/ecmascript/spidermonkey-shared.h @@ -87,7 +87,7 @@ jsid_to_string(JSContext *ctx, jsid *id) return jsval_to_string(ctx, &v); } -#define ELINKS_CAST_PROP_PARAMS JSObject *obj = *(hobj._); \ - jsval *vp = (hvp._); +#define ELINKS_CAST_PROP_PARAMS JSObject *obj = (hobj.get()); \ + jsval *vp = (hvp.address()); #endif diff --git a/src/ecmascript/spidermonkey.c b/src/ecmascript/spidermonkey.c index 2c8ba385..6555bbce 100644 --- a/src/ecmascript/spidermonkey.c +++ b/src/ecmascript/spidermonkey.c @@ -50,7 +50,7 @@ #include "viewer/text/link.h" #include "viewer/text/vs.h" - +using namespace JS; /*** Global methods */ @@ -111,34 +111,6 @@ reported: JS_ClearPendingException(ctx); } -#if !defined(CONFIG_ECMASCRIPT_SMJS_HEARTBEAT) && defined(HAVE_JS_SETBRANCHCALLBACK) -static JSBool -safeguard(JSContext *ctx, JSScript *script) -{ - struct ecmascript_interpreter *interpreter = JS_GetContextPrivate(ctx); - struct session *ses = interpreter->vs->doc_view->session; - int max_exec_time = get_opt_int("ecmascript.max_exec_time", ses); - - if (time(NULL) - interpreter->exec_start > max_exec_time) { - struct terminal *term = ses->tab->term; - - /* A killer script! Alert! */ - ecmascript_timeout_dialog(term, max_exec_time); - return JS_FALSE; - } - return JS_TRUE; -} - -static void -setup_safeguard(struct ecmascript_interpreter *interpreter, - JSContext *ctx) -{ - interpreter->exec_start = time(NULL); - JS_SetBranchCallback(ctx, safeguard); -} -#endif - - static void spidermonkey_init(struct module *xxx) { @@ -157,8 +129,9 @@ void * spidermonkey_get_interpreter(struct ecmascript_interpreter *interpreter) { JSContext *ctx; - JSObject *window_obj, *document_obj, *forms_obj, *history_obj, *location_obj, + JSObject *document_obj, *forms_obj, *history_obj, *location_obj, *statusbar_obj, *menubar_obj, *navigator_obj; + JSAutoCompartment *ac = NULL; assert(interpreter); if (!js_module_init_ok) return NULL; @@ -168,17 +141,19 @@ spidermonkey_get_interpreter(struct ecmascript_interpreter *interpreter) if (!ctx) return NULL; interpreter->backend_data = ctx; + JSAutoRequest ar(ctx); JS_SetContextPrivate(ctx, interpreter); - JS_SetOptions(ctx, JSOPTION_VAROBJFIX | JSOPTION_METHODJIT); - JS_SetVersion(ctx, JSVERSION_LATEST); + JS_SetOptions(ctx, JSOPTION_VAROBJFIX | JS_METHODJIT); JS_SetErrorReporter(ctx, error_reporter); -#if defined(CONFIG_ECMASCRIPT_SMJS_HEARTBEAT) JS_SetOperationCallback(ctx, heartbeat_callback); -#endif - + RootedObject window_obj(ctx); window_obj = JS_NewGlobalObject(ctx, &window_class, NULL); - if (!window_obj) goto release_and_fail; + if (window_obj) { + ac = new JSAutoCompartment(ctx, window_obj); + } else { + goto release_and_fail; + } if (!JS_InitStandardClasses(ctx, window_obj)) { goto release_and_fail; @@ -288,18 +263,12 @@ spidermonkey_eval(struct ecmascript_interpreter *interpreter, } ctx = interpreter->backend_data; -#if defined(CONFIG_ECMASCRIPT_SMJS_HEARTBEAT) interpreter->heartbeat = add_heartbeat(interpreter); -#elif defined(HAVE_JS_SETBRANCHCALLBACK) - setup_safeguard(interpreter, ctx); -#endif interpreter->ret = ret; - JS_EvaluateScript(ctx, JS_GetGlobalObject(ctx), + JS_EvaluateScript(ctx, JS_GetGlobalForScopeChain(ctx), code->source, code->length, "", 0, &rval); -#if defined(CONFIG_ECMASCRIPT_SMJS_HEARTBEAT) done_heartbeat(interpreter->heartbeat); -#endif } @@ -315,17 +284,12 @@ spidermonkey_eval_stringback(struct ecmascript_interpreter *interpreter, if (!js_module_init_ok) return NULL; ctx = interpreter->backend_data; interpreter->ret = NULL; -#if defined(CONFIG_ECMASCRIPT_SMJS_HEARTBEAT) interpreter->heartbeat = add_heartbeat(interpreter); -#elif defined(HAVE_JS_SETBRANCHCALLBACK) - setup_safeguard(interpreter, ctx); -#endif - ret = JS_EvaluateScript(ctx, JS_GetGlobalObject(ctx), + ret = JS_EvaluateScript(ctx, JS_GetGlobalForScopeChain(ctx), code->source, code->length, "", 0, &rval); -#if defined(CONFIG_ECMASCRIPT_SMJS_HEARTBEAT) done_heartbeat(interpreter->heartbeat); -#endif + if (ret == JS_FALSE) { return NULL; } @@ -352,21 +316,15 @@ spidermonkey_eval_boolback(struct ecmascript_interpreter *interpreter, ctx = interpreter->backend_data; interpreter->ret = NULL; - fun = JS_CompileFunction(ctx, JS_GetGlobalObject(ctx), "", 0, NULL, code->source, + fun = JS_CompileFunction(ctx, JS_GetGlobalForScopeChain(ctx), "", 0, NULL, code->source, code->length, "", 0); if (!fun) return -1; -#if defined(CONFIG_ECMASCRIPT_SMJS_HEARTBEAT) interpreter->heartbeat = add_heartbeat(interpreter); -#elif defined(HAVE_JS_SETBRANCHCALLBACK) - setup_safeguard(interpreter, ctx); -#endif - ret = JS_CallFunction(ctx, JS_GetGlobalObject(ctx), fun, 0, NULL, &rval); - -#if defined(CONFIG_ECMASCRIPT_SMJS_HEARTBEAT) + ret = JS_CallFunction(ctx, JS_GetGlobalForScopeChain(ctx), fun, 0, NULL, &rval); done_heartbeat(interpreter->heartbeat); -#endif + if (ret == 2) { /* onClick="history.back()" */ return 0; } diff --git a/src/ecmascript/spidermonkey/Makefile b/src/ecmascript/spidermonkey/Makefile index 377ca804..1d712994 100644 --- a/src/ecmascript/spidermonkey/Makefile +++ b/src/ecmascript/spidermonkey/Makefile @@ -2,8 +2,6 @@ top_builddir=../../.. include $(top_builddir)/Makefile.config INCLUDES += $(SPIDERMONKEY_CFLAGS) -OBJS-$(CONFIG_ECMASCRIPT_SMJS_HEARTBEAT) += heartbeat.o - -OBJS = document.o form.o location.o navigator.o unibar.o window.o +OBJS = document.o form.o heartbeat.o location.o navigator.o unibar.o window.o include $(top_srcdir)/Makefile.lib diff --git a/src/ecmascript/spidermonkey/document.c b/src/ecmascript/spidermonkey/document.c index 026f0671..72f084eb 100644 --- a/src/ecmascript/spidermonkey/document.c +++ b/src/ecmascript/spidermonkey/document.c @@ -47,20 +47,20 @@ #include "viewer/text/vs.h" -static JSBool document_get_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp); +static JSBool document_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); /* Each @document_class object must have a @window_class parent. */ JSClass document_class = { "document", JSCLASS_HAS_PRIVATE, - JS_PropertyStub, JS_PropertyStub, + JS_PropertyStub, JS_DeletePropertyStub, document_get_property, JS_StrictPropertyStub, JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub }; #ifdef CONFIG_COOKIES static JSBool -document_get_property_cookie(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) +document_get_property_cookie(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS @@ -94,7 +94,7 @@ document_get_property_cookie(JSContext *ctx, JSHandleObject hobj, JSHandleId hid } static JSBool -document_set_property_cookie(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSBool strict, JSMutableHandleValue hvp) +document_set_property_cookie(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS @@ -121,7 +121,7 @@ document_set_property_cookie(JSContext *ctx, JSHandleObject hobj, JSHandleId hid #endif static JSBool -document_get_property_location(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) +document_get_property_location(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS @@ -141,7 +141,7 @@ document_get_property_location(JSContext *ctx, JSHandleObject hobj, JSHandleId h } static JSBool -document_set_property_location(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSBool strict, JSMutableHandleValue hvp) +document_set_property_location(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS @@ -169,7 +169,7 @@ document_set_property_location(JSContext *ctx, JSHandleObject hobj, JSHandleId h static JSBool -document_get_property_referrer(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) +document_get_property_referrer(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS @@ -220,7 +220,7 @@ document_get_property_referrer(JSContext *ctx, JSHandleObject hobj, JSHandleId h static JSBool -document_get_property_title(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) +document_get_property_title(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS @@ -247,7 +247,7 @@ document_get_property_title(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, } static JSBool -document_set_property_title(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSBool strict, JSMutableHandleValue hvp) +document_set_property_title(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS @@ -277,7 +277,7 @@ document_set_property_title(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, } static JSBool -document_get_property_url(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) +document_get_property_url(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS @@ -304,7 +304,7 @@ document_get_property_url(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, J } static JSBool -document_set_property_url(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSBool strict, JSMutableHandleValue hvp) +document_set_property_url(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS @@ -347,10 +347,10 @@ JSPropertySpec document_props[] = { /* @document_class.getProperty */ static JSBool -document_get_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) +document_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS - jsid id = *(hid._); + jsid id = hid.get(); JSObject *parent_win; /* instance of @window_class */ struct view_state *vs; diff --git a/src/ecmascript/spidermonkey/form.c b/src/ecmascript/spidermonkey/form.c index 736f75b4..64c53ad3 100644 --- a/src/ecmascript/spidermonkey/form.c +++ b/src/ecmascript/spidermonkey/form.c @@ -47,7 +47,33 @@ #include "viewer/text/vs.h" -static JSClass form_class; /* defined below */ +//static JSClass form_class; /* defined below */ + +static JSBool form_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); +static JSBool form_get_property_action(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); +static JSBool form_set_property_action(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp); +static JSBool form_get_property_elements(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); +static JSBool form_get_property_encoding(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); +static JSBool form_set_property_encoding(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp); +static JSBool form_get_property_length(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); +static JSBool form_get_property_method(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); +static JSBool form_set_property_method(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp); +static JSBool form_get_property_name(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); +static JSBool form_set_property_name(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp); +static JSBool form_get_property_target(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); +static JSBool form_set_property_target(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp); + +static void form_finalize(JSFreeOp *op, JSObject *obj); + +/* Each @form_class object must have a @document_class parent. */ +static JSClass form_class = { + "form", + JSCLASS_HAS_PRIVATE, /* struct form_view *, or NULL if detached */ + JS_PropertyStub, JS_PropertyStub, + form_get_property, JS_StrictPropertyStub, + JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, form_finalize +}; + /* Accordingly to the JS specs, each input type should own object. That'd be a @@ -55,15 +81,15 @@ static JSClass form_class; /* defined below */ * HTMLInputElement. The difference could be spotted only by some clever tricky * JS code, but I hope it doesn't matter anywhere. --pasky */ -static JSBool input_get_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp); -static JSBool input_set_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSBool strict, JSMutableHandleValue hvp); +static JSBool input_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); +static JSBool input_set_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp); static void input_finalize(JSFreeOp *op, JSObject *obj); /* Each @input_class object must have a @form_class parent. */ static JSClass input_class = { "input", /* here, we unleash ourselves */ JSCLASS_HAS_PRIVATE, /* struct form_state *, or NULL if detached */ - JS_PropertyStub, JS_PropertyStub, + JS_PropertyStub, JS_DeletePropertyStub, input_get_property, input_set_property, JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, input_finalize }; @@ -97,7 +123,7 @@ static struct form_state *input_get_form_state(JSContext *ctx, JSObject *jsinput static JSBool -input_get_property_accessKey(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) +input_get_property_accessKey(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS @@ -163,7 +189,7 @@ input_get_property_accessKey(JSContext *ctx, JSHandleObject hobj, JSHandleId hid } static JSBool -input_set_property_accessKey(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSBool strict, JSMutableHandleValue hvp) +input_set_property_accessKey(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS @@ -220,7 +246,7 @@ input_set_property_accessKey(JSContext *ctx, JSHandleObject hobj, JSHandleId hid } static JSBool -input_get_property_alt(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) +input_get_property_alt(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS @@ -268,7 +294,7 @@ input_get_property_alt(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMu } static JSBool -input_set_property_alt(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSBool strict, JSMutableHandleValue hvp) +input_set_property_alt(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS @@ -313,7 +339,7 @@ input_set_property_alt(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSBo } static JSBool -input_get_property_checked(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) +input_get_property_checked(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS @@ -334,7 +360,7 @@ input_get_property_checked(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, } static JSBool -input_set_property_checked(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSBool strict, JSMutableHandleValue hvp) +input_set_property_checked(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS @@ -381,7 +407,7 @@ input_set_property_checked(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, } static JSBool -input_get_property_defaultChecked(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) +input_get_property_defaultChecked(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS @@ -429,7 +455,7 @@ input_get_property_defaultChecked(JSContext *ctx, JSHandleObject hobj, JSHandleI } static JSBool -input_get_property_defaultValue(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) +input_get_property_defaultValue(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS @@ -478,7 +504,7 @@ input_get_property_defaultValue(JSContext *ctx, JSHandleObject hobj, JSHandleId } static JSBool -input_get_property_disabled(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) +input_get_property_disabled(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS @@ -527,7 +553,7 @@ input_get_property_disabled(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, } static JSBool -input_set_property_disabled(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSBool strict, JSMutableHandleValue hvp) +input_set_property_disabled(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS @@ -575,7 +601,7 @@ input_set_property_disabled(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, } static JSBool -input_get_property_form(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) +input_get_property_form(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS @@ -597,7 +623,7 @@ input_get_property_form(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSM } static JSBool -input_get_property_maxLength(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) +input_get_property_maxLength(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS @@ -645,7 +671,7 @@ input_get_property_maxLength(JSContext *ctx, JSHandleObject hobj, JSHandleId hid } static JSBool -input_set_property_maxLength(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSBool strict, JSMutableHandleValue hvp) +input_set_property_maxLength(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS @@ -691,7 +717,7 @@ input_set_property_maxLength(JSContext *ctx, JSHandleObject hobj, JSHandleId hid } static JSBool -input_get_property_name(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) +input_get_property_name(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS @@ -740,7 +766,7 @@ input_get_property_name(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSM /* @input_class.setProperty */ static JSBool -input_set_property_name(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSBool strict, JSMutableHandleValue hvp) +input_set_property_name(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS @@ -785,7 +811,7 @@ input_set_property_name(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSB } static JSBool -input_get_property_readonly(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) +input_get_property_readonly(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS @@ -835,7 +861,7 @@ input_get_property_readonly(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, /* @input_class.setProperty */ static JSBool -input_set_property_readonly(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSBool strict, JSMutableHandleValue hvp) +input_set_property_readonly(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS @@ -883,7 +909,7 @@ input_set_property_readonly(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, } static JSBool -input_get_property_selectedIndex(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) +input_get_property_selectedIndex(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS @@ -934,7 +960,7 @@ input_get_property_selectedIndex(JSContext *ctx, JSHandleObject hobj, JSHandleId /* @input_class.setProperty */ static JSBool -input_set_property_selectedIndex(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSBool strict, JSMutableHandleValue hvp) +input_set_property_selectedIndex(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS @@ -989,7 +1015,7 @@ input_set_property_selectedIndex(JSContext *ctx, JSHandleObject hobj, JSHandleId } static JSBool -input_get_property_size(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) +input_get_property_size(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS @@ -1037,7 +1063,7 @@ input_get_property_size(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSM } static JSBool -input_get_property_src(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) +input_get_property_src(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS @@ -1093,7 +1119,7 @@ input_get_property_src(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMu } static JSBool -input_set_property_src(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSBool strict, JSMutableHandleValue hvp) +input_set_property_src(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS @@ -1146,7 +1172,7 @@ input_set_property_src(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSBo } static JSBool -input_get_property_tabIndex(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) +input_get_property_tabIndex(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS @@ -1204,7 +1230,7 @@ input_get_property_tabIndex(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, } static JSBool -input_get_property_type(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) +input_get_property_type(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS @@ -1267,7 +1293,7 @@ input_get_property_type(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSM } static JSBool -input_get_property_value(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) +input_get_property_value(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS @@ -1287,7 +1313,7 @@ input_get_property_value(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JS } static JSBool -input_set_property_value(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSBool strict, JSMutableHandleValue hvp) +input_set_property_value(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS @@ -1390,10 +1416,10 @@ input_get_form_state(JSContext *ctx, JSObject *jsinput) /* @input_class.getProperty */ static JSBool -input_get_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) +input_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS - jsid id = *(hid._); + jsid id = hid.get(); JSObject *parent_form; /* instance of @form_class */ JSObject *parent_doc; /* instance of @document_class */ @@ -1547,10 +1573,10 @@ input_get_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutabl /* @input_class.setProperty */ static JSBool -input_set_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSBool strict, JSMutableHandleValue hvp) +input_set_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS - jsid id = *(hid._); + jsid id = hid.get(); JSObject *parent_form; /* instance of @form_class */ JSObject *parent_doc; /* instance of @document_class */ @@ -1916,13 +1942,13 @@ get_form_control_object(JSContext *ctx, JSObject *jsform, static struct form_view *form_get_form_view(JSContext *ctx, JSObject *jsform, jsval *argv); -static JSBool form_elements_get_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp); +static JSBool form_elements_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); /* Each @form_elements_class object must have a @form_class parent. */ static JSClass form_elements_class = { "elements", JSCLASS_HAS_PRIVATE, - JS_PropertyStub, JS_PropertyStub, + JS_PropertyStub, JS_DeletePropertyStub, form_elements_get_property, JS_StrictPropertyStub, JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, NULL }; @@ -1939,7 +1965,7 @@ static const spidermonkeyFunctionSpec form_elements_funcs[] = { { NULL } }; -static JSBool form_elements_get_property_length(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp); +static JSBool form_elements_get_property_length(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); /* Tinyids of properties. Use negative values to distinguish these * from array indexes (elements[INT] for INT>=0 is equivalent to @@ -1954,10 +1980,10 @@ static JSPropertySpec form_elements_props[] = { }; static JSBool -form_elements_get_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) +form_elements_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS - jsid id = *(hid._); + jsid id = hid.get(); jsval idval; JSObject *parent_form; /* instance of @form_class */ @@ -2018,7 +2044,7 @@ form_elements_get_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, } static JSBool -form_elements_get_property_length(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) +form_elements_get_property_length(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS @@ -2206,31 +2232,6 @@ form_elements_namedItem2(JSContext *ctx, JSObject *obj, unsigned int argc, jsval -static JSBool form_get_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp); -static JSBool form_get_property_action(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp); -static JSBool form_set_property_action(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSBool strict, JSMutableHandleValue hvp); -static JSBool form_get_property_elements(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp); -static JSBool form_get_property_encoding(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp); -static JSBool form_set_property_encoding(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSBool strict, JSMutableHandleValue hvp); -static JSBool form_get_property_length(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp); -static JSBool form_get_property_method(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp); -static JSBool form_set_property_method(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSBool strict, JSMutableHandleValue hvp); -static JSBool form_get_property_name(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp); -static JSBool form_set_property_name(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSBool strict, JSMutableHandleValue hvp); -static JSBool form_get_property_target(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp); -static JSBool form_set_property_target(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSBool strict, JSMutableHandleValue hvp); - -static void form_finalize(JSFreeOp *op, JSObject *obj); - -/* Each @form_class object must have a @document_class parent. */ -static JSClass form_class = { - "form", - JSCLASS_HAS_PRIVATE, /* struct form_view *, or NULL if detached */ - JS_PropertyStub, JS_PropertyStub, - form_get_property, JS_StrictPropertyStub, - JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, form_finalize -}; - /* Tinyids of properties. Use negative values to distinguish these * from array indexes (even though this object has no array elements). * ECMAScript code should not use these directly as in form[-1]; @@ -2282,10 +2283,10 @@ form_get_form_view(JSContext *ctx, JSObject *jsform, jsval *argv) /* @form_class.getProperty */ static JSBool -form_get_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) +form_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS - jsid id = *(hid._); + jsid id = hid.get(); /* DBG("doc %p %s\n", parent_doc, JS_GetStringBytes(JS_ValueToString(ctx, OBJECT_TO_JSVAL(parent_doc)))); */ JSObject *parent_doc; /* instance of @document_class */ JSObject *parent_win; /* instance of @window_class */ @@ -2419,7 +2420,7 @@ form_get_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutable static JSBool -form_get_property_action(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) +form_get_property_action(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS /* DBG("doc %p %s\n", parent_doc, JS_GetStringBytes(JS_ValueToString(ctx, OBJECT_TO_JSVAL(parent_doc)))); */ @@ -2456,7 +2457,7 @@ form_get_property_action(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JS } static JSBool -form_set_property_action(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSBool strict, JSMutableHandleValue hvp) +form_set_property_action(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS @@ -2500,7 +2501,7 @@ form_set_property_action(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JS } static JSBool -form_get_property_elements(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) +form_get_property_elements(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS /* DBG("doc %p %s\n", parent_doc, JS_GetStringBytes(JS_ValueToString(ctx, OBJECT_TO_JSVAL(parent_doc)))); */ @@ -2530,7 +2531,7 @@ form_get_property_elements(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, } static JSBool -form_get_property_encoding(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) +form_get_property_encoding(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS /* DBG("doc %p %s\n", parent_doc, JS_GetStringBytes(JS_ValueToString(ctx, OBJECT_TO_JSVAL(parent_doc)))); */ @@ -2580,7 +2581,7 @@ form_get_property_encoding(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, /* @form_class.setProperty */ static JSBool -form_set_property_encoding(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSBool strict, JSMutableHandleValue hvp) +form_set_property_encoding(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS @@ -2627,7 +2628,7 @@ form_set_property_encoding(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, } static JSBool -form_get_property_length(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) +form_get_property_length(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS /* DBG("doc %p %s\n", parent_doc, JS_GetStringBytes(JS_ValueToString(ctx, OBJECT_TO_JSVAL(parent_doc)))); */ @@ -2665,7 +2666,7 @@ form_get_property_length(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JS } static JSBool -form_get_property_method(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) +form_get_property_method(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS /* DBG("doc %p %s\n", parent_doc, JS_GetStringBytes(JS_ValueToString(ctx, OBJECT_TO_JSVAL(parent_doc)))); */ @@ -2714,7 +2715,7 @@ form_get_property_method(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JS /* @form_class.setProperty */ static JSBool -form_set_property_method(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSBool strict, JSMutableHandleValue hvp) +form_set_property_method(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS @@ -2758,7 +2759,7 @@ form_set_property_method(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JS } static JSBool -form_get_property_name(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) +form_get_property_name(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS /* DBG("doc %p %s\n", parent_doc, JS_GetStringBytes(JS_ValueToString(ctx, OBJECT_TO_JSVAL(parent_doc)))); */ @@ -2797,7 +2798,7 @@ form_get_property_name(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMu /* @form_class.setProperty */ static JSBool -form_set_property_name(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSBool strict, JSMutableHandleValue hvp) +form_set_property_name(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS @@ -2834,7 +2835,7 @@ form_set_property_name(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSBo } static JSBool -form_get_property_target(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) +form_get_property_target(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS /* DBG("doc %p %s\n", parent_doc, JS_GetStringBytes(JS_ValueToString(ctx, OBJECT_TO_JSVAL(parent_doc)))); */ @@ -2871,7 +2872,7 @@ form_get_property_target(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JS } static JSBool -form_set_property_target(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSBool strict, JSMutableHandleValue hvp) +form_set_property_target(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS @@ -3062,8 +3063,8 @@ spidermonkey_detach_form_view(struct form_view *fv) } -static JSBool forms_get_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp); -static JSBool forms_get_property_length(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp); +static JSBool forms_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); +static JSBool forms_get_property_length(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); /* Each @forms_class object must have a @document_class parent. */ JSClass forms_class = { @@ -3121,10 +3122,10 @@ find_form_by_name(JSContext *ctx, JSObject *jsdoc, /* @forms_class.getProperty */ static JSBool -forms_get_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) +forms_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS - jsid id = *(hid._); + jsid id = hid.get(); jsval idval; JSObject *parent_doc; /* instance of @document_class */ @@ -3177,7 +3178,7 @@ forms_get_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutabl } static JSBool -forms_get_property_length(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) +forms_get_property_length(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS diff --git a/src/ecmascript/spidermonkey/location.c b/src/ecmascript/spidermonkey/location.c index a5a44bf5..33cc6b1d 100644 --- a/src/ecmascript/spidermonkey/location.c +++ b/src/ecmascript/spidermonkey/location.c @@ -52,7 +52,7 @@ static JSBool history_go(JSContext *ctx, unsigned int argc, jsval *rval); JSClass history_class = { "history", JSCLASS_HAS_PRIVATE, - JS_PropertyStub, JS_PropertyStub, + JS_PropertyStub, JS_DeletePropertyStub, JS_PropertyStub, JS_StrictPropertyStub, JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, NULL }; @@ -128,14 +128,14 @@ history_go(JSContext *ctx, unsigned int argc, jsval *rval) } -static JSBool location_get_property_href(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp); -static JSBool location_set_property_href(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSBool strict, JSMutableHandleValue hvp); +static JSBool location_get_property_href(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); +static JSBool location_set_property_href(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp); /* Each @location_class object must have a @window_class parent. */ JSClass location_class = { "location", JSCLASS_HAS_PRIVATE, - JS_PropertyStub, JS_PropertyStub, + JS_PropertyStub, JS_DeletePropertyStub, JS_PropertyStub, JS_StrictPropertyStub, JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, NULL }; @@ -154,7 +154,7 @@ JSPropertySpec location_props[] = { static JSBool -location_get_property_href(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) +location_get_property_href(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS @@ -179,7 +179,7 @@ location_get_property_href(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, } static JSBool -location_set_property_href(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSBool strict, JSMutableHandleValue hvp) +location_set_property_href(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS JSObject *parent_win; /* instance of @window_class */ diff --git a/src/ecmascript/spidermonkey/meson.build b/src/ecmascript/spidermonkey/meson.build index 2eaecc44..2d58e359 100644 --- a/src/ecmascript/spidermonkey/meson.build +++ b/src/ecmascript/spidermonkey/meson.build @@ -1,6 +1,3 @@ #INCLUDES += $(SPIDERMONKEY_CFLAGS) -if conf_data.get('CONFIG_ECMASCRIPT_SMJS_HEARTBEAT') - srcs += files('heartbeat.c') -endif -srcs += files('document.c', 'form.c', 'location.c', 'navigator.c', 'unibar.c', 'window.c') +srcs += files('document.c', 'form.c', 'heartbeat.c', 'location.c', 'navigator.c', 'unibar.c', 'window.c') diff --git a/src/ecmascript/spidermonkey/navigator.c b/src/ecmascript/spidermonkey/navigator.c index e253af46..57f2dcce 100644 --- a/src/ecmascript/spidermonkey/navigator.c +++ b/src/ecmascript/spidermonkey/navigator.c @@ -44,17 +44,17 @@ #include "viewer/text/vs.h" -static JSBool navigator_get_property_appCodeName(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp); -static JSBool navigator_get_property_appName(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp); -static JSBool navigator_get_property_appVersion(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp); -static JSBool navigator_get_property_language(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp); -static JSBool navigator_get_property_platform(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp); -static JSBool navigator_get_property_userAgent(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp); +static JSBool navigator_get_property_appCodeName(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); +static JSBool navigator_get_property_appName(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); +static JSBool navigator_get_property_appVersion(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); +static JSBool navigator_get_property_language(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); +static JSBool navigator_get_property_platform(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); +static JSBool navigator_get_property_userAgent(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); JSClass navigator_class = { "navigator", JSCLASS_HAS_PRIVATE, - JS_PropertyStub, JS_PropertyStub, + JS_PropertyStub, JS_DeletePropertyStub, JS_PropertyStub, JS_StrictPropertyStub, JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, NULL }; @@ -87,7 +87,7 @@ JSPropertySpec navigator_props[] = { /* @navigator_class.getProperty */ static JSBool -navigator_get_property_appCodeName(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) +navigator_get_property_appCodeName(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS (void)obj; @@ -98,7 +98,7 @@ navigator_get_property_appCodeName(JSContext *ctx, JSHandleObject hobj, JSHandle } static JSBool -navigator_get_property_appName(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) +navigator_get_property_appName(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS (void)obj; @@ -109,7 +109,7 @@ navigator_get_property_appName(JSContext *ctx, JSHandleObject hobj, JSHandleId h } static JSBool -navigator_get_property_appVersion(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) +navigator_get_property_appVersion(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS (void)obj; @@ -120,7 +120,7 @@ navigator_get_property_appVersion(JSContext *ctx, JSHandleObject hobj, JSHandleI } static JSBool -navigator_get_property_language(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) +navigator_get_property_language(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS (void)obj; @@ -135,7 +135,7 @@ navigator_get_property_language(JSContext *ctx, JSHandleObject hobj, JSHandleId } static JSBool -navigator_get_property_platform(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) +navigator_get_property_platform(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS (void)obj; @@ -146,7 +146,7 @@ navigator_get_property_platform(JSContext *ctx, JSHandleObject hobj, JSHandleId } static JSBool -navigator_get_property_userAgent(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) +navigator_get_property_userAgent(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS unsigned char *optstr; diff --git a/src/ecmascript/spidermonkey/unibar.c b/src/ecmascript/spidermonkey/unibar.c index f26cb180..2a12829f 100644 --- a/src/ecmascript/spidermonkey/unibar.c +++ b/src/ecmascript/spidermonkey/unibar.c @@ -44,14 +44,14 @@ #include "viewer/text/link.h" #include "viewer/text/vs.h" -static JSBool unibar_get_property_visible(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp); -static JSBool unibar_set_property_visible(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSBool strict, JSMutableHandleValue hvp); +static JSBool unibar_get_property_visible(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); +static JSBool unibar_set_property_visible(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp); /* Each @menubar_class object must have a @window_class parent. */ JSClass menubar_class = { "menubar", JSCLASS_HAS_PRIVATE, /* const char * "t" */ - JS_PropertyStub, JS_PropertyStub, + JS_PropertyStub, JS_DeletePropertyStub, JS_PropertyStub, JS_StrictPropertyStub, JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, NULL }; @@ -59,7 +59,7 @@ JSClass menubar_class = { JSClass statusbar_class = { "statusbar", JSCLASS_HAS_PRIVATE, /* const char * "s" */ - JS_PropertyStub, JS_PropertyStub, + JS_PropertyStub, JS_DeletePropertyStub, JS_PropertyStub, JS_StrictPropertyStub, JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, NULL }; @@ -79,7 +79,7 @@ JSPropertySpec unibar_props[] = { static JSBool -unibar_get_property_visible(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) +unibar_get_property_visible(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS @@ -126,7 +126,7 @@ unibar_get_property_visible(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, } static JSBool -unibar_set_property_visible(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSBool strict, JSMutableHandleValue hvp) +unibar_set_property_visible(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS diff --git a/src/ecmascript/spidermonkey/window.c b/src/ecmascript/spidermonkey/window.c index bee163ab..517ab4b8 100644 --- a/src/ecmascript/spidermonkey/window.c +++ b/src/ecmascript/spidermonkey/window.c @@ -44,19 +44,19 @@ #include "viewer/text/vs.h" -static JSBool window_get_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp); -static JSBool window_get_property_closed(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp); -static JSBool window_get_property_parent(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp); -static JSBool window_get_property_self(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp); -static JSBool window_get_property_status(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp); -static JSBool window_set_property_status(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSBool strict, JSMutableHandleValue hvp); -static JSBool window_get_property_top(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp); -static JSBool window_get_property_window(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp); +static JSBool window_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); +static JSBool window_get_property_closed(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); +static JSBool window_get_property_parent(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); +static JSBool window_get_property_self(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); +static JSBool window_get_property_status(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); +static JSBool window_set_property_status(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp); +static JSBool window_get_property_top(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); +static JSBool window_get_property_window(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); JSClass window_class = { "window", JSCLASS_HAS_PRIVATE | JSCLASS_GLOBAL_FLAGS, /* struct view_state * */ - JS_PropertyStub, JS_PropertyStub, + JS_PropertyStub, JS_DeletePropertyStub, window_get_property, JS_StrictPropertyStub, JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, NULL }; @@ -102,7 +102,7 @@ try_resolve_frame(struct document_view *doc_view, unsigned char *id) if (target->vs.ecmascript_fragile) ecmascript_reset_state(&target->vs); if (!target->vs.ecmascript) return NULL; - return JS_GetGlobalObject(target->vs.ecmascript->backend_data); + return JS_GetGlobalForScopeChain(target->vs.ecmascript->backend_data); } #if 0 @@ -128,10 +128,10 @@ find_child_frame(struct document_view *doc_view, struct frame_desc *tframe) /* @window_class.getProperty */ static JSBool -window_get_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) +window_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS - jsid id = *(hid._); + jsid id = hid.get(); struct view_state *vs; @@ -211,7 +211,7 @@ found_parent: if (doc_view->vs.ecmascript_fragile) ecmascript_reset_state(&doc_view->vs); assert(doc_view->ecmascript); - object_to_jsval(ctx, vp, JS_GetGlobalObject(doc_view->ecmascript->backend_data)); + object_to_jsval(ctx, vp, JS_GetGlobalForScopeChain(doc_view->ecmascript->backend_data)); break; } #endif @@ -228,7 +228,7 @@ found_parent: ecmascript_reset_state(top_view->vs); if (!top_view->vs->ecmascript) break; - newjsframe = JS_GetGlobalObject(top_view->vs->ecmascript->backend_data); + newjsframe = JS_GetGlobalForScopeChain(top_view->vs->ecmascript->backend_data); /* Keep this unrolled this way. Will have to check document.domain * JS property. */ @@ -439,7 +439,7 @@ window_setTimeout(JSContext *ctx, unsigned int argc, jsval *rval) } static JSBool -window_get_property_closed(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) +window_get_property_closed(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS @@ -455,7 +455,7 @@ window_get_property_closed(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, } static JSBool -window_get_property_parent(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) +window_get_property_parent(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS @@ -482,7 +482,7 @@ window_get_property_parent(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, } static JSBool -window_get_property_self(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) +window_get_property_self(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS @@ -498,7 +498,7 @@ window_get_property_self(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JS } static JSBool -window_get_property_status(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) +window_get_property_status(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS @@ -514,7 +514,7 @@ window_get_property_status(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, } static JSBool -window_set_property_status(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSBool strict, JSMutableHandleValue hvp) +window_set_property_status(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS @@ -535,7 +535,7 @@ window_set_property_status(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, } static JSBool -window_get_property_top(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) +window_get_property_top(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS @@ -561,7 +561,7 @@ window_get_property_top(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSM ecmascript_reset_state(top_view->vs); if (!top_view->vs->ecmascript) return JS_TRUE; - newjsframe = JS_GetGlobalObject(top_view->vs->ecmascript->backend_data); + newjsframe = JS_GetGlobalForScopeChain(top_view->vs->ecmascript->backend_data); /* Keep this unrolled this way. Will have to check document.domain * JS property. */ @@ -580,7 +580,7 @@ window_get_property_top(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSM } static JSBool -window_get_property_window(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) +window_get_property_window(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { return window_get_property_self(ctx, hobj, hid, hvp); } diff --git a/src/encoding/brotli.h b/src/encoding/brotli.h index 4f2b4247..b8972cb6 100644 --- a/src/encoding/brotli.h +++ b/src/encoding/brotli.h @@ -3,10 +3,18 @@ #include "encoding/encoding.h" +#ifdef __cplusplus +extern "C" { +#endif + #ifdef CONFIG_BROTLI extern const struct decoding_backend brotli_decoding_backend; #else #define brotli_decoding_backend dummy_decoding_backend #endif +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/encoding/bzip2.h b/src/encoding/bzip2.h index 1367500e..b25a2ce1 100644 --- a/src/encoding/bzip2.h +++ b/src/encoding/bzip2.h @@ -3,10 +3,18 @@ #include "encoding/encoding.h" +#ifdef __cplusplus +extern "C" { +#endif + #ifdef CONFIG_BZIP2 extern const struct decoding_backend bzip2_decoding_backend; #else #define bzip2_decoding_backend dummy_decoding_backend #endif +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/encoding/deflate.h b/src/encoding/deflate.h index 4d3d2c3a..b3b60b89 100644 --- a/src/encoding/deflate.h +++ b/src/encoding/deflate.h @@ -3,6 +3,10 @@ #include "encoding/encoding.h" +#ifdef __cplusplus +extern "C" { +#endif + #ifdef CONFIG_GZIP extern const struct decoding_backend deflate_decoding_backend; extern const struct decoding_backend gzip_decoding_backend; @@ -11,4 +15,8 @@ extern const struct decoding_backend gzip_decoding_backend; #define gzip_decoding_backend dummy_decoding_backend #endif +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/encoding/encoding.h b/src/encoding/encoding.h index 2eee7d71..d24cbe64 100644 --- a/src/encoding/encoding.h +++ b/src/encoding/encoding.h @@ -4,6 +4,10 @@ #include "network/state.h" #include "util/string.h" +#ifdef __cplusplus +extern "C" { +#endif + enum stream_encoding { ENCODING_NONE = 0, ENCODING_GZIP, @@ -47,4 +51,8 @@ read_file(struct stream_encoded *stream, int readsize, struct string *page); /* Reads the file with the given @filename into the string @source. */ struct connection_state read_encoded_file(struct string *filename, struct string *source); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/encoding/lzma.h b/src/encoding/lzma.h index 9268aee1..08d28d99 100644 --- a/src/encoding/lzma.h +++ b/src/encoding/lzma.h @@ -3,10 +3,18 @@ #include "encoding/encoding.h" +#ifdef __cplusplus +extern "C" { +#endif + #ifdef CONFIG_LZMA extern const struct decoding_backend lzma_decoding_backend; #else #define lzma_decoding_backend dummy_decoding_backend #endif +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/encoding/zstd.h b/src/encoding/zstd.h index 12aefb59..f67ad706 100644 --- a/src/encoding/zstd.h +++ b/src/encoding/zstd.h @@ -3,10 +3,18 @@ #include "encoding/encoding.h" +#ifdef __cplusplus +extern "C" { +#endif + #ifdef CONFIG_ZSTD extern const struct decoding_backend zstd_decoding_backend; #else #define zstd_decoding_backend dummy_decoding_backend #endif +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/formhist/dialogs.h b/src/formhist/dialogs.h index e3a02455..a72cc234 100644 --- a/src/formhist/dialogs.h +++ b/src/formhist/dialogs.h @@ -3,9 +3,17 @@ #include "bfu/hierbox.h" +#ifdef __cplusplus +extern "C" { +#endif + struct session; extern struct hierbox_browser formhist_browser; void formhist_manager(struct session *); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/formhist/formhist.h b/src/formhist/formhist.h index 7dcd7adc..a5c8a31d 100644 --- a/src/formhist/formhist.h +++ b/src/formhist/formhist.h @@ -7,6 +7,10 @@ #include "session/session.h" #include "util/lists.h" +#ifdef __cplusplus +extern "C" { +#endif + struct formhist_data { OBJECT_HEAD(struct formhist_data); @@ -36,4 +40,8 @@ int load_formhist_from_file(void); extern struct module forms_history_module; +#ifdef __cplusplus +} +#endif + #endif /* EL__FORMHIST_FORMHIST_H */ diff --git a/src/globhist/dialogs.h b/src/globhist/dialogs.h index 550bc3f8..338aaf30 100644 --- a/src/globhist/dialogs.h +++ b/src/globhist/dialogs.h @@ -4,7 +4,15 @@ #include "bfu/hierbox.h" #include "session/session.h" +#ifdef __cplusplus +extern "C" { +#endif + extern struct hierbox_browser globhist_browser; void history_manager(struct session *); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/globhist/globhist.h b/src/globhist/globhist.h index c3b5847f..92c8fee2 100644 --- a/src/globhist/globhist.h +++ b/src/globhist/globhist.h @@ -5,6 +5,10 @@ #include "util/lists.h" #include "util/time.h" +#ifdef __cplusplus +extern "C" { +#endif + struct listbox_item; struct input_history; @@ -31,4 +35,8 @@ struct global_history_item *get_global_history_item(unsigned char *); void add_global_history_item(unsigned char *, unsigned char *, time_t); int globhist_simple_search(unsigned char *, unsigned char *); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/intl/charsets.h b/src/intl/charsets.h index 5b8fcb32..b2fc8b5f 100644 --- a/src/intl/charsets.h +++ b/src/intl/charsets.h @@ -1,6 +1,10 @@ #ifndef EL__INTL_CHARSETS_H #define EL__INTL_CHARSETS_H +#ifdef __cplusplus +extern "C" { +#endif + struct hash; /* The TRE check in configure.ac assumes unicode_val_T is uint32_t. */ @@ -193,4 +197,8 @@ void free_charsets_lookup(void); #define get_utf16_high_surrogate(u) (0xD800 + (((u) - 0x10000) >> 10)) #define get_utf16_low_surrogate(u) (0xDC00 + ((u) & 0x3FF)) +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/intl/gettext/dcigettext.c b/src/intl/gettext/dcigettext.c index 55a7b8e3..a683b628 100644 --- a/src/intl/gettext/dcigettext.c +++ b/src/intl/gettext/dcigettext.c @@ -46,6 +46,7 @@ extern int errno; #endif #include +#include #include #include diff --git a/src/intl/gettext/gettext.h b/src/intl/gettext/gettext.h index 1026a1cf..7ab6ba44 100644 --- a/src/intl/gettext/gettext.h +++ b/src/intl/gettext/gettext.h @@ -22,6 +22,10 @@ #include #endif +#ifdef __cplusplus +extern "C" { +#endif + /* The magic number of the GNU message catalog format. */ #define _MAGIC 0x950412de #define _MAGIC_SWAPPED 0xde120495 @@ -91,4 +95,8 @@ struct string_desc { nls_uint32 offset; }; +#ifdef __cplusplus +} +#endif + #endif /* gettext.h */ diff --git a/src/intl/gettext/gettextP.h b/src/intl/gettext/gettextP.h index 088671df..ee3f05fd 100644 --- a/src/intl/gettext/gettextP.h +++ b/src/intl/gettext/gettextP.h @@ -30,6 +30,11 @@ #include "intl/gettext/loadinfo.h" #include "intl/gettext/gettext.h" /* Get nls_uint32. */ +#ifdef __cplusplus +extern "C" { +#endif + + #ifndef W #define W(flag, data) ((flag) ? SWAP (data) : (data)) #endif @@ -163,4 +168,8 @@ extern unsigned char *bind_textdomain_codeset__(const unsigned char *__domainnam extern void gettext_free_exp__(struct expression * exp); extern int gettext__parse(struct parse_args *arg); +#ifdef __cplusplus +} +#endif + #endif /* gettextP.h */ diff --git a/src/intl/gettext/libgettext.h b/src/intl/gettext/libgettext.h index 1b7447ec..630dc4b1 100644 --- a/src/intl/gettext/libgettext.h +++ b/src/intl/gettext/libgettext.h @@ -18,6 +18,10 @@ #ifndef _LIBGETTEXT_H #define _LIBGETTEXT_H 1 +#ifdef __cplusplus +extern "C" { +#endif + /* NLS can be disabled through the configure --disable-nls option. */ #if CONFIG_NLS @@ -45,4 +49,8 @@ translation is needed. Instead the string itself is the result. */ #define gettext_noop(Str) (Str) +#ifdef __cplusplus +} +#endif + #endif /* _LIBGETTEXT_H */ diff --git a/src/intl/gettext/libgnuintl.h b/src/intl/gettext/libgnuintl.h index 24ef5c65..cf3ae49f 100644 --- a/src/intl/gettext/libgnuintl.h +++ b/src/intl/gettext/libgnuintl.h @@ -25,6 +25,10 @@ #include +#ifdef __cplusplus +extern "C" { +#endif + #ifndef LC_MESSAGES #define LC_MESSAGES 1729 #endif @@ -103,4 +107,8 @@ #endif /* Optimizing. */ +#ifdef __cplusplus +} +#endif + #endif /* libintl.h */ diff --git a/src/intl/gettext/libintl.h b/src/intl/gettext/libintl.h index 15d6804b..0a3f00e8 100644 --- a/src/intl/gettext/libintl.h +++ b/src/intl/gettext/libintl.h @@ -17,6 +17,10 @@ #include "intl/charsets.h" #include "terminal/terminal.h" +#ifdef __cplusplus +extern "C" { +#endif + /* no-op - just for marking */ #define N_(msg) (gettext_noop(msg)) @@ -196,4 +200,8 @@ extern void set_language(int language); #endif /* CONFIG_NLS */ +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/intl/gettext/loadinfo.h b/src/intl/gettext/loadinfo.h index fe47c90c..d9d6ab81 100644 --- a/src/intl/gettext/loadinfo.h +++ b/src/intl/gettext/loadinfo.h @@ -19,6 +19,10 @@ #ifndef _LOADINFO_H #define _LOADINFO_H 1 +#ifdef __cplusplus +extern "C" { +#endif + /* Separator in PATH like lists of pathnames. */ #if defined _WIN32 || defined __WIN32__ || defined __EMX__ || defined __DJGPP__ /* Win32, OS/2, DOS */ @@ -84,4 +88,8 @@ extern int _nl_explode_name(unsigned char *name, const unsigned char **language, extern unsigned char *_nl_find_language(const unsigned char *name); +#ifdef __cplusplus +} +#endif + #endif /* loadinfo.h */ diff --git a/src/intl/uni_7b.inc b/src/intl/uni_7b.inc index 44f525b4..2d90491f 100644 --- a/src/intl/uni_7b.inc +++ b/src/intl/uni_7b.inc @@ -2454,7 +2454,7 @@ static const struct { unicode_val_T x; unsigned char *s; } unicode_7b [2453] = { {0x0000ff62, "\""}, {0x0000ff63, "\""}, {0x0000ff64, ","}, - {-1, NULL} + {UINT32_MAX, NULL} }; #define N_UNICODE_7B 2452 diff --git a/src/main/event.h b/src/main/event.h index 145b95a3..4c865e3e 100644 --- a/src/main/event.h +++ b/src/main/event.h @@ -3,6 +3,10 @@ #include +#ifdef __cplusplus +extern "C" { +#endif + #define EVENT_NONE (-1) @@ -119,5 +123,8 @@ void init_event(void); void done_event(void); +#ifdef __cplusplus +} +#endif #endif diff --git a/src/main/interlink.h b/src/main/interlink.h index 5538e3e8..5d6a687b 100644 --- a/src/main/interlink.h +++ b/src/main/interlink.h @@ -1,6 +1,10 @@ #ifndef EL__MAIN_INTERLINK_H #define EL__MAIN_INTERLINK_H +#ifdef __cplusplus +extern "C" { +#endif + #ifdef CONFIG_INTERLINK int init_interlink(void); void done_interlink(void); @@ -9,4 +13,8 @@ void done_interlink(void); #define done_interlink() #endif +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/main/main.c b/src/main/main.c index 22a90893..5b291be6 100644 --- a/src/main/main.c +++ b/src/main/main.c @@ -202,6 +202,7 @@ init(void) /* The ECMAScript code is not good at coping with this. And it * makes currently no sense to evaluate ECMAScript in this * context anyway. */ + printf("AAA\n"); get_opt_bool("ecmascript.enable", NULL) = 0; #endif if (!list_empty(url_list)) { diff --git a/src/main/main.h b/src/main/main.h index cddbb53f..5c330058 100644 --- a/src/main/main.h +++ b/src/main/main.h @@ -1,6 +1,10 @@ #ifndef EL__MAIN_MAIN_H #define EL__MAIN_MAIN_H +#ifdef __cplusplus +extern "C" { +#endif + enum retval { RET_OK, /* All is well */ RET_ERROR, /* Failed to fetch URL or write document when dumping */ @@ -23,4 +27,8 @@ extern struct program program; void shrink_memory(int); void parse_options_again(void); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/main/module.h b/src/main/module.h index 891bb7ad..002367c3 100644 --- a/src/main/module.h +++ b/src/main/module.h @@ -4,6 +4,10 @@ #include "config/options.h" #include "main/event.h" +#ifdef __cplusplus +extern "C" { +#endif + /* The module record */ struct module { @@ -87,4 +91,8 @@ void unregister_modules_options(struct module *modules[]); void init_modules(struct module *modules[]); void done_modules(struct module *modules[]); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/main/object.h b/src/main/object.h index 2d77b285..9218efde 100644 --- a/src/main/object.h +++ b/src/main/object.h @@ -3,6 +3,10 @@ #include "util/lists.h" +#ifdef __cplusplus +extern "C" { +#endif + #if 0 #define DEBUG_REFCOUNT #endif @@ -81,4 +85,8 @@ struct object_head { object_lock_debug(obj, "initialized"); \ } while (0) +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/main/select.h b/src/main/select.h index a40b4861..02c48781 100644 --- a/src/main/select.h +++ b/src/main/select.h @@ -1,6 +1,10 @@ #ifndef EL__MAIN_SELECT_H #define EL__MAIN_SELECT_H +#ifdef __cplusplus +extern "C" { +#endif + typedef void (*select_handler_T)(void *); /* Start the select loop after calling the passed @init() function. */ @@ -47,4 +51,9 @@ int can_read(int fd); int can_write(int fd); void terminate_select(void); + +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/main/timer.h b/src/main/timer.h index e5523afe..54cd6537 100644 --- a/src/main/timer.h +++ b/src/main/timer.h @@ -3,6 +3,10 @@ #include "util/time.h" +#ifdef __cplusplus +extern "C" { +#endif + /* Only available internally. */ struct timer; @@ -24,4 +28,8 @@ void kill_timer(timer_id_T *id); int get_next_timer_time(timeval_T *t); void set_events_for_timer(void); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/main/version.h b/src/main/version.h index 34c5a672..138b8b4a 100644 --- a/src/main/version.h +++ b/src/main/version.h @@ -1,9 +1,17 @@ #ifndef EL__MAIN_VERSION_H #define EL__MAIN_VERSION_H +#ifdef __cplusplus +extern "C" { +#endif + struct terminal; unsigned char *get_dyn_full_version(struct terminal *term, int more); void init_static_version(void); +#ifdef __cplusplus +} +#endif + #endif /* EL__MODULES_VERSION_H */ diff --git a/src/meson.build b/src/meson.build index b7dfb704..6b09afbb 100644 --- a/src/meson.build +++ b/src/meson.build @@ -41,7 +41,7 @@ srcs += files('vernum.c') incs = include_directories('..', '.') -extra_args = ['-DHAVE_CONFIG_H', '-fno-strict-aliasing', '-Wno-pointer-sign', '-Wno-builtin-declaration-mismatch', '-Wno-address'] +extra_args = ['-DHAVE_CONFIG_H', '-fno-strict-aliasing', '-Wno-pointer-sign', '-Wno-builtin-declaration-mismatch', '-Wno-address'] + extracflags elinks = executable( 'elinks', srcs, diff --git a/src/mime/backend/common.h b/src/mime/backend/common.h index 7c01443c..c4b5debd 100644 --- a/src/mime/backend/common.h +++ b/src/mime/backend/common.h @@ -4,6 +4,10 @@ #include "mime/mime.h" +#ifdef __cplusplus +extern "C" { +#endif + struct mime_backend { /* Resolve the content type from the @extension. */ unsigned char *(*get_content_type)(unsigned char *extension); @@ -29,4 +33,8 @@ struct mime_handler * init_mime_handler(unsigned char *program, unsigned char *description, unsigned char *backend_name, int ask, int block); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/mime/backend/default.h b/src/mime/backend/default.h index 73453107..45719471 100644 --- a/src/mime/backend/default.h +++ b/src/mime/backend/default.h @@ -5,7 +5,15 @@ #include "main/module.h" #include "mime/backend/common.h" +#ifdef __cplusplus +extern "C" { +#endif + extern const struct mime_backend default_mime_backend; extern struct module default_mime_module; +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/mime/backend/mailcap.h b/src/mime/backend/mailcap.h index bf81fd37..639a7fd0 100644 --- a/src/mime/backend/mailcap.h +++ b/src/mime/backend/mailcap.h @@ -5,7 +5,15 @@ #include "main/module.h" #include "mime/backend/common.h" +#ifdef __cplusplus +extern "C" { +#endif + extern const struct mime_backend mailcap_mime_backend; extern struct module mailcap_mime_module; +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/mime/backend/mimetypes.h b/src/mime/backend/mimetypes.h index f6a188c5..5ae04c32 100644 --- a/src/mime/backend/mimetypes.h +++ b/src/mime/backend/mimetypes.h @@ -5,7 +5,15 @@ #include "main/module.h" #include "mime/backend/common.h" +#ifdef __cplusplus +extern "C" { +#endif + extern const struct mime_backend mimetypes_mime_backend; extern struct module mimetypes_mime_module; +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/mime/dialogs.h b/src/mime/dialogs.h index 055eeab1..c6b3fd20 100644 --- a/src/mime/dialogs.h +++ b/src/mime/dialogs.h @@ -1,10 +1,18 @@ #ifndef EL__MIME_DIALOGS_H #define EL__MIME_DIALOGS_H +#ifdef __cplusplus +extern "C" { +#endif + struct terminal; void menu_add_ext(struct terminal *, void *, void *); void menu_del_ext(struct terminal *, void *, void *); void menu_list_ext(struct terminal *, void *, void *); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/mime/mime.h b/src/mime/mime.h index 01524fdd..3e60c26c 100644 --- a/src/mime/mime.h +++ b/src/mime/mime.h @@ -3,6 +3,10 @@ #include "main/module.h" +#ifdef __cplusplus +extern "C" { +#endif + struct cache_entry; struct uri; @@ -33,4 +37,8 @@ get_mime_type_handler(unsigned char *content_type, int xwin); * empty ("") (ie. http://example.com/?crash=elinks). */ struct string *add_mime_filename_to_string(struct string *string, struct uri *uri); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/network/connection.h b/src/network/connection.h index 7c0a5d7c..1f5111f8 100644 --- a/src/network/connection.h +++ b/src/network/connection.h @@ -8,6 +8,10 @@ #include "util/lists.h" #include +#ifdef __cplusplus +extern "C" { +#endif + struct download; struct socket; struct uri; @@ -119,4 +123,8 @@ int load_uri(struct uri *uri, struct uri *referrer, struct download *download, int is_entry_used(struct cache_entry *cached); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/network/dns.h b/src/network/dns.h index 588a853f..0f53d72a 100644 --- a/src/network/dns.h +++ b/src/network/dns.h @@ -6,6 +6,10 @@ #include #endif +#ifdef __cplusplus +extern "C" { +#endif + enum dns_result { DNS_ERROR = -1, /* DNS lookup failed. */ DNS_SUCCESS = 0, /* DNS lookup was successful. */ @@ -39,4 +43,8 @@ void kill_dns_request(void **queryref); * cache entries will be removed. */ void shrink_dns_cache(int whole); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/network/progress.h b/src/network/progress.h index 70b549b2..b8c90ad3 100644 --- a/src/network/progress.h +++ b/src/network/progress.h @@ -4,6 +4,10 @@ #include "main/timer.h" /* timer_id_T */ #include "util/time.h" +#ifdef __cplusplus +extern "C" { +#endif + #define CURRENT_SPD_SEC 50 /* number of seconds */ struct progress { @@ -50,4 +54,8 @@ void start_update_progress(struct progress *progress, void (*timer_func)(void *) int has_progress(struct progress *progress); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/network/socket.h b/src/network/socket.h index e5ced365..99f6fbd8 100644 --- a/src/network/socket.h +++ b/src/network/socket.h @@ -8,6 +8,10 @@ #include "network/state.h" +#ifdef __cplusplus +extern "C" { +#endif + struct connect_info; struct read_buffer; struct socket; @@ -171,4 +175,8 @@ struct read_buffer *alloc_read_buffer(struct socket *socket); /* Remove @bytes number of bytes from @buffer. */ void kill_buffer_data(struct read_buffer *buffer, int bytes); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/network/ssl/match-hostname.h b/src/network/ssl/match-hostname.h index 60d32b2d..fda7dee5 100644 --- a/src/network/ssl/match-hostname.h +++ b/src/network/ssl/match-hostname.h @@ -2,9 +2,17 @@ #ifndef EL__NETWORK_SSL_MATCH_HOSTNAME_H #define EL__NETWORK_SSL_MATCH_HOSTNAME_H +#ifdef __cplusplus +extern "C" { +#endif + int match_hostname_pattern(const unsigned char *hostname, size_t hostname_length, const unsigned char *pattern, size_t pattern_length); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/network/ssl/socket.h b/src/network/ssl/socket.h index ed184d66..68f5b45e 100644 --- a/src/network/ssl/socket.h +++ b/src/network/ssl/socket.h @@ -2,6 +2,10 @@ #ifndef EL__NETWORK_SSL_SOCKET_H #define EL__NETWORK_SSL_SOCKET_H +#ifdef __cplusplus +extern "C" { +#endif + #ifdef CONFIG_SSL struct socket; @@ -12,4 +16,9 @@ ssize_t ssl_read(struct socket *socket, unsigned char *data, int len); int ssl_close(struct socket *socket); #endif + +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/network/ssl/ssl.h b/src/network/ssl/ssl.h index 601fde1f..1a6151de 100644 --- a/src/network/ssl/ssl.h +++ b/src/network/ssl/ssl.h @@ -6,6 +6,10 @@ #include "main/module.h" +#ifdef __cplusplus +extern "C" { +#endif + struct socket; extern struct module ssl_module; @@ -41,5 +45,10 @@ extern int socket_SSL_ex_data_idx; #define ssl_t gnutls_session_t #endif -#endif /* CONFIG_SSL */ +#ifdef __cplusplus +} +#endif + +#endif /* CONFIG_SSL */ + #endif diff --git a/src/network/state.h b/src/network/state.h index 41f13378..edc9de93 100644 --- a/src/network/state.h +++ b/src/network/state.h @@ -3,6 +3,10 @@ #include "util/error.h" /* assert() */ +#ifdef __cplusplus +extern "C" { +#endif + struct terminal; enum connection_priority { @@ -149,4 +153,8 @@ connection_state_for_errno(int syserr) return state; } +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/osdep/beos/beos.h b/src/osdep/beos/beos.h index 306fa550..05ec241e 100644 --- a/src/osdep/beos/beos.h +++ b/src/osdep/beos/beos.h @@ -2,6 +2,10 @@ #ifndef EL__OSDEP_BEOS_BEOS_H #define EL__OSDEP_BEOS_BEOS_H +#ifdef __cplusplus +extern "C" { +#endif + #ifdef CONFIG_OS_BEOS struct terminal; @@ -11,4 +15,8 @@ void open_in_new_be(struct terminal *term, unsigned char *exe_name, #endif +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/osdep/beos/overrides.h b/src/osdep/beos/overrides.h index cd67b216..410d8ffb 100644 --- a/src/osdep/beos/overrides.h +++ b/src/osdep/beos/overrides.h @@ -8,6 +8,10 @@ #include #include +#ifdef __cplusplus +extern "C" { +#endif + int be_socket(int, int, int); int be_connect(int, struct sockaddr *, int); int be_getpeername(int, struct sockaddr *, int *); @@ -42,6 +46,10 @@ int be_getsockopt(int, int, int, void *, int *); #define errno 1 #endif +#ifdef __cplusplus +} +#endif + #endif #endif diff --git a/src/osdep/beos/sysinfo.h b/src/osdep/beos/sysinfo.h index 22c28a6b..5faa8863 100644 --- a/src/osdep/beos/sysinfo.h +++ b/src/osdep/beos/sysinfo.h @@ -9,8 +9,16 @@ #define DEFAULT_SHELL "/bin/sh" #define GETSHELL getenv("SHELL") +#ifdef __cplusplus +extern "C" { +#endif + static inline int dir_sep(char x) { return x == '/'; } +#ifdef __cplusplus +} +#endif + #define FS_UNIX_RIGHTS #define FS_UNIX_SOFTLINKS #define FS_UNIX_USERS diff --git a/src/osdep/generic.h b/src/osdep/generic.h index 1f72d531..914b3f1f 100644 --- a/src/osdep/generic.h +++ b/src/osdep/generic.h @@ -3,6 +3,8 @@ #ifndef EL__OSDEP_GENERIC_H #define EL__OSDEP_GENERIC_H +#include + #ifdef HAVE_LIMITS_H #include /* may contain PIPE_BUF definition on some systems */ #endif @@ -11,6 +13,10 @@ #include /* may contain offsetof() */ #endif +#ifdef __cplusplus +extern "C" { +#endif + #ifndef PIPE_BUF #define PIPE_BUF 512 /* POSIX says that. -- Mikulas */ #endif @@ -92,9 +98,10 @@ safe_write(int fd, const void *buf, size_t count) { #define offsetof(type, ident) ((size_t) &(((type *) 0)->ident)) #endif +#if !defined(alignof) && ((!defined(__cplusplus) || __cplusplus < 201103L)) /* Alignment of types. */ -#define alignof(TYPE) \ - offsetof(struct { unsigned char dummy1; TYPE dummy2; }, dummy2) +#define alignof(TYPE) offsetof(struct { unsigned char dummy1; TYPE dummy; }, dummy2) +#endif /* Using this macro to copy structs is both faster and safer than * memcpy(destination, source, sizeof(source)). Please, use this macro instead @@ -104,4 +111,8 @@ safe_write(int fd, const void *buf, size_t count) { #define sizeof_array(array) (sizeof(array)/sizeof(*(array))) +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/osdep/getifaddrs.h b/src/osdep/getifaddrs.h index 4966c034..d2216b3a 100644 --- a/src/osdep/getifaddrs.h +++ b/src/osdep/getifaddrs.h @@ -5,6 +5,10 @@ #include "config.h" #endif +#ifdef __cplusplus +extern "C" { +#endif + #ifndef HAVE_GETIFADDRS /* ELinksification by Zas. * This file was borrowed from dkftpbench-0.45 sources (http://www.kegel.com/dkftpbench). */ @@ -69,4 +73,8 @@ void freeifaddrs(struct ifaddrs *); #endif /* HAVE_GETIFADDRS */ +#ifdef __cplusplus +} +#endif + #endif /* EL__OSDEP_GETIFADDRS_H */ diff --git a/src/osdep/newwin.h b/src/osdep/newwin.h index daf65437..8747ad03 100644 --- a/src/osdep/newwin.h +++ b/src/osdep/newwin.h @@ -3,6 +3,10 @@ #include "terminal/terminal.h" +#ifdef __cplusplus +extern "C" { +#endif + /* {struct open_in_new} and @open_in_new is used for setting up menues * of how new windows can be opened. */ struct open_in_new { @@ -31,4 +35,8 @@ int can_open_in_new(struct terminal *term); void open_new_window(struct terminal *term, unsigned char *exe_name, enum term_env_type environment, unsigned char *param); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/osdep/os2/os2.h b/src/osdep/os2/os2.h index 99b3f6d9..d432df75 100644 --- a/src/osdep/os2/os2.h +++ b/src/osdep/os2/os2.h @@ -2,6 +2,10 @@ #ifndef EL__OSDEP_OS2_OS2_H #define EL__OSDEP_OS2_OS2_H +#ifdef __cplusplus +extern "C" { +#endif + #ifdef CONFIG_OS_OS2 struct terminal; @@ -13,4 +17,8 @@ void open_in_new_fullscreen(struct terminal *term, unsigned char *exe_name, #endif +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/osdep/os2/sysinfo.h b/src/osdep/os2/sysinfo.h index 0c195c6e..beb5057e 100644 --- a/src/osdep/os2/sysinfo.h +++ b/src/osdep/os2/sysinfo.h @@ -2,6 +2,10 @@ #ifndef EL__OSDEP_OS2_SYSINFO_H #define EL__OSDEP_OS2_SYSINFO_H +#ifdef __cplusplus +extern "C" { +#endif + #ifdef CONFIG_OS_OS2 #define SYSTEM_NAME "OS/2" @@ -40,4 +44,8 @@ static inline int dir_sep(char x) { return x == '/' || x == '\\'; } #endif +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/osdep/osdep.h b/src/osdep/osdep.h index c31d5ace..89763c1f 100644 --- a/src/osdep/osdep.h +++ b/src/osdep/osdep.h @@ -7,6 +7,10 @@ #include "osdep/unix/unix.h" #include "osdep/win32/win32.h" +#ifdef __cplusplus +extern "C" { +#endif + #ifndef CHAR_DIR_SEP #define CHAR_DIR_SEP '/' #endif @@ -66,10 +70,18 @@ void set_cwd(unsigned char *); unsigned char *get_shell(void); +#ifdef __cplusplus +} +#endif + #ifdef HAVE_TERMIOS_H #include #endif +#ifdef __cplusplus +extern "C" { +#endif + /* We define own cfmakeraw() wrapper because cfmakeraw() is broken on AIX, * thus we fix it right away. We can also emulate cfmakeraw() if it is not * available at all. Face it, we are just cool. */ @@ -79,4 +91,8 @@ void elinks_cfmakeraw(struct termios *t); #define user_appdata_directory() NULL #endif +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/osdep/riscos/sysinfo.h b/src/osdep/riscos/sysinfo.h index 107ccf5f..c2c0d3ac 100644 --- a/src/osdep/riscos/sysinfo.h +++ b/src/osdep/riscos/sysinfo.h @@ -2,6 +2,10 @@ #ifndef EL__OSDEP_RISCOS_SYSINFO_H #define EL__OSDEP_RISCOS_SYSINFO_H +#ifdef __cplusplus +extern "C" { +#endif + #ifdef CONFIG_OS_RISCOS #define SYSTEM_NAME "RISC OS" @@ -17,4 +21,9 @@ static inline int dir_sep(char x) { return x == '/' || x == '\\'; } #endif +#ifdef __cplusplus +} +#endif + + #endif diff --git a/src/osdep/signals.h b/src/osdep/signals.h index 1742df05..37ba12e3 100644 --- a/src/osdep/signals.h +++ b/src/osdep/signals.h @@ -3,6 +3,10 @@ #ifndef EL__OSDEP_SIGNALS_H #define EL__OSDEP_SIGNALS_H +#ifdef __cplusplus +extern "C" { +#endif + struct terminal; #define NUM_SIGNALS 32 @@ -18,4 +22,8 @@ void handle_basic_signals(struct terminal *term); void unhandle_terminal_signals(struct terminal *term); int check_signals(void); +#ifdef __cplusplus +} +#endif + #endif /* EL__LOWLEVEL_SIGNALS_H */ diff --git a/src/osdep/stub.h b/src/osdep/stub.h index 00986472..f2f7c580 100644 --- a/src/osdep/stub.h +++ b/src/osdep/stub.h @@ -4,6 +4,10 @@ #include #include +#ifdef __cplusplus +extern "C" { +#endif + #if 0 #ifdef CONFIG_DEBUG #define CONFIG_OWN_LIBC @@ -161,4 +165,8 @@ extern void *__builtin_mempcpy(void *dest, const void *src, size_t n); #endif #endif +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/osdep/sysname.h b/src/osdep/sysname.h index 9e3eaa54..1e0883a1 100644 --- a/src/osdep/sysname.h +++ b/src/osdep/sysname.h @@ -1,8 +1,16 @@ #ifndef EL__OSDEP_SYSNAME_H #define EL__OSDEP_SYSNAME_H +#ifdef __cplusplus +extern "C" { +#endif + extern unsigned char system_name[]; extern void get_system_name(void); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/osdep/unix/sysinfo.h b/src/osdep/unix/sysinfo.h index 7b4ef587..4a7c390e 100644 --- a/src/osdep/unix/sysinfo.h +++ b/src/osdep/unix/sysinfo.h @@ -9,8 +9,16 @@ #define DEFAULT_SHELL "/bin/sh" #define GETSHELL getenv("SHELL") +#ifdef __cplusplus +extern "C" { +#endif + static inline int dir_sep(char x) { return x == '/'; } +#ifdef __cplusplus +} +#endif + #define FS_UNIX_RIGHTS #define FS_UNIX_HARDLINKS #define FS_UNIX_SOFTLINKS diff --git a/src/osdep/win32/overrides.h b/src/osdep/win32/overrides.h index 5b5aa106..1d0040cb 100644 --- a/src/osdep/win32/overrides.h +++ b/src/osdep/win32/overrides.h @@ -8,6 +8,9 @@ #include #endif +#ifdef __cplusplus +extern "C" { +#endif int win32_write(int fd, const void *buf, unsigned len); int win32_read(int fd, void *buf, unsigned len); @@ -47,5 +50,9 @@ char *win32_strerror(int err); #endif +#ifdef __cplusplus +} +#endif + #endif #endif diff --git a/src/osdep/win32/vt100.h b/src/osdep/win32/vt100.h index 4fd393ad..f82a074e 100644 --- a/src/osdep/win32/vt100.h +++ b/src/osdep/win32/vt100.h @@ -7,8 +7,16 @@ #include #endif +#ifdef __cplusplus +extern "C" { +#endif + int VT100_decode(HANDLE, const void *, int); +#ifdef __cplusplus +} +#endif + #endif #endif diff --git a/src/osdep/win32/win32.h b/src/osdep/win32/win32.h index 3118e782..f634c4c7 100644 --- a/src/osdep/win32/win32.h +++ b/src/osdep/win32/win32.h @@ -4,6 +4,10 @@ #ifdef CONFIG_OS_WIN32 +#ifdef __cplusplus +extern "C" { +#endif + #undef CHAR_DIR_SEP #define CHAR_DIR_SEP '\\' #undef STRING_DIR_SEP @@ -66,5 +70,9 @@ int tcgetattr(int fd, struct termios *termios_p); int tcsetattr(int fd, int optional_actions, const struct termios *termios_p); #endif /* __CYGWIN__ */ +#ifdef __cplusplus +} +#endif + #endif /* CONFIG_OS_WIN32 */ #endif diff --git a/src/protocol/about.h b/src/protocol/about.h index e36e99c3..8dc5578a 100644 --- a/src/protocol/about.h +++ b/src/protocol/about.h @@ -3,6 +3,14 @@ #include "protocol/protocol.h" +#ifdef __cplusplus +extern "C" { +#endif + extern protocol_handler_T about_protocol_handler; +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/protocol/auth/auth.h b/src/protocol/auth/auth.h index 1ddba200..123cbbad 100644 --- a/src/protocol/auth/auth.h +++ b/src/protocol/auth/auth.h @@ -6,6 +6,10 @@ #include "protocol/uri.h" #include "util/lists.h" +#ifdef __cplusplus +extern "C" { +#endif + struct listbox_item; struct module; @@ -46,4 +50,8 @@ struct auth_entry *get_invalid_auth_entry(void); extern struct module auth_module; +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/protocol/auth/dialogs.h b/src/protocol/auth/dialogs.h index ff6e866d..7f6c2097 100644 --- a/src/protocol/auth/dialogs.h +++ b/src/protocol/auth/dialogs.h @@ -4,10 +4,18 @@ #include "bfu/hierbox.h" +#ifdef __cplusplus +extern "C" { +#endif + struct session; void do_auth_dialog(struct session *ses, void *data); extern struct hierbox_browser auth_browser; void auth_manager(struct session *); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/protocol/auth/digest.h b/src/protocol/auth/digest.h index 9798cc9f..d56bfc13 100644 --- a/src/protocol/auth/digest.h +++ b/src/protocol/auth/digest.h @@ -2,10 +2,18 @@ #ifndef EL__PROTOCOL_AUTH_DIGEST_H #define EL__PROTOCOL_AUTH_DIGEST_H +#ifdef __cplusplus +extern "C" { +#endif + struct auth_entry; struct uri; unsigned char * get_http_auth_digest_response(struct auth_entry *entry, struct uri *uri); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/protocol/bittorrent/bencoding.h b/src/protocol/bittorrent/bencoding.h index fff35338..62bdf437 100644 --- a/src/protocol/bittorrent/bencoding.h +++ b/src/protocol/bittorrent/bencoding.h @@ -4,6 +4,10 @@ #include "protocol/bittorrent/common.h" +#ifdef __cplusplus +extern "C" { +#endif + enum bittorrent_state parse_bittorrent_metafile(struct bittorrent_meta *meta, struct bittorrent_const_string *metafile); @@ -12,4 +16,8 @@ enum bittorrent_state parse_bittorrent_tracker_response(struct bittorrent_connection *bittorrent, struct bittorrent_const_string *source); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/protocol/bittorrent/bittorrent.h b/src/protocol/bittorrent/bittorrent.h index 7ecfe002..c8c7ec11 100644 --- a/src/protocol/bittorrent/bittorrent.h +++ b/src/protocol/bittorrent/bittorrent.h @@ -5,6 +5,10 @@ #include "main/module.h" #include "network/state.h" +#ifdef __cplusplus +extern "C" { +#endif + struct bittorrent_const_string; struct uri; @@ -19,4 +23,8 @@ void add_bittorrent_selection(struct uri *uri, int *selection, size_t size); void add_bittorrent_message(struct uri *uri, struct connection_state state, struct bittorrent_const_string *); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/protocol/bittorrent/common.h b/src/protocol/bittorrent/common.h index ab6eee2a..fccb0f4f 100644 --- a/src/protocol/bittorrent/common.h +++ b/src/protocol/bittorrent/common.h @@ -14,6 +14,10 @@ #include "util/sha1.h" #include "util/time.h" +#ifdef __cplusplus +extern "C" { +#endif + struct bitfield; struct bittorrent_fetcher; struct connection; @@ -231,6 +235,11 @@ struct bittorrent_file { unsigned char name[1]; /**< Filename converted from path list. */ }; +enum meta_type { + BITTORRENT_SINGLE_FILE, + BITTORRENT_MULTI_FILE +}; + /** Static information from the .torrent metafile. */ struct bittorrent_meta { /** The SHA1 info hash of the value of the info key from the metainfo @@ -260,7 +269,7 @@ struct bittorrent_meta { unsigned char *piece_hash; /** The type of the torrent. */ - enum { BITTORRENT_SINGLE_FILE, BITTORRENT_MULTI_FILE } type; + enum meta_type type; /** Potential bad file path detected. */ unsigned int malicious_paths:1; @@ -445,4 +454,8 @@ get_bittorrent_blacklist_flags(bittorrent_id_T peer_id); void done_bittorrent_blacklist(void); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/protocol/bittorrent/connection.h b/src/protocol/bittorrent/connection.h index 13aeca03..396a23d5 100644 --- a/src/protocol/bittorrent/connection.h +++ b/src/protocol/bittorrent/connection.h @@ -4,6 +4,10 @@ #include "protocol/protocol.h" +#ifdef __cplusplus +extern "C" { +#endif + struct bittorrent_connection; struct connection; @@ -24,4 +28,8 @@ update_bittorrent_connection_stats(struct bittorrent_connection *bittorrent, void bittorrent_resume_callback(struct bittorrent_connection *bittorrent); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/protocol/bittorrent/dialogs.c b/src/protocol/bittorrent/dialogs.c index 4b50a6ae..f181b47b 100644 --- a/src/protocol/bittorrent/dialogs.c +++ b/src/protocol/bittorrent/dialogs.c @@ -16,6 +16,7 @@ #include "protocol/bittorrent/bencoding.h" #include "protocol/bittorrent/bittorrent.h" #include "protocol/bittorrent/common.h" +#include "protocol/bittorrent/dialogs.h" #include "protocol/bittorrent/piececache.h" #include "protocol/uri.h" #include "session/download.h" diff --git a/src/protocol/bittorrent/dialogs.h b/src/protocol/bittorrent/dialogs.h index 3ef296c3..af547af9 100644 --- a/src/protocol/bittorrent/dialogs.h +++ b/src/protocol/bittorrent/dialogs.h @@ -4,6 +4,10 @@ #include "bfu/common.h" +#ifdef __cplusplus +extern "C" { +#endif + struct color_pair; struct bittorrent_connection; struct download; @@ -32,4 +36,8 @@ void bittorrent_message_dialog(struct session *ses, void *data); void query_bittorrent_dialog(struct type_query *type_query); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/protocol/bittorrent/peerconnect.h b/src/protocol/bittorrent/peerconnect.h index 08b695c2..b1883196 100644 --- a/src/protocol/bittorrent/peerconnect.h +++ b/src/protocol/bittorrent/peerconnect.h @@ -5,6 +5,10 @@ #include "network/state.h" #include "protocol/bittorrent/common.h" +#ifdef __cplusplus +extern "C" { +#endif + struct connection; /* Sets up and tears down the peer listening socket. */ @@ -20,4 +24,8 @@ enum bittorrent_state make_bittorrent_peer_connection(struct bittorrent_connection *bittorrent, struct bittorrent_peer *peer_info); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/protocol/bittorrent/peerwire.h b/src/protocol/bittorrent/peerwire.h index 95d5a7cf..79a957d8 100644 --- a/src/protocol/bittorrent/peerwire.h +++ b/src/protocol/bittorrent/peerwire.h @@ -5,6 +5,10 @@ #include "protocol/bittorrent/common.h" #include "util/lists.h" +#ifdef __cplusplus +extern "C" { +#endif + struct read_buffer; struct socket; @@ -80,4 +84,8 @@ cancel_bittorrent_peer_request(struct bittorrent_peer_connection *peer, request->length); } +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/protocol/bittorrent/piececache.h b/src/protocol/bittorrent/piececache.h index e8425a13..5a1b9cad 100644 --- a/src/protocol/bittorrent/piececache.h +++ b/src/protocol/bittorrent/piececache.h @@ -5,6 +5,10 @@ #include "protocol/bittorrent/common.h" #include "util/lists.h" +#ifdef __cplusplus +extern "C" { +#endif + struct bitfield; struct bittorrent_piece_cache_entry { @@ -125,4 +129,8 @@ unsigned char * get_bittorrent_piece_cache_data(struct bittorrent_connection *bittorrent, uint32_t piece); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/protocol/bittorrent/tracker.h b/src/protocol/bittorrent/tracker.h index ba2803d4..ebe03534 100644 --- a/src/protocol/bittorrent/tracker.h +++ b/src/protocol/bittorrent/tracker.h @@ -2,6 +2,10 @@ #ifndef EL__PROTOCOL_BITTORRENT_TRACKER_H #define EL__PROTOCOL_BITTORRENT_TRACKER_H +#ifdef __cplusplus +extern "C" { +#endif + struct connection; /* Once called it will periodically request information from the tracker. @@ -12,4 +16,8 @@ void send_bittorrent_tracker_request(struct connection *conn); /* Stops all tracker related activity. */ void done_bittorrent_tracker_connection(struct connection *conn); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/protocol/common.h b/src/protocol/common.h index 7dc259bb..286134a1 100644 --- a/src/protocol/common.h +++ b/src/protocol/common.h @@ -3,6 +3,10 @@ #include "network/state.h" +#ifdef __cplusplus +extern "C" { +#endif + struct string; struct uri; @@ -12,4 +16,8 @@ void close_all_non_term_fd(void); struct connection_state init_directory_listing(struct string *page, struct uri *uri); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/protocol/data.h b/src/protocol/data.h index 5e7e77ec..b86af3a2 100644 --- a/src/protocol/data.h +++ b/src/protocol/data.h @@ -3,10 +3,18 @@ #include "protocol/protocol.h" +#ifdef __cplusplus +extern "C" { +#endif + #ifdef CONFIG_DATA extern protocol_handler_T data_protocol_handler; #else #define data_protocol_handler NULL #endif +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/protocol/date.h b/src/protocol/date.h index b1018c86..a2debe97 100644 --- a/src/protocol/date.h +++ b/src/protocol/date.h @@ -3,6 +3,10 @@ #include "util/time.h" +#ifdef __cplusplus +extern "C" { +#endif + /* Parses YY and YYYY style years. Returns year value ready for tm.tm_year and * move @date pointer after the year if successful else returns -1. */ int parse_year(const unsigned char **date, unsigned char *end); @@ -27,4 +31,8 @@ int parse_time(const unsigned char **time, struct tm *tm, unsigned char *end); time_t parse_date(unsigned char **date_pos, unsigned char *end, int update_pos, int skip_week_day); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/protocol/file/cgi.h b/src/protocol/file/cgi.h index 72cd6a02..3793c192 100644 --- a/src/protocol/file/cgi.h +++ b/src/protocol/file/cgi.h @@ -2,10 +2,18 @@ #ifndef EL__PROTOCOL_FILE_CGI_H #define EL__PROTOCOL_FILE_CGI_H +#ifdef __cplusplus +extern "C" { +#endif + struct connection; struct module; extern struct module cgi_protocol_module; int execute_cgi(struct connection *); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/protocol/file/file.h b/src/protocol/file/file.h index 7a7f12d8..067df012 100644 --- a/src/protocol/file/file.h +++ b/src/protocol/file/file.h @@ -5,7 +5,15 @@ #include "main/module.h" #include "protocol/protocol.h" +#ifdef __cplusplus +extern "C" { +#endif + extern struct module file_protocol_module; extern protocol_handler_T file_protocol_handler; +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/protocol/file/mailcap.h b/src/protocol/file/mailcap.h index e3116be4..34082b38 100644 --- a/src/protocol/file/mailcap.h +++ b/src/protocol/file/mailcap.h @@ -4,7 +4,15 @@ #include "main/module.h" #include "protocol/protocol.h" +#ifdef __cplusplus +extern "C" { +#endif + extern struct module mailcap_protocol_module; extern protocol_handler_T mailcap_protocol_handler; +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/protocol/finger/finger.h b/src/protocol/finger/finger.h index d0ebc1bd..b412c7db 100644 --- a/src/protocol/finger/finger.h +++ b/src/protocol/finger/finger.h @@ -5,6 +5,10 @@ #include "main/module.h" #include "protocol/protocol.h" +#ifdef __cplusplus +extern "C" { +#endif + #ifdef CONFIG_FINGER extern protocol_handler_T finger_protocol_handler; #else @@ -13,5 +17,8 @@ extern protocol_handler_T finger_protocol_handler; extern struct module finger_protocol_module; +#ifdef __cplusplus +} +#endif #endif diff --git a/src/protocol/fsp/fsp.c b/src/protocol/fsp/fsp.c index 8a0dee37..8c69f3e8 100644 --- a/src/protocol/fsp/fsp.c +++ b/src/protocol/fsp/fsp.c @@ -9,7 +9,15 @@ #endif #include + +#ifdef __cplusplus +extern "C" { +#endif #include +#ifdef __cplusplus +} +#endif + #include #include #include diff --git a/src/protocol/fsp/fsp.h b/src/protocol/fsp/fsp.h index b5b9087e..35acf494 100644 --- a/src/protocol/fsp/fsp.h +++ b/src/protocol/fsp/fsp.h @@ -5,6 +5,10 @@ #include "main/module.h" #include "protocol/protocol.h" +#ifdef __cplusplus +extern "C" { +#endif + extern struct module fsp_protocol_module; #ifdef CONFIG_FSP @@ -13,4 +17,8 @@ extern protocol_handler_T fsp_protocol_handler; #define fsp_protocol_handler NULL #endif +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/protocol/ftp/ftp.h b/src/protocol/ftp/ftp.h index 10f4a2d5..b3f210c8 100644 --- a/src/protocol/ftp/ftp.h +++ b/src/protocol/ftp/ftp.h @@ -5,6 +5,10 @@ #include "main/module.h" #include "protocol/protocol.h" +#ifdef __cplusplus +extern "C" { +#endif + extern struct module ftp_protocol_module; #ifdef CONFIG_FTP @@ -13,4 +17,8 @@ extern protocol_handler_T ftp_protocol_handler; #define ftp_protocol_handler NULL #endif +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/protocol/ftp/parse.h b/src/protocol/ftp/parse.h index 18cfacd8..07478a99 100644 --- a/src/protocol/ftp/parse.h +++ b/src/protocol/ftp/parse.h @@ -5,6 +5,10 @@ #include "util/string.h" +#ifdef __cplusplus +extern "C" { +#endif + /* File types. */ /* The value is the char value used when displaying the file type. */ enum ftp_file_type { @@ -38,4 +42,8 @@ struct ftp_file_info { struct ftp_file_info * parse_ftp_file_info(struct ftp_file_info *info, unsigned char *src, int len); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/protocol/gopher/gopher.h b/src/protocol/gopher/gopher.h index 29bcede2..84c55689 100644 --- a/src/protocol/gopher/gopher.h +++ b/src/protocol/gopher/gopher.h @@ -5,6 +5,10 @@ #include "main/module.h" #include "protocol/protocol.h" +#ifdef __cplusplus +extern "C" { +#endif + #ifdef CONFIG_GOPHER extern protocol_handler_T gopher_protocol_handler; #else @@ -13,5 +17,8 @@ extern protocol_handler_T gopher_protocol_handler; extern struct module gopher_protocol_module; +#ifdef __cplusplus +} +#endif #endif diff --git a/src/protocol/header.h b/src/protocol/header.h index 0bcec5a0..96f4ebc7 100644 --- a/src/protocol/header.h +++ b/src/protocol/header.h @@ -1,6 +1,10 @@ #ifndef EL__PROTOCOL_HEADER_H #define EL__PROTOCOL_HEADER_H +#ifdef __cplusplus +extern "C" { +#endif + enum parse_header_param { HEADER_PARAM_FOUND, HEADER_PARAM_NOT_FOUND, @@ -13,4 +17,8 @@ unsigned char *parse_header(unsigned char *, const unsigned char *, unsigned cha enum parse_header_param parse_header_param(unsigned char *, unsigned char *, unsigned char **, int); unsigned char *get_header_param(unsigned char *, unsigned char *); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/protocol/http/blacklist.h b/src/protocol/http/blacklist.h index 32fc3d26..676ac5ff 100644 --- a/src/protocol/http/blacklist.h +++ b/src/protocol/http/blacklist.h @@ -2,6 +2,10 @@ #ifndef EL__PROTOCOL_HTTP_BLACKLIST_H #define EL__PROTOCOL_HTTP_BLACKLIST_H +#ifdef __cplusplus +extern "C" { +#endif + struct uri; enum blacklist_flags { @@ -17,4 +21,8 @@ void del_blacklist_entry(struct uri *, enum blacklist_flags); enum blacklist_flags get_blacklist_flags(struct uri *); void free_blacklist(void); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/protocol/http/codes.h b/src/protocol/http/codes.h index 3fada7bc..d9bbdf45 100644 --- a/src/protocol/http/codes.h +++ b/src/protocol/http/codes.h @@ -2,10 +2,18 @@ #ifndef EL__PROTOCOL_HTTP_CODES_H #define EL__PROTOCOL_HTTP_CODES_H +#ifdef __cplusplus +extern "C" { +#endif + struct connection; /* HTTP response codes device. */ void http_error_document(struct connection *conn, int code); +#ifdef __cplusplus +} +#endif + #endif /* EL__PROTOCOL_HTTP_CODES_H */ diff --git a/src/protocol/http/http.h b/src/protocol/http/http.h index df7a9c9d..dff3ba33 100644 --- a/src/protocol/http/http.h +++ b/src/protocol/http/http.h @@ -7,6 +7,10 @@ #include "protocol/http/post.h" #include "protocol/protocol.h" +#ifdef __cplusplus +extern "C" { +#endif + struct connection; struct read_buffer; struct socket; @@ -48,4 +52,8 @@ void http_got_header(struct socket *, struct read_buffer *); unsigned char *subst_user_agent(unsigned char *fmt, unsigned char *version, unsigned char *sysname, unsigned char *termsize); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/protocol/http/http_negotiate.h b/src/protocol/http/http_negotiate.h index 5b7f3539..cf9d4237 100644 --- a/src/protocol/http/http_negotiate.h +++ b/src/protocol/http/http_negotiate.h @@ -2,6 +2,10 @@ #ifndef EL__PROTOCOL_HTTP_HTTP_NEGOTIATE_H #define EL__PROTOCOL_HTTP_HTTP_NEGOTIATE_H +#ifdef __cplusplus +extern "C" { +#endif + #define HTTPNEG_GSS 1 #define HTTPNEG_NEG 2 @@ -16,6 +20,9 @@ int http_negotiate_input(struct connection *conn, struct uri *uri, int http_negotiate_output(struct uri *uri, struct string *header); +#ifdef __cplusplus +} +#endif #endif /* EL_PROTOCOL_HTTP_HTTP_NEGOTIATE_H */ diff --git a/src/protocol/http/post.h b/src/protocol/http/post.h index 77f90649..7c1fe91f 100644 --- a/src/protocol/http/post.h +++ b/src/protocol/http/post.h @@ -6,6 +6,10 @@ #include "network/state.h" +#ifdef __cplusplus +extern "C" { +#endif + /** Information about a file to be uploaded in a POST request. * open_http_post() collects this information and done_http_post() * discards it. */ @@ -60,4 +64,8 @@ int read_http_post(struct http_post *http_post, unsigned char buffer[], int max, struct connection_state *error); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/protocol/nntp/connection.h b/src/protocol/nntp/connection.h index b2564673..ad2e9cf5 100644 --- a/src/protocol/nntp/connection.h +++ b/src/protocol/nntp/connection.h @@ -6,6 +6,10 @@ #include "protocol/protocol.h" #include "util/string.h" +#ifdef __cplusplus +extern "C" { +#endif + /* An NNTP target is a mapping from a given URI which in short form tells what * the URI describes. Using the following tokens: * @@ -89,4 +93,8 @@ extern protocol_handler_T news_protocol_handler; #define news_protocol_handler NULL #endif +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/protocol/nntp/nntp.h b/src/protocol/nntp/nntp.h index f993cff1..a414ee72 100644 --- a/src/protocol/nntp/nntp.h +++ b/src/protocol/nntp/nntp.h @@ -4,6 +4,10 @@ #include "main/module.h" +#ifdef __cplusplus +extern "C" { +#endif + /* Returns the server that should be used when expanding news: URIs */ unsigned char *get_nntp_server(void); @@ -12,4 +16,8 @@ unsigned char *get_nntp_header_entries(void); extern struct module nntp_protocol_module; +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/protocol/nntp/response.h b/src/protocol/nntp/response.h index dd1fc09b..5343a8e1 100644 --- a/src/protocol/nntp/response.h +++ b/src/protocol/nntp/response.h @@ -4,6 +4,10 @@ #include "protocol/nntp/connection.h" +#ifdef __cplusplus +extern "C" { +#endif + struct connection; struct read_buffer; @@ -26,4 +30,8 @@ read_nntp_response_data(struct connection *conn, struct read_buffer *rb); enum nntp_code get_nntp_response_code(struct connection *conn, struct read_buffer *rb); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/protocol/protocol.h b/src/protocol/protocol.h index aa994172..170a3f6a 100644 --- a/src/protocol/protocol.h +++ b/src/protocol/protocol.h @@ -3,6 +3,10 @@ #include "main/module.h" +#ifdef __cplusplus +extern "C" { +#endif + struct connection; struct session; struct terminal; @@ -61,4 +65,8 @@ enum protocol get_protocol(unsigned char *name, int namelen); extern struct module protocol_module; +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/protocol/proxy.h b/src/protocol/proxy.h index bb399567..f4d42f48 100644 --- a/src/protocol/proxy.h +++ b/src/protocol/proxy.h @@ -1,6 +1,10 @@ #ifndef EL__PROTOCOL_PROXY_H #define EL__PROTOCOL_PROXY_H +#ifdef __cplusplus +extern "C" { +#endif + struct connection_state; struct uri; @@ -14,4 +18,8 @@ struct uri *get_proxy_uri(struct uri *uri, struct connection_state *connection_s * proxy:// URI it will return the URI with the fragment removed. */ struct uri *get_proxied_uri(struct uri *uri); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/protocol/rewrite/rewrite.h b/src/protocol/rewrite/rewrite.h index 18cad68f..fcddb554 100644 --- a/src/protocol/rewrite/rewrite.h +++ b/src/protocol/rewrite/rewrite.h @@ -6,7 +6,15 @@ #include "main/module.h" +#ifdef __cplusplus +extern "C" { +#endif + extern struct module uri_rewrite_module; +#ifdef __cplusplus +} +#endif + #endif #endif diff --git a/src/protocol/smb/smb.h b/src/protocol/smb/smb.h index af0d5c2c..e079c76e 100644 --- a/src/protocol/smb/smb.h +++ b/src/protocol/smb/smb.h @@ -5,6 +5,10 @@ #include "main/module.h" #include "protocol/protocol.h" +#ifdef __cplusplus +extern "C" { +#endif + extern struct module smb_protocol_module; #ifdef CONFIG_SMB @@ -13,4 +17,9 @@ extern protocol_handler_T smb_protocol_handler; #define smb_protocol_handler NULL #endif +#ifdef __cplusplus +} +#endif + + #endif diff --git a/src/protocol/uri.h b/src/protocol/uri.h index 295e5109..7ff69ce8 100644 --- a/src/protocol/uri.h +++ b/src/protocol/uri.h @@ -3,6 +3,10 @@ #include "main/object.h" +#ifdef __cplusplus +extern "C" { +#endif + struct string; #define POST_CHAR 1 @@ -353,4 +357,8 @@ int is_ip_address(const unsigned char *address, int addresslen); */ int is_in_domain(unsigned char *domain, unsigned char *server, int server_len); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/protocol/user.h b/src/protocol/user.h index 4d153b0f..817a8871 100644 --- a/src/protocol/user.h +++ b/src/protocol/user.h @@ -5,9 +5,17 @@ #include "protocol/protocol.h" #include "terminal/terminal.h" +#ifdef __cplusplus +extern "C" { +#endif + extern struct module user_protocol_module; extern protocol_external_handler_T user_protocol_handler; unsigned char *get_user_program(struct terminal *, unsigned char *, int); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/scripting/guile/core.h b/src/scripting/guile/core.h index 1f06b4e1..bb559dad 100644 --- a/src/scripting/guile/core.h +++ b/src/scripting/guile/core.h @@ -2,6 +2,14 @@ #ifndef EL__SCRIPTING_GUILE_CORE_H #define EL__SCRIPTING_GUILE_CORE_H +#ifdef __cplusplus +extern "C" { +#endif + void init_guile(struct module *module); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/scripting/guile/guile.h b/src/scripting/guile/guile.h index f6729dcf..440790e6 100644 --- a/src/scripting/guile/guile.h +++ b/src/scripting/guile/guile.h @@ -2,8 +2,16 @@ #ifndef EL__SCRIPTING_GUILE_GUILE_H #define EL__SCRIPTING_GUILE_GUILE_H +#ifdef __cplusplus +extern "C" { +#endif + struct module; extern struct module guile_scripting_module; +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/scripting/guile/hooks.h b/src/scripting/guile/hooks.h index 23185b32..469f9cc1 100644 --- a/src/scripting/guile/hooks.h +++ b/src/scripting/guile/hooks.h @@ -2,8 +2,16 @@ #ifndef EL__SCRIPTING_GUILE_HOOKS_H #define EL__SCRIPTING_GUILE_HOOKS_H +#ifdef __cplusplus +extern "C" { +#endif + struct event_hook_info; extern struct event_hook_info guile_scripting_hooks[]; +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/scripting/lua/core.c b/src/scripting/lua/core.c index 6c7e1379..02d9e149 100644 --- a/src/scripting/lua/core.c +++ b/src/scripting/lua/core.c @@ -12,9 +12,29 @@ #include #endif +#ifdef __cplusplus +extern "C" { +#endif #include +#ifdef __cplusplus +} +#endif + +#ifdef __cplusplus +extern "C" { +#endif #include +#ifdef __cplusplus +} +#endif + +#ifdef __cplusplus +extern "C" { +#endif #include +#ifdef __cplusplus +} +#endif #include "elinks.h" diff --git a/src/scripting/lua/core.h b/src/scripting/lua/core.h index 4e6c8f72..0dd92e9a 100644 --- a/src/scripting/lua/core.h +++ b/src/scripting/lua/core.h @@ -10,6 +10,10 @@ #define LUA_ALERT "_ALERT" #endif +#ifdef __cplusplus +extern "C" { +#endif + struct module; struct session; @@ -27,4 +31,8 @@ enum evhook_status free_lua_console_history(va_list ap, void *data); void init_lua(struct module *module); void cleanup_lua(struct module *module); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/scripting/lua/hooks.c b/src/scripting/lua/hooks.c index 8b23f73b..f41fa98b 100644 --- a/src/scripting/lua/hooks.c +++ b/src/scripting/lua/hooks.c @@ -4,9 +4,29 @@ #include "config.h" #endif +#ifdef __cplusplus +extern "C" { +#endif #include +#ifdef __cplusplus +} +#endif + +#ifdef __cplusplus +extern "C" { +#endif #include +#ifdef __cplusplus +} +#endif + +#ifdef __cplusplus +extern "C" { +#endif #include +#ifdef __cplusplus +} +#endif #include "elinks.h" diff --git a/src/scripting/lua/hooks.h b/src/scripting/lua/hooks.h index 15ee5ae9..f5ca3898 100644 --- a/src/scripting/lua/hooks.h +++ b/src/scripting/lua/hooks.h @@ -2,8 +2,16 @@ #ifndef EL__SCRIPTING_LUA_HOOKS_H #define EL__SCRIPTING_LUA_HOOKS_H +#ifdef __cplusplus +extern "C" { +#endif + struct event_hook_info; extern struct event_hook_info lua_scripting_hooks[]; +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/scripting/lua/lua.h b/src/scripting/lua/lua.h index d91d7d69..23b5aa80 100644 --- a/src/scripting/lua/lua.h +++ b/src/scripting/lua/lua.h @@ -2,8 +2,16 @@ #ifndef EL__SCRIPTING_LUA_LUA_H #define EL__SCRIPTING_LUA_LUA_H +#ifdef __cplusplus +extern "C" { +#endif + struct module; extern struct module lua_scripting_module; +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/scripting/perl/core.h b/src/scripting/perl/core.h index b27adc9c..0ff21518 100644 --- a/src/scripting/perl/core.h +++ b/src/scripting/perl/core.h @@ -6,6 +6,10 @@ #include #include +#ifdef __cplusplus +extern "C" { +#endif + struct module; extern PerlInterpreter *my_perl; @@ -13,4 +17,8 @@ extern PerlInterpreter *my_perl; void init_perl(struct module *module); void cleanup_perl(struct module *module); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/scripting/perl/hooks.h b/src/scripting/perl/hooks.h index 8e2afcca..8ab64f97 100644 --- a/src/scripting/perl/hooks.h +++ b/src/scripting/perl/hooks.h @@ -2,8 +2,16 @@ #ifndef EL__SCRIPTING_PERL_HOOKS_H #define EL__SCRIPTING_PERL_HOOKS_H +#ifdef __cplusplus +extern "C" { +#endif + struct event_hook_info; extern struct event_hook_info perl_scripting_hooks[]; +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/scripting/perl/perl.h b/src/scripting/perl/perl.h index 59f3f47b..69b38018 100644 --- a/src/scripting/perl/perl.h +++ b/src/scripting/perl/perl.h @@ -2,8 +2,16 @@ #ifndef EL__SCRIPTING_PERL_PERL_H #define EL__SCRIPTING_PERL_PERL_H +#ifdef __cplusplus +extern "C" { +#endif + struct module; extern struct module perl_scripting_module; +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/scripting/python/core.h b/src/scripting/python/core.h index 31b2c242..00f06c9c 100644 --- a/src/scripting/python/core.h +++ b/src/scripting/python/core.h @@ -6,6 +6,10 @@ #include "config.h" #endif +#ifdef __cplusplus +extern "C" { +#endif + /* PyString_AsStringAndSize() takes a Py_ssize_t * in Python 2.5 but * an int * in Python 2.4. To be compatible with both, ELinks uses * Py_ssize_t and defines it here if necessary. The public-domain @@ -44,4 +48,8 @@ int add_python_methods(PyObject *dict, PyObject *name, PyMethodDef *methods); #define PYTHON_DOCSTRING(str) "" #endif +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/scripting/python/dialogs.c b/src/scripting/python/dialogs.c index c3fa5946..8c968d9c 100644 --- a/src/scripting/python/dialogs.c +++ b/src/scripting/python/dialogs.c @@ -13,6 +13,7 @@ #include "bfu/msgbox.h" #include "intl/gettext/libintl.h" #include "scripting/python/core.h" +#include "scripting/python/dialogs.h" #include "session/session.h" #include "util/error.h" #include "util/memlist.h" diff --git a/src/scripting/python/dialogs.h b/src/scripting/python/dialogs.h index 5d50d3e7..d8dc83d3 100644 --- a/src/scripting/python/dialogs.h +++ b/src/scripting/python/dialogs.h @@ -3,9 +3,17 @@ #include +#ifdef __cplusplus +extern "C" { +#endif + PyObject *python_info_box(PyObject *self, PyObject *args, PyObject *kwargs); extern char python_info_box_doc[]; PyObject *python_input_box(PyObject *self, PyObject *args, PyObject *kwargs); extern char python_input_box_doc[]; +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/scripting/python/document.c b/src/scripting/python/document.c index 5da6e7e4..404985ef 100644 --- a/src/scripting/python/document.c +++ b/src/scripting/python/document.c @@ -13,6 +13,7 @@ #include "document/document.h" #include "document/view.h" #include "scripting/python/core.h" +#include "scripting/python/document.h" #include "session/session.h" /* Python interface to get the current document's body. */ diff --git a/src/scripting/python/document.h b/src/scripting/python/document.h index 47ca1ac6..0bc21c7a 100644 --- a/src/scripting/python/document.h +++ b/src/scripting/python/document.h @@ -3,6 +3,10 @@ #include +#ifdef __cplusplus +extern "C" { +#endif + PyObject *python_current_document(PyObject *self, PyObject *args); extern char python_current_document_doc[]; PyObject *python_current_header(PyObject *self, PyObject *args); @@ -14,4 +18,8 @@ extern char python_current_title_doc[]; PyObject *python_current_url(PyObject *self, PyObject *args); extern char python_current_url_doc[]; +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/scripting/python/hooks.h b/src/scripting/python/hooks.h index 619d5544..074ffd79 100644 --- a/src/scripting/python/hooks.h +++ b/src/scripting/python/hooks.h @@ -2,8 +2,16 @@ #ifndef EL__SCRIPTING_PYTHON_HOOKS_H #define EL__SCRIPTING_PYTHON_HOOKS_H +#ifdef __cplusplus +extern "C" { +#endif + struct event_hook_info; extern struct event_hook_info python_scripting_hooks[]; +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/scripting/python/keybinding.c b/src/scripting/python/keybinding.c index a2cc1b57..8da7ff34 100644 --- a/src/scripting/python/keybinding.c +++ b/src/scripting/python/keybinding.c @@ -16,6 +16,7 @@ #include "intl/gettext/libintl.h" #include "main/event.h" #include "scripting/python/core.h" +#include "scripting/python/keybinding.h" #include "session/session.h" #include "util/error.h" #include "util/string.h" @@ -49,7 +50,7 @@ invoke_keybinding_callback(va_list ap, void *data) static int keymap_is_valid(const unsigned char *keymap) { - enum keymap_id keymap_id; + int keymap_id; for (keymap_id = 0; keymap_id < KEYMAP_MAX; ++keymap_id) if (!strcmp(keymap, get_keymap_name(keymap_id))) diff --git a/src/scripting/python/keybinding.h b/src/scripting/python/keybinding.h index e3601182..b3f98796 100644 --- a/src/scripting/python/keybinding.h +++ b/src/scripting/python/keybinding.h @@ -3,9 +3,17 @@ #include +#ifdef __cplusplus +extern "C" { +#endif + extern PyObject *keybindings; PyObject *python_bind_key(PyObject *self, PyObject *args, PyObject *kwargs); extern char python_bind_key_doc[]; void python_done_keybinding_interface(void); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/scripting/python/load.c b/src/scripting/python/load.c index 44c290ce..54222b7a 100644 --- a/src/scripting/python/load.c +++ b/src/scripting/python/load.c @@ -15,6 +15,7 @@ #include "network/state.h" #include "protocol/uri.h" #include "scripting/python/core.h" +#include "scripting/python/load.h" #include "session/download.h" #include "session/session.h" #include "session/task.h" diff --git a/src/scripting/python/load.h b/src/scripting/python/load.h index a6603bf9..fcd177a3 100644 --- a/src/scripting/python/load.h +++ b/src/scripting/python/load.h @@ -3,7 +3,15 @@ #include +#ifdef __cplusplus +extern "C" { +#endif + PyObject *python_load(PyObject *self, PyObject *args); extern char python_load_doc[]; +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/scripting/python/menu.c b/src/scripting/python/menu.c index 6695289f..c454c33c 100644 --- a/src/scripting/python/menu.c +++ b/src/scripting/python/menu.c @@ -14,6 +14,7 @@ #include "document/view.h" #include "intl/gettext/libintl.h" #include "scripting/python/core.h" +#include "scripting/python/menu.h" #include "session/session.h" #include "terminal/window.h" #include "util/error.h" diff --git a/src/scripting/python/menu.h b/src/scripting/python/menu.h index cd4d56d1..3f695c17 100644 --- a/src/scripting/python/menu.h +++ b/src/scripting/python/menu.h @@ -3,7 +3,15 @@ #include +#ifdef __cplusplus +extern "C" { +#endif + PyObject *python_menu(PyObject *self, PyObject *args, PyObject *kwargs); extern char python_menu_doc[]; +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/scripting/python/open.c b/src/scripting/python/open.c index f23acce5..166b42d0 100644 --- a/src/scripting/python/open.c +++ b/src/scripting/python/open.c @@ -12,6 +12,7 @@ #include "intl/gettext/libintl.h" #include "protocol/uri.h" #include "scripting/python/core.h" +#include "scripting/python/open.h" #include "session/task.h" #include "terminal/tab.h" #include "util/error.h" diff --git a/src/scripting/python/open.h b/src/scripting/python/open.h index 02635deb..35067e26 100644 --- a/src/scripting/python/open.h +++ b/src/scripting/python/open.h @@ -3,7 +3,15 @@ #include +#ifdef __cplusplus +extern "C" { +#endif + PyObject *python_open(PyObject *self, PyObject *args, PyObject *kwargs); extern char python_open_doc[]; +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/scripting/python/python.h b/src/scripting/python/python.h index 268421ae..a856ee94 100644 --- a/src/scripting/python/python.h +++ b/src/scripting/python/python.h @@ -2,8 +2,16 @@ #ifndef EL__SCRIPTING_PYTHON_PYTHON_H #define EL__SCRIPTING_PYTHON_PYTHON_H +#ifdef __cplusplus +extern "C" { +#endif + struct module; extern struct module python_scripting_module; +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/scripting/ruby/core.h b/src/scripting/ruby/core.h index 74b66cd9..aceada4c 100644 --- a/src/scripting/ruby/core.h +++ b/src/scripting/ruby/core.h @@ -2,11 +2,15 @@ #ifndef EL__SCRIPTING_RUBY_CORE_H #define EL__SCRIPTING_RUBY_CORE_H +#include /* for VALUE */ + +#ifdef __cplusplus +extern "C" { +#endif + struct module; struct session; -#include /* for VALUE */ - #ifndef RSTRING_LEN #define RSTRING_LEN(string) (RSTRING(string)->len) #endif @@ -28,4 +32,8 @@ void erb_report_error(struct session *ses, int state); void init_ruby(struct module *module); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/scripting/ruby/hooks.h b/src/scripting/ruby/hooks.h index 30308a12..820c2bb5 100644 --- a/src/scripting/ruby/hooks.h +++ b/src/scripting/ruby/hooks.h @@ -2,8 +2,16 @@ #ifndef EL__SCRIPTING_RUBY_HOOKS_H #define EL__SCRIPTING_RUBY_HOOKS_H +#ifdef __cplusplus +extern "C" { +#endif + struct event_hook_info; extern struct event_hook_info ruby_scripting_hooks[]; +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/scripting/ruby/ruby.h b/src/scripting/ruby/ruby.h index 376057ce..0a96d3a8 100644 --- a/src/scripting/ruby/ruby.h +++ b/src/scripting/ruby/ruby.h @@ -2,8 +2,16 @@ #ifndef EL__SCRIPTING_RUBY_RUBY_H #define EL__SCRIPTING_RUBY_RUBY_H +#ifdef __cplusplus +extern "C" { +#endif + struct module; extern struct module ruby_scripting_module; +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/scripting/scripting.h b/src/scripting/scripting.h index a746517f..62d470a2 100644 --- a/src/scripting/scripting.h +++ b/src/scripting/scripting.h @@ -1,6 +1,10 @@ #ifndef EL__SCRIPTING_SCRIPTING_H #define EL__SCRIPTING_SCRIPTING_H +#ifdef __cplusplus +extern "C" { +#endif + #ifdef CONFIG_SCRIPTING struct module; @@ -14,4 +18,8 @@ extern struct module scripting_module; #endif +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/scripting/smjs/action_object.c b/src/scripting/smjs/action_object.c index 86e9ed79..219e46b4 100644 --- a/src/scripting/smjs/action_object.c +++ b/src/scripting/smjs/action_object.c @@ -23,7 +23,19 @@ struct smjs_action_fn_callback_hop { action_id_T action_id; }; -static const JSClass action_fn_class; /* defined below */ +static void smjs_action_fn_finalize(JSFreeOp *op, JSObject *obj); +static JSBool smjs_action_fn_callback(JSContext *ctx, unsigned int argc, jsval *rval); + +static const JSClass action_fn_class = { + "action_fn", + JSCLASS_HAS_PRIVATE, /* struct smjs_action_fn_callback_hop * */ + JS_PropertyStub, JS_DeletePropertyStub, + JS_PropertyStub, JS_StrictPropertyStub, + JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, + smjs_action_fn_finalize, + NULL, + smjs_action_fn_callback, +}; /* @action_fn_class.finalize */ static void @@ -114,16 +126,6 @@ smjs_action_fn_callback(JSContext *ctx, unsigned int argc, jsval *rval) return JS_TRUE; } -static const JSClass action_fn_class = { - "action_fn", - JSCLASS_HAS_PRIVATE, /* struct smjs_action_fn_callback_hop * */ - JS_PropertyStub, JS_PropertyStub, - JS_PropertyStub, JS_StrictPropertyStub, - JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, - smjs_action_fn_finalize, - NULL, - smjs_action_fn_callback, -}; static JSObject * smjs_get_action_fn_object(unsigned char *action_str) @@ -163,10 +165,10 @@ smjs_get_action_fn_object(unsigned char *action_str) /* @action_class.getProperty */ static JSBool -action_get_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) +action_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS - jsid id = *(hid._); + jsid id = hid.get(); (void)obj; jsval val; @@ -190,7 +192,7 @@ action_get_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutab static const JSClass action_class = { "action", 0, - JS_PropertyStub, JS_PropertyStub, + JS_PropertyStub, JS_DeletePropertyStub, action_get_property, JS_StrictPropertyStub, JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, NULL, }; diff --git a/src/scripting/smjs/bookmarks.c b/src/scripting/smjs/bookmarks.c index 057fbd56..c1e0087c 100644 --- a/src/scripting/smjs/bookmarks.c +++ b/src/scripting/smjs/bookmarks.c @@ -15,11 +15,27 @@ #include "util/memory.h" -static const JSClass bookmark_class, bookmark_folder_class; /* defined below */ - - /*** common code ***/ +static void bookmark_finalize(JSFreeOp *op, JSObject *obj); +static JSBool bookmark_folder_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); + +static const JSClass bookmark_class = { + "bookmark", + JSCLASS_HAS_PRIVATE, /* struct bookmark * */ + JS_PropertyStub, JS_DeletePropertyStub, + JS_PropertyStub, JS_StrictPropertyStub, + JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, bookmark_finalize, +}; + +static const JSClass bookmark_folder_class = { + "bookmark_folder", + JSCLASS_HAS_PRIVATE, /* struct bookmark * */ + JS_PropertyStub, JS_PropertyStub, + bookmark_folder_get_property, JS_StrictPropertyStub, + JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, bookmark_finalize, +}; + static JSObject * smjs_get_bookmark_generic_object(struct bookmark *bookmark, JSClass *clasp) { @@ -68,11 +84,11 @@ enum bookmark_prop { BOOKMARK_CHILDREN = -3, }; -static JSBool bookmark_get_property_title(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp); -static JSBool bookmark_set_property_title(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSBool strict, JSMutableHandleValue hvp); -static JSBool bookmark_get_property_url(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp); -static JSBool bookmark_set_property_url(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSBool strict, JSMutableHandleValue hvp); -static JSBool bookmark_get_property_children(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp); +static JSBool bookmark_get_property_title(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); +static JSBool bookmark_set_property_title(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp); +static JSBool bookmark_get_property_url(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); +static JSBool bookmark_set_property_url(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp); +static JSBool bookmark_get_property_children(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); static const JSPropertySpec bookmark_props[] = { { "title", 0, JSPROP_ENUMERATE, JSOP_WRAPPER(bookmark_get_property_title), JSOP_WRAPPER(bookmark_set_property_title) }, @@ -150,7 +166,7 @@ jsval_to_bookmark_string(JSContext *ctx, jsval val, unsigned char **result) } static JSBool -bookmark_get_property_title(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) +bookmark_get_property_title(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS @@ -171,7 +187,7 @@ bookmark_get_property_title(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, } static JSBool -bookmark_set_property_title(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSBool strict, JSMutableHandleValue hvp) +bookmark_set_property_title(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS @@ -201,7 +217,7 @@ bookmark_set_property_title(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, } static JSBool -bookmark_get_property_url(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) +bookmark_get_property_url(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS @@ -222,7 +238,7 @@ bookmark_get_property_url(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, J } static JSBool -bookmark_set_property_url(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSBool strict, JSMutableHandleValue hvp) +bookmark_set_property_url(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS @@ -252,7 +268,7 @@ bookmark_set_property_url(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, J } static JSBool -bookmark_get_property_children(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) +bookmark_get_property_children(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS @@ -274,13 +290,6 @@ bookmark_get_property_children(JSContext *ctx, JSHandleObject hobj, JSHandleId h return JS_TRUE; } -static const JSClass bookmark_class = { - "bookmark", - JSCLASS_HAS_PRIVATE, /* struct bookmark * */ - JS_PropertyStub, JS_PropertyStub, - JS_PropertyStub, JS_StrictPropertyStub, - JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, bookmark_finalize, -}; static JSObject * smjs_get_bookmark_object(struct bookmark *bookmark) @@ -303,10 +312,10 @@ smjs_get_bookmark_object(struct bookmark *bookmark) /* @bookmark_folder_class.getProperty */ static JSBool -bookmark_folder_get_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) +bookmark_folder_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS - jsid id = *(hid._); + jsid id = hid.get(); struct bookmark *bookmark; struct bookmark *folder; @@ -339,13 +348,6 @@ bookmark_folder_get_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid return JS_TRUE; } -static const JSClass bookmark_folder_class = { - "bookmark_folder", - JSCLASS_HAS_PRIVATE, /* struct bookmark * */ - JS_PropertyStub, JS_PropertyStub, - bookmark_folder_get_property, JS_StrictPropertyStub, - JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, bookmark_finalize, -}; static JSObject * smjs_get_bookmark_folder_object(struct bookmark *bookmark) diff --git a/src/scripting/smjs/cache_object.c b/src/scripting/smjs/cache_object.c index 9995370d..21fc4473 100644 --- a/src/scripting/smjs/cache_object.c +++ b/src/scripting/smjs/cache_object.c @@ -15,7 +15,15 @@ #include "util/error.h" #include "util/memory.h" -static const JSClass cache_entry_class; /* defined below */ +static void cache_entry_finalize(JSFreeOp *op, JSObject *obj); + +static const JSClass cache_entry_class = { + "cache_entry", + JSCLASS_HAS_PRIVATE, /* struct cache_entry *; a weak reference */ + JS_PropertyStub, JS_DeletePropertyStub, + JS_PropertyStub, JS_StrictPropertyStub, + JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, cache_entry_finalize +}; /* Tinyids of properties. Use negative values to distinguish these * from array indexes (even though this object has no array elements). @@ -29,14 +37,14 @@ enum cache_entry_prop { CACHE_ENTRY_URI = -5, }; -static JSBool cache_entry_get_property_content(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp); -static JSBool cache_entry_set_property_content(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSBool strict, JSMutableHandleValue hvp); -static JSBool cache_entry_get_property_type(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp); -static JSBool cache_entry_set_property_type(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSBool strict, JSMutableHandleValue hvp); -static JSBool cache_entry_get_property_length(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp); -static JSBool cache_entry_get_property_head(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp); -static JSBool cache_entry_set_property_head(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSBool strict, JSMutableHandleValue hvp); -static JSBool cache_entry_get_property_uri(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp); +static JSBool cache_entry_get_property_content(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); +static JSBool cache_entry_set_property_content(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp); +static JSBool cache_entry_get_property_type(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); +static JSBool cache_entry_set_property_type(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp); +static JSBool cache_entry_get_property_length(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); +static JSBool cache_entry_get_property_head(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); +static JSBool cache_entry_set_property_head(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp); +static JSBool cache_entry_get_property_uri(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); static const JSPropertySpec cache_entry_props[] = { { "content", 0, JSPROP_ENUMERATE, JSOP_WRAPPER(cache_entry_get_property_content), JSOP_WRAPPER(cache_entry_set_property_content) }, @@ -48,7 +56,7 @@ static const JSPropertySpec cache_entry_props[] = { }; static JSBool -cache_entry_get_property_content(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) +cache_entry_get_property_content(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS @@ -90,7 +98,7 @@ cache_entry_get_property_content(JSContext *ctx, JSHandleObject hobj, JSHandleId } static JSBool -cache_entry_set_property_content(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSBool strict, JSMutableHandleValue hvp) +cache_entry_set_property_content(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS @@ -129,7 +137,7 @@ cache_entry_set_property_content(JSContext *ctx, JSHandleObject hobj, JSHandleId } static JSBool -cache_entry_get_property_type(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) +cache_entry_get_property_type(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS @@ -160,7 +168,7 @@ cache_entry_get_property_type(JSContext *ctx, JSHandleObject hobj, JSHandleId hi } static JSBool -cache_entry_set_property_type(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSBool strict, JSMutableHandleValue hvp) +cache_entry_set_property_type(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS @@ -222,13 +230,6 @@ cache_entry_finalize(JSFreeOp *op, JSObject *obj) cached->jsobject = NULL; } -static const JSClass cache_entry_class = { - "cache_entry", - JSCLASS_HAS_PRIVATE, /* struct cache_entry *; a weak reference */ - JS_PropertyStub, JS_PropertyStub, - JS_PropertyStub, JS_StrictPropertyStub, - JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, cache_entry_finalize -}; /** Return an SMJS object through which scripts can access @a cached. * If there already is such an object, return that; otherwise create a @@ -288,7 +289,7 @@ smjs_detach_cache_entry_object(struct cache_entry *cached) } static JSBool -cache_entry_get_property_length(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) +cache_entry_get_property_length(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS @@ -319,7 +320,7 @@ cache_entry_get_property_length(JSContext *ctx, JSHandleObject hobj, JSHandleId } static JSBool -cache_entry_get_property_head(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) +cache_entry_get_property_head(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS @@ -350,7 +351,7 @@ cache_entry_get_property_head(JSContext *ctx, JSHandleObject hobj, JSHandleId hi } static JSBool -cache_entry_set_property_head(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSBool strict, JSMutableHandleValue hvp) +cache_entry_set_property_head(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS @@ -387,7 +388,7 @@ cache_entry_set_property_head(JSContext *ctx, JSHandleObject hobj, JSHandleId hi } static JSBool -cache_entry_get_property_uri(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) +cache_entry_get_property_uri(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS diff --git a/src/scripting/smjs/core.c b/src/scripting/smjs/core.c index 11488033..04906142 100644 --- a/src/scripting/smjs/core.c +++ b/src/scripting/smjs/core.c @@ -82,7 +82,7 @@ smjs_do_file(unsigned char *path) if (!add_file_to_string(&script, path) || JS_FALSE == JS_EvaluateScript(smjs_ctx, - JS_GetGlobalObject(smjs_ctx), + JS_GetGlobalForScopeChain(smjs_ctx), script.source, script.length, path, 1, &rval)) { alert_smjs_error("error loading script file"); ret = 0; @@ -136,8 +136,7 @@ init_smjs(struct module *module) return; } - JS_SetOptions(smjs_ctx, JSOPTION_VAROBJFIX | JSOPTION_METHODJIT); - JS_SetVersion(smjs_ctx, JSVERSION_LATEST); + JS_SetOptions(smjs_ctx, JSOPTION_VAROBJFIX | JS_METHODJIT); JS_SetErrorReporter(smjs_ctx, error_reporter); diff --git a/src/scripting/smjs/elinks_object.c b/src/scripting/smjs/elinks_object.c index 69a71a67..88fd4d7b 100644 --- a/src/scripting/smjs/elinks_object.c +++ b/src/scripting/smjs/elinks_object.c @@ -95,10 +95,10 @@ enum elinks_prop { ELINKS_SESSION, }; -static JSBool elinks_get_property_home(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp); -static JSBool elinks_get_property_location(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp); -static JSBool elinks_set_property_location(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSBool strict, JSMutableHandleValue hvp); -static JSBool elinks_get_property_session(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp); +static JSBool elinks_get_property_home(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); +static JSBool elinks_get_property_location(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); +static JSBool elinks_set_property_location(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp); +static JSBool elinks_get_property_session(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); static const JSPropertySpec elinks_props[] = { { "home", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_READONLY, JSOP_WRAPPER(elinks_get_property_home), JSOP_NULLWRAPPER }, @@ -107,14 +107,24 @@ static const JSPropertySpec elinks_props[] = { { NULL } }; -static const JSClass elinks_class; +static JSBool elinks_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); +static JSBool elinks_set_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp); + +static const JSClass elinks_class = { + "elinks", + 0, + JS_PropertyStub, JS_DeletePropertyStub, + elinks_get_property, elinks_set_property, + JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, NULL +}; + /* @elinks_class.getProperty */ static JSBool -elinks_get_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) +elinks_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS - jsid id = *(hid._); + jsid id = hid.get(); /* This can be called if @obj if not itself an instance of the * appropriate class but has one in its prototype chain. Fail @@ -169,10 +179,10 @@ elinks_get_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutab } static JSBool -elinks_set_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSBool strict, JSMutableHandleValue hvp) +elinks_set_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS - jsid id = *(hid._); + jsid id = hid.get(); /* This can be called if @obj if not itself an instance of the * appropriate class but has one in its prototype chain. Fail @@ -211,13 +221,6 @@ elinks_set_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSBool return JS_FALSE; } -static const JSClass elinks_class = { - "elinks", - 0, - JS_PropertyStub, JS_PropertyStub, - elinks_get_property, elinks_set_property, - JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, NULL -}; static const spidermonkeyFunctionSpec elinks_funcs[] = { { "alert", elinks_alert, 1 }, @@ -275,7 +278,7 @@ smjs_invoke_elinks_object_method(unsigned char *method, jsval argv[], int argc, } static JSBool -elinks_get_property_home(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) +elinks_get_property_home(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS @@ -291,7 +294,7 @@ elinks_get_property_home(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JS } static JSBool -elinks_get_property_location(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) +elinks_get_property_location(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS struct uri *uri; @@ -311,7 +314,7 @@ elinks_get_property_location(JSContext *ctx, JSHandleObject hobj, JSHandleId hid } static JSBool -elinks_set_property_location(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSBool strict, JSMutableHandleValue hvp) +elinks_set_property_location(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS JSString *jsstr; @@ -337,7 +340,7 @@ elinks_set_property_location(JSContext *ctx, JSHandleObject hobj, JSHandleId hid } static JSBool -elinks_get_property_session(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) +elinks_get_property_session(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS JSObject *jsobj; diff --git a/src/scripting/smjs/global_object.c b/src/scripting/smjs/global_object.c index 74050fde..80866b2a 100644 --- a/src/scripting/smjs/global_object.c +++ b/src/scripting/smjs/global_object.c @@ -11,13 +11,14 @@ #include "scripting/smjs/core.h" #include "scripting/smjs/global_object.h" +using namespace JS; JSObject *smjs_global_object; static const JSClass global_class = { "global", JSCLASS_GLOBAL_FLAGS, - JS_PropertyStub, JS_PropertyStub, + JS_PropertyStub, JS_DeletePropertyStub, JS_PropertyStub, JS_StrictPropertyStub, JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, NULL }; @@ -25,14 +26,18 @@ static const JSClass global_class = { static JSObject * smjs_get_global_object(void) { - JSObject *jsobj; - assert(smjs_ctx); + JSAutoCompartment *acc = NULL; + + JSAutoRequest ar(smjs_ctx); + RootedObject jsobj(smjs_ctx); jsobj = JS_NewGlobalObject(smjs_ctx, (JSClass *) &global_class, NULL); if (!jsobj) return NULL; + acc = new JSAutoCompartment(smjs_ctx, jsobj); + JS_InitStandardClasses(smjs_ctx, jsobj); return jsobj; diff --git a/src/scripting/smjs/globhist.c b/src/scripting/smjs/globhist.c index fb7064b9..2f8e5bc7 100644 --- a/src/scripting/smjs/globhist.c +++ b/src/scripting/smjs/globhist.c @@ -12,9 +12,19 @@ #include "scripting/smjs/elinks_object.h" #include "util/memory.h" +static JSBool smjs_globhist_item_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); +static JSBool smjs_globhist_item_set_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp); -static const JSClass smjs_globhist_item_class; /* defined below */ +static void smjs_globhist_item_finalize(JSFreeOp *op, JSObject *obj); +static const JSClass smjs_globhist_item_class = { + "global_history_item", + JSCLASS_HAS_PRIVATE, /* struct global_history_item * */ + JS_PropertyStub, JS_DeletePropertyStub, + smjs_globhist_item_get_property, smjs_globhist_item_set_property, + JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, + smjs_globhist_item_finalize, +}; /* @smjs_globhist_item_class.finalize */ static void @@ -41,12 +51,12 @@ enum smjs_globhist_item_prop { GLOBHIST_LAST_VISIT = -3, }; -static JSBool smjs_globhist_item_get_property_title(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp); -static JSBool smjs_globhist_item_set_property_title(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSBool strict, JSMutableHandleValue hvp); -static JSBool smjs_globhist_item_get_property_url(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp); -static JSBool smjs_globhist_item_set_property_url(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSBool strict, JSMutableHandleValue hvp); -static JSBool smjs_globhist_item_get_property_last_visit(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp); -static JSBool smjs_globhist_item_set_property_last_visit(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSBool strict, JSMutableHandleValue hvp); +static JSBool smjs_globhist_item_get_property_title(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); +static JSBool smjs_globhist_item_set_property_title(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp); +static JSBool smjs_globhist_item_get_property_url(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); +static JSBool smjs_globhist_item_set_property_url(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp); +static JSBool smjs_globhist_item_get_property_last_visit(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); +static JSBool smjs_globhist_item_set_property_last_visit(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp); static const JSPropertySpec smjs_globhist_item_props[] = { { "title", 0, JSPROP_ENUMERATE, JSOP_WRAPPER(smjs_globhist_item_get_property_title), JSOP_WRAPPER(smjs_globhist_item_set_property_title) }, @@ -57,11 +67,11 @@ static const JSPropertySpec smjs_globhist_item_props[] = { /* @smjs_globhist_item_class.getProperty */ static JSBool -smjs_globhist_item_get_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, - JSMutableHandleValue hvp) +smjs_globhist_item_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, + JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS - jsid id = *(hid._); + jsid id = hid.get(); struct global_history_item *history_item; @@ -126,10 +136,10 @@ smjs_globhist_item_get_property(JSContext *ctx, JSHandleObject hobj, JSHandleId /* @smjs_globhist_item_class.setProperty */ static JSBool -smjs_globhist_item_set_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSBool strict, JSMutableHandleValue hvp) +smjs_globhist_item_set_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS - jsid id = *(hid._); + jsid id = hid.get(); struct global_history_item *history_item; @@ -183,14 +193,6 @@ smjs_globhist_item_set_property(JSContext *ctx, JSHandleObject hobj, JSHandleId } } -static const JSClass smjs_globhist_item_class = { - "global_history_item", - JSCLASS_HAS_PRIVATE, /* struct global_history_item * */ - JS_PropertyStub, JS_PropertyStub, - smjs_globhist_item_get_property, smjs_globhist_item_set_property, - JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, - smjs_globhist_item_finalize, -}; static JSObject * smjs_get_globhist_item_object(struct global_history_item *history_item) @@ -213,10 +215,10 @@ smjs_get_globhist_item_object(struct global_history_item *history_item) /* @smjs_globhist_class.getProperty */ static JSBool -smjs_globhist_get_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) +smjs_globhist_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS - jsid id = *(hid._); + jsid id = hid.get(); (void)obj; JSObject *jsobj; @@ -283,8 +285,8 @@ smjs_init_globhist_interface(void) } static JSBool -smjs_globhist_item_get_property_title(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, - JSMutableHandleValue hvp) +smjs_globhist_item_get_property_title(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, + JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS @@ -308,7 +310,7 @@ smjs_globhist_item_get_property_title(JSContext *ctx, JSHandleObject hobj, JSHan } static JSBool -smjs_globhist_item_set_property_title(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSBool strict, JSMutableHandleValue hvp) +smjs_globhist_item_set_property_title(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS @@ -336,8 +338,8 @@ smjs_globhist_item_set_property_title(JSContext *ctx, JSHandleObject hobj, JSHan } static JSBool -smjs_globhist_item_get_property_url(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, - JSMutableHandleValue hvp) +smjs_globhist_item_get_property_url(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, + JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS @@ -361,7 +363,7 @@ smjs_globhist_item_get_property_url(JSContext *ctx, JSHandleObject hobj, JSHandl } static JSBool -smjs_globhist_item_set_property_url(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSBool strict, JSMutableHandleValue hvp) +smjs_globhist_item_set_property_url(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS @@ -389,8 +391,8 @@ smjs_globhist_item_set_property_url(JSContext *ctx, JSHandleObject hobj, JSHandl } static JSBool -smjs_globhist_item_get_property_last_visit(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, - JSMutableHandleValue hvp) +smjs_globhist_item_get_property_last_visit(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, + JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS @@ -431,7 +433,7 @@ smjs_globhist_item_get_property_last_visit(JSContext *ctx, JSHandleObject hobj, /* @smjs_globhist_item_class.setProperty */ static JSBool -smjs_globhist_item_set_property_last_visit(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSBool strict, JSMutableHandleValue hvp) +smjs_globhist_item_set_property_last_visit(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS diff --git a/src/scripting/smjs/keybinding.c b/src/scripting/smjs/keybinding.c index 6a4c28a3..498ca4ac 100644 --- a/src/scripting/smjs/keybinding.c +++ b/src/scripting/smjs/keybinding.c @@ -13,14 +13,24 @@ #include "scripting/smjs/elinks_object.h" #include "util/memory.h" -static const JSClass keymap_class; /* defined below */ +static JSBool keymap_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); +static JSBool keymap_set_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp); +static void keymap_finalize(JSFreeOp *op, JSObject *obj); + +static const JSClass keymap_class = { + "keymap", + JSCLASS_HAS_PRIVATE, /* int * */ + JS_PropertyStub, JS_DeletePropertyStub, + keymap_get_property, keymap_set_property, + JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, keymap_finalize, +}; /* @keymap_class.getProperty */ static JSBool -keymap_get_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) +keymap_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS - jsid id = *(hid._); + jsid id = hid.get(); unsigned char *action_str; const unsigned char *keystroke_str; @@ -77,10 +87,10 @@ smjs_keybinding_action_callback(va_list ap, void *data) /* @keymap_class.setProperty */ static JSBool -keymap_set_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSBool strict, JSMutableHandleValue hvp) +keymap_set_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS - jsid id = *(hid._); + jsid id = hid.get(); int *data; unsigned char *keymap_str; @@ -179,14 +189,6 @@ keymap_finalize(JSFreeOp *op, JSObject *obj) mem_free(data); } -static const JSClass keymap_class = { - "keymap", - JSCLASS_HAS_PRIVATE, /* int * */ - JS_PropertyStub, JS_PropertyStub, - keymap_get_property, keymap_set_property, - JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, keymap_finalize, -}; - static JSObject * smjs_get_keymap_object(enum keymap_id keymap_id) { @@ -219,7 +221,7 @@ static JSObject * smjs_get_keymap_hash_object(void) { jsval val; - enum keymap_id keymap_id; + int keymap_id; JSObject *keymaps_hash; keymaps_hash = JS_NewObject(smjs_ctx, (JSClass *) &keymaps_hash_class, diff --git a/src/scripting/smjs/session_object.c b/src/scripting/smjs/session_object.c index 41beda41..98f8f017 100644 --- a/src/scripting/smjs/session_object.c +++ b/src/scripting/smjs/session_object.c @@ -30,9 +30,30 @@ static JSObject *smjs_session_object; -static const JSClass session_class; /* Defined below. */ +static JSBool session_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); +static JSBool session_set_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp); +static void session_finalize(JSFreeOp *op, JSObject *obj); +static JSBool session_construct(JSContext *ctx, unsigned int argc, jsval *rval); -static const JSClass location_array_class; /* Defined below. */ +static const JSClass session_class = { + "session", + JSCLASS_HAS_PRIVATE, /* struct session *; a weak reference */ + JS_PropertyStub, JS_DeletePropertyStub, + session_get_property, session_set_property, + JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, session_finalize, + NULL, NULL, NULL, session_construct +}; + +static JSBool smjs_location_array_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); +static void smjs_location_array_finalize(JSFreeOp *op, JSObject *obj); + +static const JSClass location_array_class = { + "location_array", + JSCLASS_HAS_PRIVATE, /* struct session *; a weak reference */ + JS_PropertyStub, JS_DeletePropertyStub, + smjs_location_array_get_property, JS_StrictPropertyStub, + JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, smjs_location_array_finalize, +}; /* location_array_class is the class for array object, the elements of which * correspond to the elements of session.history. @@ -42,10 +63,10 @@ static const JSClass location_array_class; /* Defined below. */ /* @location_array.getProperty */ static JSBool -smjs_location_array_get_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) +smjs_location_array_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS - jsid id = *(hid._); + jsid id = hid.get(); struct session *ses; int index; @@ -112,13 +133,6 @@ smjs_location_array_finalize(JSFreeOp *op, JSObject *obj) ses->history_jsobject = NULL; } -static const JSClass location_array_class = { - "location_array", - JSCLASS_HAS_PRIVATE, /* struct session *; a weak reference */ - JS_PropertyStub, JS_PropertyStub, - smjs_location_array_get_property, JS_StrictPropertyStub, - JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, smjs_location_array_finalize, -}; /** Return an SMJS object through which scripts can access @a ses.history. If * there already is such an object, return that; otherwise create a new one. @@ -191,10 +205,10 @@ static const JSPropertySpec session_props[] = { /* @session_class.getProperty */ static JSBool -session_get_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) +session_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS - jsid id = *(hid._); + jsid id = hid.get(); struct session *ses; @@ -300,10 +314,10 @@ session_get_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMuta } static JSBool -session_set_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSBool strict, JSMutableHandleValue hvp) +session_set_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS - jsid id = *(hid._); + jsid id = hid.get(); struct session *ses; @@ -512,14 +526,6 @@ session_finalize(JSFreeOp *op, JSObject *obj) ses->jsobject = NULL; } -static const JSClass session_class = { - "session", - JSCLASS_HAS_PRIVATE, /* struct session *; a weak reference */ - JS_PropertyStub, JS_PropertyStub, - session_get_property, session_set_property, - JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, session_finalize, - NULL, NULL, NULL, session_construct -}; /** Return an SMJS object through which scripts can access @a ses. * If there already is such an object, return that; otherwise create a @@ -590,10 +596,10 @@ smjs_detach_session_object(struct session *ses) * previously attached to the session object, the object will remain in * memory but it will no longer be able to access the session object. */ static JSBool -session_array_get_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) +session_array_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS - jsid id = *(hid._); + jsid id = hid.get(); JSObject *tabobj; struct terminal *term = JS_GetPrivate(obj); @@ -678,15 +684,15 @@ smjs_session_goto_url(JSContext *ctx, unsigned int argc, jsval *rval) JSString *jsstr; unsigned char *url; struct session *ses; - struct JSObject *this; + struct JSObject *this_o; if (argc != 1) return JS_FALSE; - this = JS_THIS_OBJECT(ctx, rval); - if (!JS_InstanceOf(ctx, this, (JSClass *) &session_class, NULL)) + this_o = JS_THIS_OBJECT(ctx, rval); + if (!JS_InstanceOf(ctx, this_o, (JSClass *) &session_class, NULL)) return JS_FALSE; - ses = JS_GetInstancePrivate(ctx, this, + ses = JS_GetInstancePrivate(ctx, this_o, (JSClass *) &session_class, NULL); if (!ses) return JS_FALSE; /* detached */ diff --git a/src/scripting/smjs/terminal_object.c b/src/scripting/smjs/terminal_object.c index e47ba87f..c1cf3e2d 100644 --- a/src/scripting/smjs/terminal_object.c +++ b/src/scripting/smjs/terminal_object.c @@ -17,7 +17,16 @@ #include "util/memory.h" #include "viewer/text/vs.h" -static const JSClass terminal_class; /* Defined below. */ +static JSBool terminal_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); +static void terminal_finalize(JSFreeOp *op, JSObject *obj); + +static const JSClass terminal_class = { + "terminal", + JSCLASS_HAS_PRIVATE, /* struct terminal *; a weak refernce */ + JS_PropertyStub, JS_DeletePropertyStub, + terminal_get_property, JS_StrictPropertyStub, + JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, terminal_finalize +}; enum terminal_prop { TERMINAL_TAB, @@ -30,10 +39,10 @@ static const JSPropertySpec terminal_props[] = { /* @terminal_class.getProperty */ static JSBool -terminal_get_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) +terminal_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS - jsid id = *(hid._); + jsid id = hid.get(); struct terminal *term; @@ -88,13 +97,6 @@ terminal_finalize(JSFreeOp *op, JSObject *obj) term->jsobject = NULL; } -static const JSClass terminal_class = { - "terminal", - JSCLASS_HAS_PRIVATE, /* struct terminal *; a weak refernce */ - JS_PropertyStub, JS_PropertyStub, - terminal_get_property, JS_StrictPropertyStub, - JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, terminal_finalize -}; /** Return an SMJS object through which scripts can access @a term. * If there already is such an object, return that; otherwise create a @@ -153,10 +155,10 @@ smjs_detach_terminal_object(struct terminal *term) /* @terminal_array_class.getProperty */ static JSBool -terminal_array_get_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) +terminal_array_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS - jsid id = *(hid._); + jsid id = hid.get(); int index; struct terminal *term; diff --git a/src/scripting/smjs/view_state_object.c b/src/scripting/smjs/view_state_object.c index 1f23a9b3..158d08e7 100644 --- a/src/scripting/smjs/view_state_object.c +++ b/src/scripting/smjs/view_state_object.c @@ -20,7 +20,17 @@ #include "util/memory.h" #include "viewer/text/vs.h" -static const JSClass view_state_class; /* defined below */ +static JSBool view_state_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); +static JSBool view_state_set_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp); +static void view_state_finalize(JSFreeOp *op, JSObject *obj); + +static const JSClass view_state_class = { + "view_state", + JSCLASS_HAS_PRIVATE, /* struct view_state * */ + JS_PropertyStub, JS_DeletePropertyStub, + view_state_get_property, view_state_set_property, + JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, view_state_finalize +}; /* Tinyids of properties. Use negative values to distinguish these * from array indexes (even though this object has no array elements). @@ -39,10 +49,10 @@ static const JSPropertySpec view_state_props[] = { /* @view_state_class.getProperty */ static JSBool -view_state_get_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) +view_state_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS - jsid id = *(hid._); + jsid id = hid.get(); struct view_state *vs; @@ -84,10 +94,10 @@ view_state_get_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSM /* @view_state_class.setProperty */ static JSBool -view_state_set_property(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSBool strict, JSMutableHandleValue hvp) +view_state_set_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS - jsid id = *(hid._); + jsid id = hid.get(); struct view_state *vs; @@ -144,13 +154,6 @@ view_state_finalize(JSFreeOp *op, JSObject *obj) vs->jsobject = NULL; } -static const JSClass view_state_class = { - "view_state", - JSCLASS_HAS_PRIVATE, /* struct view_state * */ - JS_PropertyStub, JS_PropertyStub, - view_state_get_property, view_state_set_property, - JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, view_state_finalize -}; /** Return an SMJS object through which scripts can access @a vs. If there * already is such an object, return that; otherwise create a new one. */ @@ -184,7 +187,7 @@ smjs_get_view_state_object(struct view_state *vs) } static JSBool -smjs_elinks_get_view_state(JSContext *ctx, JSHandleObject hobj, JSHandleId hid, JSMutableHandleValue hvp) +smjs_elinks_get_view_state(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS (void)obj; diff --git a/src/session/download.h b/src/session/download.h index a4de701e..3d165961 100644 --- a/src/session/download.h +++ b/src/session/download.h @@ -6,6 +6,10 @@ #include "util/lists.h" #include "util/time.h" +#ifdef __cplusplus +extern "C" { +#endif + /* Silly BFU stuff */ struct dialog_data; struct listbox_item; @@ -222,4 +226,8 @@ void tp_save(struct type_query *type_query); void tp_cancel(void *data); struct file_download *init_file_download(struct uri *uri, struct session *ses, unsigned char *file, int fd); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/session/history.h b/src/session/history.h index ed28bf4a..566bc322 100644 --- a/src/session/history.h +++ b/src/session/history.h @@ -1,6 +1,10 @@ #ifndef EL__SESSION_HISTORY_H #define EL__SESSION_HISTORY_H +#ifdef __cplusplus +extern "C" { +#endif + struct location; struct session; @@ -43,4 +47,8 @@ void go_unback(struct session *ses); void ses_history_move(struct session *ses); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/session/location.h b/src/session/location.h index a534b739..52b36526 100644 --- a/src/session/location.h +++ b/src/session/location.h @@ -5,6 +5,10 @@ #include "util/lists.h" #include "viewer/text/vs.h" +#ifdef __cplusplus +extern "C" { +#endif + struct location { LIST_HEAD(struct location); @@ -20,4 +24,8 @@ void copy_location(struct location *, struct location *); * @relates location */ void destroy_location(struct location *); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/session/session.h b/src/session/session.h index 04fffedf..c4743fa3 100644 --- a/src/session/session.h +++ b/src/session/session.h @@ -10,6 +10,10 @@ #include "util/lists.h" #include "viewer/text/vs.h" +#ifdef __cplusplus +extern "C" { +#endif + struct document_view; struct link; struct location; @@ -315,4 +319,8 @@ int eat_kbd_repeat_count(struct session *ses); * highlighting and status bar. */ int set_kbd_repeat_count(struct session *ses, int new_count); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/session/task.h b/src/session/task.h index 1b335bac..0288776e 100644 --- a/src/session/task.h +++ b/src/session/task.h @@ -4,6 +4,10 @@ #include "cache/cache.h" #include "session/session.h" +#ifdef __cplusplus +extern "C" { +#endif + struct download; struct location; struct terminal; @@ -38,4 +42,8 @@ int goto_url_home(struct session *ses); void goto_imgmap(struct session *, struct uri *, unsigned char *); void map_selected(struct terminal *term, void *ld, void *ses); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/terminal/color.h b/src/terminal/color.h index 1d4c2834..6302130b 100644 --- a/src/terminal/color.h +++ b/src/terminal/color.h @@ -2,6 +2,11 @@ #define EL__TERMINAL_COLOR_H #include "util/color.h" + +#ifdef __cplusplus +extern "C" { +#endif + struct screen_char; /* Terminal color encoding: */ @@ -86,4 +91,8 @@ void get_screen_char_color(struct screen_char *schar, struct color_pair *pair, void set_term_color(struct screen_char *schar, struct color_pair *pair, enum color_flags flags, enum color_mode mode); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/terminal/draw.h b/src/terminal/draw.h index 4d802d00..c8ab9c9c 100644 --- a/src/terminal/draw.h +++ b/src/terminal/draw.h @@ -3,6 +3,10 @@ #include "intl/charsets.h" /* unicode_val_T */ +#ifdef __cplusplus +extern "C" { +#endif + struct color_pair; struct dialog_data; struct el_box; @@ -306,4 +310,8 @@ void set_dlg_cursor(struct terminal *term, struct dialog_data *dlg_data, int x, /** Blanks the screen. */ void clear_terminal(struct terminal *); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/terminal/event.h b/src/terminal/event.h index 32abc1d1..b098a001 100644 --- a/src/terminal/event.h +++ b/src/terminal/event.h @@ -4,6 +4,10 @@ #include "terminal/kbd.h" #include "terminal/mouse.h" +#ifdef __cplusplus +extern "C" { +#endif + struct terminal; /* Some constants for the strings inside of {struct terminal}. */ @@ -202,5 +206,8 @@ void in_term(struct terminal *); mouse_is_in_box(&(event)->info.mouse, box) /** @} */ +#ifdef __cplusplus +} +#endif #endif /* EL__TERMINAL_EVENT_H */ diff --git a/src/terminal/hardio.h b/src/terminal/hardio.h index c3915b0c..29629200 100644 --- a/src/terminal/hardio.h +++ b/src/terminal/hardio.h @@ -1,7 +1,15 @@ #ifndef EL__TERMINAL_HARDIO_H #define EL__TERMINAL_HARDIO_H +#ifdef __cplusplus +extern "C" { +#endif + ssize_t hard_write(int fd, unsigned char *data, size_t datalen); ssize_t hard_read(int fd, unsigned char *data, size_t datalen); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/terminal/itrm.h b/src/terminal/itrm.h index c88a37f5..d8a175e2 100644 --- a/src/terminal/itrm.h +++ b/src/terminal/itrm.h @@ -1,6 +1,9 @@ #ifndef EL__TERMINAL_ITRM_H #define EL__TERMINAL_ITRM_H +#ifdef __cplusplus +extern "C" { +#endif #define ITRM_OUT_QUEUE_SIZE 16384 @@ -113,4 +116,8 @@ struct itrm { unsigned int bracketed_pasting:1;/**< Received bracketed-paste escape*/ }; +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/terminal/kbd.h b/src/terminal/kbd.h index e277988f..d80b8b86 100644 --- a/src/terminal/kbd.h +++ b/src/terminal/kbd.h @@ -3,6 +3,10 @@ #include "intl/charsets.h" +#ifdef __cplusplus +extern "C" { +#endif + struct itrm; /** A character received from a terminal. */ @@ -144,5 +148,8 @@ void get_terminal_name(unsigned char *); (kbd_)->modifier = (modifier_); \ } while (0) +#ifdef __cplusplus +} +#endif #endif diff --git a/src/terminal/mouse.h b/src/terminal/mouse.h index 3e650121..272c00a0 100644 --- a/src/terminal/mouse.h +++ b/src/terminal/mouse.h @@ -1,6 +1,10 @@ #ifndef EL__TERMINAL_MOUSE_H #define EL__TERMINAL_MOUSE_H +#ifdef __cplusplus +extern "C" { +#endif + struct interlink_event; struct itrm; @@ -119,5 +123,8 @@ void enable_mouse(void); void toggle_mouse(void); int decode_terminal_mouse_escape_sequence(struct itrm *itrm, struct interlink_event *ev, int el, int v); +#ifdef __cplusplus +} +#endif #endif diff --git a/src/terminal/screen.h b/src/terminal/screen.h index 9513a51e..7ed3bf2f 100644 --- a/src/terminal/screen.h +++ b/src/terminal/screen.h @@ -1,6 +1,9 @@ #ifndef EL__TERMINAL_SCREEN_H #define EL__TERMINAL_SCREEN_H +#ifdef __cplusplus +extern "C" { +#endif struct module; struct screen_char; @@ -52,4 +55,8 @@ void beep_terminal(struct terminal *term); extern struct module terminal_screen_module; +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/terminal/tab.h b/src/terminal/tab.h index 1ee1554b..2f2679ed 100644 --- a/src/terminal/tab.h +++ b/src/terminal/tab.h @@ -4,6 +4,10 @@ #include "terminal/terminal.h" #include "terminal/window.h" +#ifdef __cplusplus +extern "C" { +#endif + struct session; struct uri; @@ -37,4 +41,8 @@ void move_current_tab(struct session *ses, int direction); #define foreachback_tab(tab, terminal) \ foreachback (tab, terminal) if (tab->type == WINDOW_TAB) +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/terminal/terminal.h b/src/terminal/terminal.h index 1dddfdb3..16548254 100644 --- a/src/terminal/terminal.h +++ b/src/terminal/terminal.h @@ -5,6 +5,10 @@ #include "terminal/event.h" #include "util/lists.h" +#ifdef __cplusplus +extern "C" { +#endif + struct module; struct option; struct terminal_screen; @@ -235,4 +239,8 @@ struct terminal *attach_terminal(int in, int out, int ctl, void *info, int len); extern struct module terminal_module; +#ifdef __cplusplus +} +#endif + #endif /* EL__TERMINAL_TERMINAL_H */ diff --git a/src/terminal/terminfo.h b/src/terminal/terminfo.h index ccf427a8..afbba0c0 100644 --- a/src/terminal/terminfo.h +++ b/src/terminal/terminfo.h @@ -1,6 +1,10 @@ #ifndef EL__TERMINAL_TERMINFO_H #define EL__TERMINAL_TERMINFO_H +#ifdef __cplusplus +extern "C" { +#endif + int terminfo_setupterm(char *term, int fildes); char *terminfo_clear_screen(void); char *terminfo_set_bold(int arg); @@ -10,4 +14,9 @@ char *terminfo_set_foreground(int arg); char *terminfo_set_background(int arg); int terminfo_max_colors(void); char *terminfo_cursor_address(int y, int x); + +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/terminal/window.c b/src/terminal/window.c index f64c6dde..02b2ba06 100644 --- a/src/terminal/window.c +++ b/src/terminal/window.c @@ -220,7 +220,7 @@ set_dlg_window_ptr(struct dialog_data *dlg_data, struct window *window, int x, i set_window_ptr(window, x, y); } -#if CONFIG_SCRIPTING_SPIDERMONKEY +#ifdef CONFIG_SCRIPTING_SPIDERMONKEY /** Check whether keypress events would be directed to @a win. */ int would_window_receive_keypresses(const struct window *win) diff --git a/src/terminal/window.h b/src/terminal/window.h index 14651a81..ce6a666c 100644 --- a/src/terminal/window.h +++ b/src/terminal/window.h @@ -3,6 +3,10 @@ #include "util/lists.h" +#ifdef __cplusplus +extern "C" { +#endif + struct dialog_data; struct term_event; struct terminal; @@ -100,8 +104,12 @@ void assert_window_stacking(struct terminal *); #define assert_window_stacking(t) ((void) (t)) #endif -#if CONFIG_SCRIPTING_SPIDERMONKEY +#ifdef CONFIG_SCRIPTING_SPIDERMONKEY int would_window_receive_keypresses(const struct window *); #endif +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/util/base64.h b/src/util/base64.h index 2bdf0e42..9e3e71bf 100644 --- a/src/util/base64.h +++ b/src/util/base64.h @@ -1,10 +1,18 @@ #ifndef EL__UTIL_BASE64_H #define EL__UTIL_BASE64_H +#ifdef __cplusplus +extern "C" { +#endif + unsigned char *base64_encode(unsigned char *); unsigned char *base64_decode(unsigned char *); unsigned char *base64_encode_bin(unsigned char *, int, int *); unsigned char *base64_decode_bin(unsigned char *, int, int *); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/util/bitfield.h b/src/util/bitfield.h index 53086104..31fbe26f 100644 --- a/src/util/bitfield.h +++ b/src/util/bitfield.h @@ -2,9 +2,12 @@ #define EL__UTIL_BITFIELD_H #include - #include "util/memory.h" +#ifdef __cplusplus +extern "C" { +#endif + /* Bitfield operations: */ /** A vector of bits. The size is fixed at initialization time. */ @@ -161,4 +164,8 @@ bitfield_is_cleared(struct bitfield *bitfield) return 1; } +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/util/box.h b/src/util/box.h index 854424f2..050a9ab3 100644 --- a/src/util/box.h +++ b/src/util/box.h @@ -1,6 +1,10 @@ #ifndef EL__UTIL_BOX_H #define EL__UTIL_BOX_H +#ifdef __cplusplus +extern "C" { +#endif + /** A rectangular part of a drawing surface, such as the screen. */ struct el_box { int x; @@ -62,5 +66,8 @@ copy_box(struct el_box *dst, struct el_box *src) #define dbg_show_box(box) DBG("x=%i y=%i width=%i height=%i", (box)->x, (box)->y, (box)->width, (box)->height) #define dbg_show_xy(x_, y_) DBG("x=%i y=%i", x_, y_) +#ifdef __cplusplus +} +#endif #endif diff --git a/src/util/color.h b/src/util/color.h index 52f7353c..9ebfe2bc 100644 --- a/src/util/color.h +++ b/src/util/color.h @@ -1,6 +1,10 @@ #ifndef EL__UTIL_COLOR_H #define EL__UTIL_COLOR_H +#ifdef __cplusplus +extern "C" { +#endif + typedef uint32_t color_T; struct color_pair { @@ -29,4 +33,8 @@ void init_colors_lookup(void); void free_colors_lookup(void); /** @} */ +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/util/conv.h b/src/util/conv.h index 31831463..5c243c10 100644 --- a/src/util/conv.h +++ b/src/util/conv.h @@ -4,6 +4,10 @@ #include "util/string.h" #include "util/time.h" /* timeval_T types */ +#ifdef __cplusplus +extern "C" { +#endif + static inline int is_safe_in_shell(unsigned char c) { @@ -224,4 +228,8 @@ void sanitize_title(unsigned char *title); * It trims starting/ending spaces. */ int sanitize_url(unsigned char *url); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/util/env.h b/src/util/env.h index 4b40be89..bb49fa19 100644 --- a/src/util/env.h +++ b/src/util/env.h @@ -1,7 +1,14 @@ #ifndef EL__UTIL_ENV_H #define EL__UTIL_ENV_H +#ifdef __cplusplus +extern "C" { +#endif int env_set(unsigned char *name, unsigned char *value, int len); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/util/error.h b/src/util/error.h index 0a8867f1..4db5de3e 100644 --- a/src/util/error.h +++ b/src/util/error.h @@ -9,6 +9,10 @@ #ifndef EL__UTIL_ERROR_H #define EL__UTIL_ERROR_H +#ifdef __cplusplus +extern "C" { +#endif + /* This errfile thing is needed, as we don't have var-arg macros in standart, * only as gcc extension :(. */ extern int errline; @@ -224,6 +228,9 @@ void do_not_optimize_here(void *x); #define do_not_optimize_here_gcc_3_3(x) #endif +#ifdef __cplusplus +} +#endif /** This function dumps backtrace (or whatever similar it founds on the stack) * nicely formatted and with symbols resolved to @a f. When @a trouble is set, @@ -235,7 +242,17 @@ void do_not_optimize_here(void *x); * if it is available on yours. */ #ifdef CONFIG_BACKTRACE #include + +#ifdef __cplusplus +extern "C" { +#endif + void dump_backtrace(FILE *f, int trouble); + +#ifdef __cplusplus +} +#endif + #endif /** This is needed for providing info about features when dumping core */ diff --git a/src/util/fastfind.h b/src/util/fastfind.h index b0142782..6cde7435 100644 --- a/src/util/fastfind.h +++ b/src/util/fastfind.h @@ -1,6 +1,10 @@ #ifndef EL__UTIL_FASTFIND_H #define EL__UTIL_FASTFIND_H +#ifdef __cplusplus +extern "C" { +#endif + /** Whether to use these routines or not. */ #ifndef CONFIG_SMALL #define USE_FASTFIND 1 @@ -61,4 +65,8 @@ void fastfind_done(struct fastfind_index *index); #endif +#ifdef __cplusplus +} +#endif + #endif /* EL__UTIL_FASTFIND_H */ diff --git a/src/util/file.h b/src/util/file.h index b8ffa082..b93ea76c 100644 --- a/src/util/file.h +++ b/src/util/file.h @@ -7,6 +7,10 @@ #include "util/conv.h" #include "util/string.h" +#ifdef __cplusplus +extern "C" { +#endif + /** Data read about an entry in a directory. * The strings pointed to by this structure are in the system * charset (i.e. LC_CTYPE) and must be freed with mem_free(). */ @@ -260,5 +264,9 @@ stat_date(struct string *string, struct stat *stp) add_to_string(string, " "); } +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/util/hash.h b/src/util/hash.h index fd306a77..45225f4c 100644 --- a/src/util/hash.h +++ b/src/util/hash.h @@ -3,6 +3,10 @@ #include "util/lists.h" +#ifdef __cplusplus +extern "C" { +#endif + /** This should be hopefully always 32bit at least. I'm not sure what will * happen when this will be of other length, but it should still work ok. * --pasky */ @@ -36,4 +40,8 @@ void del_hash_item(struct hash *hash, struct hash_item *item); for (iterator = 0; iterator < (1 << (hash_table).width); iterator++) \ foreach (item, (hash_table).hash[iterator]) +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/util/lists.h b/src/util/lists.h index b577c9fc..67e423e6 100644 --- a/src/util/lists.h +++ b/src/util/lists.h @@ -3,6 +3,10 @@ #include "util/error.h" /* do_not_optimize_here() */ +#ifdef __cplusplus +extern "C" { +#endif + /* BEWARE! You MAY NOT use ternary operator as parameter to there functions, * because they are likely to take & of the parameter. Worst of all, it will * work with gcc. But nowhere else (at least not w/ tcc). */ @@ -237,5 +241,8 @@ list_size(struct list_head *list) } \ } while (0) +#ifdef __cplusplus +} +#endif #endif /* EL__UTIL_LISTS_H */ diff --git a/src/util/math.h b/src/util/math.h index 0d5c0f3a..00c4f478 100644 --- a/src/util/math.h +++ b/src/util/math.h @@ -1,6 +1,9 @@ #ifndef EL__UTIL_MATH_H #define EL__UTIL_MATH_H +#ifdef __cplusplus +extern "C" { +#endif /* It's evil to include this directly, elinks.h includes it for you * at the right time. */ @@ -74,4 +77,8 @@ int_bounds(register int *what, register int lower_limit, (b) = (swap_register_); \ } while (0) +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/util/md5.h b/src/util/md5.h index f23caf8b..61e371a4 100644 --- a/src/util/md5.h +++ b/src/util/md5.h @@ -1,6 +1,7 @@ #ifndef EL__UTIL_MD5_H #define EL__UTIL_MD5_H + /* Optionally MD5 support can depend on external implementation when linking * against a SSL library that supports it. */ #if defined(CONFIG_OWN_LIBC) @@ -13,6 +14,10 @@ #define CONFIG_MD5 1 #endif +#ifdef __cplusplus +extern "C" { +#endif + /* GNU TLS doesn't define this */ #ifndef MD5_DIGEST_LENGTH #define MD5_DIGEST_LENGTH 16 @@ -55,4 +60,8 @@ typedef struct md5_context MD5_CTX; /** @} */ #endif /* CONFIG_MD5 */ +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/util/memdebug.h b/src/util/memdebug.h index bcccd41a..553a1f1f 100644 --- a/src/util/memdebug.h +++ b/src/util/memdebug.h @@ -1,6 +1,10 @@ #ifndef EL__UTIL_MEMDEBUG_H #define EL__UTIL_MEMDEBUG_H +#ifdef __cplusplus +extern "C" { +#endif + #ifdef DEBUG_MEMLEAK /* TODO: Another file? */ @@ -24,4 +28,8 @@ void check_memory_leaks(void); #define set_mem_comment(p, c, l) #endif /* DEBUG_MEMLEAK */ +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/util/memlist.h b/src/util/memlist.h index 5fe34ba1..0c1dd785 100644 --- a/src/util/memlist.h +++ b/src/util/memlist.h @@ -1,6 +1,10 @@ #ifndef EL__UTIL_MEMLIST_H #define EL__UTIL_MEMLIST_H +#ifdef __cplusplus +extern "C" { +#endif + struct memory_list { int n; void *p[1]; @@ -30,4 +34,8 @@ void add_one_to_ml(struct memory_list **ml, void *p); void freeml(struct memory_list *); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/util/memory.h b/src/util/memory.h index 5b531f5e..e41eee1b 100644 --- a/src/util/memory.h +++ b/src/util/memory.h @@ -20,6 +20,10 @@ #include #include +#ifdef __cplusplus +extern "C" { +#endif + #ifdef HAVE_MMAP void *mem_mmap_alloc(size_t size); void mem_mmap_free(void *p, size_t size); @@ -191,4 +195,8 @@ intdup__( return p; } +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/util/profile.h b/src/util/profile.h index 4570e9b0..edc6aa4d 100644 --- a/src/util/profile.h +++ b/src/util/profile.h @@ -11,6 +11,10 @@ #ifdef CONFIG_DEBUG #include +#ifdef __cplusplus +extern "C" { +#endif + /** @c CLK_DECL(n) declares an array of @a n clock_t to be used by * CLK_* macros. Must occur before any CLK_* macros call. */ #define CLK_DECL(n) clock_t clk_start[n], clk_end[n], clk_diff[n]; int clk_start_line[n], clk_stop_line[n] @@ -37,6 +41,10 @@ #define CLK_STA() CLK_DECL(1); CLK_START(0) #define CLK_STO() CLK_STOP(0); CLK_DUMP(0) +#ifdef __cplusplus +} +#endif + #else /* Dummy macros. */ #define CLK_DECL(n) @@ -47,4 +55,5 @@ #define CLK_STO() #endif + #endif diff --git a/src/util/random.h b/src/util/random.h index bd4bb49e..65da34d9 100644 --- a/src/util/random.h +++ b/src/util/random.h @@ -4,8 +4,16 @@ #ifndef EL__UTIL_RANDOM_H #define EL__UTIL_RANDOM_H +#ifdef __cplusplus +extern "C" { +#endif + void seed_rand_once(void); void random_nonce(unsigned char buf[], size_t size); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/util/scanner.h b/src/util/scanner.h index 1af37d60..51fa8fcd 100644 --- a/src/util/scanner.h +++ b/src/util/scanner.h @@ -4,6 +4,10 @@ #include "util/error.h" #include "util/string.h" +#ifdef __cplusplus +extern "C" { +#endif + /* Define if you want a talking scanner */ /* #define DEBUG_SCANNER */ @@ -260,4 +264,8 @@ end_token_scanning(struct scanner *scanner, struct scanner_token *end) return get_scanner_token(scanner); } +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/util/secsave.h b/src/util/secsave.h index e1e38305..d606c641 100644 --- a/src/util/secsave.h +++ b/src/util/secsave.h @@ -7,6 +7,10 @@ #include #include /* mode_t */ +#ifdef __cplusplus +extern "C" { +#endif + struct terminal; enum secsave_errno { @@ -45,4 +49,8 @@ int secure_fprintf(struct secure_save_info *, const char *, ...); unsigned char *secsave_strerror(enum secsave_errno, struct terminal *); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/util/sha1.h b/src/util/sha1.h index 9948a3a7..f1de5ad0 100644 --- a/src/util/sha1.h +++ b/src/util/sha1.h @@ -44,6 +44,11 @@ #define CONFIG_SHA1 1 #endif +#ifdef __cplusplus +extern "C" { +#endif + + #ifndef SHA_DIGEST_LENGTH #define SHA_DIGEST_LENGTH 20 #endif @@ -78,4 +83,8 @@ typedef struct sha1_context SHA_CTX; #endif /* CONFIG_SHA1 */ +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/util/snprintf.h b/src/util/snprintf.h index de222453..116160cd 100644 --- a/src/util/snprintf.h +++ b/src/util/snprintf.h @@ -9,6 +9,10 @@ #include +#ifdef __cplusplus +extern "C" { +#endif + /* XXX: This is not quite the best place for it, perhaps. But do we have * a better one now? --pasky */ #ifndef va_copy @@ -56,6 +60,9 @@ int elinks_vasprintf(char **ptr, const char *fmt, va_list ap); int elinks_asprintf(char **ptr, const char *fmt, ...); #endif +#ifdef __cplusplus +} +#endif /* These are wrappers for (v)asprintf() which return the strings allocated by * ELinks' own memory allocation routines, thus it is usable in the context of @@ -68,6 +75,10 @@ int elinks_asprintf(char **ptr, const char *fmt, ...); #include #include "util/string.h" +#ifdef __cplusplus +extern "C" { +#endif + int vasprintf(char **ptr, const char *fmt, va_list ap); static inline unsigned char * @@ -89,5 +100,8 @@ vasprintfa(const char *fmt, va_list ap) { unsigned char *asprintfa(const char *fmt, ...); +#ifdef __cplusplus +} +#endif #endif diff --git a/src/util/string.h b/src/util/string.h index 509453da..4f3cef53 100644 --- a/src/util/string.h +++ b/src/util/string.h @@ -1,6 +1,7 @@ #ifndef EL__UTIL_STRING_H #define EL__UTIL_STRING_H + /* To these two functions, same remark applies as to copy_string() or * straconcat(). */ @@ -13,6 +14,9 @@ #include "util/memdebug.h" #include "util/memory.h" +#ifdef __cplusplus +extern "C" { +#endif #ifndef DEBUG_MEMLEAK @@ -297,4 +301,8 @@ void free_string_list(LIST_OF(struct string_list_item) *list); /** Allocated copy if not NULL or returns NULL. */ #define null_or_stracpy(str) ((str) ? stracpy(str) : NULL) +#ifdef __cplusplus +} +#endif + #endif /* EL__UTIL_STRING_H */ diff --git a/src/util/test.h b/src/util/test.h index cdb1b403..2aa374d4 100644 --- a/src/util/test.h +++ b/src/util/test.h @@ -5,6 +5,10 @@ #include +#ifdef __cplusplus +extern "C" { +#endif + static inline void #if (__GNUC__ == 2 && __GNUC_MINOR__ >= 5) || __GNUC__ > 2 __attribute__((noreturn)) @@ -50,4 +54,8 @@ get_test_opt(char **argref, const char *name, int *argi, int argc, char *argv[], return 1; } +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/util/time.h b/src/util/time.h index 06e88e26..d2653aa8 100644 --- a/src/util/time.h +++ b/src/util/time.h @@ -11,6 +11,10 @@ #include #endif +#ifdef __cplusplus +extern "C" { +#endif + typedef long milliseconds_T; #define MILLISECONDS_MAX ((milliseconds_T) (LONG_MAX / 1000L)) #define ms_max(a, b) ((a) < (b) ? (b) : (a)) @@ -56,4 +60,8 @@ int timeval_div_off_t(off_t n, timeval_T *t); /** @relates timeval_T */ #define timeval_copy(dst, src) copy_struct(dst, src) +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/viewer/action.h b/src/viewer/action.h index 54977d42..e3a95d27 100644 --- a/src/viewer/action.h +++ b/src/viewer/action.h @@ -3,6 +3,10 @@ #include "config/kbdbind.h" +#ifdef __cplusplus +extern "C" { +#endif + struct session; enum frame_event_status { @@ -19,4 +23,8 @@ enum frame_event_status { enum frame_event_status do_action(struct session *ses, enum main_action action_id, int verbose); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/viewer/dump/dump-color-mode.h b/src/viewer/dump/dump-color-mode.h index c0c472db..7d4d54f1 100644 --- a/src/viewer/dump/dump-color-mode.h +++ b/src/viewer/dump/dump-color-mode.h @@ -22,6 +22,8 @@ * - DUMP_COLOR_MODE_TRUE */ + + #define DUMP_FUNCTION_SPECIALIZED DUMP_FUNCTION_UNIBYTE #include "dump-specialized.h" #undef DUMP_FUNCTION_SPECIALIZED @@ -34,6 +36,11 @@ # undef DUMP_CHARSET_UTF8 #endif /* CONFIG_UTF8 */ + +#ifdef __cplusplus +extern "C" { +#endif + static int DUMP_FUNCTION_COLOR(struct document *document, struct dump_output *out) { @@ -44,3 +51,7 @@ DUMP_FUNCTION_COLOR(struct document *document, struct dump_output *out) return DUMP_FUNCTION_UNIBYTE(document, out); } + +#ifdef __cplusplus +} +#endif diff --git a/src/viewer/dump/dump-specialized.h b/src/viewer/dump/dump-specialized.h index cf0baa38..668542a6 100644 --- a/src/viewer/dump/dump-specialized.h +++ b/src/viewer/dump/dump-specialized.h @@ -23,6 +23,10 @@ * - DUMP_CHARSET_UTF8 */ +#ifdef __cplusplus +extern "C" { +#endif + static int DUMP_FUNCTION_SPECIALIZED(struct document *document, struct dump_output *out) { @@ -180,3 +184,7 @@ DUMP_FUNCTION_SPECIALIZED(struct document *document, struct dump_output *out) return 0; } + +#ifdef __cplusplus +} +#endif diff --git a/src/viewer/dump/dump.c b/src/viewer/dump/dump.c index c3f1fa32..2a04dc24 100644 --- a/src/viewer/dump/dump.c +++ b/src/viewer/dump/dump.c @@ -408,6 +408,7 @@ dump_formatted(int fd, struct download *download, struct cache_entry *cached) o.plain = 0; o.frames = 0; o.links_numbering = get_opt_bool("document.dump.numbering", NULL); + o.dump = 1; init_vs(&vs, cached->uri, -1); diff --git a/src/viewer/dump/dump.h b/src/viewer/dump/dump.h index cf60acfe..85ade6cc 100644 --- a/src/viewer/dump/dump.h +++ b/src/viewer/dump/dump.h @@ -4,6 +4,10 @@ #include "util/lists.h" +#ifdef __cplusplus +extern "C" { +#endif + struct string; struct document; @@ -14,4 +18,8 @@ add_document_to_string(struct string *string, struct document *document); int dump_to_file(struct document *, int); void dump_next(LIST_OF(struct string_list_item) *); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/viewer/text/draw.h b/src/viewer/text/draw.h index a8009c38..a286475e 100644 --- a/src/viewer/text/draw.h +++ b/src/viewer/text/draw.h @@ -2,6 +2,10 @@ #ifndef EL__VIEWER_TEXT_DRAW_H #define EL__VIEWER_TEXT_DRAW_H +#ifdef __cplusplus +extern "C" { +#endif + struct document_view; struct session; @@ -15,4 +19,8 @@ void draw_formatted(struct session *ses, int rerender); /** Update the document view, including frames and the status messages */ void refresh_view(struct session *ses, struct document_view *doc_view, int frames); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/viewer/text/form.h b/src/viewer/text/form.h index 2281d054..7ea6859f 100644 --- a/src/viewer/text/form.h +++ b/src/viewer/text/form.h @@ -6,6 +6,10 @@ #include "util/lists.h" /* LIST_HEAD */ #include "viewer/action.h" +#ifdef __cplusplus +extern "C" { +#endif + struct document; struct document_view; struct link; @@ -130,4 +134,8 @@ void do_reset_form(struct document_view *doc_view, struct form *form); void link_form_menu(struct session *ses); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/viewer/text/link.h b/src/viewer/text/link.h index 9a88bb99..50ce4a11 100644 --- a/src/viewer/text/link.h +++ b/src/viewer/text/link.h @@ -4,6 +4,10 @@ #include "viewer/action.h" +#ifdef __cplusplus +extern "C" { +#endif + struct document; struct document_view; struct link; @@ -61,4 +65,8 @@ enum frame_event_status try_document_key(struct session *ses, struct uri *get_link_uri(struct session *ses, struct document_view *doc_view, struct link *link); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/viewer/text/marks.h b/src/viewer/text/marks.h index 17185248..9c8397d8 100644 --- a/src/viewer/text/marks.h +++ b/src/viewer/text/marks.h @@ -2,6 +2,10 @@ #ifndef EL__VIEWER_TEXT_MARKS_H #define EL__VIEWER_TEXT_MARKS_H +#ifdef __cplusplus +extern "C" { +#endif + struct module; struct view_state; @@ -10,4 +14,8 @@ void set_mark(unsigned char mark, struct view_state *vs); extern struct module viewer_marks_module; +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/viewer/text/search.c b/src/viewer/text/search.c index af6986ea..ac9ed220 100644 --- a/src/viewer/text/search.c +++ b/src/viewer/text/search.c @@ -982,7 +982,8 @@ get_searched_all(struct session *ses, struct document_view *doc_view, struct poi if (*pt == NULL) return FIND_ERROR_NOT_FOUND; - return move_search_do(ses, doc_view, 0); + move_search_do(ses, doc_view, 0); + return FIND_ERROR_NONE; } static enum find_error @@ -1093,6 +1094,10 @@ static int find_next_link_in_search(struct document_view *doc_view, int direction) { int utf8 = 0; + struct point *pt = NULL; + struct link *link; + int len; + #ifdef CONFIG_UTF8 utf8 = doc_view->document->options.utf8; #endif @@ -1114,10 +1119,6 @@ find_next_link_in_search(struct document_view *doc_view, int direction) while (doc_view->vs->current_link != -1 && next_link_in_view(doc_view, doc_view->vs->current_link + direction, direction)) { - struct point *pt = NULL; - struct link *link; - int len; - nt: link = &doc_view->document->links[doc_view->vs->current_link]; get_searched(doc_view, &pt, &len, utf8); diff --git a/src/viewer/text/search.h b/src/viewer/text/search.h index 0839fbea..54d8327d 100644 --- a/src/viewer/text/search.h +++ b/src/viewer/text/search.h @@ -6,6 +6,10 @@ #include "document/view.h" #include "viewer/action.h" +#ifdef __cplusplus +extern "C" { +#endif + struct module; struct session; struct terminal; @@ -29,4 +33,8 @@ static inline int has_search_word(struct document_view *doc_view) && (*doc_view->search_word)[0]); } +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/viewer/text/textarea.h b/src/viewer/text/textarea.h index 80c8773f..c70faf11 100644 --- a/src/viewer/text/textarea.h +++ b/src/viewer/text/textarea.h @@ -7,6 +7,10 @@ #include "viewer/action.h" #include "viewer/text/form.h" +#ifdef __cplusplus +extern "C" { +#endif + struct document_view; struct el_form_control; struct link; @@ -47,4 +51,8 @@ enum frame_event_status textarea_op_enter(struct form_state *fs, struct el_form_ void set_textarea(struct document_view *doc_view, int direction); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/viewer/text/view.h b/src/viewer/text/view.h index 5934b15b..ad3b5a09 100644 --- a/src/viewer/text/view.h +++ b/src/viewer/text/view.h @@ -5,6 +5,10 @@ #include "config/kbdbind.h" #include "viewer/action.h" +#ifdef __cplusplus +extern "C" { +#endif + struct document_view; struct session; struct term_event; @@ -105,4 +109,8 @@ void open_link_dialog(struct session *ses); /** @} */ +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/viewer/text/vs.h b/src/viewer/text/vs.h index f9a0a417..047d6cc0 100644 --- a/src/viewer/text/vs.h +++ b/src/viewer/text/vs.h @@ -4,6 +4,10 @@ #include "util/lists.h" +#ifdef __cplusplus +extern "C" { +#endif + /* Crossdeps are evil. */ struct document_view; struct form_state; @@ -64,4 +68,8 @@ void check_vs(struct document_view *); void next_frame(struct session *, int); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/viewer/timer.h b/src/viewer/timer.h index ef623871..2b07c12b 100644 --- a/src/viewer/timer.h +++ b/src/viewer/timer.h @@ -1,6 +1,10 @@ #ifndef EL__VIEWER_TIMER_H #define EL__VIEWER_TIMER_H +#ifdef __cplusplus +extern "C" { +#endif + struct module; int get_timer_duration(void); @@ -8,4 +12,8 @@ void reset_timer(void); extern struct module timer_module; +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/viewer/viewer.h b/src/viewer/viewer.h index c32f92e8..90f3924f 100644 --- a/src/viewer/viewer.h +++ b/src/viewer/viewer.h @@ -1,8 +1,16 @@ #ifndef EL__VIEWER_VIEWER_H #define EL__VIEWER_VIEWER_H +#ifdef __cplusplus +extern "C" { +#endif + struct module; extern struct module viewer_module; +#ifdef __cplusplus +} +#endif + #endif From dd704b900a0cd248b11da9c730ec44b707356b49 Mon Sep 17 00:00:00 2001 From: Witold Filipczyk Date: Sun, 11 Oct 2020 15:41:27 +0200 Subject: [PATCH 066/179] [mozjs31] SpiderMonkey updated to mozjs31. TODO: smjs scripting. --- configure.ac | 4 +- src/ecmascript/spidermonkey-shared.c | 20 +- src/ecmascript/spidermonkey-shared.h | 15 +- src/ecmascript/spidermonkey.c | 46 +- src/ecmascript/spidermonkey/document.c | 323 ++-- src/ecmascript/spidermonkey/form.c | 2153 ++++++++++++----------- src/ecmascript/spidermonkey/heartbeat.c | 14 +- src/ecmascript/spidermonkey/heartbeat.h | 2 +- src/ecmascript/spidermonkey/location.c | 101 +- src/ecmascript/spidermonkey/navigator.c | 107 +- src/ecmascript/spidermonkey/unibar.c | 72 +- src/ecmascript/spidermonkey/util.h | 21 +- src/ecmascript/spidermonkey/window.c | 264 ++- 13 files changed, 1592 insertions(+), 1550 deletions(-) diff --git a/configure.ac b/configure.ac index e1b5dd44..d832f874 100644 --- a/configure.ac +++ b/configure.ac @@ -612,11 +612,11 @@ case "$with_spidermonkey" in ;; esac -for package in mozjs-24; do +for package in mozjs-31; do if test -n "$CONFIG_SPIDERMONKEY"; then break else - AC_MSG_CHECKING([for SpiderMonkey (mozjs-24) in pkg-config $package]) + AC_MSG_CHECKING([for SpiderMonkey (mozjs-31) in pkg-config $package]) if $PKG_CONFIG --cflags --libs $package > /dev/null 2>&AS_MESSAGE_LOG_FD; then SPIDERMONKEY_LIBS="$($PKG_CONFIG --libs $package)" SPIDERMONKEY_CFLAGS="$($PKG_CONFIG --cflags $package)" diff --git a/src/ecmascript/spidermonkey-shared.c b/src/ecmascript/spidermonkey-shared.c index d23922dd..3793865b 100644 --- a/src/ecmascript/spidermonkey-shared.c +++ b/src/ecmascript/spidermonkey-shared.c @@ -44,6 +44,10 @@ spidermonkey_runtime_addref(void) assert(spidermonkey_empty_context == NULL); if_assert_failed return 0; + if (!JS_Init()) { + return 0; + } + spidermonkey_runtime = JS_NewRuntime(4L * 1024L * 1024L, JS_USE_HELPER_THREADS); if (!spidermonkey_runtime) return 0; @@ -92,16 +96,17 @@ spidermonkey_runtime_release(void) /** An ELinks-specific replacement for JS_DefineFunctions(). * * @relates spidermonkeyFunctionSpec */ -JSBool +bool spidermonkey_DefineFunctions(JSContext *cx, JSObject *obj, const spidermonkeyFunctionSpec *fs) { + JS::RootedObject hobj(cx, obj); for (; fs->name; fs++) { - if (!JS_DefineFunction(cx, obj, fs->name, fs->call, + if (!JS_DefineFunction(cx, hobj, fs->name, fs->call, fs->nargs, 0)) - return JS_FALSE; + return false; } - return JS_TRUE; + return true; } /** An ELinks-specific replacement for JS_InitClass(). @@ -116,7 +121,9 @@ spidermonkey_InitClass(JSContext *cx, JSObject *obj, JSPropertySpec *static_ps, const spidermonkeyFunctionSpec *static_fs) { - JSObject *proto = JS_InitClass(cx, obj, parent_proto, clasp, + JS::RootedObject hobj(cx, obj); + JS::RootedObject r_parent_proto(cx, parent_proto); + JSObject *proto = JS_InitClass(cx, hobj, r_parent_proto, clasp, constructor, nargs, ps, NULL, static_ps, NULL); @@ -129,7 +136,8 @@ spidermonkey_InitClass(JSContext *cx, JSObject *obj, } if (static_fs) { - JSObject *cons_obj = JS_GetConstructor(cx, proto); + JS::RootedObject r_proto(cx, proto); + JSObject *cons_obj = JS_GetConstructor(cx, r_proto); if (cons_obj == NULL) return NULL; diff --git a/src/ecmascript/spidermonkey-shared.h b/src/ecmascript/spidermonkey-shared.h index 74e709ad..84174f6e 100644 --- a/src/ecmascript/spidermonkey-shared.h +++ b/src/ecmascript/spidermonkey-shared.h @@ -43,7 +43,7 @@ typedef struct spidermonkeyFunctionSpec { /* ELinks does not use "flags" and "extra" so omit them here. */ } spidermonkeyFunctionSpec; -JSBool spidermonkey_DefineFunctions(JSContext *cx, JSObject *obj, +bool spidermonkey_DefineFunctions(JSContext *cx, JSObject *obj, const spidermonkeyFunctionSpec *fs); JSObject *spidermonkey_InitClass(JSContext *cx, JSObject *obj, JSObject *parent_proto, JSClass *clasp, @@ -68,23 +68,20 @@ undef_to_jsval(JSContext *ctx, jsval *vp) static inline unsigned char * jsval_to_string(JSContext *ctx, jsval *vp) { - jsval val; + JS::RootedValue r_vp(ctx, *vp); + JSString *str = JS::ToString(ctx, r_vp); - if (JS_ConvertValue(ctx, *vp, JSTYPE_STRING, &val) == JS_FALSE) { - return ""; - } - - return empty_string_or_(JS_EncodeString(ctx, JS_ValueToString(ctx, val))); + return empty_string_or_(JS_EncodeString(ctx, str)); } static inline unsigned char * jsid_to_string(JSContext *ctx, jsid *id) { - jsval v; + JS::RootedValue v(ctx); /* TODO: check returned value */ JS_IdToValue(ctx, *id, &v); - return jsval_to_string(ctx, &v); + return jsval_to_string(ctx, v.address()); } #define ELINKS_CAST_PROP_PARAMS JSObject *obj = (hobj.get()); \ diff --git a/src/ecmascript/spidermonkey.c b/src/ecmascript/spidermonkey.c index 6555bbce..e6a75ba3 100644 --- a/src/ecmascript/spidermonkey.c +++ b/src/ecmascript/spidermonkey.c @@ -50,8 +50,6 @@ #include "viewer/text/link.h" #include "viewer/text/vs.h" -using namespace JS; - /*** Global methods */ @@ -143,11 +141,10 @@ spidermonkey_get_interpreter(struct ecmascript_interpreter *interpreter) interpreter->backend_data = ctx; JSAutoRequest ar(ctx); JS_SetContextPrivate(ctx, interpreter); - JS_SetOptions(ctx, JSOPTION_VAROBJFIX | JS_METHODJIT); + //JS_SetOptions(ctx, JSOPTION_VAROBJFIX | JS_METHODJIT); JS_SetErrorReporter(ctx, error_reporter); - JS_SetOperationCallback(ctx, heartbeat_callback); - RootedObject window_obj(ctx); - window_obj = JS_NewGlobalObject(ctx, &window_class, NULL); + JS_SetInterruptCallback(spidermonkey_runtime, heartbeat_callback); + JS::RootedObject window_obj(ctx, JS_NewGlobalObject(ctx, &window_class, NULL, JS::DontFireOnNewGlobalHook)); if (window_obj) { ac = new JSAutoCompartment(ctx, window_obj); @@ -204,7 +201,7 @@ spidermonkey_get_interpreter(struct ecmascript_interpreter *interpreter) goto release_and_fail; } - menubar_obj = JS_InitClass(ctx, window_obj, NULL, + menubar_obj = JS_InitClass(ctx, window_obj, JS::NullPtr(), &menubar_class, NULL, 0, unibar_props, NULL, NULL, NULL); @@ -213,7 +210,7 @@ spidermonkey_get_interpreter(struct ecmascript_interpreter *interpreter) } JS_SetPrivate(menubar_obj, "t"); /* to @menubar_class */ - statusbar_obj = JS_InitClass(ctx, window_obj, NULL, + statusbar_obj = JS_InitClass(ctx, window_obj, JS::NullPtr(), &statusbar_class, NULL, 0, unibar_props, NULL, NULL, NULL); @@ -222,7 +219,7 @@ spidermonkey_get_interpreter(struct ecmascript_interpreter *interpreter) } JS_SetPrivate(statusbar_obj, "s"); /* to @statusbar_class */ - navigator_obj = JS_InitClass(ctx, window_obj, NULL, + navigator_obj = JS_InitClass(ctx, window_obj, JS::NullPtr(), &navigator_class, NULL, 0, navigator_props, NULL, NULL, NULL); @@ -266,8 +263,10 @@ spidermonkey_eval(struct ecmascript_interpreter *interpreter, interpreter->heartbeat = add_heartbeat(interpreter); interpreter->ret = ret; - JS_EvaluateScript(ctx, JS_GetGlobalForScopeChain(ctx), - code->source, code->length, "", 0, &rval); + JS::RootedObject cg(ctx, JS::CurrentGlobalOrNull(ctx)); + JS::RootedValue r_val(ctx, rval); + + JS_EvaluateScript(ctx, cg, code->source, code->length, "", 0, &r_val); done_heartbeat(interpreter->heartbeat); } @@ -276,7 +275,7 @@ unsigned char * spidermonkey_eval_stringback(struct ecmascript_interpreter *interpreter, struct string *code) { - JSBool ret; + bool ret; JSContext *ctx; jsval rval; @@ -286,19 +285,20 @@ spidermonkey_eval_stringback(struct ecmascript_interpreter *interpreter, interpreter->ret = NULL; interpreter->heartbeat = add_heartbeat(interpreter); - ret = JS_EvaluateScript(ctx, JS_GetGlobalForScopeChain(ctx), - code->source, code->length, "", 0, &rval); + JS::RootedObject cg(ctx, JS::CurrentGlobalOrNull(ctx)); + JS::RootedValue r_rval(ctx, rval); + ret = JS_EvaluateScript(ctx, cg, code->source, code->length, "", 0, &r_rval); done_heartbeat(interpreter->heartbeat); - if (ret == JS_FALSE) { + if (ret == false) { return NULL; } - if (JSVAL_IS_VOID(rval) || JSVAL_IS_NULL(rval)) { + if (r_rval.isNullOrUndefined()) { /* Undefined value. */ return NULL; } - return stracpy(jsval_to_string(ctx, &rval)); + return stracpy(JS_EncodeString(ctx, JS::ToString(ctx, r_rval))); } @@ -316,19 +316,23 @@ spidermonkey_eval_boolback(struct ecmascript_interpreter *interpreter, ctx = interpreter->backend_data; interpreter->ret = NULL; - fun = JS_CompileFunction(ctx, JS_GetGlobalForScopeChain(ctx), "", 0, NULL, code->source, - code->length, "", 0); + JS::CompileOptions options(ctx); + JS::RootedObject cg(ctx, JS::CurrentGlobalOrNull(ctx)); + fun = JS_CompileFunction(ctx, cg, "", 0, NULL, code->source, + code->length, options); if (!fun) return -1; interpreter->heartbeat = add_heartbeat(interpreter); - ret = JS_CallFunction(ctx, JS_GetGlobalForScopeChain(ctx), fun, 0, NULL, &rval); + JS::RootedFunction r_fun(ctx, fun); + JS::RootedValue r_val(ctx, rval); + ret = JS_CallFunction(ctx, cg, r_fun, JS::HandleValueArray::empty(), &r_val); done_heartbeat(interpreter->heartbeat); if (ret == 2) { /* onClick="history.back()" */ return 0; } - if (ret == JS_FALSE) { + if (ret == false) { return -1; } if (JSVAL_IS_VOID(rval)) { diff --git a/src/ecmascript/spidermonkey/document.c b/src/ecmascript/spidermonkey/document.c index 72f084eb..e4bc3d8a 100644 --- a/src/ecmascript/spidermonkey/document.c +++ b/src/ecmascript/spidermonkey/document.c @@ -47,7 +47,7 @@ #include "viewer/text/vs.h" -static JSBool document_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); +static bool document_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); /* Each @document_class object must have a @window_class parent. */ JSClass document_class = { @@ -59,25 +59,23 @@ JSClass document_class = { }; #ifdef CONFIG_COOKIES -static JSBool -document_get_property_cookie(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) +static bool +document_get_property_cookie(JSContext *ctx, unsigned int argc, jsval *vp) { - ELINKS_CAST_PROP_PARAMS - - JSObject *parent_win; /* instance of @window_class */ + JS::CallArgs args = CallArgsFromVp(argc, vp); + JS::RootedObject hobj(ctx, &args.thisv().toObject()); + JS::RootedObject parent_win(ctx, JS_GetParent(hobj)); struct view_state *vs; struct string *cookies; - JSClass* classPtr = JS_GetClass(obj); - if (classPtr != &document_class) - return JS_FALSE; - - parent_win = JS_GetParent(obj); assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); - if_assert_failed return JS_FALSE; + if_assert_failed return false; vs = JS_GetInstancePrivate(ctx, parent_win, &window_class, NULL); + if (!vs) { + return false; + } cookies = send_cookies_js(vs->uri); if (cookies) { @@ -85,110 +83,98 @@ document_get_property_cookie(JSContext *ctx, JS::HandleObject hobj, JS::HandleId strncpy(cookiestr, cookies->source, 1023); done_string(cookies); - string_to_jsval(ctx, vp, cookiestr); + args.rval().setString(JS_NewStringCopyZ(ctx, cookiestr)); } else { - string_to_jsval(ctx, vp, ""); + args.rval().setString(JS_NewStringCopyZ(ctx, "")); } - return JS_TRUE; + return true; } -static JSBool -document_set_property_cookie(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp) +static bool +document_set_property_cookie(JSContext *ctx, unsigned int argc, jsval *vp) { - ELINKS_CAST_PROP_PARAMS - - JSObject *parent_win; /* instance of @window_class */ + JS::CallArgs args = CallArgsFromVp(argc, vp); + JS::RootedObject hobj(ctx, &args.thisv().toObject()); + JS::RootedObject parent_win(ctx, JS_GetParent(hobj)); struct view_state *vs; + struct string *cookies; - /* This can be called if @obj if not itself an instance of the - * appropriate class but has one in its prototype chain. Fail - * such calls. */ - if (!JS_InstanceOf(ctx, obj, &document_class, NULL)) - return JS_FALSE; - - parent_win = JS_GetParent(obj); + parent_win = JS_GetParent(hobj); assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); - if_assert_failed return JS_FALSE; + if_assert_failed return false; vs = JS_GetInstancePrivate(ctx, parent_win, &window_class, NULL); - set_cookie(vs->uri, jsval_to_string(ctx, vp)); + if (!vs) { + return false; + } + set_cookie(vs->uri, JS_EncodeString(ctx, args[0].toString())); - return JS_TRUE; + return true; } #endif -static JSBool -document_get_property_location(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) +static bool +document_get_property_location(JSContext *ctx, unsigned int argc, jsval *vp) { - ELINKS_CAST_PROP_PARAMS + JS::CallArgs args = CallArgsFromVp(argc, vp); + JS::RootedObject hobj(ctx, &args.thisv().toObject()); + JS::RootedObject parent_win(ctx, JS_GetParent(hobj)); - JSObject *parent_win; /* instance of @window_class */ - JSClass* classPtr = JS_GetClass(obj); - - if (classPtr != &document_class) - return JS_FALSE; - - parent_win = JS_GetParent(obj); assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); - if_assert_failed return JS_FALSE; + if_assert_failed return false; - JS_GetProperty(ctx, parent_win, "location", vp); + JS_GetProperty(ctx, parent_win, "location", args.rval()); - return JS_TRUE; + return true; } -static JSBool -document_set_property_location(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp) +static bool +document_set_property_location(JSContext *ctx, unsigned int argc, jsval *vp) { - ELINKS_CAST_PROP_PARAMS - - JSObject *parent_win; /* instance of @window_class */ + JS::CallArgs args = CallArgsFromVp(argc, vp); + JS::RootedObject hobj(ctx, &args.thisv().toObject()); + JS::RootedObject parent_win(ctx, JS_GetParent(hobj)); struct view_state *vs; struct document_view *doc_view; - /* This can be called if @obj if not itself an instance of the - * appropriate class but has one in its prototype chain. Fail - * such calls. */ - if (!JS_InstanceOf(ctx, obj, &document_class, NULL)) - return JS_FALSE; - - parent_win = JS_GetParent(obj); assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); - if_assert_failed return JS_FALSE; + if_assert_failed return false; vs = JS_GetInstancePrivate(ctx, parent_win, &window_class, NULL); + if (!vs) { + return false; + } doc_view = vs->doc_view; - location_goto(doc_view, jsval_to_string(ctx, vp)); + location_goto(doc_view, JS_EncodeString(ctx, args[0].toString())); - return JS_TRUE; + return true; } -static JSBool -document_get_property_referrer(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) +static bool +document_get_property_referrer(JSContext *ctx, unsigned int argc, jsval *vp) { - ELINKS_CAST_PROP_PARAMS - - JSObject *parent_win; /* instance of @window_class */ + JS::CallArgs args = CallArgsFromVp(argc, vp); + JS::RootedObject hobj(ctx, &args.thisv().toObject()); + JS::RootedObject parent_win(ctx, JS_GetParent(hobj)); struct view_state *vs; struct document_view *doc_view; struct document *document; struct session *ses; - JSClass* classPtr = JS_GetClass(obj); - if (classPtr != &document_class) - return JS_FALSE; - - parent_win = JS_GetParent(obj); assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); - if_assert_failed return JS_FALSE; + if_assert_failed return false; vs = JS_GetInstancePrivate(ctx, parent_win, &window_class, NULL); + + if (!vs) { + return false; + } doc_view = vs->doc_view; document = doc_view->document; ses = doc_view->session; @@ -196,138 +182,148 @@ document_get_property_referrer(JSContext *ctx, JS::HandleObject hobj, JS::Handle switch (get_opt_int("protocol.http.referer.policy", NULL)) { case REFERER_NONE: /* oh well */ - undef_to_jsval(ctx, vp); + args.rval().setUndefined(); break; case REFERER_FAKE: - string_to_jsval(ctx, vp, get_opt_str("protocol.http.referer.fake", NULL)); + args.rval().setString(JS_NewStringCopyZ(ctx, get_opt_str("protocol.http.referer.fake", NULL))); break; case REFERER_TRUE: /* XXX: Encode as in add_url_to_httset_prop_string(&prop, ) ? --pasky */ if (ses->referrer) { - astring_to_jsval(ctx, vp, get_uri_string(ses->referrer, URI_HTTP_REFERRER)); + unsigned char *str = get_uri_string(ses->referrer, URI_HTTP_REFERRER); + + if (str) { + args.rval().setString(JS_NewStringCopyZ(ctx, str)); + mem_free(str); + } else { + args.rval().setUndefined(); + } } break; case REFERER_SAME_URL: - astring_to_jsval(ctx, vp, get_uri_string(document->uri, URI_HTTP_REFERRER)); + unsigned char *str = get_uri_string(document->uri, URI_HTTP_REFERRER); + + if (str) { + args.rval().setString(JS_NewStringCopyZ(ctx, str)); + mem_free(str); + } else { + args.rval().setUndefined(); + } break; } - return JS_TRUE; + return true; } -static JSBool -document_get_property_title(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) +static bool +document_get_property_title(JSContext *ctx, unsigned int argc, jsval *vp) { - ELINKS_CAST_PROP_PARAMS - - JSObject *parent_win; /* instance of @window_class */ - struct view_state *vs; - struct document_view *doc_view; - struct document *document; - JSClass* classPtr = JS_GetClass(obj); - - if (classPtr != &document_class) - return JS_FALSE; - - parent_win = JS_GetParent(obj); - assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); - if_assert_failed return JS_FALSE; - - vs = JS_GetInstancePrivate(ctx, parent_win, - &window_class, NULL); - doc_view = vs->doc_view; - document = doc_view->document; - string_to_jsval(ctx, vp, document->title); - - return JS_TRUE; -} - -static JSBool -document_set_property_title(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp) -{ - ELINKS_CAST_PROP_PARAMS - - JSObject *parent_win; /* instance of @window_class */ + JS::CallArgs args = CallArgsFromVp(argc, vp); + JS::RootedObject hobj(ctx, &args.thisv().toObject()); + JS::RootedObject parent_win(ctx, JS_GetParent(hobj)); struct view_state *vs; struct document_view *doc_view; struct document *document; - /* This can be called if @obj if not itself an instance of the - * appropriate class but has one in its prototype chain. Fail - * such calls. */ - if (!JS_InstanceOf(ctx, obj, &document_class, NULL)) - return JS_FALSE; - - parent_win = JS_GetParent(obj); assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); - if_assert_failed return JS_FALSE; + if_assert_failed return false; vs = JS_GetInstancePrivate(ctx, parent_win, &window_class, NULL); + if (!vs) { + return false; + } doc_view = vs->doc_view; document = doc_view->document; - mem_free_set(&document->title, stracpy(jsval_to_string(ctx, vp))); + args.rval().setString(JS_NewStringCopyZ(ctx, document->title)); + + return true; +} + +static bool +document_set_property_title(JSContext *ctx, int argc, jsval *vp) +{ + JS::CallArgs args = CallArgsFromVp(argc, vp); + JS::RootedObject hobj(ctx, &args.thisv().toObject()); + JS::RootedObject parent_win(ctx, JS_GetParent(hobj)); + struct view_state *vs; + struct document_view *doc_view; + struct document *document; + + assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); + if_assert_failed return false; + + vs = JS_GetInstancePrivate(ctx, parent_win, + &window_class, NULL); + if (!vs) { + return false; + } + doc_view = vs->doc_view; + document = doc_view->document; + mem_free_set(&document->title, stracpy(JS_EncodeString(ctx, args[0].toString()))); print_screen_status(doc_view->session); - return JS_TRUE; + return true; } -static JSBool -document_get_property_url(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) +static bool +document_get_property_url(JSContext *ctx, unsigned int argc, jsval *vp) { - ELINKS_CAST_PROP_PARAMS - - JSObject *parent_win; /* instance of @window_class */ + JS::CallArgs args = CallArgsFromVp(argc, vp); + JS::RootedObject hobj(ctx, &args.thisv().toObject()); + JS::RootedObject parent_win(ctx, JS_GetParent(hobj)); struct view_state *vs; struct document_view *doc_view; struct document *document; - JSClass* classPtr = JS_GetClass(obj); - if (classPtr != &document_class) - return JS_FALSE; - - parent_win = JS_GetParent(obj); assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); - if_assert_failed return JS_FALSE; + if_assert_failed return false; vs = JS_GetInstancePrivate(ctx, parent_win, &window_class, NULL); + if (!vs) { + return false; + } doc_view = vs->doc_view; document = doc_view->document; - astring_to_jsval(ctx, vp, get_uri_string(document->uri, URI_ORIGINAL)); + unsigned char *str = get_uri_string(document->uri, URI_ORIGINAL); - return JS_TRUE; + if (str) { + args.rval().setString(JS_NewStringCopyZ(ctx, str)); + mem_free(str); + } else { + args.rval().setUndefined(); + } + + return true; } -static JSBool -document_set_property_url(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp) +static bool +document_set_property_url(JSContext *ctx, int argc, jsval *vp) { - ELINKS_CAST_PROP_PARAMS - - JSObject *parent_win; /* instance of @window_class */ + JS::CallArgs args = CallArgsFromVp(argc, vp); + JS::RootedObject hobj(ctx, &args.thisv().toObject()); + JS::RootedObject parent_win(ctx, JS_GetParent(hobj)); struct view_state *vs; struct document_view *doc_view; + struct document *document; - /* This can be called if @obj if not itself an instance of the - * appropriate class but has one in its prototype chain. Fail - * such calls. */ - if (!JS_InstanceOf(ctx, obj, &document_class, NULL)) - return JS_FALSE; - - parent_win = JS_GetParent(obj); assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); - if_assert_failed return JS_FALSE; + if_assert_failed return false; vs = JS_GetInstancePrivate(ctx, parent_win, &window_class, NULL); + if (!vs) { + return false; + } doc_view = vs->doc_view; - location_goto(doc_view, jsval_to_string(ctx, vp)); + location_goto(doc_view, JS_EncodeString(ctx, args[0].toString())); - return JS_TRUE; + return true; } @@ -335,24 +331,24 @@ document_set_property_url(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hi * cookie-module. XXX: Would it work if "cookie" was defined in this array? */ JSPropertySpec document_props[] = { #ifdef CONFIG_COOKIES - { "cookie", 0, JSPROP_ENUMERATE | JSPROP_SHARED, JSOP_WRAPPER(document_get_property_cookie), JSOP_WRAPPER(document_set_property_cookie) }, + JS_PSGS("cookie", document_get_property_cookie, document_set_property_cookie, JSPROP_ENUMERATE), #endif - { "location", 0, JSPROP_ENUMERATE | JSPROP_SHARED, JSOP_WRAPPER(document_get_property_location), JSOP_WRAPPER(document_set_property_location) }, - { "referrer", 0, JSPROP_ENUMERATE | JSPROP_READONLY | JSPROP_SHARED, JSOP_WRAPPER(document_get_property_referrer), JSOP_NULLWRAPPER }, - { "title", 0, JSPROP_ENUMERATE | JSPROP_SHARED, JSOP_WRAPPER(document_get_property_title), JSOP_WRAPPER(document_set_property_title) }, /* TODO: Charset? */ - { "url", 0, JSPROP_ENUMERATE | JSPROP_SHARED, JSOP_WRAPPER(document_get_property_url), JSOP_WRAPPER(document_set_property_url) }, + JS_PSGS("location", document_get_property_location, document_set_property_location, JSPROP_ENUMERATE), + JS_PSG("referrer", document_get_property_referrer, JSPROP_ENUMERATE), + JS_PSGS("title", document_get_property_title, document_set_property_title, JSPROP_ENUMERATE), /* TODO: Charset? */ + JS_PSGS("url", document_get_property_url, document_set_property_url, JSPROP_ENUMERATE), { NULL } }; /* @document_class.getProperty */ -static JSBool +static bool document_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS jsid id = hid.get(); - JSObject *parent_win; /* instance of @window_class */ + JS::RootedObject parent_win(ctx); /* instance of @window_class */ struct view_state *vs; struct document_view *doc_view; struct document *document; @@ -362,11 +358,11 @@ document_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, J JSClass* classPtr = JS_GetClass(obj); if (classPtr != &document_class) - return JS_FALSE; + return false; parent_win = JS_GetParent(obj); assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); - if_assert_failed return JS_FALSE; + if_assert_failed return false; vs = JS_GetInstancePrivate(ctx, parent_win, &window_class, NULL); @@ -382,11 +378,11 @@ document_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, J break; } - return JS_TRUE; + return true; } -static JSBool document_write(JSContext *ctx, unsigned int argc, jsval *rval); -static JSBool document_writeln(JSContext *ctx, unsigned int argc, jsval *rval); +static bool document_write(JSContext *ctx, unsigned int argc, jsval *rval); +static bool document_writeln(JSContext *ctx, unsigned int argc, jsval *rval); const spidermonkeyFunctionSpec document_funcs[] = { { "write", document_write, 1 }, @@ -394,19 +390,19 @@ const spidermonkeyFunctionSpec document_funcs[] = { { NULL } }; -static JSBool +static bool document_write_do(JSContext *ctx, unsigned int argc, jsval *rval, int newline) { jsval val; struct ecmascript_interpreter *interpreter = JS_GetContextPrivate(ctx); struct string *ret = interpreter->ret; - jsval *argv = JS_ARGV(ctx, rval); + JS::CallArgs args = JS::CallArgsFromVp(argc, rval); if (argc >= 1 && ret) { int i = 0; for (; i < argc; ++i) { - unsigned char *code = jsval_to_string(ctx, &argv[i]); + unsigned char *code = jsval_to_string(ctx, args[i].address()); add_to_string(ret, code); } @@ -425,14 +421,13 @@ document_write_do(JSContext *ctx, unsigned int argc, jsval *rval, int newline) set_led_value(interpreter->vs->doc_view->session->status.ecmascript_led, 'J'); #endif - boolean_to_jsval(ctx, &val, 0); - JS_SET_RVAL(ctx, rval, val); + args.rval().setBoolean(false); - return JS_TRUE; + return true; } /* @document_funcs{"write"} */ -static JSBool +static bool document_write(JSContext *ctx, unsigned int argc, jsval *rval) { @@ -440,7 +435,7 @@ document_write(JSContext *ctx, unsigned int argc, jsval *rval) } /* @document_funcs{"writeln"} */ -static JSBool +static bool document_writeln(JSContext *ctx, unsigned int argc, jsval *rval) { return document_write_do(ctx, argc, rval, 1); diff --git a/src/ecmascript/spidermonkey/form.c b/src/ecmascript/spidermonkey/form.c index 64c53ad3..8f8c003a 100644 --- a/src/ecmascript/spidermonkey/form.c +++ b/src/ecmascript/spidermonkey/form.c @@ -49,19 +49,19 @@ //static JSClass form_class; /* defined below */ -static JSBool form_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); -static JSBool form_get_property_action(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); -static JSBool form_set_property_action(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp); -static JSBool form_get_property_elements(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); -static JSBool form_get_property_encoding(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); -static JSBool form_set_property_encoding(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp); -static JSBool form_get_property_length(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); -static JSBool form_get_property_method(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); -static JSBool form_set_property_method(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp); -static JSBool form_get_property_name(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); -static JSBool form_set_property_name(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp); -static JSBool form_get_property_target(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); -static JSBool form_set_property_target(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp); +static bool form_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); +static bool form_get_property_action(JSContext *ctx, unsigned int argc, jsval *vp); +static bool form_set_property_action(JSContext *ctx, unsigned int argc, jsval *vp); +static bool form_get_property_elements(JSContext *ctx, unsigned int argc, jsval *vp); +static bool form_get_property_encoding(JSContext *ctx, unsigned int argc, jsval *vp); +static bool form_set_property_encoding(JSContext *ctx, unsigned int argc, jsval *vp); +static bool form_get_property_length(JSContext *ctx, unsigned int argc, jsval *vp); +static bool form_get_property_method(JSContext *ctx, unsigned int argc, jsval *vp); +static bool form_set_property_method(JSContext *ctx, unsigned int argc, jsval *vp); +static bool form_get_property_name(JSContext *ctx, unsigned int argc, jsval *vp); +static bool form_set_property_name(JSContext *ctx, unsigned int argc, jsval *vp); +static bool form_get_property_target(JSContext *ctx, unsigned int argc, jsval *vp); +static bool form_set_property_target(JSContext *ctx, unsigned int argc, jsval *vp); static void form_finalize(JSFreeOp *op, JSObject *obj); @@ -81,8 +81,8 @@ static JSClass form_class = { * HTMLInputElement. The difference could be spotted only by some clever tricky * JS code, but I hope it doesn't matter anywhere. --pasky */ -static JSBool input_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); -static JSBool input_set_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp); +static bool input_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); +static bool input_set_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, bool strict, JS::MutableHandleValue hvp); static void input_finalize(JSFreeOp *op, JSObject *obj); /* Each @input_class object must have a @form_class parent. */ @@ -118,18 +118,16 @@ enum input_prop { }; static JSString *unicode_to_jsstring(JSContext *ctx, unicode_val_T u); -static unicode_val_T jsval_to_accesskey(JSContext *ctx, jsval *vp); +static unicode_val_T jsval_to_accesskey(JSContext *ctx, JS::MutableHandleValue hvp); static struct form_state *input_get_form_state(JSContext *ctx, JSObject *jsinput); -static JSBool -input_get_property_accessKey(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) +static bool +input_get_property_accessKey(JSContext *ctx, unsigned int argc, jsval *vp) { - ELINKS_CAST_PROP_PARAMS + JS::CallArgs args = CallArgsFromVp(argc, vp); + JS::RootedObject hobj(ctx, &args.thisv().toObject()); - JSObject *parent_form; /* instance of @form_class */ - JSObject *parent_doc; /* instance of @document_class */ - JSObject *parent_win; /* instance of @window_class */ struct view_state *vs; struct document_view *doc_view; struct document *document; @@ -139,30 +137,27 @@ input_get_property_accessKey(JSContext *ctx, JS::HandleObject hobj, JS::HandleId struct link *link = NULL; JSString *keystr; - /* This can be called if @obj if not itself an instance of the - * appropriate class but has one in its prototype chain. Fail - * such calls. */ - if (!JS_InstanceOf(ctx, obj, &input_class, NULL)) - return JS_FALSE; - - parent_form = JS_GetParent(obj); + JS::RootedObject parent_form(ctx, JS_GetParent(hobj)); assert(JS_InstanceOf(ctx, parent_form, &form_class, NULL)); - if_assert_failed return JS_FALSE; + if_assert_failed return false; - parent_doc = JS_GetParent(parent_form); + JS::RootedObject parent_doc(ctx, JS_GetParent(parent_form)); assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); - if_assert_failed return JS_FALSE; + if_assert_failed return false; - parent_win = JS_GetParent(parent_doc); + JS::RootedObject parent_win(ctx, JS_GetParent(parent_doc)); assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); - if_assert_failed return JS_FALSE; + if_assert_failed return false; vs = JS_GetInstancePrivate(ctx, parent_win, &window_class, NULL); + if (!vs) { + return false; + } doc_view = vs->doc_view; document = doc_view->document; - fs = input_get_form_state(ctx, obj); - if (!fs) return JS_FALSE; /* detached */ + fs = input_get_form_state(ctx, hobj); + if (!fs) return false; /* detached */ fc = find_form_control(document, fs); assert(fc); @@ -172,30 +167,30 @@ input_get_property_accessKey(JSContext *ctx, JS::HandleObject hobj, JS::HandleId /* Hiddens have no link. */ if (linknum >= 0) link = &document->links[linknum]; - undef_to_jsval(ctx, vp); - - if (!link) return JS_TRUE; + if (!link) { + args.rval().setUndefined(); + return true; + } if (!link->accesskey) { - *vp = JS_GetEmptyStringValue(ctx); + args.rval().set(JS_GetEmptyStringValue(ctx)); } else { keystr = unicode_to_jsstring(ctx, link->accesskey); - if (keystr) - *vp = STRING_TO_JSVAL(keystr); + if (keystr) { + args.rval().setString(keystr); + } else - return JS_FALSE; + return false; } - return JS_TRUE; + return true; } -static JSBool -input_set_property_accessKey(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp) +static bool +input_set_property_accessKey(JSContext *ctx, unsigned int argc, jsval *vp) { - ELINKS_CAST_PROP_PARAMS + JS::CallArgs args = CallArgsFromVp(argc, vp); + JS::RootedObject hobj(ctx, &args.thisv().toObject()); - JSObject *parent_form; /* instance of @form_class */ - JSObject *parent_doc; /* instance of @document_class */ - JSObject *parent_win; /* instance of @window_class */ struct view_state *vs; struct document_view *doc_view; struct document *document; @@ -205,27 +200,25 @@ input_set_property_accessKey(JSContext *ctx, JS::HandleObject hobj, JS::HandleId struct link *link = NULL; unicode_val_T accesskey; - /* This can be called if @obj if not itself an instance of the - * appropriate class but has one in its prototype chain. Fail - * such calls. */ - if (!JS_InstanceOf(ctx, obj, &input_class, NULL)) - return JS_FALSE; - parent_form = JS_GetParent(obj); + JS::RootedObject parent_form(ctx, JS_GetParent(hobj)); assert(JS_InstanceOf(ctx, parent_form, &form_class, NULL)); - if_assert_failed return JS_FALSE; - parent_doc = JS_GetParent(parent_form); + if_assert_failed return false; + JS::RootedObject parent_doc(ctx, JS_GetParent(parent_form)); assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); - if_assert_failed return JS_FALSE; - parent_win = JS_GetParent(parent_doc); + if_assert_failed return false; + JS::RootedObject parent_win(ctx, JS_GetParent(parent_doc)); assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); - if_assert_failed return JS_FALSE; + if_assert_failed return false; vs = JS_GetInstancePrivate(ctx, parent_win, &window_class, NULL); + if (!vs) { + return false; + } doc_view = vs->doc_view; document = doc_view->document; - fs = input_get_form_state(ctx, obj); - if (!fs) return JS_FALSE; /* detached */ + fs = input_get_form_state(ctx, hobj); + if (!fs) return false; /* detached */ fc = find_form_control(document, fs); assert(fc); @@ -235,544 +228,482 @@ input_set_property_accessKey(JSContext *ctx, JS::HandleObject hobj, JS::HandleId /* Hiddens have no link. */ if (linknum >= 0) link = &document->links[linknum]; - accesskey = jsval_to_accesskey(ctx, vp); + accesskey = jsval_to_accesskey(ctx, args[0]); if (accesskey == UCS_NO_CHAR) - return JS_FALSE; + return false; else if (link) link->accesskey = accesskey; - return JS_TRUE; + return true; } -static JSBool -input_get_property_alt(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) +static bool +input_get_property_alt(JSContext *ctx, unsigned int argc, jsval *vp) { - ELINKS_CAST_PROP_PARAMS + JS::CallArgs args = CallArgsFromVp(argc, vp); + JS::RootedObject hobj(ctx, &args.thisv().toObject()); - JSObject *parent_form; /* instance of @form_class */ - JSObject *parent_doc; /* instance of @document_class */ - JSObject *parent_win; /* instance of @window_class */ struct view_state *vs; struct document_view *doc_view; struct document *document; struct form_state *fs; struct el_form_control *fc; - /* This can be called if @obj if not itself an instance of the - * appropriate class but has one in its prototype chain. Fail - * such calls. */ - if (!JS_InstanceOf(ctx, obj, &input_class, NULL)) - return JS_FALSE; - - parent_form = JS_GetParent(obj); + JS::RootedObject parent_form(ctx, JS_GetParent(hobj)); assert(JS_InstanceOf(ctx, parent_form, &form_class, NULL)); - if_assert_failed return JS_FALSE; + if_assert_failed return false; - parent_doc = JS_GetParent(parent_form); + JS::RootedObject parent_doc(ctx, JS_GetParent(parent_form)); assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); - if_assert_failed return JS_FALSE; + if_assert_failed return false; - parent_win = JS_GetParent(parent_doc); + JS::RootedObject parent_win(ctx, JS_GetParent(parent_doc)); assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); - if_assert_failed return JS_FALSE; + if_assert_failed return false; vs = JS_GetInstancePrivate(ctx, parent_win, &window_class, NULL); + if (!vs) { + return false; + } doc_view = vs->doc_view; document = doc_view->document; - fs = input_get_form_state(ctx, obj); - if (!fs) return JS_FALSE; /* detached */ + fs = input_get_form_state(ctx, hobj); + if (!fs) return false; /* detached */ fc = find_form_control(document, fs); assert(fc); assert(fc->form && fs); - string_to_jsval(ctx, vp, fc->alt); + args.rval().setString(JS_NewStringCopyZ(ctx, fc->alt)); - return JS_TRUE; + return true; } -static JSBool -input_set_property_alt(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp) +static bool +input_set_property_alt(JSContext *ctx, unsigned int argc, jsval *vp) { - ELINKS_CAST_PROP_PARAMS - - JSObject *parent_form; /* instance of @form_class */ - JSObject *parent_doc; /* instance of @document_class */ - JSObject *parent_win; /* instance of @window_class */ + JS::CallArgs args = CallArgsFromVp(argc, vp); + JS::RootedObject hobj(ctx, &args.thisv().toObject()); struct view_state *vs; struct document_view *doc_view; struct document *document; struct form_state *fs; struct el_form_control *fc; - /* This can be called if @obj if not itself an instance of the - * appropriate class but has one in its prototype chain. Fail - * such calls. */ - if (!JS_InstanceOf(ctx, obj, &input_class, NULL)) - return JS_FALSE; - parent_form = JS_GetParent(obj); + JS::RootedObject parent_form(ctx, JS_GetParent(hobj)); assert(JS_InstanceOf(ctx, parent_form, &form_class, NULL)); - if_assert_failed return JS_FALSE; - parent_doc = JS_GetParent(parent_form); + if_assert_failed return false; + JS::RootedObject parent_doc(ctx, JS_GetParent(parent_form)); assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); - if_assert_failed return JS_FALSE; - parent_win = JS_GetParent(parent_doc); + if_assert_failed return false; + JS::RootedObject parent_win(ctx, JS_GetParent(parent_doc)); assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); - if_assert_failed return JS_FALSE; + if_assert_failed return false; vs = JS_GetInstancePrivate(ctx, parent_win, &window_class, NULL); + if (!vs) { + return false; + } doc_view = vs->doc_view; document = doc_view->document; - fs = input_get_form_state(ctx, obj); - if (!fs) return JS_FALSE; /* detached */ + fs = input_get_form_state(ctx, hobj); + if (!fs) return false; /* detached */ fc = find_form_control(document, fs); assert(fc); assert(fc->form && fs); - mem_free_set(&fc->alt, stracpy(jsval_to_string(ctx, vp))); + mem_free_set(&fc->alt, stracpy(JS_EncodeString(ctx, args[0].toString()))); - return JS_TRUE; + return true; } -static JSBool -input_get_property_checked(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) +static bool +input_get_property_checked(JSContext *ctx, unsigned int argc, jsval *vp) { - ELINKS_CAST_PROP_PARAMS + JS::CallArgs args = CallArgsFromVp(argc, vp); + JS::RootedObject hobj(ctx, &args.thisv().toObject()); struct form_state *fs; - /* This can be called if @obj if not itself an instance of the - * appropriate class but has one in its prototype chain. Fail - * such calls. */ - if (!JS_InstanceOf(ctx, obj, &input_class, NULL)) - return JS_FALSE; + fs = input_get_form_state(ctx, hobj); + if (!fs) return false; /* detached */ - fs = input_get_form_state(ctx, obj); - if (!fs) return JS_FALSE; /* detached */ + args.rval().setBoolean(fs->state); - boolean_to_jsval(ctx, vp, fs->state); - - return JS_TRUE; + return true; } -static JSBool -input_set_property_checked(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp) +static bool +input_set_property_checked(JSContext *ctx, unsigned int argc, jsval *vp) { - ELINKS_CAST_PROP_PARAMS + JS::CallArgs args = CallArgsFromVp(argc, vp); + JS::RootedObject hobj(ctx, &args.thisv().toObject()); - JSObject *parent_form; /* instance of @form_class */ - JSObject *parent_doc; /* instance of @document_class */ - JSObject *parent_win; /* instance of @window_class */ struct view_state *vs; struct document_view *doc_view; struct document *document; struct form_state *fs; struct el_form_control *fc; - /* This can be called if @obj if not itself an instance of the - * appropriate class but has one in its prototype chain. Fail - * such calls. */ - if (!JS_InstanceOf(ctx, obj, &input_class, NULL)) - return JS_FALSE; - parent_form = JS_GetParent(obj); + JS::RootedObject parent_form(ctx, JS_GetParent(hobj)); assert(JS_InstanceOf(ctx, parent_form, &form_class, NULL)); - if_assert_failed return JS_FALSE; - parent_doc = JS_GetParent(parent_form); + if_assert_failed return false; + JS::RootedObject parent_doc(ctx, JS_GetParent(parent_form)); assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); - if_assert_failed return JS_FALSE; - parent_win = JS_GetParent(parent_doc); + if_assert_failed return false; + JS::RootedObject parent_win(ctx, JS_GetParent(parent_doc)); assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); - if_assert_failed return JS_FALSE; + if_assert_failed return false; vs = JS_GetInstancePrivate(ctx, parent_win, &window_class, NULL); + if (!vs) { + return false; + } doc_view = vs->doc_view; document = doc_view->document; - fs = input_get_form_state(ctx, obj); - if (!fs) return JS_FALSE; /* detached */ + fs = input_get_form_state(ctx, hobj); + if (!fs) return false; /* detached */ fc = find_form_control(document, fs); assert(fc); assert(fc->form && fs); if (fc->type != FC_CHECKBOX && fc->type != FC_RADIO) - return JS_TRUE; - fs->state = jsval_to_boolean(ctx, vp); + return true; + fs->state = args[0].toBoolean(); - return JS_TRUE; + return true; } -static JSBool -input_get_property_defaultChecked(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) +static bool +input_get_property_defaultChecked(JSContext *ctx, unsigned int argc, jsval *vp) { - ELINKS_CAST_PROP_PARAMS + JS::CallArgs args = CallArgsFromVp(argc, vp); + JS::RootedObject hobj(ctx, &args.thisv().toObject()); - JSObject *parent_form; /* instance of @form_class */ - JSObject *parent_doc; /* instance of @document_class */ - JSObject *parent_win; /* instance of @window_class */ struct view_state *vs; struct document_view *doc_view; struct document *document; struct form_state *fs; struct el_form_control *fc; - /* This can be called if @obj if not itself an instance of the - * appropriate class but has one in its prototype chain. Fail - * such calls. */ - if (!JS_InstanceOf(ctx, obj, &input_class, NULL)) - return JS_FALSE; - - parent_form = JS_GetParent(obj); + JS::RootedObject parent_form(ctx, JS_GetParent(hobj)); assert(JS_InstanceOf(ctx, parent_form, &form_class, NULL)); - if_assert_failed return JS_FALSE; + if_assert_failed return false; - parent_doc = JS_GetParent(parent_form); + JS::RootedObject parent_doc(ctx, JS_GetParent(parent_form)); assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); - if_assert_failed return JS_FALSE; + if_assert_failed return false; - parent_win = JS_GetParent(parent_doc); + JS::RootedObject parent_win(ctx, JS_GetParent(parent_doc)); assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); - if_assert_failed return JS_FALSE; + if_assert_failed return false; vs = JS_GetInstancePrivate(ctx, parent_win, &window_class, NULL); + if (!vs) { + return false; + } doc_view = vs->doc_view; document = doc_view->document; - fs = input_get_form_state(ctx, obj); - if (!fs) return JS_FALSE; /* detached */ + fs = input_get_form_state(ctx, hobj); + if (!fs) return false; /* detached */ fc = find_form_control(document, fs); assert(fc); assert(fc->form && fs); - boolean_to_jsval(ctx, vp, fc->default_state); + args.rval().setBoolean(fc->default_state); - return JS_TRUE; + return true; } -static JSBool -input_get_property_defaultValue(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) +static bool +input_get_property_defaultValue(JSContext *ctx, unsigned int argc, jsval *vp) { - ELINKS_CAST_PROP_PARAMS + JS::CallArgs args = CallArgsFromVp(argc, vp); + JS::RootedObject hobj(ctx, &args.thisv().toObject()); - JSObject *parent_form; /* instance of @form_class */ - JSObject *parent_doc; /* instance of @document_class */ - JSObject *parent_win; /* instance of @window_class */ struct view_state *vs; struct document_view *doc_view; struct document *document; struct form_state *fs; struct el_form_control *fc; - /* This can be called if @obj if not itself an instance of the - * appropriate class but has one in its prototype chain. Fail - * such calls. */ - if (!JS_InstanceOf(ctx, obj, &input_class, NULL)) - return JS_FALSE; - - parent_form = JS_GetParent(obj); + JS::RootedObject parent_form(ctx, JS_GetParent(hobj)); assert(JS_InstanceOf(ctx, parent_form, &form_class, NULL)); - if_assert_failed return JS_FALSE; + if_assert_failed return false; - parent_doc = JS_GetParent(parent_form); + JS::RootedObject parent_doc(ctx, JS_GetParent(parent_form)); assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); - if_assert_failed return JS_FALSE; + if_assert_failed return false; - parent_win = JS_GetParent(parent_doc); + JS::RootedObject parent_win(ctx, JS_GetParent(parent_doc)); assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); - if_assert_failed return JS_FALSE; + if_assert_failed return false; vs = JS_GetInstancePrivate(ctx, parent_win, &window_class, NULL); + if (!vs) { + return false; + } doc_view = vs->doc_view; document = doc_view->document; - fs = input_get_form_state(ctx, obj); - if (!fs) return JS_FALSE; /* detached */ + fs = input_get_form_state(ctx, hobj); + if (!fs) return false; /* detached */ fc = find_form_control(document, fs); assert(fc); assert(fc->form && fs); /* FIXME (bug 805): convert from the charset of the document */ - string_to_jsval(ctx, vp, fc->default_value); + args.rval().setString(JS_NewStringCopyZ(ctx, fc->default_value)); - return JS_TRUE; + return true; } -static JSBool -input_get_property_disabled(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) +static bool +input_get_property_disabled(JSContext *ctx, unsigned int argc, jsval *vp) { - ELINKS_CAST_PROP_PARAMS + JS::CallArgs args = CallArgsFromVp(argc, vp); + JS::RootedObject hobj(ctx, &args.thisv().toObject()); - JSObject *parent_form; /* instance of @form_class */ - JSObject *parent_doc; /* instance of @document_class */ - JSObject *parent_win; /* instance of @window_class */ struct view_state *vs; struct document_view *doc_view; struct document *document; struct form_state *fs; struct el_form_control *fc; - /* This can be called if @obj if not itself an instance of the - * appropriate class but has one in its prototype chain. Fail - * such calls. */ - if (!JS_InstanceOf(ctx, obj, &input_class, NULL)) - return JS_FALSE; - - parent_form = JS_GetParent(obj); + JS::RootedObject parent_form(ctx, JS_GetParent(hobj)); assert(JS_InstanceOf(ctx, parent_form, &form_class, NULL)); - if_assert_failed return JS_FALSE; + if_assert_failed return false; - parent_doc = JS_GetParent(parent_form); + JS::RootedObject parent_doc(ctx, JS_GetParent(parent_form)); assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); - if_assert_failed return JS_FALSE; + if_assert_failed return false; - parent_win = JS_GetParent(parent_doc); + JS::RootedObject parent_win(ctx, JS_GetParent(parent_doc)); assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); - if_assert_failed return JS_FALSE; + if_assert_failed return false; vs = JS_GetInstancePrivate(ctx, parent_win, &window_class, NULL); + if (!vs) { + return false; + } doc_view = vs->doc_view; document = doc_view->document; - fs = input_get_form_state(ctx, obj); - if (!fs) return JS_FALSE; /* detached */ + fs = input_get_form_state(ctx, hobj); + if (!fs) return false; /* detached */ fc = find_form_control(document, fs); assert(fc); assert(fc->form && fs); /* FIXME: --pasky */ - boolean_to_jsval(ctx, vp, fc->mode == FORM_MODE_DISABLED); + args.rval().setBoolean(fc->mode == FORM_MODE_DISABLED); - return JS_TRUE; + return true; } -static JSBool -input_set_property_disabled(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp) +static bool +input_set_property_disabled(JSContext *ctx, unsigned int argc, jsval *vp) { - ELINKS_CAST_PROP_PARAMS + JS::CallArgs args = CallArgsFromVp(argc, vp); + JS::RootedObject hobj(ctx, &args.thisv().toObject()); - JSObject *parent_form; /* instance of @form_class */ - JSObject *parent_doc; /* instance of @document_class */ - JSObject *parent_win; /* instance of @window_class */ struct view_state *vs; struct document_view *doc_view; struct document *document; struct form_state *fs; struct el_form_control *fc; - /* This can be called if @obj if not itself an instance of the - * appropriate class but has one in its prototype chain. Fail - * such calls. */ - if (!JS_InstanceOf(ctx, obj, &input_class, NULL)) - return JS_FALSE; - parent_form = JS_GetParent(obj); + JS::RootedObject parent_form(ctx, JS_GetParent(hobj)); assert(JS_InstanceOf(ctx, parent_form, &form_class, NULL)); - if_assert_failed return JS_FALSE; - parent_doc = JS_GetParent(parent_form); + if_assert_failed return false; + JS::RootedObject parent_doc(ctx, JS_GetParent(parent_form)); assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); - if_assert_failed return JS_FALSE; - parent_win = JS_GetParent(parent_doc); + if_assert_failed return false; + JS::RootedObject parent_win(ctx, JS_GetParent(parent_doc)); assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); - if_assert_failed return JS_FALSE; + if_assert_failed return false; vs = JS_GetInstancePrivate(ctx, parent_win, &window_class, NULL); + if (!vs) { + return false; + } doc_view = vs->doc_view; document = doc_view->document; - fs = input_get_form_state(ctx, obj); - if (!fs) return JS_FALSE; /* detached */ + fs = input_get_form_state(ctx, hobj); + if (!fs) return false; /* detached */ fc = find_form_control(document, fs); assert(fc); assert(fc->form && fs); /* FIXME: --pasky */ - fc->mode = (jsval_to_boolean(ctx, vp) ? FORM_MODE_DISABLED + fc->mode = (args[0].toBoolean() ? FORM_MODE_DISABLED : fc->mode == FORM_MODE_READONLY ? FORM_MODE_READONLY : FORM_MODE_NORMAL); - return JS_TRUE; + return true; } -static JSBool -input_get_property_form(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) +static bool +input_get_property_form(JSContext *ctx, unsigned int argc, jsval *vp) { - ELINKS_CAST_PROP_PARAMS + JS::CallArgs args = CallArgsFromVp(argc, vp); + JS::RootedObject hobj(ctx, &args.thisv().toObject()); - JSObject *parent_form; /* instance of @form_class */ - - /* This can be called if @obj if not itself an instance of the - * appropriate class but has one in its prototype chain. Fail - * such calls. */ - if (!JS_InstanceOf(ctx, obj, &input_class, NULL)) - return JS_FALSE; - - parent_form = JS_GetParent(obj); + JS::RootedObject parent_form(ctx, JS_GetParent(hobj)); assert(JS_InstanceOf(ctx, parent_form, &form_class, NULL)); - if_assert_failed return JS_FALSE; + if_assert_failed return false; - object_to_jsval(ctx, vp, parent_form); + args.rval().setObject(*parent_form); - return JS_TRUE; + return true; } -static JSBool -input_get_property_maxLength(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) +static bool +input_get_property_maxLength(JSContext *ctx, unsigned int argc, jsval *vp) { - ELINKS_CAST_PROP_PARAMS + JS::CallArgs args = CallArgsFromVp(argc, vp); + JS::RootedObject hobj(ctx, &args.thisv().toObject()); - JSObject *parent_form; /* instance of @form_class */ - JSObject *parent_doc; /* instance of @document_class */ - JSObject *parent_win; /* instance of @window_class */ struct view_state *vs; struct document_view *doc_view; struct document *document; struct form_state *fs; struct el_form_control *fc; - /* This can be called if @obj if not itself an instance of the - * appropriate class but has one in its prototype chain. Fail - * such calls. */ - if (!JS_InstanceOf(ctx, obj, &input_class, NULL)) - return JS_FALSE; - - parent_form = JS_GetParent(obj); + JS::RootedObject parent_form(ctx, JS_GetParent(hobj)); assert(JS_InstanceOf(ctx, parent_form, &form_class, NULL)); - if_assert_failed return JS_FALSE; + if_assert_failed return false; - parent_doc = JS_GetParent(parent_form); + JS::RootedObject parent_doc(ctx, JS_GetParent(parent_form)); assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); - if_assert_failed return JS_FALSE; + if_assert_failed return false; - parent_win = JS_GetParent(parent_doc); + JS::RootedObject parent_win(ctx, JS_GetParent(parent_doc)); assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); - if_assert_failed return JS_FALSE; + if_assert_failed return false; vs = JS_GetInstancePrivate(ctx, parent_win, &window_class, NULL); + if (!vs) { + return false; + } doc_view = vs->doc_view; document = doc_view->document; - fs = input_get_form_state(ctx, obj); - if (!fs) return JS_FALSE; /* detached */ + fs = input_get_form_state(ctx, hobj); + if (!fs) return false; /* detached */ fc = find_form_control(document, fs); assert(fc); assert(fc->form && fs); - int_to_jsval(ctx, vp, fc->maxlength); + args.rval().setInt32(fc->maxlength); - return JS_TRUE; + return true; } -static JSBool -input_set_property_maxLength(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp) +static bool +input_set_property_maxLength(JSContext *ctx, unsigned int argc, jsval *vp) { - ELINKS_CAST_PROP_PARAMS + JS::CallArgs args = CallArgsFromVp(argc, vp); + JS::RootedObject hobj(ctx, &args.thisv().toObject()); - JSObject *parent_form; /* instance of @form_class */ - JSObject *parent_doc; /* instance of @document_class */ - JSObject *parent_win; /* instance of @window_class */ struct view_state *vs; struct document_view *doc_view; struct document *document; struct form_state *fs; struct el_form_control *fc; - /* This can be called if @obj if not itself an instance of the - * appropriate class but has one in its prototype chain. Fail - * such calls. */ - if (!JS_InstanceOf(ctx, obj, &input_class, NULL)) - return JS_FALSE; - parent_form = JS_GetParent(obj); + JS::RootedObject parent_form(ctx, JS_GetParent(hobj)); assert(JS_InstanceOf(ctx, parent_form, &form_class, NULL)); - if_assert_failed return JS_FALSE; - parent_doc = JS_GetParent(parent_form); + if_assert_failed return false; + JS::RootedObject parent_doc(ctx, JS_GetParent(parent_form)); assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); - if_assert_failed return JS_FALSE; - parent_win = JS_GetParent(parent_doc); + if_assert_failed return false; + JS::RootedObject parent_win(ctx, JS_GetParent(parent_doc)); assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); - if_assert_failed return JS_FALSE; + if_assert_failed return false; vs = JS_GetInstancePrivate(ctx, parent_win, &window_class, NULL); + if (!vs) { + return false; + } doc_view = vs->doc_view; document = doc_view->document; - fs = input_get_form_state(ctx, obj); - if (!fs) return JS_FALSE; /* detached */ + fs = input_get_form_state(ctx, hobj); + if (!fs) return false; /* detached */ fc = find_form_control(document, fs); assert(fc); assert(fc->form && fs); - if (!JS_ValueToInt32(ctx, *vp, &fc->maxlength)) - return JS_FALSE; + fc->maxlength = args[0].toInt32(); - return JS_TRUE; + return true; } -static JSBool -input_get_property_name(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) +static bool +input_get_property_name(JSContext *ctx, unsigned int argc, jsval *vp) { - ELINKS_CAST_PROP_PARAMS + JS::CallArgs args = CallArgsFromVp(argc, vp); + JS::RootedObject hobj(ctx, &args.thisv().toObject()); - JSObject *parent_form; /* instance of @form_class */ - JSObject *parent_doc; /* instance of @document_class */ - JSObject *parent_win; /* instance of @window_class */ struct view_state *vs; struct document_view *doc_view; struct document *document; struct form_state *fs; struct el_form_control *fc; - /* This can be called if @obj if not itself an instance of the - * appropriate class but has one in its prototype chain. Fail - * such calls. */ - if (!JS_InstanceOf(ctx, obj, &input_class, NULL)) - return JS_FALSE; - - parent_form = JS_GetParent(obj); + JS::RootedObject parent_form(ctx, JS_GetParent(hobj)); assert(JS_InstanceOf(ctx, parent_form, &form_class, NULL)); - if_assert_failed return JS_FALSE; + if_assert_failed return false; - parent_doc = JS_GetParent(parent_form); + JS::RootedObject parent_doc(ctx, JS_GetParent(parent_form)); assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); - if_assert_failed return JS_FALSE; + if_assert_failed return false; - parent_win = JS_GetParent(parent_doc); + JS::RootedObject parent_win(ctx, JS_GetParent(parent_doc)); assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); - if_assert_failed return JS_FALSE; + if_assert_failed return false; vs = JS_GetInstancePrivate(ctx, parent_win, &window_class, NULL); + if (!vs) { + return false; + } doc_view = vs->doc_view; document = doc_view->document; - fs = input_get_form_state(ctx, obj); - if (!fs) return JS_FALSE; /* detached */ + fs = input_get_form_state(ctx, hobj); + if (!fs) return false; /* detached */ fc = find_form_control(document, fs); assert(fc); assert(fc->form && fs); - string_to_jsval(ctx, vp, fc->name); + args.rval().setString(JS_NewStringCopyZ(ctx, fc->name)); - return JS_TRUE; + return true; } /* @input_class.setProperty */ -static JSBool -input_set_property_name(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp) +static bool +input_set_property_name(JSContext *ctx, unsigned int argc, jsval *vp) { - ELINKS_CAST_PROP_PARAMS + JS::CallArgs args = CallArgsFromVp(argc, vp); + JS::RootedObject hobj(ctx, &args.thisv().toObject()); - JSObject *parent_form; /* instance of @form_class */ - JSObject *parent_doc; /* instance of @document_class */ - JSObject *parent_win; /* instance of @window_class */ struct view_state *vs; struct document_view *doc_view; struct document *document; @@ -782,42 +713,44 @@ input_set_property_name(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, /* This can be called if @obj if not itself an instance of the * appropriate class but has one in its prototype chain. Fail * such calls. */ - if (!JS_InstanceOf(ctx, obj, &input_class, NULL)) - return JS_FALSE; - parent_form = JS_GetParent(obj); + if (!JS_InstanceOf(ctx, hobj, &input_class, NULL)) + return false; + + JS::RootedObject parent_form(ctx, JS_GetParent(hobj)); assert(JS_InstanceOf(ctx, parent_form, &form_class, NULL)); - if_assert_failed return JS_FALSE; - parent_doc = JS_GetParent(parent_form); + if_assert_failed return false; + JS::RootedObject parent_doc(ctx, JS_GetParent(parent_form)); assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); - if_assert_failed return JS_FALSE; - parent_win = JS_GetParent(parent_doc); + if_assert_failed return false; + JS::RootedObject parent_win(ctx, JS_GetParent(parent_doc)); assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); - if_assert_failed return JS_FALSE; + if_assert_failed return false; vs = JS_GetInstancePrivate(ctx, parent_win, &window_class, NULL); + if (!vs) { + return false; + } doc_view = vs->doc_view; document = doc_view->document; - fs = input_get_form_state(ctx, obj); - if (!fs) return JS_FALSE; /* detached */ + fs = input_get_form_state(ctx, hobj); + if (!fs) return false; /* detached */ fc = find_form_control(document, fs); assert(fc); assert(fc->form && fs); - mem_free_set(&fc->name, stracpy(jsval_to_string(ctx, vp))); + mem_free_set(&fc->name, stracpy(JS_EncodeString(ctx, args[0].toString()))); - return JS_TRUE; + return true; } -static JSBool -input_get_property_readonly(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) +static bool +input_get_property_readonly(JSContext *ctx, unsigned int argc, jsval *vp) { - ELINKS_CAST_PROP_PARAMS + JS::CallArgs args = CallArgsFromVp(argc, vp); + JS::RootedObject hobj(ctx, &args.thisv().toObject()); - JSObject *parent_form; /* instance of @form_class */ - JSObject *parent_doc; /* instance of @document_class */ - JSObject *parent_win; /* instance of @window_class */ struct view_state *vs; struct document_view *doc_view; struct document *document; @@ -827,47 +760,48 @@ input_get_property_readonly(JSContext *ctx, JS::HandleObject hobj, JS::HandleId /* This can be called if @obj if not itself an instance of the * appropriate class but has one in its prototype chain. Fail * such calls. */ - if (!JS_InstanceOf(ctx, obj, &input_class, NULL)) - return JS_FALSE; + if (!JS_InstanceOf(ctx, hobj, &input_class, NULL)) + return false; - parent_form = JS_GetParent(obj); + JS::RootedObject parent_form(ctx, JS_GetParent(hobj)); assert(JS_InstanceOf(ctx, parent_form, &form_class, NULL)); - if_assert_failed return JS_FALSE; + if_assert_failed return false; - parent_doc = JS_GetParent(parent_form); + JS::RootedObject parent_doc(ctx, JS_GetParent(parent_form)); assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); - if_assert_failed return JS_FALSE; + if_assert_failed return false; - parent_win = JS_GetParent(parent_doc); + JS::RootedObject parent_win(ctx, JS_GetParent(parent_doc)); assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); - if_assert_failed return JS_FALSE; + if_assert_failed return false; vs = JS_GetInstancePrivate(ctx, parent_win, &window_class, NULL); + if (!vs) { + return false; + } doc_view = vs->doc_view; document = doc_view->document; - fs = input_get_form_state(ctx, obj); - if (!fs) return JS_FALSE; /* detached */ + fs = input_get_form_state(ctx, hobj); + if (!fs) return false; /* detached */ fc = find_form_control(document, fs); assert(fc); assert(fc->form && fs); /* FIXME: --pasky */ - boolean_to_jsval(ctx, vp, fc->mode == FORM_MODE_READONLY); + args.rval().setBoolean(fc->mode == FORM_MODE_READONLY); - return JS_TRUE; + return true; } /* @input_class.setProperty */ -static JSBool -input_set_property_readonly(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp) +static bool +input_set_property_readonly(JSContext *ctx, unsigned int argc, jsval *vp) { - ELINKS_CAST_PROP_PARAMS + JS::CallArgs args = CallArgsFromVp(argc, vp); + JS::RootedObject hobj(ctx, &args.thisv().toObject()); - JSObject *parent_form; /* instance of @form_class */ - JSObject *parent_doc; /* instance of @document_class */ - JSObject *parent_win; /* instance of @window_class */ struct view_state *vs; struct document_view *doc_view; struct document *document; @@ -877,45 +811,46 @@ input_set_property_readonly(JSContext *ctx, JS::HandleObject hobj, JS::HandleId /* This can be called if @obj if not itself an instance of the * appropriate class but has one in its prototype chain. Fail * such calls. */ - if (!JS_InstanceOf(ctx, obj, &input_class, NULL)) - return JS_FALSE; - parent_form = JS_GetParent(obj); + if (!JS_InstanceOf(ctx, hobj, &input_class, NULL)) + return false; + JS::RootedObject parent_form(ctx, JS_GetParent(hobj)); assert(JS_InstanceOf(ctx, parent_form, &form_class, NULL)); - if_assert_failed return JS_FALSE; - parent_doc = JS_GetParent(parent_form); + if_assert_failed return false; + JS::RootedObject parent_doc(ctx, JS_GetParent(parent_form)); assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); - if_assert_failed return JS_FALSE; - parent_win = JS_GetParent(parent_doc); + if_assert_failed return false; + JS::RootedObject parent_win(ctx, JS_GetParent(parent_doc)); assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); - if_assert_failed return JS_FALSE; + if_assert_failed return false; vs = JS_GetInstancePrivate(ctx, parent_win, &window_class, NULL); + if (!vs) { + return false; + } doc_view = vs->doc_view; document = doc_view->document; - fs = input_get_form_state(ctx, obj); - if (!fs) return JS_FALSE; /* detached */ + fs = input_get_form_state(ctx, hobj); + if (!fs) return false; /* detached */ fc = find_form_control(document, fs); assert(fc); assert(fc->form && fs); /* FIXME: --pasky */ - fc->mode = (jsval_to_boolean(ctx, vp) ? FORM_MODE_READONLY + fc->mode = (args[0].toBoolean() ? FORM_MODE_READONLY : fc->mode == FORM_MODE_DISABLED ? FORM_MODE_DISABLED : FORM_MODE_NORMAL); - return JS_TRUE; + return true; } -static JSBool -input_get_property_selectedIndex(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) +static bool +input_get_property_selectedIndex(JSContext *ctx, unsigned int argc, jsval *vp) { - ELINKS_CAST_PROP_PARAMS + JS::CallArgs args = CallArgsFromVp(argc, vp); + JS::RootedObject hobj(ctx, &args.thisv().toObject()); - JSObject *parent_form; /* instance of @form_class */ - JSObject *parent_doc; /* instance of @document_class */ - JSObject *parent_win; /* instance of @window_class */ struct view_state *vs; struct document_view *doc_view; struct document *document; @@ -925,85 +860,89 @@ input_get_property_selectedIndex(JSContext *ctx, JS::HandleObject hobj, JS::Hand /* This can be called if @obj if not itself an instance of the * appropriate class but has one in its prototype chain. Fail * such calls. */ - if (!JS_InstanceOf(ctx, obj, &input_class, NULL)) - return JS_FALSE; + if (!JS_InstanceOf(ctx, hobj, &input_class, NULL)) + return false; - parent_form = JS_GetParent(obj); + JS::RootedObject parent_form(ctx, JS_GetParent(hobj)); assert(JS_InstanceOf(ctx, parent_form, &form_class, NULL)); - if_assert_failed return JS_FALSE; + if_assert_failed return false; - parent_doc = JS_GetParent(parent_form); + JS::RootedObject parent_doc(ctx, JS_GetParent(parent_form)); assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); - if_assert_failed return JS_FALSE; + if_assert_failed return false; - parent_win = JS_GetParent(parent_doc); + JS::RootedObject parent_win(ctx, JS_GetParent(parent_doc)); assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); - if_assert_failed return JS_FALSE; + if_assert_failed return false; vs = JS_GetInstancePrivate(ctx, parent_win, &window_class, NULL); + if (!vs) { + return false; + } doc_view = vs->doc_view; document = doc_view->document; - fs = input_get_form_state(ctx, obj); - if (!fs) return JS_FALSE; /* detached */ - fc = find_form_control(document, fs); - - assert(fc); - assert(fc->form && fs); - - undef_to_jsval(ctx, vp); - - if (fc->type == FC_SELECT) int_to_jsval(ctx, vp, fs->state); - - return JS_TRUE; -} - -/* @input_class.setProperty */ -static JSBool -input_set_property_selectedIndex(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp) -{ - ELINKS_CAST_PROP_PARAMS - - JSObject *parent_form; /* instance of @form_class */ - JSObject *parent_doc; /* instance of @document_class */ - JSObject *parent_win; /* instance of @window_class */ - struct view_state *vs; - struct document_view *doc_view; - struct document *document; - struct form_state *fs; - struct el_form_control *fc; - - /* This can be called if @obj if not itself an instance of the - * appropriate class but has one in its prototype chain. Fail - * such calls. */ - if (!JS_InstanceOf(ctx, obj, &input_class, NULL)) - return JS_FALSE; - parent_form = JS_GetParent(obj); - assert(JS_InstanceOf(ctx, parent_form, &form_class, NULL)); - if_assert_failed return JS_FALSE; - parent_doc = JS_GetParent(parent_form); - assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); - if_assert_failed return JS_FALSE; - parent_win = JS_GetParent(parent_doc); - assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); - if_assert_failed return JS_FALSE; - - vs = JS_GetInstancePrivate(ctx, parent_win, - &window_class, NULL); - doc_view = vs->doc_view; - document = doc_view->document; - fs = input_get_form_state(ctx, obj); - if (!fs) return JS_FALSE; /* detached */ + fs = input_get_form_state(ctx, hobj); + if (!fs) return false; /* detached */ fc = find_form_control(document, fs); assert(fc); assert(fc->form && fs); if (fc->type == FC_SELECT) { - int item; + args.rval().setInt32(fs->state); + } + else { + args.rval().setUndefined(); + } - if (!JS_ValueToInt32(ctx, *vp, &item)) - return JS_FALSE; + return true; +} + +/* @input_class.setProperty */ +static bool +input_set_property_selectedIndex(JSContext *ctx, unsigned int argc, jsval *vp) +{ + JS::CallArgs args = CallArgsFromVp(argc, vp); + JS::RootedObject hobj(ctx, &args.thisv().toObject()); + + struct view_state *vs; + struct document_view *doc_view; + struct document *document; + struct form_state *fs; + struct el_form_control *fc; + + /* This can be called if @obj if not itself an instance of the + * appropriate class but has one in its prototype chain. Fail + * such calls. */ + if (!JS_InstanceOf(ctx, hobj, &input_class, NULL)) + return false; + JS::RootedObject parent_form(ctx, JS_GetParent(hobj)); + assert(JS_InstanceOf(ctx, parent_form, &form_class, NULL)); + if_assert_failed return false; + JS::RootedObject parent_doc(ctx, JS_GetParent(parent_form)); + assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); + if_assert_failed return false; + JS::RootedObject parent_win(ctx, JS_GetParent(parent_doc)); + assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); + if_assert_failed return false; + + vs = JS_GetInstancePrivate(ctx, parent_win, + &window_class, NULL); + if (!vs) { + return false; + } + doc_view = vs->doc_view; + document = doc_view->document; + fs = input_get_form_state(ctx, hobj); + if (!fs) return false; /* detached */ + fc = find_form_control(document, fs); + + assert(fc); + assert(fc->form && fs); + + if (fc->type == FC_SELECT) { + int item = args[0].toInt32(); if (item >= 0 && item < fc->nvalues) { fs->state = item; @@ -1011,17 +950,15 @@ input_set_property_selectedIndex(JSContext *ctx, JS::HandleObject hobj, JS::Hand } } - return JS_TRUE; + return true; } -static JSBool -input_get_property_size(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) +static bool +input_get_property_size(JSContext *ctx, unsigned int argc, jsval *vp) { - ELINKS_CAST_PROP_PARAMS + JS::CallArgs args = CallArgsFromVp(argc, vp); + JS::RootedObject hobj(ctx, &args.thisv().toObject()); - JSObject *parent_form; /* instance of @form_class */ - JSObject *parent_doc; /* instance of @document_class */ - JSObject *parent_win; /* instance of @window_class */ struct view_state *vs; struct document_view *doc_view; struct document *document; @@ -1031,45 +968,46 @@ input_get_property_size(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, /* This can be called if @obj if not itself an instance of the * appropriate class but has one in its prototype chain. Fail * such calls. */ - if (!JS_InstanceOf(ctx, obj, &input_class, NULL)) - return JS_FALSE; + if (!JS_InstanceOf(ctx, hobj, &input_class, NULL)) + return false; - parent_form = JS_GetParent(obj); + JS::RootedObject parent_form(ctx, JS_GetParent(hobj)); assert(JS_InstanceOf(ctx, parent_form, &form_class, NULL)); - if_assert_failed return JS_FALSE; + if_assert_failed return false; - parent_doc = JS_GetParent(parent_form); + JS::RootedObject parent_doc(ctx, JS_GetParent(parent_form)); assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); - if_assert_failed return JS_FALSE; + if_assert_failed return false; - parent_win = JS_GetParent(parent_doc); + JS::RootedObject parent_win(ctx, JS_GetParent(parent_doc)); assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); - if_assert_failed return JS_FALSE; + if_assert_failed return false; vs = JS_GetInstancePrivate(ctx, parent_win, &window_class, NULL); + if (!vs) { + return false; + } doc_view = vs->doc_view; document = doc_view->document; - fs = input_get_form_state(ctx, obj); - if (!fs) return JS_FALSE; /* detached */ + fs = input_get_form_state(ctx, hobj); + if (!fs) return false; /* detached */ fc = find_form_control(document, fs); assert(fc); assert(fc->form && fs); - int_to_jsval(ctx, vp, fc->size); + args.rval().setInt32(fc->size); - return JS_TRUE; + return true; } -static JSBool -input_get_property_src(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) +static bool +input_get_property_src(JSContext *ctx, unsigned int argc, jsval *vp) { - ELINKS_CAST_PROP_PARAMS + JS::CallArgs args = CallArgsFromVp(argc, vp); + JS::RootedObject hobj(ctx, &args.thisv().toObject()); - JSObject *parent_form; /* instance of @form_class */ - JSObject *parent_doc; /* instance of @document_class */ - JSObject *parent_win; /* instance of @window_class */ struct view_state *vs; struct document_view *doc_view; struct document *document; @@ -1081,27 +1019,30 @@ input_get_property_src(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, /* This can be called if @obj if not itself an instance of the * appropriate class but has one in its prototype chain. Fail * such calls. */ - if (!JS_InstanceOf(ctx, obj, &input_class, NULL)) - return JS_FALSE; + if (!JS_InstanceOf(ctx, hobj, &input_class, NULL)) + return false; - parent_form = JS_GetParent(obj); + JS::RootedObject parent_form(ctx, JS_GetParent(hobj)); assert(JS_InstanceOf(ctx, parent_form, &form_class, NULL)); - if_assert_failed return JS_FALSE; + if_assert_failed return false; - parent_doc = JS_GetParent(parent_form); + JS::RootedObject parent_doc(ctx, JS_GetParent(parent_form)); assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); - if_assert_failed return JS_FALSE; + if_assert_failed return false; - parent_win = JS_GetParent(parent_doc); + JS::RootedObject parent_win(ctx, JS_GetParent(parent_doc)); assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); - if_assert_failed return JS_FALSE; + if_assert_failed return false; vs = JS_GetInstancePrivate(ctx, parent_win, &window_class, NULL); + if (!vs) { + return false; + } doc_view = vs->doc_view; document = doc_view->document; - fs = input_get_form_state(ctx, obj); - if (!fs) return JS_FALSE; /* detached */ + fs = input_get_form_state(ctx, hobj); + if (!fs) return false; /* detached */ fc = find_form_control(document, fs); assert(fc); @@ -1110,22 +1051,21 @@ input_get_property_src(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, /* Hiddens have no link. */ if (linknum >= 0) link = &document->links[linknum]; - undef_to_jsval(ctx, vp); + if (link && link->where_img) { + args.rval().setString(JS_NewStringCopyZ(ctx, link->where_img)); + } else { + args.rval().setUndefined(); + } - if (link && link->where_img) - string_to_jsval(ctx, vp, link->where_img); - - return JS_TRUE; + return true; } -static JSBool -input_set_property_src(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp) +static bool +input_set_property_src(JSContext *ctx, unsigned int argc, jsval *vp) { - ELINKS_CAST_PROP_PARAMS + JS::CallArgs args = CallArgsFromVp(argc, vp); + JS::RootedObject hobj(ctx, &args.thisv().toObject()); - JSObject *parent_form; /* instance of @form_class */ - JSObject *parent_doc; /* instance of @document_class */ - JSObject *parent_win; /* instance of @window_class */ struct view_state *vs; struct document_view *doc_view; struct document *document; @@ -1137,24 +1077,30 @@ input_set_property_src(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, /* This can be called if @obj if not itself an instance of the * appropriate class but has one in its prototype chain. Fail * such calls. */ - if (!JS_InstanceOf(ctx, obj, &input_class, NULL)) - return JS_FALSE; - parent_form = JS_GetParent(obj); + if (!JS_InstanceOf(ctx, hobj, &input_class, NULL)) + return false; + + JS::RootedObject parent_form(ctx, JS_GetParent(hobj)); assert(JS_InstanceOf(ctx, parent_form, &form_class, NULL)); - if_assert_failed return JS_FALSE; - parent_doc = JS_GetParent(parent_form); + if_assert_failed return false; + + JS::RootedObject parent_doc(ctx, JS_GetParent(parent_form)); assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); - if_assert_failed return JS_FALSE; - parent_win = JS_GetParent(parent_doc); + if_assert_failed return false; + + JS::RootedObject parent_win(ctx, JS_GetParent(parent_doc)); assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); - if_assert_failed return JS_FALSE; + if_assert_failed return false; vs = JS_GetInstancePrivate(ctx, parent_win, &window_class, NULL); + if (!vs) { + return; + } doc_view = vs->doc_view; document = doc_view->document; - fs = input_get_form_state(ctx, obj); - if (!fs) return JS_FALSE; /* detached */ + fs = input_get_form_state(ctx, hobj); + if (!fs) return false; /* detached */ fc = find_form_control(document, fs); assert(fc); @@ -1165,20 +1111,18 @@ input_set_property_src(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, if (linknum >= 0) link = &document->links[linknum]; if (link) { - mem_free_set(&link->where_img, stracpy(jsval_to_string(ctx, vp))); + mem_free_set(&link->where_img, stracpy(JS_EncodeString(ctx, args[0].toString()))); } - return JS_TRUE; + return true; } -static JSBool -input_get_property_tabIndex(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) +static bool +input_get_property_tabIndex(JSContext *ctx, unsigned int argc, jsval *vp) { - ELINKS_CAST_PROP_PARAMS + JS::CallArgs args = CallArgsFromVp(argc, vp); + JS::RootedObject hobj(ctx, &args.thisv().toObject()); - JSObject *parent_form; /* instance of @form_class */ - JSObject *parent_doc; /* instance of @document_class */ - JSObject *parent_win; /* instance of @window_class */ struct view_state *vs; struct document_view *doc_view; struct document *document; @@ -1190,27 +1134,30 @@ input_get_property_tabIndex(JSContext *ctx, JS::HandleObject hobj, JS::HandleId /* This can be called if @obj if not itself an instance of the * appropriate class but has one in its prototype chain. Fail * such calls. */ - if (!JS_InstanceOf(ctx, obj, &input_class, NULL)) - return JS_FALSE; + if (!JS_InstanceOf(ctx, hobj, &input_class, NULL)) + return false; - parent_form = JS_GetParent(obj); + JS::RootedObject parent_form(ctx, JS_GetParent(hobj)); assert(JS_InstanceOf(ctx, parent_form, &form_class, NULL)); - if_assert_failed return JS_FALSE; + if_assert_failed return false; - parent_doc = JS_GetParent(parent_form); + JS::RootedObject parent_doc(ctx, JS_GetParent(parent_form)); assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); - if_assert_failed return JS_FALSE; + if_assert_failed return false; - parent_win = JS_GetParent(parent_doc); + JS::RootedObject parent_win(ctx, JS_GetParent(parent_doc)); assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); - if_assert_failed return JS_FALSE; + if_assert_failed return false; vs = JS_GetInstancePrivate(ctx, parent_win, &window_class, NULL); + if (!vs) { + return false; + } doc_view = vs->doc_view; document = doc_view->document; - fs = input_get_form_state(ctx, obj); - if (!fs) return JS_FALSE; /* detached */ + fs = input_get_form_state(ctx, hobj); + if (!fs) return false; /* detached */ fc = find_form_control(document, fs); assert(fc); @@ -1220,23 +1167,22 @@ input_get_property_tabIndex(JSContext *ctx, JS::HandleObject hobj, JS::HandleId /* Hiddens have no link. */ if (linknum >= 0) link = &document->links[linknum]; - undef_to_jsval(ctx, vp); - - if (link) + if (link) { /* FIXME: This is WRONG. --pasky */ - int_to_jsval(ctx, vp, link->number); + args.rval().setInt32(link->number); + } else { + args.rval().setUndefined(); + } - return JS_TRUE; + return true; } -static JSBool -input_get_property_type(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) +static bool +input_get_property_type(JSContext *ctx, unsigned int argc, jsval *vp) { - ELINKS_CAST_PROP_PARAMS + JS::CallArgs args = CallArgsFromVp(argc, vp); + JS::RootedObject hobj(ctx, &args.thisv().toObject()); - JSObject *parent_form; /* instance of @form_class */ - JSObject *parent_doc; /* instance of @document_class */ - JSObject *parent_win; /* instance of @window_class */ struct view_state *vs; struct document_view *doc_view; struct document *document; @@ -1247,27 +1193,30 @@ input_get_property_type(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, /* This can be called if @obj if not itself an instance of the * appropriate class but has one in its prototype chain. Fail * such calls. */ - if (!JS_InstanceOf(ctx, obj, &input_class, NULL)) - return JS_FALSE; + if (!JS_InstanceOf(ctx, hobj, &input_class, NULL)) + return false; - parent_form = JS_GetParent(obj); + JS::RootedObject parent_form(ctx, JS_GetParent(hobj)); assert(JS_InstanceOf(ctx, parent_form, &form_class, NULL)); - if_assert_failed return JS_FALSE; + if_assert_failed return false; - parent_doc = JS_GetParent(parent_form); + JS::RootedObject parent_doc(ctx, JS_GetParent(parent_form)); assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); - if_assert_failed return JS_FALSE; + if_assert_failed return false; - parent_win = JS_GetParent(parent_doc); + JS::RootedObject parent_win(ctx, JS_GetParent(parent_doc)); assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); - if_assert_failed return JS_FALSE; + if_assert_failed return false; vs = JS_GetInstancePrivate(ctx, parent_win, &window_class, NULL); + if (!vs) { + return false; + } doc_view = vs->doc_view; document = doc_view->document; - fs = input_get_form_state(ctx, obj); - if (!fs) return JS_FALSE; /* detached */ + fs = input_get_form_state(ctx, hobj); + if (!fs) return false; /* detached */ fc = find_form_control(document, fs); assert(fc); @@ -1287,39 +1236,38 @@ input_get_property_type(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, case FC_SELECT: s = "select"; break; default: INTERNAL("input_get_property() upon a non-input item."); break; } - string_to_jsval(ctx, vp, s); + args.rval().setString(JS_NewStringCopyZ(ctx, s)); - return JS_TRUE; + return true; } -static JSBool -input_get_property_value(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) +static bool +input_get_property_value(JSContext *ctx, unsigned int argc, jsval *vp) { - ELINKS_CAST_PROP_PARAMS + JS::CallArgs args = CallArgsFromVp(argc, vp); + JS::RootedObject hobj(ctx, &args.thisv().toObject()); struct form_state *fs; /* This can be called if @obj if not itself an instance of the * appropriate class but has one in its prototype chain. Fail * such calls. */ - if (!JS_InstanceOf(ctx, obj, &input_class, NULL)) - return JS_FALSE; + if (!JS_InstanceOf(ctx, hobj, &input_class, NULL)) + return false; - fs = input_get_form_state(ctx, obj); - if (!fs) return JS_FALSE; /* detached */ + fs = input_get_form_state(ctx, hobj); + if (!fs) return false; /* detached */ - string_to_jsval(ctx, vp, fs->value); + args.rval().setString(JS_NewStringCopyZ(ctx, fs->value)); - return JS_TRUE; + return true; } -static JSBool -input_set_property_value(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp) +static bool +input_set_property_value(JSContext *ctx, unsigned int argc, jsval *vp) { - ELINKS_CAST_PROP_PARAMS + JS::CallArgs args = CallArgsFromVp(argc, vp); + JS::RootedObject hobj(ctx, &args.thisv().toObject()); - JSObject *parent_form; /* instance of @form_class */ - JSObject *parent_doc; /* instance of @document_class */ - JSObject *parent_win; /* instance of @window_class */ struct view_state *vs; struct document_view *doc_view; struct document *document; @@ -1329,36 +1277,42 @@ input_set_property_value(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid /* This can be called if @obj if not itself an instance of the * appropriate class but has one in its prototype chain. Fail * such calls. */ - if (!JS_InstanceOf(ctx, obj, &input_class, NULL)) - return JS_FALSE; - parent_form = JS_GetParent(obj); + if (!JS_InstanceOf(ctx, hobj, &input_class, NULL)) + return false; + + JS::RootedObject parent_form(ctx, JS_GetParent(hobj)); assert(JS_InstanceOf(ctx, parent_form, &form_class, NULL)); - if_assert_failed return JS_FALSE; - parent_doc = JS_GetParent(parent_form); + if_assert_failed return false; + + JS::RootedObject parent_doc(ctx, JS_GetParent(parent_form)); assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); - if_assert_failed return JS_FALSE; - parent_win = JS_GetParent(parent_doc); + if_assert_failed return false; + + JS::RootedObject parent_win(ctx, JS_GetParent(parent_doc)); assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); - if_assert_failed return JS_FALSE; + if_assert_failed return false; vs = JS_GetInstancePrivate(ctx, parent_win, &window_class, NULL); + if (!vs) { + return false; + } doc_view = vs->doc_view; document = doc_view->document; - fs = input_get_form_state(ctx, obj); - if (!fs) return JS_FALSE; /* detached */ + fs = input_get_form_state(ctx, hobj); + if (!fs) return false; /* detached */ fc = find_form_control(document, fs); assert(fc); assert(fc->form && fs); if (fc->type != FC_FILE) { - mem_free_set(&fs->value, stracpy(jsval_to_string(ctx, vp))); + mem_free_set(&fs->value, stracpy(JS_EncodeString(ctx, args[0].toString()))); if (fc->type == FC_TEXT || fc->type == FC_PASSWORD) fs->state = strlen(fs->value); } - return JS_TRUE; + return true; } /* XXX: Some of those are marked readonly just because we can't change them @@ -1367,29 +1321,29 @@ input_set_property_value(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid * require re-rendering the document (TODO), tabindex would require renumbering * of all links and whatnot. --pasky */ static JSPropertySpec input_props[] = { - { "accessKey", 0, JSPROP_ENUMERATE | JSPROP_SHARED, JSOP_WRAPPER(input_get_property_accessKey), JSOP_WRAPPER(input_set_property_accessKey) }, - { "alt", 0, JSPROP_ENUMERATE|JSPROP_SHARED, JSOP_WRAPPER(input_get_property_alt), JSOP_WRAPPER(input_set_property_alt) }, - { "checked", 0, JSPROP_ENUMERATE|JSPROP_SHARED, JSOP_WRAPPER(input_get_property_checked), JSOP_WRAPPER(input_set_property_checked) }, - { "defaultChecked",0,JSPROP_ENUMERATE|JSPROP_SHARED|JSPROP_READONLY, JSOP_WRAPPER(input_get_property_defaultChecked), JSOP_NULLWRAPPER }, - { "defaultValue",0,JSPROP_ENUMERATE|JSPROP_SHARED|JSPROP_READONLY, JSOP_WRAPPER(input_get_property_defaultValue), JSOP_NULLWRAPPER }, - { "disabled", 0, JSPROP_ENUMERATE|JSPROP_SHARED, JSOP_WRAPPER(input_get_property_disabled), JSOP_WRAPPER(input_set_property_disabled) }, - { "form", 0, JSPROP_ENUMERATE | JSPROP_READONLY|JSPROP_SHARED, JSOP_WRAPPER(input_get_property_form), JSOP_NULLWRAPPER }, - { "maxLength", 0, JSPROP_ENUMERATE|JSPROP_SHARED, JSOP_WRAPPER(input_get_property_maxLength), JSOP_WRAPPER(input_set_property_maxLength) }, - { "name", 0, JSPROP_ENUMERATE|JSPROP_SHARED, JSOP_WRAPPER(input_get_property_name), JSOP_WRAPPER(input_set_property_name) }, - { "readonly", 0, JSPROP_ENUMERATE|JSPROP_SHARED, JSOP_WRAPPER(input_get_property_readonly), JSOP_WRAPPER(input_set_property_readonly) }, - { "selectedIndex", 0,JSPROP_ENUMERATE|JSPROP_SHARED, JSOP_WRAPPER(input_get_property_selectedIndex), JSOP_WRAPPER(input_set_property_selectedIndex) }, - { "size", 0, JSPROP_ENUMERATE | JSPROP_READONLY|JSPROP_SHARED, JSOP_WRAPPER(input_get_property_size), JSOP_NULLWRAPPER }, - { "src", 0, JSPROP_ENUMERATE|JSPROP_SHARED, JSOP_WRAPPER(input_get_property_src), JSOP_WRAPPER(input_set_property_src) }, - { "tabindex", 0, JSPROP_ENUMERATE | JSPROP_READONLY|JSPROP_SHARED, JSOP_WRAPPER(input_get_property_tabIndex), JSOP_NULLWRAPPER }, - { "type", 0, JSPROP_ENUMERATE | JSPROP_READONLY|JSPROP_SHARED, JSOP_WRAPPER(input_get_property_type), JSOP_NULLWRAPPER }, - { "value", 0, JSPROP_ENUMERATE|JSPROP_SHARED, JSOP_WRAPPER(input_get_property_value), JSOP_WRAPPER(input_set_property_value)}, + JS_PSGS("accessKey", input_get_property_accessKey, input_set_property_accessKey, JSPROP_ENUMERATE), + JS_PSGS("alt", input_get_property_alt, input_set_property_alt, JSPROP_ENUMERATE), + JS_PSGS("checked", input_get_property_checked, input_set_property_checked, JSPROP_ENUMERATE), + JS_PSG("defaultChecked", input_get_property_defaultChecked, JSPROP_ENUMERATE), + JS_PSG("defaultValue",input_get_property_defaultValue, JSPROP_ENUMERATE), + JS_PSGS("disabled", input_get_property_disabled, input_set_property_disabled, JSPROP_ENUMERATE), + JS_PSG("form", input_get_property_form, JSPROP_ENUMERATE), + JS_PSGS("maxLength", input_get_property_maxLength, input_set_property_maxLength, JSPROP_ENUMERATE), + JS_PSGS("name", input_get_property_name, input_set_property_name, JSPROP_ENUMERATE), + JS_PSGS("readonly", input_get_property_readonly, input_set_property_readonly, JSPROP_ENUMERATE), + JS_PSGS("selectedIndex", input_get_property_selectedIndex, input_set_property_selectedIndex, JSPROP_ENUMERATE), + JS_PSG("size", input_get_property_size, JSPROP_ENUMERATE), + JS_PSGS("src", input_get_property_src, input_set_property_src,JSPROP_ENUMERATE), + JS_PSG("tabindex", input_get_property_tabIndex, JSPROP_ENUMERATE), + JS_PSG("type", input_get_property_type, JSPROP_ENUMERATE), + JS_PSGS("value", input_get_property_value, input_set_property_value, JSPROP_ENUMERATE), { NULL } }; -static JSBool input_blur(JSContext *ctx, unsigned int argc, jsval *rval); -static JSBool input_click(JSContext *ctx, unsigned int argc, jsval *rval); -static JSBool input_focus(JSContext *ctx, unsigned int argc, jsval *rval); -static JSBool input_select(JSContext *ctx, unsigned int argc, jsval *rval); +static bool input_blur(JSContext *ctx, unsigned int argc, jsval *rval); +static bool input_click(JSContext *ctx, unsigned int argc, jsval *rval); +static bool input_focus(JSContext *ctx, unsigned int argc, jsval *rval); +static bool input_select(JSContext *ctx, unsigned int argc, jsval *rval); static const spidermonkeyFunctionSpec input_funcs[] = { { "blur", input_blur, 0 }, @@ -1402,7 +1356,8 @@ static const spidermonkeyFunctionSpec input_funcs[] = { static struct form_state * input_get_form_state(JSContext *ctx, JSObject *jsinput) { - struct form_state *fs = JS_GetInstancePrivate(ctx, jsinput, + JS::RootedObject r_jsinput(ctx, jsinput); + struct form_state *fs = JS_GetInstancePrivate(ctx, r_jsinput, &input_class, NULL); @@ -1415,15 +1370,15 @@ input_get_form_state(JSContext *ctx, JSObject *jsinput) } /* @input_class.getProperty */ -static JSBool +static bool input_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS jsid id = hid.get(); - JSObject *parent_form; /* instance of @form_class */ - JSObject *parent_doc; /* instance of @document_class */ - JSObject *parent_win; /* instance of @window_class */ + JS::RootedObject parent_form(ctx); /* instance of @form_class */ + JS::RootedObject parent_doc(ctx); /* instance of @document_class */ + JS::RootedObject parent_win(ctx); /* instance of @window_class */ struct view_state *vs; struct document_view *doc_view; struct document *document; @@ -1435,34 +1390,34 @@ input_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS:: /* This can be called if @obj if not itself an instance of the * appropriate class but has one in its prototype chain. Fail * such calls. */ - if (!JS_InstanceOf(ctx, obj, &input_class, NULL)) - return JS_FALSE; + if (!JS_InstanceOf(ctx, hobj, &input_class, NULL)) + return false; parent_form = JS_GetParent(obj); assert(JS_InstanceOf(ctx, parent_form, &form_class, NULL)); - if_assert_failed return JS_FALSE; + if_assert_failed return false; parent_doc = JS_GetParent(parent_form); assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); - if_assert_failed return JS_FALSE; + if_assert_failed return false; parent_win = JS_GetParent(parent_doc); assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); - if_assert_failed return JS_FALSE; + if_assert_failed return false; vs = JS_GetInstancePrivate(ctx, parent_win, &window_class, NULL); doc_view = vs->doc_view; document = doc_view->document; - fs = input_get_form_state(ctx, obj); - if (!fs) return JS_FALSE; /* detached */ + fs = input_get_form_state(ctx, hobj); + if (!fs) return false; /* detached */ fc = find_form_control(document, fs); assert(fc); assert(fc->form && fs); if (!JSID_IS_INT(id)) - return JS_TRUE; + return true; linknum = get_form_control_link(document, fc); /* Hiddens have no link. */ @@ -1484,7 +1439,7 @@ input_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS:: if (keystr) *vp = STRING_TO_JSVAL(keystr); else - return JS_FALSE; + return false; } break; } @@ -1561,26 +1516,26 @@ input_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS:: default: /* Unrecognized integer property ID; someone is using * the object as an array. SMJS builtin classes (e.g. - * js_RegExpClass) just return JS_TRUE in this case + * js_RegExpClass) just return true in this case * and leave *@vp unchanged. Do the same here. * (Actually not quite the same, as we already used * @undef_to_jsval.) */ break; } - return JS_TRUE; + return true; } /* @input_class.setProperty */ -static JSBool -input_set_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp) +static bool +input_set_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, bool strict, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS jsid id = hid.get(); - JSObject *parent_form; /* instance of @form_class */ - JSObject *parent_doc; /* instance of @document_class */ - JSObject *parent_win; /* instance of @window_class */ + JS::RootedObject parent_form(ctx); /* instance of @form_class */ + JS::RootedObject parent_doc(ctx); /* instance of @document_class */ + JS::RootedObject parent_win(ctx); /* instance of @window_class */ struct view_state *vs; struct document_view *doc_view; struct document *document; @@ -1593,31 +1548,31 @@ input_set_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBo /* This can be called if @obj if not itself an instance of the * appropriate class but has one in its prototype chain. Fail * such calls. */ - if (!JS_InstanceOf(ctx, obj, &input_class, NULL)) - return JS_FALSE; + if (!JS_InstanceOf(ctx, hobj, &input_class, NULL)) + return false; parent_form = JS_GetParent(obj); assert(JS_InstanceOf(ctx, parent_form, &form_class, NULL)); - if_assert_failed return JS_FALSE; + if_assert_failed return false; parent_doc = JS_GetParent(parent_form); assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); - if_assert_failed return JS_FALSE; + if_assert_failed return false; parent_win = JS_GetParent(parent_doc); assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); - if_assert_failed return JS_FALSE; + if_assert_failed return false; vs = JS_GetInstancePrivate(ctx, parent_win, &window_class, NULL); doc_view = vs->doc_view; document = doc_view->document; - fs = input_get_form_state(ctx, obj); - if (!fs) return JS_FALSE; /* detached */ + fs = input_get_form_state(ctx, hobj); + if (!fs) return false; /* detached */ fc = find_form_control(document, fs); assert(fc); assert(fc->form && fs); if (!JSID_IS_INT(id)) - return JS_TRUE; + return true; linknum = get_form_control_link(document, fc); /* Hiddens have no link. */ @@ -1625,9 +1580,9 @@ input_set_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBo switch (JSID_TO_INT(id)) { case JSP_INPUT_ACCESSKEY: - accesskey = jsval_to_accesskey(ctx, vp); + accesskey = jsval_to_accesskey(ctx, hvp); if (accesskey == UCS_NO_CHAR) - return JS_FALSE; + return false; else if (link) link->accesskey = accesskey; break; @@ -1646,8 +1601,8 @@ input_set_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBo : FORM_MODE_NORMAL); break; case JSP_INPUT_MAX_LENGTH: - if (!JS_ValueToInt32(ctx, *vp, &fc->maxlength)) - return JS_FALSE; + if (!JS::ToInt32(ctx, hvp, &fc->maxlength)) + return false; break; case JSP_INPUT_NAME: mem_free_set(&fc->name, stracpy(jsval_to_string(ctx, vp))); @@ -1674,8 +1629,8 @@ input_set_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBo if (fc->type == FC_SELECT) { int item; - if (!JS_ValueToInt32(ctx, *vp, &item)) - return JS_FALSE; + if (!JS::ToInt32(ctx, hvp, &item)) + return false; if (item >= 0 && item < fc->nvalues) { fs->state = item; @@ -1687,33 +1642,33 @@ input_set_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBo default: /* Unrecognized integer property ID; someone is using * the object as an array. SMJS builtin classes (e.g. - * js_RegExpClass) just return JS_TRUE in this case. + * js_RegExpClass) just return true in this case. * Do the same here. */ - return JS_TRUE; + return true; } - return JS_TRUE; + return true; } /* @input_funcs{"blur"} */ -static JSBool +static bool input_blur(JSContext *ctx, unsigned int argc, jsval *rval) { /* We are a text-mode browser and there *always* has to be something * selected. So we do nothing for now. (That was easy.) */ - return JS_TRUE; + return true; } /* @input_funcs{"click"} */ -static JSBool +static bool input_click(JSContext *ctx, unsigned int argc, jsval *rval) { jsval val; - JSObject *parent_form; /* instance of @form_class */ - JSObject *parent_doc; /* instance of @document_class */ - JSObject *parent_win; /* instance of @window_class */ - JSObject *obj = JS_THIS_OBJECT(ctx, rval); - jsval *argv = JS_ARGV(ctx, rval); + JS::RootedObject parent_form(ctx); /* instance of @form_class */ + JS::RootedObject parent_doc(ctx); /* instance of @document_class */ + JS::RootedObject parent_win(ctx); /* instance of @window_class */ + JS::RootedObject hobj(ctx, JS_THIS_OBJECT(ctx, rval)); + JS::CallArgs args = JS::CallArgsFromVp(argc, rval); struct view_state *vs; struct document_view *doc_view; struct document *document; @@ -1722,24 +1677,24 @@ input_click(JSContext *ctx, unsigned int argc, jsval *rval) struct el_form_control *fc; int linknum; - if (!JS_InstanceOf(ctx, obj, &input_class, argv)) return JS_FALSE; - parent_form = JS_GetParent(obj); + if (!JS_InstanceOf(ctx, hobj, &input_class, &args)) return false; + parent_form = JS_GetParent(hobj); assert(JS_InstanceOf(ctx, parent_form, &form_class, NULL)); - if_assert_failed return JS_FALSE; + if_assert_failed return false; parent_doc = JS_GetParent(parent_form); assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); - if_assert_failed return JS_FALSE; + if_assert_failed return false; parent_win = JS_GetParent(parent_doc); assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); - if_assert_failed return JS_FALSE; + if_assert_failed return false; vs = JS_GetInstancePrivate(ctx, parent_win, &window_class, NULL); doc_view = vs->doc_view; document = doc_view->document; ses = doc_view->session; - fs = input_get_form_state(ctx, obj); - if (!fs) return JS_FALSE; /* detached */ + fs = input_get_form_state(ctx, hobj); + if (!fs) return false; /* detached */ assert(fs); fc = find_form_control(document, fs); @@ -1748,7 +1703,7 @@ input_click(JSContext *ctx, unsigned int argc, jsval *rval) linknum = get_form_control_link(document, fc); /* Hiddens have no link. */ if (linknum < 0) - return JS_TRUE; + return true; /* Restore old current_link afterwards? */ jump_to_link_number(ses, doc_view, linknum); @@ -1757,21 +1712,21 @@ input_click(JSContext *ctx, unsigned int argc, jsval *rval) else print_screen_status(ses); - boolean_to_jsval(ctx, &val, 0); - JS_SET_RVAL(ctx, rval, val); - return JS_TRUE; + args.rval().setBoolean(false); + + return true; } /* @input_funcs{"focus"} */ -static JSBool +static bool input_focus(JSContext *ctx, unsigned int argc, jsval *rval) { jsval val; - JSObject *parent_form; /* instance of @form_class */ - JSObject *parent_doc; /* instance of @document_class */ - JSObject *parent_win; /* instance of @window_class */ - JSObject *obj = JS_THIS_OBJECT(ctx, rval); - jsval *argv = JS_ARGV(ctx, rval); + JS::RootedObject parent_form(ctx); /* instance of @form_class */ + JS::RootedObject parent_doc(ctx); /* instance of @document_class */ + JS::RootedObject parent_win(ctx); /* instance of @window_class */ + JS::RootedObject obj(ctx, JS_THIS_OBJECT(ctx, rval)); + JS::CallArgs args = JS::CallArgsFromVp(argc, rval); struct view_state *vs; struct document_view *doc_view; struct document *document; @@ -1780,16 +1735,16 @@ input_focus(JSContext *ctx, unsigned int argc, jsval *rval) struct el_form_control *fc; int linknum; - if (!JS_InstanceOf(ctx, obj, &input_class, argv)) return JS_FALSE; + if (!JS_InstanceOf(ctx, obj, &input_class, &args)) return false; parent_form = JS_GetParent(obj); assert(JS_InstanceOf(ctx, parent_form, &form_class, NULL)); - if_assert_failed return JS_FALSE; + if_assert_failed return false; parent_doc = JS_GetParent(parent_form); assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); - if_assert_failed return JS_FALSE; + if_assert_failed return false; parent_win = JS_GetParent(parent_doc); assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); - if_assert_failed return JS_FALSE; + if_assert_failed return false; vs = JS_GetInstancePrivate(ctx, parent_win, &window_class, NULL); @@ -1797,7 +1752,7 @@ input_focus(JSContext *ctx, unsigned int argc, jsval *rval) document = doc_view->document; ses = doc_view->session; fs = input_get_form_state(ctx, obj); - if (!fs) return JS_FALSE; /* detached */ + if (!fs) return false; /* detached */ assert(fs); fc = find_form_control(document, fs); @@ -1806,22 +1761,21 @@ input_focus(JSContext *ctx, unsigned int argc, jsval *rval) linknum = get_form_control_link(document, fc); /* Hiddens have no link. */ if (linknum < 0) - return JS_TRUE; + return true; jump_to_link_number(ses, doc_view, linknum); - boolean_to_jsval(ctx, &val, 0); - JS_SET_RVAL(ctx, rval, val); - return JS_TRUE; + args.rval().setBoolean(false); + return true; } /* @input_funcs{"select"} */ -static JSBool +static bool input_select(JSContext *ctx, unsigned int argc, jsval *rval) { /* We support no text selecting yet. So we do nothing for now. * (That was easy, too.) */ - return JS_TRUE; + return true; } static JSObject * @@ -1830,8 +1784,9 @@ get_input_object(JSContext *ctx, JSObject *jsform, struct form_state *fs) JSObject *jsinput = fs->ecmascript_obj; if (jsinput) { + JS::RootedObject r_jsinput(ctx, jsinput); /* This assumes JS_GetInstancePrivate cannot GC. */ - assert(JS_GetInstancePrivate(ctx, jsinput, + assert(JS_GetInstancePrivate(ctx, r_jsinput, &input_class, NULL) == fs); if_assert_failed return NULL; @@ -1839,13 +1794,17 @@ get_input_object(JSContext *ctx, JSObject *jsform, struct form_state *fs) return jsinput; } + JS::RootedObject r_jsform(ctx, jsform); /* jsform ('form') is input's parent */ /* FIXME: That is NOT correct since the real containing element * should be its parent, but gimme DOM first. --pasky */ - jsinput = JS_NewObject(ctx, &input_class, NULL, jsform); + jsinput = JS_NewObject(ctx, &input_class, JS::NullPtr(), r_jsform); if (!jsinput) return NULL; - JS_DefineProperties(ctx, jsinput, (JSPropertySpec *) input_props); + + JS::RootedObject r_jsinput(ctx, jsinput); + + JS_DefineProperties(ctx, r_jsinput, (JSPropertySpec *) input_props); spidermonkey_DefineFunctions(ctx, jsinput, input_funcs); JS_SetPrivate(jsinput, fs); /* to @input_class */ @@ -1878,6 +1837,7 @@ spidermonkey_detach_form_state(struct form_state *fs) JSObject *jsinput = fs->ecmascript_obj; if (jsinput) { + JS::RootedObject r_jsinput(spidermonkey_empty_context, jsinput); /* This assumes JS_GetInstancePrivate and JS_SetPrivate * cannot GC. */ @@ -1886,7 +1846,7 @@ spidermonkey_detach_form_state(struct form_state *fs) * crashes seem possible either way. Resetting it is * easiest. */ assert(JS_GetInstancePrivate(spidermonkey_empty_context, - jsinput, + r_jsinput, &input_class, NULL) == fs); if_assert_failed {} @@ -1942,7 +1902,7 @@ get_form_control_object(JSContext *ctx, JSObject *jsform, static struct form_view *form_get_form_view(JSContext *ctx, JSObject *jsform, jsval *argv); -static JSBool form_elements_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); +static bool form_elements_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); /* Each @form_elements_class object must have a @form_class parent. */ static JSClass form_elements_class = { @@ -1953,10 +1913,10 @@ static JSClass form_elements_class = { JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, NULL }; -static JSBool form_elements_item2(JSContext *ctx, JSObject *obj, unsigned int argc, jsval *argv, jsval *rval); -static JSBool form_elements_namedItem2(JSContext *ctx, JSObject *obj, unsigned int argc, jsval *argv, jsval *rval); -static JSBool form_elements_item(JSContext *ctx, unsigned int argc, jsval *rval); -static JSBool form_elements_namedItem(JSContext *ctx, unsigned int argc, jsval *rval); +static bool form_elements_item2(JSContext *ctx, JSObject *obj, int index, jsval *rval); +static bool form_elements_namedItem2(JSContext *ctx, JSObject *obj, unsigned char *string, jsval *rval); +static bool form_elements_item(JSContext *ctx, unsigned int argc, jsval *rval); +static bool form_elements_namedItem(JSContext *ctx, unsigned int argc, jsval *rval); static const spidermonkeyFunctionSpec form_elements_funcs[] = { @@ -1965,7 +1925,7 @@ static const spidermonkeyFunctionSpec form_elements_funcs[] = { { NULL } }; -static JSBool form_elements_get_property_length(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); +static bool form_elements_get_property_length(JSContext *ctx, unsigned int argc, jsval *vp); /* Tinyids of properties. Use negative values to distinguish these * from array indexes (elements[INT] for INT>=0 is equivalent to @@ -1975,57 +1935,62 @@ enum form_elements_prop { JSP_FORM_ELEMENTS_LENGTH = -1, }; static JSPropertySpec form_elements_props[] = { - { "length", 0, JSPROP_ENUMERATE | JSPROP_READONLY|JSPROP_SHARED, JSOP_WRAPPER(form_elements_get_property_length), JSOP_NULLWRAPPER}, + JS_PSG("length", form_elements_get_property_length, JSPROP_ENUMERATE), { NULL } }; -static JSBool +static bool form_elements_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS jsid id = hid.get(); jsval idval; - JSObject *parent_form; /* instance of @form_class */ - JSObject *parent_doc; /* instance of @document_class */ - JSObject *parent_win; /* instance of @window_class */ + JS::RootedObject parent_form(ctx); /* instance of @form_class */ + JS::RootedObject parent_doc(ctx); /* instance of @document_class */ + JS::RootedObject parent_win(ctx); /* instance of @window_class */ struct view_state *vs; struct document_view *doc_view; struct document *document; struct form_view *form_view; struct form *form; + /* This can be called if @obj if not itself an instance of the * appropriate class but has one in its prototype chain. Fail * such calls. */ - if (!JS_InstanceOf(ctx, obj, &form_elements_class, NULL)) - return JS_FALSE; + if (!JS_InstanceOf(ctx, hobj, &form_elements_class, NULL)) { + return false; + } parent_form = JS_GetParent(obj); assert(JS_InstanceOf(ctx, parent_form, &form_class, NULL)); - if_assert_failed return JS_FALSE; + if_assert_failed return false; parent_doc = JS_GetParent(parent_form); assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); - if_assert_failed return JS_FALSE; + if_assert_failed return false; parent_win = JS_GetParent(parent_doc); assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); - if_assert_failed return JS_FALSE; + if_assert_failed return false; vs = JS_GetInstancePrivate(ctx, parent_win, &window_class, NULL); doc_view = vs->doc_view; document = doc_view->document; form_view = form_get_form_view(ctx, parent_form, NULL); - if (!form_view) return JS_FALSE; /* detached */ + if (!form_view) return false; /* detached */ form = find_form_by_form_view(document, form_view); if (JSID_IS_STRING(id)) { - JS_IdToValue(ctx, id, &idval); - form_elements_namedItem2(ctx, obj, 1, &idval, vp); - return JS_TRUE; + JS::RootedValue r_idval(ctx, idval); + JS_IdToValue(ctx, id, &r_idval); + unsigned char *string = JS_EncodeString(ctx, JS::ToString(ctx, r_idval)); + form_elements_namedItem2(ctx, obj, string, vp); + return true; } - if (!JSID_IS_INT(id)) - return JS_TRUE; + if (!JSID_IS_INT(id)) { + return true; + } undef_to_jsval(ctx, vp); @@ -2035,76 +2000,84 @@ form_elements_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId h break; default: /* Array index. */ - JS_IdToValue(ctx, id, &idval); - form_elements_item2(ctx, obj, 1, &idval, vp); + int index; + JS::RootedValue r_idval(ctx, idval); + JS_IdToValue(ctx, id, &r_idval); + JS::ToInt32(ctx, r_idval, &index); + form_elements_item2(ctx, obj, index, vp); break; } - return JS_TRUE; + return true; } -static JSBool -form_elements_get_property_length(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) +static bool +form_elements_get_property_length(JSContext *ctx, unsigned int argc, jsval *vp) { - ELINKS_CAST_PROP_PARAMS + JS::CallArgs args = CallArgsFromVp(argc, vp); + JS::RootedObject hobj(ctx, &args.thisv().toObject()); - JSObject *parent_form; /* instance of @form_class */ - JSObject *parent_doc; /* instance of @document_class */ - JSObject *parent_win; /* instance of @window_class */ struct view_state *vs; struct document_view *doc_view; struct document *document; struct form_view *form_view; struct form *form; - /* This can be called if @obj if not itself an instance of the - * appropriate class but has one in its prototype chain. Fail - * such calls. */ - if (!JS_InstanceOf(ctx, obj, &form_elements_class, NULL)) - return JS_FALSE; - parent_form = JS_GetParent(obj); + JS::RootedObject parent_form(ctx, JS_GetParent(hobj)); + assert(JS_InstanceOf(ctx, parent_form, &form_class, NULL)); - if_assert_failed return JS_FALSE; - parent_doc = JS_GetParent(parent_form); + if_assert_failed return false; + + JS::RootedObject parent_doc(ctx, JS_GetParent(parent_form)); assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); - if_assert_failed return JS_FALSE; - parent_win = JS_GetParent(parent_doc); + if_assert_failed return false; + + JS::RootedObject parent_win(ctx, JS_GetParent(parent_doc)); assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); - if_assert_failed return JS_FALSE; + if_assert_failed return false; vs = JS_GetInstancePrivate(ctx, parent_win, &window_class, NULL); + + if (!vs) { + return false; + } doc_view = vs->doc_view; document = doc_view->document; form_view = form_get_form_view(ctx, parent_form, NULL); - if (!form_view) return JS_FALSE; /* detached */ + if (!form_view) return false; /* detached */ + form = find_form_by_form_view(document, form_view); + args.rval().setInt32(list_size(&form->items)); - int_to_jsval(ctx, vp, list_size(&form->items)); - - return JS_TRUE; + return true; } /* @form_elements_funcs{"item"} */ -static JSBool +static bool form_elements_item(JSContext *ctx, unsigned int argc, jsval *rval) { jsval val = JSVAL_VOID; JSObject *obj = JS_THIS_OBJECT(ctx, rval); - jsval *argv = JS_ARGV(ctx, rval); - JSBool ret = form_elements_item2(ctx, obj, argc, argv, &val); + JS::CallArgs args = JS::CallArgsFromVp(argc, rval); - JS_SET_RVAL(ctx, rval, val); + int index; + JS::ToInt32(ctx, args[0], &index); + + bool ret = form_elements_item2(ctx, obj, index, &val); + + args.rval().set(val); +// JS_SET_RVAL(ctx, rval, val); return ret; } -static JSBool -form_elements_item2(JSContext *ctx, JSObject *obj, unsigned int argc, jsval *argv, jsval *rval) +static bool +form_elements_item2(JSContext *ctx, JSObject *obj, int index, jsval *rval) { - JSObject *parent_form; /* instance of @form_class */ - JSObject *parent_doc; /* instance of @document_class */ - JSObject *parent_win; /* instance of @window_class */ + JS::RootedObject parent_form(ctx); /* instance of @form_class */ + JS::RootedObject parent_doc(ctx); /* instance of @document_class */ + JS::RootedObject parent_win(ctx); /* instance of @window_class */ struct view_state *vs; struct document_view *doc_view; struct document *document; @@ -2112,32 +2085,28 @@ form_elements_item2(JSContext *ctx, JSObject *obj, unsigned int argc, jsval *arg struct form *form; struct el_form_control *fc; int counter = -1; - int index; - if (!JS_InstanceOf(ctx, obj, &form_elements_class, argv)) return JS_FALSE; + JS::RootedObject hobj(ctx, obj); + + if (!JS_InstanceOf(ctx, hobj, &form_elements_class, NULL)) return false; parent_form = JS_GetParent(obj); assert(JS_InstanceOf(ctx, parent_form, &form_class, NULL)); - if_assert_failed return JS_FALSE; + if_assert_failed return false; parent_doc = JS_GetParent(parent_form); assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); - if_assert_failed return JS_FALSE; + if_assert_failed return false; parent_win = JS_GetParent(parent_doc); assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); - if_assert_failed return JS_FALSE; + if_assert_failed return false; vs = JS_GetInstancePrivate(ctx, parent_win, &window_class, NULL); doc_view = vs->doc_view; document = doc_view->document; form_view = form_get_form_view(ctx, parent_form, NULL); - if (!form_view) return JS_FALSE; /* detached */ + if (!form_view) return false; /* detached */ form = find_form_by_form_view(document, form_view); - if (argc != 1) - return JS_TRUE; - - if (!JS_ValueToInt32(ctx, argv[0], &index)) - return JS_FALSE; undef_to_jsval(ctx, rval); foreach (fc, form->items) { @@ -2155,61 +2124,62 @@ form_elements_item2(JSContext *ctx, JSObject *obj, unsigned int argc, jsval *arg } } - return JS_TRUE; + return true; } /* @form_elements_funcs{"namedItem"} */ -static JSBool +static bool form_elements_namedItem(JSContext *ctx, unsigned int argc, jsval *rval) { jsval val = JSVAL_VOID; JSObject *obj = JS_THIS_OBJECT(ctx, rval); - jsval *argv = JS_ARGV(ctx, rval); - JSBool ret = form_elements_namedItem2(ctx, obj, argc, argv, &val); - JS_SET_RVAL(ctx, rval, val); + JS::CallArgs args = JS::CallArgsFromVp(argc, rval); +// jsval *argv = JS_ARGV(ctx, rval); + unsigned char *string = JS_EncodeString(ctx, JS::ToString(ctx, args[0])); + bool ret = form_elements_namedItem2(ctx, obj, string, &val); + args.rval().set(val); +// JS_SET_RVAL(ctx, rval, val); return ret; } -static JSBool -form_elements_namedItem2(JSContext *ctx, JSObject *obj, unsigned int argc, jsval *argv, jsval *rval) +static bool +form_elements_namedItem2(JSContext *ctx, JSObject *obj, unsigned char *string, jsval *rval) { - JSObject *parent_form; /* instance of @form_class */ - JSObject *parent_doc; /* instance of @document_class */ - JSObject *parent_win; /* instance of @window_class */ + JS::RootedObject parent_form(ctx); /* instance of @form_class */ + JS::RootedObject parent_doc(ctx); /* instance of @document_class */ + JS::RootedObject parent_win(ctx); /* instance of @window_class */ struct view_state *vs; struct document_view *doc_view; struct document *document; struct form_view *form_view; struct form *form; struct el_form_control *fc; - unsigned char *string; - if (!JS_InstanceOf(ctx, obj, &form_elements_class, argv)) return JS_FALSE; + if (!*string) { + return true; + } + + JS::RootedObject hobj(ctx, obj); + + if (!JS_InstanceOf(ctx, hobj, &form_elements_class, NULL)) return false; parent_form = JS_GetParent(obj); assert(JS_InstanceOf(ctx, parent_form, &form_class, NULL)); - if_assert_failed return JS_FALSE; + if_assert_failed return false; parent_doc = JS_GetParent(parent_form); assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); - if_assert_failed return JS_FALSE; + if_assert_failed return false; parent_win = JS_GetParent(parent_doc); assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); - if_assert_failed return JS_FALSE; + if_assert_failed return false; vs = JS_GetInstancePrivate(ctx, parent_win, &window_class, NULL); doc_view = vs->doc_view; document = doc_view->document; form_view = form_get_form_view(ctx, parent_form, NULL); - if (!form_view) return JS_FALSE; /* detached */ + if (!form_view) return false; /* detached */ form = find_form_by_form_view(document, form_view); - if (argc != 1) - return JS_TRUE; - - string = jsval_to_string(ctx, &argv[0]); - if (!*string) - return JS_TRUE; - undef_to_jsval(ctx, rval); foreach (fc, form->items) { @@ -2227,7 +2197,7 @@ form_elements_namedItem2(JSContext *ctx, JSObject *obj, unsigned int argc, jsval } } - return JS_TRUE; + return true; } @@ -2247,18 +2217,18 @@ enum form_prop { }; static JSPropertySpec form_props[] = { - { "action", 0, JSPROP_ENUMERATE|JSPROP_SHARED, JSOP_WRAPPER(form_get_property_action), JSOP_WRAPPER(form_set_property_action) }, - { "elements", 0, JSPROP_ENUMERATE|JSPROP_SHARED|JSPROP_READONLY, JSOP_WRAPPER(form_get_property_elements), JSOP_NULLWRAPPER }, - { "encoding", 0, JSPROP_ENUMERATE|JSPROP_SHARED, JSOP_WRAPPER(form_get_property_encoding), JSOP_WRAPPER(form_set_property_encoding) }, - { "length", 0, JSPROP_ENUMERATE | JSPROP_READONLY|JSPROP_SHARED, JSOP_WRAPPER(form_get_property_length), JSOP_NULLWRAPPER }, - { "method", 0, JSPROP_ENUMERATE|JSPROP_SHARED, JSOP_WRAPPER(form_get_property_method), JSOP_WRAPPER(form_set_property_method) }, - { "name", 0, JSPROP_ENUMERATE|JSPROP_SHARED, JSOP_WRAPPER(form_get_property_name), JSOP_WRAPPER(form_set_property_name) }, - { "target", 0, JSPROP_ENUMERATE|JSPROP_SHARED, JSOP_WRAPPER(form_get_property_target), JSOP_WRAPPER(form_set_property_target) }, + JS_PSGS("action", form_get_property_action, form_set_property_action, JSPROP_ENUMERATE), + JS_PSG("elements", form_get_property_elements, JSPROP_ENUMERATE), + JS_PSGS("encoding", form_get_property_encoding, form_set_property_encoding, JSPROP_ENUMERATE), + JS_PSG("length", form_get_property_length, JSPROP_ENUMERATE), + JS_PSGS("method", form_get_property_method, form_set_property_method, JSPROP_ENUMERATE), + JS_PSGS("name", form_get_property_name, form_set_property_name, JSPROP_ENUMERATE), + JS_PSGS("target", form_get_property_target, form_set_property_target, JSPROP_ENUMERATE), { NULL } }; -static JSBool form_reset(JSContext *ctx, unsigned int argc, jsval *rval); -static JSBool form_submit(JSContext *ctx, unsigned int argc, jsval *rval); +static bool form_reset(JSContext *ctx, unsigned int argc, jsval *rval); +static bool form_submit(JSContext *ctx, unsigned int argc, jsval *rval); static const spidermonkeyFunctionSpec form_funcs[] = { { "reset", form_reset, 0 }, @@ -2269,9 +2239,11 @@ static const spidermonkeyFunctionSpec form_funcs[] = { static struct form_view * form_get_form_view(JSContext *ctx, JSObject *jsform, jsval *argv) { - struct form_view *fv = JS_GetInstancePrivate(ctx, jsform, + JS::RootedObject r_jsform(ctx, jsform); + JS::CallArgs args = JS::CallArgsFromVp(1, argv); + struct form_view *fv = JS_GetInstancePrivate(ctx, r_jsform, &form_class, - argv); + &args); if (!fv) return NULL; /* detached */ @@ -2282,14 +2254,14 @@ form_get_form_view(JSContext *ctx, JSObject *jsform, jsval *argv) } /* @form_class.getProperty */ -static JSBool +static bool form_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS jsid id = hid.get(); /* DBG("doc %p %s\n", parent_doc, JS_GetStringBytes(JS_ValueToString(ctx, OBJECT_TO_JSVAL(parent_doc)))); */ - JSObject *parent_doc; /* instance of @document_class */ - JSObject *parent_win; /* instance of @window_class */ + JS::RootedObject parent_doc(ctx); /* instance of @document_class */ + JS::RootedObject parent_win(ctx); /* instance of @window_class */ struct view_state *vs; struct document_view *doc_view; struct form_view *fv; @@ -2298,20 +2270,20 @@ form_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::M /* This can be called if @obj if not itself an instance of the * appropriate class but has one in its prototype chain. Fail * such calls. */ - if (!JS_InstanceOf(ctx, obj, &form_class, NULL)) - return JS_FALSE; + if (!JS_InstanceOf(ctx, hobj, &form_class, NULL)) + return false; parent_doc = JS_GetParent(obj); assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); - if_assert_failed return JS_FALSE; + if_assert_failed return false; parent_win = JS_GetParent(parent_doc); assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); - if_assert_failed return JS_FALSE; + if_assert_failed return false; vs = JS_GetInstancePrivate(ctx, parent_win, &window_class, NULL); doc_view = vs->doc_view; fv = form_get_form_view(ctx, obj, NULL); - if (!fv) return JS_FALSE; /* detached */ + if (!fv) return false; /* detached */ form = find_form_by_form_view(doc_view->document, fv); assert(form); @@ -2337,11 +2309,11 @@ form_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::M } break; } - return JS_TRUE; + return true; } if (!JSID_IS_INT(id)) - return JS_TRUE; + return true; undef_to_jsval(ctx, vp); @@ -2353,9 +2325,11 @@ form_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::M case JSP_FORM_ELEMENTS: { /* jsform ('form') is form_elements' parent; who knows is that's correct */ - JSObject *jsform_elems = JS_NewObject(ctx, &form_elements_class, NULL, obj); + JSObject *jsform_elems = JS_NewObject(ctx, &form_elements_class, JS::NullPtr(), hobj); - JS_DefineProperties(ctx, jsform_elems, (JSPropertySpec *) form_elements_props); + JS::RootedObject r_jsform_elems(ctx, jsform_elems); + + JS_DefineProperties(ctx, r_jsform_elems, (JSPropertySpec *) form_elements_props); spidermonkey_DefineFunctions(ctx, jsform_elems, form_elements_funcs); object_to_jsval(ctx, vp, jsform_elems); @@ -2408,24 +2382,23 @@ form_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::M default: /* Unrecognized integer property ID; someone is using * the object as an array. SMJS builtin classes (e.g. - * js_RegExpClass) just return JS_TRUE in this case + * js_RegExpClass) just return true in this case * and leave *@vp unchanged. Do the same here. * (Actually not quite the same, as we already used * @undef_to_jsval.) */ break; } - return JS_TRUE; + return true; } -static JSBool -form_get_property_action(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) +static bool +form_get_property_action(JSContext *ctx, unsigned int argc, jsval *vp) { - ELINKS_CAST_PROP_PARAMS - /* DBG("doc %p %s\n", parent_doc, JS_GetStringBytes(JS_ValueToString(ctx, OBJECT_TO_JSVAL(parent_doc)))); */ - JSObject *parent_doc; /* instance of @document_class */ - JSObject *parent_win; /* instance of @window_class */ + JS::CallArgs args = CallArgsFromVp(argc, vp); + JS::RootedObject hobj(ctx, &args.thisv().toObject()); + struct view_state *vs; struct document_view *doc_view; struct form_view *fv; @@ -2434,35 +2407,39 @@ form_get_property_action(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid /* This can be called if @obj if not itself an instance of the * appropriate class but has one in its prototype chain. Fail * such calls. */ - if (!JS_InstanceOf(ctx, obj, &form_class, NULL)) - return JS_FALSE; - parent_doc = JS_GetParent(obj); + if (!JS_InstanceOf(ctx, hobj, &form_class, NULL)) + return false; + + JS::RootedObject parent_doc(ctx, JS_GetParent(hobj)); assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); - if_assert_failed return JS_FALSE; - parent_win = JS_GetParent(parent_doc); + if_assert_failed return false; + + JS::RootedObject parent_win(ctx, JS_GetParent(parent_doc)); assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); - if_assert_failed return JS_FALSE; + if_assert_failed return false; vs = JS_GetInstancePrivate(ctx, parent_win, &window_class, NULL); + if (!vs) { + return false; + } doc_view = vs->doc_view; - fv = form_get_form_view(ctx, obj, NULL); - if (!fv) return JS_FALSE; /* detached */ + fv = form_get_form_view(ctx, hobj, NULL); + if (!fv) return false; /* detached */ form = find_form_by_form_view(doc_view->document, fv); assert(form); - string_to_jsval(ctx, vp, form->action); + args.rval().setString(JS_NewStringCopyZ(ctx, form->action)); - return JS_TRUE; + return true; } -static JSBool -form_set_property_action(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp) +static bool +form_set_property_action(JSContext *ctx, unsigned int argc, jsval *vp) { - ELINKS_CAST_PROP_PARAMS + JS::CallArgs args = CallArgsFromVp(argc, vp); + JS::RootedObject hobj(ctx, &args.thisv().toObject()); - JSObject *parent_doc; /* instance of @document_class */ - JSObject *parent_win; /* instance of @window_class */ struct view_state *vs; struct document_view *doc_view; struct form_view *fv; @@ -2472,71 +2449,74 @@ form_set_property_action(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid /* This can be called if @obj if not itself an instance of the * appropriate class but has one in its prototype chain. Fail * such calls. */ - if (!JS_InstanceOf(ctx, obj, &form_class, NULL)) - return JS_FALSE; - parent_doc = JS_GetParent(obj); + if (!JS_InstanceOf(ctx, hobj, &form_class, NULL)) + return false; + + JS::RootedObject parent_doc(ctx, JS_GetParent(hobj)); assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); - if_assert_failed return JS_FALSE; - parent_win = JS_GetParent(parent_doc); + if_assert_failed return false; + + JS::RootedObject parent_win(ctx, JS_GetParent(parent_doc)); assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); - if_assert_failed return JS_FALSE; + if_assert_failed return false; vs = JS_GetInstancePrivate(ctx, parent_win, &window_class, NULL); + if (!vs) { + return false; + } doc_view = vs->doc_view; - fv = form_get_form_view(ctx, obj, NULL); - if (!fv) return JS_FALSE; /* detached */ + fv = form_get_form_view(ctx, hobj, NULL); + if (!fv) return false; /* detached */ form = find_form_by_form_view(doc_view->document, fv); assert(form); - string = stracpy(jsval_to_string(ctx, vp)); + string = stracpy(JS_EncodeString(ctx, args[0].toString())); if (form->action) { ecmascript_set_action(&form->action, string); } else { mem_free_set(&form->action, string); } - return JS_TRUE; + return true; } -static JSBool -form_get_property_elements(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) +static bool +form_get_property_elements(JSContext *ctx, unsigned int argc, jsval *vp) { - ELINKS_CAST_PROP_PARAMS - /* DBG("doc %p %s\n", parent_doc, JS_GetStringBytes(JS_ValueToString(ctx, OBJECT_TO_JSVAL(parent_doc)))); */ + JS::CallArgs args = CallArgsFromVp(argc, vp); + JS::RootedObject hobj(ctx, &args.thisv().toObject()); + struct form_view *fv; - JSObject *jsform_elems; /* This can be called if @obj if not itself an instance of the * appropriate class but has one in its prototype chain. Fail * such calls. */ - if (!JS_InstanceOf(ctx, obj, &form_class, NULL)) - return JS_FALSE; + if (!JS_InstanceOf(ctx, hobj, &form_class, NULL)) + return false; - fv = form_get_form_view(ctx, obj, NULL); - if (!fv) return JS_FALSE; /* detached */ + fv = form_get_form_view(ctx, hobj, NULL); + if (!fv) return false; /* detached */ /* jsform ('form') is form_elements' parent; who knows is that's correct */ - jsform_elems = JS_NewObject(ctx, &form_elements_class, NULL, obj); + JSObject *jsform_elems = JS_NewObject(ctx, &form_elements_class, JS::NullPtr(), hobj); + JS::RootedObject r_jsform_elems(ctx, jsform_elems); - JS_DefineProperties(ctx, jsform_elems, (JSPropertySpec *) form_elements_props); + JS_DefineProperties(ctx, r_jsform_elems, (JSPropertySpec *) form_elements_props); spidermonkey_DefineFunctions(ctx, jsform_elems, form_elements_funcs); - object_to_jsval(ctx, vp, jsform_elems); - /* SM will cache this property value for us so we create this - * just once per form. */ + args.rval().setObject(*jsform_elems); - return JS_TRUE; + return true; } -static JSBool -form_get_property_encoding(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) +static bool +form_get_property_encoding(JSContext *ctx, unsigned int argc, jsval *vp) { - ELINKS_CAST_PROP_PARAMS - /* DBG("doc %p %s\n", parent_doc, JS_GetStringBytes(JS_ValueToString(ctx, OBJECT_TO_JSVAL(parent_doc)))); */ - JSObject *parent_doc; /* instance of @document_class */ - JSObject *parent_win; /* instance of @window_class */ + JS::CallArgs args = CallArgsFromVp(argc, vp); + JS::RootedObject hobj(ctx, &args.thisv().toObject()); + struct view_state *vs; struct document_view *doc_view; struct form_view *fv; @@ -2545,20 +2525,25 @@ form_get_property_encoding(JSContext *ctx, JS::HandleObject hobj, JS::HandleId h /* This can be called if @obj if not itself an instance of the * appropriate class but has one in its prototype chain. Fail * such calls. */ - if (!JS_InstanceOf(ctx, obj, &form_class, NULL)) - return JS_FALSE; - parent_doc = JS_GetParent(obj); + if (!JS_InstanceOf(ctx, hobj, &form_class, NULL)) + return false; + + JS::RootedObject parent_doc(ctx, JS_GetParent(hobj)); assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); - if_assert_failed return JS_FALSE; - parent_win = JS_GetParent(parent_doc); + if_assert_failed return false; + + JS::RootedObject parent_win(ctx, JS_GetParent(parent_doc)); assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); - if_assert_failed return JS_FALSE; + if_assert_failed return false; vs = JS_GetInstancePrivate(ctx, parent_win, &window_class, NULL); + if (!vs) { + return false; + } doc_view = vs->doc_view; - fv = form_get_form_view(ctx, obj, NULL); - if (!fv) return JS_FALSE; /* detached */ + fv = form_get_form_view(ctx, hobj, NULL); + if (!fv) return false; /* detached */ form = find_form_by_form_view(doc_view->document, fv); assert(form); @@ -2566,27 +2551,26 @@ form_get_property_encoding(JSContext *ctx, JS::HandleObject hobj, JS::HandleId h switch (form->method) { case FORM_METHOD_GET: case FORM_METHOD_POST: - string_to_jsval(ctx, vp, "application/x-www-form-urlencoded"); + args.rval().setString(JS_NewStringCopyZ(ctx, "application/x-www-form-urlencoded")); break; case FORM_METHOD_POST_MP: - string_to_jsval(ctx, vp, "multipart/form-data"); + args.rval().setString(JS_NewStringCopyZ(ctx, "multipart/form-data")); break; case FORM_METHOD_POST_TEXT_PLAIN: - string_to_jsval(ctx, vp, "text/plain"); + args.rval().setString(JS_NewStringCopyZ(ctx, "text/plain")); break; } - return JS_TRUE; + return true; } /* @form_class.setProperty */ -static JSBool -form_set_property_encoding(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp) +static bool +form_set_property_encoding(JSContext *ctx, unsigned int argc, jsval *vp) { - ELINKS_CAST_PROP_PARAMS + JS::CallArgs args = CallArgsFromVp(argc, vp); + JS::RootedObject hobj(ctx, &args.thisv().toObject()); - JSObject *parent_doc; /* instance of @document_class */ - JSObject *parent_win; /* instance of @window_class */ struct view_state *vs; struct document_view *doc_view; struct form_view *fv; @@ -2596,25 +2580,30 @@ form_set_property_encoding(JSContext *ctx, JS::HandleObject hobj, JS::HandleId h /* This can be called if @obj if not itself an instance of the * appropriate class but has one in its prototype chain. Fail * such calls. */ - if (!JS_InstanceOf(ctx, obj, &form_class, NULL)) - return JS_FALSE; - parent_doc = JS_GetParent(obj); + if (!JS_InstanceOf(ctx, hobj, &form_class, NULL)) + return false; + + JS::RootedObject parent_doc(ctx, JS_GetParent(hobj)); assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); - if_assert_failed return JS_FALSE; - parent_win = JS_GetParent(parent_doc); + if_assert_failed return false; + + JS::RootedObject parent_win(ctx, JS_GetParent(parent_doc)); assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); - if_assert_failed return JS_FALSE; + if_assert_failed return false; vs = JS_GetInstancePrivate(ctx, parent_win, &window_class, NULL); + if (!vs) { + return false; + } doc_view = vs->doc_view; - fv = form_get_form_view(ctx, obj, NULL); - if (!fv) return JS_FALSE; /* detached */ + fv = form_get_form_view(ctx, hobj, NULL); + if (!fv) return false; /* detached */ form = find_form_by_form_view(doc_view->document, fv); assert(form); - string = jsval_to_string(ctx, vp); + string = JS_EncodeString(ctx, args[0].toString()); if (!c_strcasecmp(string, "application/x-www-form-urlencoded")) { form->method = form->method == FORM_METHOD_GET ? FORM_METHOD_GET : FORM_METHOD_POST; @@ -2624,16 +2613,15 @@ form_set_property_encoding(JSContext *ctx, JS::HandleObject hobj, JS::HandleId h form->method = FORM_METHOD_POST_TEXT_PLAIN; } - return JS_TRUE; + return true; } -static JSBool -form_get_property_length(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) +static bool +form_get_property_length(JSContext *ctx, unsigned int argc, jsval *vp) { - ELINKS_CAST_PROP_PARAMS - /* DBG("doc %p %s\n", parent_doc, JS_GetStringBytes(JS_ValueToString(ctx, OBJECT_TO_JSVAL(parent_doc)))); */ - JSObject *parent_doc; /* instance of @document_class */ - JSObject *parent_win; /* instance of @window_class */ + JS::CallArgs args = CallArgsFromVp(argc, vp); + JS::RootedObject hobj(ctx, &args.thisv().toObject()); + struct view_state *vs; struct document_view *doc_view; struct form_view *fv; @@ -2642,36 +2630,40 @@ form_get_property_length(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid /* This can be called if @obj if not itself an instance of the * appropriate class but has one in its prototype chain. Fail * such calls. */ - if (!JS_InstanceOf(ctx, obj, &form_class, NULL)) - return JS_FALSE; - parent_doc = JS_GetParent(obj); + if (!JS_InstanceOf(ctx, hobj, &form_class, NULL)) + return false; + + JS::RootedObject parent_doc(ctx, JS_GetParent(hobj)); assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); - if_assert_failed return JS_FALSE; - parent_win = JS_GetParent(parent_doc); + if_assert_failed return false; + + JS::RootedObject parent_win(ctx, JS_GetParent(parent_doc)); assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); - if_assert_failed return JS_FALSE; + if_assert_failed return false; vs = JS_GetInstancePrivate(ctx, parent_win, &window_class, NULL); + if (!vs) { + return false; + } doc_view = vs->doc_view; - fv = form_get_form_view(ctx, obj, NULL); - if (!fv) return JS_FALSE; /* detached */ + fv = form_get_form_view(ctx, hobj, NULL); + if (!fv) return false; /* detached */ form = find_form_by_form_view(doc_view->document, fv); assert(form); - int_to_jsval(ctx, vp, list_size(&form->items)); + args.rval().setInt32(list_size(&form->items)); - return JS_TRUE; + return true; } -static JSBool -form_get_property_method(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) +static bool +form_get_property_method(JSContext *ctx, unsigned int argc, jsval *vp) { - ELINKS_CAST_PROP_PARAMS - /* DBG("doc %p %s\n", parent_doc, JS_GetStringBytes(JS_ValueToString(ctx, OBJECT_TO_JSVAL(parent_doc)))); */ - JSObject *parent_doc; /* instance of @document_class */ - JSObject *parent_win; /* instance of @window_class */ + JS::CallArgs args = CallArgsFromVp(argc, vp); + JS::RootedObject hobj(ctx, &args.thisv().toObject()); + struct view_state *vs; struct document_view *doc_view; struct form_view *fv; @@ -2680,47 +2672,51 @@ form_get_property_method(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid /* This can be called if @obj if not itself an instance of the * appropriate class but has one in its prototype chain. Fail * such calls. */ - if (!JS_InstanceOf(ctx, obj, &form_class, NULL)) - return JS_FALSE; - parent_doc = JS_GetParent(obj); + if (!JS_InstanceOf(ctx, hobj, &form_class, NULL)) + return false; + + JS::RootedObject parent_doc(ctx, JS_GetParent(hobj)); assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); - if_assert_failed return JS_FALSE; - parent_win = JS_GetParent(parent_doc); + if_assert_failed return false; + + JS::RootedObject parent_win(ctx, JS_GetParent(parent_doc)); assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); - if_assert_failed return JS_FALSE; + if_assert_failed return false; vs = JS_GetInstancePrivate(ctx, parent_win, &window_class, NULL); + if (!vs) { + return false; + } doc_view = vs->doc_view; - fv = form_get_form_view(ctx, obj, NULL); - if (!fv) return JS_FALSE; /* detached */ + fv = form_get_form_view(ctx, hobj, NULL); + if (!fv) return false; /* detached */ form = find_form_by_form_view(doc_view->document, fv); assert(form); switch (form->method) { case FORM_METHOD_GET: - string_to_jsval(ctx, vp, "GET"); + args.rval().setString(JS_NewStringCopyZ(ctx, "GET")); break; case FORM_METHOD_POST: case FORM_METHOD_POST_MP: case FORM_METHOD_POST_TEXT_PLAIN: - string_to_jsval(ctx, vp, "POST"); + args.rval().setString(JS_NewStringCopyZ(ctx, "POST")); break; } - return JS_TRUE; + return true; } /* @form_class.setProperty */ -static JSBool -form_set_property_method(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp) +static bool +form_set_property_method(JSContext *ctx, unsigned int argc, jsval *vp) { - ELINKS_CAST_PROP_PARAMS + JS::CallArgs args = CallArgsFromVp(argc, vp); + JS::RootedObject hobj(ctx, &args.thisv().toObject()); - JSObject *parent_doc; /* instance of @document_class */ - JSObject *parent_win; /* instance of @window_class */ struct view_state *vs; struct document_view *doc_view; struct form_view *fv; @@ -2730,41 +2726,45 @@ form_set_property_method(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid /* This can be called if @obj if not itself an instance of the * appropriate class but has one in its prototype chain. Fail * such calls. */ - if (!JS_InstanceOf(ctx, obj, &form_class, NULL)) - return JS_FALSE; - parent_doc = JS_GetParent(obj); + if (!JS_InstanceOf(ctx, hobj, &form_class, NULL)) + return false; + + JS::RootedObject parent_doc(ctx, JS_GetParent(hobj)); assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); - if_assert_failed return JS_FALSE; - parent_win = JS_GetParent(parent_doc); + if_assert_failed return false; + + JS::RootedObject parent_win(ctx, JS_GetParent(parent_doc)); assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); - if_assert_failed return JS_FALSE; + if_assert_failed return false; vs = JS_GetInstancePrivate(ctx, parent_win, &window_class, NULL); + if (!vs) { + return false; + } doc_view = vs->doc_view; - fv = form_get_form_view(ctx, obj, NULL); - if (!fv) return JS_FALSE; /* detached */ + fv = form_get_form_view(ctx, hobj, NULL); + if (!fv) return false; /* detached */ form = find_form_by_form_view(doc_view->document, fv); assert(form); - string = jsval_to_string(ctx, vp); + string = JS_EncodeString(ctx, args[0].toString()); if (!c_strcasecmp(string, "GET")) { form->method = FORM_METHOD_GET; } else if (!c_strcasecmp(string, "POST")) { form->method = FORM_METHOD_POST; } - return JS_TRUE; + return true; } -static JSBool -form_get_property_name(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) +static bool +form_get_property_name(JSContext *ctx, unsigned int argc, jsval *vp) { - ELINKS_CAST_PROP_PARAMS - /* DBG("doc %p %s\n", parent_doc, JS_GetStringBytes(JS_ValueToString(ctx, OBJECT_TO_JSVAL(parent_doc)))); */ - JSObject *parent_doc; /* instance of @document_class */ - JSObject *parent_win; /* instance of @window_class */ + JS::CallArgs args = CallArgsFromVp(argc, vp); + JS::RootedObject hobj(ctx, &args.thisv().toObject()); + struct view_state *vs; struct document_view *doc_view; struct form_view *fv; @@ -2773,37 +2773,41 @@ form_get_property_name(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, /* This can be called if @obj if not itself an instance of the * appropriate class but has one in its prototype chain. Fail * such calls. */ - if (!JS_InstanceOf(ctx, obj, &form_class, NULL)) - return JS_FALSE; - parent_doc = JS_GetParent(obj); + if (!JS_InstanceOf(ctx, hobj, &form_class, NULL)) + return false; + + JS::RootedObject parent_doc(ctx, JS_GetParent(hobj)); assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); - if_assert_failed return JS_FALSE; - parent_win = JS_GetParent(parent_doc); + if_assert_failed return false; + + JS::RootedObject parent_win(ctx, JS_GetParent(parent_doc)); assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); - if_assert_failed return JS_FALSE; + if_assert_failed return false; vs = JS_GetInstancePrivate(ctx, parent_win, &window_class, NULL); + if (!vs) { + return false; + } doc_view = vs->doc_view; - fv = form_get_form_view(ctx, obj, NULL); - if (!fv) return JS_FALSE; /* detached */ + fv = form_get_form_view(ctx, hobj, NULL); + if (!fv) return false; /* detached */ form = find_form_by_form_view(doc_view->document, fv); assert(form); - string_to_jsval(ctx, vp, form->name); + args.rval().setString(JS_NewStringCopyZ(ctx, form->name)); - return JS_TRUE; + return true; } /* @form_class.setProperty */ -static JSBool -form_set_property_name(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp) +static bool +form_set_property_name(JSContext *ctx, unsigned int argc, jsval *vp) { - ELINKS_CAST_PROP_PARAMS + JS::CallArgs args = CallArgsFromVp(argc, vp); + JS::RootedObject hobj(ctx, &args.thisv().toObject()); - JSObject *parent_doc; /* instance of @document_class */ - JSObject *parent_win; /* instance of @window_class */ struct view_state *vs; struct document_view *doc_view; struct form_view *fv; @@ -2812,35 +2816,39 @@ form_set_property_name(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, /* This can be called if @obj if not itself an instance of the * appropriate class but has one in its prototype chain. Fail * such calls. */ - if (!JS_InstanceOf(ctx, obj, &form_class, NULL)) - return JS_FALSE; - parent_doc = JS_GetParent(obj); + if (!JS_InstanceOf(ctx, hobj, &form_class, NULL)) + return false; + + JS::RootedObject parent_doc(ctx, JS_GetParent(hobj)); assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); - if_assert_failed return JS_FALSE; - parent_win = JS_GetParent(parent_doc); + if_assert_failed return false; + + JS::RootedObject parent_win(ctx, JS_GetParent(parent_doc)); assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); - if_assert_failed return JS_FALSE; + if_assert_failed return false; vs = JS_GetInstancePrivate(ctx, parent_win, &window_class, NULL); + if (!vs) { + return false; + } doc_view = vs->doc_view; - fv = form_get_form_view(ctx, obj, NULL); - if (!fv) return JS_FALSE; /* detached */ + fv = form_get_form_view(ctx, hobj, NULL); + if (!fv) return false; /* detached */ form = find_form_by_form_view(doc_view->document, fv); assert(form); - mem_free_set(&form->name, stracpy(jsval_to_string(ctx, vp))); + mem_free_set(&form->name, stracpy(JS_EncodeString(ctx, args[0].toString()))); - return JS_TRUE; + return true; } -static JSBool -form_get_property_target(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) +static bool +form_get_property_target(JSContext *ctx, unsigned int argc, jsval *vp) { - ELINKS_CAST_PROP_PARAMS - /* DBG("doc %p %s\n", parent_doc, JS_GetStringBytes(JS_ValueToString(ctx, OBJECT_TO_JSVAL(parent_doc)))); */ - JSObject *parent_doc; /* instance of @document_class */ - JSObject *parent_win; /* instance of @window_class */ + JS::CallArgs args = CallArgsFromVp(argc, vp); + JS::RootedObject hobj(ctx, &args.thisv().toObject()); + struct view_state *vs; struct document_view *doc_view; struct form_view *fv; @@ -2849,35 +2857,39 @@ form_get_property_target(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid /* This can be called if @obj if not itself an instance of the * appropriate class but has one in its prototype chain. Fail * such calls. */ - if (!JS_InstanceOf(ctx, obj, &form_class, NULL)) - return JS_FALSE; - parent_doc = JS_GetParent(obj); + if (!JS_InstanceOf(ctx, hobj, &form_class, NULL)) + return false; + + JS::RootedObject parent_doc(ctx, JS_GetParent(hobj)); assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); - if_assert_failed return JS_FALSE; - parent_win = JS_GetParent(parent_doc); + if_assert_failed return false; + + JS::RootedObject parent_win(ctx, JS_GetParent(parent_doc)); assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); - if_assert_failed return JS_FALSE; + if_assert_failed return false; vs = JS_GetInstancePrivate(ctx, parent_win, &window_class, NULL); + if (!vs) { + return false; + } doc_view = vs->doc_view; - fv = form_get_form_view(ctx, obj, NULL); - if (!fv) return JS_FALSE; /* detached */ + fv = form_get_form_view(ctx, hobj, NULL); + if (!fv) return false; /* detached */ form = find_form_by_form_view(doc_view->document, fv); assert(form); - string_to_jsval(ctx, vp, form->target); + args.rval().setString(JS_NewStringCopyZ(ctx, form->target)); - return JS_TRUE; + return true; } -static JSBool -form_set_property_target(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp) +static bool +form_set_property_target(JSContext *ctx, unsigned int argc, jsval *vp) { - ELINKS_CAST_PROP_PARAMS + JS::CallArgs args = CallArgsFromVp(argc, vp); + JS::RootedObject hobj(ctx, &args.thisv().toObject()); - JSObject *parent_doc; /* instance of @document_class */ - JSObject *parent_win; /* instance of @window_class */ struct view_state *vs; struct document_view *doc_view; struct form_view *fv; @@ -2886,56 +2898,64 @@ form_set_property_target(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid /* This can be called if @obj if not itself an instance of the * appropriate class but has one in its prototype chain. Fail * such calls. */ - if (!JS_InstanceOf(ctx, obj, &form_class, NULL)) - return JS_FALSE; - parent_doc = JS_GetParent(obj); + if (!JS_InstanceOf(ctx, hobj, &form_class, NULL)) + return false; + + JS::RootedObject parent_doc(ctx, JS_GetParent(hobj)); assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); - if_assert_failed return JS_FALSE; - parent_win = JS_GetParent(parent_doc); + if_assert_failed return false; + + JS::RootedObject parent_win(ctx, JS_GetParent(parent_doc)); assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); - if_assert_failed return JS_FALSE; + if_assert_failed return false; vs = JS_GetInstancePrivate(ctx, parent_win, &window_class, NULL); + if (!vs) { + return false; + } doc_view = vs->doc_view; - fv = form_get_form_view(ctx, obj, NULL); - if (!fv) return JS_FALSE; /* detached */ + fv = form_get_form_view(ctx, hobj, NULL); + if (!fv) return false; /* detached */ form = find_form_by_form_view(doc_view->document, fv); assert(form); - mem_free_set(&form->target, stracpy(jsval_to_string(ctx, vp))); + mem_free_set(&form->target, stracpy(JS_EncodeString(ctx, args[0].toString()))); - return JS_TRUE; + return true; } /* @form_funcs{"reset"} */ -static JSBool +static bool form_reset(JSContext *ctx, unsigned int argc, jsval *rval) { jsval val; - JSObject *parent_doc; /* instance of @document_class */ - JSObject *parent_win; /* instance of @window_class */ + JS::RootedObject parent_doc(ctx); /* instance of @document_class */ + JS::RootedObject parent_win(ctx); /* instance of @window_class */ JSObject *obj = JS_THIS_OBJECT(ctx, rval); - jsval *argv = JS_ARGV(ctx, rval); + JS::RootedObject hobj(ctx, obj); + JS::CallArgs args = JS::CallArgsFromVp(argc, rval); +// jsval *argv = JS_ARGV(ctx, rval); struct view_state *vs; struct document_view *doc_view; struct form_view *fv; struct form *form; - if (!JS_InstanceOf(ctx, obj, &form_class, argv)) return JS_FALSE; + if (!JS_InstanceOf(ctx, hobj, &form_class, &args)) return false; parent_doc = JS_GetParent(obj); assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); - if_assert_failed return JS_FALSE; + if_assert_failed return false; parent_win = JS_GetParent(parent_doc); assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); - if_assert_failed return JS_FALSE; + if_assert_failed return false; vs = JS_GetInstancePrivate(ctx, parent_win, &window_class, NULL); doc_view = vs->doc_view; - fv = form_get_form_view(ctx, obj, argv); - if (!fv) return JS_FALSE; /* detached */ +/// fv = form_get_form_view(ctx, obj, argv); + fv = form_get_form_view(ctx, obj, rval); + if (!fv) return false; /* detached */ form = find_form_by_form_view(doc_view->document, fv); assert(form); @@ -2943,50 +2963,51 @@ form_reset(JSContext *ctx, unsigned int argc, jsval *rval) do_reset_form(doc_view, form); draw_forms(doc_view->session->tab->term, doc_view); - boolean_to_jsval(ctx, &val, 0); - JS_SET_RVAL(ctx, rval, val); + args.rval().setBoolean(false); - return JS_TRUE; + return true; } /* @form_funcs{"submit"} */ -static JSBool +static bool form_submit(JSContext *ctx, unsigned int argc, jsval *rval) { jsval val; - JSObject *parent_doc; /* instance of @document_class */ - JSObject *parent_win; /* instance of @window_class */ + JS::RootedObject parent_doc(ctx); /* instance of @document_class */ + JS::RootedObject parent_win(ctx); /* instance of @window_class */ JSObject *obj = JS_THIS_OBJECT(ctx, rval); - jsval *argv = JS_ARGV(ctx, rval); + JS::RootedObject hobj(ctx, obj); + JS::CallArgs args = JS::CallArgsFromVp(argc, rval); +// jsval *argv = JS_ARGV(ctx, rval); struct view_state *vs; struct document_view *doc_view; struct session *ses; struct form_view *fv; struct form *form; - if (!JS_InstanceOf(ctx, obj, &form_class, argv)) return JS_FALSE; + if (!JS_InstanceOf(ctx, hobj, &form_class, &args)) return false; parent_doc = JS_GetParent(obj); assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); - if_assert_failed return JS_FALSE; + if_assert_failed return false; parent_win = JS_GetParent(parent_doc); assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); - if_assert_failed return JS_FALSE; + if_assert_failed return false; vs = JS_GetInstancePrivate(ctx, parent_win, &window_class, NULL); doc_view = vs->doc_view; ses = doc_view->session; - fv = form_get_form_view(ctx, obj, argv); - if (!fv) return JS_FALSE; /* detached */ +// fv = form_get_form_view(ctx, obj, argv); + fv = form_get_form_view(ctx, obj, rval); + if (!fv) return false; /* detached */ form = find_form_by_form_view(doc_view->document, fv); assert(form); submit_given_form(ses, doc_view, form, 0); - boolean_to_jsval(ctx, &val, 0); - JS_SET_RVAL(ctx, rval, val); + args.rval().setBoolean(false); - return JS_TRUE; + return true; } JSObject * @@ -2995,8 +3016,9 @@ get_form_object(JSContext *ctx, JSObject *jsdoc, struct form_view *fv) JSObject *jsform = fv->ecmascript_obj; if (jsform) { + JS::RootedObject r_jsform(ctx, jsform); /* This assumes JS_GetInstancePrivate cannot GC. */ - assert(JS_GetInstancePrivate(ctx, jsform, + assert(JS_GetInstancePrivate(ctx, r_jsform, &form_class, NULL) == fv); if_assert_failed return NULL; @@ -3004,13 +3026,15 @@ get_form_object(JSContext *ctx, JSObject *jsdoc, struct form_view *fv) return jsform; } + JS::RootedObject r_jsdoc(ctx, jsdoc); /* jsdoc ('document') is fv's parent */ /* FIXME: That is NOT correct since the real containing element * should be its parent, but gimme DOM first. --pasky */ - jsform = JS_NewObject(ctx, &form_class, NULL, jsdoc); + jsform = JS_NewObject(ctx, &form_class, JS::NullPtr(), r_jsdoc); if (jsform == NULL) return NULL; - JS_DefineProperties(ctx, jsform, form_props); + JS::RootedObject r_jsform(ctx, jsform); + JS_DefineProperties(ctx, r_jsform, form_props); spidermonkey_DefineFunctions(ctx, jsform, form_funcs); JS_SetPrivate(jsform, fv); /* to @form_class */ @@ -3044,6 +3068,7 @@ spidermonkey_detach_form_view(struct form_view *fv) JSObject *jsform = fv->ecmascript_obj; if (jsform) { + JS::RootedObject r_jsform(spidermonkey_empty_context, jsform); /* This assumes JS_GetInstancePrivate and JS_SetPrivate * cannot GC. */ @@ -3052,7 +3077,7 @@ spidermonkey_detach_form_view(struct form_view *fv) * crashes seem possible either way. Resetting it is * easiest. */ assert(JS_GetInstancePrivate(spidermonkey_empty_context, - jsform, + r_jsform, &form_class, NULL) == fv); if_assert_failed {} @@ -3063,8 +3088,8 @@ spidermonkey_detach_form_view(struct form_view *fv) } -static JSBool forms_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); -static JSBool forms_get_property_length(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); +static bool forms_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); +static bool forms_get_property_length(JSContext *ctx, unsigned int argc, jsval *vp); /* Each @forms_class object must have a @document_class parent. */ JSClass forms_class = { @@ -3075,9 +3100,9 @@ JSClass forms_class = { JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, NULL }; -static JSBool forms_item(JSContext *ctx, unsigned int argc, jsval *rval); -static JSBool forms_item2(JSContext *ctx, JSObject *obj, unsigned int argc, jsval *argv, jsval *rval); -static JSBool forms_namedItem(JSContext *ctx, unsigned int argc, jsval *rval); +static bool forms_item(JSContext *ctx, unsigned int argc, jsval *rval); +static bool forms_item2(JSContext *ctx, JSObject *obj, unsigned int argc, jsval *argv, jsval *rval); +static bool forms_namedItem(JSContext *ctx, unsigned int argc, jsval *rval); const spidermonkeyFunctionSpec forms_funcs[] = { { "item", forms_item, 1 }, @@ -3093,7 +3118,7 @@ enum forms_prop { JSP_FORMS_LENGTH = -1, }; JSPropertySpec forms_props[] = { - { "length", 0, JSPROP_ENUMERATE | JSPROP_READONLY|JSPROP_SHARED, JSOP_WRAPPER(forms_get_property_length), JSOP_NULLWRAPPER}, + JS_PSG("length", forms_get_property_length, JSPROP_ENUMERATE), { NULL } }; @@ -3103,9 +3128,8 @@ JSPropertySpec forms_props[] = { static void find_form_by_name(JSContext *ctx, JSObject *jsdoc, struct document_view *doc_view, - jsval name, jsval *rval) + unsigned char *string, jsval *rval) { - unsigned char *string = jsval_to_string(ctx, &name); struct form *form; if (!*string) @@ -3121,31 +3145,31 @@ find_form_by_name(JSContext *ctx, JSObject *jsdoc, } /* @forms_class.getProperty */ -static JSBool +static bool forms_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS jsid id = hid.get(); jsval idval; - JSObject *parent_doc; /* instance of @document_class */ - JSObject *parent_win; /* instance of @window_class */ + JS::RootedObject parent_doc(ctx); /* instance of @document_class */ + JS::RootedObject parent_win(ctx); /* instance of @window_class */ struct view_state *vs; struct document_view *doc_view; /* This can be called if @obj if not itself an instance of the * appropriate class but has one in its prototype chain. Fail * such calls. */ - if (!JS_InstanceOf(ctx, obj, &forms_class, NULL)) - return JS_FALSE; + if (!JS_InstanceOf(ctx, hobj, &forms_class, NULL)) + return false; parent_doc = JS_GetParent(obj); assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); - if_assert_failed return JS_FALSE; + if_assert_failed return false; parent_win = JS_GetParent(parent_doc); assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); - if_assert_failed return JS_FALSE; + if_assert_failed return false; vs = JS_GetInstancePrivate(ctx, parent_win, &window_class, NULL); @@ -3158,32 +3182,34 @@ forms_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS:: strtoll(string, &end, 10); if (end) { + JS::RootedValue r_idval(ctx, idval); /* When SMJS evaluates forms.namedItem("foo"), it first * calls forms_get_property with id = JSString "namedItem" * and *vp = JSObject JSFunction forms_namedItem. * If we don't find a form whose name is id, * we must leave *vp unchanged here, to avoid * "TypeError: forms.namedItem is not a function". */ - JS_IdToValue(ctx, id, &idval); - find_form_by_name(ctx, parent_doc, doc_view, idval, vp); + JS_IdToValue(ctx, id, &r_idval); + unsigned char *string = JS_EncodeString(ctx, JS::ToString(ctx, r_idval)); + find_form_by_name(ctx, parent_doc, doc_view, string, vp); - return JS_TRUE; + return true; } } /* Array index. */ - JS_IdToValue(ctx, id, &idval); + JS::RootedValue r_idval(ctx, idval); + JS_IdToValue(ctx, id, &r_idval); forms_item2(ctx, obj, 1, &idval, vp); - return JS_TRUE; + return true; } -static JSBool -forms_get_property_length(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) +static bool +forms_get_property_length(JSContext *ctx, unsigned int argc, jsval *vp) { - ELINKS_CAST_PROP_PARAMS + JS::CallArgs args = CallArgsFromVp(argc, vp); + JS::RootedObject hobj(ctx, &args.thisv().toObject()); - JSObject *parent_doc; /* instance of @document_class */ - JSObject *parent_win; /* instance of @window_class */ struct view_state *vs; struct document_view *doc_view; struct document *document; @@ -3191,68 +3217,76 @@ forms_get_property_length(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hi /* This can be called if @obj if not itself an instance of the * appropriate class but has one in its prototype chain. Fail * such calls. */ - if (!JS_InstanceOf(ctx, obj, &forms_class, NULL)) - return JS_FALSE; + if (!JS_InstanceOf(ctx, hobj, &forms_class, NULL)) + return false; - parent_doc = JS_GetParent(obj); + JS::RootedObject parent_doc(ctx, JS_GetParent(hobj)); assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); - if_assert_failed return JS_FALSE; + if_assert_failed return false; - parent_win = JS_GetParent(parent_doc); + JS::RootedObject parent_win(ctx, JS_GetParent(parent_doc)); assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); - if_assert_failed return JS_FALSE; + if_assert_failed return false; vs = JS_GetInstancePrivate(ctx, parent_win, &window_class, NULL); + if (!vs) { + return false; + } doc_view = vs->doc_view; document = doc_view->document; - int_to_jsval(ctx, vp, list_size(&document->forms)); + args.rval().setInt32(list_size(&document->forms)); - return JS_TRUE; + return true; } /* @forms_funcs{"item"} */ -static JSBool +static bool forms_item(JSContext *ctx, unsigned int argc, jsval *rval) { jsval val = JSVAL_VOID; JSObject *obj = JS_THIS_OBJECT(ctx, rval); - jsval *argv = JS_ARGV(ctx, rval); - JSBool ret = forms_item2(ctx, obj, argc, argv, &val); + JS::CallArgs args = JS::CallArgsFromVp(argc, rval); +// jsval *argv = JS_ARGV(ctx, rval); + bool ret = forms_item2(ctx, obj, argc, rval, &val); + + args.rval().set(val); - JS_SET_RVAL(ctx, rval, val); return ret; } -static JSBool +static bool forms_item2(JSContext *ctx, JSObject *obj, unsigned int argc, jsval *argv, jsval *rval) { - JSObject *parent_doc; /* instance of @document_class */ - JSObject *parent_win; /* instance of @window_class */ + JS::RootedObject parent_doc(ctx); /* instance of @document_class */ + JS::RootedObject parent_win(ctx); /* instance of @window_class */ struct view_state *vs; struct form_view *fv; int counter = -1; int index; - if (!JS_InstanceOf(ctx, obj, &forms_class, argv)) - return JS_FALSE; + JS::RootedObject hobj(ctx, obj); + JS::CallArgs args = JS::CallArgsFromVp(argc, argv); + + if (!JS_InstanceOf(ctx, hobj, &forms_class, &args)) + return false; parent_doc = JS_GetParent(obj); assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); - if_assert_failed return JS_FALSE; + if_assert_failed return false; parent_win = JS_GetParent(parent_doc); assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); - if_assert_failed return JS_FALSE; + if_assert_failed return false; vs = JS_GetInstancePrivate(ctx, parent_win, &window_class, NULL); if (argc != 1) - return JS_TRUE; + return true; - if (!JS_ValueToInt32(ctx, argv[0], &index)) - return JS_FALSE; + if (!JS::ToInt32(ctx, args[0], &index)) + return false; undef_to_jsval(ctx, rval); @@ -3264,40 +3298,46 @@ forms_item2(JSContext *ctx, JSObject *obj, unsigned int argc, jsval *argv, jsval } } - return JS_TRUE; + return true; } /* @forms_funcs{"namedItem"} */ -static JSBool +static bool forms_namedItem(JSContext *ctx, unsigned int argc, jsval *rval) { jsval val; - JSObject *parent_doc; /* instance of @document_class */ - JSObject *parent_win; /* instance of @window_class */ + JS::RootedObject parent_doc(ctx); /* instance of @document_class */ + JS::RootedObject parent_win(ctx); /* instance of @window_class */ JSObject *obj = JS_THIS_OBJECT(ctx, rval); - jsval *argv = JS_ARGV(ctx, rval); + JS::CallArgs args = JS::CallArgsFromVp(argc, rval); +// jsval *argv = JS_ARGV(ctx, rval); struct view_state *vs; struct document_view *doc_view; - if (!JS_InstanceOf(ctx, obj, &forms_class, argv)) return JS_FALSE; + JS::RootedObject hobj(ctx, obj); + + if (!JS_InstanceOf(ctx, hobj, &forms_class, &args)) return false; parent_doc = JS_GetParent(obj); assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); - if_assert_failed return JS_FALSE; + if_assert_failed return false; parent_win = JS_GetParent(parent_doc); assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); - if_assert_failed return JS_FALSE; + if_assert_failed return false; vs = JS_GetInstancePrivate(ctx, parent_win, &window_class, NULL); doc_view = vs->doc_view; if (argc != 1) - return JS_TRUE; + return true; undef_to_jsval(ctx, &val); - find_form_by_name(ctx, parent_doc, doc_view, argv[0], &val); - JS_SET_RVAL(ctx, rval, val); - return JS_TRUE; + unsigned char *string = JS_EncodeString(ctx, args[0].toString()); + + find_form_by_name(ctx, parent_doc, doc_view, string, &val); + args.rval().set(val); + + return true; } @@ -3330,26 +3370,27 @@ unicode_to_jsstring(JSContext *ctx, unicode_val_T u) /* Convert the string *@vp to an access key. Return 0 for no access * key, UCS_NO_CHAR on error, or the access key otherwise. */ static unicode_val_T -jsval_to_accesskey(JSContext *ctx, jsval *vp) +jsval_to_accesskey(JSContext *ctx, JS::MutableHandleValue hvp) { size_t len; - const char *chr; + const jschar *chr; - /* Convert the value in place, to protect the result from GC. */ - if (JS_ConvertValue(ctx, *vp, JSTYPE_STRING, vp) == JS_FALSE) - return UCS_NO_CHAR; - len = JS_GetStringEncodingLength(ctx, JSVAL_TO_STRING(*vp)); - chr = JS_EncodeString(ctx, JSVAL_TO_STRING(*vp)); + JSString *str = JS::ToString(ctx, hvp); + + len = JS_GetStringLength(str); + chr = JS_GetStringCharsZ(ctx, str); /* This implementation ignores extra characters in the string. */ if (len < 1) return 0; /* which means no access key */ - if (!is_utf16_surrogate(chr[0])) + if (!is_utf16_surrogate(chr[0])) { return chr[0]; + } if (len >= 2 && is_utf16_high_surrogate(chr[0]) - && is_utf16_low_surrogate(chr[1])) + && is_utf16_low_surrogate(chr[1])) { return join_utf16_surrogates(chr[0], chr[1]); + } JS_ReportError(ctx, "Invalid UTF-16 sequence"); return UCS_NO_CHAR; /* which the caller will reject */ } diff --git a/src/ecmascript/spidermonkey/heartbeat.c b/src/ecmascript/spidermonkey/heartbeat.c index 5eb2830b..e66d0f49 100644 --- a/src/ecmascript/spidermonkey/heartbeat.c +++ b/src/ecmascript/spidermonkey/heartbeat.c @@ -30,17 +30,17 @@ static INIT_LIST_OF(struct heartbeat, heartbeats); static struct itimerval heartbeat_timer = { { 1, 0 }, { 1, 0 } }; -/* This callback is installed by JS_SetOperationCallback and triggered - * by JS_TriggerOperationCallback in the heartbeat code below. Returning - * JS_FALSE terminates script execution immediately. */ -JSBool +/* This callback is installed by JS_SetInterruptCallback and triggered + * by JS_RequestInterruptCallback in the heartbeat code below. Returning + * false terminates script execution immediately. */ +bool heartbeat_callback(JSContext *ctx) { - return JS_FALSE; + return false; } /* Callback for SIGVTALRM. Go through all heartbeats, decrease each - * one's TTL, and call JS_TriggerOperationCallback if a heartbeat's TTL + * one's TTL, and call JS_RequestInterruptCallback if a heartbeat's TTL * goes to 0. */ static void check_heartbeats(void *data) @@ -63,7 +63,7 @@ check_heartbeats(void *data) ecmascript_timeout_dialog(term, max_exec_time); } - JS_TriggerOperationCallback(JS_GetRuntime(hb->interpreter->backend_data)); + JS_RequestInterruptCallback(JS_GetRuntime(hb->interpreter->backend_data)); } } install_signal_handler(SIGVTALRM, check_heartbeats, NULL, 1); diff --git a/src/ecmascript/spidermonkey/heartbeat.h b/src/ecmascript/spidermonkey/heartbeat.h index f7c8b127..079e0498 100644 --- a/src/ecmascript/spidermonkey/heartbeat.h +++ b/src/ecmascript/spidermonkey/heartbeat.h @@ -19,6 +19,6 @@ struct heartbeat { struct heartbeat *add_heartbeat(struct ecmascript_interpreter *interpreter); void done_heartbeat(struct heartbeat *hb); -JSBool heartbeat_callback(JSContext *ctx); +bool heartbeat_callback(JSContext *ctx); #endif diff --git a/src/ecmascript/spidermonkey/location.c b/src/ecmascript/spidermonkey/location.c index 33cc6b1d..7e1cbc5b 100644 --- a/src/ecmascript/spidermonkey/location.c +++ b/src/ecmascript/spidermonkey/location.c @@ -45,9 +45,9 @@ #include "viewer/text/vs.h" -static JSBool history_back(JSContext *ctx, unsigned int argc, jsval *rval); -static JSBool history_forward(JSContext *ctx, unsigned int argc, jsval *rval); -static JSBool history_go(JSContext *ctx, unsigned int argc, jsval *rval); +static bool history_back(JSContext *ctx, unsigned int argc, jsval *rval); +static bool history_forward(JSContext *ctx, unsigned int argc, jsval *rval); +static bool history_go(JSContext *ctx, unsigned int argc, jsval *rval); JSClass history_class = { "history", @@ -65,12 +65,13 @@ const spidermonkeyFunctionSpec history_funcs[] = { }; /* @history_funcs{"back"} */ -static JSBool +static bool history_back(JSContext *ctx, unsigned int argc, jsval *rval) { struct ecmascript_interpreter *interpreter = JS_GetContextPrivate(ctx); struct document_view *doc_view = interpreter->vs->doc_view; struct session *ses = doc_view->session; + JS::CallArgs args = JS::CallArgsFromVp(argc, rval); go_back(ses); @@ -78,39 +79,42 @@ history_back(JSContext *ctx, unsigned int argc, jsval *rval) * and return non zero for to prevent * "calculating" new link. Returned value 2 is changed to 0 in function * spidermonkey_eval_boolback */ - JS_SET_RVAL(ctx, rval, JSVAL_NULL); + args.rval().setNull(); return 2; } /* @history_funcs{"forward"} */ -static JSBool +static bool history_forward(JSContext *ctx, unsigned int argc, jsval *rval) { struct ecmascript_interpreter *interpreter = JS_GetContextPrivate(ctx); struct document_view *doc_view = interpreter->vs->doc_view; struct session *ses = doc_view->session; + JS::CallArgs args = JS::CallArgsFromVp(argc, rval); go_unback(ses); - JS_SET_RVAL(ctx, rval, JSVAL_NULL); + args.rval().setNull(); return 2; } /* @history_funcs{"go"} */ -static JSBool +static bool history_go(JSContext *ctx, unsigned int argc, jsval *rval) { struct ecmascript_interpreter *interpreter = JS_GetContextPrivate(ctx); struct document_view *doc_view = interpreter->vs->doc_view; struct session *ses = doc_view->session; - jsval *argv = JS_ARGV(ctx, rval); + JS::CallArgs args = JS::CallArgsFromVp(argc, rval); + +// jsval *argv = JS_ARGV(ctx, rval); int index; struct location *loc; if (argc != 1) - return JS_TRUE; + return true; - index = atol(jsval_to_string(ctx, &argv[0])); + index = atol(jsval_to_string(ctx, args[0].address())); for (loc = cur_loc(ses); loc != (struct location *) &ses->history.history; @@ -123,13 +127,13 @@ history_go(JSContext *ctx, unsigned int argc, jsval *rval) index += index > 0 ? -1 : 1; } - JS_SET_RVAL(ctx, rval, JSVAL_NULL); + args.rval().setNull(); return 2; } -static JSBool location_get_property_href(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); -static JSBool location_set_property_href(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp); +static bool location_get_property_href(JSContext *ctx, unsigned int argc, jsval *vp); +static bool location_set_property_href(JSContext *ctx, unsigned int argc, jsval *vp); /* Each @location_class object must have a @window_class parent. */ JSClass location_class = { @@ -148,63 +152,79 @@ enum location_prop { JSP_LOC_HREF = -1, }; JSPropertySpec location_props[] = { - { "href", 0, JSPROP_ENUMERATE|JSPROP_SHARED, JSOP_WRAPPER(location_get_property_href), JSOP_WRAPPER(location_set_property_href) }, + JS_PSGS("href", location_get_property_href, location_set_property_href, JSPROP_ENUMERATE), { NULL } }; -static JSBool -location_get_property_href(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) +static bool +location_get_property_href(JSContext *ctx, unsigned int argc, jsval *vp) { - ELINKS_CAST_PROP_PARAMS + JS::CallArgs args = CallArgsFromVp(argc, vp); + JS::RootedObject hobj(ctx, &args.thisv().toObject()); - JSObject *parent_win; /* instance of @window_class */ struct view_state *vs; /* This can be called if @obj if not itself an instance of the * appropriate class but has one in its prototype chain. Fail * such calls. */ - if (!JS_InstanceOf(ctx, obj, &location_class, NULL)) - return JS_FALSE; - parent_win = JS_GetParent(obj); + if (!JS_InstanceOf(ctx, hobj, &location_class, NULL)) + return false; + + JS::RootedObject parent_win(ctx, JS_GetParent(hobj)); assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); - if_assert_failed return JS_FALSE; + if_assert_failed return false; vs = JS_GetInstancePrivate(ctx, parent_win, &window_class, NULL); + if (!vs) { + return false; + } - astring_to_jsval(ctx, vp, get_uri_string(vs->uri, URI_ORIGINAL)); + unsigned char *str = get_uri_string(vs->uri, URI_ORIGINAL); - return JS_TRUE; + if (!str) { + return false; + } + + args.rval().setString(JS_NewStringCopyZ(ctx, str)); + mem_free(str); + + return true; } -static JSBool -location_set_property_href(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp) +static bool +location_set_property_href(JSContext *ctx, unsigned int argc, jsval *vp) { - ELINKS_CAST_PROP_PARAMS - JSObject *parent_win; /* instance of @window_class */ + JS::CallArgs args = CallArgsFromVp(argc, vp); + JS::RootedObject hobj(ctx, &args.thisv().toObject()); + struct view_state *vs; struct document_view *doc_view; /* This can be called if @obj if not itself an instance of the * appropriate class but has one in its prototype chain. Fail * such calls. */ - if (!JS_InstanceOf(ctx, obj, &location_class, NULL)) - return JS_FALSE; - parent_win = JS_GetParent(obj); + if (!JS_InstanceOf(ctx, hobj, &location_class, NULL)) + return false; + + JS::RootedObject parent_win(ctx, JS_GetParent(hobj)); assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); - if_assert_failed return JS_FALSE; + if_assert_failed return false; vs = JS_GetInstancePrivate(ctx, parent_win, &window_class, NULL); + if (!vs) { + return; + } doc_view = vs->doc_view; - location_goto(doc_view, jsval_to_string(ctx, vp)); + location_goto(doc_view, JS_EncodeString(ctx, args[0].toString())); - return JS_TRUE; + return true; } -static JSBool location_toString(JSContext *ctx, unsigned int argc, jsval *rval); +static bool location_toString(JSContext *ctx, unsigned int argc, jsval *rval); const spidermonkeyFunctionSpec location_funcs[] = { { "toString", location_toString, 0 }, @@ -213,14 +233,17 @@ const spidermonkeyFunctionSpec location_funcs[] = { }; /* @location_funcs{"toString"}, @location_funcs{"toLocaleString"} */ -static JSBool +static bool location_toString(JSContext *ctx, unsigned int argc, jsval *rval) { jsval val; JSObject *obj = JS_THIS_OBJECT(ctx, rval); - JSBool ret = JS_GetProperty(ctx, obj, "href", &val); + JS::CallArgs args = JS::CallArgsFromVp(argc, rval); + JS::RootedObject hobj(ctx, obj); + JS::RootedValue r_val(ctx, val); + bool ret = JS_GetProperty(ctx, hobj, "href", &r_val); - JS_SET_RVAL(ctx, rval, val); + args.rval().set(val); return ret; } diff --git a/src/ecmascript/spidermonkey/navigator.c b/src/ecmascript/spidermonkey/navigator.c index 57f2dcce..e6bd4b12 100644 --- a/src/ecmascript/spidermonkey/navigator.c +++ b/src/ecmascript/spidermonkey/navigator.c @@ -44,12 +44,12 @@ #include "viewer/text/vs.h" -static JSBool navigator_get_property_appCodeName(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); -static JSBool navigator_get_property_appName(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); -static JSBool navigator_get_property_appVersion(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); -static JSBool navigator_get_property_language(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); -static JSBool navigator_get_property_platform(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); -static JSBool navigator_get_property_userAgent(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); +static bool navigator_get_property_appCodeName(JSContext *ctx, unsigned int argc, jsval *vp); +static bool navigator_get_property_appName(JSContext *ctx, unsigned int argc, jsval *vp); +static bool navigator_get_property_appVersion(JSContext *ctx, unsigned int argc, jsval *vp); +static bool navigator_get_property_language(JSContext *ctx, unsigned int argc, jsval *vp); +static bool navigator_get_property_platform(JSContext *ctx, unsigned int argc, jsval *vp); +static bool navigator_get_property_userAgent(JSContext *ctx, unsigned int argc, jsval *vp); JSClass navigator_class = { "navigator", @@ -74,83 +74,76 @@ enum navigator_prop { JSP_NAVIGATOR_USER_AGENT = -8, }; JSPropertySpec navigator_props[] = { - { "appCodeName",0, JSPROP_ENUMERATE | JSPROP_READONLY|JSPROP_SHARED, JSOP_WRAPPER(navigator_get_property_appCodeName), JSOP_NULLWRAPPER }, - { "appName", 0, JSPROP_ENUMERATE | JSPROP_READONLY|JSPROP_SHARED, JSOP_WRAPPER(navigator_get_property_appName), JSOP_NULLWRAPPER }, - { "appVersion", 0, JSPROP_ENUMERATE | JSPROP_READONLY|JSPROP_SHARED, JSOP_WRAPPER(navigator_get_property_appVersion), JSOP_NULLWRAPPER }, - { "language", 0, JSPROP_ENUMERATE | JSPROP_READONLY|JSPROP_SHARED, JSOP_WRAPPER(navigator_get_property_language), JSOP_NULLWRAPPER }, - { "platform", 0, JSPROP_ENUMERATE | JSPROP_READONLY|JSPROP_SHARED, JSOP_WRAPPER(navigator_get_property_platform), JSOP_NULLWRAPPER }, - { "userAgent", 0, JSPROP_ENUMERATE | JSPROP_READONLY|JSPROP_SHARED, JSOP_WRAPPER(navigator_get_property_userAgent), JSOP_NULLWRAPPER }, + JS_PSG("appCodeName", navigator_get_property_appCodeName, JSPROP_ENUMERATE), + JS_PSG("appName", navigator_get_property_appName, JSPROP_ENUMERATE), + JS_PSG("appVersion", navigator_get_property_appVersion, JSPROP_ENUMERATE), + JS_PSG("language", navigator_get_property_language, JSPROP_ENUMERATE), + JS_PSG("platform", navigator_get_property_platform, JSPROP_ENUMERATE), + JS_PSG("userAgent", navigator_get_property_userAgent, JSPROP_ENUMERATE), { NULL } }; /* @navigator_class.getProperty */ -static JSBool -navigator_get_property_appCodeName(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) +static bool +navigator_get_property_appCodeName(JSContext *ctx, unsigned int argc, jsval *vp) { - ELINKS_CAST_PROP_PARAMS - (void)obj; + JS::CallArgs args = CallArgsFromVp(argc, vp); + args.rval().setString(JS_NewStringCopyZ(ctx, "Mozilla")); /* More like a constant nowadays. */ - string_to_jsval(ctx, vp, "Mozilla"); /* More like a constant nowadays. */ - - return JS_TRUE; + return true; } -static JSBool -navigator_get_property_appName(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) +static bool +navigator_get_property_appName(JSContext *ctx, unsigned int argc, jsval *vp) { - ELINKS_CAST_PROP_PARAMS - (void)obj; + JS::CallArgs args = CallArgsFromVp(argc, vp); + args.rval().setString(JS_NewStringCopyZ(ctx, + "ELinks (roughly compatible with Netscape Navigator, Mozilla and Microsoft Internet Explorer)")); - string_to_jsval(ctx, vp, "ELinks (roughly compatible with Netscape Navigator, Mozilla and Microsoft Internet Explorer)"); - - return JS_TRUE; + return true; } -static JSBool -navigator_get_property_appVersion(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) +static bool +navigator_get_property_appVersion(JSContext *ctx, unsigned int argc, jsval *vp) { - ELINKS_CAST_PROP_PARAMS - (void)obj; + JS::CallArgs args = CallArgsFromVp(argc, vp); + args.rval().setString(JS_NewStringCopyZ(ctx, VERSION)); - string_to_jsval(ctx, vp, VERSION); - - return JS_TRUE; + return true; } -static JSBool -navigator_get_property_language(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) +static bool +navigator_get_property_language(JSContext *ctx, unsigned int argc, jsval *vp) { - ELINKS_CAST_PROP_PARAMS - (void)obj; + JS::CallArgs args = CallArgsFromVp(argc, vp); - undef_to_jsval(ctx, vp); #ifdef CONFIG_NLS - if (get_opt_bool("protocol.http.accept_ui_language", NULL)) - string_to_jsval(ctx, vp, language_to_iso639(current_language)); - + if (get_opt_bool("protocol.http.accept_ui_language", NULL)) { + args.rval().setString(JS_NewStringCopyZ(ctx, language_to_iso639(current_language))); + return true; + } #endif - return JS_TRUE; + args.rval().setUndefined(); + + return true; } -static JSBool -navigator_get_property_platform(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) +static bool +navigator_get_property_platform(JSContext *ctx, unsigned int argc, jsval *vp) { - ELINKS_CAST_PROP_PARAMS - (void)obj; + JS::CallArgs args = CallArgsFromVp(argc, vp); + args.rval().setString(JS_NewStringCopyZ(ctx, system_name)); - string_to_jsval(ctx, vp, system_name); - - return JS_TRUE; + return true; } -static JSBool -navigator_get_property_userAgent(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) +static bool +navigator_get_property_userAgent(JSContext *ctx, unsigned int argc, jsval *vp) { - ELINKS_CAST_PROP_PARAMS + JS::CallArgs args = CallArgsFromVp(argc, vp); unsigned char *optstr; - (void)obj; optstr = get_opt_str("protocol.http.user_agent", NULL); @@ -173,12 +166,12 @@ navigator_get_property_userAgent(JSContext *ctx, JS::HandleObject hobj, JS::Hand if (ustr) { safe_strncpy(custr, ustr, 256); mem_free(ustr); - string_to_jsval(ctx, vp, custr); + args.rval().setString(JS_NewStringCopyZ(ctx, custr)); - return JS_TRUE; + return true; } } - string_to_jsval(ctx, vp, system_name); + args.rval().setString(JS_NewStringCopyZ(ctx, system_name)); - return JS_TRUE; + return true; } diff --git a/src/ecmascript/spidermonkey/unibar.c b/src/ecmascript/spidermonkey/unibar.c index 2a12829f..a9f1b217 100644 --- a/src/ecmascript/spidermonkey/unibar.c +++ b/src/ecmascript/spidermonkey/unibar.c @@ -44,8 +44,8 @@ #include "viewer/text/link.h" #include "viewer/text/vs.h" -static JSBool unibar_get_property_visible(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); -static JSBool unibar_set_property_visible(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp); +static bool unibar_get_property_visible(JSContext *ctx, unsigned int argc, jsval *vp); +static bool unibar_set_property_visible(JSContext *ctx, unsigned int argc, jsval *vp); /* Each @menubar_class object must have a @window_class parent. */ JSClass menubar_class = { @@ -72,18 +72,18 @@ enum unibar_prop { JSP_UNIBAR_VISIBLE = -1, }; JSPropertySpec unibar_props[] = { - { "visible", 0, JSPROP_ENUMERATE|JSPROP_SHARED, JSOP_WRAPPER(unibar_get_property_visible), JSOP_WRAPPER(unibar_set_property_visible) }, + JS_PSGS("visible", unibar_get_property_visible, unibar_set_property_visible, JSPROP_ENUMERATE), { NULL } }; -static JSBool -unibar_get_property_visible(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) +static bool +unibar_get_property_visible(JSContext *ctx, unsigned int argc, jsval *vp) { - ELINKS_CAST_PROP_PARAMS + JS::CallArgs args = CallArgsFromVp(argc, vp); + JS::RootedObject hobj(ctx, &args.thisv().toObject()); - JSObject *parent_win; /* instance of @window_class */ struct view_state *vs; struct document_view *doc_view; struct session_status *status; @@ -92,45 +92,49 @@ unibar_get_property_visible(JSContext *ctx, JS::HandleObject hobj, JS::HandleId /* This can be called if @obj if not itself an instance of either * appropriate class but has one in its prototype chain. Fail * such calls. */ - if (!JS_InstanceOf(ctx, obj, &menubar_class, NULL) - && !JS_InstanceOf(ctx, obj, &statusbar_class, NULL)) - return JS_FALSE; - parent_win = JS_GetParent(obj); + if (!JS_InstanceOf(ctx, hobj, &menubar_class, NULL) + && !JS_InstanceOf(ctx, hobj, &statusbar_class, NULL)) + return false; + + JS::RootedObject parent_win(ctx, JS_GetParent(hobj)); assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); - if_assert_failed return JS_FALSE; + if_assert_failed return false; vs = JS_GetInstancePrivate(ctx, parent_win, &window_class, NULL); + if (!vs) { + return false; + } doc_view = vs->doc_view; status = &doc_view->session->status; - bar = JS_GetPrivate(obj); /* from @menubar_class or @statusbar_class */ + bar = JS_GetPrivate(hobj); /* from @menubar_class or @statusbar_class */ #define unibar_fetch(bar) \ - boolean_to_jsval(ctx, vp, status->force_show_##bar##_bar >= 0 \ + status->force_show_##bar##_bar >= 0 \ ? status->force_show_##bar##_bar \ - : status->show_##bar##_bar) + : status->show_##bar##_bar switch (*bar) { case 's': - unibar_fetch(status); + args.rval().setBoolean(unibar_fetch(status)); break; case 't': - unibar_fetch(title); + args.rval().setBoolean(unibar_fetch(title)); break; default: - boolean_to_jsval(ctx, vp, 0); + args.rval().setBoolean(false); break; } #undef unibar_fetch - return JS_TRUE; + return true; } -static JSBool -unibar_set_property_visible(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp) +static bool +unibar_set_property_visible(JSContext *ctx, unsigned int argc, jsval *vp) { - ELINKS_CAST_PROP_PARAMS + JS::CallArgs args = CallArgsFromVp(argc, vp); + JS::RootedObject hobj(ctx, &args.thisv().toObject()); - JSObject *parent_win; /* instance of @window_class */ struct view_state *vs; struct document_view *doc_view; struct session_status *status; @@ -139,30 +143,34 @@ unibar_set_property_visible(JSContext *ctx, JS::HandleObject hobj, JS::HandleId /* This can be called if @obj if not itself an instance of either * appropriate class but has one in its prototype chain. Fail * such calls. */ - if (!JS_InstanceOf(ctx, obj, &menubar_class, NULL) - && !JS_InstanceOf(ctx, obj, &statusbar_class, NULL)) - return JS_FALSE; - parent_win = JS_GetParent(obj); + if (!JS_InstanceOf(ctx, hobj, &menubar_class, NULL) + && !JS_InstanceOf(ctx, hobj, &statusbar_class, NULL)) + return false; + + JS::RootedObject parent_win(ctx, JS_GetParent(hobj)); assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); - if_assert_failed return JS_FALSE; + if_assert_failed return false; vs = JS_GetInstancePrivate(ctx, parent_win, &window_class, NULL); + if (!vs) { + return false; + } doc_view = vs->doc_view; status = &doc_view->session->status; - bar = JS_GetPrivate(obj); /* from @menubar_class or @statusbar_class */ + bar = JS_GetPrivate(hobj); /* from @menubar_class or @statusbar_class */ switch (*bar) { case 's': - status->force_show_status_bar = jsval_to_boolean(ctx, vp); + status->force_show_status_bar = args[0].toBoolean(); break; case 't': - status->force_show_title_bar = jsval_to_boolean(ctx, vp); + status->force_show_title_bar = args[0].toBoolean(); break; default: break; } register_bottom_half(update_status, NULL); - return JS_TRUE; + return true; } diff --git a/src/ecmascript/spidermonkey/util.h b/src/ecmascript/spidermonkey/util.h index b02bc20b..19ea364b 100644 --- a/src/ecmascript/spidermonkey/util.h +++ b/src/ecmascript/spidermonkey/util.h @@ -56,25 +56,8 @@ boolean_to_jsval(JSContext *ctx, jsval *vp, int boolean) static inline int jsval_to_boolean(JSContext *ctx, jsval *vp) { - jsval val; - - if (JS_ConvertValue(ctx, *vp, JSTYPE_BOOLEAN, &val) == JS_FALSE) { - return JS_FALSE; - } - - return JSVAL_TO_BOOLEAN(val); -} - -static inline JSObject * -jsval_to_object(JSContext *ctx, jsval *vp) -{ - jsval val; - - if (JS_ConvertValue(ctx, *vp, JSTYPE_OBJECT, &val) == JS_FALSE) { - return NULL; - } - - return JSVAL_TO_OBJECT(val); + JS::RootedValue r_vp(ctx, *vp); + return (int)JS::ToBoolean(r_vp); } #endif diff --git a/src/ecmascript/spidermonkey/window.c b/src/ecmascript/spidermonkey/window.c index 517ab4b8..fffb074f 100644 --- a/src/ecmascript/spidermonkey/window.c +++ b/src/ecmascript/spidermonkey/window.c @@ -44,14 +44,13 @@ #include "viewer/text/vs.h" -static JSBool window_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); -static JSBool window_get_property_closed(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); -static JSBool window_get_property_parent(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); -static JSBool window_get_property_self(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); -static JSBool window_get_property_status(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); -static JSBool window_set_property_status(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp); -static JSBool window_get_property_top(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); -static JSBool window_get_property_window(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); +static bool window_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); +static bool window_get_property_closed(JSContext *cx, unsigned int argc, jsval *vp); +static bool window_get_property_parent(JSContext *ctx, unsigned int argc, jsval *vp); +static bool window_get_property_self(JSContext *ctx, unsigned int argc, jsval *vp); +static bool window_get_property_status(JSContext *ctx, unsigned int argc, jsval *vp); +static bool window_set_property_status(JSContext *ctx, unsigned int argc, jsval *vp); +static bool window_get_property_top(JSContext *ctx, unsigned int argc, jsval *vp); JSClass window_class = { "window", @@ -80,12 +79,12 @@ enum window_prop { * assigning to it once), instead we do just a little string * comparing. */ JSPropertySpec window_props[] = { - { "closed", 0, JSPROP_ENUMERATE | JSPROP_READONLY|JSPROP_SHARED, JSOP_WRAPPER(window_get_property_closed), JSOP_NULLWRAPPER }, - { "parent", 0, JSPROP_ENUMERATE | JSPROP_READONLY|JSPROP_SHARED, JSOP_WRAPPER(window_get_property_parent), JSOP_NULLWRAPPER }, - { "self", 0, JSPROP_ENUMERATE | JSPROP_READONLY|JSPROP_SHARED, JSOP_WRAPPER(window_get_property_self), JSOP_NULLWRAPPER }, - { "status", 0, JSPROP_ENUMERATE|JSPROP_SHARED, JSOP_WRAPPER(window_get_property_status), JSOP_WRAPPER(window_set_property_status) }, - { "top", 0, JSPROP_ENUMERATE | JSPROP_READONLY|JSPROP_SHARED, JSOP_WRAPPER(window_get_property_top), JSOP_NULLWRAPPER }, - { "window", 0, JSPROP_ENUMERATE | JSPROP_READONLY|JSPROP_SHARED, JSOP_WRAPPER(window_get_property_window), JSOP_NULLWRAPPER }, + JS_PSG("closed", window_get_property_closed, JSPROP_ENUMERATE), + JS_PSG("parent", window_get_property_parent, JSPROP_ENUMERATE), + JS_PSG("self", window_get_property_self, JSPROP_ENUMERATE), + JS_PSGS("status", window_get_property_status, window_set_property_status, 0), + JS_PSG("top", window_get_property_top, JSPROP_ENUMERATE), + JS_PSG("window", window_get_property_self, JSPROP_ENUMERATE), { NULL } }; @@ -102,7 +101,7 @@ try_resolve_frame(struct document_view *doc_view, unsigned char *id) if (target->vs.ecmascript_fragile) ecmascript_reset_state(&target->vs); if (!target->vs.ecmascript) return NULL; - return JS_GetGlobalForScopeChain(target->vs.ecmascript->backend_data); + return JS::CurrentGlobalOrNull(target->vs.ecmascript->backend_data); } #if 0 @@ -127,7 +126,7 @@ find_child_frame(struct document_view *doc_view, struct frame_desc *tframe) #endif /* @window_class.getProperty */ -static JSBool +static bool window_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS @@ -138,10 +137,10 @@ window_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS: /* This can be called if @obj if not itself an instance of the * appropriate class but has one in its prototype chain. Fail * such calls. */ - if (!JS_InstanceOf(ctx, obj, &window_class, NULL)) - return JS_FALSE; + if (!JS_InstanceOf(ctx, hobj, &window_class, NULL)) + return false; - vs = JS_GetInstancePrivate(ctx, obj, &window_class, NULL); + vs = JS_GetInstancePrivate(ctx, hobj, &window_class, NULL); /* No need for special window.location measurements - when * location is then evaluated in string context, toString() @@ -155,11 +154,11 @@ window_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS: if (obj) { object_to_jsval(ctx, vp, obj); } - return JS_TRUE; + return true; } if (!JSID_IS_INT(id)) - return JS_TRUE; + return true; undef_to_jsval(ctx, vp); @@ -216,7 +215,7 @@ found_parent: } #endif case JSP_WIN_STATUS: - return JS_FALSE; + return false; case JSP_WIN_TOP: { struct document_view *doc_view = vs->doc_view; @@ -228,7 +227,7 @@ found_parent: ecmascript_reset_state(top_view->vs); if (!top_view->vs->ecmascript) break; - newjsframe = JS_GetGlobalForScopeChain(top_view->vs->ecmascript->backend_data); + newjsframe = JS::CurrentGlobalOrNull(top_view->vs->ecmascript->backend_data); /* Keep this unrolled this way. Will have to check document.domain * JS property. */ @@ -247,21 +246,21 @@ found_parent: default: /* Unrecognized integer property ID; someone is using * the object as an array. SMJS builtin classes (e.g. - * js_RegExpClass) just return JS_TRUE in this case + * js_RegExpClass) just return true in this case * and leave *@vp unchanged. Do the same here. * (Actually not quite the same, as we already used * @undef_to_jsval.) */ break; } - return JS_TRUE; + return true; } void location_goto(struct document_view *doc_view, unsigned char *url); -static JSBool window_alert(JSContext *ctx, unsigned int argc, jsval *rval); -static JSBool window_open(JSContext *ctx, unsigned int argc, jsval *rval); -static JSBool window_setTimeout(JSContext *ctx, unsigned int argc, jsval *rval); +static bool window_alert(JSContext *ctx, unsigned int argc, jsval *rval); +static bool window_open(JSContext *ctx, unsigned int argc, jsval *rval); +static bool window_setTimeout(JSContext *ctx, unsigned int argc, jsval *rval); const spidermonkeyFunctionSpec window_funcs[] = { { "alert", window_alert, 1 }, @@ -271,41 +270,44 @@ const spidermonkeyFunctionSpec window_funcs[] = { }; /* @window_funcs{"alert"} */ -static JSBool +static bool window_alert(JSContext *ctx, unsigned int argc, jsval *rval) { jsval val; JSObject *obj = JS_THIS_OBJECT(ctx, rval); - jsval *argv = JS_ARGV(ctx, rval); + JS::RootedObject hobj(ctx, obj); + JS::CallArgs args = JS::CallArgsFromVp(argc, rval); +// jsval *argv = JS_ARGV(ctx, rval); struct view_state *vs; unsigned char *string; - if (!JS_InstanceOf(ctx, obj, &window_class, argv)) return JS_FALSE; + if (!JS_InstanceOf(ctx, hobj, &window_class, &args)) return false; - vs = JS_GetInstancePrivate(ctx, obj, &window_class, argv); + vs = JS_GetInstancePrivate(ctx, hobj, &window_class, &args); if (argc != 1) - return JS_TRUE; + return true; - string = jsval_to_string(ctx, &argv[0]); + string = jsval_to_string(ctx, args[0].address()); if (!*string) - return JS_TRUE; + return true; info_box(vs->doc_view->session->tab->term, MSGBOX_FREE_TEXT, N_("JavaScript Alert"), ALIGN_CENTER, stracpy(string)); - undef_to_jsval(ctx, &val); - JS_SET_RVAL(ctx, rval, val); - return JS_TRUE; + args.rval().setUndefined(); + return true; } /* @window_funcs{"open"} */ -static JSBool +static bool window_open(JSContext *ctx, unsigned int argc, jsval *rval) { jsval val; JSObject *obj = JS_THIS_OBJECT(ctx, rval); - jsval *argv = JS_ARGV(ctx, rval); + JS::RootedObject hobj(ctx, obj); + JS::CallArgs args = JS::CallArgsFromVp(argc, rval); +// jsval *argv = JS_ARGV(ctx, rval); struct view_state *vs; struct document_view *doc_view; struct session *ses; @@ -315,9 +317,9 @@ window_open(JSContext *ctx, unsigned int argc, jsval *rval) static time_t ratelimit_start; static int ratelimit_count; - if (!JS_InstanceOf(ctx, obj, &window_class, argv)) return JS_FALSE; + if (!JS_InstanceOf(ctx, hobj, &window_class, &args)) return false; - vs = JS_GetInstancePrivate(ctx, obj, &window_class, argv); + vs = JS_GetInstancePrivate(ctx, hobj, &window_class, &args); doc_view = vs->doc_view; ses = doc_view->session; @@ -325,10 +327,10 @@ window_open(JSContext *ctx, unsigned int argc, jsval *rval) #ifdef CONFIG_LEDS set_led_value(ses->status.popup_led, 'P'); #endif - return JS_TRUE; + return true; } - if (argc < 1) return JS_TRUE; + if (argc < 1) return true; /* Ratelimit window opening. Recursive window.open() is very nice. * We permit at most 20 tabs in 2 seconds. The ratelimiter is very @@ -339,22 +341,22 @@ window_open(JSContext *ctx, unsigned int argc, jsval *rval) } else { ratelimit_count++; if (ratelimit_count > 20) { - return JS_TRUE; + return true; } } - url = stracpy(jsval_to_string(ctx, &argv[0])); + url = stracpy(jsval_to_string(ctx, args[0].address())); trim_chars(url, ' ', 0); url2 = join_urls(doc_view->document->uri, url); mem_free(url); if (!url2) { - return JS_TRUE; + return true; } if (argc > 1) { - frame = stracpy(jsval_to_string(ctx, &argv[1])); + frame = stracpy(jsval_to_string(ctx, args[1].address())); if (!frame) { mem_free(url2); - return JS_TRUE; + return true; } } @@ -364,7 +366,7 @@ window_open(JSContext *ctx, unsigned int argc, jsval *rval) mem_free(url2); if (!uri) { mem_free_if(frame); - return JS_TRUE; + return true; } if (frame && *frame && c_strcasecmp(frame, "_blank")) { @@ -406,39 +408,41 @@ end: done_uri(uri); mem_free_if(frame); - JS_SET_RVAL(ctx, rval, val); - return JS_TRUE; + args.rval().set(val); + return true; } /* @window_funcs{"setTimeout"} */ -static JSBool +static bool window_setTimeout(JSContext *ctx, unsigned int argc, jsval *rval) { - jsval *argv = JS_ARGV(ctx, rval); + JS::CallArgs args = JS::CallArgsFromVp(argc, rval); +// jsval *argv = JS_ARGV(ctx, rval); struct ecmascript_interpreter *interpreter = JS_GetContextPrivate(ctx); unsigned char *code; int timeout; if (argc != 2) - return JS_TRUE; + return true; - code = jsval_to_string(ctx, &argv[0]); + code = jsval_to_string(ctx, args[0].address()); if (!*code) - return JS_TRUE; + return true; code = stracpy(code); if (!code) - return JS_TRUE; - timeout = atoi(jsval_to_string(ctx, &argv[1])); + return true; + timeout = atoi(jsval_to_string(ctx, args[1].address())); if (timeout <= 0) { mem_free(code); - return JS_TRUE; + return true; } ecmascript_set_timeout(interpreter, code, timeout); - return JS_TRUE; + return true; } -static JSBool +#if 0 +static bool window_get_property_closed(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS @@ -446,24 +450,28 @@ window_get_property_closed(JSContext *ctx, JS::HandleObject hobj, JS::HandleId h /* This can be called if @obj if not itself an instance of the * appropriate class but has one in its prototype chain. Fail * such calls. */ - if (!JS_InstanceOf(ctx, obj, &window_class, NULL)) - return JS_FALSE; + if (!JS_InstanceOf(ctx, hobj, &window_class, NULL)) + return false; boolean_to_jsval(ctx, vp, 0); - return JS_TRUE; + return true; +} +#endif + +static bool +window_get_property_closed(JSContext *ctx, unsigned int argc, jsval *vp) +{ + JS::CallArgs args = CallArgsFromVp(argc, vp); + args.rval().setBoolean(false); + + return true; } -static JSBool -window_get_property_parent(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) +static bool +window_get_property_parent(JSContext *ctx, unsigned int argc, jsval *vp) { - ELINKS_CAST_PROP_PARAMS - - /* This can be called if @obj if not itself an instance of the - * appropriate class but has one in its prototype chain. Fail - * such calls. */ - if (!JS_InstanceOf(ctx, obj, &window_class, NULL)) - return JS_FALSE; + JS::CallArgs args = CallArgsFromVp(argc, vp); /* XXX: It would be nice if the following worked, yes. * The problem is that we get called at the point where @@ -475,93 +483,79 @@ window_get_property_parent(JSContext *ctx, JS::HandleObject hobj, JS::HandleId h /* FIXME: So now we alias window.parent to window.top, which is * INCORRECT but works for the most common cases of just two * frames. Better something than nothing. */ + args.rval().setUndefined(); - undef_to_jsval(ctx, vp); - - return JS_TRUE; + return true; } -static JSBool -window_get_property_self(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) +static bool +window_get_property_self(JSContext *ctx, unsigned int argc, jsval *vp) { - ELINKS_CAST_PROP_PARAMS + JS::CallArgs args = CallArgsFromVp(argc, vp); + args.rval().setObject(args.thisv().toObject()); - /* This can be called if @obj if not itself an instance of the - * appropriate class but has one in its prototype chain. Fail - * such calls. */ - if (!JS_InstanceOf(ctx, obj, &window_class, NULL)) - return JS_FALSE; - - object_to_jsval(ctx, vp, obj); - - return JS_TRUE; + return true; } -static JSBool -window_get_property_status(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) +static bool +window_get_property_status(JSContext *ctx, unsigned int argc, jsval *vp) { - ELINKS_CAST_PROP_PARAMS + JS::CallArgs args = CallArgsFromVp(argc, vp); + args.rval().setUndefined(); - /* This can be called if @obj if not itself an instance of the - * appropriate class but has one in its prototype chain. Fail - * such calls. */ - if (!JS_InstanceOf(ctx, obj, &window_class, NULL)) - return JS_FALSE; - - undef_to_jsval(ctx, vp); - - return JS_TRUE; + return true; } -static JSBool -window_set_property_status(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp) +static bool +window_set_property_status(JSContext *ctx, unsigned int argc, jsval *vp) { - ELINKS_CAST_PROP_PARAMS + JS::CallArgs args = CallArgsFromVp(argc, vp); + if (args.length() != 1) { + return false; + } - struct view_state *vs; + JS::RootedObject hobj(ctx, &args.thisv().toObject()); - /* This can be called if @obj if not itself an instance of the - * appropriate class but has one in its prototype chain. Fail - * such calls. */ - if (!JS_InstanceOf(ctx, obj, &window_class, NULL)) - return JS_FALSE; + struct view_state *vs = JS_GetInstancePrivate(ctx, hobj, &window_class, NULL); - vs = JS_GetInstancePrivate(ctx, obj, &window_class, NULL); + if (!vs) { + return true; + } - mem_free_set(&vs->doc_view->session->status.window_status, stracpy(jsval_to_string(ctx, vp))); + mem_free_set(&vs->doc_view->session->status.window_status, stracpy(JS_EncodeString(ctx, args[0].toString()))); print_screen_status(vs->doc_view->session); - return JS_TRUE; + return true; } -static JSBool -window_get_property_top(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) +static bool +window_get_property_top(JSContext *ctx, unsigned int argc, jsval *vp) { - ELINKS_CAST_PROP_PARAMS + JS::CallArgs args = CallArgsFromVp(argc, vp); struct view_state *vs; struct document_view *doc_view; struct document_view *top_view; JSObject *newjsframe; - /* This can be called if @obj if not itself an instance of the - * appropriate class but has one in its prototype chain. Fail - * such calls. */ - if (!JS_InstanceOf(ctx, obj, &window_class, NULL)) - return JS_FALSE; + JS::RootedObject hobj(ctx, &args.thisv().toObject()); - vs = JS_GetInstancePrivate(ctx, obj, &window_class, NULL); + vs = JS_GetInstancePrivate(ctx, hobj, &window_class, NULL); + + if (!vs) { + return false; + } doc_view = vs->doc_view; top_view = doc_view->session->doc_view; - undef_to_jsval(ctx, vp); - assert(top_view && top_view->vs); if (top_view->vs->ecmascript_fragile) ecmascript_reset_state(top_view->vs); - if (!top_view->vs->ecmascript) - return JS_TRUE; - newjsframe = JS_GetGlobalForScopeChain(top_view->vs->ecmascript->backend_data); + if (!top_view->vs->ecmascript) { + args.rval().setUndefined(); + return true; + } + newjsframe = JS::CurrentGlobalOrNull(top_view->vs->ecmascript->backend_data); /* Keep this unrolled this way. Will have to check document.domain * JS property. */ @@ -569,18 +563,14 @@ window_get_property_top(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, * is alien but some other child window is not, we should still * let the script walk thru. That'd mean moving the check to * other individual properties in this switch. */ - if (compare_uri(vs->uri, top_view->vs->uri, URI_HOST)) - object_to_jsval(ctx, vp, newjsframe); + if (compare_uri(vs->uri, top_view->vs->uri, URI_HOST)) { + args.rval().setObject(*newjsframe); + return true; + } /* else */ /****X*X*X*** SECURITY VIOLATION! RED ALERT, SHIELDS UP! ***X*X*X****\ |* (Pasky was apparently looking at the Links2 JS code . ___ ^.^ *| \* for too long.) `.(,_,)\o/ */ - - return JS_TRUE; -} - -static JSBool -window_get_property_window(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) -{ - return window_get_property_self(ctx, hobj, hid, hvp); + args.rval().setUndefined(); + return true; } From ca24054cc6920b475d56280abcb306f44d256bd2 Mon Sep 17 00:00:00 2001 From: Witold Filipczyk Date: Mon, 12 Oct 2020 18:43:56 +0200 Subject: [PATCH 067/179] [mozjs31] scripting smjs It was not heavily tested. --- src/scripting/smjs/action_object.c | 66 +- src/scripting/smjs/bookmarks.c | 203 ++--- src/scripting/smjs/cache_object.c | 211 +++--- src/scripting/smjs/core.c | 25 +- src/scripting/smjs/elinks_object.c | 214 +++--- src/scripting/smjs/elinks_object.h | 3 +- src/scripting/smjs/global_object.c | 2 +- src/scripting/smjs/globhist.c | 236 +++--- src/scripting/smjs/hooks.c | 27 +- src/scripting/smjs/keybinding.c | 108 +-- src/scripting/smjs/load_uri.c | 45 +- src/scripting/smjs/session_object.c | 976 +++++++++++++++++++++---- src/scripting/smjs/terminal_object.c | 59 +- src/scripting/smjs/view_state_object.c | 94 +-- 14 files changed, 1492 insertions(+), 777 deletions(-) diff --git a/src/scripting/smjs/action_object.c b/src/scripting/smjs/action_object.c index 219e46b4..5af6a213 100644 --- a/src/scripting/smjs/action_object.c +++ b/src/scripting/smjs/action_object.c @@ -24,7 +24,7 @@ struct smjs_action_fn_callback_hop { }; static void smjs_action_fn_finalize(JSFreeOp *op, JSObject *obj); -static JSBool smjs_action_fn_callback(JSContext *ctx, unsigned int argc, jsval *rval); +static bool smjs_action_fn_callback(JSContext *ctx, unsigned int argc, jsval *rval); static const JSClass action_fn_class = { "action_fn", @@ -57,31 +57,31 @@ smjs_action_fn_finalize(JSFreeOp *op, JSObject *obj) } /* @action_fn_class.call */ -static JSBool +static bool smjs_action_fn_callback(JSContext *ctx, unsigned int argc, jsval *rval) { jsval value; - jsval *argv = JS_ARGV(ctx, rval); + JS::CallArgs args = CallArgsFromVp(argc, rval); + struct smjs_action_fn_callback_hop *hop; - JSObject *fn_obj; + JS::RootedObject fn_obj(ctx); assert(smjs_ctx); - if_assert_failed return JS_FALSE; + if_assert_failed return false; - value = JSVAL_FALSE; - - if (JS_TRUE != JS_ValueToObject(ctx, JS_CALLEE(ctx, rval), &fn_obj)) { - JS_SET_RVAL(ctx, rval, value); - return JS_TRUE; +// if (true != JS_ValueToObject(ctx, JS_CALLEE(ctx, rval), &fn_obj)) { + if (true != JS_ValueToObject(ctx, args[0], &fn_obj)) { + args.rval().setBoolean(false); + return true; } assert(JS_InstanceOf(ctx, fn_obj, (JSClass *) &action_fn_class, NULL)); - if_assert_failed return JS_FALSE; + if_assert_failed return false; hop = JS_GetInstancePrivate(ctx, fn_obj, (JSClass *) &action_fn_class, NULL); if (!hop) { - JS_SET_RVAL(ctx, rval, value); - return JS_TRUE; + args.rval().setBoolean(false); + return true; } if (!would_window_receive_keypresses(hop->ses->tab)) { @@ -107,23 +107,21 @@ smjs_action_fn_callback(JSContext *ctx, unsigned int argc, jsval *rval) JS_ReportError(ctx, "%s", _("Cannot run actions in a tab that doesn't " "have the focus", hop->ses->tab->term)); - return JS_FALSE; /* make JS propagate the exception */ + return false; /* make JS propagate the exception */ } if (argc >= 1) { int32_t val; - if (JS_TRUE == JS_ValueToInt32(smjs_ctx, argv[0], &val)) { + if (true == JS::ToInt32(smjs_ctx, args[0], &val)) { set_kbd_repeat_count(hop->ses, val); } } do_action(hop->ses, hop->action_id, 1); + args.rval().setBoolean(true); - value = JSVAL_TRUE; - JS_SET_RVAL(ctx, rval, value); - - return JS_TRUE; + return true; } @@ -136,7 +134,7 @@ smjs_get_action_fn_object(unsigned char *action_str) if (!smjs_ses) return NULL; - obj = JS_NewObject(smjs_ctx, (JSClass *) &action_fn_class, NULL, NULL); + obj = JS_NewObject(smjs_ctx, (JSClass *) &action_fn_class, JS::NullPtr(), JS::NullPtr()); if (!obj) return NULL; hop = mem_alloc(sizeof(*hop)); @@ -164,29 +162,28 @@ smjs_get_action_fn_object(unsigned char *action_str) /*** elinks.action object ***/ /* @action_class.getProperty */ -static JSBool +static bool action_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { - ELINKS_CAST_PROP_PARAMS jsid id = hid.get(); - (void)obj; jsval val; + JS::RootedValue rval(ctx, val); JSObject *action_fn; unsigned char *action_str; - *vp = JSVAL_NULL; + hvp.setNull(); - JS_IdToValue(ctx, id, &val); - action_str = JS_EncodeString(ctx, JS_ValueToString(ctx, val)); - if (!action_str) return JS_TRUE; + JS_IdToValue(ctx, id, &rval); + action_str = JS_EncodeString(ctx, JS::ToString(ctx, rval)); + if (!action_str) return true; action_fn = smjs_get_action_fn_object(action_str); - if (!action_fn) return JS_TRUE; + if (!action_fn) return true; - *vp = OBJECT_TO_JSVAL(action_fn); + hvp.setObject(*action_fn); - return JS_TRUE; + return true; } static const JSClass action_class = { @@ -204,7 +201,7 @@ smjs_get_action_object(void) assert(smjs_ctx); - obj = JS_NewObject(smjs_ctx, (JSClass *) &action_class, NULL, NULL); + obj = JS_NewObject(smjs_ctx, (JSClass *) &action_class, JS::NullPtr(), JS::NullPtr()); return obj; } @@ -221,7 +218,10 @@ smjs_init_action_interface(void) action_object = smjs_get_action_object(); if (!action_object) return; - val = OBJECT_TO_JSVAL(action_object); + JS::RootedObject r_smjs_elinks_object(smjs_ctx, smjs_elinks_object); - JS_SetProperty(smjs_ctx, smjs_elinks_object, "action", &val); + JS::RootedValue r_val(smjs_ctx, val); + r_val.setObject(*r_smjs_elinks_object); + + JS_SetProperty(smjs_ctx, r_smjs_elinks_object, "action", r_val); } diff --git a/src/scripting/smjs/bookmarks.c b/src/scripting/smjs/bookmarks.c index c1e0087c..8d1d3f43 100644 --- a/src/scripting/smjs/bookmarks.c +++ b/src/scripting/smjs/bookmarks.c @@ -18,7 +18,7 @@ /*** common code ***/ static void bookmark_finalize(JSFreeOp *op, JSObject *obj); -static JSBool bookmark_folder_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); +static bool bookmark_folder_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); static const JSClass bookmark_class = { "bookmark", @@ -44,7 +44,7 @@ smjs_get_bookmark_generic_object(struct bookmark *bookmark, JSClass *clasp) assert(clasp == &bookmark_class || clasp == &bookmark_folder_class); if_assert_failed return NULL; - jsobj = JS_NewObject(smjs_ctx, clasp, NULL, NULL); + jsobj = JS_NewObject(smjs_ctx, clasp, JS::NullPtr(), JS::NullPtr()); if (!jsobj) return NULL; if (!bookmark) return jsobj; @@ -84,16 +84,16 @@ enum bookmark_prop { BOOKMARK_CHILDREN = -3, }; -static JSBool bookmark_get_property_title(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); -static JSBool bookmark_set_property_title(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp); -static JSBool bookmark_get_property_url(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); -static JSBool bookmark_set_property_url(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp); -static JSBool bookmark_get_property_children(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); +static bool bookmark_get_property_title(JSContext *ctx, unsigned int argc, jsval *vp); +static bool bookmark_set_property_title(JSContext *ctx, unsigned int argc, jsval *vp); +static bool bookmark_get_property_url(JSContext *ctx, unsigned int argc, jsval *vp); +static bool bookmark_set_property_url(JSContext *ctx, unsigned int argc, jsval *vp); +static bool bookmark_get_property_children(JSContext *ctx, unsigned int argc, jsval *vp); static const JSPropertySpec bookmark_props[] = { - { "title", 0, JSPROP_ENUMERATE, JSOP_WRAPPER(bookmark_get_property_title), JSOP_WRAPPER(bookmark_set_property_title) }, - { "url", 0, JSPROP_ENUMERATE, JSOP_WRAPPER(bookmark_get_property_url), JSOP_WRAPPER(bookmark_set_property_url) }, - { "children", 0, JSPROP_ENUMERATE | JSPROP_READONLY, JSOP_WRAPPER(bookmark_get_property_children), JSOP_NULLWRAPPER }, + JS_PSGS("title", bookmark_get_property_title, bookmark_set_property_title, JSPROP_ENUMERATE), + JS_PSGS( "url", bookmark_get_property_url, bookmark_set_property_url, JSPROP_ENUMERATE), + JS_PSG("children", bookmark_get_property_children, JSPROP_ENUMERATE), { NULL } }; @@ -101,17 +101,17 @@ static JSObject *smjs_get_bookmark_folder_object(struct bookmark *bookmark); /** Convert a string retrieved from struct bookmark to a jsval. * - * @return JS_TRUE if successful. On error, report the error and - * return JS_FALSE. */ -static JSBool + * @return true if successful. On error, report the error and + * return false. */ +static bool bookmark_string_to_jsval(JSContext *ctx, const unsigned char *str, jsval *vp) { JSString *jsstr = utf8_to_jsstring(ctx, str, -1); if (jsstr == NULL) - return JS_FALSE; + return false; *vp = STRING_TO_JSVAL(jsstr); - return JS_TRUE; + return true; } /** Convert a jsval to a string and store it in struct bookmark. @@ -124,72 +124,61 @@ bookmark_string_to_jsval(JSContext *ctx, const unsigned char *str, jsval *vp) * A string allocated with mem_alloc(). * On success, this function frees the original string, if any. * - * @return JS_TRUE if successful. On error, report the error to - * SpiderMonkey and return JS_FALSE. */ -static JSBool -jsval_to_bookmark_string(JSContext *ctx, jsval val, unsigned char **result) + * @return true if successful. On error, report the error to + * SpiderMonkey and return false. */ +static bool +jsval_to_bookmark_string(JSContext *ctx, JS::HandleValue val, unsigned char **result) { - JSString *jsstr = NULL; unsigned char *str; - /* JS_ValueToString constructs a new string if val is not - * already a string. Protect the new string from the garbage - * collector, which jsstring_to_utf8() may trigger. - * - * Actually, SpiderMonkey 1.8.5 does not require this - * JS_AddNamedStringRoot call because it conservatively scans - * the C stack for GC roots. Do the call anyway, because: - * 1. Omitting the call would require somehow ensuring that the - * C compiler won't reuse the stack location too early. - * (See template class js::Anchor in .) - * 2. Later versions of SpiderMonkey are switching back to - * precise GC rooting, with a C++-only API. - * 3. jsval_to_bookmark_string() does not seem speed-critical. */ - if (!JS_AddNamedStringRoot(ctx, &jsstr, "jsval_to_bookmark_string")) - return JS_FALSE; + JSString *jsstr = JS::ToString(ctx, val); - jsstr = JS_ValueToString(ctx, val); if (jsstr == NULL) { - JS_RemoveStringRoot(ctx, &jsstr); - return JS_FALSE; + return false; } str = jsstring_to_utf8(ctx, jsstr, NULL); if (str == NULL) { - JS_RemoveStringRoot(ctx, &jsstr); - return JS_FALSE; + return false; } - JS_RemoveStringRoot(ctx, &jsstr); mem_free_set(result, str); - return JS_TRUE; + return true; } -static JSBool -bookmark_get_property_title(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) +static bool +bookmark_get_property_title(JSContext *ctx, unsigned int argc, jsval *vp) { - ELINKS_CAST_PROP_PARAMS + JS::CallArgs args = CallArgsFromVp(argc, vp); + JS::RootedObject hobj(ctx, &args.thisv().toObject()); struct bookmark *bookmark; /* This can be called if @obj if not itself an instance of the * appropriate class but has one in its prototype chain. Fail * such calls. */ - if (!JS_InstanceOf(ctx, obj, (JSClass *) &bookmark_class, NULL)) - return JS_FALSE; + if (!JS_InstanceOf(ctx, hobj, (JSClass *) &bookmark_class, NULL)) + return false; - bookmark = JS_GetInstancePrivate(ctx, obj, + bookmark = JS_GetInstancePrivate(ctx, hobj, (JSClass *) &bookmark_class, NULL); - if (!bookmark) return JS_FALSE; + if (!bookmark) return false; - return bookmark_string_to_jsval(ctx, bookmark->title, vp); + JSString *jsstr = utf8_to_jsstring(ctx, bookmark->title, -1); + + if (!jsstr) { + return false; + } + args.rval().setString(jsstr); + return true; } -static JSBool -bookmark_set_property_title(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp) +static bool +bookmark_set_property_title(JSContext *ctx, unsigned int argc, jsval *vp) { - ELINKS_CAST_PROP_PARAMS + JS::CallArgs args = CallArgsFromVp(argc, vp); + JS::RootedObject hobj(ctx, &args.thisv().toObject()); struct bookmark *bookmark; unsigned char *title = NULL; @@ -199,48 +188,56 @@ bookmark_set_property_title(JSContext *ctx, JS::HandleObject hobj, JS::HandleId /* This can be called if @obj if not itself an instance of the * appropriate class but has one in its prototype chain. Fail * such calls. */ - if (!JS_InstanceOf(ctx, obj, (JSClass *) &bookmark_class, NULL)) - return JS_FALSE; + if (!JS_InstanceOf(ctx, hobj, (JSClass *) &bookmark_class, NULL)) + return false; - bookmark = JS_GetInstancePrivate(ctx, obj, + bookmark = JS_GetInstancePrivate(ctx, hobj, (JSClass *) &bookmark_class, NULL); - if (!bookmark) return JS_FALSE; + if (!bookmark) return false; - if (!jsval_to_bookmark_string(ctx, *vp, &title)) - return JS_FALSE; + if (!jsval_to_bookmark_string(ctx, args[0], &title)) + return false; ok = update_bookmark(bookmark, get_cp_index("UTF-8"), title, url); mem_free_if(title); mem_free_if(url); - return ok ? JS_TRUE : JS_FALSE; + return ok ? true : false; } -static JSBool -bookmark_get_property_url(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) +static bool +bookmark_get_property_url(JSContext *ctx, unsigned int argc, jsval *vp) { - ELINKS_CAST_PROP_PARAMS + JS::CallArgs args = CallArgsFromVp(argc, vp); + JS::RootedObject hobj(ctx, &args.thisv().toObject()); struct bookmark *bookmark; /* This can be called if @obj if not itself an instance of the * appropriate class but has one in its prototype chain. Fail * such calls. */ - if (!JS_InstanceOf(ctx, obj, (JSClass *) &bookmark_class, NULL)) - return JS_FALSE; + if (!JS_InstanceOf(ctx, hobj, (JSClass *) &bookmark_class, NULL)) + return false; - bookmark = JS_GetInstancePrivate(ctx, obj, + bookmark = JS_GetInstancePrivate(ctx, hobj, (JSClass *) &bookmark_class, NULL); - if (!bookmark) return JS_FALSE; + if (!bookmark) return false; - return bookmark_string_to_jsval(ctx, bookmark->url, vp); + JSString *jsstr = utf8_to_jsstring(ctx, bookmark->url, -1); + + if (!jsstr) { + return false; + } + args.rval().setString(jsstr); + return true; } -static JSBool -bookmark_set_property_url(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp) +static bool +bookmark_set_property_url(JSContext *ctx, unsigned int argc, jsval *vp) { - ELINKS_CAST_PROP_PARAMS + JS::CallArgs args = CallArgsFromVp(argc, vp); + JS::RootedObject hobj(ctx, &args.thisv().toObject()); struct bookmark *bookmark; unsigned char *title = NULL; @@ -250,44 +247,45 @@ bookmark_set_property_url(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hi /* This can be called if @obj if not itself an instance of the * appropriate class but has one in its prototype chain. Fail * such calls. */ - if (!JS_InstanceOf(ctx, obj, (JSClass *) &bookmark_class, NULL)) - return JS_FALSE; + if (!JS_InstanceOf(ctx, hobj, (JSClass *) &bookmark_class, NULL)) + return false; - bookmark = JS_GetInstancePrivate(ctx, obj, + bookmark = JS_GetInstancePrivate(ctx, hobj, (JSClass *) &bookmark_class, NULL); - if (!bookmark) return JS_FALSE; + if (!bookmark) return false; - if (!jsval_to_bookmark_string(ctx, *vp, &url)) - return JS_FALSE; + if (!jsval_to_bookmark_string(ctx, args[0], &url)) + return false; ok = update_bookmark(bookmark, get_cp_index("UTF-8"), title, url); mem_free_if(title); mem_free_if(url); - return ok ? JS_TRUE : JS_FALSE; + return ok ? true : false; } -static JSBool -bookmark_get_property_children(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) +static bool +bookmark_get_property_children(JSContext *ctx, unsigned int argc, jsval *vp) { - ELINKS_CAST_PROP_PARAMS + JS::CallArgs args = CallArgsFromVp(argc, vp); + JS::RootedObject hobj(ctx, &args.thisv().toObject()); struct bookmark *bookmark; /* This can be called if @obj if not itself an instance of the * appropriate class but has one in its prototype chain. Fail * such calls. */ - if (!JS_InstanceOf(ctx, obj, (JSClass *) &bookmark_class, NULL)) - return JS_FALSE; + if (!JS_InstanceOf(ctx, hobj, (JSClass *) &bookmark_class, NULL)) + return false; - bookmark = JS_GetInstancePrivate(ctx, obj, + bookmark = JS_GetInstancePrivate(ctx, hobj, (JSClass *) &bookmark_class, NULL); - if (!bookmark) return JS_FALSE; + if (!bookmark) return false; - *vp = OBJECT_TO_JSVAL(smjs_get_bookmark_folder_object(bookmark)); + args.rval().setObject(*smjs_get_bookmark_folder_object(bookmark)); - return JS_TRUE; + return true; } @@ -299,8 +297,9 @@ smjs_get_bookmark_object(struct bookmark *bookmark) jsobj = smjs_get_bookmark_generic_object(bookmark, (JSClass *) &bookmark_class); + JS::RootedObject r_jsobj(smjs_ctx, jsobj); if (jsobj - && JS_TRUE == JS_DefineProperties(smjs_ctx, jsobj, + && true == JS_DefineProperties(smjs_ctx, r_jsobj, (JSPropertySpec *) bookmark_props)) return jsobj; @@ -311,41 +310,41 @@ smjs_get_bookmark_object(struct bookmark *bookmark) /*** bookmark folder object ***/ /* @bookmark_folder_class.getProperty */ -static JSBool +static bool bookmark_folder_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { - ELINKS_CAST_PROP_PARAMS jsid id = hid.get(); struct bookmark *bookmark; struct bookmark *folder; - jsval title_jsval = JSVAL_VOID; + jsval val; + JS::RootedValue title_jsval(ctx, val); unsigned char *title = NULL; /* This can be called if @obj if not itself an instance of the * appropriate class but has one in its prototype chain. Fail * such calls. */ - if (!JS_InstanceOf(ctx, obj, (JSClass *) &bookmark_folder_class, NULL)) - return JS_FALSE; + if (!JS_InstanceOf(ctx, hobj, (JSClass *) &bookmark_folder_class, NULL)) + return false; - folder = JS_GetInstancePrivate(ctx, obj, + folder = JS_GetInstancePrivate(ctx, hobj, (JSClass *) &bookmark_folder_class, NULL); - *vp = JSVAL_NULL; + hvp.setNull(); if (!JS_IdToValue(ctx, id, &title_jsval)) - return JS_FALSE; + return false; if (!jsval_to_bookmark_string(ctx, title_jsval, &title)) - return JS_FALSE; + return false; bookmark = get_bookmark_by_name(folder, title); if (bookmark) { - *vp = OBJECT_TO_JSVAL(smjs_get_bookmark_object(bookmark)); + hvp.setObject(*smjs_get_bookmark_object(bookmark)); } mem_free(title); - return JS_TRUE; + return true; } @@ -368,7 +367,9 @@ smjs_init_bookmarks_interface(void) bookmarks_object = smjs_get_bookmark_folder_object(NULL); if (!bookmarks_object) return; - val = OBJECT_TO_JSVAL(bookmarks_object); + JS::RootedValue rval(smjs_ctx, val); + rval.setObject(*bookmarks_object); + JS::RootedObject r_smjs_elinks_object(smjs_ctx, smjs_elinks_object); - JS_SetProperty(smjs_ctx, smjs_elinks_object, "bookmarks", &val); + JS_SetProperty(smjs_ctx, r_smjs_elinks_object, "bookmarks", rval); } diff --git a/src/scripting/smjs/cache_object.c b/src/scripting/smjs/cache_object.c index 21fc4473..b7edcf1e 100644 --- a/src/scripting/smjs/cache_object.c +++ b/src/scripting/smjs/cache_object.c @@ -37,45 +37,46 @@ enum cache_entry_prop { CACHE_ENTRY_URI = -5, }; -static JSBool cache_entry_get_property_content(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); -static JSBool cache_entry_set_property_content(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp); -static JSBool cache_entry_get_property_type(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); -static JSBool cache_entry_set_property_type(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp); -static JSBool cache_entry_get_property_length(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); -static JSBool cache_entry_get_property_head(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); -static JSBool cache_entry_set_property_head(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp); -static JSBool cache_entry_get_property_uri(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); +static bool cache_entry_get_property_content(JSContext *ctx, unsigned int argc, jsval *vp); +static bool cache_entry_set_property_content(JSContext *ctx, unsigned int argc, jsval *vp); +static bool cache_entry_get_property_type(JSContext *ctx, unsigned int argc, jsval *vp); +static bool cache_entry_set_property_type(JSContext *ctx, unsigned int argc, jsval *vp); +static bool cache_entry_get_property_length(JSContext *ctx, unsigned int argc, jsval *vp); +static bool cache_entry_get_property_head(JSContext *ctx, unsigned int argc, jsval *vp); +static bool cache_entry_set_property_head(JSContext *ctx, unsigned int argc, jsval *vp); +static bool cache_entry_get_property_uri(JSContext *ctx, unsigned int argc, jsval *vp); static const JSPropertySpec cache_entry_props[] = { - { "content", 0, JSPROP_ENUMERATE, JSOP_WRAPPER(cache_entry_get_property_content), JSOP_WRAPPER(cache_entry_set_property_content) }, - { "type", 0, JSPROP_ENUMERATE, JSOP_WRAPPER(cache_entry_get_property_type), JSOP_WRAPPER(cache_entry_set_property_type)}, - { "length", 0, JSPROP_ENUMERATE | JSPROP_READONLY, JSOP_WRAPPER(cache_entry_get_property_length), JSOP_NULLWRAPPER }, - { "head", 0, JSPROP_ENUMERATE, JSOP_WRAPPER(cache_entry_get_property_head), JSOP_WRAPPER(cache_entry_set_property_head) }, - { "uri", 0, JSPROP_ENUMERATE | JSPROP_READONLY, JSOP_WRAPPER(cache_entry_get_property_uri), JSOP_NULLWRAPPER }, + JS_PSGS("content", cache_entry_get_property_content, cache_entry_set_property_content, JSPROP_ENUMERATE), + JS_PSGS("type", cache_entry_get_property_type, cache_entry_set_property_type, JSPROP_ENUMERATE), + JS_PSG("length", cache_entry_get_property_length, JSPROP_ENUMERATE), + JS_PSGS("head", cache_entry_get_property_head, cache_entry_set_property_head, JSPROP_ENUMERATE), + JS_PSG("uri", cache_entry_get_property_uri, JSPROP_ENUMERATE), { NULL } }; -static JSBool -cache_entry_get_property_content(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) +static bool +cache_entry_get_property_content(JSContext *ctx, unsigned int argc, jsval *vp) { - ELINKS_CAST_PROP_PARAMS + JS::CallArgs args = CallArgsFromVp(argc, vp); + JS::RootedObject hobj(ctx, &args.thisv().toObject()); struct cache_entry *cached; struct fragment *fragment; - JSBool ret; + bool ret; /* This can be called if @obj if not itself an instance of the * appropriate class but has one in its prototype chain. Fail * such calls. */ - if (!JS_InstanceOf(ctx, obj, (JSClass *) &cache_entry_class, NULL)) - return JS_FALSE; + if (!JS_InstanceOf(ctx, hobj, (JSClass *) &cache_entry_class, NULL)) + return false; - cached = JS_GetInstancePrivate(ctx, obj, + cached = JS_GetInstancePrivate(ctx, hobj, (JSClass *) &cache_entry_class, NULL); - if (!cached) return JS_FALSE; /* already detached */ + if (!cached) return false; /* already detached */ assert(cache_entry_is_valid(cached)); - if_assert_failed return JS_FALSE; + if_assert_failed return false; /* Get a strong reference to the cache entry to prevent it * from being deleted if some function called below decides to @@ -83,24 +84,26 @@ cache_entry_get_property_content(JSContext *ctx, JS::HandleObject hobj, JS::Hand * eventually unlock the object. */ object_lock(cached); - undef_to_jsval(ctx, vp); + args.rval().setUndefined(); + fragment = get_cache_fragment(cached); if (!fragment) { - ret = JS_FALSE; + ret = false; } else { - *vp = STRING_TO_JSVAL(JS_NewStringCopyN(smjs_ctx, fragment->data, fragment->length)); - ret = JS_TRUE; + args.rval().setString(JS_NewStringCopyN(smjs_ctx, fragment->data, fragment->length)); + ret = true; } object_unlock(cached); return ret; } -static JSBool -cache_entry_set_property_content(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp) +static bool +cache_entry_set_property_content(JSContext *ctx, unsigned int argc, jsval *vp) { - ELINKS_CAST_PROP_PARAMS + JS::CallArgs args = CallArgsFromVp(argc, vp); + JS::RootedObject hobj(ctx, &args.thisv().toObject()); struct cache_entry *cached; JSString *jsstr; @@ -110,15 +113,15 @@ cache_entry_set_property_content(JSContext *ctx, JS::HandleObject hobj, JS::Hand /* This can be called if @obj if not itself an instance of the * appropriate class but has one in its prototype chain. Fail * such calls. */ - if (!JS_InstanceOf(ctx, obj, (JSClass *) &cache_entry_class, NULL)) - return JS_FALSE; + if (!JS_InstanceOf(ctx, hobj, (JSClass *) &cache_entry_class, NULL)) + return false; - cached = JS_GetInstancePrivate(ctx, obj, + cached = JS_GetInstancePrivate(ctx, hobj, (JSClass *) &cache_entry_class, NULL); - if (!cached) return JS_FALSE; /* already detached */ + if (!cached) return false; /* already detached */ assert(cache_entry_is_valid(cached)); - if_assert_failed return JS_FALSE; + if_assert_failed return false; /* Get a strong reference to the cache entry to prevent it * from being deleted if some function called below decides to @@ -126,51 +129,53 @@ cache_entry_set_property_content(JSContext *ctx, JS::HandleObject hobj, JS::Hand * eventually unlock the object. */ object_lock(cached); - jsstr = JS_ValueToString(smjs_ctx, *vp); + jsstr = JS::ToString(smjs_ctx, args[0]); str = JS_EncodeString(smjs_ctx, jsstr); len = JS_GetStringLength(jsstr); add_fragment(cached, 0, str, len); normalize_cache_entry(cached, len); object_unlock(cached); - return JS_TRUE; + return true; } -static JSBool -cache_entry_get_property_type(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) +static bool +cache_entry_get_property_type(JSContext *ctx, unsigned int argc, jsval *vp) { - ELINKS_CAST_PROP_PARAMS + JS::CallArgs args = CallArgsFromVp(argc, vp); + JS::RootedObject hobj(ctx, &args.thisv().toObject()); struct cache_entry *cached; /* This can be called if @obj if not itself an instance of the * appropriate class but has one in its prototype chain. Fail * such calls. */ - if (!JS_InstanceOf(ctx, obj, (JSClass *) &cache_entry_class, NULL)) - return JS_FALSE; + if (!JS_InstanceOf(ctx, hobj, (JSClass *) &cache_entry_class, NULL)) + return false; - cached = JS_GetInstancePrivate(ctx, obj, + cached = JS_GetInstancePrivate(ctx, hobj, (JSClass *) &cache_entry_class, NULL); - if (!cached) return JS_FALSE; /* already detached */ + if (!cached) return false; /* already detached */ assert(cache_entry_is_valid(cached)); - if_assert_failed return JS_FALSE; + if_assert_failed return false; /* Get a strong reference to the cache entry to prevent it * from being deleted if some function called below decides to * collect garbage. After this, all code paths must * eventually unlock the object. */ object_lock(cached); - *vp = STRING_TO_JSVAL(JS_NewStringCopyZ(smjs_ctx, cached->content_type)); + args.rval().setString(JS_NewStringCopyZ(smjs_ctx, cached->content_type)); object_unlock(cached); - return JS_TRUE; + return true; } -static JSBool -cache_entry_set_property_type(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp) +static bool +cache_entry_set_property_type(JSContext *ctx, unsigned int argc, jsval *vp) { - ELINKS_CAST_PROP_PARAMS + JS::CallArgs args = CallArgsFromVp(argc, vp); + JS::RootedObject hobj(ctx, &args.thisv().toObject()); struct cache_entry *cached; JSString *jsstr; @@ -179,15 +184,15 @@ cache_entry_set_property_type(JSContext *ctx, JS::HandleObject hobj, JS::HandleI /* This can be called if @obj if not itself an instance of the * appropriate class but has one in its prototype chain. Fail * such calls. */ - if (!JS_InstanceOf(ctx, obj, (JSClass *) &cache_entry_class, NULL)) - return JS_FALSE; + if (!JS_InstanceOf(ctx, hobj, (JSClass *) &cache_entry_class, NULL)) + return false; - cached = JS_GetInstancePrivate(ctx, obj, + cached = JS_GetInstancePrivate(ctx, hobj, (JSClass *) &cache_entry_class, NULL); - if (!cached) return JS_FALSE; /* already detached */ + if (!cached) return false; /* already detached */ assert(cache_entry_is_valid(cached)); - if_assert_failed return JS_FALSE; + if_assert_failed return false; /* Get a strong reference to the cache entry to prevent it * from being deleted if some function called below decides to @@ -195,13 +200,13 @@ cache_entry_set_property_type(JSContext *ctx, JS::HandleObject hobj, JS::HandleI * eventually unlock the object. */ object_lock(cached); - jsstr = JS_ValueToString(smjs_ctx, *vp); + jsstr = JS::ToString(smjs_ctx, args[0]); str = JS_EncodeString(smjs_ctx, jsstr); mem_free_set(&cached->content_type, stracpy(str)); object_unlock(cached); - return JS_TRUE; + return true; } @@ -249,11 +254,13 @@ smjs_get_cache_entry_object(struct cache_entry *cached) cache_entry_object = JS_NewObject(smjs_ctx, (JSClass *) &cache_entry_class, - NULL, NULL); + JS::NullPtr(), JS::NullPtr()); if (!cache_entry_object) return NULL; - if (JS_FALSE == JS_DefineProperties(smjs_ctx, cache_entry_object, + JS::RootedObject r_cache_entry_object(smjs_ctx, cache_entry_object); + + if (false == JS_DefineProperties(smjs_ctx, r_cache_entry_object, (JSPropertySpec *) cache_entry_props)) return NULL; @@ -279,7 +286,9 @@ smjs_detach_cache_entry_object(struct cache_entry *cached) if (!cached->jsobject) return; - assert(JS_GetInstancePrivate(smjs_ctx, cached->jsobject, + JS::RootedObject r_jsobject(smjs_ctx, cached->jsobject); + + assert(JS_GetInstancePrivate(smjs_ctx, r_jsobject, (JSClass *) &cache_entry_class, NULL) == cached); if_assert_failed {} @@ -288,72 +297,75 @@ smjs_detach_cache_entry_object(struct cache_entry *cached) cached->jsobject = NULL; } -static JSBool -cache_entry_get_property_length(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) +static bool +cache_entry_get_property_length(JSContext *ctx, unsigned int argc, jsval *vp) { - ELINKS_CAST_PROP_PARAMS + JS::CallArgs args = CallArgsFromVp(argc, vp); + JS::RootedObject hobj(ctx, &args.thisv().toObject()); struct cache_entry *cached; /* This can be called if @obj if not itself an instance of the * appropriate class but has one in its prototype chain. Fail * such calls. */ - if (!JS_InstanceOf(ctx, obj, (JSClass *) &cache_entry_class, NULL)) - return JS_FALSE; + if (!JS_InstanceOf(ctx, hobj, (JSClass *) &cache_entry_class, NULL)) + return false; - cached = JS_GetInstancePrivate(ctx, obj, + cached = JS_GetInstancePrivate(ctx, hobj, (JSClass *) &cache_entry_class, NULL); - if (!cached) return JS_FALSE; /* already detached */ + if (!cached) return false; /* already detached */ assert(cache_entry_is_valid(cached)); - if_assert_failed return JS_FALSE; + if_assert_failed return false; /* Get a strong reference to the cache entry to prevent it * from being deleted if some function called below decides to * collect garbage. After this, all code paths must * eventually unlock the object. */ object_lock(cached); - *vp = INT_TO_JSVAL(cached->length); + args.rval().setInt32(cached->length); object_unlock(cached); - return JS_TRUE; + return true; } -static JSBool -cache_entry_get_property_head(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) +static bool +cache_entry_get_property_head(JSContext *ctx, unsigned int argc, jsval *vp) { - ELINKS_CAST_PROP_PARAMS + JS::CallArgs args = CallArgsFromVp(argc, vp); + JS::RootedObject hobj(ctx, &args.thisv().toObject()); struct cache_entry *cached; /* This can be called if @obj if not itself an instance of the * appropriate class but has one in its prototype chain. Fail * such calls. */ - if (!JS_InstanceOf(ctx, obj, (JSClass *) &cache_entry_class, NULL)) - return JS_FALSE; + if (!JS_InstanceOf(ctx, hobj, (JSClass *) &cache_entry_class, NULL)) + return false; - cached = JS_GetInstancePrivate(ctx, obj, + cached = JS_GetInstancePrivate(ctx, hobj, (JSClass *) &cache_entry_class, NULL); - if (!cached) return JS_FALSE; /* already detached */ + if (!cached) return false; /* already detached */ assert(cache_entry_is_valid(cached)); - if_assert_failed return JS_FALSE; + if_assert_failed return false; /* Get a strong reference to the cache entry to prevent it * from being deleted if some function called below decides to * collect garbage. After this, all code paths must * eventually unlock the object. */ object_lock(cached); - *vp = STRING_TO_JSVAL(JS_NewStringCopyZ(smjs_ctx, cached->head)); + args.rval().setString(JS_NewStringCopyZ(smjs_ctx, cached->head)); object_unlock(cached); - return JS_TRUE; + return true; } -static JSBool -cache_entry_set_property_head(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp) +static bool +cache_entry_set_property_head(JSContext *ctx, unsigned int argc, jsval *vp) { - ELINKS_CAST_PROP_PARAMS + JS::CallArgs args = CallArgsFromVp(argc, vp); + JS::RootedObject hobj(ctx, &args.thisv().toObject()); struct cache_entry *cached; JSString *jsstr; @@ -362,15 +374,15 @@ cache_entry_set_property_head(JSContext *ctx, JS::HandleObject hobj, JS::HandleI /* This can be called if @obj if not itself an instance of the * appropriate class but has one in its prototype chain. Fail * such calls. */ - if (!JS_InstanceOf(ctx, obj, (JSClass *) &cache_entry_class, NULL)) - return JS_FALSE; + if (!JS_InstanceOf(ctx, hobj, (JSClass *) &cache_entry_class, NULL)) + return false; - cached = JS_GetInstancePrivate(ctx, obj, + cached = JS_GetInstancePrivate(ctx, hobj, (JSClass *) &cache_entry_class, NULL); - if (!cached) return JS_FALSE; /* already detached */ + if (!cached) return false; /* already detached */ assert(cache_entry_is_valid(cached)); - if_assert_failed return JS_FALSE; + if_assert_failed return false; /* Get a strong reference to the cache entry to prevent it * from being deleted if some function called below decides to @@ -378,42 +390,43 @@ cache_entry_set_property_head(JSContext *ctx, JS::HandleObject hobj, JS::HandleI * eventually unlock the object. */ object_lock(cached); - jsstr = JS_ValueToString(smjs_ctx, *vp); + jsstr = JS::ToString(smjs_ctx, args[0]); str = JS_EncodeString(smjs_ctx, jsstr); mem_free_set(&cached->head, stracpy(str)); object_unlock(cached); - return JS_TRUE; + return true; } -static JSBool -cache_entry_get_property_uri(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) +static bool +cache_entry_get_property_uri(JSContext *ctx, unsigned int argc, jsval *vp) { - ELINKS_CAST_PROP_PARAMS + JS::CallArgs args = CallArgsFromVp(argc, vp); + JS::RootedObject hobj(ctx, &args.thisv().toObject()); struct cache_entry *cached; /* This can be called if @obj if not itself an instance of the * appropriate class but has one in its prototype chain. Fail * such calls. */ - if (!JS_InstanceOf(ctx, obj, (JSClass *) &cache_entry_class, NULL)) - return JS_FALSE; + if (!JS_InstanceOf(ctx, hobj, (JSClass *) &cache_entry_class, NULL)) + return false; - cached = JS_GetInstancePrivate(ctx, obj, + cached = JS_GetInstancePrivate(ctx, hobj, (JSClass *) &cache_entry_class, NULL); - if (!cached) return JS_FALSE; /* already detached */ + if (!cached) return false; /* already detached */ assert(cache_entry_is_valid(cached)); - if_assert_failed return JS_FALSE; + if_assert_failed return false; /* Get a strong reference to the cache entry to prevent it * from being deleted if some function called below decides to * collect garbage. After this, all code paths must * eventually unlock the object. */ object_lock(cached); - *vp = STRING_TO_JSVAL(JS_NewStringCopyZ(smjs_ctx, struri(cached->uri))); + args.rval().setString(JS_NewStringCopyZ(smjs_ctx, struri(cached->uri))); object_unlock(cached); - return JS_TRUE; + return true; } diff --git a/src/scripting/smjs/core.c b/src/scripting/smjs/core.c index 04906142..91b13986 100644 --- a/src/scripting/smjs/core.c +++ b/src/scripting/smjs/core.c @@ -75,14 +75,16 @@ static int smjs_do_file(unsigned char *path) { int ret = 1; - jsval rval; struct string script; if (!init_string(&script)) return 0; + jsval val; + JS::RootedValue rval(smjs_ctx, val); + JS::RootedObject cg(smjs_ctx, JS::CurrentGlobalOrNull(smjs_ctx)); + if (!add_file_to_string(&script, path) - || JS_FALSE == JS_EvaluateScript(smjs_ctx, - JS_GetGlobalForScopeChain(smjs_ctx), + || false == JS_EvaluateScript(smjs_ctx, cg, script.source, script.length, path, 1, &rval)) { alert_smjs_error("error loading script file"); ret = 0; @@ -93,17 +95,18 @@ smjs_do_file(unsigned char *path) return ret; } -static JSBool +static bool smjs_do_file_wrapper(JSContext *ctx, unsigned int argc, jsval *rval) { - jsval *argv = JS_ARGV(ctx, rval); - JSString *jsstr = JS_ValueToString(smjs_ctx, *argv); + JS::CallArgs args = CallArgsFromVp(argc, rval); + + JSString *jsstr = JS::ToString(smjs_ctx, args[0]); unsigned char *path = JS_EncodeString(smjs_ctx, jsstr); if (smjs_do_file(path)) - return JS_TRUE; + return true; - return JS_FALSE; + return false; } static void @@ -136,15 +139,15 @@ init_smjs(struct module *module) return; } - JS_SetOptions(smjs_ctx, JSOPTION_VAROBJFIX | JS_METHODJIT); - JS_SetErrorReporter(smjs_ctx, error_reporter); smjs_init_global_object(); smjs_init_elinks_object(); - JS_DefineFunction(smjs_ctx, smjs_global_object, "do_file", + JS::RootedObject r_smjs_global_object(smjs_ctx, smjs_global_object); + + JS_DefineFunction(smjs_ctx, r_smjs_global_object, "do_file", &smjs_do_file_wrapper, 1, 0); smjs_load_hooks(); diff --git a/src/scripting/smjs/elinks_object.c b/src/scripting/smjs/elinks_object.c index 88fd4d7b..cf72b30e 100644 --- a/src/scripting/smjs/elinks_object.c +++ b/src/scripting/smjs/elinks_object.c @@ -32,20 +32,21 @@ /* @elinks_funcs{"alert"} */ -static JSBool +static bool elinks_alert(JSContext *ctx, unsigned int argc, jsval *rval) { - jsval val; - jsval *argv = JS_ARGV(ctx, rval); + JS::CallArgs args = CallArgsFromVp(argc, rval); + unsigned char *string; struct terminal *term; if (argc != 1) - return JS_TRUE; + return true; + + string = JS_EncodeString(ctx, args[0].toString()); - string = jsval_to_string(ctx, &argv[0]); if (!*string) - return JS_TRUE; + return true; if (smjs_ses) { term = smjs_ses->tab->term; @@ -61,32 +62,30 @@ elinks_alert(JSContext *ctx, unsigned int argc, jsval *rval) sleep(3); } - undef_to_jsval(ctx, &val); - JS_SET_RVAL(ctx, rval, val); + args.rval().setUndefined(); - return JS_TRUE; + return true; } /* @elinks_funcs{"execute"} */ -static JSBool +static bool elinks_execute(JSContext *ctx, unsigned int argc, jsval *rval) { - jsval val; - jsval *argv = JS_ARGV(ctx, rval); + JS::CallArgs args = CallArgsFromVp(argc, rval); + unsigned char *string; if (argc != 1) - return JS_TRUE; + return true; - string = jsval_to_string(ctx, &argv[0]); + string = JS_EncodeString(ctx, args[0].toString()); if (!*string) - return JS_TRUE; + return true; exec_on_terminal(smjs_ses->tab->term, string, "", TERM_EXEC_BG); - undef_to_jsval(ctx, &val); - JS_SET_RVAL(ctx, rval, val); - return JS_TRUE; + args.rval().setUndefined(); + return true; } enum elinks_prop { @@ -95,20 +94,19 @@ enum elinks_prop { ELINKS_SESSION, }; -static JSBool elinks_get_property_home(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); -static JSBool elinks_get_property_location(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); -static JSBool elinks_set_property_location(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp); -static JSBool elinks_get_property_session(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); - +static bool elinks_get_property_home(JSContext *ctx, unsigned int argc, jsval *vp); +static bool elinks_get_property_location(JSContext *ctx, unsigned int argc, jsval *vp); +static bool elinks_set_property_location(JSContext *ctx, unsigned int argc, jsval *vp); +static bool elinks_get_property_session(JSContext *ctx, unsigned int argc, jsval *vp); static const JSPropertySpec elinks_props[] = { - { "home", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_READONLY, JSOP_WRAPPER(elinks_get_property_home), JSOP_NULLWRAPPER }, - { "location", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT, JSOP_WRAPPER(elinks_get_property_location), JSOP_WRAPPER(elinks_set_property_location) }, - { "session", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_READONLY, JSOP_WRAPPER(elinks_get_property_session), JSOP_NULLWRAPPER}, + JS_PSG("home", elinks_get_property_home, JSPROP_ENUMERATE), + JS_PSGS("location", elinks_get_property_location, elinks_set_property_location, JSPROP_ENUMERATE), + JS_PSG("session", elinks_get_property_session, JSPROP_ENUMERATE), { NULL } }; -static JSBool elinks_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); -static JSBool elinks_set_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp); +static bool elinks_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); +static bool elinks_set_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, bool strict, JS::MutableHandleValue hvp); static const JSClass elinks_class = { "elinks", @@ -120,80 +118,78 @@ static const JSClass elinks_class = { /* @elinks_class.getProperty */ -static JSBool +static bool elinks_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { - ELINKS_CAST_PROP_PARAMS jsid id = hid.get(); /* This can be called if @obj if not itself an instance of the * appropriate class but has one in its prototype chain. Fail * such calls. */ - if (!JS_InstanceOf(ctx, obj, (JSClass *) &elinks_class, NULL)) - return JS_FALSE; + if (!JS_InstanceOf(ctx, hobj, (JSClass *) &elinks_class, NULL)) + return false; if (!JSID_IS_INT(id)) { - /* Note: If we return JS_FALSE here, the object's methods and + /* Note: If we return false here, the object's methods and * user-added properties do not work. */ - return JS_TRUE; + return true; } - undef_to_jsval(ctx, vp); + hvp.setUndefined(); switch (JSID_TO_INT(id)) { case ELINKS_HOME: - *vp = STRING_TO_JSVAL(JS_NewStringCopyZ(smjs_ctx, elinks_home)); + hvp.setString(JS_NewStringCopyZ(smjs_ctx, elinks_home)); - return JS_TRUE; + return true; case ELINKS_LOCATION: { struct uri *uri; - if (!smjs_ses) return JS_FALSE; + if (!smjs_ses) return false; uri = have_location(smjs_ses) ? cur_loc(smjs_ses)->vs.uri : smjs_ses->loading_uri; - *vp = STRING_TO_JSVAL(JS_NewStringCopyZ(smjs_ctx, + hvp.setString(JS_NewStringCopyZ(smjs_ctx, uri ? (const char *) struri(uri) : "")); - return JS_TRUE; + return true; } case ELINKS_SESSION: { JSObject *jsobj; - if (!smjs_ses) return JS_FALSE; + if (!smjs_ses) return false; jsobj = smjs_get_session_object(smjs_ses); - if (!jsobj) return JS_FALSE; + if (!jsobj) return false; - object_to_jsval(ctx, vp, jsobj); + hvp.setObject(*jsobj); - return JS_TRUE; + return true; } default: INTERNAL("Invalid ID %d in elinks_get_property().", JSID_TO_INT(id)); } - return JS_FALSE; + return false; } -static JSBool -elinks_set_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp) +static bool +elinks_set_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, bool strict, JS::MutableHandleValue hvp) { - ELINKS_CAST_PROP_PARAMS jsid id = hid.get(); /* This can be called if @obj if not itself an instance of the * appropriate class but has one in its prototype chain. Fail * such calls. */ - if (!JS_InstanceOf(ctx, obj, (JSClass *) &elinks_class, NULL)) - return JS_FALSE; + if (!JS_InstanceOf(ctx, hobj, (JSClass *) &elinks_class, NULL)) + return false; if (!JSID_IS_INT(id)) { - /* Note: If we return JS_FALSE here, the object's methods and + /* Note: If we return false here, the object's methods and * user-added properties do not work. */ - return JS_TRUE; + return true; } switch (JSID_TO_INT(id)) { @@ -201,24 +197,24 @@ elinks_set_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSB JSString *jsstr; unsigned char *url; - if (!smjs_ses) return JS_FALSE; + if (!smjs_ses) return false; - jsstr = JS_ValueToString(smjs_ctx, *vp); - if (!jsstr) return JS_FALSE; + jsstr = JS::ToString(smjs_ctx, hvp); + if (!jsstr) return false; url = JS_EncodeString(smjs_ctx, jsstr); - if (!url) return JS_FALSE; + if (!url) return false; goto_url(smjs_ses, url); - return JS_TRUE; + return true; } default: INTERNAL("Invalid ID %d in elinks_set_property().", JSID_TO_INT(id)); } - return JS_FALSE; + return false; } @@ -256,107 +252,117 @@ smjs_init_elinks_object(void) } /* If elinks. is defined, call it with the given arguments, - * store the return value in rval, and return JS_TRUE. Else return JS_FALSE. */ -JSBool -smjs_invoke_elinks_object_method(unsigned char *method, jsval argv[], int argc, - jsval *rval) + * store the return value in rval, and return true. Else return false. */ +bool +smjs_invoke_elinks_object_method(unsigned char *method, int argc, jsval *argv, JS::MutableHandleValue rval) { + JS::CallArgs args = CallArgsFromVp(argc, argv); + assert(smjs_ctx); assert(smjs_elinks_object); - assert(rval); assert(argv); - if (JS_FALSE == JS_GetProperty(smjs_ctx, smjs_elinks_object, - method, rval)) - return JS_FALSE; + JS::RootedObject r_smjs_elinks_object(smjs_ctx, smjs_elinks_object); + jsval val; + JS::RootedValue fun(smjs_ctx, val); - if (JSVAL_IS_VOID(*rval)) - return JS_FALSE; + if (false == JS_GetProperty(smjs_ctx, r_smjs_elinks_object, + method, &fun)) + return false; - return JS_CallFunctionValue(smjs_ctx, smjs_elinks_object, - *rval, argc, argv, rval); + if (rval.isUndefined()) + return false; + + return JS_CallFunctionValue(smjs_ctx, r_smjs_elinks_object, fun, args, rval); } -static JSBool -elinks_get_property_home(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) +static bool +elinks_get_property_home(JSContext *ctx, unsigned int argc, jsval *vp) { - ELINKS_CAST_PROP_PARAMS + JS::CallArgs args = CallArgsFromVp(argc, vp); + JS::RootedObject hobj(ctx, &args.thisv().toObject()); /* This can be called if @obj if not itself an instance of the * appropriate class but has one in its prototype chain. Fail * such calls. */ - if (!JS_InstanceOf(ctx, obj, (JSClass *) &elinks_class, NULL)) - return JS_FALSE; + if (!JS_InstanceOf(ctx, hobj, (JSClass *) &elinks_class, NULL)) + return false; - *vp = STRING_TO_JSVAL(JS_NewStringCopyZ(smjs_ctx, elinks_home)); + args.rval().setString(JS_NewStringCopyZ(smjs_ctx, elinks_home)); - return JS_TRUE; + return true; } -static JSBool -elinks_get_property_location(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) +static bool +elinks_get_property_location(JSContext *ctx, unsigned int argc, jsval *vp) { - ELINKS_CAST_PROP_PARAMS + JS::CallArgs args = CallArgsFromVp(argc, vp); + JS::RootedObject hobj(ctx, &args.thisv().toObject()); + struct uri *uri; /* This can be called if @obj if not itself an instance of the * appropriate class but has one in its prototype chain. Fail * such calls. */ - if (!JS_InstanceOf(ctx, obj, (JSClass *) &elinks_class, NULL)) - return JS_FALSE; + if (!JS_InstanceOf(ctx, hobj, (JSClass *) &elinks_class, NULL)) + return false; - if (!smjs_ses) return JS_FALSE; + if (!smjs_ses) return false; uri = have_location(smjs_ses) ? cur_loc(smjs_ses)->vs.uri : smjs_ses->loading_uri; - *vp = STRING_TO_JSVAL(JS_NewStringCopyZ(smjs_ctx, uri ? (const char *) struri(uri) : "")); + args.rval().setString(JS_NewStringCopyZ(smjs_ctx, uri ? (const char *) struri(uri) : "")); - return JS_TRUE; + return true; } -static JSBool -elinks_set_property_location(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp) +static bool +elinks_set_property_location(JSContext *ctx, unsigned int argc, jsval *vp) { - ELINKS_CAST_PROP_PARAMS + JS::CallArgs args = CallArgsFromVp(argc, vp); + JS::RootedObject hobj(ctx, &args.thisv().toObject()); + JSString *jsstr; unsigned char *url; /* This can be called if @obj if not itself an instance of the * appropriate class but has one in its prototype chain. Fail * such calls. */ - if (!JS_InstanceOf(ctx, obj, (JSClass *) &elinks_class, NULL)) - return JS_FALSE; + if (!JS_InstanceOf(ctx, hobj, (JSClass *) &elinks_class, NULL)) + return false; - if (!smjs_ses) return JS_FALSE; + if (!smjs_ses) return false; - jsstr = JS_ValueToString(smjs_ctx, *vp); - if (!jsstr) return JS_FALSE; + jsstr = JS::ToString(smjs_ctx, args[0]); + if (!jsstr) return false; url = JS_EncodeString(smjs_ctx, jsstr); - if (!url) return JS_FALSE; + if (!url) return false; goto_url(smjs_ses, url); - return JS_TRUE; + return true; } -static JSBool -elinks_get_property_session(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) +static bool +elinks_get_property_session(JSContext *ctx, unsigned int argc, jsval *vp) { - ELINKS_CAST_PROP_PARAMS + JS::CallArgs args = CallArgsFromVp(argc, vp); + JS::RootedObject hobj(ctx, &args.thisv().toObject()); + JSObject *jsobj; /* This can be called if @obj if not itself an instance of the * appropriate class but has one in its prototype chain. Fail * such calls. */ - if (!JS_InstanceOf(ctx, obj, (JSClass *) &elinks_class, NULL)) - return JS_FALSE; + if (!JS_InstanceOf(ctx, hobj, (JSClass *) &elinks_class, NULL)) + return false; - if (!smjs_ses) return JS_FALSE; + if (!smjs_ses) return false; jsobj = smjs_get_session_object(smjs_ses); - if (!jsobj) return JS_FALSE; + if (!jsobj) return false; - object_to_jsval(ctx, vp, jsobj); + args.rval().setObject(*jsobj);; - return JS_TRUE; + return true; } diff --git a/src/scripting/smjs/elinks_object.h b/src/scripting/smjs/elinks_object.h index 0395d892..5b519151 100644 --- a/src/scripting/smjs/elinks_object.h +++ b/src/scripting/smjs/elinks_object.h @@ -12,7 +12,6 @@ void smjs_init_elinks_object(void); /* Invoke elinks. with the given arguments and put the return value * into *rval. */ -JSBool smjs_invoke_elinks_object_method(unsigned char *method, - jsval argv[], int argc, jsval *rval); +bool smjs_invoke_elinks_object_method(unsigned char *method, int argc, jsval *argv, JS::MutableHandleValue rval); #endif diff --git a/src/scripting/smjs/global_object.c b/src/scripting/smjs/global_object.c index 80866b2a..44e71f9c 100644 --- a/src/scripting/smjs/global_object.c +++ b/src/scripting/smjs/global_object.c @@ -32,7 +32,7 @@ smjs_get_global_object(void) JSAutoRequest ar(smjs_ctx); RootedObject jsobj(smjs_ctx); - jsobj = JS_NewGlobalObject(smjs_ctx, (JSClass *) &global_class, NULL); + jsobj = JS_NewGlobalObject(smjs_ctx, (JSClass *) &global_class, NULL, JS::DontFireOnNewGlobalHook); if (!jsobj) return NULL; diff --git a/src/scripting/smjs/globhist.c b/src/scripting/smjs/globhist.c index 2f8e5bc7..c0c69561 100644 --- a/src/scripting/smjs/globhist.c +++ b/src/scripting/smjs/globhist.c @@ -12,8 +12,8 @@ #include "scripting/smjs/elinks_object.h" #include "util/memory.h" -static JSBool smjs_globhist_item_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); -static JSBool smjs_globhist_item_set_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp); +static bool smjs_globhist_item_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); +static bool smjs_globhist_item_set_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, bool strict, JS::MutableHandleValue hvp); static void smjs_globhist_item_finalize(JSFreeOp *op, JSObject *obj); @@ -51,26 +51,25 @@ enum smjs_globhist_item_prop { GLOBHIST_LAST_VISIT = -3, }; -static JSBool smjs_globhist_item_get_property_title(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); -static JSBool smjs_globhist_item_set_property_title(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp); -static JSBool smjs_globhist_item_get_property_url(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); -static JSBool smjs_globhist_item_set_property_url(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp); -static JSBool smjs_globhist_item_get_property_last_visit(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); -static JSBool smjs_globhist_item_set_property_last_visit(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp); +static bool smjs_globhist_item_get_property_title(JSContext *ctx, unsigned int argc, jsval *vp); +static bool smjs_globhist_item_set_property_title(JSContext *ctx, unsigned int argc, jsval *vp); +static bool smjs_globhist_item_get_property_url(JSContext *ctx, unsigned int argc, jsval *vp); +static bool smjs_globhist_item_set_property_url(JSContext *ctx, unsigned int argc, jsval *vp); +static bool smjs_globhist_item_get_property_last_visit(JSContext *ctx, unsigned int argc, jsval *vp); +static bool smjs_globhist_item_set_property_last_visit(JSContext *ctx, unsigned int argc, jsval *vp); static const JSPropertySpec smjs_globhist_item_props[] = { - { "title", 0, JSPROP_ENUMERATE, JSOP_WRAPPER(smjs_globhist_item_get_property_title), JSOP_WRAPPER(smjs_globhist_item_set_property_title) }, - { "url", 0, JSPROP_ENUMERATE, JSOP_WRAPPER(smjs_globhist_item_get_property_url), JSOP_WRAPPER(smjs_globhist_item_set_property_url) }, - { "last_visit", 0, JSPROP_ENUMERATE, JSOP_WRAPPER(smjs_globhist_item_get_property_last_visit), JSOP_WRAPPER(smjs_globhist_item_set_property_last_visit) }, + JS_PSGS("title", smjs_globhist_item_get_property_title, smjs_globhist_item_set_property_title, JSPROP_ENUMERATE), + JS_PSGS("url", smjs_globhist_item_get_property_url, smjs_globhist_item_set_property_url, JSPROP_ENUMERATE), + JS_PSGS("last_visit", smjs_globhist_item_get_property_last_visit, smjs_globhist_item_set_property_last_visit, JSPROP_ENUMERATE), { NULL } }; /* @smjs_globhist_item_class.getProperty */ -static JSBool +static bool smjs_globhist_item_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { - ELINKS_CAST_PROP_PARAMS jsid id = hid.get(); struct global_history_item *history_item; @@ -78,31 +77,29 @@ smjs_globhist_item_get_property(JSContext *ctx, JS::HandleObject hobj, JS::Handl /* This can be called if @obj if not itself an instance of the * appropriate class but has one in its prototype chain. Fail * such calls. */ - if (!JS_InstanceOf(ctx, obj, (JSClass *) &smjs_globhist_item_class, NULL)) - return JS_FALSE; + if (!JS_InstanceOf(ctx, hobj, (JSClass *) &smjs_globhist_item_class, NULL)) + return false; - history_item = JS_GetInstancePrivate(ctx, obj, + history_item = JS_GetInstancePrivate(ctx, hobj, (JSClass *) &smjs_globhist_item_class, NULL); - if (!history_item) return JS_FALSE; + if (!history_item) return false; - undef_to_jsval(ctx, vp); + hvp.setUndefined(); if (!JSID_IS_INT(id)) - return JS_FALSE; + return false; switch (JSID_TO_INT(id)) { case GLOBHIST_TITLE: - *vp = STRING_TO_JSVAL(JS_NewStringCopyZ(smjs_ctx, - history_item->title)); + hvp.setString(JS_NewStringCopyZ(smjs_ctx, history_item->title)); - return JS_TRUE; + return true; case GLOBHIST_URL: - *vp = STRING_TO_JSVAL(JS_NewStringCopyZ(smjs_ctx, - history_item->url)); + hvp.setString(JS_NewStringCopyZ(smjs_ctx, history_item->url)); - return JS_TRUE; + return true; case GLOBHIST_LAST_VISIT: /* TODO: I'd rather return a date object, but that introduces * synchronisation issues: @@ -120,25 +117,24 @@ smjs_globhist_item_get_property(JSContext *ctx, JS::HandleObject hobj, JS::Handl * Since the Date object uses milliseconds since the epoch, * I'd rather export that, but SpiderMonkey doesn't provide * a suitable type. -- Miciah */ - *vp = JS_NumberValue(history_item->last_visit); + hvp.setInt32(history_item->last_visit); - return JS_TRUE; + return true; default: /* Unrecognized integer property ID; someone is using * the object as an array. SMJS builtin classes (e.g. - * js_RegExpClass) just return JS_TRUE in this case + * js_RegExpClass) just return true in this case * and leave *@vp unchanged. Do the same here. * (Actually not quite the same, as we already used * @undef_to_jsval.) */ - return JS_TRUE; + return true; } } /* @smjs_globhist_item_class.setProperty */ -static JSBool -smjs_globhist_item_set_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp) +static bool +smjs_globhist_item_set_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, bool strict, JS::MutableHandleValue hvp) { - ELINKS_CAST_PROP_PARAMS jsid id = hid.get(); struct global_history_item *history_item; @@ -146,50 +142,50 @@ smjs_globhist_item_set_property(JSContext *ctx, JS::HandleObject hobj, JS::Handl /* This can be called if @obj if not itself an instance of the * appropriate class but has one in its prototype chain. Fail * such calls. */ - if (!JS_InstanceOf(ctx, obj, (JSClass *) &smjs_globhist_item_class, NULL)) - return JS_FALSE; + if (!JS_InstanceOf(ctx, hobj, (JSClass *) &smjs_globhist_item_class, NULL)) + return false; - history_item = JS_GetInstancePrivate(ctx, obj, + history_item = JS_GetInstancePrivate(ctx, hobj, (JSClass *) &smjs_globhist_item_class, NULL); - if (!history_item) return JS_FALSE; + if (!history_item) return false; if (!JSID_IS_INT(id)) - return JS_FALSE; + return false; switch (JSID_TO_INT(id)) { case GLOBHIST_TITLE: { - JSString *jsstr = JS_ValueToString(smjs_ctx, *vp); + JSString *jsstr = JS::ToString(smjs_ctx, hvp); unsigned char *str = JS_EncodeString(smjs_ctx, jsstr); mem_free_set(&history_item->title, stracpy(str)); - return JS_TRUE; + return true; } case GLOBHIST_URL: { - JSString *jsstr = JS_ValueToString(smjs_ctx, *vp); + JSString *jsstr = JS::ToString(smjs_ctx, hvp); unsigned char *str = JS_EncodeString(smjs_ctx, jsstr); mem_free_set(&history_item->url, stracpy(str)); - return JS_TRUE; + return true; } case GLOBHIST_LAST_VISIT: { uint32_t seconds; /* Bug 923: Assumes time_t values fit in uint32. */ - JS_ValueToECMAUint32(smjs_ctx, *vp, &seconds); + JS::ToInt32(smjs_ctx, hvp, &seconds); history_item->last_visit = seconds; - return JS_TRUE; + return true; } default: /* Unrecognized integer property ID; someone is using * the object as an array. SMJS builtin classes (e.g. - * js_RegExpClass) just return JS_TRUE in this case. + * js_RegExpClass) just return true in this case. * Do the same here. */ - return JS_TRUE; + return true; } } @@ -200,9 +196,12 @@ smjs_get_globhist_item_object(struct global_history_item *history_item) JSObject *jsobj; jsobj = JS_NewObject(smjs_ctx, (JSClass *) &smjs_globhist_item_class, - NULL, NULL); + JS::NullPtr(), JS::NullPtr()); + + JS::RootedObject r_jsobj(smjs_ctx, jsobj); + if (!jsobj - || JS_TRUE != JS_DefineProperties(smjs_ctx, jsobj, + || true != JS_DefineProperties(smjs_ctx, r_jsobj, (JSPropertySpec *) smjs_globhist_item_props)) { return NULL; } @@ -214,22 +213,22 @@ smjs_get_globhist_item_object(struct global_history_item *history_item) /* @smjs_globhist_class.getProperty */ -static JSBool +static bool smjs_globhist_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { - ELINKS_CAST_PROP_PARAMS jsid id = hid.get(); - (void)obj; JSObject *jsobj; unsigned char *uri_string; struct global_history_item *history_item; jsval tmp; + JS::RootedValue r_tmp(ctx, tmp); - if (!JS_IdToValue(ctx, id, &tmp)) + + if (!JS_IdToValue(ctx, id, &r_tmp)) goto ret_null; - uri_string = JS_EncodeString(ctx, JS_ValueToString(ctx, tmp)); + uri_string = JS_EncodeString(ctx, JS::ToString(ctx, r_tmp)); if (!uri_string) goto ret_null; history_item = get_global_history_item(uri_string); @@ -238,14 +237,14 @@ smjs_globhist_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId h jsobj = smjs_get_globhist_item_object(history_item); if (!jsobj) goto ret_null; - *vp = OBJECT_TO_JSVAL(jsobj); + hvp.setObject(*jsobj); - return JS_TRUE; + return true; ret_null: - *vp = JSVAL_NULL; + hvp.setNull(); - return JS_TRUE; + return true; } static const JSClass smjs_globhist_class = { @@ -261,7 +260,7 @@ smjs_get_globhist_object(void) JSObject *globhist; globhist = JS_NewObject(smjs_ctx, (JSClass *) &smjs_globhist_class, - NULL, NULL); + JS::NullPtr(), JS::NullPtr()); if (!globhist) return NULL; return globhist; @@ -279,40 +278,43 @@ smjs_init_globhist_interface(void) globhist = smjs_get_globhist_object(); if (!globhist) return; - val = OBJECT_TO_JSVAL(globhist); + JS::RootedObject r_smjs_elinks_object(smjs_ctx, smjs_elinks_object); + JS::RootedValue r_val(smjs_ctx, val); + r_val.setObject(*globhist); - JS_SetProperty(smjs_ctx, smjs_elinks_object, "globhist", &val); + JS_SetProperty(smjs_ctx, r_smjs_elinks_object, "globhist", r_val); } -static JSBool -smjs_globhist_item_get_property_title(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, - JS::MutableHandleValue hvp) +static bool +smjs_globhist_item_get_property_title(JSContext *ctx, unsigned int argc, jsval *vp) { - ELINKS_CAST_PROP_PARAMS + JS::CallArgs args = CallArgsFromVp(argc, vp); + JS::RootedObject hobj(ctx, &args.thisv().toObject()); struct global_history_item *history_item; /* This can be called if @obj if not itself an instance of the * appropriate class but has one in its prototype chain. Fail * such calls. */ - if (!JS_InstanceOf(ctx, obj, (JSClass *) &smjs_globhist_item_class, NULL)) - return JS_FALSE; + if (!JS_InstanceOf(ctx, hobj, (JSClass *) &smjs_globhist_item_class, NULL)) + return false; - history_item = JS_GetInstancePrivate(ctx, obj, + history_item = JS_GetInstancePrivate(ctx, hobj, (JSClass *) &smjs_globhist_item_class, NULL); - if (!history_item) return JS_FALSE; + if (!history_item) return false; - *vp = STRING_TO_JSVAL(JS_NewStringCopyZ(smjs_ctx, history_item->title)); + args.rval().setString(JS_NewStringCopyZ(smjs_ctx, history_item->title)); - return JS_TRUE; + return true; } -static JSBool -smjs_globhist_item_set_property_title(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp) +static bool +smjs_globhist_item_set_property_title(JSContext *ctx, unsigned int argc, jsval *vp) { - ELINKS_CAST_PROP_PARAMS + JS::CallArgs args = CallArgsFromVp(argc, vp); + JS::RootedObject hobj(ctx, &args.thisv().toObject()); struct global_history_item *history_item; JSString *jsstr; @@ -321,51 +323,52 @@ smjs_globhist_item_set_property_title(JSContext *ctx, JS::HandleObject hobj, JS: /* This can be called if @obj if not itself an instance of the * appropriate class but has one in its prototype chain. Fail * such calls. */ - if (!JS_InstanceOf(ctx, obj, (JSClass *) &smjs_globhist_item_class, NULL)) - return JS_FALSE; + if (!JS_InstanceOf(ctx, hobj, (JSClass *) &smjs_globhist_item_class, NULL)) + return false; - history_item = JS_GetInstancePrivate(ctx, obj, + history_item = JS_GetInstancePrivate(ctx, hobj, (JSClass *) &smjs_globhist_item_class, NULL); - if (!history_item) return JS_FALSE; + if (!history_item) return false; - jsstr = JS_ValueToString(smjs_ctx, *vp); + jsstr = JS::ToString(smjs_ctx, args[0]); str = JS_EncodeString(smjs_ctx, jsstr); mem_free_set(&history_item->title, stracpy(str)); - return JS_TRUE; + return true; } -static JSBool -smjs_globhist_item_get_property_url(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, - JS::MutableHandleValue hvp) +static bool +smjs_globhist_item_get_property_url(JSContext *ctx, unsigned int argc, jsval *vp) { - ELINKS_CAST_PROP_PARAMS + JS::CallArgs args = CallArgsFromVp(argc, vp); + JS::RootedObject hobj(ctx, &args.thisv().toObject()); struct global_history_item *history_item; /* This can be called if @obj if not itself an instance of the * appropriate class but has one in its prototype chain. Fail * such calls. */ - if (!JS_InstanceOf(ctx, obj, (JSClass *) &smjs_globhist_item_class, NULL)) - return JS_FALSE; + if (!JS_InstanceOf(ctx, hobj, (JSClass *) &smjs_globhist_item_class, NULL)) + return false; - history_item = JS_GetInstancePrivate(ctx, obj, + history_item = JS_GetInstancePrivate(ctx, hobj, (JSClass *) &smjs_globhist_item_class, NULL); - if (!history_item) return JS_FALSE; + if (!history_item) return false; - *vp = STRING_TO_JSVAL(JS_NewStringCopyZ(smjs_ctx, history_item->url)); + args.rval().setString(JS_NewStringCopyZ(smjs_ctx, history_item->url)); - return JS_TRUE; + return true; } -static JSBool -smjs_globhist_item_set_property_url(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp) +static bool +smjs_globhist_item_set_property_url(JSContext *ctx, unsigned int argc, jsval *vp) { - ELINKS_CAST_PROP_PARAMS + JS::CallArgs args = CallArgsFromVp(argc, vp); + JS::RootedObject hobj(ctx, &args.thisv().toObject()); struct global_history_item *history_item; JSString *jsstr; @@ -374,41 +377,41 @@ smjs_globhist_item_set_property_url(JSContext *ctx, JS::HandleObject hobj, JS::H /* This can be called if @obj if not itself an instance of the * appropriate class but has one in its prototype chain. Fail * such calls. */ - if (!JS_InstanceOf(ctx, obj, (JSClass *) &smjs_globhist_item_class, NULL)) - return JS_FALSE; + if (!JS_InstanceOf(ctx, hobj, (JSClass *) &smjs_globhist_item_class, NULL)) + return false; - history_item = JS_GetInstancePrivate(ctx, obj, + history_item = JS_GetInstancePrivate(ctx, hobj, (JSClass *) &smjs_globhist_item_class, NULL); - if (!history_item) return JS_FALSE; + if (!history_item) return false; - jsstr = JS_ValueToString(smjs_ctx, *vp); + jsstr = JS::ToString(smjs_ctx, args[0]); str = JS_EncodeString(smjs_ctx, jsstr); mem_free_set(&history_item->url, stracpy(str)); - return JS_TRUE; + return true; } -static JSBool -smjs_globhist_item_get_property_last_visit(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, - JS::MutableHandleValue hvp) +static bool +smjs_globhist_item_get_property_last_visit(JSContext *ctx, unsigned int argc, jsval *vp) { - ELINKS_CAST_PROP_PARAMS + JS::CallArgs args = CallArgsFromVp(argc, vp); + JS::RootedObject hobj(ctx, &args.thisv().toObject()); struct global_history_item *history_item; /* This can be called if @obj if not itself an instance of the * appropriate class but has one in its prototype chain. Fail * such calls. */ - if (!JS_InstanceOf(ctx, obj, (JSClass *) &smjs_globhist_item_class, NULL)) - return JS_FALSE; + if (!JS_InstanceOf(ctx, hobj, (JSClass *) &smjs_globhist_item_class, NULL)) + return false; - history_item = JS_GetInstancePrivate(ctx, obj, + history_item = JS_GetInstancePrivate(ctx, hobj, (JSClass *) &smjs_globhist_item_class, NULL); - if (!history_item) return JS_FALSE; + if (!history_item) return false; /* TODO: I'd rather return a date object, but that introduces * synchronisation issues: @@ -426,16 +429,17 @@ smjs_globhist_item_get_property_last_visit(JSContext *ctx, JS::HandleObject hobj * Since the Date object uses milliseconds since the epoch, * I'd rather export that, but SpiderMonkey doesn't provide * a suitable type. -- Miciah */ - *vp = JS_NumberValue(history_item->last_visit); + args.rval().setInt32(history_item->last_visit); - return JS_TRUE; + return true; } /* @smjs_globhist_item_class.setProperty */ -static JSBool -smjs_globhist_item_set_property_last_visit(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp) +static bool +smjs_globhist_item_set_property_last_visit(JSContext *ctx, unsigned int argc, jsval *vp) { - ELINKS_CAST_PROP_PARAMS + JS::CallArgs args = CallArgsFromVp(argc, vp); + JS::RootedObject hobj(ctx, &args.thisv().toObject()); struct global_history_item *history_item; uint32_t seconds; @@ -443,18 +447,18 @@ smjs_globhist_item_set_property_last_visit(JSContext *ctx, JS::HandleObject hobj /* This can be called if @obj if not itself an instance of the * appropriate class but has one in its prototype chain. Fail * such calls. */ - if (!JS_InstanceOf(ctx, obj, (JSClass *) &smjs_globhist_item_class, NULL)) - return JS_FALSE; + if (!JS_InstanceOf(ctx, hobj, (JSClass *) &smjs_globhist_item_class, NULL)) + return false; - history_item = JS_GetInstancePrivate(ctx, obj, + history_item = JS_GetInstancePrivate(ctx, hobj, (JSClass *) &smjs_globhist_item_class, NULL); - if (!history_item) return JS_FALSE; + if (!history_item) return false; /* Bug 923: Assumes time_t values fit in uint32. */ - JS_ValueToECMAUint32(smjs_ctx, *vp, &seconds); + JS::ToInt32(smjs_ctx, args[0], &seconds); history_item->last_visit = seconds; - return JS_TRUE; + return true; } diff --git a/src/scripting/smjs/hooks.c b/src/scripting/smjs/hooks.c index d69daf68..e1f6e570 100644 --- a/src/scripting/smjs/hooks.c +++ b/src/scripting/smjs/hooks.c @@ -27,20 +27,20 @@ script_hook_url(va_list ap, void *data) unsigned char **url = va_arg(ap, unsigned char **); struct session *ses = va_arg(ap, struct session *); enum evhook_status ret = EVENT_HOOK_STATUS_NEXT; - jsval args[1], rval; + jsval args[3], rval; + JS::RootedValue r_rval(smjs_ctx, rval); if (*url == NULL) return EVENT_HOOK_STATUS_NEXT; smjs_ses = ses; + args[2].setString(JS_NewStringCopyZ(smjs_ctx, *url)); - args[0] = STRING_TO_JSVAL(JS_NewStringCopyZ(smjs_ctx, *url)); - - if (JS_TRUE == smjs_invoke_elinks_object_method(data, args, 1, &rval)) { - if (JSVAL_IS_BOOLEAN(rval)) { - if (JS_FALSE == JSVAL_TO_BOOLEAN(rval)) + if (true == smjs_invoke_elinks_object_method(data, 1, args, &r_rval)) { + if (r_rval.isBoolean()) { + if (false == (r_rval.toBoolean())) ret = EVENT_HOOK_STATUS_LAST; } else { - JSString *jsstr = JS_ValueToString(smjs_ctx, rval); + JSString *jsstr = JS::ToString(smjs_ctx, r_rval); unsigned char *str = JS_EncodeString(smjs_ctx, jsstr); mem_free_set(url, stracpy(str)); @@ -59,7 +59,8 @@ script_hook_pre_format_html(va_list ap, void *data) struct cache_entry *cached = va_arg(ap, struct cache_entry *); enum evhook_status ret = EVENT_HOOK_STATUS_NEXT; JSObject *cache_entry_object, *view_state_object = NULL; - jsval args[2], rval; + jsval args[4], rval; + JS::RootedValue r_rval(smjs_ctx, rval); evhook_use_params(ses && cached); @@ -76,12 +77,12 @@ script_hook_pre_format_html(va_list ap, void *data) cache_entry_object = smjs_get_cache_entry_object(cached); if (!cache_entry_object) goto end; - args[0] = OBJECT_TO_JSVAL(cache_entry_object); - args[1] = OBJECT_TO_JSVAL(view_state_object); + args[2].setObject(*cache_entry_object); + args[3].setObject(*view_state_object); - if (JS_TRUE == smjs_invoke_elinks_object_method("preformat_html", - args, 2, &rval)) - if (JS_FALSE == JSVAL_TO_BOOLEAN(rval)) + if (true == smjs_invoke_elinks_object_method("preformat_html", + 2, args, &r_rval)) + if (false == JSVAL_TO_BOOLEAN(rval)) ret = EVENT_HOOK_STATUS_LAST; end: diff --git a/src/scripting/smjs/keybinding.c b/src/scripting/smjs/keybinding.c index 498ca4ac..6d5e8898 100644 --- a/src/scripting/smjs/keybinding.c +++ b/src/scripting/smjs/keybinding.c @@ -13,8 +13,8 @@ #include "scripting/smjs/elinks_object.h" #include "util/memory.h" -static JSBool keymap_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); -static JSBool keymap_set_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp); +static bool keymap_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); +static bool keymap_set_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, bool strict, JS::MutableHandleValue hvp); static void keymap_finalize(JSFreeOp *op, JSObject *obj); static const JSClass keymap_class = { @@ -26,50 +26,53 @@ static const JSClass keymap_class = { }; /* @keymap_class.getProperty */ -static JSBool +static bool keymap_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { - ELINKS_CAST_PROP_PARAMS jsid id = hid.get(); unsigned char *action_str; const unsigned char *keystroke_str; int *data; jsval tmp; + JS::RootedValue r_tmp(ctx, tmp); /* This can be called if @obj if not itself an instance of the * appropriate class but has one in its prototype chain. Fail * such calls. */ - if (!JS_InstanceOf(ctx, obj, (JSClass *) &keymap_class, NULL)) - return JS_FALSE; + if (!JS_InstanceOf(ctx, hobj, (JSClass *) &keymap_class, NULL)) + return false; - data = JS_GetInstancePrivate(ctx, obj, + data = JS_GetInstancePrivate(ctx, hobj, (JSClass *) &keymap_class, NULL); - if (!JS_IdToValue(ctx, id, &tmp)) + if (!JS_IdToValue(ctx, id, &r_tmp)) goto ret_null; - keystroke_str = JS_EncodeString(ctx, JS_ValueToString(ctx, tmp)); + keystroke_str = JS_EncodeString(ctx, JS::ToString(ctx, r_tmp)); if (!keystroke_str) goto ret_null; action_str = get_action_name_from_keystroke((enum keymap_id) *data, keystroke_str); if (!action_str || !strcmp(action_str, "none")) goto ret_null; - *vp = STRING_TO_JSVAL(JS_NewStringCopyZ(ctx, action_str)); + hvp.setString(JS_NewStringCopyZ(ctx, action_str)); - return JS_TRUE; + return true; ret_null: - *vp = JSVAL_NULL; + hvp.setNull(); - return JS_TRUE; + return true; } static enum evhook_status smjs_keybinding_action_callback(va_list ap, void *data) { + JS::CallArgs args; + jsval rval; + JS::RootedValue r_rval(smjs_ctx, rval); struct session *ses = va_arg(ap, struct session *); JSObject *jsobj = data; @@ -77,8 +80,12 @@ smjs_keybinding_action_callback(va_list ap, void *data) smjs_ses = ses; - JS_CallFunctionValue(smjs_ctx, NULL, OBJECT_TO_JSVAL(jsobj), - 0, NULL, &rval); + jsval r2; + JS::RootedValue r_jsobject(smjs_ctx, r2); + r_jsobject.setObject(*jsobj); + + JS_CallFunctionValue(smjs_ctx, JS::NullPtr(), r_jsobject, + args, &r_rval); smjs_ses = NULL; @@ -86,10 +93,9 @@ smjs_keybinding_action_callback(va_list ap, void *data) } /* @keymap_class.setProperty */ -static JSBool -keymap_set_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp) +static bool +keymap_set_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, bool strict, JS::MutableHandleValue hvp) { - ELINKS_CAST_PROP_PARAMS jsid id = hid.get(); int *data; @@ -100,48 +106,49 @@ keymap_set_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSB /* This can be called if @obj if not itself an instance of the * appropriate class but has one in its prototype chain. Fail * such calls. */ - if (!JS_InstanceOf(ctx, obj, (JSClass *) &keymap_class, NULL)) - return JS_FALSE; + if (!JS_InstanceOf(ctx, hobj, (JSClass *) &keymap_class, NULL)) + return false; - data = JS_GetInstancePrivate(ctx, obj, + data = JS_GetInstancePrivate(ctx, hobj, (JSClass *) &keymap_class, NULL); /* Ugly fact: we need to get the string from the id to give to bind_do, * which will of course then convert the string back to an id... */ keymap_str = get_keymap_name((enum keymap_id) *data); - if (!keymap_str) return JS_FALSE; + if (!keymap_str) return false; - JS_IdToValue(ctx, id, &val); - keystroke_str = JS_EncodeString(ctx, JS_ValueToString(ctx, val)); - if (!keystroke_str) return JS_FALSE; + JS::RootedValue rval(ctx, val); + JS_IdToValue(ctx, id, &rval); + keystroke_str = JS_EncodeString(ctx, JS::ToString(ctx, rval)); + if (!keystroke_str) return false; - if (JSVAL_IS_STRING(*vp)) { + if (hvp.isString()) { unsigned char *action_str; - action_str = JS_EncodeString(ctx, JS_ValueToString(ctx, *vp)); - if (!action_str) return JS_FALSE; + action_str = JS_EncodeString(ctx, JS::ToString(ctx, hvp)); + if (!action_str) return false; if (bind_do(keymap_str, keystroke_str, action_str, 0)) - return JS_FALSE; + return false; - return JS_TRUE; + return true; - } else if (JSVAL_IS_NULL(*vp)) { /* before JSVAL_IS_OBJECT */ + } else if (hvp.isNull()) { /* before JSVAL_IS_OBJECT */ if (bind_do(keymap_str, keystroke_str, "none", 0)) - return JS_FALSE; + return false; - return JS_TRUE; + return true; - } else if (!JSVAL_IS_PRIMITIVE(*vp) || JSVAL_IS_NULL(*vp)) { + } else if (hvp.isObject() || hvp.isNull()) { unsigned char *err = NULL; int event_id; struct string event_name = NULL_STRING; - JSObject *jsobj = JSVAL_TO_OBJECT(*vp); + JSObject *jsobj = &hvp.toObject(); - if (JS_FALSE == JS_ObjectIsFunction(ctx, jsobj)) - return JS_FALSE; + if (false == JS_ObjectIsFunction(ctx, jsobj)) + return false; - if (!init_string(&event_name)) return JS_FALSE; + if (!init_string(&event_name)) return false; add_format_to_string(&event_name, "smjs-run-func %p", jsobj); @@ -154,7 +161,7 @@ keymap_set_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSB if (err) { alert_smjs_error(err); - return JS_FALSE; + return false; } event_id = register_event_hook(event_id, @@ -165,13 +172,13 @@ keymap_set_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSB alert_smjs_error("error registering event hook" " for keybinding"); - return JS_FALSE; + return false; } - return JS_TRUE; + return true; } - return JS_FALSE; + return false; } /* @keymap_class.finalize */ @@ -198,7 +205,7 @@ smjs_get_keymap_object(enum keymap_id keymap_id) assert(smjs_ctx); keymap_object = JS_NewObject(smjs_ctx, (JSClass *) &keymap_class, - NULL, NULL); + JS::NullPtr(),JS::NullPtr()); if (!keymap_object) return NULL; @@ -225,9 +232,12 @@ smjs_get_keymap_hash_object(void) JSObject *keymaps_hash; keymaps_hash = JS_NewObject(smjs_ctx, (JSClass *) &keymaps_hash_class, - NULL, NULL); + JS::NullPtr(), JS::NullPtr()); if (!keymaps_hash) return NULL; + JS::RootedObject r_keymaps_hash(smjs_ctx, keymaps_hash); + JS::RootedValue r_val(smjs_ctx, val); + for (keymap_id = 0; keymap_id < KEYMAP_MAX; ++keymap_id) { unsigned char *keymap_str = get_keymap_name(keymap_id); JSObject *map = smjs_get_keymap_object(keymap_id); @@ -236,9 +246,9 @@ smjs_get_keymap_hash_object(void) if (!map) return NULL; - val = OBJECT_TO_JSVAL(map); + r_val.setObject(*map); - JS_SetProperty(smjs_ctx, keymaps_hash, keymap_str, &val); + JS_SetProperty(smjs_ctx, r_keymaps_hash, keymap_str, r_val); } return keymaps_hash; @@ -256,7 +266,9 @@ smjs_init_keybinding_interface(void) keymaps_hash = smjs_get_keymap_hash_object(); if (!keymaps_hash) return; - val = OBJECT_TO_JSVAL(keymaps_hash); + JS::RootedValue r_val(smjs_ctx, val); + r_val.setObject(*keymaps_hash); + JS::RootedObject r_smjs_elinks_object(smjs_ctx, smjs_elinks_object); - JS_SetProperty(smjs_ctx, smjs_elinks_object, "keymaps", &val); + JS_SetProperty(smjs_ctx, r_smjs_elinks_object, "keymaps", r_val); } diff --git a/src/scripting/smjs/load_uri.c b/src/scripting/smjs/load_uri.c index f7011cbd..ad8a1a42 100644 --- a/src/scripting/smjs/load_uri.c +++ b/src/scripting/smjs/load_uri.c @@ -24,7 +24,7 @@ struct smjs_load_uri_hop { * jsval that points to the corresponding JSObject. Besides, * JS_AddNamedRoot is not documented to support JSFunction * pointers. */ - jsval callback; + JS::MutableHandleValue callback; }; static void @@ -32,11 +32,15 @@ smjs_loading_callback(struct download *download, void *data) { struct session *saved_smjs_ses = smjs_ses; struct smjs_load_uri_hop *hop = data; + jsval args[1], rval; JSObject *cache_entry_object; if (is_in_progress_state(download->state)) return; + JS::CallArgs argv; + JS::RootedValue r_rval(smjs_ctx, rval); + if (!download->cached) goto end; /* download->cached->object.refcount is typically 0 here @@ -52,22 +56,24 @@ smjs_loading_callback(struct download *download, void *data) if (!cache_entry_object) goto end; args[0] = OBJECT_TO_JSVAL(cache_entry_object); - JS_CallFunctionValue(smjs_ctx, NULL, hop->callback, 1, args, &rval); + argv = CallArgsFromVp(1, args); + + JS_CallFunctionValue(smjs_ctx, JS::NullPtr(), hop->callback, argv, &r_rval); end: if (download->cached) object_unlock(download->cached); - JS_RemoveValueRoot(smjs_ctx, &hop->callback); mem_free(download->data); mem_free(download); smjs_ses = saved_smjs_ses; } -static JSBool +static bool smjs_load_uri(JSContext *ctx, unsigned int argc, jsval *rval) { - jsval *argv = JS_ARGV(ctx, rval); + JS::CallArgs args = CallArgsFromVp(argc, rval); + struct smjs_load_uri_hop *hop; struct download *download; JSString *jsstr; @@ -75,45 +81,38 @@ smjs_load_uri(JSContext *ctx, unsigned int argc, jsval *rval) unsigned char *uri_string; struct uri *uri; - if (argc < 2) return JS_FALSE; + if (argc < 2) return false; - jsstr = JS_ValueToString(smjs_ctx, argv[0]); + jsstr = JS::ToString(smjs_ctx, args[0]); uri_string = JS_EncodeString(smjs_ctx, jsstr); - if (!uri_string || !*uri_string) return JS_FALSE; + if (!uri_string || !*uri_string) return false; uri = get_uri(uri_string, 0); - if (!uri) return JS_FALSE; + if (!uri) return false; external_handler = get_protocol_external_handler(NULL, uri); if (external_handler) { /* Because smjs_load_uri is carrying out an asynchronous * operation, it is inappropriate to call an external * handler here, so just return. */ - return JS_FALSE; + return false; } download = mem_alloc(sizeof(*download)); if (!download) { done_uri(uri); - return JS_FALSE; + return false; } hop = mem_alloc(sizeof(*hop)); if (!hop) { mem_free(download); done_uri(uri); - return JS_FALSE; + return false; } - hop->callback = argv[1]; + hop->callback.set(args[1]); hop->ses = smjs_ses; - if (!JS_AddNamedValueRoot(smjs_ctx, &hop->callback, - "smjs_load_uri_hop.callback")) { - mem_free(hop); - mem_free(download); - done_uri(uri); - return JS_FALSE; - } download->data = hop; download->callback = (download_callback_T *) smjs_loading_callback; @@ -122,7 +121,7 @@ smjs_load_uri(JSContext *ctx, unsigned int argc, jsval *rval) done_uri(uri); - return JS_TRUE; + return true; } void @@ -131,6 +130,8 @@ smjs_init_load_uri_interface(void) if (!smjs_ctx || !smjs_elinks_object) return; - JS_DefineFunction(smjs_ctx, smjs_elinks_object, "load_uri", + JS::RootedObject r_smjs_elinks_object(smjs_ctx, smjs_elinks_object); + + JS_DefineFunction(smjs_ctx, r_smjs_elinks_object, "load_uri", &smjs_load_uri, 2, 0); } diff --git a/src/scripting/smjs/session_object.c b/src/scripting/smjs/session_object.c index 98f8f017..f107ff6e 100644 --- a/src/scripting/smjs/session_object.c +++ b/src/scripting/smjs/session_object.c @@ -30,10 +30,10 @@ static JSObject *smjs_session_object; -static JSBool session_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); -static JSBool session_set_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp); +static bool session_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); +static bool session_set_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, bool strict, JS::MutableHandleValue hvp); static void session_finalize(JSFreeOp *op, JSObject *obj); -static JSBool session_construct(JSContext *ctx, unsigned int argc, jsval *rval); +static bool session_construct(JSContext *ctx, unsigned int argc, jsval *rval); static const JSClass session_class = { "session", @@ -44,7 +44,7 @@ static const JSClass session_class = { NULL, NULL, NULL, session_construct }; -static JSBool smjs_location_array_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); +static bool smjs_location_array_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); static void smjs_location_array_finalize(JSFreeOp *op, JSObject *obj); static const JSClass location_array_class = { @@ -62,10 +62,9 @@ static const JSClass location_array_class = { * location_array_class and related routines before session_class. */ /* @location_array.getProperty */ -static JSBool +static bool smjs_location_array_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { - ELINKS_CAST_PROP_PARAMS jsid id = hid.get(); struct session *ses; @@ -75,22 +74,22 @@ smjs_location_array_get_property(JSContext *ctx, JS::HandleObject hobj, JS::Hand /* This can be called if @obj if not itself an instance of the * appropriate class but has one in its prototype chain. Fail * such calls. */ - if (!JS_InstanceOf(ctx, obj, (JSClass *) &location_array_class, NULL)) - return JS_FALSE; + if (!JS_InstanceOf(ctx, hobj, (JSClass *) &location_array_class, NULL)) + return false; - ses = JS_GetInstancePrivate(ctx, obj, + ses = JS_GetInstancePrivate(ctx, hobj, (JSClass *) &location_array_class, NULL); - if (!ses) return JS_FALSE; + if (!ses) return false; - undef_to_jsval(ctx, vp); + hvp.setUndefined(); if (!JSID_IS_INT(id)) - return JS_FALSE; + return false; assert(ses); - if_assert_failed return JS_TRUE; + if_assert_failed return true; - if (!have_location(ses)) return JS_FALSE; + if (!have_location(ses)) return false; index = JSID_TO_INT(id); for (loc = cur_loc(ses); @@ -99,15 +98,17 @@ smjs_location_array_get_property(JSContext *ctx, JS::HandleObject hobj, JS::Hand if (!index) { JSObject *obj = smjs_get_view_state_object(&loc->vs); - if (obj) object_to_jsval(ctx, vp, obj); + if (obj) { + hvp.setObject(*obj); + } - return JS_TRUE; + return true; } index += index > 0 ? -1 : 1; } - return JS_FALSE; + return false; } /** Pointed to by location_array_class.finalize. SpiderMonkey automatically @@ -147,7 +148,7 @@ smjs_get_session_location_array_object(struct session *ses) assert(smjs_ctx); if_assert_failed return NULL; - obj = JS_NewObject(smjs_ctx, (JSClass *) &location_array_class, NULL, NULL); + obj = JS_NewObject(smjs_ctx, (JSClass *) &location_array_class, JS::NullPtr(), JS::NullPtr()); if (!obj) return NULL; /* Do this last, so that if any previous step fails, we can @@ -163,6 +164,30 @@ smjs_get_session_location_array_object(struct session *ses) * smjs_detach_session_object detaches both session.jsobject and * session.history.js_object. */ +static bool session_get_property_visited(JSContext *ctx, unsigned int argc, jsval *vp); +static bool session_set_property_visited(JSContext *ctx, unsigned int argc, jsval *vp); +static bool session_get_property_history(JSContext *ctx, unsigned int argc, jsval *vp); +static bool session_get_property_loading_uri(JSContext *ctx, unsigned int argc, jsval *vp); +static bool session_get_property_reloadlevel(JSContext *ctx, unsigned int argc, jsval *vp); +static bool session_set_property_reloadlevel(JSContext *ctx, unsigned int argc, jsval *vp); +static bool session_get_property_redirect_cnt(JSContext *ctx, unsigned int argc, jsval *vp); +static bool session_set_property_redirect_cnt(JSContext *ctx, unsigned int argc, jsval *vp); +static bool session_get_property_search_direction(JSContext *ctx, unsigned int argc, jsval *vp); +static bool session_set_property_search_direction(JSContext *ctx, unsigned int argc, jsval *vp); +static bool session_get_property_kbdprefix(JSContext *ctx, unsigned int argc, jsval *vp); +static bool session_set_property_kbdprefix(JSContext *ctx, unsigned int argc, jsval *vp); + +static bool session_get_property_mark(JSContext *ctx, unsigned int argc, jsval *vp); +static bool session_set_property_mark(JSContext *ctx, unsigned int argc, jsval *vp); +static bool session_get_property_exit_query(JSContext *ctx, unsigned int argc, jsval *vp); +static bool session_get_property_insert_mode(JSContext *ctx, unsigned int argc, jsval *vp); +static bool session_set_property_insert_mode(JSContext *ctx, unsigned int argc, jsval *vp); +static bool session_get_property_navigate_mode(JSContext *ctx, unsigned int argc, jsval *vp); +static bool session_set_property_navigate_mode(JSContext *ctx, unsigned int argc, jsval *vp); +static bool session_get_property_search_word(JSContext *ctx, unsigned int argc, jsval *vp); +static bool session_set_property_search_word(JSContext *ctx, unsigned int argc, jsval *vp); +static bool session_get_property_last_search_word(JSContext *ctx, unsigned int argc, jsval *vp); +static bool session_set_property_last_search_word(JSContext *ctx, unsigned int argc, jsval *vp); enum session_prop { SESSION_VISITED, @@ -184,30 +209,353 @@ enum session_prop { }; static const JSPropertySpec session_props[] = { - { "visited", SESSION_VISITED, JSPROP_ENUMERATE }, - { "history", SESSION_HISTORY, JSPROP_ENUMERATE | JSPROP_READONLY }, - { "loading_uri", SESSION_LOADING_URI, JSPROP_ENUMERATE | JSPROP_READONLY }, - { "reloadlevel", SESSION_RELOADLEVEL, JSPROP_ENUMERATE }, - { "redirect_cnt", SESSION_REDIRECT_CNT, JSPROP_ENUMERATE }, + JS_PSGS("visited", session_get_property_visited, session_set_property_visited, JSPROP_ENUMERATE), + JS_PSG("history", session_get_property_history, JSPROP_ENUMERATE), + JS_PSG("loading_uri", session_get_property_loading_uri, JSPROP_ENUMERATE), + JS_PSGS("reloadlevel", session_get_property_reloadlevel, session_set_property_reloadlevel, JSPROP_ENUMERATE), + JS_PSGS("redirect_cnt", session_get_property_redirect_cnt, session_set_property_redirect_cnt, JSPROP_ENUMERATE), /* XXX: { "doc_view", SESSION_DOC_VIEW, JSPROP_ENUMERATE | JSPROP_READONLY }, */ /* XXX: { "frames", SESSION_FRAMES, JSPROP_ENUMERATE | JSPROP_READONLY }, */ - { "search_direction", SESSION_SEARCH_DIRECTION, JSPROP_ENUMERATE }, - { "kbdprefix", SESSION_KBDPREFIX, JSPROP_ENUMERATE }, - { "mark", SESSION_MARK_WAITING_FOR, JSPROP_ENUMERATE }, - { "exit_query", SESSION_EXIT_QUERY, JSPROP_ENUMERATE | JSPROP_READONLY }, - { "insert_mode", SESSION_INSERT_MODE, JSPROP_ENUMERATE }, - { "navigate_mode", SESSION_NAVIGATE_MODE, JSPROP_ENUMERATE }, - { "search_word", SESSION_SEARCH_WORD, JSPROP_ENUMERATE }, - { "last_search_word", SESSION_LAST_SEARCH_WORD, JSPROP_ENUMERATE }, + JS_PSGS("search_direction", session_get_property_search_direction, session_set_property_search_direction, JSPROP_ENUMERATE), + JS_PSGS("kbdprefix", session_get_property_kbdprefix, session_set_property_kbdprefix, JSPROP_ENUMERATE), + JS_PSGS("mark", session_get_property_mark, session_set_property_mark, JSPROP_ENUMERATE), + JS_PSG("exit_query", session_get_property_exit_query, JSPROP_ENUMERATE), + JS_PSGS("insert_mode", session_get_property_insert_mode, session_set_property_insert_mode, JSPROP_ENUMERATE), + JS_PSGS("navigate_mode", session_get_property_navigate_mode, session_set_property_navigate_mode, JSPROP_ENUMERATE), + JS_PSGS("search_word", session_get_property_search_word, session_set_property_search_word, JSPROP_ENUMERATE), + JS_PSGS("last_search_word", session_get_property_last_search_word, session_set_property_last_search_word, JSPROP_ENUMERATE), /* XXX: { "type_queries", SESSION_TYPE_QUERIES, JSPROP_ENUMERATE }, */ - { NULL } + JS_PS_END }; +static bool +session_get_property_visited(JSContext *ctx, unsigned int argc, jsval *vp) +{ + JS::CallArgs args = CallArgsFromVp(argc, vp); + JS::RootedObject hobj(ctx, &args.thisv().toObject()); + + struct session *ses; + + /* This can be called if @obj if not itself an instance of the + * appropriate class but has one in its prototype chain. Fail + * such calls. */ + if (!JS_InstanceOf(ctx, hobj, (JSClass *) &session_class, NULL)) + return false; + + ses = JS_GetInstancePrivate(ctx, hobj, + (JSClass *) &session_class, NULL); + if (!ses) return false; + + args.rval().setInt32(ses->status.visited); + + return true; +} + +static bool +session_get_property_history(JSContext *ctx, unsigned int argc, jsval *vp) +{ + JS::CallArgs args = CallArgsFromVp(argc, vp); + JS::RootedObject hobj(ctx, &args.thisv().toObject()); + + struct session *ses; + + /* This can be called if @obj if not itself an instance of the + * appropriate class but has one in its prototype chain. Fail + * such calls. */ + if (!JS_InstanceOf(ctx, hobj, (JSClass *) &session_class, NULL)) + return false; + + ses = JS_GetInstancePrivate(ctx, hobj, + (JSClass *) &session_class, NULL); + if (!ses) return false; + + JSObject *obj = smjs_get_session_location_array_object(ses); + + if (obj) { + args.rval().setObject(*obj); + } else { + args.rval().setUndefined(); + } + + return true; +} + +static bool +session_get_property_loading_uri(JSContext *ctx, unsigned int argc, jsval *vp) +{ + JS::CallArgs args = CallArgsFromVp(argc, vp); + JS::RootedObject hobj(ctx, &args.thisv().toObject()); + + struct session *ses; + + /* This can be called if @obj if not itself an instance of the + * appropriate class but has one in its prototype chain. Fail + * such calls. */ + if (!JS_InstanceOf(ctx, hobj, (JSClass *) &session_class, NULL)) + return false; + + ses = JS_GetInstancePrivate(ctx, hobj, + (JSClass *) &session_class, NULL); + if (!ses) return false; + + struct uri *uri = have_location(ses) ? cur_loc(ses)->vs.uri + : ses->loading_uri; + + if (uri) { + args.rval().setString(JS_NewStringCopyZ(ctx, struri(uri))); + } else { + args.rval().setUndefined(); + } + + return true; +} + +static bool +session_get_property_reloadlevel(JSContext *ctx, unsigned int argc, jsval *vp) +{ + JS::CallArgs args = CallArgsFromVp(argc, vp); + JS::RootedObject hobj(ctx, &args.thisv().toObject()); + + struct session *ses; + + /* This can be called if @obj if not itself an instance of the + * appropriate class but has one in its prototype chain. Fail + * such calls. */ + if (!JS_InstanceOf(ctx, hobj, (JSClass *) &session_class, NULL)) + return false; + + ses = JS_GetInstancePrivate(ctx, hobj, + (JSClass *) &session_class, NULL); + if (!ses) return false; + + args.rval().setInt32(ses->reloadlevel); + + return true; +} + +static bool +session_get_property_redirect_cnt(JSContext *ctx, unsigned int argc, jsval *vp) +{ + JS::CallArgs args = CallArgsFromVp(argc, vp); + JS::RootedObject hobj(ctx, &args.thisv().toObject()); + + struct session *ses; + + /* This can be called if @obj if not itself an instance of the + * appropriate class but has one in its prototype chain. Fail + * such calls. */ + if (!JS_InstanceOf(ctx, hobj, (JSClass *) &session_class, NULL)) + return false; + + ses = JS_GetInstancePrivate(ctx, hobj, + (JSClass *) &session_class, NULL); + if (!ses) return false; + + args.rval().setInt32(ses->redirect_cnt); + + return true; +} + +static bool +session_get_property_search_direction(JSContext *ctx, unsigned int argc, jsval *vp) +{ + JS::CallArgs args = CallArgsFromVp(argc, vp); + JS::RootedObject hobj(ctx, &args.thisv().toObject()); + + struct session *ses; + + /* This can be called if @obj if not itself an instance of the + * appropriate class but has one in its prototype chain. Fail + * such calls. */ + if (!JS_InstanceOf(ctx, hobj, (JSClass *) &session_class, NULL)) + return false; + + ses = JS_GetInstancePrivate(ctx, hobj, + (JSClass *) &session_class, NULL); + if (!ses) return false; + + args.rval().setString(JS_NewStringCopyZ(ctx, ses->search_direction == 1 ? "down" : "up")); + + return true; +} + +static bool +session_get_property_kbdprefix(JSContext *ctx, unsigned int argc, jsval *vp) +{ + JS::CallArgs args = CallArgsFromVp(argc, vp); + JS::RootedObject hobj(ctx, &args.thisv().toObject()); + + struct session *ses; + + /* This can be called if @obj if not itself an instance of the + * appropriate class but has one in its prototype chain. Fail + * such calls. */ + if (!JS_InstanceOf(ctx, hobj, (JSClass *) &session_class, NULL)) + return false; + + ses = JS_GetInstancePrivate(ctx, hobj, + (JSClass *) &session_class, NULL); + if (!ses) return false; + + args.rval().setInt32(ses->kbdprefix.repeat_count); + + return true; +} + +static bool +session_get_property_mark(JSContext *ctx, unsigned int argc, jsval *vp) +{ + JS::CallArgs args = CallArgsFromVp(argc, vp); + JS::RootedObject hobj(ctx, &args.thisv().toObject()); + + struct session *ses; + + /* This can be called if @obj if not itself an instance of the + * appropriate class but has one in its prototype chain. Fail + * such calls. */ + if (!JS_InstanceOf(ctx, hobj, (JSClass *) &session_class, NULL)) + return false; + + ses = JS_GetInstancePrivate(ctx, hobj, + (JSClass *) &session_class, NULL); + if (!ses) return false; + + args.rval().setString(JS_NewStringCopyZ(ctx, ses->kbdprefix.mark == KP_MARK_NOTHING + ? "nothing" + : ses->kbdprefix.mark == KP_MARK_SET + ? "set" + : "goto")); + + return true; +} + +static bool +session_get_property_exit_query(JSContext *ctx, unsigned int argc, jsval *vp) +{ + JS::CallArgs args = CallArgsFromVp(argc, vp); + JS::RootedObject hobj(ctx, &args.thisv().toObject()); + + struct session *ses; + + /* This can be called if @obj if not itself an instance of the + * appropriate class but has one in its prototype chain. Fail + * such calls. */ + if (!JS_InstanceOf(ctx, hobj, (JSClass *) &session_class, NULL)) + return false; + + ses = JS_GetInstancePrivate(ctx, hobj, + (JSClass *) &session_class, NULL); + if (!ses) return false; + + args.rval().setInt32(ses->exit_query); + + return true; +} + +static bool +session_get_property_insert_mode(JSContext *ctx, unsigned int argc, jsval *vp) +{ + JS::CallArgs args = CallArgsFromVp(argc, vp); + JS::RootedObject hobj(ctx, &args.thisv().toObject()); + + struct session *ses; + + /* This can be called if @obj if not itself an instance of the + * appropriate class but has one in its prototype chain. Fail + * such calls. */ + if (!JS_InstanceOf(ctx, hobj, (JSClass *) &session_class, NULL)) + return false; + + ses = JS_GetInstancePrivate(ctx, hobj, + (JSClass *) &session_class, NULL); + if (!ses) return false; + + args.rval().setString(JS_NewStringCopyZ(ctx, + ses->insert_mode == INSERT_MODE_LESS + ? "disabled" + : ses->insert_mode == INSERT_MODE_ON + ? "on" + : "off")); + + return true; +} + +static bool +session_get_property_navigate_mode(JSContext *ctx, unsigned int argc, jsval *vp) +{ + JS::CallArgs args = CallArgsFromVp(argc, vp); + JS::RootedObject hobj(ctx, &args.thisv().toObject()); + + struct session *ses; + + /* This can be called if @obj if not itself an instance of the + * appropriate class but has one in its prototype chain. Fail + * such calls. */ + if (!JS_InstanceOf(ctx, hobj, (JSClass *) &session_class, NULL)) + return false; + + ses = JS_GetInstancePrivate(ctx, hobj, + (JSClass *) &session_class, NULL); + if (!ses) return false; + + args.rval().setString(JS_NewStringCopyZ(ctx, + ses->navigate_mode == NAVIGATE_CURSOR_ROUTING + ? "cursor" + : "linkwise")); + + return true; +} + +static bool +session_get_property_search_word(JSContext *ctx, unsigned int argc, jsval *vp) +{ + JS::CallArgs args = CallArgsFromVp(argc, vp); + JS::RootedObject hobj(ctx, &args.thisv().toObject()); + + struct session *ses; + + /* This can be called if @obj if not itself an instance of the + * appropriate class but has one in its prototype chain. Fail + * such calls. */ + if (!JS_InstanceOf(ctx, hobj, (JSClass *) &session_class, NULL)) + return false; + + ses = JS_GetInstancePrivate(ctx, hobj, + (JSClass *) &session_class, NULL); + if (!ses) return false; + + args.rval().setString(JS_NewStringCopyZ(ctx, ses->search_word)); + + return true; +} + +static bool +session_get_property_last_search_word(JSContext *ctx, unsigned int argc, jsval *vp) +{ + JS::CallArgs args = CallArgsFromVp(argc, vp); + JS::RootedObject hobj(ctx, &args.thisv().toObject()); + + struct session *ses; + + /* This can be called if @obj if not itself an instance of the + * appropriate class but has one in its prototype chain. Fail + * such calls. */ + if (!JS_InstanceOf(ctx, hobj, (JSClass *) &session_class, NULL)) + return false; + + ses = JS_GetInstancePrivate(ctx, hobj, + (JSClass *) &session_class, NULL); + if (!ses) return false; + + args.rval().setString(JS_NewStringCopyZ(ctx, ses->last_search_word)); + + return true; +} + /* @session_class.getProperty */ -static JSBool +static bool session_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { - ELINKS_CAST_PROP_PARAMS jsid id = hid.get(); struct session *ses; @@ -215,108 +563,421 @@ session_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS /* This can be called if @obj if not itself an instance of the * appropriate class but has one in its prototype chain. Fail * such calls. */ - if (!JS_InstanceOf(ctx, obj, (JSClass *) &session_class, NULL)) - return JS_FALSE; + if (!JS_InstanceOf(ctx, hobj, (JSClass *) &session_class, NULL)) + return false; - ses = JS_GetInstancePrivate(ctx, obj, + ses = JS_GetInstancePrivate(ctx, hobj, (JSClass *) &session_class, NULL); - if (!ses) return JS_FALSE; + if (!ses) return false; if (!JSID_IS_INT(id)) { - /* Note: If we return JS_FALSE here, the object's methods do not + /* Note: If we return false here, the object's methods do not * work. */ - return JS_TRUE; + return true; } /* XXX: Lock session here if it is ever changed to have an OBJECT_HEAD. */ - undef_to_jsval(ctx, vp); + hvp.setUndefined(); switch (JSID_TO_INT(id)) { case SESSION_VISITED: - int_to_jsval(ctx, vp, ses->status.visited); + hvp.setInt32(ses->status.visited); - return JS_TRUE; + return true; case SESSION_HISTORY: { JSObject *obj = smjs_get_session_location_array_object(ses); - if (obj) object_to_jsval(ctx, vp, obj); + if (obj) { + hvp.setObject(*obj); + } - return JS_TRUE; + return true; } case SESSION_LOADING_URI: { struct uri *uri = have_location(ses) ? cur_loc(ses)->vs.uri : ses->loading_uri; - if (uri) string_to_jsval(ctx, vp, struri(uri)); + if (uri) { + hvp.setString(JS_NewStringCopyZ(ctx, struri(uri))); + } - return JS_TRUE; + return true; } case SESSION_RELOADLEVEL: - int_to_jsval(ctx, vp, ses->reloadlevel); + hvp.setInt32(ses->reloadlevel); - return JS_TRUE; + return true; case SESSION_REDIRECT_CNT: - int_to_jsval(ctx, vp, ses->redirect_cnt); + hvp.setInt32(ses->redirect_cnt); - return JS_TRUE; + return true; case SESSION_SEARCH_DIRECTION: - string_to_jsval(ctx, vp, ses->search_direction == 1 ? "down" - : "up"); + hvp.setString(JS_NewStringCopyZ(ctx, ses->search_direction == 1 ? "down" : "up")); - return JS_TRUE; + return true; case SESSION_KBDPREFIX: - int_to_jsval(ctx, vp, ses->kbdprefix.repeat_count); + hvp.setInt32(ses->kbdprefix.repeat_count); - return JS_TRUE; + return true; case SESSION_MARK_WAITING_FOR: - string_to_jsval(ctx, vp, ses->kbdprefix.mark == KP_MARK_NOTHING + hvp.setString(JS_NewStringCopyZ(ctx, ses->kbdprefix.mark == KP_MARK_NOTHING ? "nothing" : ses->kbdprefix.mark == KP_MARK_SET ? "set" - : "goto"); + : "goto")); - return JS_TRUE; + return true; case SESSION_EXIT_QUERY: - int_to_jsval(ctx, vp, ses->exit_query); + hvp.setInt32(ses->exit_query); - return JS_TRUE; + return true; case SESSION_INSERT_MODE: - string_to_jsval(ctx, vp, + hvp.setString(JS_NewStringCopyZ(ctx, ses->insert_mode == INSERT_MODE_LESS ? "disabled" : ses->insert_mode == INSERT_MODE_ON ? "on" - : "off"); + : "off")); - return JS_TRUE; + return true; case SESSION_NAVIGATE_MODE: - string_to_jsval(ctx, vp, + hvp.setString(JS_NewStringCopyZ(ctx, ses->navigate_mode == NAVIGATE_CURSOR_ROUTING ? "cursor" - : "linkwise"); + : "linkwise")); - return JS_TRUE; + return true; case SESSION_SEARCH_WORD: - string_to_jsval(ctx, vp, ses->search_word); + hvp.setString(JS_NewStringCopyZ(ctx, ses->search_word)); - return JS_TRUE; + return true; case SESSION_LAST_SEARCH_WORD: - string_to_jsval(ctx, vp, ses->last_search_word); + hvp.setString(JS_NewStringCopyZ(ctx, ses->last_search_word)); - return JS_TRUE; + return true; default: INTERNAL("Invalid ID %d in session_get_property().", JSID_TO_INT(id)); } - return JS_FALSE; + return false; } -static JSBool -session_set_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp) +static bool +session_set_property_visited(JSContext *ctx, unsigned int argc, jsval *vp) +{ + JS::CallArgs args = CallArgsFromVp(argc, vp); + JS::RootedObject hobj(ctx, &args.thisv().toObject()); + + struct session *ses; + + /* This can be called if @obj if not itself an instance of the + * appropriate class but has one in its prototype chain. Fail + * such calls. */ + if (!JS_InstanceOf(ctx, hobj, (JSClass *) &session_class, NULL)) + return false; + + ses = JS_GetInstancePrivate(ctx, hobj, + (JSClass *) &session_class, NULL); + if (!ses) return false; + + int v = args[0].toInt32(); + ses->status.visited = v; + + return true; +} + +static bool +session_set_property_reloadlevel(JSContext *ctx, unsigned int argc, jsval *vp) +{ + JS::CallArgs args = CallArgsFromVp(argc, vp); + JS::RootedObject hobj(ctx, &args.thisv().toObject()); + + struct session *ses; + + /* This can be called if @obj if not itself an instance of the + * appropriate class but has one in its prototype chain. Fail + * such calls. */ + if (!JS_InstanceOf(ctx, hobj, (JSClass *) &session_class, NULL)) + return false; + + ses = JS_GetInstancePrivate(ctx, hobj, + (JSClass *) &session_class, NULL); + if (!ses) return false; + + JS::ToInt32(ctx, args[0], &ses->reloadlevel); + + return true; +} + +static bool +session_set_property_redirect_cnt(JSContext *ctx, unsigned int argc, jsval *vp) +{ + JS::CallArgs args = CallArgsFromVp(argc, vp); + JS::RootedObject hobj(ctx, &args.thisv().toObject()); + + struct session *ses; + + /* This can be called if @obj if not itself an instance of the + * appropriate class but has one in its prototype chain. Fail + * such calls. */ + if (!JS_InstanceOf(ctx, hobj, (JSClass *) &session_class, NULL)) + return false; + + ses = JS_GetInstancePrivate(ctx, hobj, + (JSClass *) &session_class, NULL); + if (!ses) return false; + + JS::ToInt32(ctx, args[0], &ses->redirect_cnt); + + return true; +} + +static bool +session_set_property_search_direction(JSContext *ctx, unsigned int argc, jsval *vp) +{ + JS::CallArgs args = CallArgsFromVp(argc, vp); + JS::RootedObject hobj(ctx, &args.thisv().toObject()); + + struct session *ses; + + /* This can be called if @obj if not itself an instance of the + * appropriate class but has one in its prototype chain. Fail + * such calls. */ + if (!JS_InstanceOf(ctx, hobj, (JSClass *) &session_class, NULL)) + return false; + + ses = JS_GetInstancePrivate(ctx, hobj, + (JSClass *) &session_class, NULL); + if (!ses) return false; + + unsigned char *str; + JSString *jsstr; + + jsstr = JS::ToString(ctx, args[0]); + if (!jsstr) return true; + + str = JS_EncodeString(ctx, jsstr); + if (!str) return true; + + if (!strcmp(str, "up")) + ses->search_direction = -1; + else if (!strcmp(str, "down")) + ses->search_direction = 1; + else + return false; + + return true; +} + +static bool +session_set_property_kbdprefix(JSContext *ctx, unsigned int argc, jsval *vp) +{ + JS::CallArgs args = CallArgsFromVp(argc, vp); + JS::RootedObject hobj(ctx, &args.thisv().toObject()); + + struct session *ses; + + /* This can be called if @obj if not itself an instance of the + * appropriate class but has one in its prototype chain. Fail + * such calls. */ + if (!JS_InstanceOf(ctx, hobj, (JSClass *) &session_class, NULL)) + return false; + + ses = JS_GetInstancePrivate(ctx, hobj, + (JSClass *) &session_class, NULL); + if (!ses) return false; + + JS::ToInt32(ctx, args[0], &ses->kbdprefix.repeat_count); + + return true; +} + +static bool +session_set_property_mark(JSContext *ctx, unsigned int argc, jsval *vp) +{ + JS::CallArgs args = CallArgsFromVp(argc, vp); + JS::RootedObject hobj(ctx, &args.thisv().toObject()); + + struct session *ses; + + /* This can be called if @obj if not itself an instance of the + * appropriate class but has one in its prototype chain. Fail + * such calls. */ + if (!JS_InstanceOf(ctx, hobj, (JSClass *) &session_class, NULL)) + return false; + + ses = JS_GetInstancePrivate(ctx, hobj, + (JSClass *) &session_class, NULL); + if (!ses) return false; + + unsigned char *str; + JSString *jsstr; + + jsstr = JS::ToString(ctx, args[0]); + if (!jsstr) return true; + + str = JS_EncodeString(ctx, jsstr); + if (!str) return true; + + if (!strcmp(str, "nothing")) + ses->kbdprefix.mark = KP_MARK_NOTHING; + else if (!strcmp(str, "set")) + ses->kbdprefix.mark = KP_MARK_SET; + else if (!strcmp(str, "goto")) + ses->kbdprefix.mark = KP_MARK_GOTO; + else + return false; + + return true; +} + +static bool +session_set_property_insert_mode(JSContext *ctx, unsigned int argc, jsval *vp) +{ + JS::CallArgs args = CallArgsFromVp(argc, vp); + JS::RootedObject hobj(ctx, &args.thisv().toObject()); + + struct session *ses; + + /* This can be called if @obj if not itself an instance of the + * appropriate class but has one in its prototype chain. Fail + * such calls. */ + if (!JS_InstanceOf(ctx, hobj, (JSClass *) &session_class, NULL)) + return false; + + ses = JS_GetInstancePrivate(ctx, hobj, + (JSClass *) &session_class, NULL); + if (!ses) return false; + + unsigned char *str; + JSString *jsstr; + + jsstr = JS::ToString(ctx, args[0]); + if (!jsstr) return true; + + str = JS_EncodeString(ctx, jsstr); + if (!str) return true; + + if (!strcmp(str, "disabled")) + ses->insert_mode = INSERT_MODE_LESS; + else if (!strcmp(str, "on")) + ses->insert_mode = INSERT_MODE_ON; + else if (!strcmp(str, "off")) + ses->insert_mode = INSERT_MODE_OFF; + else + return false; + + return true; +} + +static bool +session_set_property_navigate_mode(JSContext *ctx, unsigned int argc, jsval *vp) +{ + JS::CallArgs args = CallArgsFromVp(argc, vp); + JS::RootedObject hobj(ctx, &args.thisv().toObject()); + + struct session *ses; + + /* This can be called if @obj if not itself an instance of the + * appropriate class but has one in its prototype chain. Fail + * such calls. */ + if (!JS_InstanceOf(ctx, hobj, (JSClass *) &session_class, NULL)) + return false; + + ses = JS_GetInstancePrivate(ctx, hobj, + (JSClass *) &session_class, NULL); + if (!ses) return false; + + unsigned char *str; + JSString *jsstr; + + jsstr = JS::ToString(ctx, args[0]); + if (!jsstr) return true; + + str = JS_EncodeString(ctx, jsstr); + if (!str) return true; + + if (!strcmp(str, "cursor")) + ses->navigate_mode = NAVIGATE_CURSOR_ROUTING; + else if (!strcmp(str, "linkwise")) + ses->navigate_mode = NAVIGATE_LINKWISE; + else + return false; + + return true; +} + +static bool +session_set_property_search_word(JSContext *ctx, unsigned int argc, jsval *vp) +{ + JS::CallArgs args = CallArgsFromVp(argc, vp); + JS::RootedObject hobj(ctx, &args.thisv().toObject()); + + struct session *ses; + + /* This can be called if @obj if not itself an instance of the + * appropriate class but has one in its prototype chain. Fail + * such calls. */ + if (!JS_InstanceOf(ctx, hobj, (JSClass *) &session_class, NULL)) + return false; + + ses = JS_GetInstancePrivate(ctx, hobj, + (JSClass *) &session_class, NULL); + if (!ses) return false; + + unsigned char *str; + JSString *jsstr; + + jsstr = JS::ToString(ctx, args[0]); + if (!jsstr) return true; + + str = JS_EncodeString(ctx, jsstr); + if (!str) return true; + + mem_free_set(&ses->search_word, str); + + return true; +} + +static bool +session_set_property_last_search_word(JSContext *ctx, unsigned int argc, jsval *vp) +{ + JS::CallArgs args = CallArgsFromVp(argc, vp); + JS::RootedObject hobj(ctx, &args.thisv().toObject()); + + struct session *ses; + + /* This can be called if @obj if not itself an instance of the + * appropriate class but has one in its prototype chain. Fail + * such calls. */ + if (!JS_InstanceOf(ctx, hobj, (JSClass *) &session_class, NULL)) + return false; + + ses = JS_GetInstancePrivate(ctx, hobj, + (JSClass *) &session_class, NULL); + if (!ses) return false; + + unsigned char *str; + JSString *jsstr; + + jsstr = JS::ToString(ctx, args[0]); + if (!jsstr) return true; + + str = JS_EncodeString(ctx, jsstr); + if (!str) return true; + + mem_free_set(&ses->last_search_word, str); + + return true; +} + + + +static bool +session_set_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, bool strict, JS::MutableHandleValue hvp) { - ELINKS_CAST_PROP_PARAMS jsid id = hid.get(); struct session *ses; @@ -324,63 +985,65 @@ session_set_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS /* This can be called if @obj if not itself an instance of the * appropriate class but has one in its prototype chain. Fail * such calls. */ - if (!JS_InstanceOf(ctx, obj, (JSClass *) &session_class, NULL)) - return JS_FALSE; + if (!JS_InstanceOf(ctx, hobj, (JSClass *) &session_class, NULL)) + return false; - ses = JS_GetInstancePrivate(ctx, obj, + ses = JS_GetInstancePrivate(ctx, hobj, (JSClass *) &session_class, NULL); - if (!ses) return JS_FALSE; + if (!ses) return false; if (!JSID_IS_INT(id)) - return JS_FALSE; + return false; switch (JSID_TO_INT(id)) { case SESSION_VISITED: - ses->status.visited = atol(jsval_to_string(ctx, vp)); + int v; + JS::ToInt32(ctx, hvp, &v); + ses->status.visited = v; - return JS_TRUE; + return true; /* SESSION_HISTORY is RO */ /* SESSION_LOADING_URI is RO */ case SESSION_RELOADLEVEL: - ses->reloadlevel = atol(jsval_to_string(ctx, vp)); + JS::ToInt32(ctx, hvp, &ses->reloadlevel); - return JS_TRUE; + return true; case SESSION_REDIRECT_CNT: - ses->redirect_cnt = atol(jsval_to_string(ctx, vp)); + JS::ToInt32(ctx, hvp, &ses->redirect_cnt); - return JS_TRUE; + return true; case SESSION_SEARCH_DIRECTION: { unsigned char *str; JSString *jsstr; - jsstr = JS_ValueToString(ctx, *vp); - if (!jsstr) return JS_TRUE; + jsstr = JS::ToString(ctx, hvp); + if (!jsstr) return true; str = JS_EncodeString(ctx, jsstr); - if (!str) return JS_TRUE; + if (!str) return true; if (!strcmp(str, "up")) ses->search_direction = -1; else if (!strcmp(str, "down")) ses->search_direction = 1; else - return JS_FALSE; + return false; - return JS_TRUE; + return true; } case SESSION_KBDPREFIX: - ses->kbdprefix.repeat_count = atol(jsval_to_string(ctx, vp)); + JS::ToInt32(ctx, hvp, &ses->kbdprefix.repeat_count); - return JS_TRUE; + return true; case SESSION_MARK_WAITING_FOR: { unsigned char *str; JSString *jsstr; - jsstr = JS_ValueToString(ctx, *vp); - if (!jsstr) return JS_TRUE; + jsstr = JS::ToString(ctx, hvp); + if (!jsstr) return true; str = JS_EncodeString(ctx, jsstr); - if (!str) return JS_TRUE; + if (!str) return true; if (!strcmp(str, "nothing")) ses->kbdprefix.mark = KP_MARK_NOTHING; @@ -389,20 +1052,20 @@ session_set_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS else if (!strcmp(str, "goto")) ses->kbdprefix.mark = KP_MARK_GOTO; else - return JS_FALSE; + return false; - return JS_TRUE; + return true; } /* SESSION_EXIT_QUERY is RO */ case SESSION_INSERT_MODE: { unsigned char *str; JSString *jsstr; - jsstr = JS_ValueToString(ctx, *vp); - if (!jsstr) return JS_TRUE; + jsstr = JS::ToString(ctx, hvp); + if (!jsstr) return true; str = JS_EncodeString(ctx, jsstr); - if (!str) return JS_TRUE; + if (!str) return true; if (!strcmp(str, "disabled")) ses->insert_mode = INSERT_MODE_LESS; @@ -411,96 +1074,97 @@ session_set_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS else if (!strcmp(str, "off")) ses->insert_mode = INSERT_MODE_OFF; else - return JS_FALSE; + return false; - return JS_TRUE; + return true; } case SESSION_NAVIGATE_MODE: { unsigned char *str; JSString *jsstr; - jsstr = JS_ValueToString(ctx, *vp); - if (!jsstr) return JS_TRUE; + jsstr = JS::ToString(ctx, hvp); + if (!jsstr) return true; str = JS_EncodeString(ctx, jsstr); - if (!str) return JS_TRUE; + if (!str) return true; if (!strcmp(str, "cursor")) ses->navigate_mode = NAVIGATE_CURSOR_ROUTING; else if (!strcmp(str, "linkwise")) ses->navigate_mode = NAVIGATE_LINKWISE; else - return JS_FALSE; + return false; - return JS_TRUE; + return true; } case SESSION_SEARCH_WORD: { unsigned char *str; JSString *jsstr; - jsstr = JS_ValueToString(ctx, *vp); - if (!jsstr) return JS_TRUE; + jsstr = JS::ToString(ctx, hvp); + if (!jsstr) return true; str = JS_EncodeString(ctx, jsstr); - if (!str) return JS_TRUE; + if (!str) return true; mem_free_set(&ses->search_word, str); - return JS_TRUE; + return true; } case SESSION_LAST_SEARCH_WORD: { unsigned char *str; JSString *jsstr; - jsstr = JS_ValueToString(ctx, *vp); - if (!jsstr) return JS_TRUE; + jsstr = JS::ToString(ctx, hvp); + if (!jsstr) return true; str = JS_EncodeString(ctx, jsstr); - if (!str) return JS_TRUE; + if (!str) return true; mem_free_set(&ses->last_search_word, str); - return JS_TRUE; + return true; } default: INTERNAL("Invalid ID %d in session_set_property().", JSID_TO_INT(id)); } - return JS_FALSE; + return false; } /** Pointed to by session_class.construct. Create a new session (tab) * and return the JSObject wrapper. */ -static JSBool +static bool session_construct(JSContext *ctx, unsigned int argc, jsval *rval) { + JS::CallArgs args = CallArgsFromVp(argc, rval); + JS::RootedObject hobj(ctx, &args.thisv().toObject()); + jsval val; - jsval *argv = JS_ARGV(ctx, rval); int bg = 0; /* open new tab in background */ struct session *ses; JSObject *jsobj; if (argc > 1) { - return JS_TRUE; + return true; } if (argc >= 1) { - bg = jsval_to_boolean(ctx, &argv[0]); + bg = args[0].toBoolean(); } - if (!smjs_ses) return JS_FALSE; + if (!smjs_ses) return false; ses = init_session(smjs_ses, smjs_ses->tab->term, NULL, bg); - if (!ses) return JS_FALSE; + if (!ses) return false; jsobj = smjs_get_session_object(ses); - if (!jsobj) return JS_FALSE; + if (!jsobj) return false; - object_to_jsval(ctx, &val, jsobj); - JS_SET_RVAL(ctx, rval, val); + args.rval().setObject(*jsobj); - return JS_TRUE; + return true; } /** Pointed to by session_class.finalize. SpiderMonkey automatically @@ -540,10 +1204,12 @@ smjs_get_session_object(struct session *ses) assert(smjs_ctx); if_assert_failed return NULL; - obj = JS_NewObject(smjs_ctx, (JSClass *) &session_class, NULL, NULL); + obj = JS_NewObject(smjs_ctx, (JSClass *) &session_class, JS::NullPtr(), JS::NullPtr()); if (!obj) return NULL; - if (JS_FALSE == JS_DefineProperties(smjs_ctx, obj, + JS::RootedObject r_obj(smjs_ctx, obj); + + if (false == JS_DefineProperties(smjs_ctx, r_obj, (JSPropertySpec *) session_props)) return NULL; @@ -568,7 +1234,8 @@ smjs_detach_session_object(struct session *ses) if_assert_failed return; if (ses->jsobject) { - assert(JS_GetInstancePrivate(smjs_ctx, ses->jsobject, + JS::RootedObject r_jsobject(smjs_ctx, ses->jsobject); + assert(JS_GetInstancePrivate(smjs_ctx, r_jsobject, (JSClass *) &session_class, NULL) == ses); if_assert_failed {} @@ -578,7 +1245,9 @@ smjs_detach_session_object(struct session *ses) } if (ses->history_jsobject) { - assert(JS_GetInstancePrivate(smjs_ctx, ses->history_jsobject, + JS::RootedObject r_history_jsobject(smjs_ctx, ses->history_jsobject); + + assert(JS_GetInstancePrivate(smjs_ctx, r_history_jsobject, (JSClass *) &location_array_class, NULL) == ses); @@ -595,7 +1264,7 @@ smjs_detach_session_object(struct session *ses) * already 0 and it is about to be freed. If a JSObject was * previously attached to the session object, the object will remain in * memory but it will no longer be able to access the session object. */ -static JSBool +static bool session_array_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS @@ -609,22 +1278,22 @@ session_array_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId h undef_to_jsval(ctx, vp); if (!JSID_IS_INT(id)) - return JS_FALSE; + return false; assert(term); - if_assert_failed return JS_TRUE; + if_assert_failed return true; index = JSID_TO_INT(id); foreach_tab (tab, term->windows) { if (!index) break; --index; } - if ((void *) tab == (void *) &term->windows) return JS_FALSE; + if ((void *) tab == (void *) &term->windows) return false; tabobj = smjs_get_session_object(tab->data); if (tabobj) object_to_jsval(ctx, vp, tabobj); - return JS_TRUE; + return true; } static const JSClass session_array_class = { @@ -644,7 +1313,7 @@ smjs_get_session_array_object(struct terminal *term) if_assert_failed return NULL; obj = JS_NewObject(smjs_ctx, (JSClass *) &session_array_class, - NULL, NULL); + JS::NullPtr(), JS::NullPtr()); if (!obj) return NULL; JS_SetPrivate(obj, term); @@ -665,7 +1334,8 @@ smjs_detach_session_array_object(struct terminal *term) if (!term->session_array_jsobject) return; - assert(JS_GetInstancePrivate(smjs_ctx, term->session_array_jsobject, + JS::RootedObject r_term_session_array_jsobject(smjs_ctx, term->session_array_jsobject); + assert(JS_GetInstancePrivate(smjs_ctx, r_term_session_array_jsobject, (JSClass *) &session_array_class, NULL) == term); if_assert_failed {} @@ -674,41 +1344,40 @@ smjs_detach_session_array_object(struct terminal *term) term->session_array_jsobject = NULL; } -static JSBool +static bool smjs_session_goto_url(JSContext *ctx, unsigned int argc, jsval *rval) { - jsval val; + JS::CallArgs args = CallArgsFromVp(argc, rval); + JS::RootedObject this_o(ctx, &args.thisv().toObject()); + struct delayed_open *deo; struct uri *uri; - jsval *argv = JS_ARGV(ctx, rval); JSString *jsstr; unsigned char *url; struct session *ses; - struct JSObject *this_o; - if (argc != 1) return JS_FALSE; + if (argc != 1) return false; - this_o = JS_THIS_OBJECT(ctx, rval); if (!JS_InstanceOf(ctx, this_o, (JSClass *) &session_class, NULL)) - return JS_FALSE; + return false; ses = JS_GetInstancePrivate(ctx, this_o, (JSClass *) &session_class, NULL); - if (!ses) return JS_FALSE; /* detached */ + if (!ses) return false; /* detached */ - jsstr = JS_ValueToString(ctx, argv[0]); - if (!jsstr) return JS_FALSE; + jsstr = JS::ToString(ctx, args[0]); + if (!jsstr) return false; url = JS_EncodeString(ctx, jsstr); - if (!url) return JS_FALSE; + if (!url) return false; uri = get_uri(url, 0); - if (!uri) return JS_FALSE; + if (!uri) return false; deo = mem_calloc(1, sizeof(*deo)); if (!deo) { done_uri(uri); - return JS_FALSE; + return false; } deo->ses = ses; @@ -716,12 +1385,11 @@ smjs_session_goto_url(JSContext *ctx, unsigned int argc, jsval *rval) /* deo->target = NULL; */ register_bottom_half(delayed_goto_uri_frame, deo); - undef_to_jsval(ctx, &val); - JS_SET_RVAL(ctx, rval, val); + args.rval().setUndefined(); done_uri(uri); - return JS_TRUE; + return true; } static const spidermonkeyFunctionSpec session_funcs[] = { diff --git a/src/scripting/smjs/terminal_object.c b/src/scripting/smjs/terminal_object.c index c1cf3e2d..4a3a1992 100644 --- a/src/scripting/smjs/terminal_object.c +++ b/src/scripting/smjs/terminal_object.c @@ -17,7 +17,7 @@ #include "util/memory.h" #include "viewer/text/vs.h" -static JSBool terminal_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); +static bool terminal_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); static void terminal_finalize(JSFreeOp *op, JSObject *obj); static const JSClass terminal_class = { @@ -38,10 +38,9 @@ static const JSPropertySpec terminal_props[] = { }; /* @terminal_class.getProperty */ -static JSBool +static bool terminal_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { - ELINKS_CAST_PROP_PARAMS jsid id = hid.get(); struct terminal *term; @@ -49,31 +48,33 @@ terminal_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, J /* This can be called if @obj if not itself an instance of the * appropriate class but has one in its prototype chain. Fail * such calls. */ - if (!JS_InstanceOf(ctx, obj, (JSClass *) &terminal_class, NULL)) - return JS_FALSE; + if (!JS_InstanceOf(ctx, hobj, (JSClass *) &terminal_class, NULL)) + return false; - term = JS_GetInstancePrivate(ctx, obj, + term = JS_GetInstancePrivate(ctx, hobj, (JSClass *) &terminal_class, NULL); - if (!term) return JS_FALSE; /* already detached */ + if (!term) return false; /* already detached */ - undef_to_jsval(ctx, vp); + hvp.setUndefined(); - if (!JSID_IS_INT(id)) return JS_FALSE; + if (!JSID_IS_INT(id)) return false; switch (JSID_TO_INT(id)) { case TERMINAL_TAB: { JSObject *obj = smjs_get_session_array_object(term); - if (obj) object_to_jsval(ctx, vp, obj); + if (obj) { + hvp.setObject(*obj); + } - return JS_TRUE; + return true; } default: INTERNAL("Invalid ID %d in terminal_get_property().", JSID_TO_INT(id)); } - return JS_FALSE; + return false; } /** Pointed to by terminal_class.finalize. SpiderMonkey automatically @@ -111,11 +112,12 @@ smjs_get_terminal_object(struct terminal *term) assert(smjs_ctx); if_assert_failed return NULL; - obj = JS_NewObject(smjs_ctx, (JSClass *) &terminal_class, NULL, NULL); + obj = JS_NewObject(smjs_ctx, (JSClass *) &terminal_class, JS::NullPtr(), JS::NullPtr()); if (!obj) return NULL; - if (JS_FALSE == JS_DefineProperties(smjs_ctx, obj, + JS::RootedObject robj(smjs_ctx, obj); + if (false == JS_DefineProperties(smjs_ctx, robj, (JSPropertySpec *) terminal_props)) return NULL; @@ -143,7 +145,9 @@ smjs_detach_terminal_object(struct terminal *term) if (!term->jsobject) return; - assert(JS_GetInstancePrivate(smjs_ctx, term->jsobject, + JS::RootedObject r_jsobject(smjs_ctx, term->jsobject); + + assert(JS_GetInstancePrivate(smjs_ctx, r_jsobject, (JSClass *) &terminal_class, NULL) == term); if_assert_failed {} @@ -154,31 +158,32 @@ smjs_detach_terminal_object(struct terminal *term) /* @terminal_array_class.getProperty */ -static JSBool +static bool terminal_array_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { - ELINKS_CAST_PROP_PARAMS jsid id = hid.get(); int index; struct terminal *term; - undef_to_jsval(ctx, vp); + hvp.setUndefined(); if (!JSID_IS_INT(id)) - return JS_FALSE; + return false; index = JSID_TO_INT(id); foreach (term, terminals) { if (!index) break; --index; } - if ((void *) term == (void *) &terminals) return JS_FALSE; + if ((void *) term == (void *) &terminals) return false; - obj = smjs_get_terminal_object(term); - if (obj) object_to_jsval(ctx, vp, obj); + JSObject *obj = smjs_get_terminal_object(term); + if (obj) { + hvp.setObject(*obj); + } - return JS_TRUE; + return true; ; } @@ -199,7 +204,7 @@ smjs_get_terminal_array_object(void) if_assert_failed return NULL; return JS_NewObject(smjs_ctx, (JSClass *) &terminal_array_class, - NULL, NULL); + JS::NullPtr(), JS::NullPtr()); } void @@ -214,7 +219,9 @@ smjs_init_terminal_interface(void) obj = smjs_get_terminal_array_object(); if (!obj) return; - val = OBJECT_TO_JSVAL(obj); + JS::RootedValue rval(smjs_ctx, val); + rval.setObject(*obj); + JS::RootedObject r_smjs_elinks_object(smjs_ctx, smjs_elinks_object); - JS_SetProperty(smjs_ctx, smjs_elinks_object, "terminal", &val); + JS_SetProperty(smjs_ctx, r_smjs_elinks_object, "terminal", rval); } diff --git a/src/scripting/smjs/view_state_object.c b/src/scripting/smjs/view_state_object.c index 158d08e7..a8be80bd 100644 --- a/src/scripting/smjs/view_state_object.c +++ b/src/scripting/smjs/view_state_object.c @@ -20,8 +20,8 @@ #include "util/memory.h" #include "viewer/text/vs.h" -static JSBool view_state_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); -static JSBool view_state_set_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp); +static bool view_state_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); +static bool view_state_set_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, bool strict, JS::MutableHandleValue hvp); static void view_state_finalize(JSFreeOp *op, JSObject *obj); static const JSClass view_state_class = { @@ -42,16 +42,15 @@ enum view_state_prop { }; static const JSPropertySpec view_state_props[] = { - { "plain", VIEW_STATE_PLAIN, JSPROP_ENUMERATE }, - { "uri", VIEW_STATE_URI, JSPROP_ENUMERATE | JSPROP_READONLY }, + { "plain", (unsigned char)VIEW_STATE_PLAIN, JSPROP_ENUMERATE }, + { "uri", (unsigned char)VIEW_STATE_URI, JSPROP_ENUMERATE | JSPROP_READONLY }, { NULL } }; /* @view_state_class.getProperty */ -static JSBool +static bool view_state_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { - ELINKS_CAST_PROP_PARAMS jsid id = hid.get(); struct view_state *vs; @@ -59,44 +58,42 @@ view_state_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, /* This can be called if @obj if not itself an instance of the * appropriate class but has one in its prototype chain. Fail * such calls. */ - if (!JS_InstanceOf(ctx, obj, (JSClass *) &view_state_class, NULL)) - return JS_FALSE; + if (!JS_InstanceOf(ctx, hobj, (JSClass *) &view_state_class, NULL)) + return false; - vs = JS_GetInstancePrivate(ctx, obj, + vs = JS_GetInstancePrivate(ctx, hobj, (JSClass *) &view_state_class, NULL); - if (!vs) return JS_FALSE; + if (!vs) return false; - undef_to_jsval(ctx, vp); + hvp.setUndefined(); if (!JSID_IS_INT(id)) - return JS_FALSE; + return false; switch (JSID_TO_INT(id)) { case VIEW_STATE_PLAIN: - *vp = INT_TO_JSVAL(vs->plain); + hvp.setInt32(vs->plain); - return JS_TRUE; + return true; case VIEW_STATE_URI: - *vp = STRING_TO_JSVAL(JS_NewStringCopyZ(smjs_ctx, - struri(vs->uri))); + hvp.setString(JS_NewStringCopyZ(smjs_ctx, struri(vs->uri))); - return JS_TRUE; + return true; default: /* Unrecognized integer property ID; someone is using * the object as an array. SMJS builtin classes (e.g. - * js_RegExpClass) just return JS_TRUE in this case + * js_RegExpClass) just return true in this case * and leave *@vp unchanged. Do the same here. * (Actually not quite the same, as we already used * @undef_to_jsval.) */ - return JS_TRUE; + return true; } } /* @view_state_class.setProperty */ -static JSBool -view_state_set_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JSBool strict, JS::MutableHandleValue hvp) +static bool +view_state_set_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, bool strict, JS::MutableHandleValue hvp) { - ELINKS_CAST_PROP_PARAMS jsid id = hid.get(); struct view_state *vs; @@ -104,28 +101,28 @@ view_state_set_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, /* This can be called if @obj if not itself an instance of the * appropriate class but has one in its prototype chain. Fail * such calls. */ - if (!JS_InstanceOf(ctx, obj, (JSClass *) &view_state_class, NULL)) - return JS_FALSE; + if (!JS_InstanceOf(ctx, hobj, (JSClass *) &view_state_class, NULL)) + return false; - vs = JS_GetInstancePrivate(ctx, obj, + vs = JS_GetInstancePrivate(ctx, hobj, (JSClass *) &view_state_class, NULL); - if (!vs) return JS_FALSE; + if (!vs) return false; if (!JSID_IS_INT(id)) - return JS_FALSE; + return false; switch (JSID_TO_INT(id)) { case VIEW_STATE_PLAIN: { - vs->plain = atol(jsval_to_string(ctx, vp)); + vs->plain = hvp.toInt32(); - return JS_TRUE; + return true; } default: /* Unrecognized integer property ID; someone is using * the object as an array. SMJS builtin classes (e.g. - * js_RegExpClass) just return JS_TRUE in this case. + * js_RegExpClass) just return true in this case. * Do the same here. */ - return JS_TRUE; + return true; } } @@ -169,11 +166,13 @@ smjs_get_view_state_object(struct view_state *vs) view_state_object = JS_NewObject(smjs_ctx, (JSClass *) &view_state_class, - NULL, NULL); + JS::NullPtr(), JS::NullPtr()); if (!view_state_object) return NULL; - if (JS_FALSE == JS_DefineProperties(smjs_ctx, view_state_object, + JS::RootedObject r_view_state_object(smjs_ctx, view_state_object); + + if (false == JS_DefineProperties(smjs_ctx, r_view_state_object, (JSPropertySpec *) view_state_props)) return NULL; @@ -186,28 +185,25 @@ smjs_get_view_state_object(struct view_state *vs) return view_state_object; } -static JSBool +static bool smjs_elinks_get_view_state(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { - ELINKS_CAST_PROP_PARAMS - (void)obj; - JSObject *vs_obj; struct view_state *vs; - *vp = JSVAL_NULL; + hvp.setNull(); - if (!smjs_ses || !have_location(smjs_ses)) return JS_TRUE; + if (!smjs_ses || !have_location(smjs_ses)) return true; vs = &cur_loc(smjs_ses)->vs; - if (!vs) return JS_TRUE; + if (!vs) return true; vs_obj = smjs_get_view_state_object(vs); - if (!vs_obj) return JS_TRUE; + if (!vs_obj) return true; - *vp = OBJECT_TO_JSVAL(vs_obj); + hvp.setObject(*vs_obj); - return JS_TRUE; + return true; } /** Ensure that no JSObject contains the pointer @a vs. This is called from @@ -223,7 +219,9 @@ smjs_detach_view_state_object(struct view_state *vs) if (!vs->jsobject) return; - assert(JS_GetInstancePrivate(smjs_ctx, vs->jsobject, + JS::RootedObject r_vs_jsobject(smjs_ctx, vs->jsobject); + + assert(JS_GetInstancePrivate(smjs_ctx, r_vs_jsobject, (JSClass *) &view_state_class, NULL) == vs); if_assert_failed {} @@ -238,7 +236,9 @@ smjs_init_view_state_interface(void) if (!smjs_ctx || !smjs_elinks_object) return; - JS_DefineProperty(smjs_ctx, smjs_elinks_object, "vs", JSVAL_NULL, - smjs_elinks_get_view_state, JS_StrictPropertyStub, - JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_READONLY); + JS::RootedObject r_smjs_elinks_object(smjs_ctx, smjs_elinks_object); + + JS_DefineProperty(smjs_ctx, r_smjs_elinks_object, "vs", (int32_t)0, + (unsigned int)(JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_READONLY), smjs_elinks_get_view_state, JS_StrictPropertyStub + ); } From 01c511f52d68743a78ed72a63c56175fefb8b4b8 Mon Sep 17 00:00:00 2001 From: Witold Filipczyk Date: Fri, 16 Oct 2020 19:54:02 +0200 Subject: [PATCH 068/179] [mozjs38] ELinks is compilable, was not heavily tested. --- configure.ac | 4 +- meson.build | 2 +- src/ecmascript/spidermonkey-shared.c | 2 +- src/ecmascript/spidermonkey-shared.h | 2 +- src/ecmascript/spidermonkey.c | 34 +-- src/ecmascript/spidermonkey/document.c | 4 +- src/ecmascript/spidermonkey/form.c | 235 +++++++++++---------- src/ecmascript/spidermonkey/location.c | 12 +- src/ecmascript/spidermonkey/navigator.c | 4 +- src/ecmascript/spidermonkey/unibar.c | 8 +- src/ecmascript/spidermonkey/util.h | 2 +- src/ecmascript/spidermonkey/window.c | 6 +- src/scripting/smjs/action_object.c | 21 +- src/scripting/smjs/bookmarks.c | 16 +- src/scripting/smjs/cache_object.c | 13 +- src/scripting/smjs/core.c | 28 +-- src/scripting/smjs/elinks_object.c | 8 +- src/scripting/smjs/global_object.c | 4 +- src/scripting/smjs/globhist.c | 33 ++- src/scripting/smjs/hooks.c | 4 +- src/scripting/smjs/keybinding.c | 20 +- src/scripting/smjs/load_uri.c | 2 +- src/scripting/smjs/session_object.c | 263 ++---------------------- src/scripting/smjs/terminal_object.c | 13 +- src/scripting/smjs/view_state_object.c | 83 +++++++- 25 files changed, 345 insertions(+), 478 deletions(-) diff --git a/configure.ac b/configure.ac index d832f874..4c1ec5ba 100644 --- a/configure.ac +++ b/configure.ac @@ -612,11 +612,11 @@ case "$with_spidermonkey" in ;; esac -for package in mozjs-31; do +for package in mozjs-38; do if test -n "$CONFIG_SPIDERMONKEY"; then break else - AC_MSG_CHECKING([for SpiderMonkey (mozjs-31) in pkg-config $package]) + AC_MSG_CHECKING([for SpiderMonkey (mozjs-38) in pkg-config $package]) if $PKG_CONFIG --cflags --libs $package > /dev/null 2>&AS_MESSAGE_LOG_FD; then SPIDERMONKEY_LIBS="$($PKG_CONFIG --libs $package)" SPIDERMONKEY_CFLAGS="$($PKG_CONFIG --cflags $package)" diff --git a/meson.build b/meson.build index 2cdebf09..b9d54c2b 100644 --- a/meson.build +++ b/meson.build @@ -271,7 +271,7 @@ if conf_data.get('CONFIG_BZIP2') endif if conf_data.get('CONFIG_ECMASCRIPT') - mozjsdeps = dependency('mozjs-24') + mozjsdeps = dependency('mozjs-38') deps += mozjsdeps endif diff --git a/src/ecmascript/spidermonkey-shared.c b/src/ecmascript/spidermonkey-shared.c index 3793865b..7f057fbd 100644 --- a/src/ecmascript/spidermonkey-shared.c +++ b/src/ecmascript/spidermonkey-shared.c @@ -48,7 +48,7 @@ spidermonkey_runtime_addref(void) return 0; } - spidermonkey_runtime = JS_NewRuntime(4L * 1024L * 1024L, JS_USE_HELPER_THREADS); + spidermonkey_runtime = JS_NewRuntime(4L * 1024L * 1024L); if (!spidermonkey_runtime) return 0; spidermonkey_empty_context = JS_NewContext(spidermonkey_runtime, diff --git a/src/ecmascript/spidermonkey-shared.h b/src/ecmascript/spidermonkey-shared.h index 84174f6e..782867fa 100644 --- a/src/ecmascript/spidermonkey-shared.h +++ b/src/ecmascript/spidermonkey-shared.h @@ -69,7 +69,7 @@ static inline unsigned char * jsval_to_string(JSContext *ctx, jsval *vp) { JS::RootedValue r_vp(ctx, *vp); - JSString *str = JS::ToString(ctx, r_vp); + JSString *str = r_vp.toString(); return empty_string_or_(JS_EncodeString(ctx, str)); } diff --git a/src/ecmascript/spidermonkey.c b/src/ecmascript/spidermonkey.c index e6a75ba3..300124e6 100644 --- a/src/ecmascript/spidermonkey.c +++ b/src/ecmascript/spidermonkey.c @@ -142,7 +142,7 @@ spidermonkey_get_interpreter(struct ecmascript_interpreter *interpreter) JSAutoRequest ar(ctx); JS_SetContextPrivate(ctx, interpreter); //JS_SetOptions(ctx, JSOPTION_VAROBJFIX | JS_METHODJIT); - JS_SetErrorReporter(ctx, error_reporter); + JS_SetErrorReporter(spidermonkey_runtime, error_reporter); JS_SetInterruptCallback(spidermonkey_runtime, heartbeat_callback); JS::RootedObject window_obj(ctx, JS_NewGlobalObject(ctx, &window_class, NULL, JS::DontFireOnNewGlobalHook)); @@ -265,8 +265,9 @@ spidermonkey_eval(struct ecmascript_interpreter *interpreter, JS::RootedObject cg(ctx, JS::CurrentGlobalOrNull(ctx)); JS::RootedValue r_val(ctx, rval); + JS::CompileOptions options(ctx); - JS_EvaluateScript(ctx, cg, code->source, code->length, "", 0, &r_val); + JS::Evaluate(ctx, cg, options, code->source, code->length, &r_val); done_heartbeat(interpreter->heartbeat); } @@ -287,7 +288,14 @@ spidermonkey_eval_stringback(struct ecmascript_interpreter *interpreter, JS::RootedObject cg(ctx, JS::CurrentGlobalOrNull(ctx)); JS::RootedValue r_rval(ctx, rval); - ret = JS_EvaluateScript(ctx, cg, code->source, code->length, "", 0, &r_rval); + JS::CompileOptions options(ctx); + +// options.setIntroductionType("js shell load") +// .setUTF8(true) +// .setCompileAndGo(true) +// .setNoScriptRval(true); + + ret = JS::Evaluate(ctx, cg, options, code->source, code->length, &r_rval); done_heartbeat(interpreter->heartbeat); if (ret == false) { @@ -298,7 +306,7 @@ spidermonkey_eval_stringback(struct ecmascript_interpreter *interpreter, return NULL; } - return stracpy(JS_EncodeString(ctx, JS::ToString(ctx, r_rval))); + return stracpy(JS_EncodeString(ctx, r_rval.toString())); } @@ -307,7 +315,7 @@ spidermonkey_eval_boolback(struct ecmascript_interpreter *interpreter, struct string *code) { JSContext *ctx; - JSFunction *fun; + JS::RootedFunction fun(ctx); jsval rval; int ret; @@ -317,16 +325,16 @@ spidermonkey_eval_boolback(struct ecmascript_interpreter *interpreter, interpreter->ret = NULL; JS::CompileOptions options(ctx); - JS::RootedObject cg(ctx, JS::CurrentGlobalOrNull(ctx)); - fun = JS_CompileFunction(ctx, cg, "", 0, NULL, code->source, - code->length, options); - if (!fun) + JS::AutoObjectVector ag(ctx); + if (!JS::CompileFunction(ctx, ag, options, "", 0, nullptr, code->source, + code->length, &fun)) { return -1; + }; interpreter->heartbeat = add_heartbeat(interpreter); - JS::RootedFunction r_fun(ctx, fun); JS::RootedValue r_val(ctx, rval); - ret = JS_CallFunction(ctx, cg, r_fun, JS::HandleValueArray::empty(), &r_val); + JS::RootedObject cg(ctx, JS::CurrentGlobalOrNull(ctx)); + ret = JS_CallFunction(ctx, cg, fun, JS::HandleValueArray::empty(), &r_val); done_heartbeat(interpreter->heartbeat); if (ret == 2) { /* onClick="history.back()" */ @@ -335,12 +343,12 @@ spidermonkey_eval_boolback(struct ecmascript_interpreter *interpreter, if (ret == false) { return -1; } - if (JSVAL_IS_VOID(rval)) { + if (r_val.isUndefined()) { /* Undefined value. */ return -1; } - return jsval_to_boolean(ctx, &rval); + return r_val.toBoolean(); } struct module spidermonkey_module = struct_module( diff --git a/src/ecmascript/spidermonkey/document.c b/src/ecmascript/spidermonkey/document.c index e4bc3d8a..de5ec176 100644 --- a/src/ecmascript/spidermonkey/document.c +++ b/src/ecmascript/spidermonkey/document.c @@ -53,9 +53,9 @@ static bool document_get_property(JSContext *ctx, JS::HandleObject hobj, JS::Han JSClass document_class = { "document", JSCLASS_HAS_PRIVATE, - JS_PropertyStub, JS_DeletePropertyStub, + JS_PropertyStub, nullptr, document_get_property, JS_StrictPropertyStub, - JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub + nullptr, nullptr, nullptr }; #ifdef CONFIG_COOKIES diff --git a/src/ecmascript/spidermonkey/form.c b/src/ecmascript/spidermonkey/form.c index 8f8c003a..0c20ac2e 100644 --- a/src/ecmascript/spidermonkey/form.c +++ b/src/ecmascript/spidermonkey/form.c @@ -69,9 +69,9 @@ static void form_finalize(JSFreeOp *op, JSObject *obj); static JSClass form_class = { "form", JSCLASS_HAS_PRIVATE, /* struct form_view *, or NULL if detached */ - JS_PropertyStub, JS_PropertyStub, + JS_PropertyStub, nullptr, form_get_property, JS_StrictPropertyStub, - JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, form_finalize + nullptr, nullptr, nullptr, form_finalize }; @@ -89,9 +89,9 @@ static void input_finalize(JSFreeOp *op, JSObject *obj); static JSClass input_class = { "input", /* here, we unleash ourselves */ JSCLASS_HAS_PRIVATE, /* struct form_state *, or NULL if detached */ - JS_PropertyStub, JS_DeletePropertyStub, + JS_PropertyStub, nullptr, input_get_property, input_set_property, - JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, input_finalize + nullptr, nullptr, nullptr, input_finalize }; /* Tinyids of properties. Use negative values to distinguish these @@ -228,12 +228,43 @@ input_set_property_accessKey(JSContext *ctx, unsigned int argc, jsval *vp) /* Hiddens have no link. */ if (linknum >= 0) link = &document->links[linknum]; - accesskey = jsval_to_accesskey(ctx, args[0]); +// accesskey = jsval_to_accesskey(ctx, args[0]); - if (accesskey == UCS_NO_CHAR) + size_t len; + char16_t chr[2]; + + accesskey = UCS_NO_CHAR; + + if (!args[0].isString()) { return false; - else if (link) + } + JSString *str = args[0].toString(); + + len = JS_GetStringLength(str); + + /* This implementation ignores extra characters in the string. */ + if (len < 1) { + accesskey = 0; /* which means no access key */ + } else if (len == 1) { + JS_GetStringCharAt(ctx, str, 0, &chr[0]); + if (!is_utf16_surrogate(chr[0])) { + accesskey = chr[0]; + } + } else { + JS_GetStringCharAt(ctx, str, 1, &chr[1]); + if (is_utf16_high_surrogate(chr[0]) + && is_utf16_low_surrogate(chr[1])) { + accesskey = join_utf16_surrogates(chr[0], chr[1]); + } + } + if (accesskey == UCS_NO_CHAR) { + JS_ReportError(ctx, "Invalid UTF-16 sequence"); + return false; + } + + if (link) { link->accesskey = accesskey; + } return true; } @@ -1601,8 +1632,7 @@ input_set_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, bool : FORM_MODE_NORMAL); break; case JSP_INPUT_MAX_LENGTH: - if (!JS::ToInt32(ctx, hvp, &fc->maxlength)) - return false; + fc->maxlength = hvp.toInt32(); break; case JSP_INPUT_NAME: mem_free_set(&fc->name, stracpy(jsval_to_string(ctx, vp))); @@ -1627,10 +1657,7 @@ input_set_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, bool break; case JSP_INPUT_SELECTED_INDEX: if (fc->type == FC_SELECT) { - int item; - - if (!JS::ToInt32(ctx, hvp, &item)) - return false; + int item = hvp.toInt32(); if (item >= 0 && item < fc->nvalues) { fs->state = item; @@ -1798,7 +1825,7 @@ get_input_object(JSContext *ctx, JSObject *jsform, struct form_state *fs) /* jsform ('form') is input's parent */ /* FIXME: That is NOT correct since the real containing element * should be its parent, but gimme DOM first. --pasky */ - jsinput = JS_NewObject(ctx, &input_class, JS::NullPtr(), r_jsform); + jsinput = JS_NewObject(ctx, &input_class, r_jsform); if (!jsinput) return NULL; @@ -1908,13 +1935,13 @@ static bool form_elements_get_property(JSContext *ctx, JS::HandleObject hobj, JS static JSClass form_elements_class = { "elements", JSCLASS_HAS_PRIVATE, - JS_PropertyStub, JS_DeletePropertyStub, + JS_PropertyStub, nullptr, form_elements_get_property, JS_StrictPropertyStub, - JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, NULL + nullptr, nullptr, nullptr, nullptr }; -static bool form_elements_item2(JSContext *ctx, JSObject *obj, int index, jsval *rval); -static bool form_elements_namedItem2(JSContext *ctx, JSObject *obj, unsigned char *string, jsval *rval); +static bool form_elements_item2(JSContext *ctx, JS::HandleObject hobj, int index, JS::MutableHandleValue hvp); +static bool form_elements_namedItem2(JSContext *ctx, JS::HandleObject hobj, unsigned char *string, JS::MutableHandleValue hvp); static bool form_elements_item(JSContext *ctx, unsigned int argc, jsval *rval); static bool form_elements_namedItem(JSContext *ctx, unsigned int argc, jsval *rval); @@ -1942,7 +1969,6 @@ static JSPropertySpec form_elements_props[] = { static bool form_elements_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { - ELINKS_CAST_PROP_PARAMS jsid id = hid.get(); jsval idval; @@ -1962,7 +1988,7 @@ form_elements_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId h if (!JS_InstanceOf(ctx, hobj, &form_elements_class, NULL)) { return false; } - parent_form = JS_GetParent(obj); + parent_form = JS_GetParent(hobj); assert(JS_InstanceOf(ctx, parent_form, &form_class, NULL)); if_assert_failed return false; parent_doc = JS_GetParent(parent_form); @@ -1983,8 +2009,8 @@ form_elements_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId h if (JSID_IS_STRING(id)) { JS::RootedValue r_idval(ctx, idval); JS_IdToValue(ctx, id, &r_idval); - unsigned char *string = JS_EncodeString(ctx, JS::ToString(ctx, r_idval)); - form_elements_namedItem2(ctx, obj, string, vp); + unsigned char *string = JS_EncodeString(ctx, r_idval.toString()); + form_elements_namedItem2(ctx, hobj, string, hvp); return true; } @@ -1992,19 +2018,19 @@ form_elements_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId h return true; } - undef_to_jsval(ctx, vp); + hvp.setUndefined(); switch (JSID_TO_INT(id)) { case JSP_FORM_ELEMENTS_LENGTH: - int_to_jsval(ctx, vp, list_size(&form->items)); + hvp.setInt32(list_size(&form->items)); break; default: /* Array index. */ int index; JS::RootedValue r_idval(ctx, idval); JS_IdToValue(ctx, id, &r_idval); - JS::ToInt32(ctx, r_idval, &index); - form_elements_item2(ctx, obj, index, vp); + index = r_idval.toInt32(); + form_elements_item2(ctx, hobj, index, hvp); break; } @@ -2056,24 +2082,23 @@ form_elements_get_property_length(JSContext *ctx, unsigned int argc, jsval *vp) /* @form_elements_funcs{"item"} */ static bool -form_elements_item(JSContext *ctx, unsigned int argc, jsval *rval) +form_elements_item(JSContext *ctx, unsigned int argc, jsval *vp) { jsval val = JSVAL_VOID; - JSObject *obj = JS_THIS_OBJECT(ctx, rval); - JS::CallArgs args = JS::CallArgsFromVp(argc, rval); + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject hobj(ctx, &args.thisv().toObject()); + JS::RootedValue rval(ctx, val); - int index; - JS::ToInt32(ctx, args[0], &index); + int index = args[0].toInt32(); - bool ret = form_elements_item2(ctx, obj, index, &val); + bool ret = form_elements_item2(ctx, hobj, index, &rval); + args.rval().set(rval.get()); - args.rval().set(val); -// JS_SET_RVAL(ctx, rval, val); return ret; } static bool -form_elements_item2(JSContext *ctx, JSObject *obj, int index, jsval *rval) +form_elements_item2(JSContext *ctx, JS::HandleObject hobj, int index, JS::MutableHandleValue hvp) { JS::RootedObject parent_form(ctx); /* instance of @form_class */ JS::RootedObject parent_doc(ctx); /* instance of @document_class */ @@ -2086,10 +2111,8 @@ form_elements_item2(JSContext *ctx, JSObject *obj, int index, jsval *rval) struct el_form_control *fc; int counter = -1; - JS::RootedObject hobj(ctx, obj); - if (!JS_InstanceOf(ctx, hobj, &form_elements_class, NULL)) return false; - parent_form = JS_GetParent(obj); + parent_form = JS_GetParent(hobj); assert(JS_InstanceOf(ctx, parent_form, &form_class, NULL)); if_assert_failed return false; parent_doc = JS_GetParent(parent_form); @@ -2107,7 +2130,7 @@ form_elements_item2(JSContext *ctx, JSObject *obj, int index, jsval *rval) if (!form_view) return false; /* detached */ form = find_form_by_form_view(document, form_view); - undef_to_jsval(ctx, rval); + hvp.setUndefined(); foreach (fc, form->items) { counter++; @@ -2117,8 +2140,9 @@ form_elements_item2(JSContext *ctx, JSObject *obj, int index, jsval *rval) if (fs) { JSObject *fcobj = get_form_control_object(ctx, parent_form, fc->type, fs); - if (fcobj) - object_to_jsval(ctx, rval, fcobj); + if (fcobj) { + hvp.setObject(*fcobj); + } } break; } @@ -2129,21 +2153,24 @@ form_elements_item2(JSContext *ctx, JSObject *obj, int index, jsval *rval) /* @form_elements_funcs{"namedItem"} */ static bool -form_elements_namedItem(JSContext *ctx, unsigned int argc, jsval *rval) +form_elements_namedItem(JSContext *ctx, unsigned int argc, jsval *vp) { jsval val = JSVAL_VOID; - JSObject *obj = JS_THIS_OBJECT(ctx, rval); - JS::CallArgs args = JS::CallArgsFromVp(argc, rval); + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject hobj(ctx, &args.thisv().toObject()); + JS::RootedValue rval(ctx, val); + + // jsval *argv = JS_ARGV(ctx, rval); - unsigned char *string = JS_EncodeString(ctx, JS::ToString(ctx, args[0])); - bool ret = form_elements_namedItem2(ctx, obj, string, &val); - args.rval().set(val); + unsigned char *string = JS_EncodeString(ctx, args[0].toString()); + bool ret = form_elements_namedItem2(ctx, hobj, string, &rval); + args.rval().set(rval); // JS_SET_RVAL(ctx, rval, val); return ret; } static bool -form_elements_namedItem2(JSContext *ctx, JSObject *obj, unsigned char *string, jsval *rval) +form_elements_namedItem2(JSContext *ctx, JS::HandleObject hobj, unsigned char *string, JS::MutableHandleValue hvp) { JS::RootedObject parent_form(ctx); /* instance of @form_class */ JS::RootedObject parent_doc(ctx); /* instance of @document_class */ @@ -2159,10 +2186,8 @@ form_elements_namedItem2(JSContext *ctx, JSObject *obj, unsigned char *string, j return true; } - JS::RootedObject hobj(ctx, obj); - if (!JS_InstanceOf(ctx, hobj, &form_elements_class, NULL)) return false; - parent_form = JS_GetParent(obj); + parent_form = JS_GetParent(hobj); assert(JS_InstanceOf(ctx, parent_form, &form_class, NULL)); if_assert_failed return false; parent_doc = JS_GetParent(parent_form); @@ -2180,7 +2205,7 @@ form_elements_namedItem2(JSContext *ctx, JSObject *obj, unsigned char *string, j if (!form_view) return false; /* detached */ form = find_form_by_form_view(document, form_view); - undef_to_jsval(ctx, rval); + hvp.setUndefined(); foreach (fc, form->items) { if ((fc->id && !c_strcasecmp(string, fc->id)) @@ -2190,8 +2215,9 @@ form_elements_namedItem2(JSContext *ctx, JSObject *obj, unsigned char *string, j if (fs) { JSObject *fcobj = get_form_control_object(ctx, parent_form, fc->type, fs); - if (fcobj) - object_to_jsval(ctx, rval, fcobj); + if (fcobj) { + hvp.setObject(*fcobj); + } } break; } @@ -2325,7 +2351,7 @@ form_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::M case JSP_FORM_ELEMENTS: { /* jsform ('form') is form_elements' parent; who knows is that's correct */ - JSObject *jsform_elems = JS_NewObject(ctx, &form_elements_class, JS::NullPtr(), hobj); + JSObject *jsform_elems = JS_NewObject(ctx, &form_elements_class, hobj); JS::RootedObject r_jsform_elems(ctx, jsform_elems); @@ -2500,7 +2526,7 @@ form_get_property_elements(JSContext *ctx, unsigned int argc, jsval *vp) if (!fv) return false; /* detached */ /* jsform ('form') is form_elements' parent; who knows is that's correct */ - JSObject *jsform_elems = JS_NewObject(ctx, &form_elements_class, JS::NullPtr(), hobj); + JSObject *jsform_elems = JS_NewObject(ctx, &form_elements_class, hobj); JS::RootedObject r_jsform_elems(ctx, jsform_elems); JS_DefineProperties(ctx, r_jsform_elems, (JSPropertySpec *) form_elements_props); @@ -3030,7 +3056,7 @@ get_form_object(JSContext *ctx, JSObject *jsdoc, struct form_view *fv) /* jsdoc ('document') is fv's parent */ /* FIXME: That is NOT correct since the real containing element * should be its parent, but gimme DOM first. --pasky */ - jsform = JS_NewObject(ctx, &form_class, JS::NullPtr(), r_jsdoc); + jsform = JS_NewObject(ctx, &form_class, r_jsdoc); if (jsform == NULL) return NULL; JS::RootedObject r_jsform(ctx, jsform); @@ -3095,13 +3121,13 @@ static bool forms_get_property_length(JSContext *ctx, unsigned int argc, jsval * JSClass forms_class = { "forms", JSCLASS_HAS_PRIVATE, - JS_PropertyStub, JS_PropertyStub, + JS_PropertyStub, nullptr, forms_get_property, JS_StrictPropertyStub, - JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, NULL + nullptr, nullptr, nullptr, nullptr }; static bool forms_item(JSContext *ctx, unsigned int argc, jsval *rval); -static bool forms_item2(JSContext *ctx, JSObject *obj, unsigned int argc, jsval *argv, jsval *rval); +static bool forms_item2(JSContext *ctx, JS::HandleObject hobj, int index, JS::MutableHandleValue hvp); static bool forms_namedItem(JSContext *ctx, unsigned int argc, jsval *rval); const spidermonkeyFunctionSpec forms_funcs[] = { @@ -3126,9 +3152,9 @@ JSPropertySpec forms_props[] = { * string (but might not be). If found, set *rval = the DOM * object. If not found, leave *rval unchanged. */ static void -find_form_by_name(JSContext *ctx, JSObject *jsdoc, +find_form_by_name(JSContext *ctx, JS::HandleObject jsdoc, struct document_view *doc_view, - unsigned char *string, jsval *rval) + unsigned char *string, JS::MutableHandleValue hvp) { struct form *form; @@ -3137,7 +3163,7 @@ find_form_by_name(JSContext *ctx, JSObject *jsdoc, foreach (form, doc_view->document->forms) { if (form->name && !c_strcasecmp(string, form->name)) { - object_to_jsval(ctx, rval, get_form_object(ctx, jsdoc, + hvp.setObject(*get_form_object(ctx, jsdoc, find_form_view(doc_view, form))); break; } @@ -3148,7 +3174,6 @@ find_form_by_name(JSContext *ctx, JSObject *jsdoc, static bool forms_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { - ELINKS_CAST_PROP_PARAMS jsid id = hid.get(); jsval idval; @@ -3163,7 +3188,7 @@ forms_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS:: if (!JS_InstanceOf(ctx, hobj, &forms_class, NULL)) return false; - parent_doc = JS_GetParent(obj); + parent_doc = JS_GetParent(hobj); assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); if_assert_failed return false; @@ -3190,8 +3215,8 @@ forms_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS:: * we must leave *vp unchanged here, to avoid * "TypeError: forms.namedItem is not a function". */ JS_IdToValue(ctx, id, &r_idval); - unsigned char *string = JS_EncodeString(ctx, JS::ToString(ctx, r_idval)); - find_form_by_name(ctx, parent_doc, doc_view, string, vp); + unsigned char *string = JS_EncodeString(ctx, r_idval.toString()); + find_form_by_name(ctx, parent_doc, doc_view, string, hvp); return true; } @@ -3199,7 +3224,8 @@ forms_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS:: /* Array index. */ JS::RootedValue r_idval(ctx, idval); JS_IdToValue(ctx, id, &r_idval); - forms_item2(ctx, obj, 1, &idval, vp); + int index = r_idval.toInt32(); + forms_item2(ctx, hobj, index, hvp); return true; } @@ -3242,36 +3268,36 @@ forms_get_property_length(JSContext *ctx, unsigned int argc, jsval *vp) /* @forms_funcs{"item"} */ static bool -forms_item(JSContext *ctx, unsigned int argc, jsval *rval) +forms_item(JSContext *ctx, unsigned int argc, jsval *vp) { jsval val = JSVAL_VOID; - JSObject *obj = JS_THIS_OBJECT(ctx, rval); - JS::CallArgs args = JS::CallArgsFromVp(argc, rval); -// jsval *argv = JS_ARGV(ctx, rval); - bool ret = forms_item2(ctx, obj, argc, rval, &val); + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject hobj(ctx, &args.thisv().toObject()); + JS::RootedValue rval(ctx, val); - args.rval().set(val); + +// jsval *argv = JS_ARGV(ctx, rval); + int index = args[0].toInt32(); + bool ret = forms_item2(ctx, hobj, index, &rval); + + args.rval().set(rval.get()); return ret; } static bool -forms_item2(JSContext *ctx, JSObject *obj, unsigned int argc, jsval *argv, jsval *rval) +forms_item2(JSContext *ctx, JS::HandleObject hobj, int index, JS::MutableHandleValue hvp) { JS::RootedObject parent_doc(ctx); /* instance of @document_class */ JS::RootedObject parent_win(ctx); /* instance of @window_class */ struct view_state *vs; struct form_view *fv; int counter = -1; - int index; - JS::RootedObject hobj(ctx, obj); - JS::CallArgs args = JS::CallArgsFromVp(argc, argv); - - if (!JS_InstanceOf(ctx, hobj, &forms_class, &args)) + if (!JS_InstanceOf(ctx, hobj, &forms_class, NULL)) return false; - parent_doc = JS_GetParent(obj); + parent_doc = JS_GetParent(hobj); assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); if_assert_failed return false; @@ -3282,18 +3308,12 @@ forms_item2(JSContext *ctx, JSObject *obj, unsigned int argc, jsval *argv, jsval vs = JS_GetInstancePrivate(ctx, parent_win, &window_class, NULL); - if (argc != 1) - return true; - - if (!JS::ToInt32(ctx, args[0], &index)) - return false; - - undef_to_jsval(ctx, rval); + hvp.setUndefined(); foreach (fv, vs->forms) { counter++; if (counter == index) { - object_to_jsval(ctx, rval, get_form_object(ctx, parent_doc, fv)); + hvp.setObject(*get_form_object(ctx, parent_doc, fv)); break; } } @@ -3303,21 +3323,20 @@ forms_item2(JSContext *ctx, JSObject *obj, unsigned int argc, jsval *argv, jsval /* @forms_funcs{"namedItem"} */ static bool -forms_namedItem(JSContext *ctx, unsigned int argc, jsval *rval) +forms_namedItem(JSContext *ctx, unsigned int argc, jsval *vp) { jsval val; JS::RootedObject parent_doc(ctx); /* instance of @document_class */ JS::RootedObject parent_win(ctx); /* instance of @window_class */ - JSObject *obj = JS_THIS_OBJECT(ctx, rval); - JS::CallArgs args = JS::CallArgsFromVp(argc, rval); + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject hobj(ctx, &args.thisv().toObject()); + // jsval *argv = JS_ARGV(ctx, rval); struct view_state *vs; struct document_view *doc_view; - JS::RootedObject hobj(ctx, obj); - if (!JS_InstanceOf(ctx, hobj, &forms_class, &args)) return false; - parent_doc = JS_GetParent(obj); + parent_doc = JS_GetParent(hobj); assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); if_assert_failed return false; parent_win = JS_GetParent(parent_doc); @@ -3331,11 +3350,13 @@ forms_namedItem(JSContext *ctx, unsigned int argc, jsval *rval) if (argc != 1) return true; - undef_to_jsval(ctx, &val); + args.rval().setUndefined(); unsigned char *string = JS_EncodeString(ctx, args[0].toString()); - find_form_by_name(ctx, parent_doc, doc_view, string, &val); - args.rval().set(val); + JS::RootedValue rval(ctx, val); + + find_form_by_name(ctx, parent_doc, doc_view, string, &rval); + args.rval().set(rval.get()); return true; } @@ -3344,7 +3365,7 @@ forms_namedItem(JSContext *ctx, unsigned int argc, jsval *rval) static JSString * unicode_to_jsstring(JSContext *ctx, unicode_val_T u) { - jschar buf[2]; + char16_t buf[2]; /* This is supposed to make a string from which * jsval_to_accesskey() can get the original @u back. @@ -3373,23 +3394,25 @@ static unicode_val_T jsval_to_accesskey(JSContext *ctx, JS::MutableHandleValue hvp) { size_t len; - const jschar *chr; + char16_t chr[2]; - JSString *str = JS::ToString(ctx, hvp); + JSString *str = hvp.toString(); len = JS_GetStringLength(str); - chr = JS_GetStringCharsZ(ctx, str); /* This implementation ignores extra characters in the string. */ if (len < 1) return 0; /* which means no access key */ + JS_GetStringCharAt(ctx, str, 0, &chr[0]); if (!is_utf16_surrogate(chr[0])) { return chr[0]; } - if (len >= 2 - && is_utf16_high_surrogate(chr[0]) - && is_utf16_low_surrogate(chr[1])) { - return join_utf16_surrogates(chr[0], chr[1]); + if (len >= 2) { + JS_GetStringCharAt(ctx, str, 1, &chr[1]); + if (is_utf16_high_surrogate(chr[0]) + && is_utf16_low_surrogate(chr[1])) { + return join_utf16_surrogates(chr[0], chr[1]); + } } JS_ReportError(ctx, "Invalid UTF-16 sequence"); return UCS_NO_CHAR; /* which the caller will reject */ diff --git a/src/ecmascript/spidermonkey/location.c b/src/ecmascript/spidermonkey/location.c index 7e1cbc5b..c4399f83 100644 --- a/src/ecmascript/spidermonkey/location.c +++ b/src/ecmascript/spidermonkey/location.c @@ -52,9 +52,9 @@ static bool history_go(JSContext *ctx, unsigned int argc, jsval *rval); JSClass history_class = { "history", JSCLASS_HAS_PRIVATE, - JS_PropertyStub, JS_DeletePropertyStub, + JS_PropertyStub, nullptr, JS_PropertyStub, JS_StrictPropertyStub, - JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, NULL + nullptr, nullptr, nullptr, nullptr }; const spidermonkeyFunctionSpec history_funcs[] = { @@ -107,14 +107,12 @@ history_go(JSContext *ctx, unsigned int argc, jsval *rval) struct session *ses = doc_view->session; JS::CallArgs args = JS::CallArgsFromVp(argc, rval); -// jsval *argv = JS_ARGV(ctx, rval); - int index; struct location *loc; if (argc != 1) return true; - index = atol(jsval_to_string(ctx, args[0].address())); + int index = args[0].toInt32(); for (loc = cur_loc(ses); loc != (struct location *) &ses->history.history; @@ -139,9 +137,9 @@ static bool location_set_property_href(JSContext *ctx, unsigned int argc, jsval JSClass location_class = { "location", JSCLASS_HAS_PRIVATE, - JS_PropertyStub, JS_DeletePropertyStub, + JS_PropertyStub, nullptr, JS_PropertyStub, JS_StrictPropertyStub, - JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, NULL + nullptr, nullptr, nullptr, nullptr }; /* Tinyids of properties. Use negative values to distinguish these diff --git a/src/ecmascript/spidermonkey/navigator.c b/src/ecmascript/spidermonkey/navigator.c index e6bd4b12..4b3589aa 100644 --- a/src/ecmascript/spidermonkey/navigator.c +++ b/src/ecmascript/spidermonkey/navigator.c @@ -54,9 +54,9 @@ static bool navigator_get_property_userAgent(JSContext *ctx, unsigned int argc, JSClass navigator_class = { "navigator", JSCLASS_HAS_PRIVATE, - JS_PropertyStub, JS_DeletePropertyStub, + JS_PropertyStub, nullptr, JS_PropertyStub, JS_StrictPropertyStub, - JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, NULL + nullptr, nullptr, nullptr, nullptr }; /* Tinyids of properties. Use negative values to distinguish these diff --git a/src/ecmascript/spidermonkey/unibar.c b/src/ecmascript/spidermonkey/unibar.c index a9f1b217..1d3bdcfb 100644 --- a/src/ecmascript/spidermonkey/unibar.c +++ b/src/ecmascript/spidermonkey/unibar.c @@ -51,17 +51,17 @@ static bool unibar_set_property_visible(JSContext *ctx, unsigned int argc, jsval JSClass menubar_class = { "menubar", JSCLASS_HAS_PRIVATE, /* const char * "t" */ - JS_PropertyStub, JS_DeletePropertyStub, + JS_PropertyStub, nullptr, JS_PropertyStub, JS_StrictPropertyStub, - JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, NULL + nullptr, nullptr, nullptr, nullptr }; /* Each @statusbar_class object must have a @window_class parent. */ JSClass statusbar_class = { "statusbar", JSCLASS_HAS_PRIVATE, /* const char * "s" */ - JS_PropertyStub, JS_DeletePropertyStub, + JS_PropertyStub, nullptr, JS_PropertyStub, JS_StrictPropertyStub, - JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, NULL + nullptr, nullptr, nullptr, nullptr }; /* Tinyids of properties. Use negative values to distinguish these diff --git a/src/ecmascript/spidermonkey/util.h b/src/ecmascript/spidermonkey/util.h index 19ea364b..a99cdea4 100644 --- a/src/ecmascript/spidermonkey/util.h +++ b/src/ecmascript/spidermonkey/util.h @@ -57,7 +57,7 @@ static inline int jsval_to_boolean(JSContext *ctx, jsval *vp) { JS::RootedValue r_vp(ctx, *vp); - return (int)JS::ToBoolean(r_vp); + return (int)r_vp.toBoolean(); } #endif diff --git a/src/ecmascript/spidermonkey/window.c b/src/ecmascript/spidermonkey/window.c index fffb074f..6e5e9e3c 100644 --- a/src/ecmascript/spidermonkey/window.c +++ b/src/ecmascript/spidermonkey/window.c @@ -55,9 +55,9 @@ static bool window_get_property_top(JSContext *ctx, unsigned int argc, jsval *vp JSClass window_class = { "window", JSCLASS_HAS_PRIVATE | JSCLASS_GLOBAL_FLAGS, /* struct view_state * */ - JS_PropertyStub, JS_DeletePropertyStub, + JS_PropertyStub, nullptr, window_get_property, JS_StrictPropertyStub, - JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, NULL + nullptr, nullptr, nullptr, nullptr }; @@ -432,7 +432,7 @@ window_setTimeout(JSContext *ctx, unsigned int argc, jsval *rval) code = stracpy(code); if (!code) return true; - timeout = atoi(jsval_to_string(ctx, args[1].address())); + timeout = args[1].toInt32(); if (timeout <= 0) { mem_free(code); return true; diff --git a/src/scripting/smjs/action_object.c b/src/scripting/smjs/action_object.c index 5af6a213..78d973c3 100644 --- a/src/scripting/smjs/action_object.c +++ b/src/scripting/smjs/action_object.c @@ -29,9 +29,9 @@ static bool smjs_action_fn_callback(JSContext *ctx, unsigned int argc, jsval *rv static const JSClass action_fn_class = { "action_fn", JSCLASS_HAS_PRIVATE, /* struct smjs_action_fn_callback_hop * */ - JS_PropertyStub, JS_DeletePropertyStub, + JS_PropertyStub, nullptr, JS_PropertyStub, JS_StrictPropertyStub, - JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, + nullptr, nullptr, nullptr, smjs_action_fn_finalize, NULL, smjs_action_fn_callback, @@ -111,11 +111,8 @@ smjs_action_fn_callback(JSContext *ctx, unsigned int argc, jsval *rval) } if (argc >= 1) { - int32_t val; - - if (true == JS::ToInt32(smjs_ctx, args[0], &val)) { - set_kbd_repeat_count(hop->ses, val); - } + int32_t val = args[0].toInt32(); + set_kbd_repeat_count(hop->ses, val); } do_action(hop->ses, hop->action_id, 1); @@ -134,7 +131,7 @@ smjs_get_action_fn_object(unsigned char *action_str) if (!smjs_ses) return NULL; - obj = JS_NewObject(smjs_ctx, (JSClass *) &action_fn_class, JS::NullPtr(), JS::NullPtr()); + obj = JS_NewObject(smjs_ctx, (JSClass *) &action_fn_class); if (!obj) return NULL; hop = mem_alloc(sizeof(*hop)); @@ -175,7 +172,7 @@ action_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS: hvp.setNull(); JS_IdToValue(ctx, id, &rval); - action_str = JS_EncodeString(ctx, JS::ToString(ctx, rval)); + action_str = JS_EncodeString(ctx, rval.toString()); if (!action_str) return true; action_fn = smjs_get_action_fn_object(action_str); @@ -189,9 +186,9 @@ action_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS: static const JSClass action_class = { "action", 0, - JS_PropertyStub, JS_DeletePropertyStub, + JS_PropertyStub, nullptr, action_get_property, JS_StrictPropertyStub, - JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, NULL, + nullptr, nullptr, nullptr, nullptr, }; static JSObject * @@ -201,7 +198,7 @@ smjs_get_action_object(void) assert(smjs_ctx); - obj = JS_NewObject(smjs_ctx, (JSClass *) &action_class, JS::NullPtr(), JS::NullPtr()); + obj = JS_NewObject(smjs_ctx, (JSClass *) &action_class); return obj; } diff --git a/src/scripting/smjs/bookmarks.c b/src/scripting/smjs/bookmarks.c index 8d1d3f43..82cd0d2d 100644 --- a/src/scripting/smjs/bookmarks.c +++ b/src/scripting/smjs/bookmarks.c @@ -23,17 +23,17 @@ static bool bookmark_folder_get_property(JSContext *ctx, JS::HandleObject hobj, static const JSClass bookmark_class = { "bookmark", JSCLASS_HAS_PRIVATE, /* struct bookmark * */ - JS_PropertyStub, JS_DeletePropertyStub, + JS_PropertyStub, nullptr, JS_PropertyStub, JS_StrictPropertyStub, - JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, bookmark_finalize, + nullptr, nullptr, nullptr, bookmark_finalize, }; static const JSClass bookmark_folder_class = { "bookmark_folder", JSCLASS_HAS_PRIVATE, /* struct bookmark * */ - JS_PropertyStub, JS_PropertyStub, + JS_PropertyStub, nullptr, bookmark_folder_get_property, JS_StrictPropertyStub, - JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, bookmark_finalize, + nullptr, nullptr, nullptr, bookmark_finalize, }; static JSObject * @@ -44,7 +44,7 @@ smjs_get_bookmark_generic_object(struct bookmark *bookmark, JSClass *clasp) assert(clasp == &bookmark_class || clasp == &bookmark_folder_class); if_assert_failed return NULL; - jsobj = JS_NewObject(smjs_ctx, clasp, JS::NullPtr(), JS::NullPtr()); + jsobj = JS_NewObject(smjs_ctx, clasp); if (!jsobj) return NULL; if (!bookmark) return jsobj; @@ -131,13 +131,15 @@ jsval_to_bookmark_string(JSContext *ctx, JS::HandleValue val, unsigned char **re { unsigned char *str; - JSString *jsstr = JS::ToString(ctx, val); + JSString *jsstr = val.toString(); if (jsstr == NULL) { return false; } - str = jsstring_to_utf8(ctx, jsstr, NULL); + JS::RootedString r_jsstr(ctx, jsstr); + str = JS_EncodeStringToUTF8(ctx, r_jsstr); + if (str == NULL) { return false; } diff --git a/src/scripting/smjs/cache_object.c b/src/scripting/smjs/cache_object.c index b7edcf1e..e9c35033 100644 --- a/src/scripting/smjs/cache_object.c +++ b/src/scripting/smjs/cache_object.c @@ -20,9 +20,9 @@ static void cache_entry_finalize(JSFreeOp *op, JSObject *obj); static const JSClass cache_entry_class = { "cache_entry", JSCLASS_HAS_PRIVATE, /* struct cache_entry *; a weak reference */ - JS_PropertyStub, JS_DeletePropertyStub, + JS_PropertyStub, nullptr, JS_PropertyStub, JS_StrictPropertyStub, - JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, cache_entry_finalize + nullptr, nullptr, nullptr, cache_entry_finalize }; /* Tinyids of properties. Use negative values to distinguish these @@ -129,7 +129,7 @@ cache_entry_set_property_content(JSContext *ctx, unsigned int argc, jsval *vp) * eventually unlock the object. */ object_lock(cached); - jsstr = JS::ToString(smjs_ctx, args[0]); + jsstr = args[0].toString(); str = JS_EncodeString(smjs_ctx, jsstr); len = JS_GetStringLength(jsstr); add_fragment(cached, 0, str, len); @@ -200,7 +200,7 @@ cache_entry_set_property_type(JSContext *ctx, unsigned int argc, jsval *vp) * eventually unlock the object. */ object_lock(cached); - jsstr = JS::ToString(smjs_ctx, args[0]); + jsstr = args[0].toString(); str = JS_EncodeString(smjs_ctx, jsstr); mem_free_set(&cached->content_type, stracpy(str)); @@ -253,8 +253,7 @@ smjs_get_cache_entry_object(struct cache_entry *cached) if_assert_failed return NULL; cache_entry_object = JS_NewObject(smjs_ctx, - (JSClass *) &cache_entry_class, - JS::NullPtr(), JS::NullPtr()); + (JSClass *) &cache_entry_class); if (!cache_entry_object) return NULL; @@ -390,7 +389,7 @@ cache_entry_set_property_head(JSContext *ctx, unsigned int argc, jsval *vp) * eventually unlock the object. */ object_lock(cached); - jsstr = JS::ToString(smjs_ctx, args[0]); + jsstr = args[0].toString(); str = JS_EncodeString(smjs_ctx, jsstr); mem_free_set(&cached->head, stracpy(str)); diff --git a/src/scripting/smjs/core.c b/src/scripting/smjs/core.c index 91b13986..4d2ba394 100644 --- a/src/scripting/smjs/core.c +++ b/src/scripting/smjs/core.c @@ -83,9 +83,11 @@ smjs_do_file(unsigned char *path) JS::RootedValue rval(smjs_ctx, val); JS::RootedObject cg(smjs_ctx, JS::CurrentGlobalOrNull(smjs_ctx)); + JS::CompileOptions options(smjs_ctx); + if (!add_file_to_string(&script, path) - || false == JS_EvaluateScript(smjs_ctx, cg, - script.source, script.length, path, 1, &rval)) { + || false == JS::Evaluate(smjs_ctx, cg, options, + script.source, script.length, &rval)) { alert_smjs_error("error loading script file"); ret = 0; } @@ -100,7 +102,7 @@ smjs_do_file_wrapper(JSContext *ctx, unsigned int argc, jsval *rval) { JS::CallArgs args = CallArgsFromVp(argc, rval); - JSString *jsstr = JS::ToString(smjs_ctx, args[0]); + JSString *jsstr = args[0].toString(); unsigned char *path = JS_EncodeString(smjs_ctx, jsstr); if (smjs_do_file(path)) @@ -139,7 +141,7 @@ init_smjs(struct module *module) return; } - JS_SetErrorReporter(smjs_ctx, error_reporter); + JS_SetErrorReporter(spidermonkey_runtime, error_reporter); smjs_init_global_object(); @@ -188,7 +190,7 @@ utf8_to_jsstring(JSContext *ctx, const unsigned char *str, int length) size_t in_bytes; const unsigned char *in_end; size_t utf16_alloc; - jschar *utf16; + char16_t *utf16; size_t utf16_used; JSString *jsstr; @@ -200,7 +202,7 @@ utf8_to_jsstring(JSContext *ctx, const unsigned char *str, int length) /* Each byte of input can become at most one UTF-16 unit. * Check whether the multiplication could overflow. */ assert(!needs_utf16_surrogates(UCS_REPLACEMENT_CHARACTER)); - if (in_bytes > ((size_t) -1) / sizeof(jschar)) { + if (in_bytes > ((size_t) -1) / sizeof(char16_t)) { #ifdef HAVE_JS_REPORTALLOCATIONOVERFLOW JS_ReportAllocationOverflow(ctx); #else @@ -211,7 +213,7 @@ utf8_to_jsstring(JSContext *ctx, const unsigned char *str, int length) utf16_alloc = in_bytes; /* Use malloc because SpiderMonkey will handle the memory after * this routine finishes. */ - utf16 = malloc(utf16_alloc * sizeof(jschar)); + utf16 = malloc(utf16_alloc * sizeof(char16_t)); if (utf16 == NULL) { JS_ReportOutOfMemory(ctx); return NULL; @@ -247,22 +249,22 @@ utf8_to_jsstring(JSContext *ctx, const unsigned char *str, int length) return jsstr; } -/** Convert a jschar array to UTF-8 and append it to struct string. +/** Convert a char16_t array to UTF-8 and append it to struct string. * Replace misused surrogate codepoints with UCS_REPLACEMENT_CHARACTER. * * @param[in,out] utf8 * The function appends characters to this UTF-8 string. * * @param[in] utf16 - * Pointer to the first element in an array of jschars. + * Pointer to the first element in an array of char16_ts. * * @param[in] len - * Number of jschars in the @a utf16 array. + * Number of char16_ts in the @a utf16 array. * * @return @a utf8 if successful, or NULL if not. */ static struct string * add_jschars_to_utf8_string(struct string *utf8, - const jschar *utf16, size_t len) + const char16_t *utf16, size_t len) { size_t pos; @@ -309,11 +311,11 @@ unsigned char * jsstring_to_utf8(JSContext *ctx, JSString *jsstr, int *length) { size_t utf16_len; - const jschar *utf16; + const char16_t *utf16; struct string utf8; utf16_len = JS_GetStringLength(jsstr); - utf16 = JS_GetStringCharsZ(ctx, jsstr); /* stays owned by jsstr */ + utf16 = JS_GetTwoByteExternalStringChars(jsstr); /* stays owned by jsstr */ if (utf16 == NULL) { /* JS_GetStringChars doesn't have a JSContext * * parameter so it can't report the error diff --git a/src/scripting/smjs/elinks_object.c b/src/scripting/smjs/elinks_object.c index cf72b30e..7231b941 100644 --- a/src/scripting/smjs/elinks_object.c +++ b/src/scripting/smjs/elinks_object.c @@ -111,9 +111,9 @@ static bool elinks_set_property(JSContext *ctx, JS::HandleObject hobj, JS::Handl static const JSClass elinks_class = { "elinks", 0, - JS_PropertyStub, JS_DeletePropertyStub, + JS_PropertyStub, nullptr, elinks_get_property, elinks_set_property, - JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, NULL + nullptr, nullptr, nullptr, nullptr }; @@ -199,7 +199,7 @@ elinks_set_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, boo if (!smjs_ses) return false; - jsstr = JS::ToString(smjs_ctx, hvp); + jsstr = hvp.toString(); if (!jsstr) return false; url = JS_EncodeString(smjs_ctx, jsstr); @@ -332,7 +332,7 @@ elinks_set_property_location(JSContext *ctx, unsigned int argc, jsval *vp) if (!smjs_ses) return false; - jsstr = JS::ToString(smjs_ctx, args[0]); + jsstr = args[0].toString(); if (!jsstr) return false; url = JS_EncodeString(smjs_ctx, jsstr); diff --git a/src/scripting/smjs/global_object.c b/src/scripting/smjs/global_object.c index 44e71f9c..32491b77 100644 --- a/src/scripting/smjs/global_object.c +++ b/src/scripting/smjs/global_object.c @@ -18,9 +18,9 @@ JSObject *smjs_global_object; static const JSClass global_class = { "global", JSCLASS_GLOBAL_FLAGS, - JS_PropertyStub, JS_DeletePropertyStub, + JS_PropertyStub, nullptr, JS_PropertyStub, JS_StrictPropertyStub, - JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, NULL + nullptr, nullptr, nullptr, nullptr }; static JSObject * diff --git a/src/scripting/smjs/globhist.c b/src/scripting/smjs/globhist.c index c0c69561..343985dd 100644 --- a/src/scripting/smjs/globhist.c +++ b/src/scripting/smjs/globhist.c @@ -20,9 +20,9 @@ static void smjs_globhist_item_finalize(JSFreeOp *op, JSObject *obj); static const JSClass smjs_globhist_item_class = { "global_history_item", JSCLASS_HAS_PRIVATE, /* struct global_history_item * */ - JS_PropertyStub, JS_DeletePropertyStub, + JS_PropertyStub, nullptr, smjs_globhist_item_get_property, smjs_globhist_item_set_property, - JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, + nullptr, nullptr, nullptr, smjs_globhist_item_finalize, }; @@ -156,7 +156,7 @@ smjs_globhist_item_set_property(JSContext *ctx, JS::HandleObject hobj, JS::Handl switch (JSID_TO_INT(id)) { case GLOBHIST_TITLE: { - JSString *jsstr = JS::ToString(smjs_ctx, hvp); + JSString *jsstr = hvp.toString(); unsigned char *str = JS_EncodeString(smjs_ctx, jsstr); mem_free_set(&history_item->title, stracpy(str)); @@ -164,7 +164,7 @@ smjs_globhist_item_set_property(JSContext *ctx, JS::HandleObject hobj, JS::Handl return true; } case GLOBHIST_URL: { - JSString *jsstr = JS::ToString(smjs_ctx, hvp); + JSString *jsstr = hvp.toString(); unsigned char *str = JS_EncodeString(smjs_ctx, jsstr); mem_free_set(&history_item->url, stracpy(str)); @@ -172,11 +172,8 @@ smjs_globhist_item_set_property(JSContext *ctx, JS::HandleObject hobj, JS::Handl return true; } case GLOBHIST_LAST_VISIT: { - uint32_t seconds; - /* Bug 923: Assumes time_t values fit in uint32. */ - JS::ToInt32(smjs_ctx, hvp, &seconds); - history_item->last_visit = seconds; + history_item->last_visit = hvp.toInt32(); return true; } @@ -195,8 +192,7 @@ smjs_get_globhist_item_object(struct global_history_item *history_item) { JSObject *jsobj; - jsobj = JS_NewObject(smjs_ctx, (JSClass *) &smjs_globhist_item_class, - JS::NullPtr(), JS::NullPtr()); + jsobj = JS_NewObject(smjs_ctx, (JSClass *) &smjs_globhist_item_class); JS::RootedObject r_jsobj(smjs_ctx, jsobj); @@ -228,7 +224,7 @@ smjs_globhist_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId h if (!JS_IdToValue(ctx, id, &r_tmp)) goto ret_null; - uri_string = JS_EncodeString(ctx, JS::ToString(ctx, r_tmp)); + uri_string = JS_EncodeString(ctx, r_tmp.toString()); if (!uri_string) goto ret_null; history_item = get_global_history_item(uri_string); @@ -249,9 +245,9 @@ ret_null: static const JSClass smjs_globhist_class = { "global_history", 0, - JS_PropertyStub, JS_PropertyStub, + JS_PropertyStub, nullptr, smjs_globhist_get_property, JS_StrictPropertyStub, - JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, NULL, + nullptr, nullptr, nullptr, nullptr }; static JSObject * @@ -259,8 +255,7 @@ smjs_get_globhist_object(void) { JSObject *globhist; - globhist = JS_NewObject(smjs_ctx, (JSClass *) &smjs_globhist_class, - JS::NullPtr(), JS::NullPtr()); + globhist = JS_NewObject(smjs_ctx, (JSClass *) &smjs_globhist_class); if (!globhist) return NULL; return globhist; @@ -332,7 +327,7 @@ smjs_globhist_item_set_property_title(JSContext *ctx, unsigned int argc, jsval * if (!history_item) return false; - jsstr = JS::ToString(smjs_ctx, args[0]); + jsstr = args[0].toString(); str = JS_EncodeString(smjs_ctx, jsstr); mem_free_set(&history_item->title, stracpy(str)); @@ -386,7 +381,7 @@ smjs_globhist_item_set_property_url(JSContext *ctx, unsigned int argc, jsval *vp if (!history_item) return false; - jsstr = JS::ToString(smjs_ctx, args[0]); + jsstr = args[0].toString(); str = JS_EncodeString(smjs_ctx, jsstr); mem_free_set(&history_item->url, stracpy(str)); @@ -442,7 +437,6 @@ smjs_globhist_item_set_property_last_visit(JSContext *ctx, unsigned int argc, js JS::RootedObject hobj(ctx, &args.thisv().toObject()); struct global_history_item *history_item; - uint32_t seconds; /* This can be called if @obj if not itself an instance of the * appropriate class but has one in its prototype chain. Fail @@ -457,8 +451,7 @@ smjs_globhist_item_set_property_last_visit(JSContext *ctx, unsigned int argc, js if (!history_item) return false; /* Bug 923: Assumes time_t values fit in uint32. */ - JS::ToInt32(smjs_ctx, args[0], &seconds); - history_item->last_visit = seconds; + history_item->last_visit = args[0].toInt32(); return true; } diff --git a/src/scripting/smjs/hooks.c b/src/scripting/smjs/hooks.c index e1f6e570..9edb3be4 100644 --- a/src/scripting/smjs/hooks.c +++ b/src/scripting/smjs/hooks.c @@ -40,7 +40,7 @@ script_hook_url(va_list ap, void *data) if (false == (r_rval.toBoolean())) ret = EVENT_HOOK_STATUS_LAST; } else { - JSString *jsstr = JS::ToString(smjs_ctx, r_rval); + JSString *jsstr = r_rval.toString(); unsigned char *str = JS_EncodeString(smjs_ctx, jsstr); mem_free_set(url, stracpy(str)); @@ -82,7 +82,7 @@ script_hook_pre_format_html(va_list ap, void *data) if (true == smjs_invoke_elinks_object_method("preformat_html", 2, args, &r_rval)) - if (false == JSVAL_TO_BOOLEAN(rval)) + if (false == r_rval.toBoolean()) ret = EVENT_HOOK_STATUS_LAST; end: diff --git a/src/scripting/smjs/keybinding.c b/src/scripting/smjs/keybinding.c index 6d5e8898..dc0aa03f 100644 --- a/src/scripting/smjs/keybinding.c +++ b/src/scripting/smjs/keybinding.c @@ -20,9 +20,9 @@ static void keymap_finalize(JSFreeOp *op, JSObject *obj); static const JSClass keymap_class = { "keymap", JSCLASS_HAS_PRIVATE, /* int * */ - JS_PropertyStub, JS_DeletePropertyStub, + JS_PropertyStub, nullptr, keymap_get_property, keymap_set_property, - JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, keymap_finalize, + nullptr, nullptr, nullptr, keymap_finalize, }; /* @keymap_class.getProperty */ @@ -49,7 +49,7 @@ keymap_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS: if (!JS_IdToValue(ctx, id, &r_tmp)) goto ret_null; - keystroke_str = JS_EncodeString(ctx, JS::ToString(ctx, r_tmp)); + keystroke_str = JS_EncodeString(ctx, r_tmp.toString()); if (!keystroke_str) goto ret_null; action_str = get_action_name_from_keystroke((enum keymap_id) *data, @@ -119,13 +119,13 @@ keymap_set_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, boo JS::RootedValue rval(ctx, val); JS_IdToValue(ctx, id, &rval); - keystroke_str = JS_EncodeString(ctx, JS::ToString(ctx, rval)); + keystroke_str = JS_EncodeString(ctx, rval.toString()); if (!keystroke_str) return false; if (hvp.isString()) { unsigned char *action_str; - action_str = JS_EncodeString(ctx, JS::ToString(ctx, hvp)); + action_str = JS_EncodeString(ctx, hvp.toString()); if (!action_str) return false; if (bind_do(keymap_str, keystroke_str, action_str, 0)) @@ -204,8 +204,7 @@ smjs_get_keymap_object(enum keymap_id keymap_id) assert(smjs_ctx); - keymap_object = JS_NewObject(smjs_ctx, (JSClass *) &keymap_class, - JS::NullPtr(),JS::NullPtr()); + keymap_object = JS_NewObject(smjs_ctx, (JSClass *) &keymap_class); if (!keymap_object) return NULL; @@ -219,9 +218,9 @@ smjs_get_keymap_object(enum keymap_id keymap_id) static const JSClass keymaps_hash_class = { "keymaps_hash", JSCLASS_HAS_PRIVATE, - JS_PropertyStub, JS_PropertyStub, + JS_PropertyStub, nullptr, JS_PropertyStub, JS_StrictPropertyStub, - JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, NULL, + nullptr, nullptr, nullptr, nullptr, }; static JSObject * @@ -231,8 +230,7 @@ smjs_get_keymap_hash_object(void) int keymap_id; JSObject *keymaps_hash; - keymaps_hash = JS_NewObject(smjs_ctx, (JSClass *) &keymaps_hash_class, - JS::NullPtr(), JS::NullPtr()); + keymaps_hash = JS_NewObject(smjs_ctx, (JSClass *) &keymaps_hash_class); if (!keymaps_hash) return NULL; JS::RootedObject r_keymaps_hash(smjs_ctx, keymaps_hash); diff --git a/src/scripting/smjs/load_uri.c b/src/scripting/smjs/load_uri.c index ad8a1a42..fd23efcf 100644 --- a/src/scripting/smjs/load_uri.c +++ b/src/scripting/smjs/load_uri.c @@ -83,7 +83,7 @@ smjs_load_uri(JSContext *ctx, unsigned int argc, jsval *rval) if (argc < 2) return false; - jsstr = JS::ToString(smjs_ctx, args[0]); + jsstr = args[0].toString(); uri_string = JS_EncodeString(smjs_ctx, jsstr); if (!uri_string || !*uri_string) return false; diff --git a/src/scripting/smjs/session_object.c b/src/scripting/smjs/session_object.c index f107ff6e..65f2eaea 100644 --- a/src/scripting/smjs/session_object.c +++ b/src/scripting/smjs/session_object.c @@ -37,10 +37,10 @@ static bool session_construct(JSContext *ctx, unsigned int argc, jsval *rval); static const JSClass session_class = { "session", - JSCLASS_HAS_PRIVATE, /* struct session *; a weak reference */ - JS_PropertyStub, JS_DeletePropertyStub, + JSCLASS_HAS_PRIVATE | JSCLASS_IMPLEMENTS_BARRIERS, /* struct session *; a weak reference */ + JS_PropertyStub, nullptr, session_get_property, session_set_property, - JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, session_finalize, + nullptr, nullptr, nullptr, session_finalize, NULL, NULL, NULL, session_construct }; @@ -50,9 +50,9 @@ static void smjs_location_array_finalize(JSFreeOp *op, JSObject *obj); static const JSClass location_array_class = { "location_array", JSCLASS_HAS_PRIVATE, /* struct session *; a weak reference */ - JS_PropertyStub, JS_DeletePropertyStub, + JS_PropertyStub, nullptr, smjs_location_array_get_property, JS_StrictPropertyStub, - JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, smjs_location_array_finalize, + nullptr, nullptr, nullptr, smjs_location_array_finalize, }; /* location_array_class is the class for array object, the elements of which @@ -148,7 +148,7 @@ smjs_get_session_location_array_object(struct session *ses) assert(smjs_ctx); if_assert_failed return NULL; - obj = JS_NewObject(smjs_ctx, (JSClass *) &location_array_class, JS::NullPtr(), JS::NullPtr()); + obj = JS_NewObject(smjs_ctx, (JSClass *) &location_array_class); if (!obj) return NULL; /* Do this last, so that if any previous step fails, we can @@ -576,91 +576,6 @@ session_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS return true; } - /* XXX: Lock session here if it is ever changed to have an OBJECT_HEAD. */ - - hvp.setUndefined(); - - switch (JSID_TO_INT(id)) { - case SESSION_VISITED: - hvp.setInt32(ses->status.visited); - - return true; - case SESSION_HISTORY: { - JSObject *obj = smjs_get_session_location_array_object(ses); - - if (obj) { - hvp.setObject(*obj); - } - - return true; - } - case SESSION_LOADING_URI: { - struct uri *uri = have_location(ses) ? cur_loc(ses)->vs.uri - : ses->loading_uri; - - if (uri) { - hvp.setString(JS_NewStringCopyZ(ctx, struri(uri))); - } - - return true; - } - case SESSION_RELOADLEVEL: - hvp.setInt32(ses->reloadlevel); - - return true; - case SESSION_REDIRECT_CNT: - hvp.setInt32(ses->redirect_cnt); - - return true; - case SESSION_SEARCH_DIRECTION: - hvp.setString(JS_NewStringCopyZ(ctx, ses->search_direction == 1 ? "down" : "up")); - - return true; - case SESSION_KBDPREFIX: - hvp.setInt32(ses->kbdprefix.repeat_count); - - return true; - case SESSION_MARK_WAITING_FOR: - hvp.setString(JS_NewStringCopyZ(ctx, ses->kbdprefix.mark == KP_MARK_NOTHING - ? "nothing" - : ses->kbdprefix.mark == KP_MARK_SET - ? "set" - : "goto")); - - return true; - case SESSION_EXIT_QUERY: - hvp.setInt32(ses->exit_query); - - return true; - case SESSION_INSERT_MODE: - hvp.setString(JS_NewStringCopyZ(ctx, - ses->insert_mode == INSERT_MODE_LESS - ? "disabled" - : ses->insert_mode == INSERT_MODE_ON - ? "on" - : "off")); - - return true; - case SESSION_NAVIGATE_MODE: - hvp.setString(JS_NewStringCopyZ(ctx, - ses->navigate_mode == NAVIGATE_CURSOR_ROUTING - ? "cursor" - : "linkwise")); - - return true; - case SESSION_SEARCH_WORD: - hvp.setString(JS_NewStringCopyZ(ctx, ses->search_word)); - - return true; - case SESSION_LAST_SEARCH_WORD: - hvp.setString(JS_NewStringCopyZ(ctx, ses->last_search_word)); - - return true; - default: - INTERNAL("Invalid ID %d in session_get_property().", - JSID_TO_INT(id)); - } - return false; } @@ -706,7 +621,7 @@ session_set_property_reloadlevel(JSContext *ctx, unsigned int argc, jsval *vp) (JSClass *) &session_class, NULL); if (!ses) return false; - JS::ToInt32(ctx, args[0], &ses->reloadlevel); + ses->reloadlevel = args[0].toInt32(); return true; } @@ -729,7 +644,7 @@ session_set_property_redirect_cnt(JSContext *ctx, unsigned int argc, jsval *vp) (JSClass *) &session_class, NULL); if (!ses) return false; - JS::ToInt32(ctx, args[0], &ses->redirect_cnt); + ses->redirect_cnt = args[0].toInt32(); return true; } @@ -755,7 +670,7 @@ session_set_property_search_direction(JSContext *ctx, unsigned int argc, jsval * unsigned char *str; JSString *jsstr; - jsstr = JS::ToString(ctx, args[0]); + jsstr = args[0].toString(); if (!jsstr) return true; str = JS_EncodeString(ctx, jsstr); @@ -789,7 +704,7 @@ session_set_property_kbdprefix(JSContext *ctx, unsigned int argc, jsval *vp) (JSClass *) &session_class, NULL); if (!ses) return false; - JS::ToInt32(ctx, args[0], &ses->kbdprefix.repeat_count); + ses->kbdprefix.repeat_count = args[0].toInt32(); return true; } @@ -815,7 +730,7 @@ session_set_property_mark(JSContext *ctx, unsigned int argc, jsval *vp) unsigned char *str; JSString *jsstr; - jsstr = JS::ToString(ctx, args[0]); + jsstr = args[0].toString(); if (!jsstr) return true; str = JS_EncodeString(ctx, jsstr); @@ -854,7 +769,7 @@ session_set_property_insert_mode(JSContext *ctx, unsigned int argc, jsval *vp) unsigned char *str; JSString *jsstr; - jsstr = JS::ToString(ctx, args[0]); + jsstr = args[0].toString(); if (!jsstr) return true; str = JS_EncodeString(ctx, jsstr); @@ -893,7 +808,7 @@ session_set_property_navigate_mode(JSContext *ctx, unsigned int argc, jsval *vp) unsigned char *str; JSString *jsstr; - jsstr = JS::ToString(ctx, args[0]); + jsstr = args[0].toString(); if (!jsstr) return true; str = JS_EncodeString(ctx, jsstr); @@ -930,7 +845,7 @@ session_set_property_search_word(JSContext *ctx, unsigned int argc, jsval *vp) unsigned char *str; JSString *jsstr; - jsstr = JS::ToString(ctx, args[0]); + jsstr = args[0].toString(); if (!jsstr) return true; str = JS_EncodeString(ctx, jsstr); @@ -962,7 +877,7 @@ session_set_property_last_search_word(JSContext *ctx, unsigned int argc, jsval * unsigned char *str; JSString *jsstr; - jsstr = JS::ToString(ctx, args[0]); + jsstr = args[0].toString(); if (!jsstr) return true; str = JS_EncodeString(ctx, jsstr); @@ -995,141 +910,6 @@ session_set_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, bo if (!JSID_IS_INT(id)) return false; - switch (JSID_TO_INT(id)) { - case SESSION_VISITED: - int v; - JS::ToInt32(ctx, hvp, &v); - ses->status.visited = v; - - return true; - /* SESSION_HISTORY is RO */ - /* SESSION_LOADING_URI is RO */ - case SESSION_RELOADLEVEL: - JS::ToInt32(ctx, hvp, &ses->reloadlevel); - - return true; - case SESSION_REDIRECT_CNT: - JS::ToInt32(ctx, hvp, &ses->redirect_cnt); - - return true; - case SESSION_SEARCH_DIRECTION: { - unsigned char *str; - JSString *jsstr; - - jsstr = JS::ToString(ctx, hvp); - if (!jsstr) return true; - - str = JS_EncodeString(ctx, jsstr); - if (!str) return true; - - if (!strcmp(str, "up")) - ses->search_direction = -1; - else if (!strcmp(str, "down")) - ses->search_direction = 1; - else - return false; - - return true; - } - case SESSION_KBDPREFIX: - JS::ToInt32(ctx, hvp, &ses->kbdprefix.repeat_count); - - return true; - case SESSION_MARK_WAITING_FOR: { - unsigned char *str; - JSString *jsstr; - - jsstr = JS::ToString(ctx, hvp); - if (!jsstr) return true; - - str = JS_EncodeString(ctx, jsstr); - if (!str) return true; - - if (!strcmp(str, "nothing")) - ses->kbdprefix.mark = KP_MARK_NOTHING; - else if (!strcmp(str, "set")) - ses->kbdprefix.mark = KP_MARK_SET; - else if (!strcmp(str, "goto")) - ses->kbdprefix.mark = KP_MARK_GOTO; - else - return false; - - return true; - } - /* SESSION_EXIT_QUERY is RO */ - case SESSION_INSERT_MODE: { - unsigned char *str; - JSString *jsstr; - - jsstr = JS::ToString(ctx, hvp); - if (!jsstr) return true; - - str = JS_EncodeString(ctx, jsstr); - if (!str) return true; - - if (!strcmp(str, "disabled")) - ses->insert_mode = INSERT_MODE_LESS; - else if (!strcmp(str, "on")) - ses->insert_mode = INSERT_MODE_ON; - else if (!strcmp(str, "off")) - ses->insert_mode = INSERT_MODE_OFF; - else - return false; - - return true; - } - case SESSION_NAVIGATE_MODE: { - unsigned char *str; - JSString *jsstr; - - jsstr = JS::ToString(ctx, hvp); - if (!jsstr) return true; - - str = JS_EncodeString(ctx, jsstr); - if (!str) return true; - - if (!strcmp(str, "cursor")) - ses->navigate_mode = NAVIGATE_CURSOR_ROUTING; - else if (!strcmp(str, "linkwise")) - ses->navigate_mode = NAVIGATE_LINKWISE; - else - return false; - - return true; - } - case SESSION_SEARCH_WORD: { - unsigned char *str; - JSString *jsstr; - - jsstr = JS::ToString(ctx, hvp); - if (!jsstr) return true; - - str = JS_EncodeString(ctx, jsstr); - if (!str) return true; - - mem_free_set(&ses->search_word, str); - - return true; - } - case SESSION_LAST_SEARCH_WORD: { - unsigned char *str; - JSString *jsstr; - - jsstr = JS::ToString(ctx, hvp); - if (!jsstr) return true; - - str = JS_EncodeString(ctx, jsstr); - if (!str) return true; - - mem_free_set(&ses->last_search_word, str); - - return true; - } - default: - INTERNAL("Invalid ID %d in session_set_property().", - JSID_TO_INT(id)); - } - return false; } @@ -1139,7 +919,7 @@ static bool session_construct(JSContext *ctx, unsigned int argc, jsval *rval) { JS::CallArgs args = CallArgsFromVp(argc, rval); - JS::RootedObject hobj(ctx, &args.thisv().toObject()); + //JS::RootedObject hobj(ctx, &args.thisv().toObject()); jsval val; int bg = 0; /* open new tab in background */ @@ -1204,7 +984,7 @@ smjs_get_session_object(struct session *ses) assert(smjs_ctx); if_assert_failed return NULL; - obj = JS_NewObject(smjs_ctx, (JSClass *) &session_class, JS::NullPtr(), JS::NullPtr()); + obj = JS_NewObject(smjs_ctx, (JSClass *) &session_class); if (!obj) return NULL; JS::RootedObject r_obj(smjs_ctx, obj); @@ -1299,9 +1079,9 @@ session_array_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId h static const JSClass session_array_class = { "session_array", JSCLASS_HAS_PRIVATE, /* struct terminal *term; a weak reference */ - JS_PropertyStub, JS_PropertyStub, + JS_PropertyStub, nullptr, session_array_get_property, JS_StrictPropertyStub, - JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, NULL + nullptr, nullptr, nullptr, nullptr }; JSObject * @@ -1312,8 +1092,7 @@ smjs_get_session_array_object(struct terminal *term) assert(smjs_ctx); if_assert_failed return NULL; - obj = JS_NewObject(smjs_ctx, (JSClass *) &session_array_class, - JS::NullPtr(), JS::NullPtr()); + obj = JS_NewObject(smjs_ctx, (JSClass *) &session_array_class); if (!obj) return NULL; JS_SetPrivate(obj, term); @@ -1365,7 +1144,7 @@ smjs_session_goto_url(JSContext *ctx, unsigned int argc, jsval *rval) (JSClass *) &session_class, NULL); if (!ses) return false; /* detached */ - jsstr = JS::ToString(ctx, args[0]); + jsstr = args[0].toString(); if (!jsstr) return false; url = JS_EncodeString(ctx, jsstr); diff --git a/src/scripting/smjs/terminal_object.c b/src/scripting/smjs/terminal_object.c index 4a3a1992..bbc2633f 100644 --- a/src/scripting/smjs/terminal_object.c +++ b/src/scripting/smjs/terminal_object.c @@ -23,9 +23,9 @@ static void terminal_finalize(JSFreeOp *op, JSObject *obj); static const JSClass terminal_class = { "terminal", JSCLASS_HAS_PRIVATE, /* struct terminal *; a weak refernce */ - JS_PropertyStub, JS_DeletePropertyStub, + JS_PropertyStub, nullptr, terminal_get_property, JS_StrictPropertyStub, - JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, terminal_finalize + nullptr, nullptr, nullptr, terminal_finalize }; enum terminal_prop { @@ -112,7 +112,7 @@ smjs_get_terminal_object(struct terminal *term) assert(smjs_ctx); if_assert_failed return NULL; - obj = JS_NewObject(smjs_ctx, (JSClass *) &terminal_class, JS::NullPtr(), JS::NullPtr()); + obj = JS_NewObject(smjs_ctx, (JSClass *) &terminal_class); if (!obj) return NULL; @@ -190,9 +190,9 @@ terminal_array_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId static const JSClass terminal_array_class = { "terminal_array", 0, - JS_PropertyStub, JS_PropertyStub, + JS_PropertyStub, nullptr, terminal_array_get_property, JS_StrictPropertyStub, - JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, NULL + nullptr, nullptr, nullptr, nullptr }; /** Return an SMJS object that scripts can use an array to get terminal @@ -203,8 +203,7 @@ smjs_get_terminal_array_object(void) assert(smjs_ctx); if_assert_failed return NULL; - return JS_NewObject(smjs_ctx, (JSClass *) &terminal_array_class, - JS::NullPtr(), JS::NullPtr()); + return JS_NewObject(smjs_ctx, (JSClass *) &terminal_array_class); } void diff --git a/src/scripting/smjs/view_state_object.c b/src/scripting/smjs/view_state_object.c index a8be80bd..041616fa 100644 --- a/src/scripting/smjs/view_state_object.c +++ b/src/scripting/smjs/view_state_object.c @@ -27,9 +27,9 @@ static void view_state_finalize(JSFreeOp *op, JSObject *obj); static const JSClass view_state_class = { "view_state", JSCLASS_HAS_PRIVATE, /* struct view_state * */ - JS_PropertyStub, JS_DeletePropertyStub, + JS_PropertyStub, nullptr, view_state_get_property, view_state_set_property, - JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, view_state_finalize + nullptr, nullptr, nullptr, view_state_finalize }; /* Tinyids of properties. Use negative values to distinguish these @@ -41,10 +41,80 @@ enum view_state_prop { VIEW_STATE_URI = -2, }; +static bool +view_state_get_property_plain(JSContext *ctx, unsigned int argc, jsval *vp) +{ + JS::CallArgs args = CallArgsFromVp(argc, vp); + JS::RootedObject hobj(ctx, &args.thisv().toObject()); + + struct view_state *vs; + + /* This can be called if @obj if not itself an instance of the + * appropriate class but has one in its prototype chain. Fail + * such calls. */ + if (!JS_InstanceOf(ctx, hobj, (JSClass *) &view_state_class, NULL)) + return false; + + vs = JS_GetInstancePrivate(ctx, hobj, + (JSClass *) &view_state_class, NULL); + if (!vs) return false; + + args.rval().setInt32(vs->plain); + + return true; +} + +static bool +view_state_set_property_plain(JSContext *ctx, unsigned int argc, jsval *vp) +{ + JS::CallArgs args = CallArgsFromVp(argc, vp); + JS::RootedObject hobj(ctx, &args.thisv().toObject()); + + struct view_state *vs; + + if (argc != 1) { + return false; + } + /* This can be called if @obj if not itself an instance of the + * appropriate class but has one in its prototype chain. Fail + * such calls. */ + if (!JS_InstanceOf(ctx, hobj, (JSClass *) &view_state_class, NULL)) + return false; + + vs = JS_GetInstancePrivate(ctx, hobj, + (JSClass *) &view_state_class, NULL); + if (!vs) return false; + + vs->plain = args[0].toInt32(); + + return true; +} + +static bool +view_state_get_property_uri(JSContext *ctx, unsigned int argc, jsval *vp) +{ + JS::CallArgs args = CallArgsFromVp(argc, vp); + JS::RootedObject hobj(ctx, &args.thisv().toObject()); + + /* This can be called if @obj if not itself an instance of the + * appropriate class but has one in its prototype chain. Fail + * such calls. */ + if (!JS_InstanceOf(ctx, hobj, (JSClass *) &view_state_class, NULL)) + return false; + + struct view_state *vs = JS_GetInstancePrivate(ctx, hobj, + (JSClass *) &view_state_class, NULL); + if (!vs) return false; + + args.rval().setString(JS_NewStringCopyZ(ctx, struri(vs->uri))); + + return true; +} + static const JSPropertySpec view_state_props[] = { - { "plain", (unsigned char)VIEW_STATE_PLAIN, JSPROP_ENUMERATE }, - { "uri", (unsigned char)VIEW_STATE_URI, JSPROP_ENUMERATE | JSPROP_READONLY }, - { NULL } + JS_PSGS("plain", view_state_get_property_plain, view_state_set_property_plain, JSPROP_ENUMERATE), + JS_PSG("uri", view_state_get_property_uri, JSPROP_ENUMERATE), + JS_PS_END }; /* @view_state_class.getProperty */ @@ -165,8 +235,7 @@ smjs_get_view_state_object(struct view_state *vs) if_assert_failed return NULL; view_state_object = JS_NewObject(smjs_ctx, - (JSClass *) &view_state_class, - JS::NullPtr(), JS::NullPtr()); + (JSClass *) &view_state_class); if (!view_state_object) return NULL; From a5b68a25a12dd8afe02e459116a89a0df5c5230a Mon Sep 17 00:00:00 2001 From: Witold Filipczyk Date: Fri, 23 Oct 2020 22:34:58 +0200 Subject: [PATCH 069/179] [mozjs45] Code is unstable, but at least compiles. --- configure.ac | 4 +- meson.build | 2 +- src/ecmascript/spidermonkey-shared.c | 1 + src/ecmascript/spidermonkey-shared.h | 12 +- src/ecmascript/spidermonkey.c | 45 +- src/ecmascript/spidermonkey/document.c | 52 +- src/ecmascript/spidermonkey/form.c | 1073 ++++++++++++----------- src/ecmascript/spidermonkey/location.c | 31 +- src/ecmascript/spidermonkey/navigator.c | 24 +- src/ecmascript/spidermonkey/unibar.c | 13 +- src/ecmascript/spidermonkey/util.h | 34 +- src/ecmascript/spidermonkey/window.c | 73 +- src/scripting/smjs/action_object.c | 10 +- src/scripting/smjs/bookmarks.c | 32 +- src/scripting/smjs/cache_object.c | 32 +- src/scripting/smjs/core.c | 36 +- src/scripting/smjs/elinks_object.c | 28 +- src/scripting/smjs/elinks_object.h | 2 +- src/scripting/smjs/globhist.c | 32 +- src/scripting/smjs/hooks.c | 4 +- src/scripting/smjs/keybinding.c | 30 +- src/scripting/smjs/load_uri.c | 10 +- src/scripting/smjs/session_object.c | 106 +-- src/scripting/smjs/terminal_object.c | 2 +- src/scripting/smjs/view_state_object.c | 10 +- test/ecmascript/infinite.html | 6 +- 26 files changed, 882 insertions(+), 822 deletions(-) diff --git a/configure.ac b/configure.ac index 4c1ec5ba..47872d7b 100644 --- a/configure.ac +++ b/configure.ac @@ -612,11 +612,11 @@ case "$with_spidermonkey" in ;; esac -for package in mozjs-38; do +for package in mozjs-45; do if test -n "$CONFIG_SPIDERMONKEY"; then break else - AC_MSG_CHECKING([for SpiderMonkey (mozjs-38) in pkg-config $package]) + AC_MSG_CHECKING([for SpiderMonkey (mozjs-45) in pkg-config $package]) if $PKG_CONFIG --cflags --libs $package > /dev/null 2>&AS_MESSAGE_LOG_FD; then SPIDERMONKEY_LIBS="$($PKG_CONFIG --libs $package)" SPIDERMONKEY_CFLAGS="$($PKG_CONFIG --cflags $package)" diff --git a/meson.build b/meson.build index b9d54c2b..777e5808 100644 --- a/meson.build +++ b/meson.build @@ -271,7 +271,7 @@ if conf_data.get('CONFIG_BZIP2') endif if conf_data.get('CONFIG_ECMASCRIPT') - mozjsdeps = dependency('mozjs-38') + mozjsdeps = dependency('mozjs-45') deps += mozjsdeps endif diff --git a/src/ecmascript/spidermonkey-shared.c b/src/ecmascript/spidermonkey-shared.c index 7f057fbd..8af6d565 100644 --- a/src/ecmascript/spidermonkey-shared.c +++ b/src/ecmascript/spidermonkey-shared.c @@ -8,6 +8,7 @@ #include "elinks.h" #include "ecmascript/spidermonkey-shared.h" +#include /** A shared runtime used for both user scripts (scripting/smjs/) and * scripts on web pages (ecmascript/spidermonkey/). diff --git a/src/ecmascript/spidermonkey-shared.h b/src/ecmascript/spidermonkey-shared.h index 782867fa..ee3fbae9 100644 --- a/src/ecmascript/spidermonkey-shared.h +++ b/src/ecmascript/spidermonkey-shared.h @@ -53,20 +53,20 @@ JSObject *spidermonkey_InitClass(JSContext *cx, JSObject *obj, JSPropertySpec *static_ps, const spidermonkeyFunctionSpec *static_fs); -static void undef_to_jsval(JSContext *ctx, jsval *vp); -static unsigned char *jsval_to_string(JSContext *ctx, jsval *vp); +static void undef_to_jsval(JSContext *ctx, JS::Value *vp); +static unsigned char *jsval_to_string(JSContext *ctx, JS::Value *vp); static unsigned char *jsid_to_string(JSContext *ctx, jsid *id); /* Inline functions */ static inline void -undef_to_jsval(JSContext *ctx, jsval *vp) +undef_to_jsval(JSContext *ctx, JS::Value *vp) { - *vp = JSVAL_NULL; + *vp = JS::NullValue(); } static inline unsigned char * -jsval_to_string(JSContext *ctx, jsval *vp) +jsval_to_string(JSContext *ctx, JS::Value *vp) { JS::RootedValue r_vp(ctx, *vp); JSString *str = r_vp.toString(); @@ -85,6 +85,6 @@ jsid_to_string(JSContext *ctx, jsid *id) } #define ELINKS_CAST_PROP_PARAMS JSObject *obj = (hobj.get()); \ - jsval *vp = (hvp.address()); + JS::Value *vp = (hvp.address()); #endif diff --git a/src/ecmascript/spidermonkey.c b/src/ecmascript/spidermonkey.c index 300124e6..a626eebb 100644 --- a/src/ecmascript/spidermonkey.c +++ b/src/ecmascript/spidermonkey.c @@ -11,6 +11,7 @@ #include "elinks.h" #include "ecmascript/spidermonkey/util.h" +#include #include "bfu/dialog.h" #include "cache/cache.h" @@ -66,6 +67,8 @@ error_reporter(JSContext *ctx, const char *message, JSErrorReport *report) unsigned char *strict, *exception, *warning, *error; struct string msg; + char *prefix = nullptr; + assert(interpreter && interpreter->vs && interpreter->vs->doc_view && ses && ses->tab); if_assert_failed goto reported; @@ -92,6 +95,20 @@ error_reporter(JSContext *ctx, const char *message, JSErrorReport *report) add_to_string(&msg, ":\n\n"); add_to_string(&msg, message); + if (report->filename) { + prefix = JS_smprintf("%s:", report->filename); + } + + if (report->lineno) { + char* tmp = prefix; + prefix = JS_smprintf("%s%u:%u ", tmp ? tmp : "", report->lineno, report->column); + JS_free(ctx, tmp); + } + + if (prefix) { + add_to_string(&msg, prefix); + } +#if 0 if (report->linebuf && report->tokenptr) { int pos = report->tokenptr - report->linebuf; @@ -100,6 +117,7 @@ error_reporter(JSContext *ctx, const char *message, JSErrorReport *report) pos - 2, " ", strlen(report->linebuf) - pos - 1, " "); } +#endif info_box(term, MSGBOX_FREE_TEXT, N_("JavaScript Error"), ALIGN_CENTER, msg.source); @@ -182,6 +200,7 @@ spidermonkey_get_interpreter(struct ecmascript_interpreter *interpreter) if (!forms_obj) { goto release_and_fail; } +// JS_SetPrivate(forms_obj, interpreter->vs); history_obj = spidermonkey_InitClass(ctx, window_obj, NULL, &history_class, NULL, 0, @@ -191,6 +210,8 @@ spidermonkey_get_interpreter(struct ecmascript_interpreter *interpreter) if (!history_obj) { goto release_and_fail; } +// JS_SetPrivate(history_obj, interpreter->vs); + location_obj = spidermonkey_InitClass(ctx, window_obj, NULL, &location_class, NULL, 0, @@ -200,8 +221,10 @@ spidermonkey_get_interpreter(struct ecmascript_interpreter *interpreter) if (!location_obj) { goto release_and_fail; } +// JS_SetPrivate(location_obj, interpreter->vs); - menubar_obj = JS_InitClass(ctx, window_obj, JS::NullPtr(), + + menubar_obj = JS_InitClass(ctx, window_obj, nullptr, &menubar_class, NULL, 0, unibar_props, NULL, NULL, NULL); @@ -210,7 +233,7 @@ spidermonkey_get_interpreter(struct ecmascript_interpreter *interpreter) } JS_SetPrivate(menubar_obj, "t"); /* to @menubar_class */ - statusbar_obj = JS_InitClass(ctx, window_obj, JS::NullPtr(), + statusbar_obj = JS_InitClass(ctx, window_obj, nullptr, &statusbar_class, NULL, 0, unibar_props, NULL, NULL, NULL); @@ -219,13 +242,14 @@ spidermonkey_get_interpreter(struct ecmascript_interpreter *interpreter) } JS_SetPrivate(statusbar_obj, "s"); /* to @statusbar_class */ - navigator_obj = JS_InitClass(ctx, window_obj, JS::NullPtr(), + navigator_obj = JS_InitClass(ctx, window_obj, nullptr, &navigator_class, NULL, 0, navigator_props, NULL, NULL, NULL); if (!navigator_obj) { goto release_and_fail; } +// JS_SetPrivate(navigator_obj, interpreter->vs); return ctx; @@ -252,7 +276,7 @@ spidermonkey_eval(struct ecmascript_interpreter *interpreter, struct string *code, struct string *ret) { JSContext *ctx; - jsval rval; + JS::Value rval; assert(interpreter); if (!js_module_init_ok) { @@ -267,7 +291,7 @@ spidermonkey_eval(struct ecmascript_interpreter *interpreter, JS::RootedValue r_val(ctx, rval); JS::CompileOptions options(ctx); - JS::Evaluate(ctx, cg, options, code->source, code->length, &r_val); + JS::Evaluate(ctx, options, code->source, code->length, &r_val); done_heartbeat(interpreter->heartbeat); } @@ -278,7 +302,7 @@ spidermonkey_eval_stringback(struct ecmascript_interpreter *interpreter, { bool ret; JSContext *ctx; - jsval rval; + JS::Value rval; assert(interpreter); if (!js_module_init_ok) return NULL; @@ -295,7 +319,7 @@ spidermonkey_eval_stringback(struct ecmascript_interpreter *interpreter, // .setCompileAndGo(true) // .setNoScriptRval(true); - ret = JS::Evaluate(ctx, cg, options, code->source, code->length, &r_rval); + ret = JS::Evaluate(ctx, options, code->source, code->length, &r_rval); done_heartbeat(interpreter->heartbeat); if (ret == false) { @@ -315,8 +339,7 @@ spidermonkey_eval_boolback(struct ecmascript_interpreter *interpreter, struct string *code) { JSContext *ctx; - JS::RootedFunction fun(ctx); - jsval rval; + JS::Value rval; int ret; assert(interpreter); @@ -324,9 +347,11 @@ spidermonkey_eval_boolback(struct ecmascript_interpreter *interpreter, ctx = interpreter->backend_data; interpreter->ret = NULL; + JS::RootedFunction fun(ctx); + JS::CompileOptions options(ctx); JS::AutoObjectVector ag(ctx); - if (!JS::CompileFunction(ctx, ag, options, "", 0, nullptr, code->source, + if (!JS::CompileFunction(ctx, ag, options, "aaa", 0, nullptr, code->source, code->length, &fun)) { return -1; }; diff --git a/src/ecmascript/spidermonkey/document.c b/src/ecmascript/spidermonkey/document.c index de5ec176..aca00e64 100644 --- a/src/ecmascript/spidermonkey/document.c +++ b/src/ecmascript/spidermonkey/document.c @@ -11,6 +11,7 @@ #include "elinks.h" #include "ecmascript/spidermonkey/util.h" +#include #include "bfu/dialog.h" #include "cache/cache.h" @@ -60,11 +61,11 @@ JSClass document_class = { #ifdef CONFIG_COOKIES static bool -document_get_property_cookie(JSContext *ctx, unsigned int argc, jsval *vp) +document_get_property_cookie(JSContext *ctx, unsigned int argc, JS::Value *vp) { JS::CallArgs args = CallArgsFromVp(argc, vp); JS::RootedObject hobj(ctx, &args.thisv().toObject()); - JS::RootedObject parent_win(ctx, JS_GetParent(hobj)); + JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); struct view_state *vs; struct string *cookies; @@ -92,15 +93,14 @@ document_get_property_cookie(JSContext *ctx, unsigned int argc, jsval *vp) } static bool -document_set_property_cookie(JSContext *ctx, unsigned int argc, jsval *vp) +document_set_property_cookie(JSContext *ctx, unsigned int argc, JS::Value *vp) { JS::CallArgs args = CallArgsFromVp(argc, vp); JS::RootedObject hobj(ctx, &args.thisv().toObject()); - JS::RootedObject parent_win(ctx, JS_GetParent(hobj)); + JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); struct view_state *vs; struct string *cookies; - parent_win = JS_GetParent(hobj); assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); if_assert_failed return false; @@ -117,11 +117,11 @@ document_set_property_cookie(JSContext *ctx, unsigned int argc, jsval *vp) #endif static bool -document_get_property_location(JSContext *ctx, unsigned int argc, jsval *vp) +document_get_property_location(JSContext *ctx, unsigned int argc, JS::Value *vp) { JS::CallArgs args = CallArgsFromVp(argc, vp); JS::RootedObject hobj(ctx, &args.thisv().toObject()); - JS::RootedObject parent_win(ctx, JS_GetParent(hobj)); + JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); if_assert_failed return false; @@ -132,11 +132,11 @@ document_get_property_location(JSContext *ctx, unsigned int argc, jsval *vp) } static bool -document_set_property_location(JSContext *ctx, unsigned int argc, jsval *vp) +document_set_property_location(JSContext *ctx, unsigned int argc, JS::Value *vp) { JS::CallArgs args = CallArgsFromVp(argc, vp); JS::RootedObject hobj(ctx, &args.thisv().toObject()); - JS::RootedObject parent_win(ctx, JS_GetParent(hobj)); + JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); struct view_state *vs; struct document_view *doc_view; @@ -156,11 +156,11 @@ document_set_property_location(JSContext *ctx, unsigned int argc, jsval *vp) static bool -document_get_property_referrer(JSContext *ctx, unsigned int argc, jsval *vp) +document_get_property_referrer(JSContext *ctx, unsigned int argc, JS::Value *vp) { JS::CallArgs args = CallArgsFromVp(argc, vp); JS::RootedObject hobj(ctx, &args.thisv().toObject()); - JS::RootedObject parent_win(ctx, JS_GetParent(hobj)); + JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); struct view_state *vs; struct document_view *doc_view; struct document *document; @@ -220,11 +220,11 @@ document_get_property_referrer(JSContext *ctx, unsigned int argc, jsval *vp) static bool -document_get_property_title(JSContext *ctx, unsigned int argc, jsval *vp) +document_get_property_title(JSContext *ctx, unsigned int argc, JS::Value *vp) { JS::CallArgs args = CallArgsFromVp(argc, vp); JS::RootedObject hobj(ctx, &args.thisv().toObject()); - JS::RootedObject parent_win(ctx, JS_GetParent(hobj)); + JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); struct view_state *vs; struct document_view *doc_view; struct document *document; @@ -245,11 +245,11 @@ document_get_property_title(JSContext *ctx, unsigned int argc, jsval *vp) } static bool -document_set_property_title(JSContext *ctx, int argc, jsval *vp) +document_set_property_title(JSContext *ctx, int argc, JS::Value *vp) { JS::CallArgs args = CallArgsFromVp(argc, vp); JS::RootedObject hobj(ctx, &args.thisv().toObject()); - JS::RootedObject parent_win(ctx, JS_GetParent(hobj)); + JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); struct view_state *vs; struct document_view *doc_view; struct document *document; @@ -271,11 +271,11 @@ document_set_property_title(JSContext *ctx, int argc, jsval *vp) } static bool -document_get_property_url(JSContext *ctx, unsigned int argc, jsval *vp) +document_get_property_url(JSContext *ctx, unsigned int argc, JS::Value *vp) { JS::CallArgs args = CallArgsFromVp(argc, vp); JS::RootedObject hobj(ctx, &args.thisv().toObject()); - JS::RootedObject parent_win(ctx, JS_GetParent(hobj)); + JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); struct view_state *vs; struct document_view *doc_view; struct document *document; @@ -303,11 +303,11 @@ document_get_property_url(JSContext *ctx, unsigned int argc, jsval *vp) } static bool -document_set_property_url(JSContext *ctx, int argc, jsval *vp) +document_set_property_url(JSContext *ctx, int argc, JS::Value *vp) { JS::CallArgs args = CallArgsFromVp(argc, vp); JS::RootedObject hobj(ctx, &args.thisv().toObject()); - JS::RootedObject parent_win(ctx, JS_GetParent(hobj)); + JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); struct view_state *vs; struct document_view *doc_view; struct document *document; @@ -360,7 +360,7 @@ document_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, J if (classPtr != &document_class) return false; - parent_win = JS_GetParent(obj); + parent_win = js::GetGlobalForObjectCrossCompartment(hobj); assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); if_assert_failed return false; @@ -381,8 +381,8 @@ document_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, J return true; } -static bool document_write(JSContext *ctx, unsigned int argc, jsval *rval); -static bool document_writeln(JSContext *ctx, unsigned int argc, jsval *rval); +static bool document_write(JSContext *ctx, unsigned int argc, JS::Value *rval); +static bool document_writeln(JSContext *ctx, unsigned int argc, JS::Value *rval); const spidermonkeyFunctionSpec document_funcs[] = { { "write", document_write, 1 }, @@ -391,9 +391,9 @@ const spidermonkeyFunctionSpec document_funcs[] = { }; static bool -document_write_do(JSContext *ctx, unsigned int argc, jsval *rval, int newline) +document_write_do(JSContext *ctx, unsigned int argc, JS::Value *rval, int newline) { - jsval val; + JS::Value val; struct ecmascript_interpreter *interpreter = JS_GetContextPrivate(ctx); struct string *ret = interpreter->ret; JS::CallArgs args = JS::CallArgsFromVp(argc, rval); @@ -428,7 +428,7 @@ document_write_do(JSContext *ctx, unsigned int argc, jsval *rval, int newline) /* @document_funcs{"write"} */ static bool -document_write(JSContext *ctx, unsigned int argc, jsval *rval) +document_write(JSContext *ctx, unsigned int argc, JS::Value *rval) { return document_write_do(ctx, argc, rval, 0); @@ -436,7 +436,7 @@ document_write(JSContext *ctx, unsigned int argc, jsval *rval) /* @document_funcs{"writeln"} */ static bool -document_writeln(JSContext *ctx, unsigned int argc, jsval *rval) +document_writeln(JSContext *ctx, unsigned int argc, JS::Value *rval) { return document_write_do(ctx, argc, rval, 1); } diff --git a/src/ecmascript/spidermonkey/form.c b/src/ecmascript/spidermonkey/form.c index 0c20ac2e..4ba033f8 100644 --- a/src/ecmascript/spidermonkey/form.c +++ b/src/ecmascript/spidermonkey/form.c @@ -11,6 +11,7 @@ #include "elinks.h" #include "ecmascript/spidermonkey/util.h" +#include #include "bfu/dialog.h" #include "cache/cache.h" @@ -50,18 +51,18 @@ //static JSClass form_class; /* defined below */ static bool form_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); -static bool form_get_property_action(JSContext *ctx, unsigned int argc, jsval *vp); -static bool form_set_property_action(JSContext *ctx, unsigned int argc, jsval *vp); -static bool form_get_property_elements(JSContext *ctx, unsigned int argc, jsval *vp); -static bool form_get_property_encoding(JSContext *ctx, unsigned int argc, jsval *vp); -static bool form_set_property_encoding(JSContext *ctx, unsigned int argc, jsval *vp); -static bool form_get_property_length(JSContext *ctx, unsigned int argc, jsval *vp); -static bool form_get_property_method(JSContext *ctx, unsigned int argc, jsval *vp); -static bool form_set_property_method(JSContext *ctx, unsigned int argc, jsval *vp); -static bool form_get_property_name(JSContext *ctx, unsigned int argc, jsval *vp); -static bool form_set_property_name(JSContext *ctx, unsigned int argc, jsval *vp); -static bool form_get_property_target(JSContext *ctx, unsigned int argc, jsval *vp); -static bool form_set_property_target(JSContext *ctx, unsigned int argc, jsval *vp); +static bool form_get_property_action(JSContext *ctx, unsigned int argc, JS::Value *vp); +static bool form_set_property_action(JSContext *ctx, unsigned int argc, JS::Value *vp); +static bool form_get_property_elements(JSContext *ctx, unsigned int argc, JS::Value *vp); +static bool form_get_property_encoding(JSContext *ctx, unsigned int argc, JS::Value *vp); +static bool form_set_property_encoding(JSContext *ctx, unsigned int argc, JS::Value *vp); +static bool form_get_property_length(JSContext *ctx, unsigned int argc, JS::Value *vp); +static bool form_get_property_method(JSContext *ctx, unsigned int argc, JS::Value *vp); +static bool form_set_property_method(JSContext *ctx, unsigned int argc, JS::Value *vp); +static bool form_get_property_name(JSContext *ctx, unsigned int argc, JS::Value *vp); +static bool form_set_property_name(JSContext *ctx, unsigned int argc, JS::Value *vp); +static bool form_get_property_target(JSContext *ctx, unsigned int argc, JS::Value *vp); +static bool form_set_property_target(JSContext *ctx, unsigned int argc, JS::Value *vp); static void form_finalize(JSFreeOp *op, JSObject *obj); @@ -82,7 +83,7 @@ static JSClass form_class = { * JS code, but I hope it doesn't matter anywhere. --pasky */ static bool input_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); -static bool input_set_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, bool strict, JS::MutableHandleValue hvp); +static bool input_set_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); static void input_finalize(JSFreeOp *op, JSObject *obj); /* Each @input_class object must have a @form_class parent. */ @@ -123,7 +124,7 @@ static struct form_state *input_get_form_state(JSContext *ctx, JSObject *jsinput static bool -input_get_property_accessKey(JSContext *ctx, unsigned int argc, jsval *vp) +input_get_property_accessKey(JSContext *ctx, unsigned int argc, JS::Value *vp) { JS::CallArgs args = CallArgsFromVp(argc, vp); JS::RootedObject hobj(ctx, &args.thisv().toObject()); @@ -137,20 +138,23 @@ input_get_property_accessKey(JSContext *ctx, unsigned int argc, jsval *vp) struct link *link = NULL; JSString *keystr; - JS::RootedObject parent_form(ctx, JS_GetParent(hobj)); - assert(JS_InstanceOf(ctx, parent_form, &form_class, NULL)); - if_assert_failed return false; +// JS::RootedObject parent_form(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); +// assert(JS_InstanceOf(ctx, parent_form, &form_class, NULL)); +// if_assert_failed return false; - JS::RootedObject parent_doc(ctx, JS_GetParent(parent_form)); - assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); - if_assert_failed return false; +// JS::RootedObject parent_doc(ctx, js::GetGlobalForObjectCrossCompartment(parent_form)); +// assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); +// if_assert_failed return false; - JS::RootedObject parent_win(ctx, JS_GetParent(parent_doc)); - assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); - if_assert_failed return false; +// JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(parent_doc)); +// assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); +// if_assert_failed return false; + + JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); vs = JS_GetInstancePrivate(ctx, parent_win, &window_class, NULL); + if (!vs) { return false; } @@ -186,7 +190,7 @@ input_get_property_accessKey(JSContext *ctx, unsigned int argc, jsval *vp) } static bool -input_set_property_accessKey(JSContext *ctx, unsigned int argc, jsval *vp) +input_set_property_accessKey(JSContext *ctx, unsigned int argc, JS::Value *vp) { JS::CallArgs args = CallArgsFromVp(argc, vp); JS::RootedObject hobj(ctx, &args.thisv().toObject()); @@ -200,15 +204,17 @@ input_set_property_accessKey(JSContext *ctx, unsigned int argc, jsval *vp) struct link *link = NULL; unicode_val_T accesskey; - JS::RootedObject parent_form(ctx, JS_GetParent(hobj)); - assert(JS_InstanceOf(ctx, parent_form, &form_class, NULL)); - if_assert_failed return false; - JS::RootedObject parent_doc(ctx, JS_GetParent(parent_form)); - assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); - if_assert_failed return false; - JS::RootedObject parent_win(ctx, JS_GetParent(parent_doc)); - assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); - if_assert_failed return false; +// JS::RootedObject parent_form(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); +// assert(JS_InstanceOf(ctx, parent_form, &form_class, NULL)); +// if_assert_failed return false; +// JS::RootedObject parent_doc(ctx, js::GetGlobalForObjectCrossCompartment(parent_form)); +// assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); +// if_assert_failed return false; +// JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(parent_doc)); +// assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); +// if_assert_failed return false; + + JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); vs = JS_GetInstancePrivate(ctx, parent_win, &window_class, NULL); @@ -270,7 +276,7 @@ input_set_property_accessKey(JSContext *ctx, unsigned int argc, jsval *vp) } static bool -input_get_property_alt(JSContext *ctx, unsigned int argc, jsval *vp) +input_get_property_alt(JSContext *ctx, unsigned int argc, JS::Value *vp) { JS::CallArgs args = CallArgsFromVp(argc, vp); JS::RootedObject hobj(ctx, &args.thisv().toObject()); @@ -281,17 +287,18 @@ input_get_property_alt(JSContext *ctx, unsigned int argc, jsval *vp) struct form_state *fs; struct el_form_control *fc; - JS::RootedObject parent_form(ctx, JS_GetParent(hobj)); - assert(JS_InstanceOf(ctx, parent_form, &form_class, NULL)); - if_assert_failed return false; +// JS::RootedObject parent_form(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); +// assert(JS_InstanceOf(ctx, parent_form, &form_class, NULL)); +// if_assert_failed return false; - JS::RootedObject parent_doc(ctx, JS_GetParent(parent_form)); - assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); - if_assert_failed return false; +// JS::RootedObject parent_doc(ctx, js::GetGlobalForObjectCrossCompartment(parent_form)); +// assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); +// if_assert_failed return false; - JS::RootedObject parent_win(ctx, JS_GetParent(parent_doc)); - assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); - if_assert_failed return false; +// JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(parent_doc)); +// assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); +// if_assert_failed return false; + JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); vs = JS_GetInstancePrivate(ctx, parent_win, &window_class, NULL); @@ -313,7 +320,7 @@ input_get_property_alt(JSContext *ctx, unsigned int argc, jsval *vp) } static bool -input_set_property_alt(JSContext *ctx, unsigned int argc, jsval *vp) +input_set_property_alt(JSContext *ctx, unsigned int argc, JS::Value *vp) { JS::CallArgs args = CallArgsFromVp(argc, vp); JS::RootedObject hobj(ctx, &args.thisv().toObject()); @@ -323,15 +330,16 @@ input_set_property_alt(JSContext *ctx, unsigned int argc, jsval *vp) struct form_state *fs; struct el_form_control *fc; - JS::RootedObject parent_form(ctx, JS_GetParent(hobj)); - assert(JS_InstanceOf(ctx, parent_form, &form_class, NULL)); - if_assert_failed return false; - JS::RootedObject parent_doc(ctx, JS_GetParent(parent_form)); - assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); - if_assert_failed return false; - JS::RootedObject parent_win(ctx, JS_GetParent(parent_doc)); - assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); - if_assert_failed return false; +// JS::RootedObject parent_form(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); +// assert(JS_InstanceOf(ctx, parent_form, &form_class, NULL)); +// if_assert_failed return false; +// JS::RootedObject parent_doc(ctx, js::GetGlobalForObjectCrossCompartment(parent_form)); +// assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); +// if_assert_failed return false; +// JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(parent_doc)); +// assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); +// if_assert_failed return false; + JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); vs = JS_GetInstancePrivate(ctx, parent_win, &window_class, NULL); @@ -353,7 +361,7 @@ input_set_property_alt(JSContext *ctx, unsigned int argc, jsval *vp) } static bool -input_get_property_checked(JSContext *ctx, unsigned int argc, jsval *vp) +input_get_property_checked(JSContext *ctx, unsigned int argc, JS::Value *vp) { JS::CallArgs args = CallArgsFromVp(argc, vp); JS::RootedObject hobj(ctx, &args.thisv().toObject()); @@ -369,7 +377,7 @@ input_get_property_checked(JSContext *ctx, unsigned int argc, jsval *vp) } static bool -input_set_property_checked(JSContext *ctx, unsigned int argc, jsval *vp) +input_set_property_checked(JSContext *ctx, unsigned int argc, JS::Value *vp) { JS::CallArgs args = CallArgsFromVp(argc, vp); JS::RootedObject hobj(ctx, &args.thisv().toObject()); @@ -380,15 +388,16 @@ input_set_property_checked(JSContext *ctx, unsigned int argc, jsval *vp) struct form_state *fs; struct el_form_control *fc; - JS::RootedObject parent_form(ctx, JS_GetParent(hobj)); - assert(JS_InstanceOf(ctx, parent_form, &form_class, NULL)); - if_assert_failed return false; - JS::RootedObject parent_doc(ctx, JS_GetParent(parent_form)); - assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); - if_assert_failed return false; - JS::RootedObject parent_win(ctx, JS_GetParent(parent_doc)); - assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); - if_assert_failed return false; +// JS::RootedObject parent_form(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); +// assert(JS_InstanceOf(ctx, parent_form, &form_class, NULL)); +// if_assert_failed return false; +// JS::RootedObject parent_doc(ctx, js::GetGlobalForObjectCrossCompartment(parent_form)); +// assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); +// if_assert_failed return false; +// JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(parent_doc)); +// assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); +// if_assert_failed return false; + JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); vs = JS_GetInstancePrivate(ctx, parent_win, &window_class, NULL); @@ -412,7 +421,7 @@ input_set_property_checked(JSContext *ctx, unsigned int argc, jsval *vp) } static bool -input_get_property_defaultChecked(JSContext *ctx, unsigned int argc, jsval *vp) +input_get_property_defaultChecked(JSContext *ctx, unsigned int argc, JS::Value *vp) { JS::CallArgs args = CallArgsFromVp(argc, vp); JS::RootedObject hobj(ctx, &args.thisv().toObject()); @@ -423,17 +432,18 @@ input_get_property_defaultChecked(JSContext *ctx, unsigned int argc, jsval *vp) struct form_state *fs; struct el_form_control *fc; - JS::RootedObject parent_form(ctx, JS_GetParent(hobj)); - assert(JS_InstanceOf(ctx, parent_form, &form_class, NULL)); - if_assert_failed return false; +// JS::RootedObject parent_form(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); +// assert(JS_InstanceOf(ctx, parent_form, &form_class, NULL)); +// if_assert_failed return false; - JS::RootedObject parent_doc(ctx, JS_GetParent(parent_form)); - assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); - if_assert_failed return false; +// JS::RootedObject parent_doc(ctx, js::GetGlobalForObjectCrossCompartment(parent_form)); +// assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); +// if_assert_failed return false; - JS::RootedObject parent_win(ctx, JS_GetParent(parent_doc)); - assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); - if_assert_failed return false; +// JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(parent_doc)); +// assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); +// if_assert_failed return false; + JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); vs = JS_GetInstancePrivate(ctx, parent_win, &window_class, NULL); @@ -455,7 +465,7 @@ input_get_property_defaultChecked(JSContext *ctx, unsigned int argc, jsval *vp) } static bool -input_get_property_defaultValue(JSContext *ctx, unsigned int argc, jsval *vp) +input_get_property_defaultValue(JSContext *ctx, unsigned int argc, JS::Value *vp) { JS::CallArgs args = CallArgsFromVp(argc, vp); JS::RootedObject hobj(ctx, &args.thisv().toObject()); @@ -466,17 +476,18 @@ input_get_property_defaultValue(JSContext *ctx, unsigned int argc, jsval *vp) struct form_state *fs; struct el_form_control *fc; - JS::RootedObject parent_form(ctx, JS_GetParent(hobj)); - assert(JS_InstanceOf(ctx, parent_form, &form_class, NULL)); - if_assert_failed return false; +// JS::RootedObject parent_form(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); +// assert(JS_InstanceOf(ctx, parent_form, &form_class, NULL)); +// if_assert_failed return false; - JS::RootedObject parent_doc(ctx, JS_GetParent(parent_form)); - assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); - if_assert_failed return false; +// JS::RootedObject parent_doc(ctx, js::GetGlobalForObjectCrossCompartment(parent_form)); +// assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); +// if_assert_failed return false; - JS::RootedObject parent_win(ctx, JS_GetParent(parent_doc)); - assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); - if_assert_failed return false; +// JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(parent_doc)); +// assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); +// if_assert_failed return false; + JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); vs = JS_GetInstancePrivate(ctx, parent_win, &window_class, NULL); @@ -499,7 +510,7 @@ input_get_property_defaultValue(JSContext *ctx, unsigned int argc, jsval *vp) } static bool -input_get_property_disabled(JSContext *ctx, unsigned int argc, jsval *vp) +input_get_property_disabled(JSContext *ctx, unsigned int argc, JS::Value *vp) { JS::CallArgs args = CallArgsFromVp(argc, vp); JS::RootedObject hobj(ctx, &args.thisv().toObject()); @@ -510,17 +521,18 @@ input_get_property_disabled(JSContext *ctx, unsigned int argc, jsval *vp) struct form_state *fs; struct el_form_control *fc; - JS::RootedObject parent_form(ctx, JS_GetParent(hobj)); - assert(JS_InstanceOf(ctx, parent_form, &form_class, NULL)); - if_assert_failed return false; +// JS::RootedObject parent_form(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); +// assert(JS_InstanceOf(ctx, parent_form, &form_class, NULL)); +// if_assert_failed return false; - JS::RootedObject parent_doc(ctx, JS_GetParent(parent_form)); - assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); - if_assert_failed return false; +// JS::RootedObject parent_doc(ctx, js::GetGlobalForObjectCrossCompartment(parent_form)); +// assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); +// if_assert_failed return false; - JS::RootedObject parent_win(ctx, JS_GetParent(parent_doc)); - assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); - if_assert_failed return false; +// JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(parent_doc)); +// assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); +// if_assert_failed return false; + JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); vs = JS_GetInstancePrivate(ctx, parent_win, &window_class, NULL); @@ -543,7 +555,7 @@ input_get_property_disabled(JSContext *ctx, unsigned int argc, jsval *vp) } static bool -input_set_property_disabled(JSContext *ctx, unsigned int argc, jsval *vp) +input_set_property_disabled(JSContext *ctx, unsigned int argc, JS::Value *vp) { JS::CallArgs args = CallArgsFromVp(argc, vp); JS::RootedObject hobj(ctx, &args.thisv().toObject()); @@ -554,15 +566,16 @@ input_set_property_disabled(JSContext *ctx, unsigned int argc, jsval *vp) struct form_state *fs; struct el_form_control *fc; - JS::RootedObject parent_form(ctx, JS_GetParent(hobj)); - assert(JS_InstanceOf(ctx, parent_form, &form_class, NULL)); - if_assert_failed return false; - JS::RootedObject parent_doc(ctx, JS_GetParent(parent_form)); - assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); - if_assert_failed return false; - JS::RootedObject parent_win(ctx, JS_GetParent(parent_doc)); - assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); - if_assert_failed return false; +// JS::RootedObject parent_form(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); +// assert(JS_InstanceOf(ctx, parent_form, &form_class, NULL)); +// if_assert_failed return false; +// JS::RootedObject parent_doc(ctx, js::GetGlobalForObjectCrossCompartment(parent_form)); +// assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); +// if_assert_failed return false; +// JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(parent_doc)); +// assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); +// if_assert_failed return false; + JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); vs = JS_GetInstancePrivate(ctx, parent_win, &window_class, NULL); @@ -587,12 +600,12 @@ input_set_property_disabled(JSContext *ctx, unsigned int argc, jsval *vp) } static bool -input_get_property_form(JSContext *ctx, unsigned int argc, jsval *vp) +input_get_property_form(JSContext *ctx, unsigned int argc, JS::Value *vp) { JS::CallArgs args = CallArgsFromVp(argc, vp); JS::RootedObject hobj(ctx, &args.thisv().toObject()); - JS::RootedObject parent_form(ctx, JS_GetParent(hobj)); + JS::RootedObject parent_form(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); assert(JS_InstanceOf(ctx, parent_form, &form_class, NULL)); if_assert_failed return false; @@ -602,7 +615,7 @@ input_get_property_form(JSContext *ctx, unsigned int argc, jsval *vp) } static bool -input_get_property_maxLength(JSContext *ctx, unsigned int argc, jsval *vp) +input_get_property_maxLength(JSContext *ctx, unsigned int argc, JS::Value *vp) { JS::CallArgs args = CallArgsFromVp(argc, vp); JS::RootedObject hobj(ctx, &args.thisv().toObject()); @@ -613,17 +626,18 @@ input_get_property_maxLength(JSContext *ctx, unsigned int argc, jsval *vp) struct form_state *fs; struct el_form_control *fc; - JS::RootedObject parent_form(ctx, JS_GetParent(hobj)); - assert(JS_InstanceOf(ctx, parent_form, &form_class, NULL)); - if_assert_failed return false; +// JS::RootedObject parent_form(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); +// assert(JS_InstanceOf(ctx, parent_form, &form_class, NULL)); +// if_assert_failed return false; - JS::RootedObject parent_doc(ctx, JS_GetParent(parent_form)); - assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); - if_assert_failed return false; +// JS::RootedObject parent_doc(ctx, js::GetGlobalForObjectCrossCompartment(parent_form)); +// assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); +// if_assert_failed return false; - JS::RootedObject parent_win(ctx, JS_GetParent(parent_doc)); - assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); - if_assert_failed return false; +// JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(parent_doc)); +// assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); +// if_assert_failed return false; + JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); vs = JS_GetInstancePrivate(ctx, parent_win, &window_class, NULL); @@ -645,7 +659,7 @@ input_get_property_maxLength(JSContext *ctx, unsigned int argc, jsval *vp) } static bool -input_set_property_maxLength(JSContext *ctx, unsigned int argc, jsval *vp) +input_set_property_maxLength(JSContext *ctx, unsigned int argc, JS::Value *vp) { JS::CallArgs args = CallArgsFromVp(argc, vp); JS::RootedObject hobj(ctx, &args.thisv().toObject()); @@ -656,15 +670,16 @@ input_set_property_maxLength(JSContext *ctx, unsigned int argc, jsval *vp) struct form_state *fs; struct el_form_control *fc; - JS::RootedObject parent_form(ctx, JS_GetParent(hobj)); - assert(JS_InstanceOf(ctx, parent_form, &form_class, NULL)); - if_assert_failed return false; - JS::RootedObject parent_doc(ctx, JS_GetParent(parent_form)); - assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); - if_assert_failed return false; - JS::RootedObject parent_win(ctx, JS_GetParent(parent_doc)); - assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); - if_assert_failed return false; +// JS::RootedObject parent_form(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); +// assert(JS_InstanceOf(ctx, parent_form, &form_class, NULL)); +// if_assert_failed return false; +// JS::RootedObject parent_doc(ctx, js::GetGlobalForObjectCrossCompartment(parent_form)); +// assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); +// if_assert_failed return false; +// JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(parent_doc)); +// assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); +// if_assert_failed return false; + JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); vs = JS_GetInstancePrivate(ctx, parent_win, &window_class, NULL); @@ -686,7 +701,7 @@ input_set_property_maxLength(JSContext *ctx, unsigned int argc, jsval *vp) } static bool -input_get_property_name(JSContext *ctx, unsigned int argc, jsval *vp) +input_get_property_name(JSContext *ctx, unsigned int argc, JS::Value *vp) { JS::CallArgs args = CallArgsFromVp(argc, vp); JS::RootedObject hobj(ctx, &args.thisv().toObject()); @@ -697,17 +712,18 @@ input_get_property_name(JSContext *ctx, unsigned int argc, jsval *vp) struct form_state *fs; struct el_form_control *fc; - JS::RootedObject parent_form(ctx, JS_GetParent(hobj)); - assert(JS_InstanceOf(ctx, parent_form, &form_class, NULL)); - if_assert_failed return false; +// JS::RootedObject parent_form(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); +// assert(JS_InstanceOf(ctx, parent_form, &form_class, NULL)); +// if_assert_failed return false; - JS::RootedObject parent_doc(ctx, JS_GetParent(parent_form)); - assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); - if_assert_failed return false; +// JS::RootedObject parent_doc(ctx, js::GetGlobalForObjectCrossCompartment(parent_form)); +// assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); +// if_assert_failed return false; - JS::RootedObject parent_win(ctx, JS_GetParent(parent_doc)); - assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); - if_assert_failed return false; +// JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(parent_doc)); +// assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); +// if_assert_failed return false; + JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); vs = JS_GetInstancePrivate(ctx, parent_win, &window_class, NULL); @@ -730,7 +746,7 @@ input_get_property_name(JSContext *ctx, unsigned int argc, jsval *vp) /* @input_class.setProperty */ static bool -input_set_property_name(JSContext *ctx, unsigned int argc, jsval *vp) +input_set_property_name(JSContext *ctx, unsigned int argc, JS::Value *vp) { JS::CallArgs args = CallArgsFromVp(argc, vp); JS::RootedObject hobj(ctx, &args.thisv().toObject()); @@ -747,15 +763,16 @@ input_set_property_name(JSContext *ctx, unsigned int argc, jsval *vp) if (!JS_InstanceOf(ctx, hobj, &input_class, NULL)) return false; - JS::RootedObject parent_form(ctx, JS_GetParent(hobj)); - assert(JS_InstanceOf(ctx, parent_form, &form_class, NULL)); - if_assert_failed return false; - JS::RootedObject parent_doc(ctx, JS_GetParent(parent_form)); - assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); - if_assert_failed return false; - JS::RootedObject parent_win(ctx, JS_GetParent(parent_doc)); - assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); - if_assert_failed return false; +// JS::RootedObject parent_form(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); +// assert(JS_InstanceOf(ctx, parent_form, &form_class, NULL)); +// if_assert_failed return false; +// JS::RootedObject parent_doc(ctx, js::GetGlobalForObjectCrossCompartment(parent_form)); +// assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); +// if_assert_failed return false; +// JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(parent_doc)); +// assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); +// if_assert_failed return false; + JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); vs = JS_GetInstancePrivate(ctx, parent_win, &window_class, NULL); @@ -777,7 +794,7 @@ input_set_property_name(JSContext *ctx, unsigned int argc, jsval *vp) } static bool -input_get_property_readonly(JSContext *ctx, unsigned int argc, jsval *vp) +input_get_property_readonly(JSContext *ctx, unsigned int argc, JS::Value *vp) { JS::CallArgs args = CallArgsFromVp(argc, vp); JS::RootedObject hobj(ctx, &args.thisv().toObject()); @@ -794,17 +811,18 @@ input_get_property_readonly(JSContext *ctx, unsigned int argc, jsval *vp) if (!JS_InstanceOf(ctx, hobj, &input_class, NULL)) return false; - JS::RootedObject parent_form(ctx, JS_GetParent(hobj)); - assert(JS_InstanceOf(ctx, parent_form, &form_class, NULL)); - if_assert_failed return false; +// JS::RootedObject parent_form(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); +// assert(JS_InstanceOf(ctx, parent_form, &form_class, NULL)); +// if_assert_failed return false; - JS::RootedObject parent_doc(ctx, JS_GetParent(parent_form)); - assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); - if_assert_failed return false; +// JS::RootedObject parent_doc(ctx, js::GetGlobalForObjectCrossCompartment(parent_form)); +// assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); +// if_assert_failed return false; - JS::RootedObject parent_win(ctx, JS_GetParent(parent_doc)); - assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); - if_assert_failed return false; +// JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(parent_doc)); +// assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); +// if_assert_failed return false; + JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); vs = JS_GetInstancePrivate(ctx, parent_win, &window_class, NULL); @@ -828,7 +846,7 @@ input_get_property_readonly(JSContext *ctx, unsigned int argc, jsval *vp) /* @input_class.setProperty */ static bool -input_set_property_readonly(JSContext *ctx, unsigned int argc, jsval *vp) +input_set_property_readonly(JSContext *ctx, unsigned int argc, JS::Value *vp) { JS::CallArgs args = CallArgsFromVp(argc, vp); JS::RootedObject hobj(ctx, &args.thisv().toObject()); @@ -844,15 +862,16 @@ input_set_property_readonly(JSContext *ctx, unsigned int argc, jsval *vp) * such calls. */ if (!JS_InstanceOf(ctx, hobj, &input_class, NULL)) return false; - JS::RootedObject parent_form(ctx, JS_GetParent(hobj)); - assert(JS_InstanceOf(ctx, parent_form, &form_class, NULL)); - if_assert_failed return false; - JS::RootedObject parent_doc(ctx, JS_GetParent(parent_form)); - assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); - if_assert_failed return false; - JS::RootedObject parent_win(ctx, JS_GetParent(parent_doc)); - assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); - if_assert_failed return false; +// JS::RootedObject parent_form(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); +// assert(JS_InstanceOf(ctx, parent_form, &form_class, NULL)); +// if_assert_failed return false; +// JS::RootedObject parent_doc(ctx, js::GetGlobalForObjectCrossCompartment(parent_form)); +// assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); +// if_assert_failed return false; +// JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(parent_doc)); +// assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); +// if_assert_failed return false; + JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); vs = JS_GetInstancePrivate(ctx, parent_win, &window_class, NULL); @@ -877,7 +896,7 @@ input_set_property_readonly(JSContext *ctx, unsigned int argc, jsval *vp) } static bool -input_get_property_selectedIndex(JSContext *ctx, unsigned int argc, jsval *vp) +input_get_property_selectedIndex(JSContext *ctx, unsigned int argc, JS::Value *vp) { JS::CallArgs args = CallArgsFromVp(argc, vp); JS::RootedObject hobj(ctx, &args.thisv().toObject()); @@ -894,17 +913,18 @@ input_get_property_selectedIndex(JSContext *ctx, unsigned int argc, jsval *vp) if (!JS_InstanceOf(ctx, hobj, &input_class, NULL)) return false; - JS::RootedObject parent_form(ctx, JS_GetParent(hobj)); - assert(JS_InstanceOf(ctx, parent_form, &form_class, NULL)); - if_assert_failed return false; +// JS::RootedObject parent_form(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); +// assert(JS_InstanceOf(ctx, parent_form, &form_class, NULL)); +// if_assert_failed return false; - JS::RootedObject parent_doc(ctx, JS_GetParent(parent_form)); - assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); - if_assert_failed return false; +// JS::RootedObject parent_doc(ctx, js::GetGlobalForObjectCrossCompartment(parent_form)); +// assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); +// if_assert_failed return false; - JS::RootedObject parent_win(ctx, JS_GetParent(parent_doc)); - assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); - if_assert_failed return false; +// JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(parent_doc)); +// assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); +// if_assert_failed return false; + JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); vs = JS_GetInstancePrivate(ctx, parent_win, &window_class, NULL); @@ -932,7 +952,7 @@ input_get_property_selectedIndex(JSContext *ctx, unsigned int argc, jsval *vp) /* @input_class.setProperty */ static bool -input_set_property_selectedIndex(JSContext *ctx, unsigned int argc, jsval *vp) +input_set_property_selectedIndex(JSContext *ctx, unsigned int argc, JS::Value *vp) { JS::CallArgs args = CallArgsFromVp(argc, vp); JS::RootedObject hobj(ctx, &args.thisv().toObject()); @@ -948,15 +968,16 @@ input_set_property_selectedIndex(JSContext *ctx, unsigned int argc, jsval *vp) * such calls. */ if (!JS_InstanceOf(ctx, hobj, &input_class, NULL)) return false; - JS::RootedObject parent_form(ctx, JS_GetParent(hobj)); - assert(JS_InstanceOf(ctx, parent_form, &form_class, NULL)); - if_assert_failed return false; - JS::RootedObject parent_doc(ctx, JS_GetParent(parent_form)); - assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); - if_assert_failed return false; - JS::RootedObject parent_win(ctx, JS_GetParent(parent_doc)); - assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); - if_assert_failed return false; +// JS::RootedObject parent_form(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); +// assert(JS_InstanceOf(ctx, parent_form, &form_class, NULL)); +// if_assert_failed return false; +// JS::RootedObject parent_doc(ctx, js::GetGlobalForObjectCrossCompartment(parent_form)); +// assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); +// if_assert_failed return false; +// JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(parent_doc)); +// assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); +// if_assert_failed return false; + JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); vs = JS_GetInstancePrivate(ctx, parent_win, &window_class, NULL); @@ -985,7 +1006,7 @@ input_set_property_selectedIndex(JSContext *ctx, unsigned int argc, jsval *vp) } static bool -input_get_property_size(JSContext *ctx, unsigned int argc, jsval *vp) +input_get_property_size(JSContext *ctx, unsigned int argc, JS::Value *vp) { JS::CallArgs args = CallArgsFromVp(argc, vp); JS::RootedObject hobj(ctx, &args.thisv().toObject()); @@ -1002,17 +1023,18 @@ input_get_property_size(JSContext *ctx, unsigned int argc, jsval *vp) if (!JS_InstanceOf(ctx, hobj, &input_class, NULL)) return false; - JS::RootedObject parent_form(ctx, JS_GetParent(hobj)); - assert(JS_InstanceOf(ctx, parent_form, &form_class, NULL)); - if_assert_failed return false; +// JS::RootedObject parent_form(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); +// assert(JS_InstanceOf(ctx, parent_form, &form_class, NULL)); +// if_assert_failed return false; - JS::RootedObject parent_doc(ctx, JS_GetParent(parent_form)); - assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); - if_assert_failed return false; +// JS::RootedObject parent_doc(ctx, js::GetGlobalForObjectCrossCompartment(parent_form)); +// assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); +// if_assert_failed return false; - JS::RootedObject parent_win(ctx, JS_GetParent(parent_doc)); - assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); - if_assert_failed return false; +// JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(parent_doc)); +// assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); +// if_assert_failed return false; + JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); vs = JS_GetInstancePrivate(ctx, parent_win, &window_class, NULL); @@ -1034,7 +1056,7 @@ input_get_property_size(JSContext *ctx, unsigned int argc, jsval *vp) } static bool -input_get_property_src(JSContext *ctx, unsigned int argc, jsval *vp) +input_get_property_src(JSContext *ctx, unsigned int argc, JS::Value *vp) { JS::CallArgs args = CallArgsFromVp(argc, vp); JS::RootedObject hobj(ctx, &args.thisv().toObject()); @@ -1053,17 +1075,18 @@ input_get_property_src(JSContext *ctx, unsigned int argc, jsval *vp) if (!JS_InstanceOf(ctx, hobj, &input_class, NULL)) return false; - JS::RootedObject parent_form(ctx, JS_GetParent(hobj)); - assert(JS_InstanceOf(ctx, parent_form, &form_class, NULL)); - if_assert_failed return false; +// JS::RootedObject parent_form(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); +// assert(JS_InstanceOf(ctx, parent_form, &form_class, NULL)); +// if_assert_failed return false; - JS::RootedObject parent_doc(ctx, JS_GetParent(parent_form)); - assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); - if_assert_failed return false; +// JS::RootedObject parent_doc(ctx, js::GetGlobalForObjectCrossCompartment(parent_form)); +// assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); +// if_assert_failed return false; - JS::RootedObject parent_win(ctx, JS_GetParent(parent_doc)); - assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); - if_assert_failed return false; +// JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(parent_doc)); +// assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); +// if_assert_failed return false; + JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); vs = JS_GetInstancePrivate(ctx, parent_win, &window_class, NULL); @@ -1092,7 +1115,7 @@ input_get_property_src(JSContext *ctx, unsigned int argc, jsval *vp) } static bool -input_set_property_src(JSContext *ctx, unsigned int argc, jsval *vp) +input_set_property_src(JSContext *ctx, unsigned int argc, JS::Value *vp) { JS::CallArgs args = CallArgsFromVp(argc, vp); JS::RootedObject hobj(ctx, &args.thisv().toObject()); @@ -1111,17 +1134,18 @@ input_set_property_src(JSContext *ctx, unsigned int argc, jsval *vp) if (!JS_InstanceOf(ctx, hobj, &input_class, NULL)) return false; - JS::RootedObject parent_form(ctx, JS_GetParent(hobj)); - assert(JS_InstanceOf(ctx, parent_form, &form_class, NULL)); - if_assert_failed return false; +// JS::RootedObject parent_form(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); +// assert(JS_InstanceOf(ctx, parent_form, &form_class, NULL)); +// if_assert_failed return false; - JS::RootedObject parent_doc(ctx, JS_GetParent(parent_form)); - assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); - if_assert_failed return false; +// JS::RootedObject parent_doc(ctx, js::GetGlobalForObjectCrossCompartment(parent_form)); +// assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); +// if_assert_failed return false; - JS::RootedObject parent_win(ctx, JS_GetParent(parent_doc)); - assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); - if_assert_failed return false; +// JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(parent_doc)); +// assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); +// if_assert_failed return false; + JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); vs = JS_GetInstancePrivate(ctx, parent_win, &window_class, NULL); @@ -1149,7 +1173,7 @@ input_set_property_src(JSContext *ctx, unsigned int argc, jsval *vp) } static bool -input_get_property_tabIndex(JSContext *ctx, unsigned int argc, jsval *vp) +input_get_property_tabIndex(JSContext *ctx, unsigned int argc, JS::Value *vp) { JS::CallArgs args = CallArgsFromVp(argc, vp); JS::RootedObject hobj(ctx, &args.thisv().toObject()); @@ -1168,17 +1192,18 @@ input_get_property_tabIndex(JSContext *ctx, unsigned int argc, jsval *vp) if (!JS_InstanceOf(ctx, hobj, &input_class, NULL)) return false; - JS::RootedObject parent_form(ctx, JS_GetParent(hobj)); - assert(JS_InstanceOf(ctx, parent_form, &form_class, NULL)); - if_assert_failed return false; +// JS::RootedObject parent_form(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); +// assert(JS_InstanceOf(ctx, parent_form, &form_class, NULL)); +// if_assert_failed return false; - JS::RootedObject parent_doc(ctx, JS_GetParent(parent_form)); - assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); - if_assert_failed return false; +// JS::RootedObject parent_doc(ctx, js::GetGlobalForObjectCrossCompartment(parent_form)); +// assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); +// if_assert_failed return false; - JS::RootedObject parent_win(ctx, JS_GetParent(parent_doc)); - assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); - if_assert_failed return false; +// JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(parent_doc)); +// assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); +// if_assert_failed return false; + JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); vs = JS_GetInstancePrivate(ctx, parent_win, &window_class, NULL); @@ -1209,7 +1234,7 @@ input_get_property_tabIndex(JSContext *ctx, unsigned int argc, jsval *vp) } static bool -input_get_property_type(JSContext *ctx, unsigned int argc, jsval *vp) +input_get_property_type(JSContext *ctx, unsigned int argc, JS::Value *vp) { JS::CallArgs args = CallArgsFromVp(argc, vp); JS::RootedObject hobj(ctx, &args.thisv().toObject()); @@ -1227,17 +1252,18 @@ input_get_property_type(JSContext *ctx, unsigned int argc, jsval *vp) if (!JS_InstanceOf(ctx, hobj, &input_class, NULL)) return false; - JS::RootedObject parent_form(ctx, JS_GetParent(hobj)); - assert(JS_InstanceOf(ctx, parent_form, &form_class, NULL)); - if_assert_failed return false; +// JS::RootedObject parent_form(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); +// assert(JS_InstanceOf(ctx, parent_form, &form_class, NULL)); +// if_assert_failed return false; - JS::RootedObject parent_doc(ctx, JS_GetParent(parent_form)); - assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); - if_assert_failed return false; +// JS::RootedObject parent_doc(ctx, js::GetGlobalForObjectCrossCompartment(parent_form)); +// assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); +// if_assert_failed return false; - JS::RootedObject parent_win(ctx, JS_GetParent(parent_doc)); - assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); - if_assert_failed return false; +// JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(parent_doc)); +// assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); +// if_assert_failed return false; + JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); vs = JS_GetInstancePrivate(ctx, parent_win, &window_class, NULL); @@ -1273,7 +1299,7 @@ input_get_property_type(JSContext *ctx, unsigned int argc, jsval *vp) } static bool -input_get_property_value(JSContext *ctx, unsigned int argc, jsval *vp) +input_get_property_value(JSContext *ctx, unsigned int argc, JS::Value *vp) { JS::CallArgs args = CallArgsFromVp(argc, vp); JS::RootedObject hobj(ctx, &args.thisv().toObject()); @@ -1294,7 +1320,7 @@ input_get_property_value(JSContext *ctx, unsigned int argc, jsval *vp) } static bool -input_set_property_value(JSContext *ctx, unsigned int argc, jsval *vp) +input_set_property_value(JSContext *ctx, unsigned int argc, JS::Value *vp) { JS::CallArgs args = CallArgsFromVp(argc, vp); JS::RootedObject hobj(ctx, &args.thisv().toObject()); @@ -1311,17 +1337,18 @@ input_set_property_value(JSContext *ctx, unsigned int argc, jsval *vp) if (!JS_InstanceOf(ctx, hobj, &input_class, NULL)) return false; - JS::RootedObject parent_form(ctx, JS_GetParent(hobj)); - assert(JS_InstanceOf(ctx, parent_form, &form_class, NULL)); - if_assert_failed return false; +// JS::RootedObject parent_form(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); +// assert(JS_InstanceOf(ctx, parent_form, &form_class, NULL)); +// if_assert_failed return false; - JS::RootedObject parent_doc(ctx, JS_GetParent(parent_form)); - assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); - if_assert_failed return false; +// JS::RootedObject parent_doc(ctx, js::GetGlobalForObjectCrossCompartment(parent_form)); +// assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); +// if_assert_failed return false; - JS::RootedObject parent_win(ctx, JS_GetParent(parent_doc)); - assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); - if_assert_failed return false; +// JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(parent_doc)); +// assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); +// if_assert_failed return false; + JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); vs = JS_GetInstancePrivate(ctx, parent_win, &window_class, NULL); @@ -1371,10 +1398,10 @@ static JSPropertySpec input_props[] = { { NULL } }; -static bool input_blur(JSContext *ctx, unsigned int argc, jsval *rval); -static bool input_click(JSContext *ctx, unsigned int argc, jsval *rval); -static bool input_focus(JSContext *ctx, unsigned int argc, jsval *rval); -static bool input_select(JSContext *ctx, unsigned int argc, jsval *rval); +static bool input_blur(JSContext *ctx, unsigned int argc, JS::Value *rval); +static bool input_click(JSContext *ctx, unsigned int argc, JS::Value *rval); +static bool input_focus(JSContext *ctx, unsigned int argc, JS::Value *rval); +static bool input_select(JSContext *ctx, unsigned int argc, JS::Value *rval); static const spidermonkeyFunctionSpec input_funcs[] = { { "blur", input_blur, 0 }, @@ -1409,7 +1436,6 @@ input_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS:: JS::RootedObject parent_form(ctx); /* instance of @form_class */ JS::RootedObject parent_doc(ctx); /* instance of @document_class */ - JS::RootedObject parent_win(ctx); /* instance of @window_class */ struct view_state *vs; struct document_view *doc_view; struct document *document; @@ -1424,17 +1450,18 @@ input_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS:: if (!JS_InstanceOf(ctx, hobj, &input_class, NULL)) return false; - parent_form = JS_GetParent(obj); - assert(JS_InstanceOf(ctx, parent_form, &form_class, NULL)); - if_assert_failed return false; +// parent_form = js::GetGlobalForObjectCrossCompartment(obj); +// assert(JS_InstanceOf(ctx, parent_form, &form_class, NULL)); +// if_assert_failed return false; - parent_doc = JS_GetParent(parent_form); - assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); - if_assert_failed return false; +// parent_doc = js::GetGlobalForObjectCrossCompartment(parent_form); +// assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); +// if_assert_failed return false; - parent_win = JS_GetParent(parent_doc); - assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); - if_assert_failed return false; +// parent_win = js::GetGlobalForObjectCrossCompartment(parent_doc); +// assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); +// if_assert_failed return false; + JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); vs = JS_GetInstancePrivate(ctx, parent_win, &window_class, NULL); @@ -1468,7 +1495,7 @@ input_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS:: } else { keystr = unicode_to_jsstring(ctx, link->accesskey); if (keystr) - *vp = STRING_TO_JSVAL(keystr); + *vp = JS::StringValue(keystr); else return false; } @@ -1559,14 +1586,13 @@ input_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS:: /* @input_class.setProperty */ static bool -input_set_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, bool strict, JS::MutableHandleValue hvp) +input_set_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS jsid id = hid.get(); JS::RootedObject parent_form(ctx); /* instance of @form_class */ JS::RootedObject parent_doc(ctx); /* instance of @document_class */ - JS::RootedObject parent_win(ctx); /* instance of @window_class */ struct view_state *vs; struct document_view *doc_view; struct document *document; @@ -1581,15 +1607,16 @@ input_set_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, bool * such calls. */ if (!JS_InstanceOf(ctx, hobj, &input_class, NULL)) return false; - parent_form = JS_GetParent(obj); - assert(JS_InstanceOf(ctx, parent_form, &form_class, NULL)); - if_assert_failed return false; - parent_doc = JS_GetParent(parent_form); - assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); - if_assert_failed return false; - parent_win = JS_GetParent(parent_doc); - assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); - if_assert_failed return false; +// parent_form = js::GetGlobalForObjectCrossCompartment(obj); +// assert(JS_InstanceOf(ctx, parent_form, &form_class, NULL)); +// if_assert_failed return false; +// parent_doc = js::GetGlobalForObjectCrossCompartment(parent_form); +// assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); +// if_assert_failed return false; +// parent_win = js::GetGlobalForObjectCrossCompartment(parent_doc); +// assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); +// if_assert_failed return false; + JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); vs = JS_GetInstancePrivate(ctx, parent_win, &window_class, NULL); @@ -1679,7 +1706,7 @@ input_set_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, bool /* @input_funcs{"blur"} */ static bool -input_blur(JSContext *ctx, unsigned int argc, jsval *rval) +input_blur(JSContext *ctx, unsigned int argc, JS::Value *rval) { /* We are a text-mode browser and there *always* has to be something * selected. So we do nothing for now. (That was easy.) */ @@ -1688,12 +1715,11 @@ input_blur(JSContext *ctx, unsigned int argc, jsval *rval) /* @input_funcs{"click"} */ static bool -input_click(JSContext *ctx, unsigned int argc, jsval *rval) +input_click(JSContext *ctx, unsigned int argc, JS::Value *rval) { - jsval val; + JS::Value val; JS::RootedObject parent_form(ctx); /* instance of @form_class */ JS::RootedObject parent_doc(ctx); /* instance of @document_class */ - JS::RootedObject parent_win(ctx); /* instance of @window_class */ JS::RootedObject hobj(ctx, JS_THIS_OBJECT(ctx, rval)); JS::CallArgs args = JS::CallArgsFromVp(argc, rval); struct view_state *vs; @@ -1705,15 +1731,16 @@ input_click(JSContext *ctx, unsigned int argc, jsval *rval) int linknum; if (!JS_InstanceOf(ctx, hobj, &input_class, &args)) return false; - parent_form = JS_GetParent(hobj); - assert(JS_InstanceOf(ctx, parent_form, &form_class, NULL)); - if_assert_failed return false; - parent_doc = JS_GetParent(parent_form); - assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); - if_assert_failed return false; - parent_win = JS_GetParent(parent_doc); - assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); - if_assert_failed return false; +// parent_form = js::GetGlobalForObjectCrossCompartment(hobj); +// assert(JS_InstanceOf(ctx, parent_form, &form_class, NULL)); +// if_assert_failed return false; +// parent_doc = js::GetGlobalForObjectCrossCompartment(parent_form); +// assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); +// if_assert_failed return false; +// parent_win = js::GetGlobalForObjectCrossCompartment(parent_doc); +// assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); +// if_assert_failed return false; + JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); vs = JS_GetInstancePrivate(ctx, parent_win, &window_class, NULL); @@ -1746,13 +1773,12 @@ input_click(JSContext *ctx, unsigned int argc, jsval *rval) /* @input_funcs{"focus"} */ static bool -input_focus(JSContext *ctx, unsigned int argc, jsval *rval) +input_focus(JSContext *ctx, unsigned int argc, JS::Value *rval) { - jsval val; + JS::Value val; JS::RootedObject parent_form(ctx); /* instance of @form_class */ JS::RootedObject parent_doc(ctx); /* instance of @document_class */ - JS::RootedObject parent_win(ctx); /* instance of @window_class */ - JS::RootedObject obj(ctx, JS_THIS_OBJECT(ctx, rval)); + JS::RootedObject hobj(ctx, JS_THIS_OBJECT(ctx, rval)); JS::CallArgs args = JS::CallArgsFromVp(argc, rval); struct view_state *vs; struct document_view *doc_view; @@ -1762,23 +1788,24 @@ input_focus(JSContext *ctx, unsigned int argc, jsval *rval) struct el_form_control *fc; int linknum; - if (!JS_InstanceOf(ctx, obj, &input_class, &args)) return false; - parent_form = JS_GetParent(obj); - assert(JS_InstanceOf(ctx, parent_form, &form_class, NULL)); - if_assert_failed return false; - parent_doc = JS_GetParent(parent_form); - assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); - if_assert_failed return false; - parent_win = JS_GetParent(parent_doc); - assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); - if_assert_failed return false; + if (!JS_InstanceOf(ctx, hobj, &input_class, &args)) return false; +// parent_form = js::GetGlobalForObjectCrossCompartment(obj); +// assert(JS_InstanceOf(ctx, parent_form, &form_class, NULL)); +// if_assert_failed return false; +// parent_doc = js::GetGlobalForObjectCrossCompartment(parent_form); +// assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); +// if_assert_failed return false; +// parent_win = js::GetGlobalForObjectCrossCompartment(parent_doc); +// assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); +// if_assert_failed return false; + JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); vs = JS_GetInstancePrivate(ctx, parent_win, &window_class, NULL); doc_view = vs->doc_view; document = doc_view->document; ses = doc_view->session; - fs = input_get_form_state(ctx, obj); + fs = input_get_form_state(ctx, hobj); if (!fs) return false; /* detached */ assert(fs); @@ -1798,7 +1825,7 @@ input_focus(JSContext *ctx, unsigned int argc, jsval *rval) /* @input_funcs{"select"} */ static bool -input_select(JSContext *ctx, unsigned int argc, jsval *rval) +input_select(JSContext *ctx, unsigned int argc, JS::Value *rval) { /* We support no text selecting yet. So we do nothing for now. * (That was easy, too.) */ @@ -1806,7 +1833,7 @@ input_select(JSContext *ctx, unsigned int argc, jsval *rval) } static JSObject * -get_input_object(JSContext *ctx, JSObject *jsform, struct form_state *fs) +get_input_object(JSContext *ctx, struct form_state *fs) { JSObject *jsinput = fs->ecmascript_obj; @@ -1821,11 +1848,10 @@ get_input_object(JSContext *ctx, JSObject *jsform, struct form_state *fs) return jsinput; } - JS::RootedObject r_jsform(ctx, jsform); /* jsform ('form') is input's parent */ /* FIXME: That is NOT correct since the real containing element * should be its parent, but gimme DOM first. --pasky */ - jsinput = JS_NewObject(ctx, &input_class, r_jsform); + jsinput = JS_NewObject(ctx, &input_class); if (!jsinput) return NULL; @@ -1900,7 +1926,7 @@ spidermonkey_moved_form_state(struct form_state *fs) static JSObject * -get_form_control_object(JSContext *ctx, JSObject *jsform, +get_form_control_object(JSContext *ctx, enum form_type type, struct form_state *fs) { switch (type) { @@ -1915,7 +1941,7 @@ get_form_control_object(JSContext *ctx, JSObject *jsform, case FC_BUTTON: case FC_HIDDEN: case FC_SELECT: - return get_input_object(ctx, jsform, fs); + return get_input_object(ctx, fs); case FC_TEXTAREA: /* TODO */ @@ -1928,7 +1954,7 @@ get_form_control_object(JSContext *ctx, JSObject *jsform, } -static struct form_view *form_get_form_view(JSContext *ctx, JSObject *jsform, jsval *argv); +static struct form_view *form_get_form_view(JSContext *ctx, JSObject *jsform, JS::Value *argv); static bool form_elements_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); /* Each @form_elements_class object must have a @form_class parent. */ @@ -1942,8 +1968,8 @@ static JSClass form_elements_class = { static bool form_elements_item2(JSContext *ctx, JS::HandleObject hobj, int index, JS::MutableHandleValue hvp); static bool form_elements_namedItem2(JSContext *ctx, JS::HandleObject hobj, unsigned char *string, JS::MutableHandleValue hvp); -static bool form_elements_item(JSContext *ctx, unsigned int argc, jsval *rval); -static bool form_elements_namedItem(JSContext *ctx, unsigned int argc, jsval *rval); +static bool form_elements_item(JSContext *ctx, unsigned int argc, JS::Value *rval); +static bool form_elements_namedItem(JSContext *ctx, unsigned int argc, JS::Value *rval); static const spidermonkeyFunctionSpec form_elements_funcs[] = { @@ -1952,7 +1978,7 @@ static const spidermonkeyFunctionSpec form_elements_funcs[] = { { NULL } }; -static bool form_elements_get_property_length(JSContext *ctx, unsigned int argc, jsval *vp); +static bool form_elements_get_property_length(JSContext *ctx, unsigned int argc, JS::Value *vp); /* Tinyids of properties. Use negative values to distinguish these * from array indexes (elements[INT] for INT>=0 is equivalent to @@ -1971,10 +1997,9 @@ form_elements_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId h { jsid id = hid.get(); - jsval idval; - JS::RootedObject parent_form(ctx); /* instance of @form_class */ - JS::RootedObject parent_doc(ctx); /* instance of @document_class */ - JS::RootedObject parent_win(ctx); /* instance of @window_class */ + JS::Value idval; +// JS::RootedObject parent_form(ctx); /* instance of @form_class */ +// JS::RootedObject parent_doc(ctx); /* instance of @document_class */ struct view_state *vs; struct document_view *doc_view; struct document *document; @@ -1988,21 +2013,15 @@ form_elements_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId h if (!JS_InstanceOf(ctx, hobj, &form_elements_class, NULL)) { return false; } - parent_form = JS_GetParent(hobj); - assert(JS_InstanceOf(ctx, parent_form, &form_class, NULL)); - if_assert_failed return false; - parent_doc = JS_GetParent(parent_form); - assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); - if_assert_failed return false; - parent_win = JS_GetParent(parent_doc); - assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); - if_assert_failed return false; + JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); vs = JS_GetInstancePrivate(ctx, parent_win, &window_class, NULL); doc_view = vs->doc_view; document = doc_view->document; - form_view = form_get_form_view(ctx, parent_form, NULL); + + form_view = JS_GetInstancePrivate(ctx, hobj, &form_elements_class, nullptr); +// form_view = form_get_form_view(ctx, nullptr, /*parent_form*/ NULL); if (!form_view) return false; /* detached */ form = find_form_by_form_view(document, form_view); @@ -2010,6 +2029,7 @@ form_elements_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId h JS::RootedValue r_idval(ctx, idval); JS_IdToValue(ctx, id, &r_idval); unsigned char *string = JS_EncodeString(ctx, r_idval.toString()); + form_elements_namedItem2(ctx, hobj, string, hvp); return true; } @@ -2038,7 +2058,7 @@ form_elements_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId h } static bool -form_elements_get_property_length(JSContext *ctx, unsigned int argc, jsval *vp) +form_elements_get_property_length(JSContext *ctx, unsigned int argc, JS::Value *vp) { JS::CallArgs args = CallArgsFromVp(argc, vp); JS::RootedObject hobj(ctx, &args.thisv().toObject()); @@ -2049,18 +2069,7 @@ form_elements_get_property_length(JSContext *ctx, unsigned int argc, jsval *vp) struct form_view *form_view; struct form *form; - JS::RootedObject parent_form(ctx, JS_GetParent(hobj)); - - assert(JS_InstanceOf(ctx, parent_form, &form_class, NULL)); - if_assert_failed return false; - - JS::RootedObject parent_doc(ctx, JS_GetParent(parent_form)); - assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); - if_assert_failed return false; - - JS::RootedObject parent_win(ctx, JS_GetParent(parent_doc)); - assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); - if_assert_failed return false; + JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); vs = JS_GetInstancePrivate(ctx, parent_win, &window_class, NULL); @@ -2068,9 +2077,11 @@ form_elements_get_property_length(JSContext *ctx, unsigned int argc, jsval *vp) if (!vs) { return false; } + doc_view = vs->doc_view; document = doc_view->document; - form_view = form_get_form_view(ctx, parent_form, NULL); + form_view = JS_GetInstancePrivate(ctx, hobj, &form_elements_class, nullptr); +// form_view = form_get_form_view(ctx, nullptr, /*parent_form*/ NULL); if (!form_view) return false; /* detached */ form = find_form_by_form_view(document, form_view); @@ -2082,9 +2093,9 @@ form_elements_get_property_length(JSContext *ctx, unsigned int argc, jsval *vp) /* @form_elements_funcs{"item"} */ static bool -form_elements_item(JSContext *ctx, unsigned int argc, jsval *vp) +form_elements_item(JSContext *ctx, unsigned int argc, JS::Value *vp) { - jsval val = JSVAL_VOID; + JS::Value val; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); JS::RootedObject hobj(ctx, &args.thisv().toObject()); JS::RootedValue rval(ctx, val); @@ -2092,7 +2103,7 @@ form_elements_item(JSContext *ctx, unsigned int argc, jsval *vp) int index = args[0].toInt32(); bool ret = form_elements_item2(ctx, hobj, index, &rval); - args.rval().set(rval.get()); + args.rval().set(rval); return ret; } @@ -2102,7 +2113,6 @@ form_elements_item2(JSContext *ctx, JS::HandleObject hobj, int index, JS::Mutabl { JS::RootedObject parent_form(ctx); /* instance of @form_class */ JS::RootedObject parent_doc(ctx); /* instance of @document_class */ - JS::RootedObject parent_win(ctx); /* instance of @window_class */ struct view_state *vs; struct document_view *doc_view; struct document *document; @@ -2112,21 +2122,17 @@ form_elements_item2(JSContext *ctx, JS::HandleObject hobj, int index, JS::Mutabl int counter = -1; if (!JS_InstanceOf(ctx, hobj, &form_elements_class, NULL)) return false; - parent_form = JS_GetParent(hobj); - assert(JS_InstanceOf(ctx, parent_form, &form_class, NULL)); - if_assert_failed return false; - parent_doc = JS_GetParent(parent_form); - assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); - if_assert_failed return false; - parent_win = JS_GetParent(parent_doc); - assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); - if_assert_failed return false; + JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); vs = JS_GetInstancePrivate(ctx, parent_win, &window_class, NULL); doc_view = vs->doc_view; document = doc_view->document; - form_view = form_get_form_view(ctx, parent_form, NULL); + + form_view = JS_GetInstancePrivate(ctx, hobj, &form_elements_class, nullptr); + +// form_view = form_get_form_view(ctx, nullptr/*parent_form*/, NULL); + if (!form_view) return false; /* detached */ form = find_form_by_form_view(document, form_view); @@ -2138,7 +2144,7 @@ form_elements_item2(JSContext *ctx, JS::HandleObject hobj, int index, JS::Mutabl struct form_state *fs = find_form_state(doc_view, fc); if (fs) { - JSObject *fcobj = get_form_control_object(ctx, parent_form, fc->type, fs); + JSObject *fcobj = get_form_control_object(ctx, fc->type, fs); if (fcobj) { hvp.setObject(*fcobj); @@ -2153,15 +2159,15 @@ form_elements_item2(JSContext *ctx, JS::HandleObject hobj, int index, JS::Mutabl /* @form_elements_funcs{"namedItem"} */ static bool -form_elements_namedItem(JSContext *ctx, unsigned int argc, jsval *vp) +form_elements_namedItem(JSContext *ctx, unsigned int argc, JS::Value *vp) { - jsval val = JSVAL_VOID; + JS::Value val; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); JS::RootedObject hobj(ctx, &args.thisv().toObject()); JS::RootedValue rval(ctx, val); -// jsval *argv = JS_ARGV(ctx, rval); +// JS::Value *argv = JS_ARGV(ctx, rval); unsigned char *string = JS_EncodeString(ctx, args[0].toString()); bool ret = form_elements_namedItem2(ctx, hobj, string, &rval); args.rval().set(rval); @@ -2174,7 +2180,6 @@ form_elements_namedItem2(JSContext *ctx, JS::HandleObject hobj, unsigned char *s { JS::RootedObject parent_form(ctx); /* instance of @form_class */ JS::RootedObject parent_doc(ctx); /* instance of @document_class */ - JS::RootedObject parent_win(ctx); /* instance of @window_class */ struct view_state *vs; struct document_view *doc_view; struct document *document; @@ -2187,21 +2192,24 @@ form_elements_namedItem2(JSContext *ctx, JS::HandleObject hobj, unsigned char *s } if (!JS_InstanceOf(ctx, hobj, &form_elements_class, NULL)) return false; - parent_form = JS_GetParent(hobj); - assert(JS_InstanceOf(ctx, parent_form, &form_class, NULL)); - if_assert_failed return false; - parent_doc = JS_GetParent(parent_form); - assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); - if_assert_failed return false; - parent_win = JS_GetParent(parent_doc); - assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); - if_assert_failed return false; +// parent_form = js::GetGlobalForObjectCrossCompartment(hobj); +// assert(JS_InstanceOf(ctx, parent_form, &form_class, NULL)); +// if_assert_failed return false; +// parent_doc = js::GetGlobalForObjectCrossCompartment(parent_form); +// assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); +// if_assert_failed return false; +// parent_win = js::GetGlobalForObjectCrossCompartment(parent_doc); +// assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); +// if_assert_failed return false; + JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); vs = JS_GetInstancePrivate(ctx, parent_win, &window_class, NULL); doc_view = vs->doc_view; document = doc_view->document; - form_view = form_get_form_view(ctx, parent_form, NULL); + + form_view = JS_GetInstancePrivate(ctx, hobj, &form_elements_class, nullptr); +// form_view = form_get_form_view(ctx, nullptr, /*parent_form*/ NULL); if (!form_view) return false; /* detached */ form = find_form_by_form_view(document, form_view); @@ -2213,7 +2221,7 @@ form_elements_namedItem2(JSContext *ctx, JS::HandleObject hobj, unsigned char *s struct form_state *fs = find_form_state(doc_view, fc); if (fs) { - JSObject *fcobj = get_form_control_object(ctx, parent_form, fc->type, fs); + JSObject *fcobj = get_form_control_object(ctx, fc->type, fs); if (fcobj) { hvp.setObject(*fcobj); @@ -2253,8 +2261,8 @@ static JSPropertySpec form_props[] = { { NULL } }; -static bool form_reset(JSContext *ctx, unsigned int argc, jsval *rval); -static bool form_submit(JSContext *ctx, unsigned int argc, jsval *rval); +static bool form_reset(JSContext *ctx, unsigned int argc, JS::Value *rval); +static bool form_submit(JSContext *ctx, unsigned int argc, JS::Value *rval); static const spidermonkeyFunctionSpec form_funcs[] = { { "reset", form_reset, 0 }, @@ -2263,13 +2271,12 @@ static const spidermonkeyFunctionSpec form_funcs[] = { }; static struct form_view * -form_get_form_view(JSContext *ctx, JSObject *jsform, jsval *argv) +form_get_form_view(JSContext *ctx, JSObject *jsform, JS::Value *argv) { JS::RootedObject r_jsform(ctx, jsform); - JS::CallArgs args = JS::CallArgsFromVp(1, argv); struct form_view *fv = JS_GetInstancePrivate(ctx, r_jsform, &form_class, - &args); + NULL); if (!fv) return NULL; /* detached */ @@ -2287,7 +2294,6 @@ form_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::M jsid id = hid.get(); /* DBG("doc %p %s\n", parent_doc, JS_GetStringBytes(JS_ValueToString(ctx, OBJECT_TO_JSVAL(parent_doc)))); */ JS::RootedObject parent_doc(ctx); /* instance of @document_class */ - JS::RootedObject parent_win(ctx); /* instance of @window_class */ struct view_state *vs; struct document_view *doc_view; struct form_view *fv; @@ -2298,17 +2304,18 @@ form_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::M * such calls. */ if (!JS_InstanceOf(ctx, hobj, &form_class, NULL)) return false; - parent_doc = JS_GetParent(obj); - assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); - if_assert_failed return false; - parent_win = JS_GetParent(parent_doc); - assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); - if_assert_failed return false; +// parent_doc = js::GetGlobalForObjectCrossCompartment(obj); +// assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); +// if_assert_failed return false; +// parent_win = js::GetGlobalForObjectCrossCompartment(parent_doc); +// assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); +// if_assert_failed return false; + JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); vs = JS_GetInstancePrivate(ctx, parent_win, &window_class, NULL); doc_view = vs->doc_view; - fv = form_get_form_view(ctx, obj, NULL); + fv = form_get_form_view(ctx, hobj, NULL); if (!fv) return false; /* detached */ form = find_form_by_form_view(doc_view->document, fv); @@ -2329,7 +2336,7 @@ form_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::M undef_to_jsval(ctx, vp); fs = find_form_state(doc_view, fc); if (fs) { - fcobj = get_form_control_object(ctx, obj, fc->type, fs); + fcobj = get_form_control_object(ctx, fc->type, fs); if (fcobj) object_to_jsval(ctx, vp, fcobj); } @@ -2351,7 +2358,7 @@ form_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::M case JSP_FORM_ELEMENTS: { /* jsform ('form') is form_elements' parent; who knows is that's correct */ - JSObject *jsform_elems = JS_NewObject(ctx, &form_elements_class, hobj); + JSObject *jsform_elems = JS_NewObjectWithGivenProto(ctx, &form_elements_class, hobj); JS::RootedObject r_jsform_elems(ctx, jsform_elems); @@ -2420,7 +2427,7 @@ form_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::M static bool -form_get_property_action(JSContext *ctx, unsigned int argc, jsval *vp) +form_get_property_action(JSContext *ctx, unsigned int argc, JS::Value *vp) { JS::CallArgs args = CallArgsFromVp(argc, vp); JS::RootedObject hobj(ctx, &args.thisv().toObject()); @@ -2436,13 +2443,14 @@ form_get_property_action(JSContext *ctx, unsigned int argc, jsval *vp) if (!JS_InstanceOf(ctx, hobj, &form_class, NULL)) return false; - JS::RootedObject parent_doc(ctx, JS_GetParent(hobj)); - assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); - if_assert_failed return false; - - JS::RootedObject parent_win(ctx, JS_GetParent(parent_doc)); - assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); - if_assert_failed return false; +// JS::RootedObject parent_doc(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); +// assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); +// if_assert_failed return false; +// +// JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(parent_doc)); +// assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); +// if_assert_failed return false; + JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); vs = JS_GetInstancePrivate(ctx, parent_win, &window_class, NULL); @@ -2461,7 +2469,7 @@ form_get_property_action(JSContext *ctx, unsigned int argc, jsval *vp) } static bool -form_set_property_action(JSContext *ctx, unsigned int argc, jsval *vp) +form_set_property_action(JSContext *ctx, unsigned int argc, JS::Value *vp) { JS::CallArgs args = CallArgsFromVp(argc, vp); JS::RootedObject hobj(ctx, &args.thisv().toObject()); @@ -2478,13 +2486,14 @@ form_set_property_action(JSContext *ctx, unsigned int argc, jsval *vp) if (!JS_InstanceOf(ctx, hobj, &form_class, NULL)) return false; - JS::RootedObject parent_doc(ctx, JS_GetParent(hobj)); - assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); - if_assert_failed return false; +// JS::RootedObject parent_doc(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); +// assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); +// if_assert_failed return false; - JS::RootedObject parent_win(ctx, JS_GetParent(parent_doc)); - assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); - if_assert_failed return false; +// JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(parent_doc)); +// assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); +// if_assert_failed return false; + JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); vs = JS_GetInstancePrivate(ctx, parent_win, &window_class, NULL); @@ -2509,7 +2518,7 @@ form_set_property_action(JSContext *ctx, unsigned int argc, jsval *vp) } static bool -form_get_property_elements(JSContext *ctx, unsigned int argc, jsval *vp) +form_get_property_elements(JSContext *ctx, unsigned int argc, JS::Value *vp) { JS::CallArgs args = CallArgsFromVp(argc, vp); JS::RootedObject hobj(ctx, &args.thisv().toObject()); @@ -2526,19 +2535,21 @@ form_get_property_elements(JSContext *ctx, unsigned int argc, jsval *vp) if (!fv) return false; /* detached */ /* jsform ('form') is form_elements' parent; who knows is that's correct */ - JSObject *jsform_elems = JS_NewObject(ctx, &form_elements_class, hobj); + JSObject *jsform_elems = JS_NewObjectWithGivenProto(ctx, &form_elements_class, hobj); JS::RootedObject r_jsform_elems(ctx, jsform_elems); JS_DefineProperties(ctx, r_jsform_elems, (JSPropertySpec *) form_elements_props); spidermonkey_DefineFunctions(ctx, jsform_elems, form_elements_funcs); + JS_SetPrivate(jsform_elems, fv); + args.rval().setObject(*jsform_elems); return true; } static bool -form_get_property_encoding(JSContext *ctx, unsigned int argc, jsval *vp) +form_get_property_encoding(JSContext *ctx, unsigned int argc, JS::Value *vp) { JS::CallArgs args = CallArgsFromVp(argc, vp); JS::RootedObject hobj(ctx, &args.thisv().toObject()); @@ -2554,13 +2565,14 @@ form_get_property_encoding(JSContext *ctx, unsigned int argc, jsval *vp) if (!JS_InstanceOf(ctx, hobj, &form_class, NULL)) return false; - JS::RootedObject parent_doc(ctx, JS_GetParent(hobj)); - assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); - if_assert_failed return false; +// JS::RootedObject parent_doc(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); +// assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); +// if_assert_failed return false; - JS::RootedObject parent_win(ctx, JS_GetParent(parent_doc)); - assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); - if_assert_failed return false; +// JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(parent_doc)); +// assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); +// if_assert_failed return false; + JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); vs = JS_GetInstancePrivate(ctx, parent_win, &window_class, NULL); @@ -2592,7 +2604,7 @@ form_get_property_encoding(JSContext *ctx, unsigned int argc, jsval *vp) /* @form_class.setProperty */ static bool -form_set_property_encoding(JSContext *ctx, unsigned int argc, jsval *vp) +form_set_property_encoding(JSContext *ctx, unsigned int argc, JS::Value *vp) { JS::CallArgs args = CallArgsFromVp(argc, vp); JS::RootedObject hobj(ctx, &args.thisv().toObject()); @@ -2609,13 +2621,14 @@ form_set_property_encoding(JSContext *ctx, unsigned int argc, jsval *vp) if (!JS_InstanceOf(ctx, hobj, &form_class, NULL)) return false; - JS::RootedObject parent_doc(ctx, JS_GetParent(hobj)); - assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); - if_assert_failed return false; +// JS::RootedObject parent_doc(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); +// assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); +// if_assert_failed return false; - JS::RootedObject parent_win(ctx, JS_GetParent(parent_doc)); - assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); - if_assert_failed return false; +// JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(parent_doc)); +// assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); +// if_assert_failed return false; + JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); vs = JS_GetInstancePrivate(ctx, parent_win, &window_class, NULL); @@ -2643,7 +2656,7 @@ form_set_property_encoding(JSContext *ctx, unsigned int argc, jsval *vp) } static bool -form_get_property_length(JSContext *ctx, unsigned int argc, jsval *vp) +form_get_property_length(JSContext *ctx, unsigned int argc, JS::Value *vp) { JS::CallArgs args = CallArgsFromVp(argc, vp); JS::RootedObject hobj(ctx, &args.thisv().toObject()); @@ -2659,13 +2672,14 @@ form_get_property_length(JSContext *ctx, unsigned int argc, jsval *vp) if (!JS_InstanceOf(ctx, hobj, &form_class, NULL)) return false; - JS::RootedObject parent_doc(ctx, JS_GetParent(hobj)); - assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); - if_assert_failed return false; - - JS::RootedObject parent_win(ctx, JS_GetParent(parent_doc)); - assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); - if_assert_failed return false; +// JS::RootedObject parent_doc(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); +// assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); +// if_assert_failed return false; +// +// JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(parent_doc)); +// assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); +// if_assert_failed return false; + JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); vs = JS_GetInstancePrivate(ctx, parent_win, &window_class, NULL); @@ -2685,7 +2699,7 @@ form_get_property_length(JSContext *ctx, unsigned int argc, jsval *vp) } static bool -form_get_property_method(JSContext *ctx, unsigned int argc, jsval *vp) +form_get_property_method(JSContext *ctx, unsigned int argc, JS::Value *vp) { JS::CallArgs args = CallArgsFromVp(argc, vp); JS::RootedObject hobj(ctx, &args.thisv().toObject()); @@ -2701,13 +2715,14 @@ form_get_property_method(JSContext *ctx, unsigned int argc, jsval *vp) if (!JS_InstanceOf(ctx, hobj, &form_class, NULL)) return false; - JS::RootedObject parent_doc(ctx, JS_GetParent(hobj)); - assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); - if_assert_failed return false; - - JS::RootedObject parent_win(ctx, JS_GetParent(parent_doc)); - assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); - if_assert_failed return false; +// JS::RootedObject parent_doc(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); +// assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); +// if_assert_failed return false; +// +// JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(parent_doc)); +// assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); +// if_assert_failed return false; + JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); vs = JS_GetInstancePrivate(ctx, parent_win, &window_class, NULL); @@ -2738,7 +2753,7 @@ form_get_property_method(JSContext *ctx, unsigned int argc, jsval *vp) /* @form_class.setProperty */ static bool -form_set_property_method(JSContext *ctx, unsigned int argc, jsval *vp) +form_set_property_method(JSContext *ctx, unsigned int argc, JS::Value *vp) { JS::CallArgs args = CallArgsFromVp(argc, vp); JS::RootedObject hobj(ctx, &args.thisv().toObject()); @@ -2755,13 +2770,14 @@ form_set_property_method(JSContext *ctx, unsigned int argc, jsval *vp) if (!JS_InstanceOf(ctx, hobj, &form_class, NULL)) return false; - JS::RootedObject parent_doc(ctx, JS_GetParent(hobj)); - assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); - if_assert_failed return false; +// JS::RootedObject parent_doc(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); +// assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); +// if_assert_failed return false; - JS::RootedObject parent_win(ctx, JS_GetParent(parent_doc)); - assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); - if_assert_failed return false; +// JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(parent_doc)); +// assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); +// if_assert_failed return false; + JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); vs = JS_GetInstancePrivate(ctx, parent_win, &window_class, NULL); @@ -2786,7 +2802,7 @@ form_set_property_method(JSContext *ctx, unsigned int argc, jsval *vp) } static bool -form_get_property_name(JSContext *ctx, unsigned int argc, jsval *vp) +form_get_property_name(JSContext *ctx, unsigned int argc, JS::Value *vp) { JS::CallArgs args = CallArgsFromVp(argc, vp); JS::RootedObject hobj(ctx, &args.thisv().toObject()); @@ -2802,13 +2818,14 @@ form_get_property_name(JSContext *ctx, unsigned int argc, jsval *vp) if (!JS_InstanceOf(ctx, hobj, &form_class, NULL)) return false; - JS::RootedObject parent_doc(ctx, JS_GetParent(hobj)); - assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); - if_assert_failed return false; +// JS::RootedObject parent_doc(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); +// assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); +// if_assert_failed return false; - JS::RootedObject parent_win(ctx, JS_GetParent(parent_doc)); - assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); - if_assert_failed return false; +// JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(parent_doc)); +// assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); +// if_assert_failed return false; + JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); vs = JS_GetInstancePrivate(ctx, parent_win, &window_class, NULL); @@ -2829,7 +2846,7 @@ form_get_property_name(JSContext *ctx, unsigned int argc, jsval *vp) /* @form_class.setProperty */ static bool -form_set_property_name(JSContext *ctx, unsigned int argc, jsval *vp) +form_set_property_name(JSContext *ctx, unsigned int argc, JS::Value *vp) { JS::CallArgs args = CallArgsFromVp(argc, vp); JS::RootedObject hobj(ctx, &args.thisv().toObject()); @@ -2845,13 +2862,14 @@ form_set_property_name(JSContext *ctx, unsigned int argc, jsval *vp) if (!JS_InstanceOf(ctx, hobj, &form_class, NULL)) return false; - JS::RootedObject parent_doc(ctx, JS_GetParent(hobj)); - assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); - if_assert_failed return false; +// JS::RootedObject parent_doc(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); +// assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); +// if_assert_failed return false; - JS::RootedObject parent_win(ctx, JS_GetParent(parent_doc)); - assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); - if_assert_failed return false; +// JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(parent_doc)); +// assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); +// if_assert_failed return false; + JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); vs = JS_GetInstancePrivate(ctx, parent_win, &window_class, NULL); @@ -2870,7 +2888,7 @@ form_set_property_name(JSContext *ctx, unsigned int argc, jsval *vp) } static bool -form_get_property_target(JSContext *ctx, unsigned int argc, jsval *vp) +form_get_property_target(JSContext *ctx, unsigned int argc, JS::Value *vp) { JS::CallArgs args = CallArgsFromVp(argc, vp); JS::RootedObject hobj(ctx, &args.thisv().toObject()); @@ -2886,13 +2904,14 @@ form_get_property_target(JSContext *ctx, unsigned int argc, jsval *vp) if (!JS_InstanceOf(ctx, hobj, &form_class, NULL)) return false; - JS::RootedObject parent_doc(ctx, JS_GetParent(hobj)); - assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); - if_assert_failed return false; +// JS::RootedObject parent_doc(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); +// assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); +// if_assert_failed return false; - JS::RootedObject parent_win(ctx, JS_GetParent(parent_doc)); - assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); - if_assert_failed return false; +// JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(parent_doc)); +// assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); +// if_assert_failed return false; + JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); vs = JS_GetInstancePrivate(ctx, parent_win, &window_class, NULL); @@ -2911,7 +2930,7 @@ form_get_property_target(JSContext *ctx, unsigned int argc, jsval *vp) } static bool -form_set_property_target(JSContext *ctx, unsigned int argc, jsval *vp) +form_set_property_target(JSContext *ctx, unsigned int argc, JS::Value *vp) { JS::CallArgs args = CallArgsFromVp(argc, vp); JS::RootedObject hobj(ctx, &args.thisv().toObject()); @@ -2927,13 +2946,14 @@ form_set_property_target(JSContext *ctx, unsigned int argc, jsval *vp) if (!JS_InstanceOf(ctx, hobj, &form_class, NULL)) return false; - JS::RootedObject parent_doc(ctx, JS_GetParent(hobj)); - assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); - if_assert_failed return false; +// JS::RootedObject parent_doc(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); +// assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); +// if_assert_failed return false; - JS::RootedObject parent_win(ctx, JS_GetParent(parent_doc)); - assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); - if_assert_failed return false; +// JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(parent_doc)); +// assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); +// if_assert_failed return false; + JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); vs = JS_GetInstancePrivate(ctx, parent_win, &window_class, NULL); @@ -2954,27 +2974,27 @@ form_set_property_target(JSContext *ctx, unsigned int argc, jsval *vp) /* @form_funcs{"reset"} */ static bool -form_reset(JSContext *ctx, unsigned int argc, jsval *rval) +form_reset(JSContext *ctx, unsigned int argc, JS::Value *rval) { - jsval val; + JS::Value val; JS::RootedObject parent_doc(ctx); /* instance of @document_class */ - JS::RootedObject parent_win(ctx); /* instance of @window_class */ JSObject *obj = JS_THIS_OBJECT(ctx, rval); JS::RootedObject hobj(ctx, obj); JS::CallArgs args = JS::CallArgsFromVp(argc, rval); -// jsval *argv = JS_ARGV(ctx, rval); +// JS::Value *argv = JS_ARGV(ctx, rval); struct view_state *vs; struct document_view *doc_view; struct form_view *fv; struct form *form; if (!JS_InstanceOf(ctx, hobj, &form_class, &args)) return false; - parent_doc = JS_GetParent(obj); - assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); - if_assert_failed return false; - parent_win = JS_GetParent(parent_doc); - assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); - if_assert_failed return false; +// parent_doc = js::GetGlobalForObjectCrossCompartment(obj); +// assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); +// if_assert_failed return false; +// parent_win = js::GetGlobalForObjectCrossCompartment(parent_doc); +// assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); +// if_assert_failed return false; + JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); vs = JS_GetInstancePrivate(ctx, parent_win, &window_class, NULL); @@ -2996,15 +3016,14 @@ form_reset(JSContext *ctx, unsigned int argc, jsval *rval) /* @form_funcs{"submit"} */ static bool -form_submit(JSContext *ctx, unsigned int argc, jsval *rval) +form_submit(JSContext *ctx, unsigned int argc, JS::Value *rval) { - jsval val; + JS::Value val; JS::RootedObject parent_doc(ctx); /* instance of @document_class */ - JS::RootedObject parent_win(ctx); /* instance of @window_class */ JSObject *obj = JS_THIS_OBJECT(ctx, rval); JS::RootedObject hobj(ctx, obj); JS::CallArgs args = JS::CallArgsFromVp(argc, rval); -// jsval *argv = JS_ARGV(ctx, rval); +// JS::Value *argv = JS_ARGV(ctx, rval); struct view_state *vs; struct document_view *doc_view; struct session *ses; @@ -3012,12 +3031,13 @@ form_submit(JSContext *ctx, unsigned int argc, jsval *rval) struct form *form; if (!JS_InstanceOf(ctx, hobj, &form_class, &args)) return false; - parent_doc = JS_GetParent(obj); - assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); - if_assert_failed return false; - parent_win = JS_GetParent(parent_doc); - assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); - if_assert_failed return false; +// parent_doc = js::GetGlobalForObjectCrossCompartment(obj); +// assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); +// if_assert_failed return false; +// parent_win = js::GetGlobalForObjectCrossCompartment(parent_doc); +// assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); +// if_assert_failed return false; + JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); vs = JS_GetInstancePrivate(ctx, parent_win, &window_class, NULL); @@ -3052,11 +3072,10 @@ get_form_object(JSContext *ctx, JSObject *jsdoc, struct form_view *fv) return jsform; } - JS::RootedObject r_jsdoc(ctx, jsdoc); /* jsdoc ('document') is fv's parent */ /* FIXME: That is NOT correct since the real containing element * should be its parent, but gimme DOM first. --pasky */ - jsform = JS_NewObject(ctx, &form_class, r_jsdoc); + jsform = JS_NewObject(ctx, &form_class); if (jsform == NULL) return NULL; JS::RootedObject r_jsform(ctx, jsform); @@ -3115,7 +3134,7 @@ spidermonkey_detach_form_view(struct form_view *fv) static bool forms_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); -static bool forms_get_property_length(JSContext *ctx, unsigned int argc, jsval *vp); +static bool forms_get_property_length(JSContext *ctx, unsigned int argc, JS::Value *vp); /* Each @forms_class object must have a @document_class parent. */ JSClass forms_class = { @@ -3126,9 +3145,9 @@ JSClass forms_class = { nullptr, nullptr, nullptr, nullptr }; -static bool forms_item(JSContext *ctx, unsigned int argc, jsval *rval); +static bool forms_item(JSContext *ctx, unsigned int argc, JS::Value *rval); static bool forms_item2(JSContext *ctx, JS::HandleObject hobj, int index, JS::MutableHandleValue hvp); -static bool forms_namedItem(JSContext *ctx, unsigned int argc, jsval *rval); +static bool forms_namedItem(JSContext *ctx, unsigned int argc, JS::Value *rval); const spidermonkeyFunctionSpec forms_funcs[] = { { "item", forms_item, 1 }, @@ -3152,7 +3171,7 @@ JSPropertySpec forms_props[] = { * string (but might not be). If found, set *rval = the DOM * object. If not found, leave *rval unchanged. */ static void -find_form_by_name(JSContext *ctx, JS::HandleObject jsdoc, +find_form_by_name(JSContext *ctx, struct document_view *doc_view, unsigned char *string, JS::MutableHandleValue hvp) { @@ -3163,7 +3182,7 @@ find_form_by_name(JSContext *ctx, JS::HandleObject jsdoc, foreach (form, doc_view->document->forms) { if (form->name && !c_strcasecmp(string, form->name)) { - hvp.setObject(*get_form_object(ctx, jsdoc, + hvp.setObject(*get_form_object(ctx, nullptr, find_form_view(doc_view, form))); break; } @@ -3176,9 +3195,8 @@ forms_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS:: { jsid id = hid.get(); - jsval idval; - JS::RootedObject parent_doc(ctx); /* instance of @document_class */ - JS::RootedObject parent_win(ctx); /* instance of @window_class */ + JS::Value idval; +// JS::RootedObject parent_doc(ctx); /* instance of @document_class */ struct view_state *vs; struct document_view *doc_view; @@ -3188,13 +3206,7 @@ forms_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS:: if (!JS_InstanceOf(ctx, hobj, &forms_class, NULL)) return false; - parent_doc = JS_GetParent(hobj); - assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); - if_assert_failed return false; - - parent_win = JS_GetParent(parent_doc); - assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); - if_assert_failed return false; + JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); vs = JS_GetInstancePrivate(ctx, parent_win, &window_class, NULL); @@ -3216,7 +3228,7 @@ forms_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS:: * "TypeError: forms.namedItem is not a function". */ JS_IdToValue(ctx, id, &r_idval); unsigned char *string = JS_EncodeString(ctx, r_idval.toString()); - find_form_by_name(ctx, parent_doc, doc_view, string, hvp); + find_form_by_name(ctx, doc_view, string, hvp); return true; } @@ -3231,7 +3243,7 @@ forms_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS:: } static bool -forms_get_property_length(JSContext *ctx, unsigned int argc, jsval *vp) +forms_get_property_length(JSContext *ctx, unsigned int argc, JS::Value *vp) { JS::CallArgs args = CallArgsFromVp(argc, vp); JS::RootedObject hobj(ctx, &args.thisv().toObject()); @@ -3246,13 +3258,14 @@ forms_get_property_length(JSContext *ctx, unsigned int argc, jsval *vp) if (!JS_InstanceOf(ctx, hobj, &forms_class, NULL)) return false; - JS::RootedObject parent_doc(ctx, JS_GetParent(hobj)); - assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); - if_assert_failed return false; +// JS::RootedObject parent_doc(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); +// assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); +// if_assert_failed return false; - JS::RootedObject parent_win(ctx, JS_GetParent(parent_doc)); - assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); - if_assert_failed return false; +// JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(parent_doc)); +// assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); +// if_assert_failed return false; + JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); vs = JS_GetInstancePrivate(ctx, parent_win, &window_class, NULL); @@ -3268,15 +3281,15 @@ forms_get_property_length(JSContext *ctx, unsigned int argc, jsval *vp) /* @forms_funcs{"item"} */ static bool -forms_item(JSContext *ctx, unsigned int argc, jsval *vp) +forms_item(JSContext *ctx, unsigned int argc, JS::Value *vp) { - jsval val = JSVAL_VOID; + JS::Value val; JS::CallArgs args = JS::CallArgsFromVp(argc, vp); JS::RootedObject hobj(ctx, &args.thisv().toObject()); JS::RootedValue rval(ctx, val); -// jsval *argv = JS_ARGV(ctx, rval); +// JS::Value *argv = JS_ARGV(ctx, rval); int index = args[0].toInt32(); bool ret = forms_item2(ctx, hobj, index, &rval); @@ -3288,8 +3301,7 @@ forms_item(JSContext *ctx, unsigned int argc, jsval *vp) static bool forms_item2(JSContext *ctx, JS::HandleObject hobj, int index, JS::MutableHandleValue hvp) { - JS::RootedObject parent_doc(ctx); /* instance of @document_class */ - JS::RootedObject parent_win(ctx); /* instance of @window_class */ +// JS::RootedObject parent_doc(ctx); /* instance of @document_class */ struct view_state *vs; struct form_view *fv; int counter = -1; @@ -3297,13 +3309,7 @@ forms_item2(JSContext *ctx, JS::HandleObject hobj, int index, JS::MutableHandleV if (!JS_InstanceOf(ctx, hobj, &forms_class, NULL)) return false; - parent_doc = JS_GetParent(hobj); - assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); - if_assert_failed return false; - - parent_win = JS_GetParent(parent_doc); - assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); - if_assert_failed return false; + JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); vs = JS_GetInstancePrivate(ctx, parent_win, &window_class, NULL); @@ -3313,7 +3319,7 @@ forms_item2(JSContext *ctx, JS::HandleObject hobj, int index, JS::MutableHandleV foreach (fv, vs->forms) { counter++; if (counter == index) { - hvp.setObject(*get_form_object(ctx, parent_doc, fv)); + hvp.setObject(*get_form_object(ctx, nullptr, fv)); break; } } @@ -3323,25 +3329,20 @@ forms_item2(JSContext *ctx, JS::HandleObject hobj, int index, JS::MutableHandleV /* @forms_funcs{"namedItem"} */ static bool -forms_namedItem(JSContext *ctx, unsigned int argc, jsval *vp) +forms_namedItem(JSContext *ctx, unsigned int argc, JS::Value *vp) { - jsval val; - JS::RootedObject parent_doc(ctx); /* instance of @document_class */ - JS::RootedObject parent_win(ctx); /* instance of @window_class */ + JS::Value val; +// JS::RootedObject parent_doc(ctx); /* instance of @document_class */ JS::CallArgs args = JS::CallArgsFromVp(argc, vp); JS::RootedObject hobj(ctx, &args.thisv().toObject()); -// jsval *argv = JS_ARGV(ctx, rval); +// JS::Value *argv = JS_ARGV(ctx, rval); struct view_state *vs; struct document_view *doc_view; if (!JS_InstanceOf(ctx, hobj, &forms_class, &args)) return false; - parent_doc = JS_GetParent(hobj); - assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); - if_assert_failed return false; - parent_win = JS_GetParent(parent_doc); - assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); - if_assert_failed return false; + + JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); vs = JS_GetInstancePrivate(ctx, parent_win, &window_class, NULL); @@ -3355,7 +3356,7 @@ forms_namedItem(JSContext *ctx, unsigned int argc, jsval *vp) JS::RootedValue rval(ctx, val); - find_form_by_name(ctx, parent_doc, doc_view, string, &rval); + find_form_by_name(ctx, doc_view, string, &rval); args.rval().set(rval.get()); return true; diff --git a/src/ecmascript/spidermonkey/location.c b/src/ecmascript/spidermonkey/location.c index c4399f83..2059f4b6 100644 --- a/src/ecmascript/spidermonkey/location.c +++ b/src/ecmascript/spidermonkey/location.c @@ -11,6 +11,7 @@ #include "elinks.h" #include "ecmascript/spidermonkey/util.h" +#include #include "bfu/dialog.h" #include "cache/cache.h" @@ -45,9 +46,9 @@ #include "viewer/text/vs.h" -static bool history_back(JSContext *ctx, unsigned int argc, jsval *rval); -static bool history_forward(JSContext *ctx, unsigned int argc, jsval *rval); -static bool history_go(JSContext *ctx, unsigned int argc, jsval *rval); +static bool history_back(JSContext *ctx, unsigned int argc, JS::Value *rval); +static bool history_forward(JSContext *ctx, unsigned int argc, JS::Value *rval); +static bool history_go(JSContext *ctx, unsigned int argc, JS::Value *rval); JSClass history_class = { "history", @@ -66,7 +67,7 @@ const spidermonkeyFunctionSpec history_funcs[] = { /* @history_funcs{"back"} */ static bool -history_back(JSContext *ctx, unsigned int argc, jsval *rval) +history_back(JSContext *ctx, unsigned int argc, JS::Value *rval) { struct ecmascript_interpreter *interpreter = JS_GetContextPrivate(ctx); struct document_view *doc_view = interpreter->vs->doc_view; @@ -85,7 +86,7 @@ history_back(JSContext *ctx, unsigned int argc, jsval *rval) /* @history_funcs{"forward"} */ static bool -history_forward(JSContext *ctx, unsigned int argc, jsval *rval) +history_forward(JSContext *ctx, unsigned int argc, JS::Value *rval) { struct ecmascript_interpreter *interpreter = JS_GetContextPrivate(ctx); struct document_view *doc_view = interpreter->vs->doc_view; @@ -100,7 +101,7 @@ history_forward(JSContext *ctx, unsigned int argc, jsval *rval) /* @history_funcs{"go"} */ static bool -history_go(JSContext *ctx, unsigned int argc, jsval *rval) +history_go(JSContext *ctx, unsigned int argc, JS::Value *rval) { struct ecmascript_interpreter *interpreter = JS_GetContextPrivate(ctx); struct document_view *doc_view = interpreter->vs->doc_view; @@ -130,8 +131,8 @@ history_go(JSContext *ctx, unsigned int argc, jsval *rval) } -static bool location_get_property_href(JSContext *ctx, unsigned int argc, jsval *vp); -static bool location_set_property_href(JSContext *ctx, unsigned int argc, jsval *vp); +static bool location_get_property_href(JSContext *ctx, unsigned int argc, JS::Value *vp); +static bool location_set_property_href(JSContext *ctx, unsigned int argc, JS::Value *vp); /* Each @location_class object must have a @window_class parent. */ JSClass location_class = { @@ -156,7 +157,7 @@ JSPropertySpec location_props[] = { static bool -location_get_property_href(JSContext *ctx, unsigned int argc, jsval *vp) +location_get_property_href(JSContext *ctx, unsigned int argc, JS::Value *vp) { JS::CallArgs args = CallArgsFromVp(argc, vp); JS::RootedObject hobj(ctx, &args.thisv().toObject()); @@ -169,7 +170,7 @@ location_get_property_href(JSContext *ctx, unsigned int argc, jsval *vp) if (!JS_InstanceOf(ctx, hobj, &location_class, NULL)) return false; - JS::RootedObject parent_win(ctx, JS_GetParent(hobj)); + JS::RootedObject parent_win(ctx, GetGlobalForObjectCrossCompartment(hobj)); assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); if_assert_failed return false; @@ -192,7 +193,7 @@ location_get_property_href(JSContext *ctx, unsigned int argc, jsval *vp) } static bool -location_set_property_href(JSContext *ctx, unsigned int argc, jsval *vp) +location_set_property_href(JSContext *ctx, unsigned int argc, JS::Value *vp) { JS::CallArgs args = CallArgsFromVp(argc, vp); JS::RootedObject hobj(ctx, &args.thisv().toObject()); @@ -206,7 +207,7 @@ location_set_property_href(JSContext *ctx, unsigned int argc, jsval *vp) if (!JS_InstanceOf(ctx, hobj, &location_class, NULL)) return false; - JS::RootedObject parent_win(ctx, JS_GetParent(hobj)); + JS::RootedObject parent_win(ctx, GetGlobalForObjectCrossCompartment(hobj)); assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); if_assert_failed return false; @@ -222,7 +223,7 @@ location_set_property_href(JSContext *ctx, unsigned int argc, jsval *vp) } -static bool location_toString(JSContext *ctx, unsigned int argc, jsval *rval); +static bool location_toString(JSContext *ctx, unsigned int argc, JS::Value *rval); const spidermonkeyFunctionSpec location_funcs[] = { { "toString", location_toString, 0 }, @@ -232,9 +233,9 @@ const spidermonkeyFunctionSpec location_funcs[] = { /* @location_funcs{"toString"}, @location_funcs{"toLocaleString"} */ static bool -location_toString(JSContext *ctx, unsigned int argc, jsval *rval) +location_toString(JSContext *ctx, unsigned int argc, JS::Value *rval) { - jsval val; + JS::Value val; JSObject *obj = JS_THIS_OBJECT(ctx, rval); JS::CallArgs args = JS::CallArgsFromVp(argc, rval); JS::RootedObject hobj(ctx, obj); diff --git a/src/ecmascript/spidermonkey/navigator.c b/src/ecmascript/spidermonkey/navigator.c index 4b3589aa..3bbfdf79 100644 --- a/src/ecmascript/spidermonkey/navigator.c +++ b/src/ecmascript/spidermonkey/navigator.c @@ -44,12 +44,12 @@ #include "viewer/text/vs.h" -static bool navigator_get_property_appCodeName(JSContext *ctx, unsigned int argc, jsval *vp); -static bool navigator_get_property_appName(JSContext *ctx, unsigned int argc, jsval *vp); -static bool navigator_get_property_appVersion(JSContext *ctx, unsigned int argc, jsval *vp); -static bool navigator_get_property_language(JSContext *ctx, unsigned int argc, jsval *vp); -static bool navigator_get_property_platform(JSContext *ctx, unsigned int argc, jsval *vp); -static bool navigator_get_property_userAgent(JSContext *ctx, unsigned int argc, jsval *vp); +static bool navigator_get_property_appCodeName(JSContext *ctx, unsigned int argc, JS::Value *vp); +static bool navigator_get_property_appName(JSContext *ctx, unsigned int argc, JS::Value *vp); +static bool navigator_get_property_appVersion(JSContext *ctx, unsigned int argc, JS::Value *vp); +static bool navigator_get_property_language(JSContext *ctx, unsigned int argc, JS::Value *vp); +static bool navigator_get_property_platform(JSContext *ctx, unsigned int argc, JS::Value *vp); +static bool navigator_get_property_userAgent(JSContext *ctx, unsigned int argc, JS::Value *vp); JSClass navigator_class = { "navigator", @@ -87,7 +87,7 @@ JSPropertySpec navigator_props[] = { /* @navigator_class.getProperty */ static bool -navigator_get_property_appCodeName(JSContext *ctx, unsigned int argc, jsval *vp) +navigator_get_property_appCodeName(JSContext *ctx, unsigned int argc, JS::Value *vp) { JS::CallArgs args = CallArgsFromVp(argc, vp); args.rval().setString(JS_NewStringCopyZ(ctx, "Mozilla")); /* More like a constant nowadays. */ @@ -96,7 +96,7 @@ navigator_get_property_appCodeName(JSContext *ctx, unsigned int argc, jsval *vp) } static bool -navigator_get_property_appName(JSContext *ctx, unsigned int argc, jsval *vp) +navigator_get_property_appName(JSContext *ctx, unsigned int argc, JS::Value *vp) { JS::CallArgs args = CallArgsFromVp(argc, vp); args.rval().setString(JS_NewStringCopyZ(ctx, @@ -106,7 +106,7 @@ navigator_get_property_appName(JSContext *ctx, unsigned int argc, jsval *vp) } static bool -navigator_get_property_appVersion(JSContext *ctx, unsigned int argc, jsval *vp) +navigator_get_property_appVersion(JSContext *ctx, unsigned int argc, JS::Value *vp) { JS::CallArgs args = CallArgsFromVp(argc, vp); args.rval().setString(JS_NewStringCopyZ(ctx, VERSION)); @@ -115,7 +115,7 @@ navigator_get_property_appVersion(JSContext *ctx, unsigned int argc, jsval *vp) } static bool -navigator_get_property_language(JSContext *ctx, unsigned int argc, jsval *vp) +navigator_get_property_language(JSContext *ctx, unsigned int argc, JS::Value *vp) { JS::CallArgs args = CallArgsFromVp(argc, vp); @@ -131,7 +131,7 @@ navigator_get_property_language(JSContext *ctx, unsigned int argc, jsval *vp) } static bool -navigator_get_property_platform(JSContext *ctx, unsigned int argc, jsval *vp) +navigator_get_property_platform(JSContext *ctx, unsigned int argc, JS::Value *vp) { JS::CallArgs args = CallArgsFromVp(argc, vp); args.rval().setString(JS_NewStringCopyZ(ctx, system_name)); @@ -140,7 +140,7 @@ navigator_get_property_platform(JSContext *ctx, unsigned int argc, jsval *vp) } static bool -navigator_get_property_userAgent(JSContext *ctx, unsigned int argc, jsval *vp) +navigator_get_property_userAgent(JSContext *ctx, unsigned int argc, JS::Value *vp) { JS::CallArgs args = CallArgsFromVp(argc, vp); unsigned char *optstr; diff --git a/src/ecmascript/spidermonkey/unibar.c b/src/ecmascript/spidermonkey/unibar.c index 1d3bdcfb..4a20598c 100644 --- a/src/ecmascript/spidermonkey/unibar.c +++ b/src/ecmascript/spidermonkey/unibar.c @@ -11,6 +11,7 @@ #include "elinks.h" #include "ecmascript/spidermonkey/util.h" +#include #include "bfu/dialog.h" #include "cache/cache.h" @@ -44,8 +45,8 @@ #include "viewer/text/link.h" #include "viewer/text/vs.h" -static bool unibar_get_property_visible(JSContext *ctx, unsigned int argc, jsval *vp); -static bool unibar_set_property_visible(JSContext *ctx, unsigned int argc, jsval *vp); +static bool unibar_get_property_visible(JSContext *ctx, unsigned int argc, JS::Value *vp); +static bool unibar_set_property_visible(JSContext *ctx, unsigned int argc, JS::Value *vp); /* Each @menubar_class object must have a @window_class parent. */ JSClass menubar_class = { @@ -79,7 +80,7 @@ JSPropertySpec unibar_props[] = { static bool -unibar_get_property_visible(JSContext *ctx, unsigned int argc, jsval *vp) +unibar_get_property_visible(JSContext *ctx, unsigned int argc, JS::Value *vp) { JS::CallArgs args = CallArgsFromVp(argc, vp); JS::RootedObject hobj(ctx, &args.thisv().toObject()); @@ -96,7 +97,7 @@ unibar_get_property_visible(JSContext *ctx, unsigned int argc, jsval *vp) && !JS_InstanceOf(ctx, hobj, &statusbar_class, NULL)) return false; - JS::RootedObject parent_win(ctx, JS_GetParent(hobj)); + JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); if_assert_failed return false; @@ -130,7 +131,7 @@ unibar_get_property_visible(JSContext *ctx, unsigned int argc, jsval *vp) } static bool -unibar_set_property_visible(JSContext *ctx, unsigned int argc, jsval *vp) +unibar_set_property_visible(JSContext *ctx, unsigned int argc, JS::Value *vp) { JS::CallArgs args = CallArgsFromVp(argc, vp); JS::RootedObject hobj(ctx, &args.thisv().toObject()); @@ -147,7 +148,7 @@ unibar_set_property_visible(JSContext *ctx, unsigned int argc, jsval *vp) && !JS_InstanceOf(ctx, hobj, &statusbar_class, NULL)) return false; - JS::RootedObject parent_win(ctx, JS_GetParent(hobj)); + JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); if_assert_failed return false; diff --git a/src/ecmascript/spidermonkey/util.h b/src/ecmascript/spidermonkey/util.h index a99cdea4..8911b979 100644 --- a/src/ecmascript/spidermonkey/util.h +++ b/src/ecmascript/spidermonkey/util.h @@ -5,56 +5,56 @@ #include "ecmascript/spidermonkey-shared.h" #include "util/memory.h" -static void string_to_jsval(JSContext *ctx, jsval *vp, unsigned char *string); -static void astring_to_jsval(JSContext *ctx, jsval *vp, unsigned char *string); -static void int_to_jsval(JSContext *ctx, jsval *vp, int number); -static void object_to_jsval(JSContext *ctx, jsval *vp, JSObject *object); -static void boolean_to_jsval(JSContext *ctx, jsval *vp, int boolean); +static void string_to_jsval(JSContext *ctx, JS::Value *vp, unsigned char *string); +static void astring_to_jsval(JSContext *ctx, JS::Value *vp, unsigned char *string); +static void int_to_jsval(JSContext *ctx, JS::Value *vp, int number); +static void object_to_jsval(JSContext *ctx, JS::Value *vp, JSObject *object); +static void boolean_to_jsval(JSContext *ctx, JS::Value *vp, int boolean); -static int jsval_to_boolean(JSContext *ctx, jsval *vp); +static int jsval_to_boolean(JSContext *ctx, JS::Value *vp); /** Inline functions */ static inline void -string_to_jsval(JSContext *ctx, jsval *vp, unsigned char *string) +string_to_jsval(JSContext *ctx, JS::Value *vp, unsigned char *string) { if (!string) { - *vp = JSVAL_NULL; + *vp = JS::NullValue(); } else { - *vp = STRING_TO_JSVAL(JS_NewStringCopyZ(ctx, string)); + *vp = JS::StringValue(JS_NewStringCopyZ(ctx, string)); } } static inline void -astring_to_jsval(JSContext *ctx, jsval *vp, unsigned char *string) +astring_to_jsval(JSContext *ctx, JS::Value *vp, unsigned char *string) { string_to_jsval(ctx, vp, string); mem_free_if(string); } static inline void -int_to_jsval(JSContext *ctx, jsval *vp, int number) +int_to_jsval(JSContext *ctx, JS::Value *vp, int number) { - *vp = INT_TO_JSVAL(number); + *vp = JS::Int32Value(number); } static inline void -object_to_jsval(JSContext *ctx, jsval *vp, JSObject *object) +object_to_jsval(JSContext *ctx, JS::Value *vp, JSObject *object) { - *vp = OBJECT_TO_JSVAL(object); + *vp = JS::ObjectValue(*object); } static inline void -boolean_to_jsval(JSContext *ctx, jsval *vp, int boolean) +boolean_to_jsval(JSContext *ctx, JS::Value *vp, int boolean) { - *vp = BOOLEAN_TO_JSVAL(boolean); + *vp = JS::BooleanValue(boolean); } static inline int -jsval_to_boolean(JSContext *ctx, jsval *vp) +jsval_to_boolean(JSContext *ctx, JS::Value *vp) { JS::RootedValue r_vp(ctx, *vp); return (int)r_vp.toBoolean(); diff --git a/src/ecmascript/spidermonkey/window.c b/src/ecmascript/spidermonkey/window.c index 6e5e9e3c..bd4f9d63 100644 --- a/src/ecmascript/spidermonkey/window.c +++ b/src/ecmascript/spidermonkey/window.c @@ -11,6 +11,7 @@ #include "elinks.h" #include "ecmascript/spidermonkey/util.h" +#include #include "bfu/dialog.h" #include "cache/cache.h" @@ -45,12 +46,12 @@ static bool window_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); -static bool window_get_property_closed(JSContext *cx, unsigned int argc, jsval *vp); -static bool window_get_property_parent(JSContext *ctx, unsigned int argc, jsval *vp); -static bool window_get_property_self(JSContext *ctx, unsigned int argc, jsval *vp); -static bool window_get_property_status(JSContext *ctx, unsigned int argc, jsval *vp); -static bool window_set_property_status(JSContext *ctx, unsigned int argc, jsval *vp); -static bool window_get_property_top(JSContext *ctx, unsigned int argc, jsval *vp); +static bool window_get_property_closed(JSContext *cx, unsigned int argc, JS::Value *vp); +static bool window_get_property_parent(JSContext *ctx, unsigned int argc, JS::Value *vp); +static bool window_get_property_self(JSContext *ctx, unsigned int argc, JS::Value *vp); +static bool window_get_property_status(JSContext *ctx, unsigned int argc, JS::Value *vp); +static bool window_set_property_status(JSContext *ctx, unsigned int argc, JS::Value *vp); +static bool window_get_property_top(JSContext *ctx, unsigned int argc, JS::Value *vp); JSClass window_class = { "window", @@ -129,7 +130,6 @@ find_child_frame(struct document_view *doc_view, struct frame_desc *tframe) static bool window_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { - ELINKS_CAST_PROP_PARAMS jsid id = hid.get(); struct view_state *vs; @@ -152,7 +152,7 @@ window_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS: /* TODO: Try other lookups (mainly element lookup) until * something yields data. */ if (obj) { - object_to_jsval(ctx, vp, obj); + hvp.setObject(*obj); } return true; } @@ -160,17 +160,17 @@ window_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS: if (!JSID_IS_INT(id)) return true; - undef_to_jsval(ctx, vp); + hvp.setUndefined(); switch (JSID_TO_INT(id)) { case JSP_WIN_CLOSED: /* TODO: It will be a major PITA to implement this properly. * Well, perhaps not so much if we introduce reference tracking * for (struct session)? Still... --pasky */ - boolean_to_jsval(ctx, vp, 0); + hvp.setBoolean(false); break; case JSP_WIN_SELF: - object_to_jsval(ctx, vp, obj); + hvp.setObject(*hobj.get()); break; case JSP_WIN_PARENT: /* XXX: It would be nice if the following worked, yes. @@ -235,8 +235,9 @@ found_parent: * is alien but some other child window is not, we should still * let the script walk thru. That'd mean moving the check to * other individual properties in this switch. */ - if (compare_uri(vs->uri, top_view->vs->uri, URI_HOST)) - object_to_jsval(ctx, vp, newjsframe); + if (compare_uri(vs->uri, top_view->vs->uri, URI_HOST)) { + hvp.setObject(*newjsframe); + } /* else */ /****X*X*X*** SECURITY VIOLATION! RED ALERT, SHIELDS UP! ***X*X*X****\ |* (Pasky was apparently looking at the Links2 JS code . ___ ^.^ *| @@ -258,9 +259,9 @@ found_parent: void location_goto(struct document_view *doc_view, unsigned char *url); -static bool window_alert(JSContext *ctx, unsigned int argc, jsval *rval); -static bool window_open(JSContext *ctx, unsigned int argc, jsval *rval); -static bool window_setTimeout(JSContext *ctx, unsigned int argc, jsval *rval); +static bool window_alert(JSContext *ctx, unsigned int argc, JS::Value *rval); +static bool window_open(JSContext *ctx, unsigned int argc, JS::Value *rval); +static bool window_setTimeout(JSContext *ctx, unsigned int argc, JS::Value *rval); const spidermonkeyFunctionSpec window_funcs[] = { { "alert", window_alert, 1 }, @@ -271,24 +272,30 @@ const spidermonkeyFunctionSpec window_funcs[] = { /* @window_funcs{"alert"} */ static bool -window_alert(JSContext *ctx, unsigned int argc, jsval *rval) +window_alert(JSContext *ctx, unsigned int argc, JS::Value *rval) { - jsval val; + JS::Value val; JSObject *obj = JS_THIS_OBJECT(ctx, rval); JS::RootedObject hobj(ctx, obj); JS::CallArgs args = JS::CallArgsFromVp(argc, rval); -// jsval *argv = JS_ARGV(ctx, rval); + +// JS::Value *argv = JS_ARGV(ctx, rval); struct view_state *vs; unsigned char *string; - if (!JS_InstanceOf(ctx, hobj, &window_class, &args)) return false; + if (!JS_InstanceOf(ctx, hobj, &window_class, nullptr)) { + return false; + } - vs = JS_GetInstancePrivate(ctx, hobj, &window_class, &args); + vs = JS_GetInstancePrivate(ctx, hobj, &window_class, nullptr); if (argc != 1) return true; - string = jsval_to_string(ctx, args[0].address()); + JSString *str = JS::ToString(ctx, args[0]); + + string = JS_EncodeString(ctx, str); + if (!*string) return true; @@ -301,13 +308,13 @@ window_alert(JSContext *ctx, unsigned int argc, jsval *rval) /* @window_funcs{"open"} */ static bool -window_open(JSContext *ctx, unsigned int argc, jsval *rval) +window_open(JSContext *ctx, unsigned int argc, JS::Value *rval) { - jsval val; + JS::Value val; JSObject *obj = JS_THIS_OBJECT(ctx, rval); JS::RootedObject hobj(ctx, obj); JS::CallArgs args = JS::CallArgsFromVp(argc, rval); -// jsval *argv = JS_ARGV(ctx, rval); +// JS::Value *argv = JS_ARGV(ctx, rval); struct view_state *vs; struct document_view *doc_view; struct session *ses; @@ -414,10 +421,10 @@ end: /* @window_funcs{"setTimeout"} */ static bool -window_setTimeout(JSContext *ctx, unsigned int argc, jsval *rval) +window_setTimeout(JSContext *ctx, unsigned int argc, JS::Value *rval) { JS::CallArgs args = JS::CallArgsFromVp(argc, rval); -// jsval *argv = JS_ARGV(ctx, rval); +// JS::Value *argv = JS_ARGV(ctx, rval); struct ecmascript_interpreter *interpreter = JS_GetContextPrivate(ctx); unsigned char *code; int timeout; @@ -460,7 +467,7 @@ window_get_property_closed(JSContext *ctx, JS::HandleObject hobj, JS::HandleId h #endif static bool -window_get_property_closed(JSContext *ctx, unsigned int argc, jsval *vp) +window_get_property_closed(JSContext *ctx, unsigned int argc, JS::Value *vp) { JS::CallArgs args = CallArgsFromVp(argc, vp); args.rval().setBoolean(false); @@ -469,7 +476,7 @@ window_get_property_closed(JSContext *ctx, unsigned int argc, jsval *vp) } static bool -window_get_property_parent(JSContext *ctx, unsigned int argc, jsval *vp) +window_get_property_parent(JSContext *ctx, unsigned int argc, JS::Value *vp) { JS::CallArgs args = CallArgsFromVp(argc, vp); @@ -489,7 +496,7 @@ window_get_property_parent(JSContext *ctx, unsigned int argc, jsval *vp) } static bool -window_get_property_self(JSContext *ctx, unsigned int argc, jsval *vp) +window_get_property_self(JSContext *ctx, unsigned int argc, JS::Value *vp) { JS::CallArgs args = CallArgsFromVp(argc, vp); args.rval().setObject(args.thisv().toObject()); @@ -498,7 +505,7 @@ window_get_property_self(JSContext *ctx, unsigned int argc, jsval *vp) } static bool -window_get_property_status(JSContext *ctx, unsigned int argc, jsval *vp) +window_get_property_status(JSContext *ctx, unsigned int argc, JS::Value *vp) { JS::CallArgs args = CallArgsFromVp(argc, vp); args.rval().setUndefined(); @@ -507,7 +514,7 @@ window_get_property_status(JSContext *ctx, unsigned int argc, jsval *vp) } static bool -window_set_property_status(JSContext *ctx, unsigned int argc, jsval *vp) +window_set_property_status(JSContext *ctx, unsigned int argc, JS::Value *vp) { JS::CallArgs args = CallArgsFromVp(argc, vp); if (args.length() != 1) { @@ -529,7 +536,7 @@ window_set_property_status(JSContext *ctx, unsigned int argc, jsval *vp) } static bool -window_get_property_top(JSContext *ctx, unsigned int argc, jsval *vp) +window_get_property_top(JSContext *ctx, unsigned int argc, JS::Value *vp) { JS::CallArgs args = CallArgsFromVp(argc, vp); diff --git a/src/scripting/smjs/action_object.c b/src/scripting/smjs/action_object.c index 78d973c3..18c6aeb7 100644 --- a/src/scripting/smjs/action_object.c +++ b/src/scripting/smjs/action_object.c @@ -24,7 +24,7 @@ struct smjs_action_fn_callback_hop { }; static void smjs_action_fn_finalize(JSFreeOp *op, JSObject *obj); -static bool smjs_action_fn_callback(JSContext *ctx, unsigned int argc, jsval *rval); +static bool smjs_action_fn_callback(JSContext *ctx, unsigned int argc, JS::Value *rval); static const JSClass action_fn_class = { "action_fn", @@ -58,9 +58,9 @@ smjs_action_fn_finalize(JSFreeOp *op, JSObject *obj) /* @action_fn_class.call */ static bool -smjs_action_fn_callback(JSContext *ctx, unsigned int argc, jsval *rval) +smjs_action_fn_callback(JSContext *ctx, unsigned int argc, JS::Value *rval) { - jsval value; + JS::Value value; JS::CallArgs args = CallArgsFromVp(argc, rval); struct smjs_action_fn_callback_hop *hop; @@ -164,7 +164,7 @@ action_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS: { jsid id = hid.get(); - jsval val; + JS::Value val; JS::RootedValue rval(ctx, val); JSObject *action_fn; unsigned char *action_str; @@ -206,7 +206,7 @@ smjs_get_action_object(void) void smjs_init_action_interface(void) { - jsval val; + JS::Value val; struct JSObject *action_object; if (!smjs_ctx || !smjs_elinks_object) diff --git a/src/scripting/smjs/bookmarks.c b/src/scripting/smjs/bookmarks.c index 82cd0d2d..fcedbaba 100644 --- a/src/scripting/smjs/bookmarks.c +++ b/src/scripting/smjs/bookmarks.c @@ -84,11 +84,11 @@ enum bookmark_prop { BOOKMARK_CHILDREN = -3, }; -static bool bookmark_get_property_title(JSContext *ctx, unsigned int argc, jsval *vp); -static bool bookmark_set_property_title(JSContext *ctx, unsigned int argc, jsval *vp); -static bool bookmark_get_property_url(JSContext *ctx, unsigned int argc, jsval *vp); -static bool bookmark_set_property_url(JSContext *ctx, unsigned int argc, jsval *vp); -static bool bookmark_get_property_children(JSContext *ctx, unsigned int argc, jsval *vp); +static bool bookmark_get_property_title(JSContext *ctx, unsigned int argc, JS::Value *vp); +static bool bookmark_set_property_title(JSContext *ctx, unsigned int argc, JS::Value *vp); +static bool bookmark_get_property_url(JSContext *ctx, unsigned int argc, JS::Value *vp); +static bool bookmark_set_property_url(JSContext *ctx, unsigned int argc, JS::Value *vp); +static bool bookmark_get_property_children(JSContext *ctx, unsigned int argc, JS::Value *vp); static const JSPropertySpec bookmark_props[] = { JS_PSGS("title", bookmark_get_property_title, bookmark_set_property_title, JSPROP_ENUMERATE), @@ -104,22 +104,22 @@ static JSObject *smjs_get_bookmark_folder_object(struct bookmark *bookmark); * @return true if successful. On error, report the error and * return false. */ static bool -bookmark_string_to_jsval(JSContext *ctx, const unsigned char *str, jsval *vp) +bookmark_string_to_jsval(JSContext *ctx, const unsigned char *str, JS::Value *vp) { JSString *jsstr = utf8_to_jsstring(ctx, str, -1); if (jsstr == NULL) return false; - *vp = STRING_TO_JSVAL(jsstr); + *vp = JS::StringValue(jsstr); return true; } -/** Convert a jsval to a string and store it in struct bookmark. +/** Convert a JS::Value to a string and store it in struct bookmark. * * @param ctx * Context for memory allocations and error reports. * @param val - * The @c jsval that should be converted. + * The @c JS::Value that should be converted. * @param[in,out] result * A string allocated with mem_alloc(). * On success, this function frees the original string, if any. @@ -149,7 +149,7 @@ jsval_to_bookmark_string(JSContext *ctx, JS::HandleValue val, unsigned char **re } static bool -bookmark_get_property_title(JSContext *ctx, unsigned int argc, jsval *vp) +bookmark_get_property_title(JSContext *ctx, unsigned int argc, JS::Value *vp) { JS::CallArgs args = CallArgsFromVp(argc, vp); JS::RootedObject hobj(ctx, &args.thisv().toObject()); @@ -177,7 +177,7 @@ bookmark_get_property_title(JSContext *ctx, unsigned int argc, jsval *vp) } static bool -bookmark_set_property_title(JSContext *ctx, unsigned int argc, jsval *vp) +bookmark_set_property_title(JSContext *ctx, unsigned int argc, JS::Value *vp) { JS::CallArgs args = CallArgsFromVp(argc, vp); JS::RootedObject hobj(ctx, &args.thisv().toObject()); @@ -208,7 +208,7 @@ bookmark_set_property_title(JSContext *ctx, unsigned int argc, jsval *vp) } static bool -bookmark_get_property_url(JSContext *ctx, unsigned int argc, jsval *vp) +bookmark_get_property_url(JSContext *ctx, unsigned int argc, JS::Value *vp) { JS::CallArgs args = CallArgsFromVp(argc, vp); JS::RootedObject hobj(ctx, &args.thisv().toObject()); @@ -236,7 +236,7 @@ bookmark_get_property_url(JSContext *ctx, unsigned int argc, jsval *vp) } static bool -bookmark_set_property_url(JSContext *ctx, unsigned int argc, jsval *vp) +bookmark_set_property_url(JSContext *ctx, unsigned int argc, JS::Value *vp) { JS::CallArgs args = CallArgsFromVp(argc, vp); JS::RootedObject hobj(ctx, &args.thisv().toObject()); @@ -267,7 +267,7 @@ bookmark_set_property_url(JSContext *ctx, unsigned int argc, jsval *vp) } static bool -bookmark_get_property_children(JSContext *ctx, unsigned int argc, jsval *vp) +bookmark_get_property_children(JSContext *ctx, unsigned int argc, JS::Value *vp) { JS::CallArgs args = CallArgsFromVp(argc, vp); JS::RootedObject hobj(ctx, &args.thisv().toObject()); @@ -319,7 +319,7 @@ bookmark_folder_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId struct bookmark *bookmark; struct bookmark *folder; - jsval val; + JS::Value val; JS::RootedValue title_jsval(ctx, val); unsigned char *title = NULL; @@ -360,7 +360,7 @@ smjs_get_bookmark_folder_object(struct bookmark *bookmark) void smjs_init_bookmarks_interface(void) { - jsval val; + JS::Value val; struct JSObject *bookmarks_object; if (!smjs_ctx || !smjs_elinks_object) diff --git a/src/scripting/smjs/cache_object.c b/src/scripting/smjs/cache_object.c index e9c35033..bd6204d2 100644 --- a/src/scripting/smjs/cache_object.c +++ b/src/scripting/smjs/cache_object.c @@ -37,14 +37,14 @@ enum cache_entry_prop { CACHE_ENTRY_URI = -5, }; -static bool cache_entry_get_property_content(JSContext *ctx, unsigned int argc, jsval *vp); -static bool cache_entry_set_property_content(JSContext *ctx, unsigned int argc, jsval *vp); -static bool cache_entry_get_property_type(JSContext *ctx, unsigned int argc, jsval *vp); -static bool cache_entry_set_property_type(JSContext *ctx, unsigned int argc, jsval *vp); -static bool cache_entry_get_property_length(JSContext *ctx, unsigned int argc, jsval *vp); -static bool cache_entry_get_property_head(JSContext *ctx, unsigned int argc, jsval *vp); -static bool cache_entry_set_property_head(JSContext *ctx, unsigned int argc, jsval *vp); -static bool cache_entry_get_property_uri(JSContext *ctx, unsigned int argc, jsval *vp); +static bool cache_entry_get_property_content(JSContext *ctx, unsigned int argc, JS::Value *vp); +static bool cache_entry_set_property_content(JSContext *ctx, unsigned int argc, JS::Value *vp); +static bool cache_entry_get_property_type(JSContext *ctx, unsigned int argc, JS::Value *vp); +static bool cache_entry_set_property_type(JSContext *ctx, unsigned int argc, JS::Value *vp); +static bool cache_entry_get_property_length(JSContext *ctx, unsigned int argc, JS::Value *vp); +static bool cache_entry_get_property_head(JSContext *ctx, unsigned int argc, JS::Value *vp); +static bool cache_entry_set_property_head(JSContext *ctx, unsigned int argc, JS::Value *vp); +static bool cache_entry_get_property_uri(JSContext *ctx, unsigned int argc, JS::Value *vp); static const JSPropertySpec cache_entry_props[] = { JS_PSGS("content", cache_entry_get_property_content, cache_entry_set_property_content, JSPROP_ENUMERATE), @@ -56,7 +56,7 @@ static const JSPropertySpec cache_entry_props[] = { }; static bool -cache_entry_get_property_content(JSContext *ctx, unsigned int argc, jsval *vp) +cache_entry_get_property_content(JSContext *ctx, unsigned int argc, JS::Value *vp) { JS::CallArgs args = CallArgsFromVp(argc, vp); JS::RootedObject hobj(ctx, &args.thisv().toObject()); @@ -100,7 +100,7 @@ cache_entry_get_property_content(JSContext *ctx, unsigned int argc, jsval *vp) } static bool -cache_entry_set_property_content(JSContext *ctx, unsigned int argc, jsval *vp) +cache_entry_set_property_content(JSContext *ctx, unsigned int argc, JS::Value *vp) { JS::CallArgs args = CallArgsFromVp(argc, vp); JS::RootedObject hobj(ctx, &args.thisv().toObject()); @@ -140,7 +140,7 @@ cache_entry_set_property_content(JSContext *ctx, unsigned int argc, jsval *vp) } static bool -cache_entry_get_property_type(JSContext *ctx, unsigned int argc, jsval *vp) +cache_entry_get_property_type(JSContext *ctx, unsigned int argc, JS::Value *vp) { JS::CallArgs args = CallArgsFromVp(argc, vp); JS::RootedObject hobj(ctx, &args.thisv().toObject()); @@ -172,7 +172,7 @@ cache_entry_get_property_type(JSContext *ctx, unsigned int argc, jsval *vp) } static bool -cache_entry_set_property_type(JSContext *ctx, unsigned int argc, jsval *vp) +cache_entry_set_property_type(JSContext *ctx, unsigned int argc, JS::Value *vp) { JS::CallArgs args = CallArgsFromVp(argc, vp); JS::RootedObject hobj(ctx, &args.thisv().toObject()); @@ -297,7 +297,7 @@ smjs_detach_cache_entry_object(struct cache_entry *cached) } static bool -cache_entry_get_property_length(JSContext *ctx, unsigned int argc, jsval *vp) +cache_entry_get_property_length(JSContext *ctx, unsigned int argc, JS::Value *vp) { JS::CallArgs args = CallArgsFromVp(argc, vp); JS::RootedObject hobj(ctx, &args.thisv().toObject()); @@ -329,7 +329,7 @@ cache_entry_get_property_length(JSContext *ctx, unsigned int argc, jsval *vp) } static bool -cache_entry_get_property_head(JSContext *ctx, unsigned int argc, jsval *vp) +cache_entry_get_property_head(JSContext *ctx, unsigned int argc, JS::Value *vp) { JS::CallArgs args = CallArgsFromVp(argc, vp); JS::RootedObject hobj(ctx, &args.thisv().toObject()); @@ -361,7 +361,7 @@ cache_entry_get_property_head(JSContext *ctx, unsigned int argc, jsval *vp) } static bool -cache_entry_set_property_head(JSContext *ctx, unsigned int argc, jsval *vp) +cache_entry_set_property_head(JSContext *ctx, unsigned int argc, JS::Value *vp) { JS::CallArgs args = CallArgsFromVp(argc, vp); JS::RootedObject hobj(ctx, &args.thisv().toObject()); @@ -399,7 +399,7 @@ cache_entry_set_property_head(JSContext *ctx, unsigned int argc, jsval *vp) } static bool -cache_entry_get_property_uri(JSContext *ctx, unsigned int argc, jsval *vp) +cache_entry_get_property_uri(JSContext *ctx, unsigned int argc, JS::Value *vp) { JS::CallArgs args = CallArgsFromVp(argc, vp); JS::RootedObject hobj(ctx, &args.thisv().toObject()); diff --git a/src/scripting/smjs/core.c b/src/scripting/smjs/core.c index 4d2ba394..94285c32 100644 --- a/src/scripting/smjs/core.c +++ b/src/scripting/smjs/core.c @@ -10,6 +10,7 @@ #include "config/home.h" #include "ecmascript/spidermonkey-shared.h" +#include #include "intl/charsets.h" #include "main/module.h" #include "osdep/osdep.h" @@ -41,6 +42,7 @@ error_reporter(JSContext *ctx, const char *message, JSErrorReport *report) { unsigned char *strict, *exception, *warning, *error; struct string msg; + char *prefix = nullptr; if (!init_string(&msg)) goto reported; @@ -55,14 +57,32 @@ error_reporter(JSContext *ctx, const char *message, JSErrorReport *report) add_to_string(&msg, ":\n\n"); add_to_string(&msg, message); - if (report->linebuf && report->tokenptr) { - int pos = report->tokenptr - report->linebuf; + add_format_to_string(&msg, "\n\n%d:%d ", report->lineno, report->column); + + if (report->filename) { + prefix = JS_smprintf("%s:", report->filename); + } + + if (report->lineno) { + char* tmp = prefix; + prefix = JS_smprintf("%s%u:%u ", tmp ? tmp : "", report->lineno, report->column); + JS_free(ctx, tmp); + } + + if (prefix) { + add_to_string(&msg, prefix); + } + +#if 0 + if (report->linebuf) { + int pos = report->offset; add_format_to_string(&msg, "\n\n%s\n.%*s^%*s.", report->linebuf, pos - 2, " ", strlen(report->linebuf) - pos - 1, " "); } +#endif alert_smjs_error(msg.source); done_string(&msg); @@ -79,14 +99,12 @@ smjs_do_file(unsigned char *path) if (!init_string(&script)) return 0; - jsval val; - JS::RootedValue rval(smjs_ctx, val); - JS::RootedObject cg(smjs_ctx, JS::CurrentGlobalOrNull(smjs_ctx)); - - JS::CompileOptions options(smjs_ctx); + JS::CompileOptions opts(smjs_ctx); + opts.setNoScriptRval(true); + JS::RootedValue rval(smjs_ctx); if (!add_file_to_string(&script, path) - || false == JS::Evaluate(smjs_ctx, cg, options, + || false == JS::Evaluate(smjs_ctx, opts, script.source, script.length, &rval)) { alert_smjs_error("error loading script file"); ret = 0; @@ -98,7 +116,7 @@ smjs_do_file(unsigned char *path) } static bool -smjs_do_file_wrapper(JSContext *ctx, unsigned int argc, jsval *rval) +smjs_do_file_wrapper(JSContext *ctx, unsigned int argc, JS::Value *rval) { JS::CallArgs args = CallArgsFromVp(argc, rval); diff --git a/src/scripting/smjs/elinks_object.c b/src/scripting/smjs/elinks_object.c index 7231b941..9a84ca18 100644 --- a/src/scripting/smjs/elinks_object.c +++ b/src/scripting/smjs/elinks_object.c @@ -33,7 +33,7 @@ /* @elinks_funcs{"alert"} */ static bool -elinks_alert(JSContext *ctx, unsigned int argc, jsval *rval) +elinks_alert(JSContext *ctx, unsigned int argc, JS::Value *rval) { JS::CallArgs args = CallArgsFromVp(argc, rval); @@ -69,7 +69,7 @@ elinks_alert(JSContext *ctx, unsigned int argc, jsval *rval) /* @elinks_funcs{"execute"} */ static bool -elinks_execute(JSContext *ctx, unsigned int argc, jsval *rval) +elinks_execute(JSContext *ctx, unsigned int argc, JS::Value *rval) { JS::CallArgs args = CallArgsFromVp(argc, rval); @@ -94,10 +94,10 @@ enum elinks_prop { ELINKS_SESSION, }; -static bool elinks_get_property_home(JSContext *ctx, unsigned int argc, jsval *vp); -static bool elinks_get_property_location(JSContext *ctx, unsigned int argc, jsval *vp); -static bool elinks_set_property_location(JSContext *ctx, unsigned int argc, jsval *vp); -static bool elinks_get_property_session(JSContext *ctx, unsigned int argc, jsval *vp); +static bool elinks_get_property_home(JSContext *ctx, unsigned int argc, JS::Value *vp); +static bool elinks_get_property_location(JSContext *ctx, unsigned int argc, JS::Value *vp); +static bool elinks_set_property_location(JSContext *ctx, unsigned int argc, JS::Value *vp); +static bool elinks_get_property_session(JSContext *ctx, unsigned int argc, JS::Value *vp); static const JSPropertySpec elinks_props[] = { JS_PSG("home", elinks_get_property_home, JSPROP_ENUMERATE), JS_PSGS("location", elinks_get_property_location, elinks_set_property_location, JSPROP_ENUMERATE), @@ -106,7 +106,7 @@ static const JSPropertySpec elinks_props[] = { }; static bool elinks_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); -static bool elinks_set_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, bool strict, JS::MutableHandleValue hvp); +static bool elinks_set_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); static const JSClass elinks_class = { "elinks", @@ -176,7 +176,7 @@ elinks_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS: } static bool -elinks_set_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, bool strict, JS::MutableHandleValue hvp) +elinks_set_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { jsid id = hid.get(); @@ -254,7 +254,7 @@ smjs_init_elinks_object(void) /* If elinks. is defined, call it with the given arguments, * store the return value in rval, and return true. Else return false. */ bool -smjs_invoke_elinks_object_method(unsigned char *method, int argc, jsval *argv, JS::MutableHandleValue rval) +smjs_invoke_elinks_object_method(unsigned char *method, int argc, JS::Value *argv, JS::MutableHandleValue rval) { JS::CallArgs args = CallArgsFromVp(argc, argv); @@ -263,7 +263,7 @@ smjs_invoke_elinks_object_method(unsigned char *method, int argc, jsval *argv, J assert(argv); JS::RootedObject r_smjs_elinks_object(smjs_ctx, smjs_elinks_object); - jsval val; + JS::Value val; JS::RootedValue fun(smjs_ctx, val); if (false == JS_GetProperty(smjs_ctx, r_smjs_elinks_object, @@ -277,7 +277,7 @@ smjs_invoke_elinks_object_method(unsigned char *method, int argc, jsval *argv, J } static bool -elinks_get_property_home(JSContext *ctx, unsigned int argc, jsval *vp) +elinks_get_property_home(JSContext *ctx, unsigned int argc, JS::Value *vp) { JS::CallArgs args = CallArgsFromVp(argc, vp); JS::RootedObject hobj(ctx, &args.thisv().toObject()); @@ -294,7 +294,7 @@ elinks_get_property_home(JSContext *ctx, unsigned int argc, jsval *vp) } static bool -elinks_get_property_location(JSContext *ctx, unsigned int argc, jsval *vp) +elinks_get_property_location(JSContext *ctx, unsigned int argc, JS::Value *vp) { JS::CallArgs args = CallArgsFromVp(argc, vp); JS::RootedObject hobj(ctx, &args.thisv().toObject()); @@ -316,7 +316,7 @@ elinks_get_property_location(JSContext *ctx, unsigned int argc, jsval *vp) } static bool -elinks_set_property_location(JSContext *ctx, unsigned int argc, jsval *vp) +elinks_set_property_location(JSContext *ctx, unsigned int argc, JS::Value *vp) { JS::CallArgs args = CallArgsFromVp(argc, vp); JS::RootedObject hobj(ctx, &args.thisv().toObject()); @@ -344,7 +344,7 @@ elinks_set_property_location(JSContext *ctx, unsigned int argc, jsval *vp) } static bool -elinks_get_property_session(JSContext *ctx, unsigned int argc, jsval *vp) +elinks_get_property_session(JSContext *ctx, unsigned int argc, JS::Value *vp) { JS::CallArgs args = CallArgsFromVp(argc, vp); JS::RootedObject hobj(ctx, &args.thisv().toObject()); diff --git a/src/scripting/smjs/elinks_object.h b/src/scripting/smjs/elinks_object.h index 5b519151..da9a6c54 100644 --- a/src/scripting/smjs/elinks_object.h +++ b/src/scripting/smjs/elinks_object.h @@ -12,6 +12,6 @@ void smjs_init_elinks_object(void); /* Invoke elinks. with the given arguments and put the return value * into *rval. */ -bool smjs_invoke_elinks_object_method(unsigned char *method, int argc, jsval *argv, JS::MutableHandleValue rval); +bool smjs_invoke_elinks_object_method(unsigned char *method, int argc, JS::Value *argv, JS::MutableHandleValue rval); #endif diff --git a/src/scripting/smjs/globhist.c b/src/scripting/smjs/globhist.c index 343985dd..52f618ac 100644 --- a/src/scripting/smjs/globhist.c +++ b/src/scripting/smjs/globhist.c @@ -13,7 +13,7 @@ #include "util/memory.h" static bool smjs_globhist_item_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); -static bool smjs_globhist_item_set_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, bool strict, JS::MutableHandleValue hvp); +static bool smjs_globhist_item_set_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); static void smjs_globhist_item_finalize(JSFreeOp *op, JSObject *obj); @@ -51,12 +51,12 @@ enum smjs_globhist_item_prop { GLOBHIST_LAST_VISIT = -3, }; -static bool smjs_globhist_item_get_property_title(JSContext *ctx, unsigned int argc, jsval *vp); -static bool smjs_globhist_item_set_property_title(JSContext *ctx, unsigned int argc, jsval *vp); -static bool smjs_globhist_item_get_property_url(JSContext *ctx, unsigned int argc, jsval *vp); -static bool smjs_globhist_item_set_property_url(JSContext *ctx, unsigned int argc, jsval *vp); -static bool smjs_globhist_item_get_property_last_visit(JSContext *ctx, unsigned int argc, jsval *vp); -static bool smjs_globhist_item_set_property_last_visit(JSContext *ctx, unsigned int argc, jsval *vp); +static bool smjs_globhist_item_get_property_title(JSContext *ctx, unsigned int argc, JS::Value *vp); +static bool smjs_globhist_item_set_property_title(JSContext *ctx, unsigned int argc, JS::Value *vp); +static bool smjs_globhist_item_get_property_url(JSContext *ctx, unsigned int argc, JS::Value *vp); +static bool smjs_globhist_item_set_property_url(JSContext *ctx, unsigned int argc, JS::Value *vp); +static bool smjs_globhist_item_get_property_last_visit(JSContext *ctx, unsigned int argc, JS::Value *vp); +static bool smjs_globhist_item_set_property_last_visit(JSContext *ctx, unsigned int argc, JS::Value *vp); static const JSPropertySpec smjs_globhist_item_props[] = { JS_PSGS("title", smjs_globhist_item_get_property_title, smjs_globhist_item_set_property_title, JSPROP_ENUMERATE), @@ -133,7 +133,7 @@ smjs_globhist_item_get_property(JSContext *ctx, JS::HandleObject hobj, JS::Handl /* @smjs_globhist_item_class.setProperty */ static bool -smjs_globhist_item_set_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, bool strict, JS::MutableHandleValue hvp) +smjs_globhist_item_set_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { jsid id = hid.get(); @@ -217,7 +217,7 @@ smjs_globhist_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId h JSObject *jsobj; unsigned char *uri_string; struct global_history_item *history_item; - jsval tmp; + JS::Value tmp; JS::RootedValue r_tmp(ctx, tmp); @@ -264,7 +264,7 @@ smjs_get_globhist_object(void) void smjs_init_globhist_interface(void) { - jsval val; + JS::Value val; struct JSObject *globhist; if (!smjs_ctx || !smjs_elinks_object) @@ -281,7 +281,7 @@ smjs_init_globhist_interface(void) } static bool -smjs_globhist_item_get_property_title(JSContext *ctx, unsigned int argc, jsval *vp) +smjs_globhist_item_get_property_title(JSContext *ctx, unsigned int argc, JS::Value *vp) { JS::CallArgs args = CallArgsFromVp(argc, vp); JS::RootedObject hobj(ctx, &args.thisv().toObject()); @@ -306,7 +306,7 @@ smjs_globhist_item_get_property_title(JSContext *ctx, unsigned int argc, jsval * } static bool -smjs_globhist_item_set_property_title(JSContext *ctx, unsigned int argc, jsval *vp) +smjs_globhist_item_set_property_title(JSContext *ctx, unsigned int argc, JS::Value *vp) { JS::CallArgs args = CallArgsFromVp(argc, vp); JS::RootedObject hobj(ctx, &args.thisv().toObject()); @@ -335,7 +335,7 @@ smjs_globhist_item_set_property_title(JSContext *ctx, unsigned int argc, jsval * } static bool -smjs_globhist_item_get_property_url(JSContext *ctx, unsigned int argc, jsval *vp) +smjs_globhist_item_get_property_url(JSContext *ctx, unsigned int argc, JS::Value *vp) { JS::CallArgs args = CallArgsFromVp(argc, vp); JS::RootedObject hobj(ctx, &args.thisv().toObject()); @@ -360,7 +360,7 @@ smjs_globhist_item_get_property_url(JSContext *ctx, unsigned int argc, jsval *vp } static bool -smjs_globhist_item_set_property_url(JSContext *ctx, unsigned int argc, jsval *vp) +smjs_globhist_item_set_property_url(JSContext *ctx, unsigned int argc, JS::Value *vp) { JS::CallArgs args = CallArgsFromVp(argc, vp); JS::RootedObject hobj(ctx, &args.thisv().toObject()); @@ -389,7 +389,7 @@ smjs_globhist_item_set_property_url(JSContext *ctx, unsigned int argc, jsval *vp } static bool -smjs_globhist_item_get_property_last_visit(JSContext *ctx, unsigned int argc, jsval *vp) +smjs_globhist_item_get_property_last_visit(JSContext *ctx, unsigned int argc, JS::Value *vp) { JS::CallArgs args = CallArgsFromVp(argc, vp); JS::RootedObject hobj(ctx, &args.thisv().toObject()); @@ -431,7 +431,7 @@ smjs_globhist_item_get_property_last_visit(JSContext *ctx, unsigned int argc, js /* @smjs_globhist_item_class.setProperty */ static bool -smjs_globhist_item_set_property_last_visit(JSContext *ctx, unsigned int argc, jsval *vp) +smjs_globhist_item_set_property_last_visit(JSContext *ctx, unsigned int argc, JS::Value *vp) { JS::CallArgs args = CallArgsFromVp(argc, vp); JS::RootedObject hobj(ctx, &args.thisv().toObject()); diff --git a/src/scripting/smjs/hooks.c b/src/scripting/smjs/hooks.c index 9edb3be4..0359927a 100644 --- a/src/scripting/smjs/hooks.c +++ b/src/scripting/smjs/hooks.c @@ -27,7 +27,7 @@ script_hook_url(va_list ap, void *data) unsigned char **url = va_arg(ap, unsigned char **); struct session *ses = va_arg(ap, struct session *); enum evhook_status ret = EVENT_HOOK_STATUS_NEXT; - jsval args[3], rval; + JS::Value args[3], rval; JS::RootedValue r_rval(smjs_ctx, rval); if (*url == NULL) return EVENT_HOOK_STATUS_NEXT; @@ -59,7 +59,7 @@ script_hook_pre_format_html(va_list ap, void *data) struct cache_entry *cached = va_arg(ap, struct cache_entry *); enum evhook_status ret = EVENT_HOOK_STATUS_NEXT; JSObject *cache_entry_object, *view_state_object = NULL; - jsval args[4], rval; + JS::Value args[4], rval; JS::RootedValue r_rval(smjs_ctx, rval); evhook_use_params(ses && cached); diff --git a/src/scripting/smjs/keybinding.c b/src/scripting/smjs/keybinding.c index dc0aa03f..460d72b3 100644 --- a/src/scripting/smjs/keybinding.c +++ b/src/scripting/smjs/keybinding.c @@ -14,7 +14,7 @@ #include "util/memory.h" static bool keymap_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); -static bool keymap_set_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, bool strict, JS::MutableHandleValue hvp); +static bool keymap_set_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); static void keymap_finalize(JSFreeOp *op, JSObject *obj); static const JSClass keymap_class = { @@ -34,7 +34,7 @@ keymap_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS: unsigned char *action_str; const unsigned char *keystroke_str; int *data; - jsval tmp; + JS::Value tmp; JS::RootedValue r_tmp(ctx, tmp); /* This can be called if @obj if not itself an instance of the @@ -46,6 +46,8 @@ keymap_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS: data = JS_GetInstancePrivate(ctx, hobj, (JSClass *) &keymap_class, NULL); + + if (!JS_IdToValue(ctx, id, &r_tmp)) goto ret_null; @@ -71,7 +73,7 @@ smjs_keybinding_action_callback(va_list ap, void *data) { JS::CallArgs args; - jsval rval; + JS::Value rval; JS::RootedValue r_rval(smjs_ctx, rval); struct session *ses = va_arg(ap, struct session *); JSObject *jsobj = data; @@ -80,11 +82,11 @@ smjs_keybinding_action_callback(va_list ap, void *data) smjs_ses = ses; - jsval r2; + JS::Value r2; JS::RootedValue r_jsobject(smjs_ctx, r2); r_jsobject.setObject(*jsobj); - JS_CallFunctionValue(smjs_ctx, JS::NullPtr(), r_jsobject, + JS_CallFunctionValue(smjs_ctx, nullptr, r_jsobject, args, &r_rval); smjs_ses = NULL; @@ -94,20 +96,20 @@ smjs_keybinding_action_callback(va_list ap, void *data) /* @keymap_class.setProperty */ static bool -keymap_set_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, bool strict, JS::MutableHandleValue hvp) +keymap_set_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { jsid id = hid.get(); int *data; unsigned char *keymap_str; - jsval val; const unsigned char *keystroke_str; /* This can be called if @obj if not itself an instance of the * appropriate class but has one in its prototype chain. Fail * such calls. */ - if (!JS_InstanceOf(ctx, hobj, (JSClass *) &keymap_class, NULL)) + if (!JS_InstanceOf(ctx, hobj, (JSClass *) &keymap_class, NULL)) { return false; + } data = JS_GetInstancePrivate(ctx, hobj, (JSClass *) &keymap_class, NULL); @@ -115,11 +117,13 @@ keymap_set_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, boo /* Ugly fact: we need to get the string from the id to give to bind_do, * which will of course then convert the string back to an id... */ keymap_str = get_keymap_name((enum keymap_id) *data); + if (!keymap_str) return false; - JS::RootedValue rval(ctx, val); + JS::RootedValue rval(ctx); JS_IdToValue(ctx, id, &rval); keystroke_str = JS_EncodeString(ctx, rval.toString()); + if (!keystroke_str) return false; if (hvp.isString()) { @@ -134,6 +138,7 @@ keymap_set_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, boo return true; } else if (hvp.isNull()) { /* before JSVAL_IS_OBJECT */ + if (bind_do(keymap_str, keystroke_str, "none", 0)) return false; @@ -226,7 +231,6 @@ static const JSClass keymaps_hash_class = { static JSObject * smjs_get_keymap_hash_object(void) { - jsval val; int keymap_id; JSObject *keymaps_hash; @@ -234,7 +238,7 @@ smjs_get_keymap_hash_object(void) if (!keymaps_hash) return NULL; JS::RootedObject r_keymaps_hash(smjs_ctx, keymaps_hash); - JS::RootedValue r_val(smjs_ctx, val); + JS::RootedValue r_val(smjs_ctx); for (keymap_id = 0; keymap_id < KEYMAP_MAX; ++keymap_id) { unsigned char *keymap_str = get_keymap_name(keymap_id); @@ -245,7 +249,6 @@ smjs_get_keymap_hash_object(void) if (!map) return NULL; r_val.setObject(*map); - JS_SetProperty(smjs_ctx, r_keymaps_hash, keymap_str, r_val); } @@ -255,7 +258,6 @@ smjs_get_keymap_hash_object(void) void smjs_init_keybinding_interface(void) { - jsval val; struct JSObject *keymaps_hash; if (!smjs_ctx || !smjs_elinks_object) @@ -264,7 +266,7 @@ smjs_init_keybinding_interface(void) keymaps_hash = smjs_get_keymap_hash_object(); if (!keymaps_hash) return; - JS::RootedValue r_val(smjs_ctx, val); + JS::RootedValue r_val(smjs_ctx); r_val.setObject(*keymaps_hash); JS::RootedObject r_smjs_elinks_object(smjs_ctx, smjs_elinks_object); diff --git a/src/scripting/smjs/load_uri.c b/src/scripting/smjs/load_uri.c index fd23efcf..646d6348 100644 --- a/src/scripting/smjs/load_uri.c +++ b/src/scripting/smjs/load_uri.c @@ -21,7 +21,7 @@ struct smjs_load_uri_hop { /* SpiderMonkey versions earlier than 1.8 cannot properly call * a closure if given just a JSFunction pointer. They need a - * jsval that points to the corresponding JSObject. Besides, + * JS::Value that points to the corresponding JSObject. Besides, * JS_AddNamedRoot is not documented to support JSFunction * pointers. */ JS::MutableHandleValue callback; @@ -33,7 +33,7 @@ smjs_loading_callback(struct download *download, void *data) struct session *saved_smjs_ses = smjs_ses; struct smjs_load_uri_hop *hop = data; - jsval args[1], rval; + JS::Value args[1], rval; JSObject *cache_entry_object; if (is_in_progress_state(download->state)) return; @@ -55,10 +55,10 @@ smjs_loading_callback(struct download *download, void *data) cache_entry_object = smjs_get_cache_entry_object(download->cached); if (!cache_entry_object) goto end; - args[0] = OBJECT_TO_JSVAL(cache_entry_object); + args[0] = JS::ObjectValue(*cache_entry_object); argv = CallArgsFromVp(1, args); - JS_CallFunctionValue(smjs_ctx, JS::NullPtr(), hop->callback, argv, &r_rval); + JS_CallFunctionValue(smjs_ctx, nullptr, hop->callback, argv, &r_rval); end: if (download->cached) @@ -70,7 +70,7 @@ end: } static bool -smjs_load_uri(JSContext *ctx, unsigned int argc, jsval *rval) +smjs_load_uri(JSContext *ctx, unsigned int argc, JS::Value *rval) { JS::CallArgs args = CallArgsFromVp(argc, rval); diff --git a/src/scripting/smjs/session_object.c b/src/scripting/smjs/session_object.c index 65f2eaea..8366e317 100644 --- a/src/scripting/smjs/session_object.c +++ b/src/scripting/smjs/session_object.c @@ -31,13 +31,13 @@ static JSObject *smjs_session_object; static bool session_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); -static bool session_set_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, bool strict, JS::MutableHandleValue hvp); +static bool session_set_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); static void session_finalize(JSFreeOp *op, JSObject *obj); -static bool session_construct(JSContext *ctx, unsigned int argc, jsval *rval); +static bool session_construct(JSContext *ctx, unsigned int argc, JS::Value *rval); static const JSClass session_class = { "session", - JSCLASS_HAS_PRIVATE | JSCLASS_IMPLEMENTS_BARRIERS, /* struct session *; a weak reference */ + JSCLASS_HAS_PRIVATE, /* struct session *; a weak reference */ JS_PropertyStub, nullptr, session_get_property, session_set_property, nullptr, nullptr, nullptr, session_finalize, @@ -164,30 +164,30 @@ smjs_get_session_location_array_object(struct session *ses) * smjs_detach_session_object detaches both session.jsobject and * session.history.js_object. */ -static bool session_get_property_visited(JSContext *ctx, unsigned int argc, jsval *vp); -static bool session_set_property_visited(JSContext *ctx, unsigned int argc, jsval *vp); -static bool session_get_property_history(JSContext *ctx, unsigned int argc, jsval *vp); -static bool session_get_property_loading_uri(JSContext *ctx, unsigned int argc, jsval *vp); -static bool session_get_property_reloadlevel(JSContext *ctx, unsigned int argc, jsval *vp); -static bool session_set_property_reloadlevel(JSContext *ctx, unsigned int argc, jsval *vp); -static bool session_get_property_redirect_cnt(JSContext *ctx, unsigned int argc, jsval *vp); -static bool session_set_property_redirect_cnt(JSContext *ctx, unsigned int argc, jsval *vp); -static bool session_get_property_search_direction(JSContext *ctx, unsigned int argc, jsval *vp); -static bool session_set_property_search_direction(JSContext *ctx, unsigned int argc, jsval *vp); -static bool session_get_property_kbdprefix(JSContext *ctx, unsigned int argc, jsval *vp); -static bool session_set_property_kbdprefix(JSContext *ctx, unsigned int argc, jsval *vp); +static bool session_get_property_visited(JSContext *ctx, unsigned int argc, JS::Value *vp); +static bool session_set_property_visited(JSContext *ctx, unsigned int argc, JS::Value *vp); +static bool session_get_property_history(JSContext *ctx, unsigned int argc, JS::Value *vp); +static bool session_get_property_loading_uri(JSContext *ctx, unsigned int argc, JS::Value *vp); +static bool session_get_property_reloadlevel(JSContext *ctx, unsigned int argc, JS::Value *vp); +static bool session_set_property_reloadlevel(JSContext *ctx, unsigned int argc, JS::Value *vp); +static bool session_get_property_redirect_cnt(JSContext *ctx, unsigned int argc, JS::Value *vp); +static bool session_set_property_redirect_cnt(JSContext *ctx, unsigned int argc, JS::Value *vp); +static bool session_get_property_search_direction(JSContext *ctx, unsigned int argc, JS::Value *vp); +static bool session_set_property_search_direction(JSContext *ctx, unsigned int argc, JS::Value *vp); +static bool session_get_property_kbdprefix(JSContext *ctx, unsigned int argc, JS::Value *vp); +static bool session_set_property_kbdprefix(JSContext *ctx, unsigned int argc, JS::Value *vp); -static bool session_get_property_mark(JSContext *ctx, unsigned int argc, jsval *vp); -static bool session_set_property_mark(JSContext *ctx, unsigned int argc, jsval *vp); -static bool session_get_property_exit_query(JSContext *ctx, unsigned int argc, jsval *vp); -static bool session_get_property_insert_mode(JSContext *ctx, unsigned int argc, jsval *vp); -static bool session_set_property_insert_mode(JSContext *ctx, unsigned int argc, jsval *vp); -static bool session_get_property_navigate_mode(JSContext *ctx, unsigned int argc, jsval *vp); -static bool session_set_property_navigate_mode(JSContext *ctx, unsigned int argc, jsval *vp); -static bool session_get_property_search_word(JSContext *ctx, unsigned int argc, jsval *vp); -static bool session_set_property_search_word(JSContext *ctx, unsigned int argc, jsval *vp); -static bool session_get_property_last_search_word(JSContext *ctx, unsigned int argc, jsval *vp); -static bool session_set_property_last_search_word(JSContext *ctx, unsigned int argc, jsval *vp); +static bool session_get_property_mark(JSContext *ctx, unsigned int argc, JS::Value *vp); +static bool session_set_property_mark(JSContext *ctx, unsigned int argc, JS::Value *vp); +static bool session_get_property_exit_query(JSContext *ctx, unsigned int argc, JS::Value *vp); +static bool session_get_property_insert_mode(JSContext *ctx, unsigned int argc, JS::Value *vp); +static bool session_set_property_insert_mode(JSContext *ctx, unsigned int argc, JS::Value *vp); +static bool session_get_property_navigate_mode(JSContext *ctx, unsigned int argc, JS::Value *vp); +static bool session_set_property_navigate_mode(JSContext *ctx, unsigned int argc, JS::Value *vp); +static bool session_get_property_search_word(JSContext *ctx, unsigned int argc, JS::Value *vp); +static bool session_set_property_search_word(JSContext *ctx, unsigned int argc, JS::Value *vp); +static bool session_get_property_last_search_word(JSContext *ctx, unsigned int argc, JS::Value *vp); +static bool session_set_property_last_search_word(JSContext *ctx, unsigned int argc, JS::Value *vp); enum session_prop { SESSION_VISITED, @@ -229,7 +229,7 @@ static const JSPropertySpec session_props[] = { }; static bool -session_get_property_visited(JSContext *ctx, unsigned int argc, jsval *vp) +session_get_property_visited(JSContext *ctx, unsigned int argc, JS::Value *vp) { JS::CallArgs args = CallArgsFromVp(argc, vp); JS::RootedObject hobj(ctx, &args.thisv().toObject()); @@ -252,7 +252,7 @@ session_get_property_visited(JSContext *ctx, unsigned int argc, jsval *vp) } static bool -session_get_property_history(JSContext *ctx, unsigned int argc, jsval *vp) +session_get_property_history(JSContext *ctx, unsigned int argc, JS::Value *vp) { JS::CallArgs args = CallArgsFromVp(argc, vp); JS::RootedObject hobj(ctx, &args.thisv().toObject()); @@ -281,7 +281,7 @@ session_get_property_history(JSContext *ctx, unsigned int argc, jsval *vp) } static bool -session_get_property_loading_uri(JSContext *ctx, unsigned int argc, jsval *vp) +session_get_property_loading_uri(JSContext *ctx, unsigned int argc, JS::Value *vp) { JS::CallArgs args = CallArgsFromVp(argc, vp); JS::RootedObject hobj(ctx, &args.thisv().toObject()); @@ -311,7 +311,7 @@ session_get_property_loading_uri(JSContext *ctx, unsigned int argc, jsval *vp) } static bool -session_get_property_reloadlevel(JSContext *ctx, unsigned int argc, jsval *vp) +session_get_property_reloadlevel(JSContext *ctx, unsigned int argc, JS::Value *vp) { JS::CallArgs args = CallArgsFromVp(argc, vp); JS::RootedObject hobj(ctx, &args.thisv().toObject()); @@ -334,7 +334,7 @@ session_get_property_reloadlevel(JSContext *ctx, unsigned int argc, jsval *vp) } static bool -session_get_property_redirect_cnt(JSContext *ctx, unsigned int argc, jsval *vp) +session_get_property_redirect_cnt(JSContext *ctx, unsigned int argc, JS::Value *vp) { JS::CallArgs args = CallArgsFromVp(argc, vp); JS::RootedObject hobj(ctx, &args.thisv().toObject()); @@ -357,7 +357,7 @@ session_get_property_redirect_cnt(JSContext *ctx, unsigned int argc, jsval *vp) } static bool -session_get_property_search_direction(JSContext *ctx, unsigned int argc, jsval *vp) +session_get_property_search_direction(JSContext *ctx, unsigned int argc, JS::Value *vp) { JS::CallArgs args = CallArgsFromVp(argc, vp); JS::RootedObject hobj(ctx, &args.thisv().toObject()); @@ -380,7 +380,7 @@ session_get_property_search_direction(JSContext *ctx, unsigned int argc, jsval * } static bool -session_get_property_kbdprefix(JSContext *ctx, unsigned int argc, jsval *vp) +session_get_property_kbdprefix(JSContext *ctx, unsigned int argc, JS::Value *vp) { JS::CallArgs args = CallArgsFromVp(argc, vp); JS::RootedObject hobj(ctx, &args.thisv().toObject()); @@ -403,7 +403,7 @@ session_get_property_kbdprefix(JSContext *ctx, unsigned int argc, jsval *vp) } static bool -session_get_property_mark(JSContext *ctx, unsigned int argc, jsval *vp) +session_get_property_mark(JSContext *ctx, unsigned int argc, JS::Value *vp) { JS::CallArgs args = CallArgsFromVp(argc, vp); JS::RootedObject hobj(ctx, &args.thisv().toObject()); @@ -430,7 +430,7 @@ session_get_property_mark(JSContext *ctx, unsigned int argc, jsval *vp) } static bool -session_get_property_exit_query(JSContext *ctx, unsigned int argc, jsval *vp) +session_get_property_exit_query(JSContext *ctx, unsigned int argc, JS::Value *vp) { JS::CallArgs args = CallArgsFromVp(argc, vp); JS::RootedObject hobj(ctx, &args.thisv().toObject()); @@ -453,7 +453,7 @@ session_get_property_exit_query(JSContext *ctx, unsigned int argc, jsval *vp) } static bool -session_get_property_insert_mode(JSContext *ctx, unsigned int argc, jsval *vp) +session_get_property_insert_mode(JSContext *ctx, unsigned int argc, JS::Value *vp) { JS::CallArgs args = CallArgsFromVp(argc, vp); JS::RootedObject hobj(ctx, &args.thisv().toObject()); @@ -481,7 +481,7 @@ session_get_property_insert_mode(JSContext *ctx, unsigned int argc, jsval *vp) } static bool -session_get_property_navigate_mode(JSContext *ctx, unsigned int argc, jsval *vp) +session_get_property_navigate_mode(JSContext *ctx, unsigned int argc, JS::Value *vp) { JS::CallArgs args = CallArgsFromVp(argc, vp); JS::RootedObject hobj(ctx, &args.thisv().toObject()); @@ -507,7 +507,7 @@ session_get_property_navigate_mode(JSContext *ctx, unsigned int argc, jsval *vp) } static bool -session_get_property_search_word(JSContext *ctx, unsigned int argc, jsval *vp) +session_get_property_search_word(JSContext *ctx, unsigned int argc, JS::Value *vp) { JS::CallArgs args = CallArgsFromVp(argc, vp); JS::RootedObject hobj(ctx, &args.thisv().toObject()); @@ -530,7 +530,7 @@ session_get_property_search_word(JSContext *ctx, unsigned int argc, jsval *vp) } static bool -session_get_property_last_search_word(JSContext *ctx, unsigned int argc, jsval *vp) +session_get_property_last_search_word(JSContext *ctx, unsigned int argc, JS::Value *vp) { JS::CallArgs args = CallArgsFromVp(argc, vp); JS::RootedObject hobj(ctx, &args.thisv().toObject()); @@ -580,7 +580,7 @@ session_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS } static bool -session_set_property_visited(JSContext *ctx, unsigned int argc, jsval *vp) +session_set_property_visited(JSContext *ctx, unsigned int argc, JS::Value *vp) { JS::CallArgs args = CallArgsFromVp(argc, vp); JS::RootedObject hobj(ctx, &args.thisv().toObject()); @@ -604,7 +604,7 @@ session_set_property_visited(JSContext *ctx, unsigned int argc, jsval *vp) } static bool -session_set_property_reloadlevel(JSContext *ctx, unsigned int argc, jsval *vp) +session_set_property_reloadlevel(JSContext *ctx, unsigned int argc, JS::Value *vp) { JS::CallArgs args = CallArgsFromVp(argc, vp); JS::RootedObject hobj(ctx, &args.thisv().toObject()); @@ -627,7 +627,7 @@ session_set_property_reloadlevel(JSContext *ctx, unsigned int argc, jsval *vp) } static bool -session_set_property_redirect_cnt(JSContext *ctx, unsigned int argc, jsval *vp) +session_set_property_redirect_cnt(JSContext *ctx, unsigned int argc, JS::Value *vp) { JS::CallArgs args = CallArgsFromVp(argc, vp); JS::RootedObject hobj(ctx, &args.thisv().toObject()); @@ -650,7 +650,7 @@ session_set_property_redirect_cnt(JSContext *ctx, unsigned int argc, jsval *vp) } static bool -session_set_property_search_direction(JSContext *ctx, unsigned int argc, jsval *vp) +session_set_property_search_direction(JSContext *ctx, unsigned int argc, JS::Value *vp) { JS::CallArgs args = CallArgsFromVp(argc, vp); JS::RootedObject hobj(ctx, &args.thisv().toObject()); @@ -687,7 +687,7 @@ session_set_property_search_direction(JSContext *ctx, unsigned int argc, jsval * } static bool -session_set_property_kbdprefix(JSContext *ctx, unsigned int argc, jsval *vp) +session_set_property_kbdprefix(JSContext *ctx, unsigned int argc, JS::Value *vp) { JS::CallArgs args = CallArgsFromVp(argc, vp); JS::RootedObject hobj(ctx, &args.thisv().toObject()); @@ -710,7 +710,7 @@ session_set_property_kbdprefix(JSContext *ctx, unsigned int argc, jsval *vp) } static bool -session_set_property_mark(JSContext *ctx, unsigned int argc, jsval *vp) +session_set_property_mark(JSContext *ctx, unsigned int argc, JS::Value *vp) { JS::CallArgs args = CallArgsFromVp(argc, vp); JS::RootedObject hobj(ctx, &args.thisv().toObject()); @@ -749,7 +749,7 @@ session_set_property_mark(JSContext *ctx, unsigned int argc, jsval *vp) } static bool -session_set_property_insert_mode(JSContext *ctx, unsigned int argc, jsval *vp) +session_set_property_insert_mode(JSContext *ctx, unsigned int argc, JS::Value *vp) { JS::CallArgs args = CallArgsFromVp(argc, vp); JS::RootedObject hobj(ctx, &args.thisv().toObject()); @@ -788,7 +788,7 @@ session_set_property_insert_mode(JSContext *ctx, unsigned int argc, jsval *vp) } static bool -session_set_property_navigate_mode(JSContext *ctx, unsigned int argc, jsval *vp) +session_set_property_navigate_mode(JSContext *ctx, unsigned int argc, JS::Value *vp) { JS::CallArgs args = CallArgsFromVp(argc, vp); JS::RootedObject hobj(ctx, &args.thisv().toObject()); @@ -825,7 +825,7 @@ session_set_property_navigate_mode(JSContext *ctx, unsigned int argc, jsval *vp) } static bool -session_set_property_search_word(JSContext *ctx, unsigned int argc, jsval *vp) +session_set_property_search_word(JSContext *ctx, unsigned int argc, JS::Value *vp) { JS::CallArgs args = CallArgsFromVp(argc, vp); JS::RootedObject hobj(ctx, &args.thisv().toObject()); @@ -857,7 +857,7 @@ session_set_property_search_word(JSContext *ctx, unsigned int argc, jsval *vp) } static bool -session_set_property_last_search_word(JSContext *ctx, unsigned int argc, jsval *vp) +session_set_property_last_search_word(JSContext *ctx, unsigned int argc, JS::Value *vp) { JS::CallArgs args = CallArgsFromVp(argc, vp); JS::RootedObject hobj(ctx, &args.thisv().toObject()); @@ -891,7 +891,7 @@ session_set_property_last_search_word(JSContext *ctx, unsigned int argc, jsval * static bool -session_set_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, bool strict, JS::MutableHandleValue hvp) +session_set_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { jsid id = hid.get(); @@ -916,12 +916,12 @@ session_set_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, bo /** Pointed to by session_class.construct. Create a new session (tab) * and return the JSObject wrapper. */ static bool -session_construct(JSContext *ctx, unsigned int argc, jsval *rval) +session_construct(JSContext *ctx, unsigned int argc, JS::Value *rval) { JS::CallArgs args = CallArgsFromVp(argc, rval); //JS::RootedObject hobj(ctx, &args.thisv().toObject()); - jsval val; + JS::Value val; int bg = 0; /* open new tab in background */ struct session *ses; JSObject *jsobj; @@ -1124,7 +1124,7 @@ smjs_detach_session_array_object(struct terminal *term) } static bool -smjs_session_goto_url(JSContext *ctx, unsigned int argc, jsval *rval) +smjs_session_goto_url(JSContext *ctx, unsigned int argc, JS::Value *rval) { JS::CallArgs args = CallArgsFromVp(argc, rval); JS::RootedObject this_o(ctx, &args.thisv().toObject()); diff --git a/src/scripting/smjs/terminal_object.c b/src/scripting/smjs/terminal_object.c index bbc2633f..49506f65 100644 --- a/src/scripting/smjs/terminal_object.c +++ b/src/scripting/smjs/terminal_object.c @@ -209,7 +209,7 @@ smjs_get_terminal_array_object(void) void smjs_init_terminal_interface(void) { - jsval val; + JS::Value val; struct JSObject *obj; if (!smjs_ctx || !smjs_elinks_object) diff --git a/src/scripting/smjs/view_state_object.c b/src/scripting/smjs/view_state_object.c index 041616fa..be3ffca9 100644 --- a/src/scripting/smjs/view_state_object.c +++ b/src/scripting/smjs/view_state_object.c @@ -21,7 +21,7 @@ #include "viewer/text/vs.h" static bool view_state_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); -static bool view_state_set_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, bool strict, JS::MutableHandleValue hvp); +static bool view_state_set_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); static void view_state_finalize(JSFreeOp *op, JSObject *obj); static const JSClass view_state_class = { @@ -42,7 +42,7 @@ enum view_state_prop { }; static bool -view_state_get_property_plain(JSContext *ctx, unsigned int argc, jsval *vp) +view_state_get_property_plain(JSContext *ctx, unsigned int argc, JS::Value *vp) { JS::CallArgs args = CallArgsFromVp(argc, vp); JS::RootedObject hobj(ctx, &args.thisv().toObject()); @@ -65,7 +65,7 @@ view_state_get_property_plain(JSContext *ctx, unsigned int argc, jsval *vp) } static bool -view_state_set_property_plain(JSContext *ctx, unsigned int argc, jsval *vp) +view_state_set_property_plain(JSContext *ctx, unsigned int argc, JS::Value *vp) { JS::CallArgs args = CallArgsFromVp(argc, vp); JS::RootedObject hobj(ctx, &args.thisv().toObject()); @@ -91,7 +91,7 @@ view_state_set_property_plain(JSContext *ctx, unsigned int argc, jsval *vp) } static bool -view_state_get_property_uri(JSContext *ctx, unsigned int argc, jsval *vp) +view_state_get_property_uri(JSContext *ctx, unsigned int argc, JS::Value *vp) { JS::CallArgs args = CallArgsFromVp(argc, vp); JS::RootedObject hobj(ctx, &args.thisv().toObject()); @@ -162,7 +162,7 @@ view_state_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, /* @view_state_class.setProperty */ static bool -view_state_set_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, bool strict, JS::MutableHandleValue hvp) +view_state_set_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { jsid id = hid.get(); diff --git a/test/ecmascript/infinite.html b/test/ecmascript/infinite.html index f9f36eb4..ad229a87 100644 --- a/test/ecmascript/infinite.html +++ b/test/ecmascript/infinite.html @@ -1,3 +1,7 @@ From d1ecd4582844424ae45200748956d6d20ff0158a Mon Sep 17 00:00:00 2001 From: Witold Filipczyk Date: Tue, 27 Oct 2020 14:53:24 +0100 Subject: [PATCH 070/179] [mozjs52] It compiles, but often segfaults. No idea yet how to fix it. --- configure.ac | 4 +- meson.build | 2 +- src/dialogs/info.c | 2 +- src/document/renderer.c | 6 +- src/ecmascript/Makefile | 4 +- src/ecmascript/ecmascript.c | 1 + src/ecmascript/ecmascript.h | 1 + src/ecmascript/meson.build | 3 +- src/ecmascript/spidermonkey-shared.c | 42 ++------- src/ecmascript/spidermonkey.c | 109 ++++++++++++++++++++++-- src/ecmascript/spidermonkey/document.c | 22 +++-- src/ecmascript/spidermonkey/form.c | 70 +++++++++------ src/ecmascript/spidermonkey/heartbeat.c | 7 +- src/ecmascript/spidermonkey/location.c | 19 +++-- src/ecmascript/spidermonkey/navigator.c | 10 ++- src/ecmascript/spidermonkey/unibar.c | 14 ++- src/ecmascript/spidermonkey/window.c | 11 ++- src/main/module.c | 2 +- src/protocol/protocol.c | 2 +- src/scripting/smjs/action_object.c | 22 +++-- src/scripting/smjs/bookmarks.c | 16 +++- src/scripting/smjs/cache_object.c | 10 ++- src/scripting/smjs/core.c | 89 ++++++++++++++++++- src/scripting/smjs/elinks_object.c | 19 +++-- src/scripting/smjs/global_object.c | 17 ++-- src/scripting/smjs/globhist.c | 18 ++-- src/scripting/smjs/hooks.c | 15 ++-- src/scripting/smjs/keybinding.c | 20 +++-- src/scripting/smjs/session_object.c | 30 +++++-- src/scripting/smjs/terminal_object.c | 20 +++-- src/scripting/smjs/view_state_object.c | 26 +++--- src/viewer/text/form.c | 10 +-- src/viewer/text/link.c | 6 +- src/viewer/text/vs.c | 8 +- test/ecmascript/scroll.html | 2 +- 35 files changed, 461 insertions(+), 198 deletions(-) diff --git a/configure.ac b/configure.ac index 47872d7b..d71c611a 100644 --- a/configure.ac +++ b/configure.ac @@ -612,11 +612,11 @@ case "$with_spidermonkey" in ;; esac -for package in mozjs-45; do +for package in mozjs-52; do if test -n "$CONFIG_SPIDERMONKEY"; then break else - AC_MSG_CHECKING([for SpiderMonkey (mozjs-45) in pkg-config $package]) + AC_MSG_CHECKING([for SpiderMonkey (mozjs-52) in pkg-config $package]) if $PKG_CONFIG --cflags --libs $package > /dev/null 2>&AS_MESSAGE_LOG_FD; then SPIDERMONKEY_LIBS="$($PKG_CONFIG --libs $package)" SPIDERMONKEY_CFLAGS="$($PKG_CONFIG --cflags $package)" diff --git a/meson.build b/meson.build index 777e5808..9f02215d 100644 --- a/meson.build +++ b/meson.build @@ -271,7 +271,7 @@ if conf_data.get('CONFIG_BZIP2') endif if conf_data.get('CONFIG_ECMASCRIPT') - mozjsdeps = dependency('mozjs-45') + mozjsdeps = dependency('mozjs-52') deps += mozjsdeps endif diff --git a/src/dialogs/info.c b/src/dialogs/info.c index d4f4f798..910d4ce2 100644 --- a/src/dialogs/info.c +++ b/src/dialogs/info.c @@ -232,7 +232,7 @@ get_resource_info(struct terminal *term, void *data) val_add(n_("%ld refreshing", "%ld refreshing", val, term)); add_to_string(&info, ".\n"); -#ifdef CONFIG_ECMASCRIPT +#ifdef CONFIG_ECMASCRIPT_SMJS add_to_string(&info, _("ECMAScript", term)); add_to_string(&info, ": "); diff --git a/src/document/renderer.c b/src/document/renderer.c index e49b4abc..150e72aa 100644 --- a/src/document/renderer.c +++ b/src/document/renderer.c @@ -42,7 +42,7 @@ #include "viewer/text/vs.h" -#ifdef CONFIG_ECMASCRIPT +#ifdef CONFIG_ECMASCRIPT_SMJS /** @todo XXX: This function is de facto obsolete, since we do not need to copy * snippets around anymore (we process them in one go after the document is * loaded; gradual processing was practically impossible because the snippets @@ -331,7 +331,7 @@ render_document(struct view_state *vs, struct document_view *doc_view, vs->doc_view->used = 0; /* A bit risky, but... */ vs->doc_view->vs = NULL; vs->doc_view = NULL; -#ifdef CONFIG_ECMASCRIPT +#ifdef CONFIG_ECMASCRIPT_SMJS vs->ecmascript_fragile = 1; /* And is this good? ;-) */ #endif } @@ -385,7 +385,7 @@ render_document(struct view_state *vs, struct document_view *doc_view, document->css_magic = get_document_css_magic(document); #endif } -#ifdef CONFIG_ECMASCRIPT +#ifdef CONFIG_ECMASCRIPT_SMJS if (!vs->ecmascript_fragile) assert(vs->ecmascript); if (!options->dump && !options->gradual_rerendering) { diff --git a/src/ecmascript/Makefile b/src/ecmascript/Makefile index 0e5ae66e..69cb1122 100644 --- a/src/ecmascript/Makefile +++ b/src/ecmascript/Makefile @@ -4,7 +4,7 @@ INCLUDES += $(SPIDERMONKEY_CFLAGS) SUBDIRS-$(CONFIG_ECMASCRIPT_SMJS) += spidermonkey -OBJS-$(CONFIG_ECMASCRIPT_SMJS) += spidermonkey.o +OBJS-$(CONFIG_ECMASCRIPT_SMJS) += ecmascript.o spidermonkey.o ifeq ($(CONFIG_ECMASCRIPT_SMJS), yes) CONFIG_ANY_SPIDERMONKEY = yes @@ -16,6 +16,4 @@ endif OBJS-$(CONFIG_ANY_SPIDERMONKEY) += spidermonkey-shared.o -OBJS = ecmascript.o - include $(top_srcdir)/Makefile.lib diff --git a/src/ecmascript/ecmascript.c b/src/ecmascript/ecmascript.c index 5b48abb2..7979f77d 100644 --- a/src/ecmascript/ecmascript.c +++ b/src/ecmascript/ecmascript.c @@ -5,6 +5,7 @@ #endif #include +#include #include "elinks.h" diff --git a/src/ecmascript/ecmascript.h b/src/ecmascript/ecmascript.h index 55273fad..0f2a3421 100644 --- a/src/ecmascript/ecmascript.h +++ b/src/ecmascript/ecmascript.h @@ -53,6 +53,7 @@ struct ecmascript_interpreter { * is reloaded in another tab and then you just cause the current tab * to redraw. */ unsigned int onload_snippets_cache_id; + void *ac; }; /* Why is the interpreter bound to {struct view_state} instead of {struct diff --git a/src/ecmascript/meson.build b/src/ecmascript/meson.build index af4aec2b..d171694d 100644 --- a/src/ecmascript/meson.build +++ b/src/ecmascript/meson.build @@ -1,7 +1,7 @@ #INCLUDES += $(SPIDERMONKEY_CFLAGS) if conf_data.get('CONFIG_ECMASCRIPT_SMJS') subdir('spidermonkey') - srcs += files('spidermonkey.c') + srcs += files('ecmascript.c', 'spidermonkey.c') endif if conf_data.get('CONFIG_ECMASCRIPT_SMJS') @@ -16,4 +16,3 @@ if CONFIG_ANY_SPIDERMONKEY srcs += files('spidermonkey-shared.c', 'empty.cpp') endif -srcs += files('ecmascript.c') diff --git a/src/ecmascript/spidermonkey-shared.c b/src/ecmascript/spidermonkey-shared.c index 8af6d565..b65f239c 100644 --- a/src/ecmascript/spidermonkey-shared.c +++ b/src/ecmascript/spidermonkey-shared.c @@ -10,24 +10,12 @@ #include "ecmascript/spidermonkey-shared.h" #include -/** A shared runtime used for both user scripts (scripting/smjs/) and - * scripts on web pages (ecmascript/spidermonkey/). - * - * SpiderMonkey has bugs that corrupt memory when multiple JSRuntimes - * are used: https://bugzilla.mozilla.org/show_bug.cgi?id=378918 and - * perhaps others. */ -JSRuntime *spidermonkey_runtime; - /** A JSContext that can be used in JS_SetPrivate and JS_GetPrivate - * when no better one is available. This context has no global - * object, so scripts cannot be evaluated in it. - * - * XXX: This also works around a crash on exit. SMJS will crash on - * JS_DestroyRuntime if the given runtime has never had any context - * created, which will be the case if one closes ELinks without having - * loaded any documents. */ -JSContext *spidermonkey_empty_context; +- * when no better one is available. This context has no global +- * object, so scripts cannot be evaluated in it. +- */ +JSContext *spidermonkey_empty_context; /** A reference count for ::spidermonkey_runtime so that modules using * it can be initialized and shut down in arbitrary order. */ static int spidermonkey_runtime_refcount; @@ -41,32 +29,18 @@ int spidermonkey_runtime_addref(void) { if (spidermonkey_runtime_refcount == 0) { - assert(spidermonkey_runtime == NULL); - assert(spidermonkey_empty_context == NULL); - if_assert_failed return 0; if (!JS_Init()) { return 0; } - spidermonkey_runtime = JS_NewRuntime(4L * 1024L * 1024L); - if (!spidermonkey_runtime) return 0; - - spidermonkey_empty_context = JS_NewContext(spidermonkey_runtime, - 0); + spidermonkey_empty_context = JS_NewContext(0); if (!spidermonkey_empty_context) { - /* Perhaps JS_DestroyRuntime will now crash - * because no context was created, but there's - * not much else to do. */ - JS_DestroyRuntime(spidermonkey_runtime); - spidermonkey_runtime = NULL; JS_ShutDown(); return 0; } } - assert(spidermonkey_runtime); - assert(spidermonkey_empty_context); spidermonkey_runtime_refcount++; assert(spidermonkey_runtime_refcount > 0); if_assert_failed { spidermonkey_runtime_refcount--; return 0; } @@ -80,16 +54,10 @@ void spidermonkey_runtime_release(void) { assert(spidermonkey_runtime_refcount > 0); - assert(spidermonkey_runtime); - assert(spidermonkey_empty_context); - if_assert_failed return; --spidermonkey_runtime_refcount; if (spidermonkey_runtime_refcount == 0) { JS_DestroyContext(spidermonkey_empty_context); - spidermonkey_empty_context = NULL; - JS_DestroyRuntime(spidermonkey_runtime); - spidermonkey_runtime = NULL; JS_ShutDown(); } } diff --git a/src/ecmascript/spidermonkey.c b/src/ecmascript/spidermonkey.c index a626eebb..7ab712a4 100644 --- a/src/ecmascript/spidermonkey.c +++ b/src/ecmascript/spidermonkey.c @@ -58,8 +58,88 @@ static int js_module_init_ok; +bool +PrintError(JSContext* cx, FILE* file, JS::ConstUTF8CharsZ toStringResult, + JSErrorReport* report, bool reportWarnings) +{ + MOZ_ASSERT(report); + + /* Conditionally ignore reported warnings. */ + if (JSREPORT_IS_WARNING(report->flags) && !reportWarnings) + return false; + + char* prefix = nullptr; + if (report->filename) + prefix = JS_smprintf("%s:", report->filename); + if (report->lineno) { + char* tmp = prefix; + prefix = JS_smprintf("%s%u:%u ", tmp ? tmp : "", report->lineno, report->column); + JS_free(cx, tmp); + } + if (JSREPORT_IS_WARNING(report->flags)) { + char* tmp = prefix; + prefix = JS_smprintf("%s%swarning: ", + tmp ? tmp : "", + JSREPORT_IS_STRICT(report->flags) ? "strict " : ""); + JS_free(cx, tmp); + } + + const char* message = toStringResult ? toStringResult.c_str() : report->message().c_str(); + + /* embedded newlines -- argh! */ + const char* ctmp; + while ((ctmp = strchr(message, '\n')) != 0) { + ctmp++; + if (prefix) + fputs(prefix, file); + fwrite(message, 1, ctmp - message, file); + message = ctmp; + } + + /* If there were no filename or lineno, the prefix might be empty */ + if (prefix) + fputs(prefix, file); + fputs(message, file); + + if (const char16_t* linebuf = report->linebuf()) { + size_t n = report->linebufLength(); + + fputs(":\n", file); + if (prefix) + fputs(prefix, file); + + for (size_t i = 0; i < n; i++) + fputc(static_cast(linebuf[i]), file); + + // linebuf usually ends with a newline. If not, add one here. + if (n == 0 || linebuf[n-1] != '\n') + fputc('\n', file); + + if (prefix) + fputs(prefix, file); + + n = report->tokenOffset(); + for (size_t i = 0, j = 0; i < n; i++) { + if (linebuf[i] == '\t') { + for (size_t k = (j + 8) & ~7; j < k; j++) + fputc('.', file); + continue; + } + fputc('.', file); + j++; + } + fputc('^', file); + } + fputc('\n', file); + fflush(file); + JS_free(cx, prefix); + return true; +} + + + static void -error_reporter(JSContext *ctx, const char *message, JSErrorReport *report) +error_reporter(JSContext *ctx, JSErrorReport *report) { struct ecmascript_interpreter *interpreter = JS_GetContextPrivate(ctx); struct session *ses = interpreter->vs->doc_view->session; @@ -75,6 +155,8 @@ error_reporter(JSContext *ctx, const char *message, JSErrorReport *report) term = ses->tab->term; + PrintError(ctx, stderr, JS::ConstUTF8CharsZ(), report, true/*reportWarnings*/); + #ifdef CONFIG_LEDS set_led_value(ses->status.ecmascript_led, 'J'); #endif @@ -93,7 +175,6 @@ error_reporter(JSContext *ctx, const char *message, JSErrorReport *report) strict, exception, warning, error); add_to_string(&msg, ":\n\n"); - add_to_string(&msg, message); if (report->filename) { prefix = JS_smprintf("%s:", report->filename); @@ -147,25 +228,30 @@ spidermonkey_get_interpreter(struct ecmascript_interpreter *interpreter) JSContext *ctx; JSObject *document_obj, *forms_obj, *history_obj, *location_obj, *statusbar_obj, *menubar_obj, *navigator_obj; - JSAutoCompartment *ac = NULL; assert(interpreter); if (!js_module_init_ok) return NULL; - ctx = JS_NewContext(spidermonkey_runtime, - 8192 /* Stack allocation chunk size */); +// ctx = JS_NewContext(JS::DefaultHeapMaxBytes, JS::DefaultNurseryBytes); + ctx = JS_NewContext(8L * 1024 * 1024); if (!ctx) return NULL; interpreter->backend_data = ctx; JSAutoRequest ar(ctx); JS_SetContextPrivate(ctx, interpreter); //JS_SetOptions(ctx, JSOPTION_VAROBJFIX | JS_METHODJIT); - JS_SetErrorReporter(spidermonkey_runtime, error_reporter); - JS_SetInterruptCallback(spidermonkey_runtime, heartbeat_callback); - JS::RootedObject window_obj(ctx, JS_NewGlobalObject(ctx, &window_class, NULL, JS::DontFireOnNewGlobalHook)); + JS::SetWarningReporter(ctx, error_reporter); + JS_AddInterruptCallback(ctx, heartbeat_callback); + JS::CompartmentOptions options; + + if (!JS::InitSelfHostedCode(ctx)) { + return NULL; + } + + JS::RootedObject window_obj(ctx, JS_NewGlobalObject(ctx, &window_class, NULL, JS::FireOnNewGlobalHook, options)); if (window_obj) { - ac = new JSAutoCompartment(ctx, window_obj); + interpreter->ac = new JSAutoCompartment(ctx, window_obj); } else { goto release_and_fail; } @@ -191,6 +277,7 @@ spidermonkey_get_interpreter(struct ecmascript_interpreter *interpreter) if (!document_obj) { goto release_and_fail; } + JS_SetPrivate(document_obj, interpreter->vs); forms_obj = spidermonkey_InitClass(ctx, document_obj, NULL, &forms_class, NULL, 0, @@ -266,8 +353,12 @@ spidermonkey_put_interpreter(struct ecmascript_interpreter *interpreter) assert(interpreter); if (!js_module_init_ok) return; ctx = interpreter->backend_data; + if (interpreter->ac) { + delete (JSAutoCompartment *)interpreter->ac; + } JS_DestroyContext(ctx); interpreter->backend_data = NULL; + interpreter->ac = nullptr; } diff --git a/src/ecmascript/spidermonkey/document.c b/src/ecmascript/spidermonkey/document.c index aca00e64..fe5bf51c 100644 --- a/src/ecmascript/spidermonkey/document.c +++ b/src/ecmascript/spidermonkey/document.c @@ -50,13 +50,18 @@ static bool document_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); +JSClassOps document_ops = { + JS_PropertyStub, nullptr, + document_get_property, JS_StrictPropertyStub, + nullptr, nullptr, nullptr +}; + + /* Each @document_class object must have a @window_class parent. */ JSClass document_class = { "document", JSCLASS_HAS_PRIVATE, - JS_PropertyStub, nullptr, - document_get_property, JS_StrictPropertyStub, - nullptr, nullptr, nullptr + &document_ops }; #ifdef CONFIG_COOKIES @@ -249,16 +254,19 @@ document_set_property_title(JSContext *ctx, int argc, JS::Value *vp) { JS::CallArgs args = CallArgsFromVp(argc, vp); JS::RootedObject hobj(ctx, &args.thisv().toObject()); - JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); +// JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); struct view_state *vs; struct document_view *doc_view; struct document *document; - assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); + assert(JS_InstanceOf(ctx, hobj, &document_class, NULL)); if_assert_failed return false; - vs = JS_GetInstancePrivate(ctx, parent_win, - &window_class, NULL); +// assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); +// if_assert_failed return false; + + vs = JS_GetInstancePrivate(ctx, hobj, + &document_class, NULL); if (!vs) { return false; } diff --git a/src/ecmascript/spidermonkey/form.c b/src/ecmascript/spidermonkey/form.c index 4ba033f8..76630191 100644 --- a/src/ecmascript/spidermonkey/form.c +++ b/src/ecmascript/spidermonkey/form.c @@ -66,13 +66,17 @@ static bool form_set_property_target(JSContext *ctx, unsigned int argc, JS::Valu static void form_finalize(JSFreeOp *op, JSObject *obj); +static JSClassOps form_ops = { + JS_PropertyStub, nullptr, + form_get_property, JS_StrictPropertyStub, + nullptr, nullptr, nullptr, form_finalize +}; + /* Each @form_class object must have a @document_class parent. */ static JSClass form_class = { "form", JSCLASS_HAS_PRIVATE, /* struct form_view *, or NULL if detached */ - JS_PropertyStub, nullptr, - form_get_property, JS_StrictPropertyStub, - nullptr, nullptr, nullptr, form_finalize + &form_ops }; @@ -86,13 +90,17 @@ static bool input_get_property(JSContext *ctx, JS::HandleObject hobj, JS::Handle static bool input_set_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); static void input_finalize(JSFreeOp *op, JSObject *obj); +static JSClassOps input_ops = { + JS_PropertyStub, nullptr, + input_get_property, input_set_property, + nullptr, nullptr, nullptr, input_finalize +}; + /* Each @input_class object must have a @form_class parent. */ static JSClass input_class = { "input", /* here, we unleash ourselves */ JSCLASS_HAS_PRIVATE, /* struct form_state *, or NULL if detached */ - JS_PropertyStub, nullptr, - input_get_property, input_set_property, - nullptr, nullptr, nullptr, input_finalize + &input_ops }; /* Tinyids of properties. Use negative values to distinguish these @@ -264,7 +272,7 @@ input_set_property_accessKey(JSContext *ctx, unsigned int argc, JS::Value *vp) } } if (accesskey == UCS_NO_CHAR) { - JS_ReportError(ctx, "Invalid UTF-16 sequence"); + JS_ReportErrorUTF8(ctx, "Invalid UTF-16 sequence"); return false; } @@ -1890,7 +1898,7 @@ spidermonkey_detach_form_state(struct form_state *fs) JSObject *jsinput = fs->ecmascript_obj; if (jsinput) { - JS::RootedObject r_jsinput(spidermonkey_empty_context, jsinput); +// JS::RootedObject r_jsinput(spidermonkey_empty_context, jsinput); /* This assumes JS_GetInstancePrivate and JS_SetPrivate * cannot GC. */ @@ -1898,12 +1906,12 @@ spidermonkey_detach_form_state(struct form_state *fs) * the private pointer of jsinput should be reset; * crashes seem possible either way. Resetting it is * easiest. */ - assert(JS_GetInstancePrivate(spidermonkey_empty_context, - r_jsinput, - &input_class, NULL) - == fs); - if_assert_failed {} - +// assert(JS_GetInstancePrivate(spidermonkey_empty_context, +// r_jsinput, +// &input_class, NULL) +// == fs); +// if_assert_failed {} +// JS_SetPrivate(jsinput, NULL); fs->ecmascript_obj = NULL; } @@ -1957,13 +1965,17 @@ get_form_control_object(JSContext *ctx, static struct form_view *form_get_form_view(JSContext *ctx, JSObject *jsform, JS::Value *argv); static bool form_elements_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); +static JSClassOps form_elements_ops = { + JS_PropertyStub, nullptr, + form_elements_get_property, JS_StrictPropertyStub, + nullptr, nullptr, nullptr, nullptr +}; + /* Each @form_elements_class object must have a @form_class parent. */ static JSClass form_elements_class = { "elements", JSCLASS_HAS_PRIVATE, - JS_PropertyStub, nullptr, - form_elements_get_property, JS_StrictPropertyStub, - nullptr, nullptr, nullptr, nullptr + &form_elements_ops }; static bool form_elements_item2(JSContext *ctx, JS::HandleObject hobj, int index, JS::MutableHandleValue hvp); @@ -3113,7 +3125,7 @@ spidermonkey_detach_form_view(struct form_view *fv) JSObject *jsform = fv->ecmascript_obj; if (jsform) { - JS::RootedObject r_jsform(spidermonkey_empty_context, jsform); +// JS::RootedObject r_jsform(spidermonkey_empty_context, jsform); /* This assumes JS_GetInstancePrivate and JS_SetPrivate * cannot GC. */ @@ -3121,11 +3133,11 @@ spidermonkey_detach_form_view(struct form_view *fv) * the private pointer of jsform should be reset; * crashes seem possible either way. Resetting it is * easiest. */ - assert(JS_GetInstancePrivate(spidermonkey_empty_context, - r_jsform, - &form_class, NULL) - == fv); - if_assert_failed {} +// assert(JS_GetInstancePrivate(spidermonkey_empty_context, +// r_jsform, +// &form_class, NULL) +// == fv); +// if_assert_failed {} JS_SetPrivate(jsform, NULL); fv->ecmascript_obj = NULL; @@ -3136,13 +3148,17 @@ spidermonkey_detach_form_view(struct form_view *fv) static bool forms_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); static bool forms_get_property_length(JSContext *ctx, unsigned int argc, JS::Value *vp); +JSClassOps forms_ops = { + JS_PropertyStub, nullptr, + forms_get_property, JS_StrictPropertyStub, + nullptr, nullptr, nullptr, nullptr +}; + /* Each @forms_class object must have a @document_class parent. */ JSClass forms_class = { "forms", JSCLASS_HAS_PRIVATE, - JS_PropertyStub, nullptr, - forms_get_property, JS_StrictPropertyStub, - nullptr, nullptr, nullptr, nullptr + &forms_ops }; static bool forms_item(JSContext *ctx, unsigned int argc, JS::Value *rval); @@ -3415,6 +3431,6 @@ jsval_to_accesskey(JSContext *ctx, JS::MutableHandleValue hvp) return join_utf16_surrogates(chr[0], chr[1]); } } - JS_ReportError(ctx, "Invalid UTF-16 sequence"); + JS_ReportErrorUTF8(ctx, "Invalid UTF-16 sequence"); return UCS_NO_CHAR; /* which the caller will reject */ } diff --git a/src/ecmascript/spidermonkey/heartbeat.c b/src/ecmascript/spidermonkey/heartbeat.c index e66d0f49..65383bf5 100644 --- a/src/ecmascript/spidermonkey/heartbeat.c +++ b/src/ecmascript/spidermonkey/heartbeat.c @@ -36,6 +36,11 @@ static struct itimerval heartbeat_timer = { { 1, 0 }, { 1, 0 } }; bool heartbeat_callback(JSContext *ctx) { + struct ecmascript_interpreter *interpreter = JS_GetContextPrivate(ctx); + + if (!interpreter->heartbeat || interpreter->heartbeat->ttl > 0) { + return true; + } return false; } @@ -63,7 +68,7 @@ check_heartbeats(void *data) ecmascript_timeout_dialog(term, max_exec_time); } - JS_RequestInterruptCallback(JS_GetRuntime(hb->interpreter->backend_data)); + JS_RequestInterruptCallback(hb->interpreter->backend_data); } } install_signal_handler(SIGVTALRM, check_heartbeats, NULL, 1); diff --git a/src/ecmascript/spidermonkey/location.c b/src/ecmascript/spidermonkey/location.c index 2059f4b6..48827afa 100644 --- a/src/ecmascript/spidermonkey/location.c +++ b/src/ecmascript/spidermonkey/location.c @@ -50,14 +50,18 @@ static bool history_back(JSContext *ctx, unsigned int argc, JS::Value *rval); static bool history_forward(JSContext *ctx, unsigned int argc, JS::Value *rval); static bool history_go(JSContext *ctx, unsigned int argc, JS::Value *rval); -JSClass history_class = { - "history", - JSCLASS_HAS_PRIVATE, +JSClassOps history_ops = { JS_PropertyStub, nullptr, JS_PropertyStub, JS_StrictPropertyStub, nullptr, nullptr, nullptr, nullptr }; +JSClass history_class = { + "history", + JSCLASS_HAS_PRIVATE, + &history_ops +}; + const spidermonkeyFunctionSpec history_funcs[] = { { "back", history_back, 0 }, { "forward", history_forward, 0 }, @@ -134,13 +138,16 @@ history_go(JSContext *ctx, unsigned int argc, JS::Value *rval) static bool location_get_property_href(JSContext *ctx, unsigned int argc, JS::Value *vp); static bool location_set_property_href(JSContext *ctx, unsigned int argc, JS::Value *vp); +JSClassOps location_ops = { + JS_PropertyStub, nullptr, + JS_PropertyStub, JS_StrictPropertyStub, + nullptr, nullptr, nullptr, nullptr +}; /* Each @location_class object must have a @window_class parent. */ JSClass location_class = { "location", JSCLASS_HAS_PRIVATE, - JS_PropertyStub, nullptr, - JS_PropertyStub, JS_StrictPropertyStub, - nullptr, nullptr, nullptr, nullptr + &location_ops }; /* Tinyids of properties. Use negative values to distinguish these diff --git a/src/ecmascript/spidermonkey/navigator.c b/src/ecmascript/spidermonkey/navigator.c index 3bbfdf79..46c35dc1 100644 --- a/src/ecmascript/spidermonkey/navigator.c +++ b/src/ecmascript/spidermonkey/navigator.c @@ -51,14 +51,18 @@ static bool navigator_get_property_language(JSContext *ctx, unsigned int argc, J static bool navigator_get_property_platform(JSContext *ctx, unsigned int argc, JS::Value *vp); static bool navigator_get_property_userAgent(JSContext *ctx, unsigned int argc, JS::Value *vp); -JSClass navigator_class = { - "navigator", - JSCLASS_HAS_PRIVATE, +JSClassOps navigator_ops = { JS_PropertyStub, nullptr, JS_PropertyStub, JS_StrictPropertyStub, nullptr, nullptr, nullptr, nullptr }; +JSClass navigator_class = { + "navigator", + JSCLASS_HAS_PRIVATE, + &navigator_ops +}; + /* Tinyids of properties. Use negative values to distinguish these * from array indexes (even though this object has no array elements). * ECMAScript code should not use these directly as in navigator[-1]; diff --git a/src/ecmascript/spidermonkey/unibar.c b/src/ecmascript/spidermonkey/unibar.c index 4a20598c..1cf8aec5 100644 --- a/src/ecmascript/spidermonkey/unibar.c +++ b/src/ecmascript/spidermonkey/unibar.c @@ -48,10 +48,20 @@ static bool unibar_get_property_visible(JSContext *ctx, unsigned int argc, JS::Value *vp); static bool unibar_set_property_visible(JSContext *ctx, unsigned int argc, JS::Value *vp); +JSClassOps menubar_ops = { + JS_PropertyStub, nullptr, + JS_PropertyStub, JS_StrictPropertyStub, + nullptr, nullptr, nullptr, nullptr +}; + /* Each @menubar_class object must have a @window_class parent. */ JSClass menubar_class = { "menubar", JSCLASS_HAS_PRIVATE, /* const char * "t" */ + &menubar_ops +}; + +JSClassOps statusbar_ops = { JS_PropertyStub, nullptr, JS_PropertyStub, JS_StrictPropertyStub, nullptr, nullptr, nullptr, nullptr @@ -60,9 +70,7 @@ JSClass menubar_class = { JSClass statusbar_class = { "statusbar", JSCLASS_HAS_PRIVATE, /* const char * "s" */ - JS_PropertyStub, nullptr, - JS_PropertyStub, JS_StrictPropertyStub, - nullptr, nullptr, nullptr, nullptr + &statusbar_ops }; /* Tinyids of properties. Use negative values to distinguish these diff --git a/src/ecmascript/spidermonkey/window.c b/src/ecmascript/spidermonkey/window.c index bd4f9d63..1279e231 100644 --- a/src/ecmascript/spidermonkey/window.c +++ b/src/ecmascript/spidermonkey/window.c @@ -53,14 +53,18 @@ static bool window_get_property_status(JSContext *ctx, unsigned int argc, JS::Va static bool window_set_property_status(JSContext *ctx, unsigned int argc, JS::Value *vp); static bool window_get_property_top(JSContext *ctx, unsigned int argc, JS::Value *vp); -JSClass window_class = { - "window", - JSCLASS_HAS_PRIVATE | JSCLASS_GLOBAL_FLAGS, /* struct view_state * */ +JSClassOps window_ops = { JS_PropertyStub, nullptr, window_get_property, JS_StrictPropertyStub, nullptr, nullptr, nullptr, nullptr }; +JSClass window_class = { + "window", + JSCLASS_HAS_PRIVATE | JSCLASS_GLOBAL_FLAGS, /* struct view_state * */ + &window_ops +}; + /* Tinyids of properties. Use negative values to distinguish these * from array indexes (even though this object has no array elements). @@ -440,6 +444,7 @@ window_setTimeout(JSContext *ctx, unsigned int argc, JS::Value *rval) if (!code) return true; timeout = args[1].toInt32(); + if (timeout <= 0) { mem_free(code); return true; diff --git a/src/main/module.c b/src/main/module.c index 3d0ebb86..64aba901 100644 --- a/src/main/module.c +++ b/src/main/module.c @@ -60,7 +60,7 @@ struct module *builtin_modules[] = { #ifdef CONFIG_COOKIES &cookies_module, #endif -#ifdef CONFIG_ECMASCRIPT +#ifdef CONFIG_ECMASCRIPT_SMJS &ecmascript_module, #endif #ifdef CONFIG_FORMHIST diff --git a/src/protocol/protocol.c b/src/protocol/protocol.c index aecfd098..117311a2 100644 --- a/src/protocol/protocol.c +++ b/src/protocol/protocol.c @@ -219,7 +219,7 @@ generic_external_protocol_handler(struct session *ses, struct uri *uri) switch (uri->protocol) { case PROTOCOL_JAVASCRIPT: -#ifdef CONFIG_ECMASCRIPT +#ifdef CONFIG_ECMASCRIPT_SMJS ecmascript_protocol_handler(ses, uri); return; #else diff --git a/src/scripting/smjs/action_object.c b/src/scripting/smjs/action_object.c index 18c6aeb7..532d9fab 100644 --- a/src/scripting/smjs/action_object.c +++ b/src/scripting/smjs/action_object.c @@ -26,9 +26,7 @@ struct smjs_action_fn_callback_hop { static void smjs_action_fn_finalize(JSFreeOp *op, JSObject *obj); static bool smjs_action_fn_callback(JSContext *ctx, unsigned int argc, JS::Value *rval); -static const JSClass action_fn_class = { - "action_fn", - JSCLASS_HAS_PRIVATE, /* struct smjs_action_fn_callback_hop * */ +static JSClassOps action_fn_ops = { JS_PropertyStub, nullptr, JS_PropertyStub, JS_StrictPropertyStub, nullptr, nullptr, nullptr, @@ -37,6 +35,12 @@ static const JSClass action_fn_class = { smjs_action_fn_callback, }; +static const JSClass action_fn_class = { + "action_fn", + JSCLASS_HAS_PRIVATE, /* struct smjs_action_fn_callback_hop * */ + &action_fn_ops +}; + /* @action_fn_class.finalize */ static void smjs_action_fn_finalize(JSFreeOp *op, JSObject *obj) @@ -104,7 +108,7 @@ smjs_action_fn_callback(JSContext *ctx, unsigned int argc, JS::Value *rval) * * The "%s" prevents interpretation of any percent * signs in translations. */ - JS_ReportError(ctx, "%s", + JS_ReportErrorUTF8(ctx, "%s", _("Cannot run actions in a tab that doesn't " "have the focus", hop->ses->tab->term)); return false; /* make JS propagate the exception */ @@ -183,14 +187,18 @@ action_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS: return true; } -static const JSClass action_class = { - "action", - 0, +static JSClassOps action_ops = { JS_PropertyStub, nullptr, action_get_property, JS_StrictPropertyStub, nullptr, nullptr, nullptr, nullptr, }; +static const JSClass action_class = { + "action", + 0, + &action_ops +}; + static JSObject * smjs_get_action_object(void) { diff --git a/src/scripting/smjs/bookmarks.c b/src/scripting/smjs/bookmarks.c index fcedbaba..d32bf1c4 100644 --- a/src/scripting/smjs/bookmarks.c +++ b/src/scripting/smjs/bookmarks.c @@ -20,20 +20,28 @@ static void bookmark_finalize(JSFreeOp *op, JSObject *obj); static bool bookmark_folder_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); +static JSClassOps bookmark_ops = { + JS_PropertyStub, nullptr, + JS_PropertyStub, JS_StrictPropertyStub, + nullptr, nullptr, nullptr, bookmark_finalize, +}; + static const JSClass bookmark_class = { "bookmark", JSCLASS_HAS_PRIVATE, /* struct bookmark * */ + &bookmark_ops +}; + +static JSClassOps bookmark_folder_ops = { JS_PropertyStub, nullptr, - JS_PropertyStub, JS_StrictPropertyStub, + bookmark_folder_get_property, JS_StrictPropertyStub, nullptr, nullptr, nullptr, bookmark_finalize, }; static const JSClass bookmark_folder_class = { "bookmark_folder", JSCLASS_HAS_PRIVATE, /* struct bookmark * */ - JS_PropertyStub, nullptr, - bookmark_folder_get_property, JS_StrictPropertyStub, - nullptr, nullptr, nullptr, bookmark_finalize, + &bookmark_folder_ops }; static JSObject * diff --git a/src/scripting/smjs/cache_object.c b/src/scripting/smjs/cache_object.c index bd6204d2..0ea15d1c 100644 --- a/src/scripting/smjs/cache_object.c +++ b/src/scripting/smjs/cache_object.c @@ -17,14 +17,18 @@ static void cache_entry_finalize(JSFreeOp *op, JSObject *obj); -static const JSClass cache_entry_class = { - "cache_entry", - JSCLASS_HAS_PRIVATE, /* struct cache_entry *; a weak reference */ +static JSClassOps cache_entry_ops = { JS_PropertyStub, nullptr, JS_PropertyStub, JS_StrictPropertyStub, nullptr, nullptr, nullptr, cache_entry_finalize }; +static const JSClass cache_entry_class = { + "cache_entry", + JSCLASS_HAS_PRIVATE, /* struct cache_entry *; a weak reference */ + &cache_entry_ops +}; + /* Tinyids of properties. Use negative values to distinguish these * from array indexes (even though this object has no array elements). * ECMAScript code should not use these directly as in cache_entry[-1]; diff --git a/src/scripting/smjs/core.c b/src/scripting/smjs/core.c index 94285c32..cca5caec 100644 --- a/src/scripting/smjs/core.c +++ b/src/scripting/smjs/core.c @@ -37,8 +37,88 @@ alert_smjs_error(unsigned char *msg) smjs_ses, msg); } +static bool +PrintError(JSContext* cx, FILE* file, JS::ConstUTF8CharsZ toStringResult, + JSErrorReport* report, bool reportWarnings) +{ + MOZ_ASSERT(report); + + /* Conditionally ignore reported warnings. */ + if (JSREPORT_IS_WARNING(report->flags) && !reportWarnings) + return false; + + char* prefix = nullptr; + if (report->filename) + prefix = JS_smprintf("%s:", report->filename); + if (report->lineno) { + char* tmp = prefix; + prefix = JS_smprintf("%s%u:%u ", tmp ? tmp : "", report->lineno, report->column); + JS_free(cx, tmp); + } + if (JSREPORT_IS_WARNING(report->flags)) { + char* tmp = prefix; + prefix = JS_smprintf("%s%swarning: ", + tmp ? tmp : "", + JSREPORT_IS_STRICT(report->flags) ? "strict " : ""); + JS_free(cx, tmp); + } + + const char* message = toStringResult ? toStringResult.c_str() : report->message().c_str(); + + /* embedded newlines -- argh! */ + const char* ctmp; + while ((ctmp = strchr(message, '\n')) != 0) { + ctmp++; + if (prefix) + fputs(prefix, file); + fwrite(message, 1, ctmp - message, file); + message = ctmp; + } + + /* If there were no filename or lineno, the prefix might be empty */ + if (prefix) + fputs(prefix, file); + fputs(message, file); + + if (const char16_t* linebuf = report->linebuf()) { + size_t n = report->linebufLength(); + + fputs(":\n", file); + if (prefix) + fputs(prefix, file); + + for (size_t i = 0; i < n; i++) + fputc(static_cast(linebuf[i]), file); + + // linebuf usually ends with a newline. If not, add one here. + if (n == 0 || linebuf[n-1] != '\n') + fputc('\n', file); + + if (prefix) + fputs(prefix, file); + + n = report->tokenOffset(); + for (size_t i = 0, j = 0; i < n; i++) { + if (linebuf[i] == '\t') { + for (size_t k = (j + 8) & ~7; j < k; j++) + fputc('.', file); + continue; + } + fputc('.', file); + j++; + } + fputc('^', file); + } + fputc('\n', file); + fflush(file); + JS_free(cx, prefix); + return true; +} + + + static void -error_reporter(JSContext *ctx, const char *message, JSErrorReport *report) +error_reporter(JSContext *ctx, JSErrorReport *report) { unsigned char *strict, *exception, *warning, *error; struct string msg; @@ -51,11 +131,12 @@ error_reporter(JSContext *ctx, const char *message, JSErrorReport *report) warning = JSREPORT_IS_WARNING(report->flags) ? " warning" : ""; error = !report->flags ? " error" : ""; + PrintError(ctx, stderr, JS::ConstUTF8CharsZ(), report, true/*reportWarnings*/); + add_format_to_string(&msg, "A client script raised the following%s%s%s%s", strict, exception, warning, error); add_to_string(&msg, ":\n\n"); - add_to_string(&msg, message); add_format_to_string(&msg, "\n\n%d:%d ", report->lineno, report->column); @@ -153,13 +234,13 @@ init_smjs(struct module *module) { if (!spidermonkey_runtime_addref()) return; - smjs_ctx = JS_NewContext(spidermonkey_runtime, 8192); + smjs_ctx = JS_NewContext(8L * 1024 * 1024); if (!smjs_ctx) { spidermonkey_runtime_release(); return; } - JS_SetErrorReporter(spidermonkey_runtime, error_reporter); + JS::SetWarningReporter(smjs_ctx, error_reporter); smjs_init_global_object(); diff --git a/src/scripting/smjs/elinks_object.c b/src/scripting/smjs/elinks_object.c index 9a84ca18..50b709d6 100644 --- a/src/scripting/smjs/elinks_object.c +++ b/src/scripting/smjs/elinks_object.c @@ -108,14 +108,18 @@ static const JSPropertySpec elinks_props[] = { static bool elinks_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); static bool elinks_set_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); -static const JSClass elinks_class = { - "elinks", - 0, +static const JSClassOps elinks_ops = { JS_PropertyStub, nullptr, elinks_get_property, elinks_set_property, nullptr, nullptr, nullptr, nullptr }; +static const JSClass elinks_class = { + "elinks", + 0, + &elinks_ops +}; + /* @elinks_class.getProperty */ static bool @@ -263,15 +267,12 @@ smjs_invoke_elinks_object_method(unsigned char *method, int argc, JS::Value *arg assert(argv); JS::RootedObject r_smjs_elinks_object(smjs_ctx, smjs_elinks_object); - JS::Value val; - JS::RootedValue fun(smjs_ctx, val); + JS::RootedValue fun(smjs_ctx); if (false == JS_GetProperty(smjs_ctx, r_smjs_elinks_object, - method, &fun)) - return false; - - if (rval.isUndefined()) + method, &fun)) { return false; + } return JS_CallFunctionValue(smjs_ctx, r_smjs_elinks_object, fun, args, rval); } diff --git a/src/scripting/smjs/global_object.c b/src/scripting/smjs/global_object.c index 32491b77..733d8527 100644 --- a/src/scripting/smjs/global_object.c +++ b/src/scripting/smjs/global_object.c @@ -15,14 +15,17 @@ using namespace JS; JSObject *smjs_global_object; - -static const JSClass global_class = { - "global", JSCLASS_GLOBAL_FLAGS, +static const JSClassOps global_ops = { JS_PropertyStub, nullptr, JS_PropertyStub, JS_StrictPropertyStub, nullptr, nullptr, nullptr, nullptr }; +static const JSClass global_class = { + "global", JSCLASS_GLOBAL_FLAGS, + &global_ops +}; + static JSObject * smjs_get_global_object(void) { @@ -30,9 +33,13 @@ smjs_get_global_object(void) JSAutoCompartment *acc = NULL; JSAutoRequest ar(smjs_ctx); - RootedObject jsobj(smjs_ctx); + JS::CompartmentOptions opts; - jsobj = JS_NewGlobalObject(smjs_ctx, (JSClass *) &global_class, NULL, JS::DontFireOnNewGlobalHook); + if (!JS::InitSelfHostedCode(smjs_ctx)) { + return NULL; + } + + JS::RootedObject jsobj(smjs_ctx, JS_NewGlobalObject(smjs_ctx, (JSClass *) &global_class, NULL, JS::DontFireOnNewGlobalHook, opts)); if (!jsobj) return NULL; diff --git a/src/scripting/smjs/globhist.c b/src/scripting/smjs/globhist.c index 52f618ac..28ecf8b3 100644 --- a/src/scripting/smjs/globhist.c +++ b/src/scripting/smjs/globhist.c @@ -17,15 +17,19 @@ static bool smjs_globhist_item_set_property(JSContext *ctx, JS::HandleObject hob static void smjs_globhist_item_finalize(JSFreeOp *op, JSObject *obj); -static const JSClass smjs_globhist_item_class = { - "global_history_item", - JSCLASS_HAS_PRIVATE, /* struct global_history_item * */ +static const JSClassOps smjs_globhist_item_ops = { JS_PropertyStub, nullptr, smjs_globhist_item_get_property, smjs_globhist_item_set_property, nullptr, nullptr, nullptr, smjs_globhist_item_finalize, }; +static const JSClass smjs_globhist_item_class = { + "global_history_item", + JSCLASS_HAS_PRIVATE, /* struct global_history_item * */ + &smjs_globhist_item_ops +}; + /* @smjs_globhist_item_class.finalize */ static void smjs_globhist_item_finalize(JSFreeOp *op, JSObject *obj) @@ -243,13 +247,17 @@ ret_null: return true; } -static const JSClass smjs_globhist_class = { - "global_history", 0, +static const JSClassOps smjs_globhist_ops = { JS_PropertyStub, nullptr, smjs_globhist_get_property, JS_StrictPropertyStub, nullptr, nullptr, nullptr, nullptr }; +static const JSClass smjs_globhist_class = { + "global_history", 0, + &smjs_globhist_ops +}; + static JSObject * smjs_get_globhist_object(void) { diff --git a/src/scripting/smjs/hooks.c b/src/scripting/smjs/hooks.c index 0359927a..a5233012 100644 --- a/src/scripting/smjs/hooks.c +++ b/src/scripting/smjs/hooks.c @@ -27,8 +27,8 @@ script_hook_url(va_list ap, void *data) unsigned char **url = va_arg(ap, unsigned char **); struct session *ses = va_arg(ap, struct session *); enum evhook_status ret = EVENT_HOOK_STATUS_NEXT; - JS::Value args[3], rval; - JS::RootedValue r_rval(smjs_ctx, rval); + JS::Value args[3]; + JS::RootedValue r_rval(smjs_ctx); if (*url == NULL) return EVENT_HOOK_STATUS_NEXT; @@ -59,12 +59,14 @@ script_hook_pre_format_html(va_list ap, void *data) struct cache_entry *cached = va_arg(ap, struct cache_entry *); enum evhook_status ret = EVENT_HOOK_STATUS_NEXT; JSObject *cache_entry_object, *view_state_object = NULL; - JS::Value args[4], rval; - JS::RootedValue r_rval(smjs_ctx, rval); + JS::Value args[4]; + JS::RootedValue r_rval(smjs_ctx); evhook_use_params(ses && cached); - if (!smjs_ctx || !cached->length) goto end; + if (!smjs_ctx || !cached->length) { + goto end; + } smjs_ses = ses; @@ -81,9 +83,10 @@ script_hook_pre_format_html(va_list ap, void *data) args[3].setObject(*view_state_object); if (true == smjs_invoke_elinks_object_method("preformat_html", - 2, args, &r_rval)) + 2, args, &r_rval)) { if (false == r_rval.toBoolean()) ret = EVENT_HOOK_STATUS_LAST; + } end: smjs_ses = NULL; diff --git a/src/scripting/smjs/keybinding.c b/src/scripting/smjs/keybinding.c index 460d72b3..5c81c467 100644 --- a/src/scripting/smjs/keybinding.c +++ b/src/scripting/smjs/keybinding.c @@ -17,14 +17,18 @@ static bool keymap_get_property(JSContext *ctx, JS::HandleObject hobj, JS::Handl static bool keymap_set_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); static void keymap_finalize(JSFreeOp *op, JSObject *obj); -static const JSClass keymap_class = { - "keymap", - JSCLASS_HAS_PRIVATE, /* int * */ +static const JSClassOps keymap_ops = { JS_PropertyStub, nullptr, keymap_get_property, keymap_set_property, nullptr, nullptr, nullptr, keymap_finalize, }; +static const JSClass keymap_class = { + "keymap", + JSCLASS_HAS_PRIVATE, /* int * */ + &keymap_ops +}; + /* @keymap_class.getProperty */ static bool keymap_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) @@ -220,14 +224,18 @@ smjs_get_keymap_object(enum keymap_id keymap_id) return keymap_object; } -static const JSClass keymaps_hash_class = { - "keymaps_hash", - JSCLASS_HAS_PRIVATE, +static const JSClassOps keymap_hash_ops = { JS_PropertyStub, nullptr, JS_PropertyStub, JS_StrictPropertyStub, nullptr, nullptr, nullptr, nullptr, }; +static const JSClass keymaps_hash_class = { + "keymaps_hash", + JSCLASS_HAS_PRIVATE, + &keymap_hash_ops +}; + static JSObject * smjs_get_keymap_hash_object(void) { diff --git a/src/scripting/smjs/session_object.c b/src/scripting/smjs/session_object.c index 8366e317..f91e6587 100644 --- a/src/scripting/smjs/session_object.c +++ b/src/scripting/smjs/session_object.c @@ -35,24 +35,32 @@ static bool session_set_property(JSContext *ctx, JS::HandleObject hobj, JS::Hand static void session_finalize(JSFreeOp *op, JSObject *obj); static bool session_construct(JSContext *ctx, unsigned int argc, JS::Value *rval); -static const JSClass session_class = { - "session", - JSCLASS_HAS_PRIVATE, /* struct session *; a weak reference */ +static const JSClassOps session_ops = { JS_PropertyStub, nullptr, session_get_property, session_set_property, nullptr, nullptr, nullptr, session_finalize, NULL, NULL, NULL, session_construct }; +static const JSClass session_class = { + "session", + JSCLASS_HAS_PRIVATE, /* struct session *; a weak reference */ + &session_ops +}; + static bool smjs_location_array_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); static void smjs_location_array_finalize(JSFreeOp *op, JSObject *obj); +static const JSClassOps location_array_ops = { + JS_PropertyStub, nullptr, + smjs_location_array_get_property, JS_StrictPropertyStub, + nullptr, nullptr, nullptr, smjs_location_array_finalize, +}; + static const JSClass location_array_class = { "location_array", JSCLASS_HAS_PRIVATE, /* struct session *; a weak reference */ - JS_PropertyStub, nullptr, - smjs_location_array_get_property, JS_StrictPropertyStub, - nullptr, nullptr, nullptr, smjs_location_array_finalize, + &location_array_ops }; /* location_array_class is the class for array object, the elements of which @@ -1076,14 +1084,18 @@ session_array_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId h return true; } -static const JSClass session_array_class = { - "session_array", - JSCLASS_HAS_PRIVATE, /* struct terminal *term; a weak reference */ +static const JSClassOps session_array_ops = { JS_PropertyStub, nullptr, session_array_get_property, JS_StrictPropertyStub, nullptr, nullptr, nullptr, nullptr }; +static const JSClass session_array_class = { + "session_array", + JSCLASS_HAS_PRIVATE, /* struct terminal *term; a weak reference */ + &session_array_ops +}; + JSObject * smjs_get_session_array_object(struct terminal *term) { diff --git a/src/scripting/smjs/terminal_object.c b/src/scripting/smjs/terminal_object.c index 49506f65..b286a842 100644 --- a/src/scripting/smjs/terminal_object.c +++ b/src/scripting/smjs/terminal_object.c @@ -20,14 +20,18 @@ static bool terminal_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); static void terminal_finalize(JSFreeOp *op, JSObject *obj); -static const JSClass terminal_class = { - "terminal", - JSCLASS_HAS_PRIVATE, /* struct terminal *; a weak refernce */ +static const JSClassOps terminal_ops = { JS_PropertyStub, nullptr, terminal_get_property, JS_StrictPropertyStub, nullptr, nullptr, nullptr, terminal_finalize }; +static const JSClass terminal_class = { + "terminal", + JSCLASS_HAS_PRIVATE, /* struct terminal *; a weak refernce */ + &terminal_ops +}; + enum terminal_prop { TERMINAL_TAB, }; @@ -187,14 +191,18 @@ terminal_array_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId ; } -static const JSClass terminal_array_class = { - "terminal_array", - 0, +static const JSClassOps terminal_array_ops = { JS_PropertyStub, nullptr, terminal_array_get_property, JS_StrictPropertyStub, nullptr, nullptr, nullptr, nullptr }; +static const JSClass terminal_array_class = { + "terminal_array", + 0, + &terminal_array_ops +}; + /** Return an SMJS object that scripts can use an array to get terminal * objects. */ static JSObject * diff --git a/src/scripting/smjs/view_state_object.c b/src/scripting/smjs/view_state_object.c index be3ffca9..101c2705 100644 --- a/src/scripting/smjs/view_state_object.c +++ b/src/scripting/smjs/view_state_object.c @@ -24,14 +24,18 @@ static bool view_state_get_property(JSContext *ctx, JS::HandleObject hobj, JS::H static bool view_state_set_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); static void view_state_finalize(JSFreeOp *op, JSObject *obj); -static const JSClass view_state_class = { - "view_state", - JSCLASS_HAS_PRIVATE, /* struct view_state * */ +static const JSClassOps view_state_ops = { JS_PropertyStub, nullptr, view_state_get_property, view_state_set_property, nullptr, nullptr, nullptr, view_state_finalize }; +static const JSClass view_state_class = { + "view_state", + JSCLASS_HAS_PRIVATE, /* struct view_state * */ + &view_state_ops +}; + /* Tinyids of properties. Use negative values to distinguish these * from array indexes (even though this object has no array elements). * ECMAScript code should not use these directly as in view_state[-1]; @@ -255,22 +259,22 @@ smjs_get_view_state_object(struct view_state *vs) } static bool -smjs_elinks_get_view_state(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) +smjs_elinks_get_view_state(JSContext *ctx, unsigned int argc, JS::Value *vp) { - JSObject *vs_obj; - struct view_state *vs; + JS::CallArgs args = CallArgsFromVp(argc, vp); + JS::RootedObject hobj(ctx, &args.thisv().toObject()); - hvp.setNull(); + args.rval().setNull(); if (!smjs_ses || !have_location(smjs_ses)) return true; - vs = &cur_loc(smjs_ses)->vs; + struct view_state *vs = &cur_loc(smjs_ses)->vs; if (!vs) return true; - vs_obj = smjs_get_view_state_object(vs); + JSObject *vs_obj = smjs_get_view_state_object(vs); if (!vs_obj) return true; - hvp.setObject(*vs_obj); + args.rval().setObject(*vs_obj); return true; } @@ -308,6 +312,6 @@ smjs_init_view_state_interface(void) JS::RootedObject r_smjs_elinks_object(smjs_ctx, smjs_elinks_object); JS_DefineProperty(smjs_ctx, r_smjs_elinks_object, "vs", (int32_t)0, - (unsigned int)(JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_READONLY), smjs_elinks_get_view_state, JS_StrictPropertyStub + (unsigned int)(JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_READONLY), smjs_elinks_get_view_state, nullptr/*JS_StrictPropertyStub*/ ); } diff --git a/src/viewer/text/form.c b/src/viewer/text/form.c index e55725fe..8e77a321 100644 --- a/src/viewer/text/form.c +++ b/src/viewer/text/form.c @@ -252,7 +252,7 @@ find_form_state(struct document_view *doc_view, struct el_form_control *fc) if (n >= vs->form_info_len) { int nn = n + 1; -#ifdef CONFIG_ECMASCRIPT +#ifdef CONFIG_ECMASCRIPT_SMJS const struct form_state *const old_form_info = vs->form_info; #endif @@ -261,7 +261,7 @@ find_form_state(struct document_view *doc_view, struct el_form_control *fc) vs->form_info = fs; vs->form_info_len = nn; -#ifdef CONFIG_ECMASCRIPT +#ifdef CONFIG_ECMASCRIPT_SMJS /* TODO: Standard C does not allow this comparison; * if the memory to which old_form_info pointed has * been freed, then the value of the pointer itself is @@ -275,7 +275,7 @@ find_form_state(struct document_view *doc_view, struct el_form_control *fc) for (nn = 0; nn < vs->form_info_len; nn++) ecmascript_moved_form_state(&vs->form_info[nn]); } -#endif /* CONFIG_ECMASCRIPT */ +#endif /* CONFIG_ECMASCRIPT_SMJS */ } fs = &vs->form_info[n]; @@ -353,7 +353,7 @@ find_form_by_form_view(struct document *document, struct form_view *fv) void done_form_state(struct form_state *fs) { -#ifdef CONFIG_ECMASCRIPT +#ifdef CONFIG_ECMASCRIPT_SMJS ecmascript_detach_form_state(fs); #endif mem_free_if(fs->value); @@ -365,7 +365,7 @@ done_form_state(struct form_state *fs) void done_form_view(struct form_view *fv) { -#ifdef CONFIG_ECMASCRIPT +#ifdef CONFIG_ECMASCRIPT_SMJS ecmascript_detach_form_view(fv); #endif mem_free(fv); diff --git a/src/viewer/text/link.c b/src/viewer/text/link.c index 1b3354ee..e7af384f 100644 --- a/src/viewer/text/link.c +++ b/src/viewer/text/link.c @@ -52,7 +52,7 @@ static int current_link_evhook(struct document_view *doc_view, enum script_event_hook_type type) { -#ifdef CONFIG_ECMASCRIPT +#ifdef CONFIG_ECMASCRIPT_SMJS struct link *link; struct script_event_hook *evhook; @@ -915,7 +915,7 @@ call_onsubmit_and_submit(struct session *ses, struct document_view *doc_view, assert(fc->form); /* regardless of whether there is a FORM element */ if_assert_failed return 0; -#ifdef CONFIG_ECMASCRIPT +#ifdef CONFIG_ECMASCRIPT_SMJS /* If the form has multiple submit buttons, this does not * explicitly tell the ECMAScript code which of them was * pressed. W3C DOM Level 3 doesn't seem to include such a @@ -952,7 +952,7 @@ call_onsubmit_and_submit(struct session *ses, struct document_view *doc_view, if (!res) return 1; } } -#endif /* CONFIG_ECMASCRIPT */ +#endif /* CONFIG_ECMASCRIPT_SMJS */ uri = get_form_uri(ses, doc_view, fc); if (!uri) return 0; diff --git a/src/viewer/text/vs.c b/src/viewer/text/vs.c index 7462cb51..fc5f9717 100644 --- a/src/viewer/text/vs.c +++ b/src/viewer/text/vs.c @@ -38,7 +38,7 @@ init_vs(struct view_state *vs, struct uri *uri, int plain) vs->plain = plain; vs->uri = uri ? get_uri_reference(uri) : NULL; vs->did_fragment = !uri->fragmentlen; -#ifdef CONFIG_ECMASCRIPT +#ifdef CONFIG_ECMASCRIPT_SMJS /* If we ever get to render this vs, give it an interpreter. */ vs->ecmascript_fragile = 1; #endif @@ -67,7 +67,7 @@ destroy_vs(struct view_state *vs, int blast_ecmascript) } if (vs->uri) done_uri(vs->uri); -#ifdef CONFIG_ECMASCRIPT +#ifdef CONFIG_ECMASCRIPT_SMJS if (blast_ecmascript && vs->ecmascript) ecmascript_put_interpreter(vs->ecmascript); #endif @@ -87,7 +87,7 @@ copy_vs(struct view_state *dst, struct view_state *src) /* We do not copy ecmascript stuff around since it's specific for * a single location, offsprings (followups and so) nedd their own. */ -#ifdef CONFIG_ECMASCRIPT +#ifdef CONFIG_ECMASCRIPT_SMJS dst->ecmascript = NULL; /* If we ever get to render this vs, give it an interpreter. */ dst->ecmascript_fragile = 1; @@ -131,7 +131,7 @@ copy_vs(struct view_state *dst, struct view_state *src) struct form_state *srcfs = &src->form_info[i]; struct form_state *dstfs = &dst->form_info[i]; -#ifdef CONFIG_ECMASCRIPT +#ifdef CONFIG_ECMASCRIPT_SMJS dstfs->ecmascript_obj = NULL; #endif if (srcfs->value) diff --git a/test/ecmascript/scroll.html b/test/ecmascript/scroll.html index 3ddb9478..81b2216c 100644 --- a/test/ecmascript/scroll.html +++ b/test/ecmascript/scroll.html @@ -6,7 +6,7 @@ function scrollText() { tekst = tekst.substring(1, tekst.length) + znak; return tekst.substring(0, 80); } -function scroll () { +function scroll() { document.title = scrollText(); setTimeout("scroll()", 100); } From aeeb5c69a2aee50d3d90a9d9a3fd038e2ea6a2da Mon Sep 17 00:00:00 2001 From: Witold Filipczyk Date: Tue, 27 Oct 2020 15:05:31 +0100 Subject: [PATCH 071/179] [configure.ac] Added -fpermissive for SpiderMonkey If you want to build with SpiderMonkey, you must compile by g++. Current state is it segfaults often. --- configure.ac | 1 + 1 file changed, 1 insertion(+) diff --git a/configure.ac b/configure.ac index d71c611a..91f03444 100644 --- a/configure.ac +++ b/configure.ac @@ -692,6 +692,7 @@ if test "x$CONFIG_ECMASCRIPT_SMJS" = xyes || AC_SUBST(SPIDERMONKEY_LIBS) AC_SUBST(SPIDERMONKEY_CFLAGS) AC_SUBST(CONFIG_SPIDERMONKEY) + CFLAGS="$CFLAGS -fpermissive" fi # =================================================================== From 8ad7d68b280fbfca2a65270d53c5cdc79c8c11ca Mon Sep 17 00:00:00 2001 From: Witold Filipczyk Date: Wed, 28 Oct 2020 22:32:20 +0100 Subject: [PATCH 072/179] [js] Small progress. It segfaults less often, but still, especially on non utf-8 pages. And sometimes it did not work. --- src/ecmascript/ecmascript.h | 1 + src/ecmascript/spidermonkey-shared.c | 16 ++++++--- src/ecmascript/spidermonkey-shared.h | 2 +- src/ecmascript/spidermonkey.c | 43 +++++++++++++++++-------- src/ecmascript/spidermonkey/document.c | 11 +++++-- src/ecmascript/spidermonkey/heartbeat.c | 9 +++++- src/ecmascript/spidermonkey/location.c | 26 +++++++++++++-- src/ecmascript/spidermonkey/window.c | 11 +++++-- 8 files changed, 93 insertions(+), 26 deletions(-) diff --git a/src/ecmascript/ecmascript.h b/src/ecmascript/ecmascript.h index 0f2a3421..7f08d1b4 100644 --- a/src/ecmascript/ecmascript.h +++ b/src/ecmascript/ecmascript.h @@ -54,6 +54,7 @@ struct ecmascript_interpreter { * to redraw. */ unsigned int onload_snippets_cache_id; void *ac; + void *ar; }; /* Why is the interpreter bound to {struct view_state} instead of {struct diff --git a/src/ecmascript/spidermonkey-shared.c b/src/ecmascript/spidermonkey-shared.c index b65f239c..84dd3e5c 100644 --- a/src/ecmascript/spidermonkey-shared.c +++ b/src/ecmascript/spidermonkey-shared.c @@ -15,7 +15,8 @@ - * object, so scripts cannot be evaluated in it. - */ -JSContext *spidermonkey_empty_context; +JSContext *main_ctx; + /** A reference count for ::spidermonkey_runtime so that modules using * it can be initialized and shut down in arbitrary order. */ static int spidermonkey_runtime_refcount; @@ -34,8 +35,15 @@ spidermonkey_runtime_addref(void) return 0; } - spidermonkey_empty_context = JS_NewContext(0); - if (!spidermonkey_empty_context) { + main_ctx = JS_NewContext(16 * 1024 * 1024); + + if (!main_ctx) { + JS_ShutDown(); + return 0; + } + + if (!JS::InitSelfHostedCode(main_ctx)) { + JS_DestroyContext(main_ctx); JS_ShutDown(); return 0; } @@ -57,7 +65,7 @@ spidermonkey_runtime_release(void) --spidermonkey_runtime_refcount; if (spidermonkey_runtime_refcount == 0) { - JS_DestroyContext(spidermonkey_empty_context); + JS_DestroyContext(main_ctx); JS_ShutDown(); } } diff --git a/src/ecmascript/spidermonkey-shared.h b/src/ecmascript/spidermonkey-shared.h index ee3fbae9..e6f9d47f 100644 --- a/src/ecmascript/spidermonkey-shared.h +++ b/src/ecmascript/spidermonkey-shared.h @@ -24,7 +24,7 @@ #include "util/string.h" extern JSRuntime *spidermonkey_runtime; -extern JSContext *spidermonkey_empty_context; +extern JSContext *main_ctx; int spidermonkey_runtime_addref(void); void spidermonkey_runtime_release(void); diff --git a/src/ecmascript/spidermonkey.c b/src/ecmascript/spidermonkey.c index 7ab712a4..960fb673 100644 --- a/src/ecmascript/spidermonkey.c +++ b/src/ecmascript/spidermonkey.c @@ -141,7 +141,14 @@ PrintError(JSContext* cx, FILE* file, JS::ConstUTF8CharsZ toStringResult, static void error_reporter(JSContext *ctx, JSErrorReport *report) { - struct ecmascript_interpreter *interpreter = JS_GetContextPrivate(ctx); + JSCompartment *comp = js::GetContextCompartment(ctx); + + if (!comp) { + return; + } + + struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp); +// struct ecmascript_interpreter *interpreter = JS_GetContextPrivate(ctx); struct session *ses = interpreter->vs->doc_view->session; struct terminal *term; unsigned char *strict, *exception, *warning, *error; @@ -229,25 +236,28 @@ spidermonkey_get_interpreter(struct ecmascript_interpreter *interpreter) JSObject *document_obj, *forms_obj, *history_obj, *location_obj, *statusbar_obj, *menubar_obj, *navigator_obj; + static int initialized = 0; + assert(interpreter); if (!js_module_init_ok) return NULL; -// ctx = JS_NewContext(JS::DefaultHeapMaxBytes, JS::DefaultNurseryBytes); - ctx = JS_NewContext(8L * 1024 * 1024); - if (!ctx) - return NULL; + ctx = main_ctx; + + if (!ctx) { + return nullptr; + } + interpreter->backend_data = ctx; - JSAutoRequest ar(ctx); - JS_SetContextPrivate(ctx, interpreter); - //JS_SetOptions(ctx, JSOPTION_VAROBJFIX | JS_METHODJIT); + interpreter->ar = new JSAutoRequest(ctx); + //JSAutoRequest ar(ctx); + +// JS_SetContextPrivate(ctx, interpreter); + + //JS_SetOptions(main_ctx, JSOPTION_VAROBJFIX | JS_METHODJIT); JS::SetWarningReporter(ctx, error_reporter); JS_AddInterruptCallback(ctx, heartbeat_callback); JS::CompartmentOptions options; - if (!JS::InitSelfHostedCode(ctx)) { - return NULL; - } - JS::RootedObject window_obj(ctx, JS_NewGlobalObject(ctx, &window_class, NULL, JS::FireOnNewGlobalHook, options)); if (window_obj) { @@ -338,6 +348,8 @@ spidermonkey_get_interpreter(struct ecmascript_interpreter *interpreter) } // JS_SetPrivate(navigator_obj, interpreter->vs); + JS_SetCompartmentPrivate(js::GetContextCompartment(ctx), interpreter); + return ctx; release_and_fail: @@ -352,13 +364,18 @@ spidermonkey_put_interpreter(struct ecmascript_interpreter *interpreter) assert(interpreter); if (!js_module_init_ok) return; + ctx = interpreter->backend_data; if (interpreter->ac) { delete (JSAutoCompartment *)interpreter->ac; } - JS_DestroyContext(ctx); + if (interpreter->ar) { + delete (JSAutoRequest *)interpreter->ar; + } +// JS_DestroyContext(ctx); interpreter->backend_data = NULL; interpreter->ac = nullptr; + interpreter->ar = nullptr; } diff --git a/src/ecmascript/spidermonkey/document.c b/src/ecmascript/spidermonkey/document.c index fe5bf51c..86b332bf 100644 --- a/src/ecmascript/spidermonkey/document.c +++ b/src/ecmascript/spidermonkey/document.c @@ -267,7 +267,7 @@ document_set_property_title(JSContext *ctx, int argc, JS::Value *vp) vs = JS_GetInstancePrivate(ctx, hobj, &document_class, NULL); - if (!vs) { + if (!vs || !vs->doc_view) { return false; } doc_view = vs->doc_view; @@ -401,8 +401,15 @@ const spidermonkeyFunctionSpec document_funcs[] = { static bool document_write_do(JSContext *ctx, unsigned int argc, JS::Value *rval, int newline) { + JSCompartment *comp = js::GetContextCompartment(ctx); + + if (!comp) { + return false; + } + + struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp); JS::Value val; - struct ecmascript_interpreter *interpreter = JS_GetContextPrivate(ctx); +// struct ecmascript_interpreter *interpreter = JS_GetContextPrivate(ctx); struct string *ret = interpreter->ret; JS::CallArgs args = JS::CallArgsFromVp(argc, rval); diff --git a/src/ecmascript/spidermonkey/heartbeat.c b/src/ecmascript/spidermonkey/heartbeat.c index 65383bf5..099881f4 100644 --- a/src/ecmascript/spidermonkey/heartbeat.c +++ b/src/ecmascript/spidermonkey/heartbeat.c @@ -36,7 +36,14 @@ static struct itimerval heartbeat_timer = { { 1, 0 }, { 1, 0 } }; bool heartbeat_callback(JSContext *ctx) { - struct ecmascript_interpreter *interpreter = JS_GetContextPrivate(ctx); + JSCompartment *comp = js::GetContextCompartment(ctx); + + if (!comp) { + return true; + } + + struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp); +// struct ecmascript_interpreter *interpreter = JS_GetContextPrivate(ctx); if (!interpreter->heartbeat || interpreter->heartbeat->ttl > 0) { return true; diff --git a/src/ecmascript/spidermonkey/location.c b/src/ecmascript/spidermonkey/location.c index 48827afa..10ee9e22 100644 --- a/src/ecmascript/spidermonkey/location.c +++ b/src/ecmascript/spidermonkey/location.c @@ -73,7 +73,13 @@ const spidermonkeyFunctionSpec history_funcs[] = { static bool history_back(JSContext *ctx, unsigned int argc, JS::Value *rval) { - struct ecmascript_interpreter *interpreter = JS_GetContextPrivate(ctx); + JSCompartment *comp = js::GetContextCompartment(ctx); + + if (!comp) { + return false; + } + + struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp); struct document_view *doc_view = interpreter->vs->doc_view; struct session *ses = doc_view->session; JS::CallArgs args = JS::CallArgsFromVp(argc, rval); @@ -92,7 +98,14 @@ history_back(JSContext *ctx, unsigned int argc, JS::Value *rval) static bool history_forward(JSContext *ctx, unsigned int argc, JS::Value *rval) { - struct ecmascript_interpreter *interpreter = JS_GetContextPrivate(ctx); + JSCompartment *comp = js::GetContextCompartment(ctx); + + if (!comp) { + return false; + } + + struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp); +// struct ecmascript_interpreter *interpreter = JS_GetContextPrivate(ctx); struct document_view *doc_view = interpreter->vs->doc_view; struct session *ses = doc_view->session; JS::CallArgs args = JS::CallArgsFromVp(argc, rval); @@ -107,7 +120,14 @@ history_forward(JSContext *ctx, unsigned int argc, JS::Value *rval) static bool history_go(JSContext *ctx, unsigned int argc, JS::Value *rval) { - struct ecmascript_interpreter *interpreter = JS_GetContextPrivate(ctx); + JSCompartment *comp = js::GetContextCompartment(ctx); + + if (!comp) { + return false; + } + + struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp); +// struct ecmascript_interpreter *interpreter = JS_GetContextPrivate(ctx); struct document_view *doc_view = interpreter->vs->doc_view; struct session *ses = doc_view->session; JS::CallArgs args = JS::CallArgsFromVp(argc, rval); diff --git a/src/ecmascript/spidermonkey/window.c b/src/ecmascript/spidermonkey/window.c index 1279e231..8f4f3bda 100644 --- a/src/ecmascript/spidermonkey/window.c +++ b/src/ecmascript/spidermonkey/window.c @@ -427,9 +427,16 @@ end: static bool window_setTimeout(JSContext *ctx, unsigned int argc, JS::Value *rval) { + JSCompartment *comp = js::GetContextCompartment(ctx); + + if (!comp) { + return false; + } + + struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp); + JS::CallArgs args = JS::CallArgsFromVp(argc, rval); -// JS::Value *argv = JS_ARGV(ctx, rval); - struct ecmascript_interpreter *interpreter = JS_GetContextPrivate(ctx); +// struct ecmascript_interpreter *interpreter = JS_GetContextPrivate(ctx); unsigned char *code; int timeout; From d1f8248a0ca2727dcedbd128e713ec4b9795b90b Mon Sep 17 00:00:00 2001 From: Witold Filipczyk Date: Thu, 29 Oct 2020 19:21:14 +0100 Subject: [PATCH 073/179] [uri] pass to tab-external-command uri with #fragment . Refs #75 --- src/dialogs/menu.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/dialogs/menu.c b/src/dialogs/menu.c index 6c8f4f27..64d0b67a 100644 --- a/src/dialogs/menu.c +++ b/src/dialogs/menu.c @@ -841,7 +841,11 @@ pass_uri_to_command(struct session *ses, struct document_view *doc_view, } default: case PASS_URI_TAB: - uri = get_uri_reference(ses->doc_view->document->uri); + uri = have_location(ses) ? cur_loc(ses)->vs.uri : ses->loading_uri; + if (!uri) { + return FRAME_EVENT_OK; + } + uri = get_uri_reference(uri); }; items = new_menu(FREE_LIST | FREE_TEXT | FREE_DATA | NO_INTL); From ee5ec9c2879b66b175cf653e2a3334d9f7b07fe3 Mon Sep 17 00:00:00 2001 From: Witold Filipczyk Date: Thu, 29 Oct 2020 20:23:39 +0100 Subject: [PATCH 074/179] [dump] Removed silly debug statement. --- src/main/main.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/main.c b/src/main/main.c index 5b291be6..22a90893 100644 --- a/src/main/main.c +++ b/src/main/main.c @@ -202,7 +202,6 @@ init(void) /* The ECMAScript code is not good at coping with this. And it * makes currently no sense to evaluate ECMAScript in this * context anyway. */ - printf("AAA\n"); get_opt_bool("ecmascript.enable", NULL) = 0; #endif if (!list_empty(url_list)) { From 434ce282ce089809beec1445fc765d9d7b9c1871 Mon Sep 17 00:00:00 2001 From: Witold Filipczyk Date: Thu, 29 Oct 2020 20:40:08 +0100 Subject: [PATCH 075/179] [uri] Try to get frame uri with #fragment. Refs #75 --- src/dialogs/menu.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/dialogs/menu.c b/src/dialogs/menu.c index 64d0b67a..36141465 100644 --- a/src/dialogs/menu.c +++ b/src/dialogs/menu.c @@ -826,7 +826,8 @@ pass_uri_to_command(struct session *ses, struct document_view *doc_view, switch (type) { case PASS_URI_FRAME: - uri = get_uri_reference(doc_view->document->uri); + uri = get_uri_reference((doc_view->vs && doc_view->vs->uri) + ? doc_view->vs->uri : doc_view->document->uri); break; case PASS_URI_LINK: From 44c1f77ba4c489b33be860ab1eafd9207fc88e78 Mon Sep 17 00:00:00 2001 From: Witold Filipczyk Date: Fri, 30 Oct 2020 19:35:26 +0100 Subject: [PATCH 076/179] [search] Introduced "document.browse.search.reset". Refs #76 Default 1, old behaviour, but if you set it to 0, you can search once, and view results everywhere. --- src/config/options.inc | 6 ++++++ src/session/history.c | 4 +++- src/session/task.c | 4 +++- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/config/options.inc b/src/config/options.inc index 5840fcf4..4d064ede 100644 --- a/src/config/options.inc +++ b/src/config/options.inc @@ -439,6 +439,12 @@ static union option_info config_options_info[] = { "2 for extended regular expression searches")), #endif + INIT_OPT_BOOL("document.browse.search", N_("Reset searching on new pages"), + "reset", 0, 1, + N_("Whether to clear search, when visiting new pages, or going back " + "in history. Default 1. If you set it to 0, you can search once and " + "see results on every page.")), + INIT_OPT_BOOL("document.browse.search", N_("Show search hit top or bottom dialogs"), "show_hit_top_bottom", 0, 1, N_("Whether to show a dialog when the search hits the top or " diff --git a/src/session/history.c b/src/session/history.c index 281ffdc9..b07a23d8 100644 --- a/src/session/history.c +++ b/src/session/history.c @@ -103,7 +103,9 @@ ses_history_move(struct session *ses) /* Prepare. */ free_files(ses); - mem_free_set(&ses->search_word, NULL); + if (get_opt_bool("document.browse.search.reset", NULL)) { + mem_free_set(&ses->search_word, NULL); + } /* Does it make sense? */ diff --git a/src/session/task.c b/src/session/task.c index 8d01bc9c..a9964ce6 100644 --- a/src/session/task.c +++ b/src/session/task.c @@ -312,7 +312,9 @@ ses_forward(struct session *ses, int loaded_in_frame) if (!loaded_in_frame) { free_files(ses); - mem_free_set(&ses->search_word, NULL); + if (get_opt_bool("document.browse.search.reset", NULL)) { + mem_free_set(&ses->search_word, NULL); + } } x: From 073a4374ffcc2b4a8d4bcca50991ad1ec03606e4 Mon Sep 17 00:00:00 2001 From: Witold Filipczyk Date: Sat, 31 Oct 2020 22:47:17 +0100 Subject: [PATCH 077/179] [search] Repeat searching, when pressing 'n'. Refs #76 On new page number_of_search_points is 0, so do search in such case, when user pressed 'n'. --- src/viewer/text/search.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/viewer/text/search.c b/src/viewer/text/search.c index ac9ed220..4aca1cb6 100644 --- a/src/viewer/text/search.c +++ b/src/viewer/text/search.c @@ -1312,8 +1312,20 @@ find_first_search_in_view(struct session *ses, struct document_view *doc_view) static enum frame_event_status move_search_do(struct session *ses, struct document_view *doc_view, int direction) { - if (!doc_view->document->number_of_search_points) - return FRAME_EVENT_OK; + + if (!doc_view->document->number_of_search_points) { +#ifdef CONFIG_UTF8 + int utf8 = doc_view->document->options.utf8; +#else + int utf8 = 0; +#endif + enum find_error error = get_searched_all(ses, doc_view, &doc_view->document->search_points, + &doc_view->document->number_of_search_points, utf8); + + if (error == FIND_ERROR_NOT_FOUND) { + return FRAME_EVENT_OK; + } + } int number; From 0989068e5ccba2b6e334fa41def9aa6112ddffc5 Mon Sep 17 00:00:00 2001 From: Witold Filipczyk Date: Sun, 1 Nov 2020 14:57:25 +0100 Subject: [PATCH 078/179] [search] Set current_search_number to -1. Refs #76 --- src/viewer/text/search.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/viewer/text/search.c b/src/viewer/text/search.c index 4aca1cb6..1460f925 100644 --- a/src/viewer/text/search.c +++ b/src/viewer/text/search.c @@ -1319,6 +1319,7 @@ move_search_do(struct session *ses, struct document_view *doc_view, int directio #else int utf8 = 0; #endif + doc_view->vs->current_search_number = -1; enum find_error error = get_searched_all(ses, doc_view, &doc_view->document->search_points, &doc_view->document->number_of_search_points, utf8); From 08da1d87eb74e082ca7aae8c81d2518a4415f3a7 Mon Sep 17 00:00:00 2001 From: Witold Filipczyk Date: Wed, 4 Nov 2020 17:26:46 +0100 Subject: [PATCH 079/179] [search] set searched word in setup_session. Refs #76 --- src/session/session.c | 4 ++++ src/viewer/text/search.c | 1 - 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/session/session.c b/src/session/session.c index 99b4f15b..b8227509 100644 --- a/src/session/session.c +++ b/src/session/session.c @@ -895,6 +895,10 @@ setup_first_session(struct session *ses, struct uri *uri) static void setup_session(struct session *ses, struct uri *uri, struct session *base) { + if (base && !get_opt_bool("document.browse.search.reset", NULL)) { + ses->search_word = null_or_stracpy(base->search_word); + } + if (base && have_location(base)) { ses_load(ses, get_uri_reference(cur_loc(base)->vs.uri), NULL, NULL, CACHE_MODE_ALWAYS, TASK_FORWARD); diff --git a/src/viewer/text/search.c b/src/viewer/text/search.c index 1460f925..b80c469e 100644 --- a/src/viewer/text/search.c +++ b/src/viewer/text/search.c @@ -1312,7 +1312,6 @@ find_first_search_in_view(struct session *ses, struct document_view *doc_view) static enum frame_event_status move_search_do(struct session *ses, struct document_view *doc_view, int direction) { - if (!doc_view->document->number_of_search_points) { #ifdef CONFIG_UTF8 int utf8 = doc_view->document->options.utf8; From 000b391c2dcc0a35b76a19604158e5d72a3eb00d Mon Sep 17 00:00:00 2001 From: Witold Filipczyk Date: Mon, 9 Nov 2020 21:16:43 +0100 Subject: [PATCH 080/179] [brotli] used pkg-config for libbrotlidec This will let build static binary with brotli. --- configure.ac | 40 +++++++++++++++++++++++++++++++++++----- 1 file changed, 35 insertions(+), 5 deletions(-) diff --git a/configure.ac b/configure.ac index 91f03444..351ee56e 100644 --- a/configure.ac +++ b/configure.ac @@ -489,20 +489,49 @@ EL_CONFIG_OPTIONAL_LIBRARY(CONFIG_GZIP, zlib, zlib.h, z, gzclearerr, EL_CONFIG_OPTIONAL_LIBRARY(CONFIG_BZIP2, bzlib, bzlib.h, bz2, BZ2_bzReadOpen, [ --without-bzlib disable bzlib support]) -EL_CONFIG_OPTIONAL_LIBRARY(CONFIG_BROTLI, brotli, brotli/decode.h, brotlidec, BrotliDecoderDecompressStream, - [ --with-brotli enable experimental brotli support]) - EL_CONFIG_OPTIONAL_LIBRARY(CONFIG_ZSTD, zstd, zstd.h, zstd, ZSTD_createDCtx, [ --with-zstd enable experimental zstd support]) -EL_CONFIG_OPTIONAL_LIBRARY(CONFIG_IDN, idn, idna.h, idn, stringprep_check_version, - [ --without-idn disable international domain names support]) +# =================================================================== +# brotli +# =================================================================== + +BROTLI_CFLAGS= +BROTLI_LIBS= +CONFIG_BROTLI=no +enable_brotli=no + +AC_ARG_WITH(brotli, [ --with-brotli enable brotli], + [ if test "x$withval" != xno; then enable_brotli=yes; fi ]) + +if test "$enable_brotli" = no; then + AC_MSG_CHECKING([[for brotli]]) + AC_MSG_RESULT([[disabled]]) +else + AC_MSG_CHECKING([[for brotli in pkg-config]]) + if $PKG_CONFIG libbrotlidec; then + BROTLI_CFLAGS=`$PKG_CONFIG --cflags libbrotlidec` + BROTLI_LIBS=`$PKG_CONFIG --libs libbrotlidec` + LIBS="$BROTLI_LIBS $LIBS" + CONFIG_BROTLI=yes + AC_DEFINE([CONFIG_BROTLI], [1], [Define as 1 to use the libbrotli library.]) + AC_MSG_RESULT([[yes]]) + else + enable_brotli=no + fi +fi +AC_SUBST(BROTLI_CFLAGS) +AC_SUBST(BROTLI_LIBS) +EL_LOG_CONFIG([CONFIG_BROTLI], [[brotli]], [[$enable_brotli]]) # LZMA disabled by default, because of little usability and compilation problems # with new xz EL_CONFIG_OPTIONAL_LIBRARY(CONFIG_LZMA, lzma, lzma.h, lzma, lzma_code, [ --with-lzma enable lzma encoding support]) +EL_CONFIG_OPTIONAL_LIBRARY(CONFIG_IDN, idn, idna.h, idn, stringprep_check_version, + [ --without-idn disable international domain names support]) + # =================================================================== # Check for GSSAPI, optional even if installed. # =================================================================== @@ -1616,6 +1645,7 @@ AC_SUBST(LIBDOM_CFLAGS) AC_SUBST(LIBDOM_LIBS) EL_LOG_CONFIG([CONFIG_LIBDOM], [[libdom]], [[$enable_libdom]]) + # =================================================================== # Further LDFLAGS tweaks # =================================================================== From 6171e286bd333ee53eab1da5015d4e2634e7e5bb Mon Sep 17 00:00:00 2001 From: Witold Filipczyk Date: Mon, 9 Nov 2020 22:04:48 +0100 Subject: [PATCH 081/179] [static] Added --with-static option --- configure.ac | 70 +++++++++++++++++++++++++++++++++------------------- 1 file changed, 44 insertions(+), 26 deletions(-) diff --git a/configure.ac b/configure.ac index 351ee56e..17b6c04a 100644 --- a/configure.ac +++ b/configure.ac @@ -130,6 +130,21 @@ if test "x$ac_cv_c_compiler_gnu" = "xyes"; then CFLAGS="$CFLAGS -Wall" fi +# =================================================================== +# static binary +# =================================================================== + +enable_static=no +PKG_CONFIG_STATIC= + +AC_ARG_WITH(static, [ --with-static enable build of static binary], + [ if test "x$withval" != xno; then enable_static=yes; fi ]) + +if test "$enable_static" = yes; then + CFLAGS="$CFLAGS -static" + PKG_CONFIG_STATIC="--static" +fi + # =================================================================== # Checks for special OSes. # =================================================================== @@ -509,9 +524,9 @@ if test "$enable_brotli" = no; then AC_MSG_RESULT([[disabled]]) else AC_MSG_CHECKING([[for brotli in pkg-config]]) - if $PKG_CONFIG libbrotlidec; then - BROTLI_CFLAGS=`$PKG_CONFIG --cflags libbrotlidec` - BROTLI_LIBS=`$PKG_CONFIG --libs libbrotlidec` + if $PKG_CONFIG $PKG_CONFIG_STATIC libbrotlidec; then + BROTLI_CFLAGS=`$PKG_CONFIG $PKG_CONFIG_STATIC --cflags libbrotlidec` + BROTLI_LIBS=`$PKG_CONFIG $PKG_CONFIG_STATIC --libs libbrotlidec` LIBS="$BROTLI_LIBS $LIBS" CONFIG_BROTLI=yes AC_DEFINE([CONFIG_BROTLI], [1], [Define as 1 to use the libbrotli library.]) @@ -646,9 +661,9 @@ for package in mozjs-52; do break else AC_MSG_CHECKING([for SpiderMonkey (mozjs-52) in pkg-config $package]) - if $PKG_CONFIG --cflags --libs $package > /dev/null 2>&AS_MESSAGE_LOG_FD; then - SPIDERMONKEY_LIBS="$($PKG_CONFIG --libs $package)" - SPIDERMONKEY_CFLAGS="$($PKG_CONFIG --cflags $package)" + if $PKG_CONFIG $PKG_CONFIG_STATIC --cflags --libs $package > /dev/null 2>&AS_MESSAGE_LOG_FD; then + SPIDERMONKEY_LIBS="$($PKG_CONFIG $PKG_CONFIG_STATIC --libs $package)" + SPIDERMONKEY_CFLAGS="$($PKG_CONFIG $PKG_CONFIG_STATIC --cflags $package)" LIBS="$SPIDERMONKEY_LIBS $LIBS_X" CFLAGS="$CFLAGS_X $SPIDERMONKEY_CFLAGS" CPPFLAGS="$CPPFLAGS_X $SPIDERMONKEY_CFLAGS" @@ -911,9 +926,9 @@ AC_MSG_CHECKING([for Lua]) EL_SAVE_FLAGS cf_result=no -if test -n "$luapkg" && $PKG_CONFIG "$luapkg"; then - LUA_CFLAGS=`$PKG_CONFIG --cflags "$luapkg"` - LUA_LIBS=`$PKG_CONFIG --libs "$luapkg"` +if test -n "$luapkg" && $PKG_CONFIG $PKG_CONFIG_STATIC "$luapkg"; then + LUA_CFLAGS=`$PKG_CONFIG $PKG_CONFIG_STATIC --cflags "$luapkg"` + LUA_LIBS=`$PKG_CONFIG $PKG_CONFIG_STATIC --libs "$luapkg"` CFLAGS="$CFLAGS_X $LUA_CFLAGS" CPPFLAGS="$CPPFLAGS_X $LUA_CFLAGS" LIBS="$LUA_LIBS $LIBS_X" @@ -964,9 +979,9 @@ if test "$with_tre" = no; then tre_log="no (explicitly disabled)" else AC_MSG_CHECKING([[for TRE in pkg-config]]) - if $PKG_CONFIG tre; then - TRE_CFLAGS=`$PKG_CONFIG --cflags tre` - TRE_LIBS=`$PKG_CONFIG --libs tre` + if $PKG_CONFIG $PKG_CONFIG_STATIC tre; then + TRE_CFLAGS=`$PKG_CONFIG $PKG_CONFIG_STATIC --cflags tre` + TRE_LIBS=`$PKG_CONFIG $PKG_CONFIG_STATIC --libs tre` AC_MSG_RESULT([[yes]]) else # @@ -1032,7 +1047,7 @@ AC_ARG_WITH(gnutls, [[ --with-gnutls enable GNUTLS SSL support]], "yes") chosen_ssl_library="GNUTLS" ;; *) chosen_ssl_library="GNUTLS" AC_MSG_WARN([[Support for --with-gnutls=DIR has been removed. -You may have to set the PKG_CONFIG_PATH environment variable instead.]]) ;; +You may have to set the PKG_CONFIG $PKG_CONFIG_STATIC_PATH environment variable instead.]]) ;; esac]) AC_ARG_WITH(openssl, [[ --without-openssl disable OpenSSL support]]) @@ -1066,9 +1081,9 @@ elif test -z "${with_nss_compat_ossl+set}"; then else EL_SAVE_FLAGS if test "$with_nss_compat_ossl" = yes; then - if $PKG_CONFIG nss; then - CFLAGS="$CFLAGS_X `$PKG_CONFIG --cflags nss`" - LIBS="$LIBS_X `$PKG_CONFIG --libs nss`" + if $PKG_CONFIG $PKG_CONFIG_STATIC nss; then + CFLAGS="$CFLAGS_X `$PKG_CONFIG $PKG_CONFIG_STATIC --cflags nss`" + LIBS="$LIBS_X `$PKG_CONFIG $PKG_CONFIG_STATIC --libs nss`" else with_nss_compat_ossl=no fi @@ -1165,9 +1180,9 @@ elif test -n "$chosen_ssl_library" && test "$chosen_ssl_library" != "GNUTLS"; th else cf_result=no AC_MSG_CHECKING([[for GNUTLS (1.2 or later) in pkg-config]]) - if $PKG_CONFIG --atleast-version=1.2 gnutls; then - GNUTLS_CFLAGS=`$PKG_CONFIG --cflags gnutls` - GNUTLS_LIBS=`$PKG_CONFIG --libs gnutls` + if $PKG_CONFIG $PKG_CONFIG_STATIC --atleast-version=1.2 gnutls; then + GNUTLS_CFLAGS=`$PKG_CONFIG $PKG_CONFIG_STATIC --cflags gnutls` + GNUTLS_LIBS=`$PKG_CONFIG $PKG_CONFIG_STATIC --libs gnutls` AC_MSG_RESULT([[yes: $GNUTLS_CFLAGS $GNUTLS_LIBS]]) EL_SAVE_FLAGS @@ -1630,9 +1645,9 @@ if test "$enable_libdom" = no; then AC_MSG_RESULT([[disabled]]) else AC_MSG_CHECKING([[for libdom in pkg-config]]) - if $PKG_CONFIG libdom; then - LIBDOM_CFLAGS=`$PKG_CONFIG --cflags libdom` - LIBDOM_LIBS=`$PKG_CONFIG --libs libdom` + if $PKG_CONFIG $PKG_CONFIG_STATIC libdom; then + LIBDOM_CFLAGS=`$PKG_CONFIG $PKG_CONFIG_STATIC --cflags libdom` + LIBDOM_LIBS=`$PKG_CONFIG $PKG_CONFIG_STATIC --libs libdom` LIBS="$LIBDOM_LIBS $LIBS" CONFIG_LIBDOM=yes AC_DEFINE([CONFIG_LIBDOM], [1], [Define as 1 to use the libdom library.]) @@ -1688,11 +1703,14 @@ test "$CONFIG_OS_OS2" = yes && LDFLAGS=`echo "$LDFLAGS" | sed "s/-Zbin-files//g" # linker from finding the libraries listed in -l operands. So this # -rdynamic check needs to happen after the libraries have already # been added to $LDFLAGS. +have_rdynamic=no AC_MSG_CHECKING([for -rdynamic]) -LDFLAGS_X="$LDFLAGS" -LDFLAGS="-rdynamic $LDFLAGS" -AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])],[have_rdynamic=yes],[have_rdynamic=no]) -test "$have_rdynamic" = no && LDFLAGS="$LDFLAGS_X" +if test "$enable_static" = no; then + LDFLAGS_X="$LDFLAGS" + LDFLAGS="-rdynamic $LDFLAGS" + AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])],[have_rdynamic=yes],[have_rdynamic=no]) + test "$have_rdynamic" = no && LDFLAGS="$LDFLAGS_X" +fi AC_MSG_RESULT($have_rdynamic) # =================================================================== From b0ced9308b0b7041e631f0d162980507d95b8538 Mon Sep 17 00:00:00 2001 From: Witold Filipczyk Date: Sun, 15 Nov 2020 17:55:58 +0100 Subject: [PATCH 082/179] [spidermonkey] Some random changes. --- src/ecmascript/spidermonkey-shared.h | 22 +- src/ecmascript/spidermonkey/document.c | 15 +- src/ecmascript/spidermonkey/form.c | 299 +------------------------ src/ecmascript/spidermonkey/util.h | 22 -- src/ecmascript/spidermonkey/window.c | 116 +--------- 5 files changed, 38 insertions(+), 436 deletions(-) diff --git a/src/ecmascript/spidermonkey-shared.h b/src/ecmascript/spidermonkey-shared.h index e6f9d47f..52c88fe4 100644 --- a/src/ecmascript/spidermonkey-shared.h +++ b/src/ecmascript/spidermonkey-shared.h @@ -53,35 +53,29 @@ JSObject *spidermonkey_InitClass(JSContext *cx, JSObject *obj, JSPropertySpec *static_ps, const spidermonkeyFunctionSpec *static_fs); -static void undef_to_jsval(JSContext *ctx, JS::Value *vp); static unsigned char *jsval_to_string(JSContext *ctx, JS::Value *vp); -static unsigned char *jsid_to_string(JSContext *ctx, jsid *id); +static unsigned char *jsid_to_string(JSContext *ctx, JS::HandleId hid); /* Inline functions */ -static inline void -undef_to_jsval(JSContext *ctx, JS::Value *vp) -{ - *vp = JS::NullValue(); -} - static inline unsigned char * -jsval_to_string(JSContext *ctx, JS::Value *vp) +jsval_to_string(JSContext *ctx, JS::HandleValue hvp) { - JS::RootedValue r_vp(ctx, *vp); - JSString *str = r_vp.toString(); +// JS::RootedValue r_vp(ctx, *vp); + JSString *str = hvp.toString(); +//JS::RootedString r_str(ctx, str); return empty_string_or_(JS_EncodeString(ctx, str)); } static inline unsigned char * -jsid_to_string(JSContext *ctx, jsid *id) +jsid_to_string(JSContext *ctx, JS::HandleId hid) { JS::RootedValue v(ctx); /* TODO: check returned value */ - JS_IdToValue(ctx, *id, &v); - return jsval_to_string(ctx, v.address()); + JS_IdToValue(ctx, hid, &v); + return jsval_to_string(ctx, v); } #define ELINKS_CAST_PROP_PARAMS JSObject *obj = (hobj.get()); \ diff --git a/src/ecmascript/spidermonkey/document.c b/src/ecmascript/spidermonkey/document.c index 86b332bf..97caa343 100644 --- a/src/ecmascript/spidermonkey/document.c +++ b/src/ecmascript/spidermonkey/document.c @@ -353,9 +353,6 @@ JSPropertySpec document_props[] = { static bool document_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { - ELINKS_CAST_PROP_PARAMS - jsid id = hid.get(); - JS::RootedObject parent_win(ctx); /* instance of @window_class */ struct view_state *vs; struct document_view *doc_view; @@ -363,7 +360,7 @@ document_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, J struct form *form; unsigned char *string; - JSClass* classPtr = JS_GetClass(obj); + JSClass* classPtr = JS_GetClass(hobj); if (classPtr != &document_class) return false; @@ -376,13 +373,17 @@ document_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, J &window_class, NULL); doc_view = vs->doc_view; document = doc_view->document; - string = jsid_to_string(ctx, &id); + + if (!JSID_IS_STRING(hid)) { + return true; + } + string = jsid_to_string(ctx, hid); foreach (form, document->forms) { if (!form->name || c_strcasecmp(string, form->name)) continue; - object_to_jsval(ctx, vp, get_form_object(ctx, obj, find_form_view(doc_view, form))); + hvp.setObject(*get_form_object(ctx, hobj, find_form_view(doc_view, form))); break; } @@ -417,7 +418,7 @@ document_write_do(JSContext *ctx, unsigned int argc, JS::Value *rval, int newlin int i = 0; for (; i < argc; ++i) { - unsigned char *code = jsval_to_string(ctx, args[i].address()); + unsigned char *code = jsval_to_string(ctx, args[i]); add_to_string(ret, code); } diff --git a/src/ecmascript/spidermonkey/form.c b/src/ecmascript/spidermonkey/form.c index 76630191..33a16a2c 100644 --- a/src/ecmascript/spidermonkey/form.c +++ b/src/ecmascript/spidermonkey/form.c @@ -1439,9 +1439,6 @@ input_get_form_state(JSContext *ctx, JSObject *jsinput) static bool input_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { - ELINKS_CAST_PROP_PARAMS - jsid id = hid.get(); - JS::RootedObject parent_form(ctx); /* instance of @form_class */ JS::RootedObject parent_doc(ctx); /* instance of @document_class */ struct view_state *vs; @@ -1469,125 +1466,8 @@ input_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS:: // parent_win = js::GetGlobalForObjectCrossCompartment(parent_doc); // assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); // if_assert_failed return false; - JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); + hvp.setUndefined(); - vs = JS_GetInstancePrivate(ctx, parent_win, - &window_class, NULL); - doc_view = vs->doc_view; - document = doc_view->document; - fs = input_get_form_state(ctx, hobj); - if (!fs) return false; /* detached */ - fc = find_form_control(document, fs); - - assert(fc); - assert(fc->form && fs); - - if (!JSID_IS_INT(id)) - return true; - - linknum = get_form_control_link(document, fc); - /* Hiddens have no link. */ - if (linknum >= 0) link = &document->links[linknum]; - - undef_to_jsval(ctx, vp); - - switch (JSID_TO_INT(id)) { - case JSP_INPUT_ACCESSKEY: - { - JSString *keystr; - - if (!link) break; - - if (!link->accesskey) { - *vp = JS_GetEmptyStringValue(ctx); - } else { - keystr = unicode_to_jsstring(ctx, link->accesskey); - if (keystr) - *vp = JS::StringValue(keystr); - else - return false; - } - break; - } - case JSP_INPUT_ALT: - string_to_jsval(ctx, vp, fc->alt); - break; - case JSP_INPUT_CHECKED: - boolean_to_jsval(ctx, vp, fs->state); - break; - case JSP_INPUT_DEFAULT_CHECKED: - boolean_to_jsval(ctx, vp, fc->default_state); - break; - case JSP_INPUT_DEFAULT_VALUE: - /* FIXME (bug 805): convert from the charset of the document */ - string_to_jsval(ctx, vp, fc->default_value); - break; - case JSP_INPUT_DISABLED: - /* FIXME: --pasky */ - boolean_to_jsval(ctx, vp, fc->mode == FORM_MODE_DISABLED); - break; - case JSP_INPUT_FORM: - object_to_jsval(ctx, vp, parent_form); - break; - case JSP_INPUT_MAX_LENGTH: - int_to_jsval(ctx, vp, fc->maxlength); - break; - case JSP_INPUT_NAME: - string_to_jsval(ctx, vp, fc->name); - break; - case JSP_INPUT_READONLY: - /* FIXME: --pasky */ - boolean_to_jsval(ctx, vp, fc->mode == FORM_MODE_READONLY); - break; - case JSP_INPUT_SIZE: - int_to_jsval(ctx, vp, fc->size); - break; - case JSP_INPUT_SRC: - if (link && link->where_img) - string_to_jsval(ctx, vp, link->where_img); - break; - case JSP_INPUT_TABINDEX: - if (link) - /* FIXME: This is WRONG. --pasky */ - int_to_jsval(ctx, vp, link->number); - break; - case JSP_INPUT_TYPE: - { - unsigned char *s = NULL; - - switch (fc->type) { - case FC_TEXT: s = "text"; break; - case FC_PASSWORD: s = "password"; break; - case FC_FILE: s = "file"; break; - case FC_CHECKBOX: s = "checkbox"; break; - case FC_RADIO: s = "radio"; break; - case FC_SUBMIT: s = "submit"; break; - case FC_IMAGE: s = "image"; break; - case FC_RESET: s = "reset"; break; - case FC_BUTTON: s = "button"; break; - case FC_HIDDEN: s = "hidden"; break; - case FC_SELECT: s = "select"; break; - default: INTERNAL("input_get_property() upon a non-input item."); break; - } - string_to_jsval(ctx, vp, s); - break; - } - case JSP_INPUT_VALUE: - string_to_jsval(ctx, vp, fs->value); - break; - - case JSP_INPUT_SELECTED_INDEX: - if (fc->type == FC_SELECT) int_to_jsval(ctx, vp, fs->state); - break; - default: - /* Unrecognized integer property ID; someone is using - * the object as an array. SMJS builtin classes (e.g. - * js_RegExpClass) just return true in this case - * and leave *@vp unchanged. Do the same here. - * (Actually not quite the same, as we already used - * @undef_to_jsval.) */ - break; - } return true; } @@ -1624,90 +1504,6 @@ input_set_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS:: // parent_win = js::GetGlobalForObjectCrossCompartment(parent_doc); // assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); // if_assert_failed return false; - JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); - - vs = JS_GetInstancePrivate(ctx, parent_win, - &window_class, NULL); - doc_view = vs->doc_view; - document = doc_view->document; - fs = input_get_form_state(ctx, hobj); - if (!fs) return false; /* detached */ - fc = find_form_control(document, fs); - - assert(fc); - assert(fc->form && fs); - - if (!JSID_IS_INT(id)) - return true; - - linknum = get_form_control_link(document, fc); - /* Hiddens have no link. */ - if (linknum >= 0) link = &document->links[linknum]; - - switch (JSID_TO_INT(id)) { - case JSP_INPUT_ACCESSKEY: - accesskey = jsval_to_accesskey(ctx, hvp); - if (accesskey == UCS_NO_CHAR) - return false; - else if (link) - link->accesskey = accesskey; - break; - case JSP_INPUT_ALT: - mem_free_set(&fc->alt, stracpy(jsval_to_string(ctx, vp))); - break; - case JSP_INPUT_CHECKED: - if (fc->type != FC_CHECKBOX && fc->type != FC_RADIO) - break; - fs->state = jsval_to_boolean(ctx, vp); - break; - case JSP_INPUT_DISABLED: - /* FIXME: --pasky */ - fc->mode = (jsval_to_boolean(ctx, vp) ? FORM_MODE_DISABLED - : fc->mode == FORM_MODE_READONLY ? FORM_MODE_READONLY - : FORM_MODE_NORMAL); - break; - case JSP_INPUT_MAX_LENGTH: - fc->maxlength = hvp.toInt32(); - break; - case JSP_INPUT_NAME: - mem_free_set(&fc->name, stracpy(jsval_to_string(ctx, vp))); - break; - case JSP_INPUT_READONLY: - /* FIXME: --pasky */ - fc->mode = (jsval_to_boolean(ctx, vp) ? FORM_MODE_READONLY - : fc->mode == FORM_MODE_DISABLED ? FORM_MODE_DISABLED - : FORM_MODE_NORMAL); - break; - case JSP_INPUT_SRC: - if (link) { - mem_free_set(&link->where_img, stracpy(jsval_to_string(ctx, vp))); - } - break; - case JSP_INPUT_VALUE: - if (fc->type == FC_FILE) - break; /* A huge security risk otherwise. */ - mem_free_set(&fs->value, stracpy(jsval_to_string(ctx, vp))); - if (fc->type == FC_TEXT || fc->type == FC_PASSWORD) - fs->state = strlen(fs->value); - break; - case JSP_INPUT_SELECTED_INDEX: - if (fc->type == FC_SELECT) { - int item = hvp.toInt32(); - - if (item >= 0 && item < fc->nvalues) { - fs->state = item; - mem_free_set(&fs->value, stracpy(fc->values[item])); - } - } - break; - - default: - /* Unrecognized integer property ID; someone is using - * the object as an array. SMJS builtin classes (e.g. - * js_RegExpClass) just return true in this case. - * Do the same here. */ - return true; - } return true; } @@ -2052,7 +1848,7 @@ form_elements_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId h hvp.setUndefined(); - switch (JSID_TO_INT(id)) { + switch (JSID_TO_INT(hid)) { case JSP_FORM_ELEMENTS_LENGTH: hvp.setInt32(list_size(&form->items)); break; @@ -2333,9 +2129,9 @@ form_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::M assert(form); - if (JSID_IS_STRING(id)) { + if (JSID_IS_STRING(hid)) { struct el_form_control *fc; - unsigned char *string = jsid_to_string(ctx, &id); + unsigned char *string = jsid_to_string(ctx, hid); foreach (fc, form->items) { JSObject *fcobj = NULL; @@ -2345,94 +2141,23 @@ form_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::M && (!fc->name || c_strcasecmp(string, fc->name))) continue; - undef_to_jsval(ctx, vp); + hvp.setUndefined(); fs = find_form_state(doc_view, fc); if (fs) { fcobj = get_form_control_object(ctx, fc->type, fs); - if (fcobj) - object_to_jsval(ctx, vp, fcobj); + if (fcobj) { + hvp.setObject(*fcobj); + } } break; } return true; } - if (!JSID_IS_INT(id)) + if (!JSID_IS_INT(hid)) return true; - undef_to_jsval(ctx, vp); - - switch (JSID_TO_INT(id)) { - case JSP_FORM_ACTION: - string_to_jsval(ctx, vp, form->action); - break; - - case JSP_FORM_ELEMENTS: - { - /* jsform ('form') is form_elements' parent; who knows is that's correct */ - JSObject *jsform_elems = JS_NewObjectWithGivenProto(ctx, &form_elements_class, hobj); - - JS::RootedObject r_jsform_elems(ctx, jsform_elems); - - JS_DefineProperties(ctx, r_jsform_elems, (JSPropertySpec *) form_elements_props); - spidermonkey_DefineFunctions(ctx, jsform_elems, - form_elements_funcs); - object_to_jsval(ctx, vp, jsform_elems); - /* SM will cache this property value for us so we create this - * just once per form. */ - } - break; - - case JSP_FORM_ENCODING: - switch (form->method) { - case FORM_METHOD_GET: - case FORM_METHOD_POST: - string_to_jsval(ctx, vp, "application/x-www-form-urlencoded"); - break; - case FORM_METHOD_POST_MP: - string_to_jsval(ctx, vp, "multipart/form-data"); - break; - case FORM_METHOD_POST_TEXT_PLAIN: - string_to_jsval(ctx, vp, "text/plain"); - break; - } - break; - - case JSP_FORM_LENGTH: - int_to_jsval(ctx, vp, list_size(&form->items)); - break; - - case JSP_FORM_METHOD: - switch (form->method) { - case FORM_METHOD_GET: - string_to_jsval(ctx, vp, "GET"); - break; - - case FORM_METHOD_POST: - case FORM_METHOD_POST_MP: - case FORM_METHOD_POST_TEXT_PLAIN: - string_to_jsval(ctx, vp, "POST"); - break; - } - break; - - case JSP_FORM_NAME: - string_to_jsval(ctx, vp, form->name); - break; - - case JSP_FORM_TARGET: - string_to_jsval(ctx, vp, form->target); - break; - - default: - /* Unrecognized integer property ID; someone is using - * the object as an array. SMJS builtin classes (e.g. - * js_RegExpClass) just return true in this case - * and leave *@vp unchanged. Do the same here. - * (Actually not quite the same, as we already used - * @undef_to_jsval.) */ - break; - } + hvp.setUndefined(); return true; } @@ -3228,8 +2953,8 @@ forms_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS:: &window_class, NULL); doc_view = vs->doc_view; - if (JSID_IS_STRING(id)) { - unsigned char *string = jsid_to_string(ctx, &id); + if (JSID_IS_STRING(hid)) { + unsigned char *string = jsid_to_string(ctx, hid); char *end; strtoll(string, &end, 10); diff --git a/src/ecmascript/spidermonkey/util.h b/src/ecmascript/spidermonkey/util.h index 8911b979..19a7f4a2 100644 --- a/src/ecmascript/spidermonkey/util.h +++ b/src/ecmascript/spidermonkey/util.h @@ -7,9 +7,6 @@ static void string_to_jsval(JSContext *ctx, JS::Value *vp, unsigned char *string); static void astring_to_jsval(JSContext *ctx, JS::Value *vp, unsigned char *string); -static void int_to_jsval(JSContext *ctx, JS::Value *vp, int number); -static void object_to_jsval(JSContext *ctx, JS::Value *vp, JSObject *object); -static void boolean_to_jsval(JSContext *ctx, JS::Value *vp, int boolean); static int jsval_to_boolean(JSContext *ctx, JS::Value *vp); @@ -34,25 +31,6 @@ astring_to_jsval(JSContext *ctx, JS::Value *vp, unsigned char *string) mem_free_if(string); } -static inline void -int_to_jsval(JSContext *ctx, JS::Value *vp, int number) -{ - *vp = JS::Int32Value(number); -} - -static inline void -object_to_jsval(JSContext *ctx, JS::Value *vp, JSObject *object) -{ - *vp = JS::ObjectValue(*object); -} - -static inline void -boolean_to_jsval(JSContext *ctx, JS::Value *vp, int boolean) -{ - *vp = JS::BooleanValue(boolean); -} - - static inline int jsval_to_boolean(JSContext *ctx, JS::Value *vp) { diff --git a/src/ecmascript/spidermonkey/window.c b/src/ecmascript/spidermonkey/window.c index 8f4f3bda..f0565177 100644 --- a/src/ecmascript/spidermonkey/window.c +++ b/src/ecmascript/spidermonkey/window.c @@ -134,8 +134,6 @@ find_child_frame(struct document_view *doc_view, struct frame_desc *tframe) static bool window_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { - jsid id = hid.get(); - struct view_state *vs; /* This can be called if @obj if not itself an instance of the @@ -150,9 +148,9 @@ window_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS: * location is then evaluated in string context, toString() * is called which we overrode for that class below, so * everything's fine. */ - if (JSID_IS_STRING(id)) { + if (JSID_IS_STRING(hid)) { struct document_view *doc_view = vs->doc_view; - JSObject *obj = try_resolve_frame(doc_view, jsid_to_string(ctx, &id)); + JSObject *obj = try_resolve_frame(doc_view, jsid_to_string(ctx, hid)); /* TODO: Try other lookups (mainly element lookup) until * something yields data. */ if (obj) { @@ -161,103 +159,11 @@ window_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS: return true; } - if (!JSID_IS_INT(id)) + if (!JSID_IS_INT(hid)) return true; hvp.setUndefined(); - switch (JSID_TO_INT(id)) { - case JSP_WIN_CLOSED: - /* TODO: It will be a major PITA to implement this properly. - * Well, perhaps not so much if we introduce reference tracking - * for (struct session)? Still... --pasky */ - hvp.setBoolean(false); - break; - case JSP_WIN_SELF: - hvp.setObject(*hobj.get()); - break; - case JSP_WIN_PARENT: - /* XXX: It would be nice if the following worked, yes. - * The problem is that we get called at the point where - * document.frame properties are going to be mostly NULL. - * But the problem is deeper because at that time we are - * yet building scrn_frames so our parent might not be there - * yet (XXX: is this true?). The true solution will be to just - * have struct document_view *(document_view.parent). --pasky */ - /* FIXME: So now we alias window.parent to window.top, which is - * INCORRECT but works for the most common cases of just two - * frames. Better something than nothing. */ -#if 0 - { - /* This is horrible. */ - struct document_view *doc_view = vs->doc_view; - struct session *ses = doc_view->session; - struct frame_desc *frame = doc_view->document->frame; - - if (!ses->doc_view->document->frame_desc) { - INTERNAL("Looking for parent but there're no frames."); - break; - } - assert(frame); - doc_view = ses->doc_view; - if (find_child_frame(doc_view, frame)) - goto found_parent; - foreach (doc_view, ses->scrn_frames) { - if (find_child_frame(doc_view, frame)) - goto found_parent; - } - INTERNAL("Cannot find frame %s parent.",doc_view->name); - break; - -found_parent: - some_domain_security_check(); - if (doc_view->vs.ecmascript_fragile) - ecmascript_reset_state(&doc_view->vs); - assert(doc_view->ecmascript); - object_to_jsval(ctx, vp, JS_GetGlobalForScopeChain(doc_view->ecmascript->backend_data)); - break; - } -#endif - case JSP_WIN_STATUS: - return false; - case JSP_WIN_TOP: - { - struct document_view *doc_view = vs->doc_view; - struct document_view *top_view = doc_view->session->doc_view; - JSObject *newjsframe; - - assert(top_view && top_view->vs); - if (top_view->vs->ecmascript_fragile) - ecmascript_reset_state(top_view->vs); - if (!top_view->vs->ecmascript) - break; - newjsframe = JS::CurrentGlobalOrNull(top_view->vs->ecmascript->backend_data); - - /* Keep this unrolled this way. Will have to check document.domain - * JS property. */ - /* Note that this check is perhaps overparanoid. If top windows - * is alien but some other child window is not, we should still - * let the script walk thru. That'd mean moving the check to - * other individual properties in this switch. */ - if (compare_uri(vs->uri, top_view->vs->uri, URI_HOST)) { - hvp.setObject(*newjsframe); - } - /* else */ - /****X*X*X*** SECURITY VIOLATION! RED ALERT, SHIELDS UP! ***X*X*X****\ - |* (Pasky was apparently looking at the Links2 JS code . ___ ^.^ *| - \* for too long.) `.(,_,)\o/ */ - break; - } - default: - /* Unrecognized integer property ID; someone is using - * the object as an array. SMJS builtin classes (e.g. - * js_RegExpClass) just return true in this case - * and leave *@vp unchanged. Do the same here. - * (Actually not quite the same, as we already used - * @undef_to_jsval.) */ - break; - } - return true; } @@ -314,7 +220,6 @@ window_alert(JSContext *ctx, unsigned int argc, JS::Value *rval) static bool window_open(JSContext *ctx, unsigned int argc, JS::Value *rval) { - JS::Value val; JSObject *obj = JS_THIS_OBJECT(ctx, rval); JS::RootedObject hobj(ctx, obj); JS::CallArgs args = JS::CallArgsFromVp(argc, rval); @@ -356,7 +261,7 @@ window_open(JSContext *ctx, unsigned int argc, JS::Value *rval) } } - url = stracpy(jsval_to_string(ctx, args[0].address())); + url = stracpy(jsval_to_string(ctx, args[0])); trim_chars(url, ' ', 0); url2 = join_urls(doc_view->document->uri, url); mem_free(url); @@ -364,7 +269,7 @@ window_open(JSContext *ctx, unsigned int argc, JS::Value *rval) return true; } if (argc > 1) { - frame = stracpy(jsval_to_string(ctx, args[1].address())); + frame = stracpy(jsval_to_string(ctx, args[1])); if (!frame) { mem_free(url2); return true; @@ -388,7 +293,7 @@ window_open(JSContext *ctx, unsigned int argc, JS::Value *rval) deo->uri = get_uri_reference(uri); deo->target = stracpy(frame); register_bottom_half(delayed_goto_uri_frame, deo); - boolean_to_jsval(ctx, &val, 1); + args.rval().setBoolean(true); goto end; } } @@ -399,7 +304,7 @@ window_open(JSContext *ctx, unsigned int argc, JS::Value *rval) && can_open_in_new(ses->tab->term)) { open_uri_in_new_window(ses, uri, NULL, ENV_ANY, CACHE_MODE_NORMAL, TASK_NONE); - boolean_to_jsval(ctx, &val, 1); + args.rval().setBoolean(true); } else { /* When opening a new tab, we might get rerendered, losing our * context and triggerring a disaster, so postpone that. */ @@ -409,9 +314,9 @@ window_open(JSContext *ctx, unsigned int argc, JS::Value *rval) deo->ses = ses; deo->uri = get_uri_reference(uri); register_bottom_half(delayed_open, deo); - boolean_to_jsval(ctx, &val, 1); + args.rval().setBoolean(true); } else { - undef_to_jsval(ctx, &val); + args.rval().setUndefined(); } } @@ -419,7 +324,6 @@ end: done_uri(uri); mem_free_if(frame); - args.rval().set(val); return true; } @@ -443,7 +347,7 @@ window_setTimeout(JSContext *ctx, unsigned int argc, JS::Value *rval) if (argc != 2) return true; - code = jsval_to_string(ctx, args[0].address()); + code = jsval_to_string(ctx, args[0]); if (!*code) return true; From 873797935cd4714ed9ce8f3fdebbfb09c7ade956 Mon Sep 17 00:00:00 2001 From: Witold Filipczyk Date: Mon, 16 Nov 2020 22:00:48 +0100 Subject: [PATCH 083/179] [spidermonkey] Some code related to compartments. Progress. --- src/ecmascript/ecmascript.h | 1 + src/ecmascript/spidermonkey.c | 57 +- src/ecmascript/spidermonkey/document.c | 142 ++-- src/ecmascript/spidermonkey/form.c | 907 ++++++++++--------------- src/ecmascript/spidermonkey/location.c | 28 +- src/ecmascript/spidermonkey/unibar.c | 28 +- src/ecmascript/spidermonkey/window.c | 43 +- 7 files changed, 554 insertions(+), 652 deletions(-) diff --git a/src/ecmascript/ecmascript.h b/src/ecmascript/ecmascript.h index 7f08d1b4..61203f92 100644 --- a/src/ecmascript/ecmascript.h +++ b/src/ecmascript/ecmascript.h @@ -54,6 +54,7 @@ struct ecmascript_interpreter { * to redraw. */ unsigned int onload_snippets_cache_id; void *ac; + void *ac2; void *ar; }; diff --git a/src/ecmascript/spidermonkey.c b/src/ecmascript/spidermonkey.c index 960fb673..e07c59dd 100644 --- a/src/ecmascript/spidermonkey.c +++ b/src/ecmascript/spidermonkey.c @@ -261,7 +261,8 @@ spidermonkey_get_interpreter(struct ecmascript_interpreter *interpreter) JS::RootedObject window_obj(ctx, JS_NewGlobalObject(ctx, &window_class, NULL, JS::FireOnNewGlobalHook, options)); if (window_obj) { - interpreter->ac = new JSAutoCompartment(ctx, window_obj); + interpreter->ac = window_obj; + interpreter->ac2 = new JSAutoCompartment(ctx, window_obj); } else { goto release_and_fail; } @@ -277,7 +278,7 @@ spidermonkey_get_interpreter(struct ecmascript_interpreter *interpreter) if (!spidermonkey_DefineFunctions(ctx, window_obj, window_funcs)) { goto release_and_fail; } - JS_SetPrivate(window_obj, interpreter->vs); /* to @window_class */ + //JS_SetPrivate(window_obj, interpreter); /* to @window_class */ document_obj = spidermonkey_InitClass(ctx, window_obj, NULL, &document_class, NULL, 0, @@ -287,7 +288,6 @@ spidermonkey_get_interpreter(struct ecmascript_interpreter *interpreter) if (!document_obj) { goto release_and_fail; } - JS_SetPrivate(document_obj, interpreter->vs); forms_obj = spidermonkey_InitClass(ctx, document_obj, NULL, &forms_class, NULL, 0, @@ -297,7 +297,6 @@ spidermonkey_get_interpreter(struct ecmascript_interpreter *interpreter) if (!forms_obj) { goto release_and_fail; } -// JS_SetPrivate(forms_obj, interpreter->vs); history_obj = spidermonkey_InitClass(ctx, window_obj, NULL, &history_class, NULL, 0, @@ -307,8 +306,6 @@ spidermonkey_get_interpreter(struct ecmascript_interpreter *interpreter) if (!history_obj) { goto release_and_fail; } -// JS_SetPrivate(history_obj, interpreter->vs); - location_obj = spidermonkey_InitClass(ctx, window_obj, NULL, &location_class, NULL, 0, @@ -318,8 +315,6 @@ spidermonkey_get_interpreter(struct ecmascript_interpreter *interpreter) if (!location_obj) { goto release_and_fail; } -// JS_SetPrivate(location_obj, interpreter->vs); - menubar_obj = JS_InitClass(ctx, window_obj, nullptr, &menubar_class, NULL, 0, @@ -346,8 +341,6 @@ spidermonkey_get_interpreter(struct ecmascript_interpreter *interpreter) if (!navigator_obj) { goto release_and_fail; } -// JS_SetPrivate(navigator_obj, interpreter->vs); - JS_SetCompartmentPrivate(js::GetContextCompartment(ctx), interpreter); return ctx; @@ -367,7 +360,7 @@ spidermonkey_put_interpreter(struct ecmascript_interpreter *interpreter) ctx = interpreter->backend_data; if (interpreter->ac) { - delete (JSAutoCompartment *)interpreter->ac; + //delete (JSAutoCompartment *)interpreter->ac; } if (interpreter->ar) { delete (JSAutoRequest *)interpreter->ar; @@ -391,6 +384,8 @@ spidermonkey_eval(struct ecmascript_interpreter *interpreter, return; } ctx = interpreter->backend_data; + JS_BeginRequest(ctx); + JSCompartment *comp = JS_EnterCompartment(ctx, interpreter->ac); interpreter->heartbeat = add_heartbeat(interpreter); interpreter->ret = ret; @@ -401,6 +396,8 @@ spidermonkey_eval(struct ecmascript_interpreter *interpreter, JS::Evaluate(ctx, options, code->source, code->length, &r_val); done_heartbeat(interpreter->heartbeat); + JS_LeaveCompartment(ctx, comp); + JS_EndRequest(ctx); } @@ -411,6 +408,7 @@ spidermonkey_eval_stringback(struct ecmascript_interpreter *interpreter, bool ret; JSContext *ctx; JS::Value rval; + unsigned char *result = NULL; assert(interpreter); if (!js_module_init_ok) return NULL; @@ -418,6 +416,9 @@ spidermonkey_eval_stringback(struct ecmascript_interpreter *interpreter, interpreter->ret = NULL; interpreter->heartbeat = add_heartbeat(interpreter); + JS_BeginRequest(ctx); + JSCompartment *comp = JS_EnterCompartment(ctx, interpreter->ac); + JS::RootedObject cg(ctx, JS::CurrentGlobalOrNull(ctx)); JS::RootedValue r_rval(ctx, rval); JS::CompileOptions options(ctx); @@ -431,14 +432,17 @@ spidermonkey_eval_stringback(struct ecmascript_interpreter *interpreter, done_heartbeat(interpreter->heartbeat); if (ret == false) { - return NULL; + result = NULL; } - if (r_rval.isNullOrUndefined()) { + else if (r_rval.isNullOrUndefined()) { /* Undefined value. */ - return NULL; + result = NULL; + } else { + result = stracpy(JS_EncodeString(ctx, r_rval.toString())); } - - return stracpy(JS_EncodeString(ctx, r_rval.toString())); + JS_LeaveCompartment(ctx, comp); + JS_EndRequest(ctx); + return result; } @@ -449,12 +453,16 @@ spidermonkey_eval_boolback(struct ecmascript_interpreter *interpreter, JSContext *ctx; JS::Value rval; int ret; + int result = 0; assert(interpreter); if (!js_module_init_ok) return 0; ctx = interpreter->backend_data; interpreter->ret = NULL; + JSCompartment *comp = JS_EnterCompartment(ctx, interpreter->ac); + JS_BeginRequest(ctx); + JS::RootedFunction fun(ctx); JS::CompileOptions options(ctx); @@ -471,17 +479,22 @@ spidermonkey_eval_boolback(struct ecmascript_interpreter *interpreter, done_heartbeat(interpreter->heartbeat); if (ret == 2) { /* onClick="history.back()" */ - return 0; + result = 0; } - if (ret == false) { - return -1; + else if (ret == false) { + result = -1; } - if (r_val.isUndefined()) { + else if (r_val.isUndefined()) { /* Undefined value. */ - return -1; + result = -1; + } else { + result = r_val.toBoolean(); } - return r_val.toBoolean(); + JS_LeaveCompartment(ctx, comp); + JS_EndRequest(ctx); + + return result; } struct module spidermonkey_module = struct_module( diff --git a/src/ecmascript/spidermonkey/document.c b/src/ecmascript/spidermonkey/document.c index 97caa343..0d2543f1 100644 --- a/src/ecmascript/spidermonkey/document.c +++ b/src/ecmascript/spidermonkey/document.c @@ -10,6 +10,7 @@ #include "elinks.h" +#include "ecmascript/ecmascript.h" #include "ecmascript/spidermonkey/util.h" #include @@ -70,15 +71,20 @@ document_get_property_cookie(JSContext *ctx, unsigned int argc, JS::Value *vp) { JS::CallArgs args = CallArgsFromVp(argc, vp); JS::RootedObject hobj(ctx, &args.thisv().toObject()); - JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); + + JSCompartment *comp = js::GetContextCompartment(ctx); + + if (!comp) { + return false; + } + + struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp); + struct view_state *vs; struct string *cookies; - assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); - if_assert_failed return false; + vs = interpreter->vs; - vs = JS_GetInstancePrivate(ctx, parent_win, - &window_class, NULL); if (!vs) { return false; } @@ -102,15 +108,19 @@ document_set_property_cookie(JSContext *ctx, unsigned int argc, JS::Value *vp) { JS::CallArgs args = CallArgsFromVp(argc, vp); JS::RootedObject hobj(ctx, &args.thisv().toObject()); - JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); + + JSCompartment *comp = js::GetContextCompartment(ctx); + + if (!comp) { + return false; + } + + struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp); + struct view_state *vs; struct string *cookies; - assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); - if_assert_failed return false; - - vs = JS_GetInstancePrivate(ctx, parent_win, - &window_class, NULL); + vs = interpreter->vs; if (!vs) { return false; } @@ -141,15 +151,20 @@ document_set_property_location(JSContext *ctx, unsigned int argc, JS::Value *vp) { JS::CallArgs args = CallArgsFromVp(argc, vp); JS::RootedObject hobj(ctx, &args.thisv().toObject()); - JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); + + JSCompartment *comp = js::GetContextCompartment(ctx); + + if (!comp) { + return false; + } + + struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp); + struct view_state *vs; struct document_view *doc_view; - assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); - if_assert_failed return false; + vs = interpreter->vs; - vs = JS_GetInstancePrivate(ctx, parent_win, - &window_class, NULL); if (!vs) { return false; } @@ -165,17 +180,21 @@ document_get_property_referrer(JSContext *ctx, unsigned int argc, JS::Value *vp) { JS::CallArgs args = CallArgsFromVp(argc, vp); JS::RootedObject hobj(ctx, &args.thisv().toObject()); - JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); + + JSCompartment *comp = js::GetContextCompartment(ctx); + + if (!comp) { + return false; + } + + struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp); + struct view_state *vs; struct document_view *doc_view; struct document *document; struct session *ses; - assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); - if_assert_failed return false; - - vs = JS_GetInstancePrivate(ctx, parent_win, - &window_class, NULL); + vs = interpreter->vs; if (!vs) { return false; @@ -229,16 +248,20 @@ document_get_property_title(JSContext *ctx, unsigned int argc, JS::Value *vp) { JS::CallArgs args = CallArgsFromVp(argc, vp); JS::RootedObject hobj(ctx, &args.thisv().toObject()); - JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); + + JSCompartment *comp = js::GetContextCompartment(ctx); + + if (!comp) { + return false; + } + + struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp); struct view_state *vs; struct document_view *doc_view; struct document *document; - assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); - if_assert_failed return false; + vs = interpreter->vs; - vs = JS_GetInstancePrivate(ctx, parent_win, - &window_class, NULL); if (!vs) { return false; } @@ -254,19 +277,23 @@ document_set_property_title(JSContext *ctx, int argc, JS::Value *vp) { JS::CallArgs args = CallArgsFromVp(argc, vp); JS::RootedObject hobj(ctx, &args.thisv().toObject()); -// JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); + + JSCompartment *comp = js::GetContextCompartment(ctx); + + if (!comp) { + return false; + } + + struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp); + + + JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); struct view_state *vs; struct document_view *doc_view; struct document *document; - assert(JS_InstanceOf(ctx, hobj, &document_class, NULL)); - if_assert_failed return false; + vs = interpreter->vs; -// assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); -// if_assert_failed return false; - - vs = JS_GetInstancePrivate(ctx, hobj, - &document_class, NULL); if (!vs || !vs->doc_view) { return false; } @@ -283,16 +310,20 @@ document_get_property_url(JSContext *ctx, unsigned int argc, JS::Value *vp) { JS::CallArgs args = CallArgsFromVp(argc, vp); JS::RootedObject hobj(ctx, &args.thisv().toObject()); - JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); + JSCompartment *comp = js::GetContextCompartment(ctx); + + if (!comp) { + return false; + } + + struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp); + struct view_state *vs; struct document_view *doc_view; struct document *document; - assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); - if_assert_failed return false; + vs = interpreter->vs; - vs = JS_GetInstancePrivate(ctx, parent_win, - &window_class, NULL); if (!vs) { return false; } @@ -315,16 +346,19 @@ document_set_property_url(JSContext *ctx, int argc, JS::Value *vp) { JS::CallArgs args = CallArgsFromVp(argc, vp); JS::RootedObject hobj(ctx, &args.thisv().toObject()); - JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); + + JSCompartment *comp = js::GetContextCompartment(ctx); + + if (!comp) { + return false; + } + + struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp); struct view_state *vs; struct document_view *doc_view; struct document *document; - assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); - if_assert_failed return false; - - vs = JS_GetInstancePrivate(ctx, parent_win, - &window_class, NULL); + vs = interpreter->vs; if (!vs) { return false; } @@ -359,18 +393,21 @@ document_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, J struct document *document; struct form *form; unsigned char *string; + JSCompartment *comp = js::GetContextCompartment(ctx); + + if (!comp) { + return false; + } + + struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp); + JSClass* classPtr = JS_GetClass(hobj); if (classPtr != &document_class) return false; - parent_win = js::GetGlobalForObjectCrossCompartment(hobj); - assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); - if_assert_failed return false; - - vs = JS_GetInstancePrivate(ctx, parent_win, - &window_class, NULL); + vs = interpreter->vs; doc_view = vs->doc_view; document = doc_view->document; @@ -410,7 +447,6 @@ document_write_do(JSContext *ctx, unsigned int argc, JS::Value *rval, int newlin struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp); JS::Value val; -// struct ecmascript_interpreter *interpreter = JS_GetContextPrivate(ctx); struct string *ret = interpreter->ret; JS::CallArgs args = JS::CallArgsFromVp(argc, rval); diff --git a/src/ecmascript/spidermonkey/form.c b/src/ecmascript/spidermonkey/form.c index 33a16a2c..7210dbe5 100644 --- a/src/ecmascript/spidermonkey/form.c +++ b/src/ecmascript/spidermonkey/form.c @@ -146,22 +146,15 @@ input_get_property_accessKey(JSContext *ctx, unsigned int argc, JS::Value *vp) struct link *link = NULL; JSString *keystr; -// JS::RootedObject parent_form(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); -// assert(JS_InstanceOf(ctx, parent_form, &form_class, NULL)); -// if_assert_failed return false; + JSCompartment *comp = js::GetContextCompartment(ctx); -// JS::RootedObject parent_doc(ctx, js::GetGlobalForObjectCrossCompartment(parent_form)); -// assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); -// if_assert_failed return false; + if (!comp) { + return false; + } -// JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(parent_doc)); -// assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); -// if_assert_failed return false; + struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp); - JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); - - vs = JS_GetInstancePrivate(ctx, parent_win, - &window_class, NULL); + vs = interpreter->vs; if (!vs) { return false; @@ -211,21 +204,15 @@ input_set_property_accessKey(JSContext *ctx, unsigned int argc, JS::Value *vp) int linknum; struct link *link = NULL; unicode_val_T accesskey; + JSCompartment *comp = js::GetContextCompartment(ctx); -// JS::RootedObject parent_form(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); -// assert(JS_InstanceOf(ctx, parent_form, &form_class, NULL)); -// if_assert_failed return false; -// JS::RootedObject parent_doc(ctx, js::GetGlobalForObjectCrossCompartment(parent_form)); -// assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); -// if_assert_failed return false; -// JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(parent_doc)); -// assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); -// if_assert_failed return false; + if (!comp) { + return false; + } - JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); + struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp); - vs = JS_GetInstancePrivate(ctx, parent_win, - &window_class, NULL); + vs = interpreter->vs; if (!vs) { return false; } @@ -294,22 +281,16 @@ input_get_property_alt(JSContext *ctx, unsigned int argc, JS::Value *vp) struct document *document; struct form_state *fs; struct el_form_control *fc; + JSCompartment *comp = js::GetContextCompartment(ctx); -// JS::RootedObject parent_form(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); -// assert(JS_InstanceOf(ctx, parent_form, &form_class, NULL)); -// if_assert_failed return false; + if (!comp) { + return false; + } -// JS::RootedObject parent_doc(ctx, js::GetGlobalForObjectCrossCompartment(parent_form)); -// assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); -// if_assert_failed return false; + struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp); -// JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(parent_doc)); -// assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); -// if_assert_failed return false; - JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); + vs = interpreter->vs; - vs = JS_GetInstancePrivate(ctx, parent_win, - &window_class, NULL); if (!vs) { return false; } @@ -337,20 +318,15 @@ input_set_property_alt(JSContext *ctx, unsigned int argc, JS::Value *vp) struct document *document; struct form_state *fs; struct el_form_control *fc; + JSCompartment *comp = js::GetContextCompartment(ctx); -// JS::RootedObject parent_form(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); -// assert(JS_InstanceOf(ctx, parent_form, &form_class, NULL)); -// if_assert_failed return false; -// JS::RootedObject parent_doc(ctx, js::GetGlobalForObjectCrossCompartment(parent_form)); -// assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); -// if_assert_failed return false; -// JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(parent_doc)); -// assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); -// if_assert_failed return false; - JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); + if (!comp) { + return false; + } - vs = JS_GetInstancePrivate(ctx, parent_win, - &window_class, NULL); + struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp); + + vs = interpreter->vs; if (!vs) { return false; } @@ -395,20 +371,16 @@ input_set_property_checked(JSContext *ctx, unsigned int argc, JS::Value *vp) struct document *document; struct form_state *fs; struct el_form_control *fc; + JSCompartment *comp = js::GetContextCompartment(ctx); -// JS::RootedObject parent_form(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); -// assert(JS_InstanceOf(ctx, parent_form, &form_class, NULL)); -// if_assert_failed return false; -// JS::RootedObject parent_doc(ctx, js::GetGlobalForObjectCrossCompartment(parent_form)); -// assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); -// if_assert_failed return false; -// JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(parent_doc)); -// assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); -// if_assert_failed return false; - JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); + if (!comp) { + return false; + } + + struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp); + + vs = interpreter->vs; - vs = JS_GetInstancePrivate(ctx, parent_win, - &window_class, NULL); if (!vs) { return false; } @@ -439,22 +411,15 @@ input_get_property_defaultChecked(JSContext *ctx, unsigned int argc, JS::Value * struct document *document; struct form_state *fs; struct el_form_control *fc; + JSCompartment *comp = js::GetContextCompartment(ctx); -// JS::RootedObject parent_form(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); -// assert(JS_InstanceOf(ctx, parent_form, &form_class, NULL)); -// if_assert_failed return false; + if (!comp) { + return false; + } -// JS::RootedObject parent_doc(ctx, js::GetGlobalForObjectCrossCompartment(parent_form)); -// assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); -// if_assert_failed return false; + struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp); -// JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(parent_doc)); -// assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); -// if_assert_failed return false; - JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); - - vs = JS_GetInstancePrivate(ctx, parent_win, - &window_class, NULL); + vs = interpreter->vs; if (!vs) { return false; } @@ -483,22 +448,15 @@ input_get_property_defaultValue(JSContext *ctx, unsigned int argc, JS::Value *vp struct document *document; struct form_state *fs; struct el_form_control *fc; + JSCompartment *comp = js::GetContextCompartment(ctx); -// JS::RootedObject parent_form(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); -// assert(JS_InstanceOf(ctx, parent_form, &form_class, NULL)); -// if_assert_failed return false; + if (!comp) { + return false; + } -// JS::RootedObject parent_doc(ctx, js::GetGlobalForObjectCrossCompartment(parent_form)); -// assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); -// if_assert_failed return false; + struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp); -// JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(parent_doc)); -// assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); -// if_assert_failed return false; - JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); - - vs = JS_GetInstancePrivate(ctx, parent_win, - &window_class, NULL); + vs = interpreter->vs; if (!vs) { return false; } @@ -528,22 +486,15 @@ input_get_property_disabled(JSContext *ctx, unsigned int argc, JS::Value *vp) struct document *document; struct form_state *fs; struct el_form_control *fc; + JSCompartment *comp = js::GetContextCompartment(ctx); -// JS::RootedObject parent_form(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); -// assert(JS_InstanceOf(ctx, parent_form, &form_class, NULL)); -// if_assert_failed return false; + if (!comp) { + return false; + } -// JS::RootedObject parent_doc(ctx, js::GetGlobalForObjectCrossCompartment(parent_form)); -// assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); -// if_assert_failed return false; + struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp); -// JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(parent_doc)); -// assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); -// if_assert_failed return false; - JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); - - vs = JS_GetInstancePrivate(ctx, parent_win, - &window_class, NULL); + vs = interpreter->vs; if (!vs) { return false; } @@ -573,20 +524,15 @@ input_set_property_disabled(JSContext *ctx, unsigned int argc, JS::Value *vp) struct document *document; struct form_state *fs; struct el_form_control *fc; + JSCompartment *comp = js::GetContextCompartment(ctx); -// JS::RootedObject parent_form(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); -// assert(JS_InstanceOf(ctx, parent_form, &form_class, NULL)); -// if_assert_failed return false; -// JS::RootedObject parent_doc(ctx, js::GetGlobalForObjectCrossCompartment(parent_form)); -// assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); -// if_assert_failed return false; -// JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(parent_doc)); -// assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); -// if_assert_failed return false; - JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); + if (!comp) { + return false; + } - vs = JS_GetInstancePrivate(ctx, parent_win, - &window_class, NULL); + struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp); + + vs = interpreter->vs; if (!vs) { return false; } @@ -633,22 +579,15 @@ input_get_property_maxLength(JSContext *ctx, unsigned int argc, JS::Value *vp) struct document *document; struct form_state *fs; struct el_form_control *fc; + JSCompartment *comp = js::GetContextCompartment(ctx); -// JS::RootedObject parent_form(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); -// assert(JS_InstanceOf(ctx, parent_form, &form_class, NULL)); -// if_assert_failed return false; + if (!comp) { + return false; + } -// JS::RootedObject parent_doc(ctx, js::GetGlobalForObjectCrossCompartment(parent_form)); -// assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); -// if_assert_failed return false; + struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp); -// JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(parent_doc)); -// assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); -// if_assert_failed return false; - JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); - - vs = JS_GetInstancePrivate(ctx, parent_win, - &window_class, NULL); + vs = interpreter->vs; if (!vs) { return false; } @@ -677,20 +616,15 @@ input_set_property_maxLength(JSContext *ctx, unsigned int argc, JS::Value *vp) struct document *document; struct form_state *fs; struct el_form_control *fc; + JSCompartment *comp = js::GetContextCompartment(ctx); -// JS::RootedObject parent_form(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); -// assert(JS_InstanceOf(ctx, parent_form, &form_class, NULL)); -// if_assert_failed return false; -// JS::RootedObject parent_doc(ctx, js::GetGlobalForObjectCrossCompartment(parent_form)); -// assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); -// if_assert_failed return false; -// JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(parent_doc)); -// assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); -// if_assert_failed return false; - JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); + if (!comp) { + return false; + } - vs = JS_GetInstancePrivate(ctx, parent_win, - &window_class, NULL); + struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp); + + vs = interpreter->vs; if (!vs) { return false; } @@ -719,22 +653,15 @@ input_get_property_name(JSContext *ctx, unsigned int argc, JS::Value *vp) struct document *document; struct form_state *fs; struct el_form_control *fc; + JSCompartment *comp = js::GetContextCompartment(ctx); -// JS::RootedObject parent_form(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); -// assert(JS_InstanceOf(ctx, parent_form, &form_class, NULL)); -// if_assert_failed return false; + if (!comp) { + return false; + } -// JS::RootedObject parent_doc(ctx, js::GetGlobalForObjectCrossCompartment(parent_form)); -// assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); -// if_assert_failed return false; + struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp); -// JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(parent_doc)); -// assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); -// if_assert_failed return false; - JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); - - vs = JS_GetInstancePrivate(ctx, parent_win, - &window_class, NULL); + vs = interpreter->vs; if (!vs) { return false; } @@ -764,6 +691,14 @@ input_set_property_name(JSContext *ctx, unsigned int argc, JS::Value *vp) struct document *document; struct form_state *fs; struct el_form_control *fc; + JSCompartment *comp = js::GetContextCompartment(ctx); + + if (!comp) { + return false; + } + + struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp); + /* This can be called if @obj if not itself an instance of the * appropriate class but has one in its prototype chain. Fail @@ -771,19 +706,8 @@ input_set_property_name(JSContext *ctx, unsigned int argc, JS::Value *vp) if (!JS_InstanceOf(ctx, hobj, &input_class, NULL)) return false; -// JS::RootedObject parent_form(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); -// assert(JS_InstanceOf(ctx, parent_form, &form_class, NULL)); -// if_assert_failed return false; -// JS::RootedObject parent_doc(ctx, js::GetGlobalForObjectCrossCompartment(parent_form)); -// assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); -// if_assert_failed return false; -// JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(parent_doc)); -// assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); -// if_assert_failed return false; - JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); + vs = interpreter->vs; - vs = JS_GetInstancePrivate(ctx, parent_win, - &window_class, NULL); if (!vs) { return false; } @@ -812,6 +736,13 @@ input_get_property_readonly(JSContext *ctx, unsigned int argc, JS::Value *vp) struct document *document; struct form_state *fs; struct el_form_control *fc; + JSCompartment *comp = js::GetContextCompartment(ctx); + + if (!comp) { + return false; + } + + struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp); /* This can be called if @obj if not itself an instance of the * appropriate class but has one in its prototype chain. Fail @@ -819,21 +750,7 @@ input_get_property_readonly(JSContext *ctx, unsigned int argc, JS::Value *vp) if (!JS_InstanceOf(ctx, hobj, &input_class, NULL)) return false; -// JS::RootedObject parent_form(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); -// assert(JS_InstanceOf(ctx, parent_form, &form_class, NULL)); -// if_assert_failed return false; - -// JS::RootedObject parent_doc(ctx, js::GetGlobalForObjectCrossCompartment(parent_form)); -// assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); -// if_assert_failed return false; - -// JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(parent_doc)); -// assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); -// if_assert_failed return false; - JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); - - vs = JS_GetInstancePrivate(ctx, parent_win, - &window_class, NULL); + vs = interpreter->vs; if (!vs) { return false; } @@ -864,25 +781,21 @@ input_set_property_readonly(JSContext *ctx, unsigned int argc, JS::Value *vp) struct document *document; struct form_state *fs; struct el_form_control *fc; + JSCompartment *comp = js::GetContextCompartment(ctx); + + if (!comp) { + return false; + } + + struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp); /* This can be called if @obj if not itself an instance of the * appropriate class but has one in its prototype chain. Fail * such calls. */ if (!JS_InstanceOf(ctx, hobj, &input_class, NULL)) return false; -// JS::RootedObject parent_form(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); -// assert(JS_InstanceOf(ctx, parent_form, &form_class, NULL)); -// if_assert_failed return false; -// JS::RootedObject parent_doc(ctx, js::GetGlobalForObjectCrossCompartment(parent_form)); -// assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); -// if_assert_failed return false; -// JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(parent_doc)); -// assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); -// if_assert_failed return false; - JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); - vs = JS_GetInstancePrivate(ctx, parent_win, - &window_class, NULL); + vs = interpreter->vs; if (!vs) { return false; } @@ -914,6 +827,13 @@ input_get_property_selectedIndex(JSContext *ctx, unsigned int argc, JS::Value *v struct document *document; struct form_state *fs; struct el_form_control *fc; + JSCompartment *comp = js::GetContextCompartment(ctx); + + if (!comp) { + return false; + } + + struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp); /* This can be called if @obj if not itself an instance of the * appropriate class but has one in its prototype chain. Fail @@ -921,21 +841,7 @@ input_get_property_selectedIndex(JSContext *ctx, unsigned int argc, JS::Value *v if (!JS_InstanceOf(ctx, hobj, &input_class, NULL)) return false; -// JS::RootedObject parent_form(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); -// assert(JS_InstanceOf(ctx, parent_form, &form_class, NULL)); -// if_assert_failed return false; - -// JS::RootedObject parent_doc(ctx, js::GetGlobalForObjectCrossCompartment(parent_form)); -// assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); -// if_assert_failed return false; - -// JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(parent_doc)); -// assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); -// if_assert_failed return false; - JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); - - vs = JS_GetInstancePrivate(ctx, parent_win, - &window_class, NULL); + vs = interpreter->vs; if (!vs) { return false; } @@ -970,25 +876,21 @@ input_set_property_selectedIndex(JSContext *ctx, unsigned int argc, JS::Value *v struct document *document; struct form_state *fs; struct el_form_control *fc; + JSCompartment *comp = js::GetContextCompartment(ctx); + + if (!comp) { + return false; + } + + struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp); /* This can be called if @obj if not itself an instance of the * appropriate class but has one in its prototype chain. Fail * such calls. */ if (!JS_InstanceOf(ctx, hobj, &input_class, NULL)) return false; -// JS::RootedObject parent_form(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); -// assert(JS_InstanceOf(ctx, parent_form, &form_class, NULL)); -// if_assert_failed return false; -// JS::RootedObject parent_doc(ctx, js::GetGlobalForObjectCrossCompartment(parent_form)); -// assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); -// if_assert_failed return false; -// JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(parent_doc)); -// assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); -// if_assert_failed return false; - JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); - vs = JS_GetInstancePrivate(ctx, parent_win, - &window_class, NULL); + vs = interpreter->vs; if (!vs) { return false; } @@ -1024,6 +926,13 @@ input_get_property_size(JSContext *ctx, unsigned int argc, JS::Value *vp) struct document *document; struct form_state *fs; struct el_form_control *fc; + JSCompartment *comp = js::GetContextCompartment(ctx); + + if (!comp) { + return false; + } + + struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp); /* This can be called if @obj if not itself an instance of the * appropriate class but has one in its prototype chain. Fail @@ -1031,21 +940,7 @@ input_get_property_size(JSContext *ctx, unsigned int argc, JS::Value *vp) if (!JS_InstanceOf(ctx, hobj, &input_class, NULL)) return false; -// JS::RootedObject parent_form(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); -// assert(JS_InstanceOf(ctx, parent_form, &form_class, NULL)); -// if_assert_failed return false; - -// JS::RootedObject parent_doc(ctx, js::GetGlobalForObjectCrossCompartment(parent_form)); -// assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); -// if_assert_failed return false; - -// JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(parent_doc)); -// assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); -// if_assert_failed return false; - JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); - - vs = JS_GetInstancePrivate(ctx, parent_win, - &window_class, NULL); + vs = interpreter->vs; if (!vs) { return false; } @@ -1076,6 +971,13 @@ input_get_property_src(JSContext *ctx, unsigned int argc, JS::Value *vp) struct el_form_control *fc; int linknum; struct link *link = NULL; + JSCompartment *comp = js::GetContextCompartment(ctx); + + if (!comp) { + return false; + } + + struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp); /* This can be called if @obj if not itself an instance of the * appropriate class but has one in its prototype chain. Fail @@ -1083,21 +985,7 @@ input_get_property_src(JSContext *ctx, unsigned int argc, JS::Value *vp) if (!JS_InstanceOf(ctx, hobj, &input_class, NULL)) return false; -// JS::RootedObject parent_form(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); -// assert(JS_InstanceOf(ctx, parent_form, &form_class, NULL)); -// if_assert_failed return false; - -// JS::RootedObject parent_doc(ctx, js::GetGlobalForObjectCrossCompartment(parent_form)); -// assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); -// if_assert_failed return false; - -// JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(parent_doc)); -// assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); -// if_assert_failed return false; - JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); - - vs = JS_GetInstancePrivate(ctx, parent_win, - &window_class, NULL); + vs = interpreter->vs; if (!vs) { return false; } @@ -1135,6 +1023,13 @@ input_set_property_src(JSContext *ctx, unsigned int argc, JS::Value *vp) struct el_form_control *fc; int linknum; struct link *link = NULL; + JSCompartment *comp = js::GetContextCompartment(ctx); + + if (!comp) { + return false; + } + + struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp); /* This can be called if @obj if not itself an instance of the * appropriate class but has one in its prototype chain. Fail @@ -1142,21 +1037,7 @@ input_set_property_src(JSContext *ctx, unsigned int argc, JS::Value *vp) if (!JS_InstanceOf(ctx, hobj, &input_class, NULL)) return false; -// JS::RootedObject parent_form(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); -// assert(JS_InstanceOf(ctx, parent_form, &form_class, NULL)); -// if_assert_failed return false; - -// JS::RootedObject parent_doc(ctx, js::GetGlobalForObjectCrossCompartment(parent_form)); -// assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); -// if_assert_failed return false; - -// JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(parent_doc)); -// assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); -// if_assert_failed return false; - JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); - - vs = JS_GetInstancePrivate(ctx, parent_win, - &window_class, NULL); + vs = interpreter->vs; if (!vs) { return; } @@ -1193,6 +1074,13 @@ input_get_property_tabIndex(JSContext *ctx, unsigned int argc, JS::Value *vp) struct el_form_control *fc; int linknum; struct link *link = NULL; + JSCompartment *comp = js::GetContextCompartment(ctx); + + if (!comp) { + return false; + } + + struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp); /* This can be called if @obj if not itself an instance of the * appropriate class but has one in its prototype chain. Fail @@ -1200,21 +1088,7 @@ input_get_property_tabIndex(JSContext *ctx, unsigned int argc, JS::Value *vp) if (!JS_InstanceOf(ctx, hobj, &input_class, NULL)) return false; -// JS::RootedObject parent_form(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); -// assert(JS_InstanceOf(ctx, parent_form, &form_class, NULL)); -// if_assert_failed return false; - -// JS::RootedObject parent_doc(ctx, js::GetGlobalForObjectCrossCompartment(parent_form)); -// assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); -// if_assert_failed return false; - -// JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(parent_doc)); -// assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); -// if_assert_failed return false; - JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); - - vs = JS_GetInstancePrivate(ctx, parent_win, - &window_class, NULL); + vs = interpreter->vs; if (!vs) { return false; } @@ -1253,6 +1127,13 @@ input_get_property_type(JSContext *ctx, unsigned int argc, JS::Value *vp) struct form_state *fs; struct el_form_control *fc; unsigned char *s = NULL; + JSCompartment *comp = js::GetContextCompartment(ctx); + + if (!comp) { + return false; + } + + struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp); /* This can be called if @obj if not itself an instance of the * appropriate class but has one in its prototype chain. Fail @@ -1260,21 +1141,7 @@ input_get_property_type(JSContext *ctx, unsigned int argc, JS::Value *vp) if (!JS_InstanceOf(ctx, hobj, &input_class, NULL)) return false; -// JS::RootedObject parent_form(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); -// assert(JS_InstanceOf(ctx, parent_form, &form_class, NULL)); -// if_assert_failed return false; - -// JS::RootedObject parent_doc(ctx, js::GetGlobalForObjectCrossCompartment(parent_form)); -// assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); -// if_assert_failed return false; - -// JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(parent_doc)); -// assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); -// if_assert_failed return false; - JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); - - vs = JS_GetInstancePrivate(ctx, parent_win, - &window_class, NULL); + vs = interpreter->vs; if (!vs) { return false; } @@ -1338,6 +1205,13 @@ input_set_property_value(JSContext *ctx, unsigned int argc, JS::Value *vp) struct document *document; struct form_state *fs; struct el_form_control *fc; + JSCompartment *comp = js::GetContextCompartment(ctx); + + if (!comp) { + return false; + } + + struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp); /* This can be called if @obj if not itself an instance of the * appropriate class but has one in its prototype chain. Fail @@ -1345,21 +1219,7 @@ input_set_property_value(JSContext *ctx, unsigned int argc, JS::Value *vp) if (!JS_InstanceOf(ctx, hobj, &input_class, NULL)) return false; -// JS::RootedObject parent_form(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); -// assert(JS_InstanceOf(ctx, parent_form, &form_class, NULL)); -// if_assert_failed return false; - -// JS::RootedObject parent_doc(ctx, js::GetGlobalForObjectCrossCompartment(parent_form)); -// assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); -// if_assert_failed return false; - -// JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(parent_doc)); -// assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); -// if_assert_failed return false; - JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); - - vs = JS_GetInstancePrivate(ctx, parent_win, - &window_class, NULL); + vs = interpreter->vs; if (!vs) { return false; } @@ -1455,20 +1315,8 @@ input_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS:: if (!JS_InstanceOf(ctx, hobj, &input_class, NULL)) return false; -// parent_form = js::GetGlobalForObjectCrossCompartment(obj); -// assert(JS_InstanceOf(ctx, parent_form, &form_class, NULL)); -// if_assert_failed return false; - -// parent_doc = js::GetGlobalForObjectCrossCompartment(parent_form); -// assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); -// if_assert_failed return false; - -// parent_win = js::GetGlobalForObjectCrossCompartment(parent_doc); -// assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); -// if_assert_failed return false; hvp.setUndefined(); - return true; } @@ -1495,15 +1343,6 @@ input_set_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS:: * such calls. */ if (!JS_InstanceOf(ctx, hobj, &input_class, NULL)) return false; -// parent_form = js::GetGlobalForObjectCrossCompartment(obj); -// assert(JS_InstanceOf(ctx, parent_form, &form_class, NULL)); -// if_assert_failed return false; -// parent_doc = js::GetGlobalForObjectCrossCompartment(parent_form); -// assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); -// if_assert_failed return false; -// parent_win = js::GetGlobalForObjectCrossCompartment(parent_doc); -// assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); -// if_assert_failed return false; return true; } @@ -1533,21 +1372,17 @@ input_click(JSContext *ctx, unsigned int argc, JS::Value *rval) struct form_state *fs; struct el_form_control *fc; int linknum; + JSCompartment *comp = js::GetContextCompartment(ctx); + + if (!comp) { + return false; + } + + struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp); if (!JS_InstanceOf(ctx, hobj, &input_class, &args)) return false; -// parent_form = js::GetGlobalForObjectCrossCompartment(hobj); -// assert(JS_InstanceOf(ctx, parent_form, &form_class, NULL)); -// if_assert_failed return false; -// parent_doc = js::GetGlobalForObjectCrossCompartment(parent_form); -// assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); -// if_assert_failed return false; -// parent_win = js::GetGlobalForObjectCrossCompartment(parent_doc); -// assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); -// if_assert_failed return false; - JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); - vs = JS_GetInstancePrivate(ctx, parent_win, - &window_class, NULL); + vs = interpreter->vs; doc_view = vs->doc_view; document = doc_view->document; ses = doc_view->session; @@ -1591,21 +1426,17 @@ input_focus(JSContext *ctx, unsigned int argc, JS::Value *rval) struct form_state *fs; struct el_form_control *fc; int linknum; + JSCompartment *comp = js::GetContextCompartment(ctx); + + if (!comp) { + return false; + } + + struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp); if (!JS_InstanceOf(ctx, hobj, &input_class, &args)) return false; -// parent_form = js::GetGlobalForObjectCrossCompartment(obj); -// assert(JS_InstanceOf(ctx, parent_form, &form_class, NULL)); -// if_assert_failed return false; -// parent_doc = js::GetGlobalForObjectCrossCompartment(parent_form); -// assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); -// if_assert_failed return false; -// parent_win = js::GetGlobalForObjectCrossCompartment(parent_doc); -// assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); -// if_assert_failed return false; - JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); - vs = JS_GetInstancePrivate(ctx, parent_win, - &window_class, NULL); + vs = interpreter->vs; doc_view = vs->doc_view; document = doc_view->document; ses = doc_view->session; @@ -1806,14 +1637,19 @@ form_elements_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId h jsid id = hid.get(); JS::Value idval; -// JS::RootedObject parent_form(ctx); /* instance of @form_class */ -// JS::RootedObject parent_doc(ctx); /* instance of @document_class */ struct view_state *vs; struct document_view *doc_view; struct document *document; struct form_view *form_view; struct form *form; + JSCompartment *comp = js::GetContextCompartment(ctx); + + if (!comp) { + return false; + } + + struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp); /* This can be called if @obj if not itself an instance of the * appropriate class but has one in its prototype chain. Fail @@ -1821,10 +1657,7 @@ form_elements_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId h if (!JS_InstanceOf(ctx, hobj, &form_elements_class, NULL)) { return false; } - JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); - - vs = JS_GetInstancePrivate(ctx, parent_win, - &window_class, NULL); + vs = interpreter->vs; doc_view = vs->doc_view; document = doc_view->document; @@ -1876,11 +1709,15 @@ form_elements_get_property_length(JSContext *ctx, unsigned int argc, JS::Value * struct document *document; struct form_view *form_view; struct form *form; + JSCompartment *comp = js::GetContextCompartment(ctx); - JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); + if (!comp) { + return false; + } - vs = JS_GetInstancePrivate(ctx, parent_win, - &window_class, NULL); + struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp); + + vs = interpreter->vs; if (!vs) { return false; @@ -1928,12 +1765,17 @@ form_elements_item2(JSContext *ctx, JS::HandleObject hobj, int index, JS::Mutabl struct form *form; struct el_form_control *fc; int counter = -1; + JSCompartment *comp = js::GetContextCompartment(ctx); + + if (!comp) { + return false; + } + + struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp); if (!JS_InstanceOf(ctx, hobj, &form_elements_class, NULL)) return false; - JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); - vs = JS_GetInstancePrivate(ctx, parent_win, - &window_class, NULL); + vs = interpreter->vs; doc_view = vs->doc_view; document = doc_view->document; @@ -1994,25 +1836,21 @@ form_elements_namedItem2(JSContext *ctx, JS::HandleObject hobj, unsigned char *s struct form_view *form_view; struct form *form; struct el_form_control *fc; + JSCompartment *comp = js::GetContextCompartment(ctx); + + if (!comp) { + return false; + } + + struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp); if (!*string) { return true; } if (!JS_InstanceOf(ctx, hobj, &form_elements_class, NULL)) return false; -// parent_form = js::GetGlobalForObjectCrossCompartment(hobj); -// assert(JS_InstanceOf(ctx, parent_form, &form_class, NULL)); -// if_assert_failed return false; -// parent_doc = js::GetGlobalForObjectCrossCompartment(parent_form); -// assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); -// if_assert_failed return false; -// parent_win = js::GetGlobalForObjectCrossCompartment(parent_doc); -// assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); -// if_assert_failed return false; - JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); - vs = JS_GetInstancePrivate(ctx, parent_win, - &window_class, NULL); + vs = interpreter->vs; doc_view = vs->doc_view; document = doc_view->document; @@ -2106,22 +1944,21 @@ form_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::M struct document_view *doc_view; struct form_view *fv; struct form *form; + JSCompartment *comp = js::GetContextCompartment(ctx); + + if (!comp) { + return false; + } + + struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp); /* This can be called if @obj if not itself an instance of the * appropriate class but has one in its prototype chain. Fail * such calls. */ if (!JS_InstanceOf(ctx, hobj, &form_class, NULL)) return false; -// parent_doc = js::GetGlobalForObjectCrossCompartment(obj); -// assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); -// if_assert_failed return false; -// parent_win = js::GetGlobalForObjectCrossCompartment(parent_doc); -// assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); -// if_assert_failed return false; - JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); - vs = JS_GetInstancePrivate(ctx, parent_win, - &window_class, NULL); + vs = interpreter->vs; doc_view = vs->doc_view; fv = form_get_form_view(ctx, hobj, NULL); if (!fv) return false; /* detached */ @@ -2173,6 +2010,13 @@ form_get_property_action(JSContext *ctx, unsigned int argc, JS::Value *vp) struct document_view *doc_view; struct form_view *fv; struct form *form; + JSCompartment *comp = js::GetContextCompartment(ctx); + + if (!comp) { + return false; + } + + struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp); /* This can be called if @obj if not itself an instance of the * appropriate class but has one in its prototype chain. Fail @@ -2180,17 +2024,7 @@ form_get_property_action(JSContext *ctx, unsigned int argc, JS::Value *vp) if (!JS_InstanceOf(ctx, hobj, &form_class, NULL)) return false; -// JS::RootedObject parent_doc(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); -// assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); -// if_assert_failed return false; -// -// JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(parent_doc)); -// assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); -// if_assert_failed return false; - JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); - - vs = JS_GetInstancePrivate(ctx, parent_win, - &window_class, NULL); + vs = interpreter->vs; if (!vs) { return false; } @@ -2216,6 +2050,13 @@ form_set_property_action(JSContext *ctx, unsigned int argc, JS::Value *vp) struct form_view *fv; struct form *form; unsigned char *string; + JSCompartment *comp = js::GetContextCompartment(ctx); + + if (!comp) { + return false; + } + + struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp); /* This can be called if @obj if not itself an instance of the * appropriate class but has one in its prototype chain. Fail @@ -2223,17 +2064,7 @@ form_set_property_action(JSContext *ctx, unsigned int argc, JS::Value *vp) if (!JS_InstanceOf(ctx, hobj, &form_class, NULL)) return false; -// JS::RootedObject parent_doc(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); -// assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); -// if_assert_failed return false; - -// JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(parent_doc)); -// assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); -// if_assert_failed return false; - JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); - - vs = JS_GetInstancePrivate(ctx, parent_win, - &window_class, NULL); + vs = interpreter->vs; if (!vs) { return false; } @@ -2295,6 +2126,13 @@ form_get_property_encoding(JSContext *ctx, unsigned int argc, JS::Value *vp) struct document_view *doc_view; struct form_view *fv; struct form *form; + JSCompartment *comp = js::GetContextCompartment(ctx); + + if (!comp) { + return false; + } + + struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp); /* This can be called if @obj if not itself an instance of the * appropriate class but has one in its prototype chain. Fail @@ -2302,17 +2140,7 @@ form_get_property_encoding(JSContext *ctx, unsigned int argc, JS::Value *vp) if (!JS_InstanceOf(ctx, hobj, &form_class, NULL)) return false; -// JS::RootedObject parent_doc(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); -// assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); -// if_assert_failed return false; - -// JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(parent_doc)); -// assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); -// if_assert_failed return false; - JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); - - vs = JS_GetInstancePrivate(ctx, parent_win, - &window_class, NULL); + vs = interpreter->vs; if (!vs) { return false; } @@ -2351,6 +2179,13 @@ form_set_property_encoding(JSContext *ctx, unsigned int argc, JS::Value *vp) struct form_view *fv; struct form *form; unsigned char *string; + JSCompartment *comp = js::GetContextCompartment(ctx); + + if (!comp) { + return false; + } + + struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp); /* This can be called if @obj if not itself an instance of the * appropriate class but has one in its prototype chain. Fail @@ -2358,17 +2193,7 @@ form_set_property_encoding(JSContext *ctx, unsigned int argc, JS::Value *vp) if (!JS_InstanceOf(ctx, hobj, &form_class, NULL)) return false; -// JS::RootedObject parent_doc(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); -// assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); -// if_assert_failed return false; - -// JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(parent_doc)); -// assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); -// if_assert_failed return false; - JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); - - vs = JS_GetInstancePrivate(ctx, parent_win, - &window_class, NULL); + vs = interpreter->vs; if (!vs) { return false; } @@ -2402,6 +2227,13 @@ form_get_property_length(JSContext *ctx, unsigned int argc, JS::Value *vp) struct document_view *doc_view; struct form_view *fv; struct form *form; + JSCompartment *comp = js::GetContextCompartment(ctx); + + if (!comp) { + return false; + } + + struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp); /* This can be called if @obj if not itself an instance of the * appropriate class but has one in its prototype chain. Fail @@ -2409,17 +2241,7 @@ form_get_property_length(JSContext *ctx, unsigned int argc, JS::Value *vp) if (!JS_InstanceOf(ctx, hobj, &form_class, NULL)) return false; -// JS::RootedObject parent_doc(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); -// assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); -// if_assert_failed return false; -// -// JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(parent_doc)); -// assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); -// if_assert_failed return false; - JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); - - vs = JS_GetInstancePrivate(ctx, parent_win, - &window_class, NULL); + vs = interpreter->vs; if (!vs) { return false; } @@ -2445,6 +2267,13 @@ form_get_property_method(JSContext *ctx, unsigned int argc, JS::Value *vp) struct document_view *doc_view; struct form_view *fv; struct form *form; + JSCompartment *comp = js::GetContextCompartment(ctx); + + if (!comp) { + return false; + } + + struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp); /* This can be called if @obj if not itself an instance of the * appropriate class but has one in its prototype chain. Fail @@ -2452,17 +2281,7 @@ form_get_property_method(JSContext *ctx, unsigned int argc, JS::Value *vp) if (!JS_InstanceOf(ctx, hobj, &form_class, NULL)) return false; -// JS::RootedObject parent_doc(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); -// assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); -// if_assert_failed return false; -// -// JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(parent_doc)); -// assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); -// if_assert_failed return false; - JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); - - vs = JS_GetInstancePrivate(ctx, parent_win, - &window_class, NULL); + vs = interpreter->vs; if (!vs) { return false; } @@ -2500,6 +2319,13 @@ form_set_property_method(JSContext *ctx, unsigned int argc, JS::Value *vp) struct form_view *fv; struct form *form; unsigned char *string; + JSCompartment *comp = js::GetContextCompartment(ctx); + + if (!comp) { + return false; + } + + struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp); /* This can be called if @obj if not itself an instance of the * appropriate class but has one in its prototype chain. Fail @@ -2507,17 +2333,7 @@ form_set_property_method(JSContext *ctx, unsigned int argc, JS::Value *vp) if (!JS_InstanceOf(ctx, hobj, &form_class, NULL)) return false; -// JS::RootedObject parent_doc(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); -// assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); -// if_assert_failed return false; - -// JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(parent_doc)); -// assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); -// if_assert_failed return false; - JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); - - vs = JS_GetInstancePrivate(ctx, parent_win, - &window_class, NULL); + vs = interpreter->vs; if (!vs) { return false; } @@ -2548,6 +2364,13 @@ form_get_property_name(JSContext *ctx, unsigned int argc, JS::Value *vp) struct document_view *doc_view; struct form_view *fv; struct form *form; + JSCompartment *comp = js::GetContextCompartment(ctx); + + if (!comp) { + return false; + } + + struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp); /* This can be called if @obj if not itself an instance of the * appropriate class but has one in its prototype chain. Fail @@ -2555,17 +2378,7 @@ form_get_property_name(JSContext *ctx, unsigned int argc, JS::Value *vp) if (!JS_InstanceOf(ctx, hobj, &form_class, NULL)) return false; -// JS::RootedObject parent_doc(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); -// assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); -// if_assert_failed return false; - -// JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(parent_doc)); -// assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); -// if_assert_failed return false; - JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); - - vs = JS_GetInstancePrivate(ctx, parent_win, - &window_class, NULL); + vs = interpreter->vs; if (!vs) { return false; } @@ -2592,6 +2405,13 @@ form_set_property_name(JSContext *ctx, unsigned int argc, JS::Value *vp) struct document_view *doc_view; struct form_view *fv; struct form *form; + JSCompartment *comp = js::GetContextCompartment(ctx); + + if (!comp) { + return false; + } + + struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp); /* This can be called if @obj if not itself an instance of the * appropriate class but has one in its prototype chain. Fail @@ -2599,17 +2419,7 @@ form_set_property_name(JSContext *ctx, unsigned int argc, JS::Value *vp) if (!JS_InstanceOf(ctx, hobj, &form_class, NULL)) return false; -// JS::RootedObject parent_doc(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); -// assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); -// if_assert_failed return false; - -// JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(parent_doc)); -// assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); -// if_assert_failed return false; - JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); - - vs = JS_GetInstancePrivate(ctx, parent_win, - &window_class, NULL); + vs = interpreter->vs; if (!vs) { return false; } @@ -2634,6 +2444,13 @@ form_get_property_target(JSContext *ctx, unsigned int argc, JS::Value *vp) struct document_view *doc_view; struct form_view *fv; struct form *form; + JSCompartment *comp = js::GetContextCompartment(ctx); + + if (!comp) { + return false; + } + + struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp); /* This can be called if @obj if not itself an instance of the * appropriate class but has one in its prototype chain. Fail @@ -2641,17 +2458,7 @@ form_get_property_target(JSContext *ctx, unsigned int argc, JS::Value *vp) if (!JS_InstanceOf(ctx, hobj, &form_class, NULL)) return false; -// JS::RootedObject parent_doc(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); -// assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); -// if_assert_failed return false; - -// JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(parent_doc)); -// assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); -// if_assert_failed return false; - JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); - - vs = JS_GetInstancePrivate(ctx, parent_win, - &window_class, NULL); + vs = interpreter->vs; if (!vs) { return false; } @@ -2676,6 +2483,13 @@ form_set_property_target(JSContext *ctx, unsigned int argc, JS::Value *vp) struct document_view *doc_view; struct form_view *fv; struct form *form; + JSCompartment *comp = js::GetContextCompartment(ctx); + + if (!comp) { + return false; + } + + struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp); /* This can be called if @obj if not itself an instance of the * appropriate class but has one in its prototype chain. Fail @@ -2683,17 +2497,7 @@ form_set_property_target(JSContext *ctx, unsigned int argc, JS::Value *vp) if (!JS_InstanceOf(ctx, hobj, &form_class, NULL)) return false; -// JS::RootedObject parent_doc(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); -// assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); -// if_assert_failed return false; - -// JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(parent_doc)); -// assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); -// if_assert_failed return false; - JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); - - vs = JS_GetInstancePrivate(ctx, parent_win, - &window_class, NULL); + vs = interpreter->vs; if (!vs) { return false; } @@ -2723,18 +2527,17 @@ form_reset(JSContext *ctx, unsigned int argc, JS::Value *rval) struct document_view *doc_view; struct form_view *fv; struct form *form; + JSCompartment *comp = js::GetContextCompartment(ctx); + + if (!comp) { + return false; + } + + struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp); if (!JS_InstanceOf(ctx, hobj, &form_class, &args)) return false; -// parent_doc = js::GetGlobalForObjectCrossCompartment(obj); -// assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); -// if_assert_failed return false; -// parent_win = js::GetGlobalForObjectCrossCompartment(parent_doc); -// assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); -// if_assert_failed return false; - JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); - vs = JS_GetInstancePrivate(ctx, parent_win, - &window_class, NULL); + vs = interpreter->vs; doc_view = vs->doc_view; /// fv = form_get_form_view(ctx, obj, argv); fv = form_get_form_view(ctx, obj, rval); @@ -2766,18 +2569,17 @@ form_submit(JSContext *ctx, unsigned int argc, JS::Value *rval) struct session *ses; struct form_view *fv; struct form *form; + JSCompartment *comp = js::GetContextCompartment(ctx); + + if (!comp) { + return false; + } + + struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp); if (!JS_InstanceOf(ctx, hobj, &form_class, &args)) return false; -// parent_doc = js::GetGlobalForObjectCrossCompartment(obj); -// assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); -// if_assert_failed return false; -// parent_win = js::GetGlobalForObjectCrossCompartment(parent_doc); -// assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); -// if_assert_failed return false; - JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); - vs = JS_GetInstancePrivate(ctx, parent_win, - &window_class, NULL); + vs = interpreter->vs; doc_view = vs->doc_view; ses = doc_view->session; // fv = form_get_form_view(ctx, obj, argv); @@ -2934,12 +2736,19 @@ find_form_by_name(JSContext *ctx, static bool forms_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { - jsid id = hid.get(); +// jsid id = hid.get(); JS::Value idval; // JS::RootedObject parent_doc(ctx); /* instance of @document_class */ struct view_state *vs; struct document_view *doc_view; + JSCompartment *comp = js::GetContextCompartment(ctx); + + if (!comp) { + return false; + } + + struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp); /* This can be called if @obj if not itself an instance of the * appropriate class but has one in its prototype chain. Fail @@ -2947,10 +2756,7 @@ forms_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS:: if (!JS_InstanceOf(ctx, hobj, &forms_class, NULL)) return false; - JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); - - vs = JS_GetInstancePrivate(ctx, parent_win, - &window_class, NULL); + vs = interpreter->vs; doc_view = vs->doc_view; if (JSID_IS_STRING(hid)) { @@ -2967,7 +2773,7 @@ forms_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS:: * If we don't find a form whose name is id, * we must leave *vp unchanged here, to avoid * "TypeError: forms.namedItem is not a function". */ - JS_IdToValue(ctx, id, &r_idval); + JS_IdToValue(ctx, hid, &r_idval); unsigned char *string = JS_EncodeString(ctx, r_idval.toString()); find_form_by_name(ctx, doc_view, string, hvp); @@ -2976,7 +2782,7 @@ forms_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS:: } /* Array index. */ JS::RootedValue r_idval(ctx, idval); - JS_IdToValue(ctx, id, &r_idval); + JS_IdToValue(ctx, hid, &r_idval); int index = r_idval.toInt32(); forms_item2(ctx, hobj, index, hvp); @@ -2992,6 +2798,13 @@ forms_get_property_length(JSContext *ctx, unsigned int argc, JS::Value *vp) struct view_state *vs; struct document_view *doc_view; struct document *document; + JSCompartment *comp = js::GetContextCompartment(ctx); + + if (!comp) { + return false; + } + + struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp); /* This can be called if @obj if not itself an instance of the * appropriate class but has one in its prototype chain. Fail @@ -2999,17 +2812,7 @@ forms_get_property_length(JSContext *ctx, unsigned int argc, JS::Value *vp) if (!JS_InstanceOf(ctx, hobj, &forms_class, NULL)) return false; -// JS::RootedObject parent_doc(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); -// assert(JS_InstanceOf(ctx, parent_doc, &document_class, NULL)); -// if_assert_failed return false; - -// JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(parent_doc)); -// assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); -// if_assert_failed return false; - JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); - - vs = JS_GetInstancePrivate(ctx, parent_win, - &window_class, NULL); + vs = interpreter->vs; if (!vs) { return false; } @@ -3049,11 +2852,15 @@ forms_item2(JSContext *ctx, JS::HandleObject hobj, int index, JS::MutableHandleV if (!JS_InstanceOf(ctx, hobj, &forms_class, NULL)) return false; + JSCompartment *comp = js::GetContextCompartment(ctx); - JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); + if (!comp) { + return false; + } - vs = JS_GetInstancePrivate(ctx, parent_win, - &window_class, NULL); + struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp); + + vs = interpreter->vs; hvp.setUndefined(); @@ -3080,13 +2887,17 @@ forms_namedItem(JSContext *ctx, unsigned int argc, JS::Value *vp) // JS::Value *argv = JS_ARGV(ctx, rval); struct view_state *vs; struct document_view *doc_view; + JSCompartment *comp = js::GetContextCompartment(ctx); + + if (!comp) { + return false; + } + + struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp); if (!JS_InstanceOf(ctx, hobj, &forms_class, &args)) return false; - JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); - - vs = JS_GetInstancePrivate(ctx, parent_win, - &window_class, NULL); + vs = interpreter->vs; doc_view = vs->doc_view; if (argc != 1) diff --git a/src/ecmascript/spidermonkey/location.c b/src/ecmascript/spidermonkey/location.c index 10ee9e22..ebebdcd6 100644 --- a/src/ecmascript/spidermonkey/location.c +++ b/src/ecmascript/spidermonkey/location.c @@ -190,6 +190,13 @@ location_get_property_href(JSContext *ctx, unsigned int argc, JS::Value *vp) JS::RootedObject hobj(ctx, &args.thisv().toObject()); struct view_state *vs; + JSCompartment *comp = js::GetContextCompartment(ctx); + + if (!comp) { + return false; + } + + struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp); /* This can be called if @obj if not itself an instance of the * appropriate class but has one in its prototype chain. Fail @@ -197,12 +204,7 @@ location_get_property_href(JSContext *ctx, unsigned int argc, JS::Value *vp) if (!JS_InstanceOf(ctx, hobj, &location_class, NULL)) return false; - JS::RootedObject parent_win(ctx, GetGlobalForObjectCrossCompartment(hobj)); - assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); - if_assert_failed return false; - - vs = JS_GetInstancePrivate(ctx, parent_win, - &window_class, NULL); + vs = interpreter->vs; if (!vs) { return false; } @@ -227,6 +229,13 @@ location_set_property_href(JSContext *ctx, unsigned int argc, JS::Value *vp) struct view_state *vs; struct document_view *doc_view; + JSCompartment *comp = js::GetContextCompartment(ctx); + + if (!comp) { + return false; + } + + struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp); /* This can be called if @obj if not itself an instance of the * appropriate class but has one in its prototype chain. Fail @@ -234,12 +243,7 @@ location_set_property_href(JSContext *ctx, unsigned int argc, JS::Value *vp) if (!JS_InstanceOf(ctx, hobj, &location_class, NULL)) return false; - JS::RootedObject parent_win(ctx, GetGlobalForObjectCrossCompartment(hobj)); - assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); - if_assert_failed return false; - - vs = JS_GetInstancePrivate(ctx, parent_win, - &window_class, NULL); + vs = interpreter->vs; if (!vs) { return; } diff --git a/src/ecmascript/spidermonkey/unibar.c b/src/ecmascript/spidermonkey/unibar.c index 1cf8aec5..3f43736f 100644 --- a/src/ecmascript/spidermonkey/unibar.c +++ b/src/ecmascript/spidermonkey/unibar.c @@ -97,6 +97,13 @@ unibar_get_property_visible(JSContext *ctx, unsigned int argc, JS::Value *vp) struct document_view *doc_view; struct session_status *status; unsigned char *bar; + JSCompartment *comp = js::GetContextCompartment(ctx); + + if (!comp) { + return false; + } + + struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp); /* This can be called if @obj if not itself an instance of either * appropriate class but has one in its prototype chain. Fail @@ -105,12 +112,7 @@ unibar_get_property_visible(JSContext *ctx, unsigned int argc, JS::Value *vp) && !JS_InstanceOf(ctx, hobj, &statusbar_class, NULL)) return false; - JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); - assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); - if_assert_failed return false; - - vs = JS_GetInstancePrivate(ctx, parent_win, - &window_class, NULL); + vs = interpreter->vs; if (!vs) { return false; } @@ -148,6 +150,13 @@ unibar_set_property_visible(JSContext *ctx, unsigned int argc, JS::Value *vp) struct document_view *doc_view; struct session_status *status; unsigned char *bar; + JSCompartment *comp = js::GetContextCompartment(ctx); + + if (!comp) { + return false; + } + + struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp); /* This can be called if @obj if not itself an instance of either * appropriate class but has one in its prototype chain. Fail @@ -156,12 +165,7 @@ unibar_set_property_visible(JSContext *ctx, unsigned int argc, JS::Value *vp) && !JS_InstanceOf(ctx, hobj, &statusbar_class, NULL)) return false; - JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(hobj)); - assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL)); - if_assert_failed return false; - - vs = JS_GetInstancePrivate(ctx, parent_win, - &window_class, NULL); + vs = interpreter->vs; if (!vs) { return false; } diff --git a/src/ecmascript/spidermonkey/window.c b/src/ecmascript/spidermonkey/window.c index f0565177..bb00db44 100644 --- a/src/ecmascript/spidermonkey/window.c +++ b/src/ecmascript/spidermonkey/window.c @@ -135,14 +135,20 @@ static bool window_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { struct view_state *vs; + JSCompartment *comp = js::GetContextCompartment(ctx); + if (!comp) { + return false; + } + + struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp); /* This can be called if @obj if not itself an instance of the * appropriate class but has one in its prototype chain. Fail * such calls. */ if (!JS_InstanceOf(ctx, hobj, &window_class, NULL)) return false; - vs = JS_GetInstancePrivate(ctx, hobj, &window_class, NULL); + vs = interpreter->vs; /* No need for special window.location measurements - when * location is then evaluated in string context, toString() @@ -188,6 +194,13 @@ window_alert(JSContext *ctx, unsigned int argc, JS::Value *rval) JSObject *obj = JS_THIS_OBJECT(ctx, rval); JS::RootedObject hobj(ctx, obj); JS::CallArgs args = JS::CallArgsFromVp(argc, rval); + JSCompartment *comp = js::GetContextCompartment(ctx); + + if (!comp) { + return false; + } + + struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp); // JS::Value *argv = JS_ARGV(ctx, rval); struct view_state *vs; @@ -197,7 +210,7 @@ window_alert(JSContext *ctx, unsigned int argc, JS::Value *rval) return false; } - vs = JS_GetInstancePrivate(ctx, hobj, &window_class, nullptr); + vs = interpreter->vs; if (argc != 1) return true; @@ -232,10 +245,17 @@ window_open(JSContext *ctx, unsigned int argc, JS::Value *rval) struct uri *uri; static time_t ratelimit_start; static int ratelimit_count; + JSCompartment *comp = js::GetContextCompartment(ctx); + + if (!comp) { + return false; + } + + struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp); if (!JS_InstanceOf(ctx, hobj, &window_class, &args)) return false; - vs = JS_GetInstancePrivate(ctx, hobj, &window_class, &args); + vs = interpreter->vs; doc_view = vs->doc_view; ses = doc_view->session; @@ -438,8 +458,14 @@ window_set_property_status(JSContext *ctx, unsigned int argc, JS::Value *vp) } JS::RootedObject hobj(ctx, &args.thisv().toObject()); + JSCompartment *comp = js::GetContextCompartment(ctx); - struct view_state *vs = JS_GetInstancePrivate(ctx, hobj, &window_class, NULL); + if (!comp) { + return false; + } + + struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp); + struct view_state *vs = interpreter->vs; if (!vs) { return true; @@ -460,10 +486,17 @@ window_get_property_top(JSContext *ctx, unsigned int argc, JS::Value *vp) struct document_view *doc_view; struct document_view *top_view; JSObject *newjsframe; + JSCompartment *comp = js::GetContextCompartment(ctx); + + if (!comp) { + return false; + } + + struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp); JS::RootedObject hobj(ctx, &args.thisv().toObject()); - vs = JS_GetInstancePrivate(ctx, hobj, &window_class, NULL); + vs = interpreter->vs; if (!vs) { return false; From 477e56eb43252ae0e5cca36320e9d77b884de2a8 Mon Sep 17 00:00:00 2001 From: Witold Filipczyk Date: Tue, 17 Nov 2020 18:46:27 +0100 Subject: [PATCH 084/179] [smjs] Maybe it is not correct, but spidermonkey and smjs work together. --- src/ecmascript/spidermonkey-shared.h | 2 +- src/ecmascript/spidermonkey/heartbeat.c | 3 +-- src/scripting/smjs/core.c | 10 +++++++--- src/scripting/smjs/global_object.c | 10 ++++------ src/scripting/smjs/hooks.c | 13 +++++++++++++ src/scripting/smjs/session_object.c | 11 ++++++----- 6 files changed, 32 insertions(+), 17 deletions(-) diff --git a/src/ecmascript/spidermonkey-shared.h b/src/ecmascript/spidermonkey-shared.h index 52c88fe4..9e30a50b 100644 --- a/src/ecmascript/spidermonkey-shared.h +++ b/src/ecmascript/spidermonkey-shared.h @@ -53,7 +53,7 @@ JSObject *spidermonkey_InitClass(JSContext *cx, JSObject *obj, JSPropertySpec *static_ps, const spidermonkeyFunctionSpec *static_fs); -static unsigned char *jsval_to_string(JSContext *ctx, JS::Value *vp); +static unsigned char *jsval_to_string(JSContext *ctx, JS::HandleValue hvp); static unsigned char *jsid_to_string(JSContext *ctx, JS::HandleId hid); /* Inline functions */ diff --git a/src/ecmascript/spidermonkey/heartbeat.c b/src/ecmascript/spidermonkey/heartbeat.c index 099881f4..9d6192c4 100644 --- a/src/ecmascript/spidermonkey/heartbeat.c +++ b/src/ecmascript/spidermonkey/heartbeat.c @@ -43,9 +43,8 @@ heartbeat_callback(JSContext *ctx) } struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp); -// struct ecmascript_interpreter *interpreter = JS_GetContextPrivate(ctx); - if (!interpreter->heartbeat || interpreter->heartbeat->ttl > 0) { + if (!interpreter || !interpreter->heartbeat || interpreter->heartbeat->ttl > 0) { return true; } return false; diff --git a/src/scripting/smjs/core.c b/src/scripting/smjs/core.c index cca5caec..d524f99a 100644 --- a/src/scripting/smjs/core.c +++ b/src/scripting/smjs/core.c @@ -29,7 +29,6 @@ JSContext *smjs_ctx; JSObject *smjs_elinks_object; struct session *smjs_ses; - void alert_smjs_error(unsigned char *msg) { @@ -184,6 +183,9 @@ smjs_do_file(unsigned char *path) opts.setNoScriptRval(true); JS::RootedValue rval(smjs_ctx); + JS_BeginRequest(smjs_ctx); + JSCompartment *prev = JS_EnterCompartment(smjs_ctx, smjs_elinks_object); + if (!add_file_to_string(&script, path) || false == JS::Evaluate(smjs_ctx, opts, script.source, script.length, &rval)) { @@ -191,6 +193,8 @@ smjs_do_file(unsigned char *path) ret = 0; } + JS_LeaveCompartment(smjs_ctx, prev); + JS_EndRequest(smjs_ctx); done_string(&script); return ret; @@ -234,7 +238,7 @@ init_smjs(struct module *module) { if (!spidermonkey_runtime_addref()) return; - smjs_ctx = JS_NewContext(8L * 1024 * 1024); + smjs_ctx = main_ctx; //JS_NewContext(8L * 1024 * 1024); if (!smjs_ctx) { spidermonkey_runtime_release(); return; @@ -268,7 +272,7 @@ cleanup_smjs(struct module *module) * If the garbage collector were conservative, ELinks would * have to call smjs_detach_cache_entry_object on each cache * entry before it releases the runtime here. */ - JS_DestroyContext(smjs_ctx); + //JS_DestroyContext(smjs_ctx); spidermonkey_runtime_release(); } diff --git a/src/scripting/smjs/global_object.c b/src/scripting/smjs/global_object.c index 733d8527..11188354 100644 --- a/src/scripting/smjs/global_object.c +++ b/src/scripting/smjs/global_object.c @@ -30,20 +30,18 @@ static JSObject * smjs_get_global_object(void) { assert(smjs_ctx); - JSAutoCompartment *acc = NULL; - JSAutoRequest ar(smjs_ctx); JS::CompartmentOptions opts; - if (!JS::InitSelfHostedCode(smjs_ctx)) { - return NULL; - } +// if (!JS::InitSelfHostedCode(smjs_ctx)) { +// return NULL; +// } JS::RootedObject jsobj(smjs_ctx, JS_NewGlobalObject(smjs_ctx, (JSClass *) &global_class, NULL, JS::DontFireOnNewGlobalHook, opts)); if (!jsobj) return NULL; - acc = new JSAutoCompartment(smjs_ctx, jsobj); + new JSAutoCompartment(smjs_ctx, jsobj); JS_InitStandardClasses(smjs_ctx, jsobj); diff --git a/src/scripting/smjs/hooks.c b/src/scripting/smjs/hooks.c index a5233012..340a0ec8 100644 --- a/src/scripting/smjs/hooks.c +++ b/src/scripting/smjs/hooks.c @@ -27,11 +27,15 @@ script_hook_url(va_list ap, void *data) unsigned char **url = va_arg(ap, unsigned char **); struct session *ses = va_arg(ap, struct session *); enum evhook_status ret = EVENT_HOOK_STATUS_NEXT; + JS::Value args[3]; JS::RootedValue r_rval(smjs_ctx); if (*url == NULL) return EVENT_HOOK_STATUS_NEXT; + JS_BeginRequest(smjs_ctx); + JSCompartment *prev = JS_EnterCompartment(smjs_ctx, smjs_elinks_object); + smjs_ses = ses; args[2].setString(JS_NewStringCopyZ(smjs_ctx, *url)); @@ -48,6 +52,8 @@ script_hook_url(va_list ap, void *data) } smjs_ses = NULL; + JS_LeaveCompartment(smjs_ctx, prev); + JS_EndRequest(smjs_ctx); return ret; } @@ -62,6 +68,9 @@ script_hook_pre_format_html(va_list ap, void *data) JS::Value args[4]; JS::RootedValue r_rval(smjs_ctx); + JS_BeginRequest(smjs_ctx); + JSCompartment *prev = JS_EnterCompartment(smjs_ctx, smjs_elinks_object); + evhook_use_params(ses && cached); if (!smjs_ctx || !cached->length) { @@ -70,6 +79,7 @@ script_hook_pre_format_html(va_list ap, void *data) smjs_ses = ses; + if (have_location(ses)) { struct view_state *vs = &cur_loc(ses)->vs; @@ -88,7 +98,10 @@ script_hook_pre_format_html(va_list ap, void *data) ret = EVENT_HOOK_STATUS_LAST; } + end: + JS_LeaveCompartment(smjs_ctx, prev); + JS_EndRequest(smjs_ctx); smjs_ses = NULL; return ret; } diff --git a/src/scripting/smjs/session_object.c b/src/scripting/smjs/session_object.c index f91e6587..2973d800 100644 --- a/src/scripting/smjs/session_object.c +++ b/src/scripting/smjs/session_object.c @@ -1056,22 +1056,21 @@ static bool session_array_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp) { ELINKS_CAST_PROP_PARAMS - jsid id = hid.get(); JSObject *tabobj; struct terminal *term = JS_GetPrivate(obj); int index; struct window *tab; - undef_to_jsval(ctx, vp); + hvp.setUndefined(); - if (!JSID_IS_INT(id)) + if (!JSID_IS_INT(hid)) return false; assert(term); if_assert_failed return true; - index = JSID_TO_INT(id); + index = JSID_TO_INT(hid); foreach_tab (tab, term->windows) { if (!index) break; --index; @@ -1079,7 +1078,9 @@ session_array_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId h if ((void *) tab == (void *) &term->windows) return false; tabobj = smjs_get_session_object(tab->data); - if (tabobj) object_to_jsval(ctx, vp, tabobj); + if (tabobj) { + hvp.setObject(*tabobj); + } return true; } From 085a93d54471d9430c9b18431da1bd1d387e8e98 Mon Sep 17 00:00:00 2001 From: Witold Filipczyk Date: Sat, 21 Nov 2020 17:54:47 +0100 Subject: [PATCH 085/179] [spidermonkey] JS_PS_END --- src/ecmascript/spidermonkey/document.c | 2 +- src/ecmascript/spidermonkey/form.c | 8 ++++---- src/ecmascript/spidermonkey/location.c | 2 +- src/ecmascript/spidermonkey/navigator.c | 2 +- src/ecmascript/spidermonkey/unibar.c | 2 +- src/ecmascript/spidermonkey/window.c | 2 +- src/scripting/smjs/bookmarks.c | 2 +- src/scripting/smjs/cache_object.c | 2 +- src/scripting/smjs/elinks_object.c | 2 +- src/scripting/smjs/globhist.c | 2 +- 10 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/ecmascript/spidermonkey/document.c b/src/ecmascript/spidermonkey/document.c index 0d2543f1..fed609e2 100644 --- a/src/ecmascript/spidermonkey/document.c +++ b/src/ecmascript/spidermonkey/document.c @@ -379,7 +379,7 @@ JSPropertySpec document_props[] = { JS_PSG("referrer", document_get_property_referrer, JSPROP_ENUMERATE), JS_PSGS("title", document_get_property_title, document_set_property_title, JSPROP_ENUMERATE), /* TODO: Charset? */ JS_PSGS("url", document_get_property_url, document_set_property_url, JSPROP_ENUMERATE), - { NULL } + JS_PS_END }; diff --git a/src/ecmascript/spidermonkey/form.c b/src/ecmascript/spidermonkey/form.c index 7210dbe5..adbfc3d3 100644 --- a/src/ecmascript/spidermonkey/form.c +++ b/src/ecmascript/spidermonkey/form.c @@ -1263,7 +1263,7 @@ static JSPropertySpec input_props[] = { JS_PSG("tabindex", input_get_property_tabIndex, JSPROP_ENUMERATE), JS_PSG("type", input_get_property_type, JSPROP_ENUMERATE), JS_PSGS("value", input_get_property_value, input_set_property_value, JSPROP_ENUMERATE), - { NULL } + JS_PS_END }; static bool input_blur(JSContext *ctx, unsigned int argc, JS::Value *rval); @@ -1628,7 +1628,7 @@ enum form_elements_prop { }; static JSPropertySpec form_elements_props[] = { JS_PSG("length", form_elements_get_property_length, JSPROP_ENUMERATE), - { NULL } + JS_PS_END }; static bool @@ -1904,7 +1904,7 @@ static JSPropertySpec form_props[] = { JS_PSGS("method", form_get_property_method, form_set_property_method, JSPROP_ENUMERATE), JS_PSGS("name", form_get_property_name, form_set_property_name, JSPROP_ENUMERATE), JS_PSGS("target", form_get_property_target, form_set_property_target, JSPROP_ENUMERATE), - { NULL } + JS_PS_END }; static bool form_reset(JSContext *ctx, unsigned int argc, JS::Value *rval); @@ -2707,7 +2707,7 @@ enum forms_prop { }; JSPropertySpec forms_props[] = { JS_PSG("length", forms_get_property_length, JSPROP_ENUMERATE), - { NULL } + JS_PS_END }; /* Find the form whose name is @name, which should normally be a diff --git a/src/ecmascript/spidermonkey/location.c b/src/ecmascript/spidermonkey/location.c index ebebdcd6..4a8a6951 100644 --- a/src/ecmascript/spidermonkey/location.c +++ b/src/ecmascript/spidermonkey/location.c @@ -179,7 +179,7 @@ enum location_prop { }; JSPropertySpec location_props[] = { JS_PSGS("href", location_get_property_href, location_set_property_href, JSPROP_ENUMERATE), - { NULL } + JS_PS_END }; diff --git a/src/ecmascript/spidermonkey/navigator.c b/src/ecmascript/spidermonkey/navigator.c index 46c35dc1..2d19acd3 100644 --- a/src/ecmascript/spidermonkey/navigator.c +++ b/src/ecmascript/spidermonkey/navigator.c @@ -84,7 +84,7 @@ JSPropertySpec navigator_props[] = { JS_PSG("language", navigator_get_property_language, JSPROP_ENUMERATE), JS_PSG("platform", navigator_get_property_platform, JSPROP_ENUMERATE), JS_PSG("userAgent", navigator_get_property_userAgent, JSPROP_ENUMERATE), - { NULL } + JS_PS_END }; diff --git a/src/ecmascript/spidermonkey/unibar.c b/src/ecmascript/spidermonkey/unibar.c index 3f43736f..bf54b311 100644 --- a/src/ecmascript/spidermonkey/unibar.c +++ b/src/ecmascript/spidermonkey/unibar.c @@ -82,7 +82,7 @@ enum unibar_prop { }; JSPropertySpec unibar_props[] = { JS_PSGS("visible", unibar_get_property_visible, unibar_set_property_visible, JSPROP_ENUMERATE), - { NULL } + JS_PS_END }; diff --git a/src/ecmascript/spidermonkey/window.c b/src/ecmascript/spidermonkey/window.c index bb00db44..23733521 100644 --- a/src/ecmascript/spidermonkey/window.c +++ b/src/ecmascript/spidermonkey/window.c @@ -90,7 +90,7 @@ JSPropertySpec window_props[] = { JS_PSGS("status", window_get_property_status, window_set_property_status, 0), JS_PSG("top", window_get_property_top, JSPROP_ENUMERATE), JS_PSG("window", window_get_property_self, JSPROP_ENUMERATE), - { NULL } + JS_PS_END }; diff --git a/src/scripting/smjs/bookmarks.c b/src/scripting/smjs/bookmarks.c index d32bf1c4..b1390b4c 100644 --- a/src/scripting/smjs/bookmarks.c +++ b/src/scripting/smjs/bookmarks.c @@ -102,7 +102,7 @@ static const JSPropertySpec bookmark_props[] = { JS_PSGS("title", bookmark_get_property_title, bookmark_set_property_title, JSPROP_ENUMERATE), JS_PSGS( "url", bookmark_get_property_url, bookmark_set_property_url, JSPROP_ENUMERATE), JS_PSG("children", bookmark_get_property_children, JSPROP_ENUMERATE), - { NULL } + JS_PS_END }; static JSObject *smjs_get_bookmark_folder_object(struct bookmark *bookmark); diff --git a/src/scripting/smjs/cache_object.c b/src/scripting/smjs/cache_object.c index 0ea15d1c..162b87f2 100644 --- a/src/scripting/smjs/cache_object.c +++ b/src/scripting/smjs/cache_object.c @@ -56,7 +56,7 @@ static const JSPropertySpec cache_entry_props[] = { JS_PSG("length", cache_entry_get_property_length, JSPROP_ENUMERATE), JS_PSGS("head", cache_entry_get_property_head, cache_entry_set_property_head, JSPROP_ENUMERATE), JS_PSG("uri", cache_entry_get_property_uri, JSPROP_ENUMERATE), - { NULL } + JS_PS_END }; static bool diff --git a/src/scripting/smjs/elinks_object.c b/src/scripting/smjs/elinks_object.c index 50b709d6..a2cfae0f 100644 --- a/src/scripting/smjs/elinks_object.c +++ b/src/scripting/smjs/elinks_object.c @@ -102,7 +102,7 @@ static const JSPropertySpec elinks_props[] = { JS_PSG("home", elinks_get_property_home, JSPROP_ENUMERATE), JS_PSGS("location", elinks_get_property_location, elinks_set_property_location, JSPROP_ENUMERATE), JS_PSG("session", elinks_get_property_session, JSPROP_ENUMERATE), - { NULL } + JS_PS_END }; static bool elinks_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp); diff --git a/src/scripting/smjs/globhist.c b/src/scripting/smjs/globhist.c index 28ecf8b3..9c386a02 100644 --- a/src/scripting/smjs/globhist.c +++ b/src/scripting/smjs/globhist.c @@ -66,7 +66,7 @@ static const JSPropertySpec smjs_globhist_item_props[] = { JS_PSGS("title", smjs_globhist_item_get_property_title, smjs_globhist_item_set_property_title, JSPROP_ENUMERATE), JS_PSGS("url", smjs_globhist_item_get_property_url, smjs_globhist_item_set_property_url, JSPROP_ENUMERATE), JS_PSGS("last_visit", smjs_globhist_item_get_property_last_visit, smjs_globhist_item_set_property_last_visit, JSPROP_ENUMERATE), - { NULL } + JS_PS_END }; /* @smjs_globhist_item_class.getProperty */ From a92df85c11edc21dfe4ead5af3d4fc908329b862 Mon Sep 17 00:00:00 2001 From: Witold Filipczyk Date: Sun, 22 Nov 2020 16:42:23 +0100 Subject: [PATCH 086/179] [spidermonkey] Changes in setTimeout. Spidermonkey is "hardcoded" in ecmascript, but ecmascript script engine is rarely being changed. --- configure.ac | 2 +- src/ecmascript/ecmascript.c | 44 ++++++++++++++++++++++++++++ src/ecmascript/ecmascript.h | 5 ++++ src/ecmascript/spidermonkey.c | 26 ++++++++++++++++ src/ecmascript/spidermonkey.h | 4 +++ src/ecmascript/spidermonkey/window.c | 27 +++++++++++------ 6 files changed, 98 insertions(+), 10 deletions(-) diff --git a/configure.ac b/configure.ac index 17b6c04a..ca7b24b4 100644 --- a/configure.ac +++ b/configure.ac @@ -736,7 +736,7 @@ if test "x$CONFIG_ECMASCRIPT_SMJS" = xyes || AC_SUBST(SPIDERMONKEY_LIBS) AC_SUBST(SPIDERMONKEY_CFLAGS) AC_SUBST(CONFIG_SPIDERMONKEY) - CFLAGS="$CFLAGS -fpermissive" + CFLAGS="$CFLAGS -fpermissive $SPIDERMONKEY_CFLAGS" fi # =================================================================== diff --git a/src/ecmascript/ecmascript.c b/src/ecmascript/ecmascript.c index 7979f77d..4f95f575 100644 --- a/src/ecmascript/ecmascript.c +++ b/src/ecmascript/ecmascript.c @@ -138,6 +138,19 @@ ecmascript_eval(struct ecmascript_interpreter *interpreter, interpreter->backend_nesting--; } +static void +ecmascript_call_function(struct ecmascript_interpreter *interpreter, + JS::HandleValue fun, struct string *ret) +{ + if (!get_ecmascript_enable()) + return; + assert(interpreter); + interpreter->backend_nesting++; + spidermonkey_call_function(interpreter, fun, ret); + interpreter->backend_nesting--; +} + + unsigned char * ecmascript_eval_stringback(struct ecmascript_interpreter *interpreter, struct string *code) @@ -313,6 +326,24 @@ ecmascript_timeout_handler(void *i) ecmascript_eval(interpreter, &interpreter->code, NULL); } +/* Timer callback for @interpreter->vs->doc_view->document->timeout. + * As explained in @install_timer, this function must erase the + * expired timer ID from all variables. */ +static void +ecmascript_timeout_handler2(void *i) +{ + struct ecmascript_interpreter *interpreter = i; + + assertm(interpreter->vs->doc_view != NULL, + "setTimeout: vs with no document (e_f %d)", + interpreter->vs->ecmascript_fragile); + interpreter->vs->doc_view->document->timeout = TIMER_ID_UNDEF; + /* The expired timer ID has now been erased. */ + + ecmascript_call_function(interpreter, interpreter->fun, NULL); +} + + void ecmascript_set_timeout(struct ecmascript_interpreter *interpreter, unsigned char *code, int timeout) { @@ -326,6 +357,19 @@ ecmascript_set_timeout(struct ecmascript_interpreter *interpreter, unsigned char install_timer(&interpreter->vs->doc_view->document->timeout, timeout, ecmascript_timeout_handler, interpreter); } +void +ecmascript_set_timeout2(struct ecmascript_interpreter *interpreter, JS::HandleValue f, int timeout) +{ + assert(interpreter && interpreter->vs->doc_view->document); + done_string(&interpreter->code); + init_string(&interpreter->code); + kill_timer(&interpreter->vs->doc_view->document->timeout); + JS::RootedValue fun((JSContext *)interpreter->backend_data, f); + interpreter->fun = fun; + install_timer(&interpreter->vs->doc_view->document->timeout, timeout, ecmascript_timeout_handler2, interpreter); +} + + static struct module *ecmascript_modules[] = { #ifdef CONFIG_ECMASCRIPT_SMJS &spidermonkey_module, diff --git a/src/ecmascript/ecmascript.h b/src/ecmascript/ecmascript.h index 61203f92..471bd75d 100644 --- a/src/ecmascript/ecmascript.h +++ b/src/ecmascript/ecmascript.h @@ -5,6 +5,8 @@ /* In the future you will get DOM, a complete ECMAScript interface and free * plasm displays for everyone. */ +#include + #include "main/module.h" #include "util/time.h" @@ -56,6 +58,7 @@ struct ecmascript_interpreter { void *ac; void *ac2; void *ar; + JS::RootedValue fun; }; /* Why is the interpreter bound to {struct view_state} instead of {struct @@ -97,6 +100,8 @@ void ecmascript_set_action(unsigned char **action, unsigned char *string); void ecmascript_set_timeout(struct ecmascript_interpreter *interpreter, unsigned char *code, int timeout); +void ecmascript_set_timeout2(struct ecmascript_interpreter *interpreter, JS::HandleValue f, int timeout); + extern struct module ecmascript_module; #endif diff --git a/src/ecmascript/spidermonkey.c b/src/ecmascript/spidermonkey.c index e07c59dd..40f0a647 100644 --- a/src/ecmascript/spidermonkey.c +++ b/src/ecmascript/spidermonkey.c @@ -400,6 +400,32 @@ spidermonkey_eval(struct ecmascript_interpreter *interpreter, JS_EndRequest(ctx); } +void +spidermonkey_call_function(struct ecmascript_interpreter *interpreter, + JS::HandleValue fun, struct string *ret) +{ + JSContext *ctx; + JS::Value rval; + + assert(interpreter); + if (!js_module_init_ok) { + return; + } + ctx = interpreter->backend_data; + JS_BeginRequest(ctx); + JSCompartment *comp = JS_EnterCompartment(ctx, interpreter->ac); + + interpreter->heartbeat = add_heartbeat(interpreter); + interpreter->ret = ret; + + JS::RootedValue r_val(ctx, rval); + JS::RootedObject cg(ctx, JS::CurrentGlobalOrNull(ctx)); + JS_CallFunctionValue(ctx, cg, fun, JS::HandleValueArray::empty(), &r_val); + done_heartbeat(interpreter->heartbeat); + JS_LeaveCompartment(ctx, comp); + JS_EndRequest(ctx); +} + unsigned char * spidermonkey_eval_stringback(struct ecmascript_interpreter *interpreter, diff --git a/src/ecmascript/spidermonkey.h b/src/ecmascript/spidermonkey.h index a751b69e..f74eead2 100644 --- a/src/ecmascript/spidermonkey.h +++ b/src/ecmascript/spidermonkey.h @@ -1,6 +1,8 @@ #ifndef EL__ECMASCRIPT_SPIDERMONKEY_H #define EL__ECMASCRIPT_SPIDERMONKEY_H +#include + struct ecmascript_interpreter; struct form_view; struct form_state; @@ -17,5 +19,7 @@ void spidermonkey_eval(struct ecmascript_interpreter *interpreter, struct string unsigned char *spidermonkey_eval_stringback(struct ecmascript_interpreter *interpreter, struct string *code); int spidermonkey_eval_boolback(struct ecmascript_interpreter *interpreter, struct string *code); +void spidermonkey_call_function(struct ecmascript_interpreter *interpreter, JS::HandleValue fun, struct string *ret); + extern struct module spidermonkey_module; #endif diff --git a/src/ecmascript/spidermonkey/window.c b/src/ecmascript/spidermonkey/window.c index 23733521..416644bb 100644 --- a/src/ecmascript/spidermonkey/window.c +++ b/src/ecmascript/spidermonkey/window.c @@ -367,20 +367,29 @@ window_setTimeout(JSContext *ctx, unsigned int argc, JS::Value *rval) if (argc != 2) return true; - code = jsval_to_string(ctx, args[0]); - if (!*code) - return true; - - code = stracpy(code); - if (!code) - return true; timeout = args[1].toInt32(); if (timeout <= 0) { - mem_free(code); return true; } - ecmascript_set_timeout(interpreter, code, timeout); + + if (args[0].isString()) { + code = jsval_to_string(ctx, args[0]); + + if (!*code) { + return true; + } + code = stracpy(code); + + if (!code) { + return true; + } + + ecmascript_set_timeout(interpreter, code, timeout); + return true; + } + + ecmascript_set_timeout2(interpreter, args[0], timeout); return true; } From 37ae7a0db871466c20b3a347d6b4f54f3bbfee31 Mon Sep 17 00:00:00 2001 From: Witold Filipczyk Date: Mon, 23 Nov 2020 18:06:17 +0100 Subject: [PATCH 087/179] [spidermonkey] ReportError - removed code, which did not work well --- src/ecmascript/spidermonkey.c | 28 +--------------------------- 1 file changed, 1 insertion(+), 27 deletions(-) diff --git a/src/ecmascript/spidermonkey.c b/src/ecmascript/spidermonkey.c index 40f0a647..3503a0c1 100644 --- a/src/ecmascript/spidermonkey.c +++ b/src/ecmascript/spidermonkey.c @@ -148,7 +148,6 @@ error_reporter(JSContext *ctx, JSErrorReport *report) } struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp); -// struct ecmascript_interpreter *interpreter = JS_GetContextPrivate(ctx); struct session *ses = interpreter->vs->doc_view->session; struct terminal *term; unsigned char *strict, *exception, *warning, *error; @@ -162,8 +161,6 @@ error_reporter(JSContext *ctx, JSErrorReport *report) term = ses->tab->term; - PrintError(ctx, stderr, JS::ConstUTF8CharsZ(), report, true/*reportWarnings*/); - #ifdef CONFIG_LEDS set_led_value(ses->status.ecmascript_led, 'J'); #endif @@ -182,30 +179,7 @@ error_reporter(JSContext *ctx, JSErrorReport *report) strict, exception, warning, error); add_to_string(&msg, ":\n\n"); - - if (report->filename) { - prefix = JS_smprintf("%s:", report->filename); - } - - if (report->lineno) { - char* tmp = prefix; - prefix = JS_smprintf("%s%u:%u ", tmp ? tmp : "", report->lineno, report->column); - JS_free(ctx, tmp); - } - - if (prefix) { - add_to_string(&msg, prefix); - } -#if 0 - if (report->linebuf && report->tokenptr) { - int pos = report->tokenptr - report->linebuf; - - add_format_to_string(&msg, "\n\n%s\n.%*s^%*s.", - report->linebuf, - pos - 2, " ", - strlen(report->linebuf) - pos - 1, " "); - } -#endif + add_to_string(&msg, report->message().c_str()); info_box(term, MSGBOX_FREE_TEXT, N_("JavaScript Error"), ALIGN_CENTER, msg.source); From 3e3721582e5f8b3b965edf79f400e7ad71904caa Mon Sep 17 00:00:00 2001 From: Witold Filipczyk Date: Mon, 23 Nov 2020 20:11:47 +0100 Subject: [PATCH 088/179] [ecmascript] Guard for builds without mozjs. Refs #81 --- src/ecmascript/ecmascript.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/ecmascript/ecmascript.h b/src/ecmascript/ecmascript.h index 471bd75d..e351e568 100644 --- a/src/ecmascript/ecmascript.h +++ b/src/ecmascript/ecmascript.h @@ -5,6 +5,12 @@ /* In the future you will get DOM, a complete ECMAScript interface and free * plasm displays for everyone. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#ifdef CONFIG_ECMASCRIPT + #include #include "main/module.h" @@ -105,3 +111,5 @@ void ecmascript_set_timeout2(struct ecmascript_interpreter *interpreter, JS::Han extern struct module ecmascript_module; #endif + +#endif From a24cea2d8727a6deadd77d92b93832ee363bf789 Mon Sep 17 00:00:00 2001 From: Witold Filipczyk Date: Tue, 24 Nov 2020 19:36:29 +0100 Subject: [PATCH 089/179] [configure.ac] PKG_CONFIG_STATIC -> pkg_config_static --- configure.ac | 48 ++++++++++++++++++++++++------------------------ 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/configure.ac b/configure.ac index ca7b24b4..6b16826b 100644 --- a/configure.ac +++ b/configure.ac @@ -135,14 +135,14 @@ fi # =================================================================== enable_static=no -PKG_CONFIG_STATIC= +pkg_config_static= AC_ARG_WITH(static, [ --with-static enable build of static binary], [ if test "x$withval" != xno; then enable_static=yes; fi ]) if test "$enable_static" = yes; then CFLAGS="$CFLAGS -static" - PKG_CONFIG_STATIC="--static" + pkg_config_static="--static" fi # =================================================================== @@ -524,9 +524,9 @@ if test "$enable_brotli" = no; then AC_MSG_RESULT([[disabled]]) else AC_MSG_CHECKING([[for brotli in pkg-config]]) - if $PKG_CONFIG $PKG_CONFIG_STATIC libbrotlidec; then - BROTLI_CFLAGS=`$PKG_CONFIG $PKG_CONFIG_STATIC --cflags libbrotlidec` - BROTLI_LIBS=`$PKG_CONFIG $PKG_CONFIG_STATIC --libs libbrotlidec` + if $PKG_CONFIG $pkg_config_static libbrotlidec; then + BROTLI_CFLAGS=`$PKG_CONFIG $pkg_config_static --cflags libbrotlidec` + BROTLI_LIBS=`$PKG_CONFIG $pkg_config_static --libs libbrotlidec` LIBS="$BROTLI_LIBS $LIBS" CONFIG_BROTLI=yes AC_DEFINE([CONFIG_BROTLI], [1], [Define as 1 to use the libbrotli library.]) @@ -661,9 +661,9 @@ for package in mozjs-52; do break else AC_MSG_CHECKING([for SpiderMonkey (mozjs-52) in pkg-config $package]) - if $PKG_CONFIG $PKG_CONFIG_STATIC --cflags --libs $package > /dev/null 2>&AS_MESSAGE_LOG_FD; then - SPIDERMONKEY_LIBS="$($PKG_CONFIG $PKG_CONFIG_STATIC --libs $package)" - SPIDERMONKEY_CFLAGS="$($PKG_CONFIG $PKG_CONFIG_STATIC --cflags $package)" + if $PKG_CONFIG $pkg_config_static --cflags --libs $package > /dev/null 2>&AS_MESSAGE_LOG_FD; then + SPIDERMONKEY_LIBS="$($PKG_CONFIG $pkg_config_static --libs $package)" + SPIDERMONKEY_CFLAGS="$($PKG_CONFIG $pkg_config_static --cflags $package)" LIBS="$SPIDERMONKEY_LIBS $LIBS_X" CFLAGS="$CFLAGS_X $SPIDERMONKEY_CFLAGS" CPPFLAGS="$CPPFLAGS_X $SPIDERMONKEY_CFLAGS" @@ -926,9 +926,9 @@ AC_MSG_CHECKING([for Lua]) EL_SAVE_FLAGS cf_result=no -if test -n "$luapkg" && $PKG_CONFIG $PKG_CONFIG_STATIC "$luapkg"; then - LUA_CFLAGS=`$PKG_CONFIG $PKG_CONFIG_STATIC --cflags "$luapkg"` - LUA_LIBS=`$PKG_CONFIG $PKG_CONFIG_STATIC --libs "$luapkg"` +if test -n "$luapkg" && $PKG_CONFIG $pkg_config_static "$luapkg"; then + LUA_CFLAGS=`$PKG_CONFIG $pkg_config_static --cflags "$luapkg"` + LUA_LIBS=`$PKG_CONFIG $pkg_config_static --libs "$luapkg"` CFLAGS="$CFLAGS_X $LUA_CFLAGS" CPPFLAGS="$CPPFLAGS_X $LUA_CFLAGS" LIBS="$LUA_LIBS $LIBS_X" @@ -979,9 +979,9 @@ if test "$with_tre" = no; then tre_log="no (explicitly disabled)" else AC_MSG_CHECKING([[for TRE in pkg-config]]) - if $PKG_CONFIG $PKG_CONFIG_STATIC tre; then - TRE_CFLAGS=`$PKG_CONFIG $PKG_CONFIG_STATIC --cflags tre` - TRE_LIBS=`$PKG_CONFIG $PKG_CONFIG_STATIC --libs tre` + if $PKG_CONFIG $pkg_config_static tre; then + TRE_CFLAGS=`$PKG_CONFIG $pkg_config_static --cflags tre` + TRE_LIBS=`$PKG_CONFIG $pkg_config_static --libs tre` AC_MSG_RESULT([[yes]]) else # @@ -1047,7 +1047,7 @@ AC_ARG_WITH(gnutls, [[ --with-gnutls enable GNUTLS SSL support]], "yes") chosen_ssl_library="GNUTLS" ;; *) chosen_ssl_library="GNUTLS" AC_MSG_WARN([[Support for --with-gnutls=DIR has been removed. -You may have to set the PKG_CONFIG $PKG_CONFIG_STATIC_PATH environment variable instead.]]) ;; +You may have to set the PKG_CONFIG $pkg_config_static_PATH environment variable instead.]]) ;; esac]) AC_ARG_WITH(openssl, [[ --without-openssl disable OpenSSL support]]) @@ -1081,9 +1081,9 @@ elif test -z "${with_nss_compat_ossl+set}"; then else EL_SAVE_FLAGS if test "$with_nss_compat_ossl" = yes; then - if $PKG_CONFIG $PKG_CONFIG_STATIC nss; then - CFLAGS="$CFLAGS_X `$PKG_CONFIG $PKG_CONFIG_STATIC --cflags nss`" - LIBS="$LIBS_X `$PKG_CONFIG $PKG_CONFIG_STATIC --libs nss`" + if $PKG_CONFIG $pkg_config_static nss; then + CFLAGS="$CFLAGS_X `$PKG_CONFIG $pkg_config_static --cflags nss`" + LIBS="$LIBS_X `$PKG_CONFIG $pkg_config_static --libs nss`" else with_nss_compat_ossl=no fi @@ -1180,9 +1180,9 @@ elif test -n "$chosen_ssl_library" && test "$chosen_ssl_library" != "GNUTLS"; th else cf_result=no AC_MSG_CHECKING([[for GNUTLS (1.2 or later) in pkg-config]]) - if $PKG_CONFIG $PKG_CONFIG_STATIC --atleast-version=1.2 gnutls; then - GNUTLS_CFLAGS=`$PKG_CONFIG $PKG_CONFIG_STATIC --cflags gnutls` - GNUTLS_LIBS=`$PKG_CONFIG $PKG_CONFIG_STATIC --libs gnutls` + if $PKG_CONFIG $pkg_config_static --atleast-version=1.2 gnutls; then + GNUTLS_CFLAGS=`$PKG_CONFIG $pkg_config_static --cflags gnutls` + GNUTLS_LIBS=`$PKG_CONFIG $pkg_config_static --libs gnutls` AC_MSG_RESULT([[yes: $GNUTLS_CFLAGS $GNUTLS_LIBS]]) EL_SAVE_FLAGS @@ -1645,9 +1645,9 @@ if test "$enable_libdom" = no; then AC_MSG_RESULT([[disabled]]) else AC_MSG_CHECKING([[for libdom in pkg-config]]) - if $PKG_CONFIG $PKG_CONFIG_STATIC libdom; then - LIBDOM_CFLAGS=`$PKG_CONFIG $PKG_CONFIG_STATIC --cflags libdom` - LIBDOM_LIBS=`$PKG_CONFIG $PKG_CONFIG_STATIC --libs libdom` + if $PKG_CONFIG $pkg_config_static libdom; then + LIBDOM_CFLAGS=`$PKG_CONFIG $pkg_config_static --cflags libdom` + LIBDOM_LIBS=`$PKG_CONFIG $pkg_config_static --libs libdom` LIBS="$LIBDOM_LIBS $LIBS" CONFIG_LIBDOM=yes AC_DEFINE([CONFIG_LIBDOM], [1], [Define as 1 to use the libdom library.]) From d4ccb07cf63feff92ea8a4b156551b8364b1a933 Mon Sep 17 00:00:00 2001 From: Witold Filipczyk Date: Fri, 27 Nov 2020 17:21:11 +0100 Subject: [PATCH 090/179] [spidermonkey] Delete ac2 (AutoCompartment) --- src/ecmascript/spidermonkey.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/ecmascript/spidermonkey.c b/src/ecmascript/spidermonkey.c index 3503a0c1..1b58186a 100644 --- a/src/ecmascript/spidermonkey.c +++ b/src/ecmascript/spidermonkey.c @@ -333,8 +333,8 @@ spidermonkey_put_interpreter(struct ecmascript_interpreter *interpreter) if (!js_module_init_ok) return; ctx = interpreter->backend_data; - if (interpreter->ac) { - //delete (JSAutoCompartment *)interpreter->ac; + if (interpreter->ac2) { + delete (JSAutoCompartment *)interpreter->ac2; } if (interpreter->ar) { delete (JSAutoRequest *)interpreter->ar; @@ -342,6 +342,7 @@ spidermonkey_put_interpreter(struct ecmascript_interpreter *interpreter) // JS_DestroyContext(ctx); interpreter->backend_data = NULL; interpreter->ac = nullptr; + interpreter->ac2 = nullptr; interpreter->ar = nullptr; } From 3db1abc5b7f09afcf41b27684af7a8d0d58eb7b3 Mon Sep 17 00:00:00 2001 From: Witold Filipczyk Date: Tue, 1 Dec 2020 21:36:39 +0100 Subject: [PATCH 091/179] [rename] felinks -> elinks --- README | 5 ++++- SITES | 2 +- meson.build | 2 +- src/setup.h | 4 ++-- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/README b/README index 1e22c9fe..8e240deb 100644 --- a/README +++ b/README @@ -66,9 +66,12 @@ Old ELinks team lost interest in ELinks development somehow. felinks is continuation of elinks based on the master branch of the original elinks repo with main releases (new features and other incompatible changes) no more often than 1 yearly, and point releases (bugfixes) no more often than once a month. + +Repository was renamed to elinks on 2020-12-01 with Petr's approval. + Main repo is at - https://github.com/rkd77/felinks.git + https://github.com/rkd77/elinks.git vim: textwidth=80 diff --git a/SITES b/SITES index 553b0930..f3a6cb1c 100644 --- a/SITES +++ b/SITES @@ -11,7 +11,7 @@ RPMs: http://rpmfind.net/linux/rpm2html/search.php?query=elinks GIT root: - git://github.com/rkd77/felinks.git + git://github.com/rkd77/elinks.git Original elinks git repo: http://elinks.cz/elinks.git diff --git a/meson.build b/meson.build index 9f02215d..6afa6b53 100644 --- a/meson.build +++ b/meson.build @@ -1,4 +1,4 @@ -project('felinks', ['c','cpp'], version:'0.14.GIT', license:'GPLv2') +project('elinks', ['c','cpp'], version:'0.14.GIT', license:'GPLv2') srcs=[] srcdir = meson.source_root() diff --git a/src/setup.h b/src/setup.h index 37bf7cdc..f93c60b9 100644 --- a/src/setup.h +++ b/src/setup.h @@ -17,8 +17,8 @@ #define ELINKS_WEBSITE_URL "http://elinks.cz/" #define ELINKS_AUTHORS_URL "http://elinks.cz/authors.html" #define ELINKS_DOC_URL "http://elinks.cz/documentation/" -#define ELINKS_BUGS_URL "https://github.com/rkd77/felinks/issues" -#define ELINKS_GITWEB_URL "https://github.com/rkd77/felinks" +#define ELINKS_BUGS_URL "https://github.com/rkd77/elinks/issues" +#define ELINKS_GITWEB_URL "https://github.com/rkd77/elinks" #define ELINKS_SOCK_NAME "socket" #define ELINKS_PORT 23456 From 35f69b12143406813ab9222f8d8e5f071bdc30f8 Mon Sep 17 00:00:00 2001 From: Witold Filipczyk Date: Sun, 6 Dec 2020 15:05:25 +0100 Subject: [PATCH 092/179] [options] Removed "Default 1". --- src/config/options.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/config/options.inc b/src/config/options.inc index 4d064ede..3b82ecde 100644 --- a/src/config/options.inc +++ b/src/config/options.inc @@ -442,7 +442,7 @@ static union option_info config_options_info[] = { INIT_OPT_BOOL("document.browse.search", N_("Reset searching on new pages"), "reset", 0, 1, N_("Whether to clear search, when visiting new pages, or going back " - "in history. Default 1. If you set it to 0, you can search once and " + "in history. If you set it to 0, you can search once and " "see results on every page.")), INIT_OPT_BOOL("document.browse.search", N_("Show search hit top or bottom dialogs"), From 08731a5403d31a97d39c887a874a8de03f6de82a Mon Sep 17 00:00:00 2001 From: Witold Filipczyk Date: Sun, 6 Dec 2020 15:13:37 +0100 Subject: [PATCH 093/179] [po] Updated po files --- po/af.po | 1239 +++++++++++++++++++++++++------------------------ po/be.po | 1260 +++++++++++++++++++++++++------------------------- po/bg.po | 1260 +++++++++++++++++++++++++------------------------- po/ca.po | 1260 +++++++++++++++++++++++++------------------------- po/cs.po | 1245 +++++++++++++++++++++++++------------------------ po/da.po | 1245 +++++++++++++++++++++++++------------------------ po/de.po | 1245 +++++++++++++++++++++++++------------------------ po/el.po | 1260 +++++++++++++++++++++++++------------------------- po/es.po | 1260 +++++++++++++++++++++++++------------------------- po/et.po | 1260 +++++++++++++++++++++++++------------------------- po/fi.po | 1247 +++++++++++++++++++++++++------------------------ po/fr.po | 1245 +++++++++++++++++++++++++------------------------ po/gl.po | 1260 +++++++++++++++++++++++++------------------------- po/hr.po | 1260 +++++++++++++++++++++++++------------------------- po/hu.po | 1245 +++++++++++++++++++++++++------------------------ po/id.po | 1260 +++++++++++++++++++++++++------------------------- po/is.po | 1260 +++++++++++++++++++++++++------------------------- po/it.po | 1251 +++++++++++++++++++++++++------------------------ po/ja.po | 1239 +++++++++++++++++++++++++------------------------ po/lt.po | 1260 +++++++++++++++++++++++++------------------------- po/nb.po | 1260 +++++++++++++++++++++++++------------------------- po/nl.po | 1260 +++++++++++++++++++++++++------------------------- po/pl.po | 1255 ++++++++++++++++++++++++------------------------- po/pt.po | 1260 +++++++++++++++++++++++++------------------------- po/pt_BR.po | 1260 +++++++++++++++++++++++++------------------------- po/ro.po | 1260 +++++++++++++++++++++++++------------------------- po/ru.po | 1260 +++++++++++++++++++++++++------------------------- po/sk.po | 1251 +++++++++++++++++++++++++------------------------ po/sr.po | 1245 +++++++++++++++++++++++++------------------------ po/sv.po | 1260 +++++++++++++++++++++++++------------------------- po/tr.po | 1260 +++++++++++++++++++++++++------------------------- po/uk.po | 1285 ++++++++++++++++++++++++++------------------------- 32 files changed, 20455 insertions(+), 19722 deletions(-) diff --git a/po/af.po b/po/af.po index 751d9adc..59c75567 100644 --- a/po/af.po +++ b/po/af.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: 0.12\n" "Report-Msgid-Bugs-To: elinks-users@linuxfromscratch.org\n" -"POT-Creation-Date: 2020-07-31 14:44+0200\n" +"POT-Creation-Date: 2020-12-06 15:06+0100\n" "PO-Revision-Date: 2006-09-25 17:13+0200\n" "Last-Translator: Friedel Wolff \n" "Language-Team: \n" @@ -26,7 +26,7 @@ msgstr "Sluit" #. #: src/bfu/hierbox.c:429 src/bfu/hierbox.c:438 src/dialogs/document.c:42 #: src/dialogs/document.c:134 src/dialogs/document.c:268 -#: src/scripting/python/dialogs.c:44 +#: src/scripting/python/dialogs.c:45 msgid "Info" msgstr "Info" @@ -37,12 +37,12 @@ msgstr "Druk spasie om hierdie gids te laat oopvou." #. accelerator_context(do_auth_dialog, do_edit_dialog, generic_external_protocol_handler, info_box, input_dialog, menu_add_ext, menu_keys, push_hierbox_info_button, python_info_box, refreshed_msg_box, resize_terminal_dialog, setup_first_session, src/config/dialogs.c:build_edit_dialog, src/cookies/dialogs.c:build_edit_dialog, src/cookies/dialogs.c:push_add_server_button, src/scripting/lua/core.c:l_edit_bookmark_dialog, src/scripting/lua/core.c:l_xdialog, src/viewer/text/search.c:search_dlg_do, terminal_options, write_config_dialog) #: src/bfu/hierbox.c:441 src/bfu/inpfield.c:257 src/bfu/msgbox.c:173 #: src/bfu/msgbox.c:194 src/config/dialogs.c:57 src/config/dialogs.c:365 -#: src/cookies/dialogs.c:420 src/cookies/dialogs.c:518 src/dialogs/edit.c:98 +#: src/cookies/dialogs.c:423 src/cookies/dialogs.c:521 src/dialogs/edit.c:98 #: src/dialogs/info.c:135 src/dialogs/options.c:241 src/dialogs/options.c:322 #: src/mime/dialogs.c:132 src/protocol/auth/dialogs.c:159 -#: src/protocol/protocol.c:248 src/scripting/lua/core.c:401 -#: src/scripting/lua/core.c:482 src/scripting/python/dialogs.c:87 -#: src/session/session.c:869 src/viewer/text/search.c:1936 +#: src/protocol/protocol.c:248 src/scripting/lua/core.c:421 +#: src/scripting/lua/core.c:502 src/scripting/python/dialogs.c:88 +#: src/session/session.c:869 src/viewer/text/search.c:1952 msgid "~OK" msgstr "Regs~o" @@ -138,25 +138,25 @@ msgstr "~Ja" msgid "~No" msgstr "~Nee" -#: src/bfu/hierbox.c:946 src/bfu/hierbox.c:977 src/viewer/text/search.c:1254 -#: src/viewer/text/search.c:1262 src/viewer/text/search.c:1278 -#: src/viewer/text/search.c:1955 +#: src/bfu/hierbox.c:946 src/bfu/hierbox.c:977 src/viewer/text/search.c:1255 +#: src/viewer/text/search.c:1263 src/viewer/text/search.c:1279 +#: src/viewer/text/search.c:1971 msgid "Search" msgstr "Soek" -#: src/bfu/hierbox.c:948 src/viewer/text/search.c:1255 +#: src/bfu/hierbox.c:948 src/viewer/text/search.c:1256 #, c-format msgid "Search string '%s' not found" msgstr "Soekstring '%s' nie gevind nie" #: src/bfu/hierbox.c:977 src/config/dialogs.c:140 src/config/dialogs.c:329 -#: src/config/dialogs.c:477 src/cookies/dialogs.c:38 src/cookies/dialogs.c:413 -#: src/dialogs/edit.c:92 src/dialogs/edit.c:94 src/scripting/lua/core.c:397 -#: src/scripting/lua/core.c:398 src/scripting/lua/core.c:479 +#: src/config/dialogs.c:477 src/cookies/dialogs.c:41 src/cookies/dialogs.c:416 +#: src/dialogs/edit.c:92 src/dialogs/edit.c:94 src/scripting/lua/core.c:417 +#: src/scripting/lua/core.c:418 src/scripting/lua/core.c:499 msgid "Name" msgstr "Naam" -#: src/bfu/inpfield.c:72 src/bfu/inpfield.c:79 src/scripting/python/menu.c:107 +#: src/bfu/inpfield.c:72 src/bfu/inpfield.c:79 src/scripting/python/menu.c:108 msgid "Bad number" msgstr "Slegte getal" @@ -178,13 +178,13 @@ msgid "Empty string not allowed" msgstr "Leë string word nie toegelaat nie" #. accelerator_context(do_auth_dialog, do_edit_dialog, input_dialog, menu_add_ext, resize_terminal_dialog, src/config/dialogs.c:build_edit_dialog, src/cookies/dialogs.c:build_edit_dialog, src/cookies/dialogs.c:push_add_server_button, src/protocol/bittorrent/dialogs.c:bittorrent_query_callback, src/scripting/lua/core.c:l_edit_bookmark_dialog, src/scripting/lua/core.c:l_xdialog, src/session/download.c:do_type_query, src/session/download.c:lookup_unique_name, src/viewer/text/search.c:search_dlg_do, terminal_options) -#: src/bfu/inpfield.c:257 src/config/dialogs.c:366 src/cookies/dialogs.c:421 -#: src/cookies/dialogs.c:519 src/dialogs/edit.c:102 src/dialogs/edit.c:105 +#: src/bfu/inpfield.c:257 src/config/dialogs.c:366 src/cookies/dialogs.c:424 +#: src/cookies/dialogs.c:522 src/dialogs/edit.c:102 src/dialogs/edit.c:105 #: src/dialogs/options.c:244 src/dialogs/options.c:323 src/mime/dialogs.c:133 -#: src/protocol/auth/dialogs.c:160 src/protocol/bittorrent/dialogs.c:820 -#: src/scripting/lua/core.c:402 src/scripting/lua/core.c:483 -#: src/session/download.c:840 src/session/download.c:1684 -#: src/viewer/text/search.c:1937 +#: src/protocol/auth/dialogs.c:160 src/protocol/bittorrent/dialogs.c:821 +#: src/scripting/lua/core.c:422 src/scripting/lua/core.c:503 +#: src/session/download.c:840 src/session/download.c:1700 +#: src/viewer/text/search.c:1953 msgid "~Cancel" msgstr "~Kanseleer" @@ -196,8 +196,8 @@ msgstr "Horlosie" msgid "Digital clock in the status bar." msgstr "Digitale horlose in die statusbalk." -#: src/bfu/leds.c:80 src/bfu/leds.c:102 src/config/options.inc:1336 -#: src/config/options.inc:1343 src/ecmascript/ecmascript.c:44 +#: src/bfu/leds.c:80 src/bfu/leds.c:102 src/config/options.inc:1345 +#: src/config/options.inc:1352 src/ecmascript/ecmascript.c:45 #: src/globhist/globhist.c:64 src/mime/backend/mailcap.c:93 #: src/mime/backend/mimetypes.c:52 src/network/ssl/ssl.c:129 #: src/network/ssl/ssl.c:282 @@ -359,7 +359,7 @@ msgid "" "This feature requires bookmark support." msgstr "" -#: src/bookmarks/dialogs.c:97 src/config/options.inc:1179 +#: src/bookmarks/dialogs.c:97 src/config/options.inc:1185 #: src/dialogs/document.c:165 src/globhist/dialogs.c:68 msgid "Title" msgstr "Titel" @@ -367,7 +367,7 @@ msgstr "Titel" #: src/bookmarks/dialogs.c:101 src/cache/dialogs.c:65 #: src/dialogs/document.c:156 src/dialogs/edit.c:96 src/formhist/dialogs.c:63 #: src/globhist/dialogs.c:69 src/protocol/auth/dialogs.c:207 -#: src/scripting/lua/core.c:399 +#: src/scripting/lua/core.c:419 msgid "URL" msgstr "URL" @@ -427,7 +427,7 @@ msgstr "Voeg gids by" msgid "Folder name" msgstr "Gidsnaam" -#: src/bookmarks/dialogs.c:410 src/scripting/lua/core.c:393 +#: src/bookmarks/dialogs.c:410 src/scripting/lua/core.c:413 msgid "Edit bookmark" msgstr "Wysig boekmerk" @@ -462,13 +462,13 @@ msgstr "~Gaan na" #. accelerator_context(src/bookmarks/dialogs.c:bookmark_buttons, src/config/dialogs.c:option_buttons, src/cookies/dialogs.c:cookie_buttons) #: src/bookmarks/dialogs.c:594 src/config/dialogs.c:501 -#: src/cookies/dialogs.c:540 +#: src/cookies/dialogs.c:543 msgid "~Edit" msgstr "~Redigeer" #. accelerator_context(src/bookmarks/dialogs.c:bookmark_buttons, src/cache/dialogs.c:cache_buttons, src/config/dialogs.c:keybinding_buttons, src/config/dialogs.c:option_buttons, src/cookies/dialogs.c:cookie_buttons, src/dialogs/menu.c:ext_menu, src/formhist/dialogs.c:formhist_buttons, src/globhist/dialogs.c:globhist_buttons, src/protocol/auth/dialogs.c:auth_buttons) #: src/bookmarks/dialogs.c:595 src/cache/dialogs.c:318 src/config/dialogs.c:503 -#: src/config/dialogs.c:930 src/cookies/dialogs.c:541 src/dialogs/menu.c:463 +#: src/config/dialogs.c:930 src/cookies/dialogs.c:544 src/dialogs/menu.c:463 #: src/formhist/dialogs.c:211 src/globhist/dialogs.c:233 #: src/protocol/auth/dialogs.c:307 msgid "~Delete" @@ -476,7 +476,7 @@ msgstr "~Skrap" #. accelerator_context(src/bookmarks/dialogs.c:bookmark_buttons, src/config/dialogs.c:keybinding_buttons, src/config/dialogs.c:option_buttons, src/cookies/dialogs.c:cookie_buttons, src/dialogs/menu.c:ext_menu) #: src/bookmarks/dialogs.c:596 src/config/dialogs.c:502 -#: src/config/dialogs.c:929 src/cookies/dialogs.c:538 src/dialogs/menu.c:461 +#: src/config/dialogs.c:929 src/cookies/dialogs.c:541 src/dialogs/menu.c:461 msgid "~Add" msgstr "~Voeg by" @@ -558,8 +558,8 @@ msgstr "Instaan-URL" msgid "Redirect" msgstr "Aanstuur" -#: src/cache/dialogs.c:85 src/config/options.inc:590 src/dialogs/document.c:176 -#: src/protocol/bittorrent/dialogs.c:126 +#: src/cache/dialogs.c:85 src/config/options.inc:596 src/dialogs/document.c:176 +#: src/protocol/bittorrent/dialogs.c:127 msgid "Size" msgstr "Grootte" @@ -595,8 +595,8 @@ msgstr "onvolledig" msgid "invalid" msgstr "ongeldig" -#: src/cache/dialogs.c:125 src/cookies/dialogs.c:44 src/cookies/dialogs.c:48 -#: src/cookies/dialogs.c:416 +#: src/cache/dialogs.c:125 src/cookies/dialogs.c:47 src/cookies/dialogs.c:51 +#: src/cookies/dialogs.c:419 msgid "Expires" msgstr "Verval" @@ -619,7 +619,7 @@ msgstr "Skrap kasitem" msgid "ID" msgstr "ID" -#: src/cache/dialogs.c:152 src/config/options.inc:753 +#: src/cache/dialogs.c:152 src/config/options.inc:759 msgid "Header" msgstr "Kop" @@ -664,8 +664,8 @@ msgid "Cache entry invalidated." msgstr "" #. accelerator_context(display_download, src/cache/dialogs.c:cache_buttons, src/config/dialogs.c:option_buttons, src/cookies/dialogs.c:cookie_buttons, src/dialogs/download.c:download_buttons, src/formhist/dialogs.c:formhist_buttons, src/globhist/dialogs.c:globhist_buttons, src/protocol/auth/dialogs.c:auth_buttons) -#: src/cache/dialogs.c:316 src/config/dialogs.c:500 src/cookies/dialogs.c:537 -#: src/dialogs/download.c:264 src/dialogs/download.c:501 +#: src/cache/dialogs.c:316 src/config/dialogs.c:500 src/cookies/dialogs.c:540 +#: src/dialogs/download.c:267 src/dialogs/download.c:504 #: src/formhist/dialogs.c:210 src/globhist/dialogs.c:229 #: src/protocol/auth/dialogs.c:306 msgid "~Info" @@ -793,7 +793,7 @@ msgstr "" msgid "Move to the previous item" msgstr "" -#: src/config/actions-edit.inc:31 src/config/actions-main.inc:89 +#: src/config/actions-edit.inc:31 src/config/actions-main.inc:90 #: src/config/actions-menu.inc:21 msgid "Redraw the terminal" msgstr "" @@ -988,304 +988,308 @@ msgid "Open a Lua console" msgstr "" #: src/config/actions-main.inc:54 -msgid "Go at a specified mark" +msgid "Mark a corner of the clipboard rectangle" msgstr "" #: src/config/actions-main.inc:55 -msgid "Set a mark" +msgid "Go at a specified mark" msgstr "" #: src/config/actions-main.inc:56 -msgid "Activate the menu" +msgid "Set a mark" msgstr "" #: src/config/actions-main.inc:57 -msgid "Move downwards to put the current line at the top" +msgid "Activate the menu" msgstr "" #: src/config/actions-main.inc:58 -msgid "Move cursor down" +msgid "Move downwards to put the current line at the top" msgstr "" #: src/config/actions-main.inc:59 -msgid "Move cursor left" +msgid "Move cursor down" msgstr "" #: src/config/actions-main.inc:60 -msgid "Move cursor to the start of the line" +msgid "Move cursor left" msgstr "" #: src/config/actions-main.inc:61 -msgid "Move cursor right" +msgid "Move cursor to the start of the line" msgstr "" #: src/config/actions-main.inc:62 -msgid "Move cursor up" +msgid "Move cursor right" msgstr "" #: src/config/actions-main.inc:63 -msgid "Move to the end of the document" +msgid "Move cursor up" msgstr "" #: src/config/actions-main.inc:64 -msgid "Move to the start of the document" +msgid "Move to the end of the document" msgstr "" #: src/config/actions-main.inc:65 -msgid "Move downwards by half a page" +msgid "Move to the start of the document" msgstr "" #: src/config/actions-main.inc:66 -msgid "Move upwards by half a page" +msgid "Move downwards by half a page" msgstr "" #: src/config/actions-main.inc:67 -msgid "Move one link down" +msgid "Move upwards by half a page" msgstr "" #: src/config/actions-main.inc:68 -msgid "Move to the next line with a link" +msgid "Move one link down" msgstr "" #: src/config/actions-main.inc:69 -msgid "Move one link left" +msgid "Move to the next line with a link" msgstr "" #: src/config/actions-main.inc:70 -msgid "Move one link left or to the previous link" +msgid "Move one link left" msgstr "" #: src/config/actions-main.inc:71 -msgid "Move to the next link" +msgid "Move one link left or to the previous link" msgstr "" #: src/config/actions-main.inc:72 -msgid "Move to the previous link" +msgid "Move to the next link" msgstr "" #: src/config/actions-main.inc:73 -msgid "Move one link right" +msgid "Move to the previous link" msgstr "" #: src/config/actions-main.inc:74 -msgid "Move one link right or to the next link" +msgid "Move one link right" msgstr "" #: src/config/actions-main.inc:75 -msgid "Move one link up" +msgid "Move one link right or to the next link" msgstr "" #: src/config/actions-main.inc:76 +msgid "Move one link up" +msgstr "" + +#: src/config/actions-main.inc:77 msgid "Move to the previous line with a link" msgstr "" -#: src/config/actions-main.inc:77 src/config/actions-menu.inc:18 +#: src/config/actions-main.inc:78 src/config/actions-menu.inc:18 msgid "Move downwards by a page" msgstr "" -#: src/config/actions-main.inc:78 src/config/actions-menu.inc:19 +#: src/config/actions-main.inc:79 src/config/actions-menu.inc:19 msgid "Move upwards by a page" msgstr "" -#: src/config/actions-main.inc:79 +#: src/config/actions-main.inc:80 msgid "Open the current link in a new tab" msgstr "Open die huidige skakel in 'n nuwe oortjie" -#: src/config/actions-main.inc:80 +#: src/config/actions-main.inc:81 msgid "Open the current link in a new tab in the background" msgstr "Open die huidige skakel in 'n nuwe agtergrondoortjie" -#: src/config/actions-main.inc:81 +#: src/config/actions-main.inc:82 msgid "Open the current link in a new window" msgstr "Open die huidige skakel in 'n nuwe venster" -#: src/config/actions-main.inc:82 +#: src/config/actions-main.inc:83 msgid "Open a new tab" msgstr "Open 'n nuwe oortjie" -#: src/config/actions-main.inc:83 +#: src/config/actions-main.inc:84 msgid "Open a new tab in the background" msgstr "Open 'n nuwe agtergrondoortjie" -#: src/config/actions-main.inc:84 +#: src/config/actions-main.inc:85 msgid "Open a new window" msgstr "Open 'n nuwe venster" -#: src/config/actions-main.inc:85 +#: src/config/actions-main.inc:86 msgid "Open an OS shell" msgstr "" -#: src/config/actions-main.inc:86 +#: src/config/actions-main.inc:87 msgid "Open options manager" msgstr "" -#: src/config/actions-main.inc:87 +#: src/config/actions-main.inc:88 msgid "Open a quit confirmation dialog box" msgstr "" -#: src/config/actions-main.inc:88 +#: src/config/actions-main.inc:89 msgid "Quit without confirmation" msgstr "" -#: src/config/actions-main.inc:90 +#: src/config/actions-main.inc:91 msgid "Reload the current page" msgstr "" -#: src/config/actions-main.inc:91 +#: src/config/actions-main.inc:92 msgid "Re-render the current page" msgstr "" -#: src/config/actions-main.inc:92 +#: src/config/actions-main.inc:93 msgid "Reset form items to their initial values" msgstr "" -#: src/config/actions-main.inc:93 +#: src/config/actions-main.inc:94 msgid "Show information about the currently used resources" msgstr "" -#: src/config/actions-main.inc:94 +#: src/config/actions-main.inc:95 msgid "Save the current document in source form" msgstr "" -#: src/config/actions-main.inc:95 +#: src/config/actions-main.inc:96 msgid "Save the current document in formatted form" msgstr "" -#: src/config/actions-main.inc:96 +#: src/config/actions-main.inc:97 msgid "Save options" msgstr "Stoor keuses" -#: src/config/actions-main.inc:97 +#: src/config/actions-main.inc:98 msgid "Save URL as" msgstr "Stoor URL as" -#: src/config/actions-main.inc:98 +#: src/config/actions-main.inc:99 msgid "Scroll down" msgstr "" -#: src/config/actions-main.inc:99 +#: src/config/actions-main.inc:100 msgid "Scroll left" msgstr "" -#: src/config/actions-main.inc:100 +#: src/config/actions-main.inc:101 msgid "Scroll right" msgstr "" -#: src/config/actions-main.inc:101 +#: src/config/actions-main.inc:102 msgid "Scroll up" msgstr "" -#: src/config/actions-main.inc:102 src/config/actions-menu.inc:23 +#: src/config/actions-main.inc:103 src/config/actions-menu.inc:23 msgid "Search for a text pattern" msgstr "" -#: src/config/actions-main.inc:103 +#: src/config/actions-main.inc:104 msgid "Search backwards for a text pattern" msgstr "" -#: src/config/actions-main.inc:104 src/config/actions-main.inc:105 +#: src/config/actions-main.inc:105 src/config/actions-main.inc:106 msgid "Search link text by typing ahead" msgstr "" -#: src/config/actions-main.inc:106 +#: src/config/actions-main.inc:107 msgid "Search document text by typing ahead" msgstr "" -#: src/config/actions-main.inc:107 +#: src/config/actions-main.inc:108 msgid "Search document text backwards by typing ahead" msgstr "" -#: src/config/actions-main.inc:108 +#: src/config/actions-main.inc:109 msgid "Show terminal options dialog" msgstr "" -#: src/config/actions-main.inc:109 +#: src/config/actions-main.inc:110 msgid "Submit form" msgstr "" -#: src/config/actions-main.inc:110 +#: src/config/actions-main.inc:111 msgid "Submit form and reload" msgstr "" -#: src/config/actions-main.inc:111 src/terminal/tab.c:216 +#: src/config/actions-main.inc:112 src/terminal/tab.c:216 #: src/terminal/tab.c:260 msgid "Close tab" msgstr "Sluit oortjie" -#: src/config/actions-main.inc:112 +#: src/config/actions-main.inc:113 msgid "Close all tabs but the current one" msgstr "Sluit alle oortjies behalwe die huidige een" -#: src/config/actions-main.inc:113 +#: src/config/actions-main.inc:114 msgid "Pass URI of current tab to external command" msgstr "" -#: src/config/actions-main.inc:114 +#: src/config/actions-main.inc:115 msgid "Open the tab menu" msgstr "" -#: src/config/actions-main.inc:115 +#: src/config/actions-main.inc:116 msgid "Move the current tab to the left" msgstr "" -#: src/config/actions-main.inc:116 +#: src/config/actions-main.inc:117 msgid "Move the current tab to the right" msgstr "" -#: src/config/actions-main.inc:117 +#: src/config/actions-main.inc:118 msgid "Next tab" msgstr "Volgende oortjie" -#: src/config/actions-main.inc:118 +#: src/config/actions-main.inc:119 msgid "Previous tab" msgstr "Vorige oortjie" -#: src/config/actions-main.inc:119 +#: src/config/actions-main.inc:120 msgid "Open the terminal resize dialog" msgstr "" -#: src/config/actions-main.inc:120 +#: src/config/actions-main.inc:121 msgid "Toggle rendering of page using CSS" msgstr "" -#: src/config/actions-main.inc:121 +#: src/config/actions-main.inc:122 msgid "Toggle displaying of links to images" msgstr "Wissel die vertoon van skakels na prente" -#: src/config/actions-main.inc:122 +#: src/config/actions-main.inc:123 msgid "Toggle rendering of tables" msgstr "" -#: src/config/actions-main.inc:123 +#: src/config/actions-main.inc:124 msgid "Toggle usage of document specific colors" msgstr "" -#: src/config/actions-main.inc:124 +#: src/config/actions-main.inc:125 #, fuzzy msgid "Toggle use of document width" msgstr "Wissel ~dokumentkleure" -#: src/config/actions-main.inc:125 +#: src/config/actions-main.inc:126 msgid "Toggle rendering page as HTML / plain text" msgstr "" -#: src/config/actions-main.inc:126 +#: src/config/actions-main.inc:127 msgid "Toggle mouse handling" msgstr "" -#: src/config/actions-main.inc:127 +#: src/config/actions-main.inc:128 msgid "Toggle displaying of links numbers" msgstr "Wissel die vertoon van skakelnommers" -#: src/config/actions-main.inc:128 +#: src/config/actions-main.inc:129 msgid "Toggle plain renderer compression of empty lines" msgstr "" -#: src/config/actions-main.inc:129 +#: src/config/actions-main.inc:130 msgid "Toggle wrapping of text" msgstr "" -#: src/config/actions-main.inc:130 +#: src/config/actions-main.inc:131 msgid "View the current image" msgstr "" @@ -1837,12 +1841,12 @@ msgstr "(druk spasie om oop te vou)" #. * characters as above but encodes them in UTF-8 and does not #. * switch charsets. So, it will work in any terminal that #. * understands UTF-8 and has the characters in its font. -#: src/config/dialogs.c:149 src/config/dialogs.c:330 src/config/options.inc:934 +#: src/config/dialogs.c:149 src/config/dialogs.c:330 src/config/options.inc:940 msgid "Type" msgstr "Soort" -#: src/config/dialogs.c:174 src/config/dialogs.c:361 src/cookies/dialogs.c:39 -#: src/cookies/dialogs.c:414 +#: src/config/dialogs.c:174 src/config/dialogs.c:361 src/cookies/dialogs.c:42 +#: src/cookies/dialogs.c:417 msgid "Value" msgstr "Waarde" @@ -1864,9 +1868,9 @@ msgstr "" msgid "Description" msgstr "Beskrywing" -#: src/config/dialogs.c:291 src/protocol/bittorrent/dialogs.c:600 +#: src/config/dialogs.c:291 src/protocol/bittorrent/dialogs.c:601 #: src/protocol/protocol.c:242 src/session/session.c:319 -#: src/session/session.c:332 src/session/session.c:1051 +#: src/session/session.c:332 src/session/session.c:1055 #: src/viewer/text/textarea.c:629 msgid "Error" msgstr "Fout" @@ -1875,7 +1879,7 @@ msgstr "Fout" msgid "Bad option value." msgstr "" -#: src/config/dialogs.c:320 src/config/dialogs.c:390 src/cookies/dialogs.c:372 +#: src/config/dialogs.c:320 src/config/dialogs.c:390 src/cookies/dialogs.c:375 msgid "Edit" msgstr "Redigeer" @@ -1902,9 +1906,9 @@ msgid "Cannot add an option here." msgstr "Kan nie 'n keuse hier byvoeg nie." #. accelerator_context(src/config/dialogs.c:keybinding_buttons, src/config/dialogs.c:option_buttons, src/cookies/dialogs.c:cookie_buttons, src/formhist/dialogs.c:formhist_buttons, src/protocol/bittorrent/dialogs.c:bittorrent_query_callback, src/session/download.c:do_type_query, terminal_options) -#: src/config/dialogs.c:505 src/config/dialogs.c:933 src/cookies/dialogs.c:543 +#: src/config/dialogs.c:505 src/config/dialogs.c:933 src/cookies/dialogs.c:546 #: src/dialogs/options.c:243 src/formhist/dialogs.c:214 -#: src/protocol/bittorrent/dialogs.c:807 src/session/download.c:1668 +#: src/protocol/bittorrent/dialogs.c:808 src/session/download.c:1684 msgid "Sa~ve" msgstr "Stoo~r" @@ -1916,7 +1920,7 @@ msgstr "Keusebestuurder" msgid "Keystroke" msgstr "Sleutel" -#: src/config/dialogs.c:676 src/config/options.inc:1356 +#: src/config/dialogs.c:676 src/config/options.inc:1365 msgid "Action" msgstr "Aksie" @@ -2001,7 +2005,7 @@ msgstr "" msgid "Menu mapping" msgstr "" -#: src/config/kbdbind.c:593 src/scripting/python/keybinding.c:105 +#: src/config/kbdbind.c:593 src/scripting/python/keybinding.c:106 msgid "Unrecognised keymap" msgstr "" @@ -2441,13 +2445,13 @@ msgstr "Kleure" msgid "Active link colors." msgstr "Kleure vir aktiewe skakels." -#: src/config/options.inc:289 src/config/options.inc:620 -#: src/config/options.inc:1073 +#: src/config/options.inc:289 src/config/options.inc:626 +#: src/config/options.inc:1079 msgid "Background color" msgstr "Agtergronkleur" -#: src/config/options.inc:291 src/config/options.inc:622 -#: src/config/options.inc:1074 +#: src/config/options.inc:291 src/config/options.inc:628 +#: src/config/options.inc:1080 msgid "Default background color." msgstr "Verstekagtergrondkleur." @@ -2459,13 +2463,13 @@ msgstr "Verstekagtergrondkleur." #. * on it. #. The colors and mono tree should be similar but with different default #. * values of course so always use the macros below. -#: src/config/options.inc:293 src/config/options.inc:616 -#: src/config/options.inc:1071 +#: src/config/options.inc:293 src/config/options.inc:622 +#: src/config/options.inc:1077 msgid "Text color" msgstr "Tekskleur" -#: src/config/options.inc:295 src/config/options.inc:618 -#: src/config/options.inc:1072 +#: src/config/options.inc:295 src/config/options.inc:624 +#: src/config/options.inc:1078 msgid "Default text color." msgstr "Verstektekskleur." @@ -2521,7 +2525,7 @@ msgstr "" msgid "Invert the fore- and background color so the link stands out." msgstr "" -#: src/config/options.inc:323 src/config/options.inc:1034 +#: src/config/options.inc:323 src/config/options.inc:1040 #: src/dialogs/options.c:235 msgid "Underline" msgstr "Onderstreep" @@ -2724,28 +2728,38 @@ msgid "" msgstr "" #: src/config/options.inc:442 -msgid "Show search hit top or bottom dialogs" +msgid "Reset searching on new pages" msgstr "" #: src/config/options.inc:444 msgid "" +"Whether to clear search, when visiting new pages, or going back in history. " +"If you set it to 0, you can search once and see results on every page." +msgstr "" + +#: src/config/options.inc:448 +msgid "Show search hit top or bottom dialogs" +msgstr "" + +#: src/config/options.inc:450 +msgid "" "Whether to show a dialog when the search hits the top or bottom of the " "document." msgstr "" -#: src/config/options.inc:447 +#: src/config/options.inc:453 msgid "Wraparound" msgstr "" -#: src/config/options.inc:449 +#: src/config/options.inc:455 msgid "Wrap around when searching. Currently only used for typeahead." msgstr "" -#: src/config/options.inc:452 +#: src/config/options.inc:458 msgid "Show not found" msgstr "" -#: src/config/options.inc:454 +#: src/config/options.inc:460 msgid "" "How to inform the user when nothing is matched:\n" "0 means do nothing\n" @@ -2753,11 +2767,11 @@ msgid "" "2 means pop up message box" msgstr "" -#: src/config/options.inc:459 +#: src/config/options.inc:465 msgid "Typeahead searching" msgstr "" -#: src/config/options.inc:461 +#: src/config/options.inc:467 msgid "" "Start typeahead searching when an unbound key is pressed without any " "modifiers. Note that most keys have default bindings, so this feature will " @@ -2771,39 +2785,39 @@ msgid "" " text" msgstr "" -#: src/config/options.inc:474 +#: src/config/options.inc:480 msgid "Horizontal text margin" msgstr "" -#: src/config/options.inc:476 +#: src/config/options.inc:482 msgid "Horizontal text margin." msgstr "" -#: src/config/options.inc:478 +#: src/config/options.inc:484 #, fuzzy msgid "Preferred document width" msgstr "~Teken dokument oor" -#: src/config/options.inc:480 +#: src/config/options.inc:486 msgid "" "Try to fit the document within this width. If set to zero,use screen width." msgstr "" -#: src/config/options.inc:483 +#: src/config/options.inc:489 msgid "Whether to use preferred document width" msgstr "" -#: src/config/options.inc:485 +#: src/config/options.inc:491 msgid "" "Whether to use preferred document width. If set to zero,\n" "use screen width. If set to one, use preferred_document_width." msgstr "" -#: src/config/options.inc:488 +#: src/config/options.inc:494 msgid "Document meta refresh" msgstr "" -#: src/config/options.inc:490 +#: src/config/options.inc:496 msgid "" "Automatically follow document-specified refresh directives (' refresh' " "tags). Web-page authors use these to instruct the browser to reload a " @@ -2814,48 +2828,48 @@ msgid "" "of seconds a refresh will wait." msgstr "" -#: src/config/options.inc:499 +#: src/config/options.inc:505 msgid "Document meta refresh minimum time" msgstr "" -#: src/config/options.inc:501 +#: src/config/options.inc:507 msgid "" "The minimum number of milliseconds that should pass before refreshing. If " "set to zero the document refresh time is used unchanged. It can fix going " "back in history for some sites that use refreshing with zero values." msgstr "" -#: src/config/options.inc:506 +#: src/config/options.inc:512 msgid "Show meta refresh link" msgstr "" -#: src/config/options.inc:508 +#: src/config/options.inc:514 #, fuzzy msgid "Whether to show meta refresh link." msgstr "Of gidsinskrywings gesorteer moet word." -#: src/config/options.inc:510 +#: src/config/options.inc:516 msgid "Tables navigation order" msgstr "" -#: src/config/options.inc:512 +#: src/config/options.inc:518 msgid "Move by columns in table, instead of rows." msgstr "" #. Keep options in alphabetical order. -#: src/config/options.inc:518 +#: src/config/options.inc:524 msgid "Cache" msgstr "Kas" -#: src/config/options.inc:520 +#: src/config/options.inc:526 msgid "Cache options." msgstr "" -#: src/config/options.inc:522 +#: src/config/options.inc:528 msgid "Cache information about redirects" msgstr "" -#: src/config/options.inc:524 +#: src/config/options.inc:530 msgid "" "Cache even redirects sent by server (usually thru HTTP by a 302 HTTP code " "and a Location header). This was the original behaviour for quite some time, " @@ -2875,29 +2889,29 @@ msgid "" "will be taken from cache instead of asking the server." msgstr "" -#: src/config/options.inc:545 +#: src/config/options.inc:551 msgid "Ignore cache-control info from server" msgstr "" -#: src/config/options.inc:547 +#: src/config/options.inc:553 msgid "" "Ignore Cache-Control and Pragma server headers. When set, the document is " "cached even with 'Cache-Control: no-cache'." msgstr "" -#: src/config/options.inc:551 +#: src/config/options.inc:557 msgid "Formatted documents" msgstr "" -#: src/config/options.inc:553 +#: src/config/options.inc:559 msgid "Format cache options." msgstr "" -#: src/config/options.inc:555 +#: src/config/options.inc:561 msgid "Number" msgstr "Aantal" -#: src/config/options.inc:557 +#: src/config/options.inc:563 msgid "" "Number of cached formatted pages. Do not get too generous here, 'formatted' " "means that all the accompanying structures are kept in memory so that you " @@ -2915,11 +2929,11 @@ msgid "" msgstr "" #. FIXME: Write more. -#: src/config/options.inc:575 +#: src/config/options.inc:581 msgid "Revalidation interval" msgstr "" -#: src/config/options.inc:577 +#: src/config/options.inc:583 msgid "" "Period in seconds that a cache entry is considered to be up-to-date. When a " "document is loaded and this interval has elapsed since the document was " @@ -2929,89 +2943,89 @@ msgid "" "A value of -1 disables automatic revalidation." msgstr "" -#: src/config/options.inc:586 src/dialogs/info.c:200 +#: src/config/options.inc:592 src/dialogs/info.c:200 msgid "Memory cache" msgstr "Geheuekas" -#: src/config/options.inc:588 +#: src/config/options.inc:594 msgid "Memory cache options." msgstr "Keuses vir geheuekas." -#: src/config/options.inc:592 +#: src/config/options.inc:598 msgid "Memory cache size (in bytes)." msgstr "Kasgrootte (in grepe)." -#: src/config/options.inc:596 +#: src/config/options.inc:602 msgid "Charset" msgstr "Karakterstel" -#: src/config/options.inc:598 +#: src/config/options.inc:604 msgid "Charset options." msgstr "Karakterstelkeuses." -#: src/config/options.inc:600 +#: src/config/options.inc:606 msgid "Default codepage" msgstr "Verstekkarakterstel" -#: src/config/options.inc:602 +#: src/config/options.inc:608 msgid "" "Default document codepage. 'System' stands for a codepage determined by a " "selected locale." msgstr "" -#: src/config/options.inc:605 +#: src/config/options.inc:611 msgid "Ignore charset info from server" msgstr "Ignoreer die karakterstel van die bediener" -#: src/config/options.inc:607 +#: src/config/options.inc:613 msgid "Ignore charset info sent by server." msgstr "Ignoreer die karakterstel wat deur die bediener gestuur word." -#: src/config/options.inc:611 +#: src/config/options.inc:617 msgid "Default color settings" msgstr "Verstekkleurinstellings" -#: src/config/options.inc:613 +#: src/config/options.inc:619 msgid "Default document color settings." msgstr "Verstelinstellings vir dokumentkleure." -#: src/config/options.inc:624 +#: src/config/options.inc:630 msgid "Link color" msgstr "Skakelkleur" -#: src/config/options.inc:626 +#: src/config/options.inc:632 msgid "Default link color." msgstr "Verstekskakelkleur." -#: src/config/options.inc:628 +#: src/config/options.inc:634 msgid "Visited-link color" msgstr "Kleur van besoekte skakels" -#: src/config/options.inc:630 +#: src/config/options.inc:636 msgid "Default visited link color." msgstr "Verstekkleur van besoekte skakels." -#: src/config/options.inc:632 +#: src/config/options.inc:638 msgid "Image-link color" msgstr "Prentskakel-kleur" -#: src/config/options.inc:634 +#: src/config/options.inc:640 msgid "Default image link color." msgstr "Verstekkleur van prentskakels." -#: src/config/options.inc:636 +#: src/config/options.inc:642 msgid "Bookmarked-link color" msgstr "Kleur van geboekmerkte skakels" -#: src/config/options.inc:638 +#: src/config/options.inc:644 msgid "Default bookmarked link color." msgstr "Verstek kleur van geboekmerkte skakels." -#: src/config/options.inc:640 +#: src/config/options.inc:646 msgid "Directory color" msgstr "Gidskleur" -#: src/config/options.inc:642 +#: src/config/options.inc:648 #, fuzzy msgid "" "Default directory color.\n" @@ -3021,32 +3035,32 @@ msgstr "" "Verstek-gidskleur.\n" "Sien die 'document.browse.links.color_dirs'-keuse." -#: src/config/options.inc:646 +#: src/config/options.inc:652 #, fuzzy msgid "Use link number color" msgstr "Tik skakelnommer in" -#: src/config/options.inc:648 +#: src/config/options.inc:654 msgid "" "Whether to use link number color even when colors specified by the document " "are used." msgstr "" -#: src/config/options.inc:651 +#: src/config/options.inc:657 #, fuzzy msgid "Link number color" msgstr "Skakelkleur" -#: src/config/options.inc:653 +#: src/config/options.inc:659 #, fuzzy msgid "Default link number color." msgstr "Verstekskakelkleur." -#: src/config/options.inc:659 +#: src/config/options.inc:665 msgid "Increase contrast" msgstr "Verhoog kontras" -#: src/config/options.inc:661 +#: src/config/options.inc:667 #, fuzzy msgid "" "Increase the contrast between the foreground and background colors to ensure " @@ -3060,22 +3074,22 @@ msgstr "" "hierdie is anders as om die kontras te verseker met die\n" "'ensure_contrast'-keuse." -#: src/config/options.inc:667 +#: src/config/options.inc:673 msgid "Ensure contrast" msgstr "Verseker kontras" -#: src/config/options.inc:669 +#: src/config/options.inc:675 #, fuzzy msgid "Makes sure that the back- and foreground colors are never equal." msgstr "Maak seker dat die voor- en agtergrondkleure nooit die selfde is nie." #. If you change this please also change ACT_MAIN_DOCUMENT_COLORS action #. * handling. -#: src/config/options.inc:674 +#: src/config/options.inc:680 msgid "Use document-specified colors" msgstr "Gebruik kleure gespesifiseer in die dokument" -#: src/config/options.inc:676 +#: src/config/options.inc:682 msgid "" "Use colors specified in document:\n" "0 is use always the default settings\n" @@ -3087,38 +3101,38 @@ msgid "" msgstr "" #. Keep options in alphabetical order. -#: src/config/options.inc:689 +#: src/config/options.inc:695 msgid "Downloading" msgstr "Aflaai" -#: src/config/options.inc:691 +#: src/config/options.inc:697 msgid "Options regarding files downloading and handling." msgstr "Keuses aangaande die aflaai en hantering van lêers." -#: src/config/options.inc:693 +#: src/config/options.inc:699 msgid "Default download directory" msgstr "" -#: src/config/options.inc:695 +#: src/config/options.inc:701 msgid "Default download directory." msgstr "" -#: src/config/options.inc:697 +#: src/config/options.inc:703 msgid "Set original time" msgstr "" -#: src/config/options.inc:699 +#: src/config/options.inc:705 msgid "" "Set the timestamp of each downloaded file to the timestamp stored on the " "server." msgstr "" #. Does automatic resuming make sense as an option? -#: src/config/options.inc:703 +#: src/config/options.inc:709 msgid "Prevent overwriting" msgstr "" -#: src/config/options.inc:705 +#: src/config/options.inc:711 msgid "" "Prevent overwriting the local files:\n" "0 is files will silently be overwritten\n" @@ -3126,11 +3140,11 @@ msgid "" "2 is ask the user" msgstr "" -#: src/config/options.inc:710 +#: src/config/options.inc:716 msgid "Notify download completion by bell" msgstr "" -#: src/config/options.inc:712 +#: src/config/options.inc:718 msgid "" "Audio notification when download is completed:\n" "0 is never\n" @@ -3138,27 +3152,27 @@ msgid "" "2 is always" msgstr "" -#: src/config/options.inc:718 +#: src/config/options.inc:724 msgid "Dump output" msgstr "" -#: src/config/options.inc:720 +#: src/config/options.inc:726 msgid "Dump output options." msgstr "" #. OPT_CODEPAGE -#: src/config/options.inc:722 src/config/options.inc:1039 +#: src/config/options.inc:728 src/config/options.inc:1045 #: src/config/opttypes.c:489 src/dialogs/document.c:184 msgid "Codepage" msgstr "" -#: src/config/options.inc:724 +#: src/config/options.inc:730 msgid "" "Codepage used in dump output. 'System' stands for a codepage determined by a " "selected locale." msgstr "" -#: src/config/options.inc:727 src/config/options.inc:996 +#: src/config/options.inc:733 src/config/options.inc:1002 msgid "Color mode" msgstr "" @@ -3167,7 +3181,7 @@ msgstr "" #. * an outer list entry after an inner list. #. * TRANSLATORS: This restriction applies only to the #. * "en" (English) translation. (See doc/Makefile.) -#: src/config/options.inc:734 +#: src/config/options.inc:740 msgid "" "Color mode for dumps.\n" "\n" @@ -3184,113 +3198,113 @@ msgid "" "4 is true color mode" msgstr "" -#: src/config/options.inc:749 +#: src/config/options.inc:755 msgid "Footer" msgstr "" -#: src/config/options.inc:751 +#: src/config/options.inc:757 #, c-format msgid "Footer string used in dumps. %u is substituted by URL." msgstr "" -#: src/config/options.inc:755 +#: src/config/options.inc:761 #, c-format msgid "Header string used in dumps. %u is substituted by URL." msgstr "" -#: src/config/options.inc:757 +#: src/config/options.inc:763 msgid "Numbering" msgstr "" -#: src/config/options.inc:759 +#: src/config/options.inc:765 msgid "Whether to print link numbers in dump output." msgstr "" -#: src/config/options.inc:761 +#: src/config/options.inc:767 msgid "References" msgstr "Verwysings" -#: src/config/options.inc:763 +#: src/config/options.inc:769 msgid "Whether to print references (URIs) of document links in dump output." msgstr "" -#: src/config/options.inc:766 +#: src/config/options.inc:772 msgid "Separator" msgstr "Skeier" -#: src/config/options.inc:768 +#: src/config/options.inc:774 msgid "String which separates two dumps." msgstr "" -#: src/config/options.inc:770 +#: src/config/options.inc:776 msgid "Width" msgstr "Wydte" -#: src/config/options.inc:772 +#: src/config/options.inc:778 msgid "Width of screen in characters when dumping documents." msgstr "" -#: src/config/options.inc:776 +#: src/config/options.inc:782 msgid "History" msgstr "Geskiedenis" -#: src/config/options.inc:778 +#: src/config/options.inc:784 msgid "History options." msgstr "Geskiedeniskeuses." -#: src/config/options.inc:780 +#: src/config/options.inc:786 msgid "Keep unhistory" msgstr "Hou toekoms" -#: src/config/options.inc:782 +#: src/config/options.inc:788 msgid "Keep unhistory (\"forward history\")." msgstr "Hou toekoms (\"vorentoe geskiedenis\")." -#: src/config/options.inc:785 +#: src/config/options.inc:791 msgid "HTML rendering" msgstr "" -#: src/config/options.inc:787 +#: src/config/options.inc:793 msgid "Options concerning the display of HTML pages." msgstr "" -#: src/config/options.inc:789 +#: src/config/options.inc:795 msgid "Display frames" msgstr "Wys rame" -#: src/config/options.inc:791 +#: src/config/options.inc:797 msgid "Display frames." msgstr "Wys rame." -#: src/config/options.inc:793 +#: src/config/options.inc:799 msgid "Display tables" msgstr "Wys tabelle" -#: src/config/options.inc:795 +#: src/config/options.inc:801 msgid "Display tables." msgstr "Wys tabelle." -#: src/config/options.inc:797 +#: src/config/options.inc:803 msgid "Display subscripts" msgstr "Wys onderskrif" -#: src/config/options.inc:799 +#: src/config/options.inc:805 msgid "Display subscripts (as [thing])." msgstr "Wys onderskrif (as [iets])." -#: src/config/options.inc:801 +#: src/config/options.inc:807 msgid "Display superscripts" msgstr "Wys superskrif" -#: src/config/options.inc:803 +#: src/config/options.inc:809 msgid "Display superscripts (as ^thing)." msgstr "Wys superskrif (as ^iets)." -#: src/config/options.inc:805 +#: src/config/options.inc:811 msgid "Rendering of HTML link element" msgstr "" -#: src/config/options.inc:807 +#: src/config/options.inc:813 msgid "" "How to render tags from the HTML header:\n" "0 is nothing\n" @@ -3301,54 +3315,54 @@ msgid "" "5 is everything" msgstr "" -#: src/config/options.inc:815 +#: src/config/options.inc:821 msgid "Underline links" msgstr "Onderstreep skakels" -#: src/config/options.inc:817 +#: src/config/options.inc:823 msgid "Underline links." msgstr "Onderstreep skakels." -#: src/config/options.inc:819 +#: src/config/options.inc:825 msgid "Wrap non breaking space" msgstr "" -#: src/config/options.inc:821 +#: src/config/options.inc:827 msgid "" "If set do not honour non breaking space (the nbsp entity) but allows one to " "wrap the text. This can help keeping the width of documents down so no " "horizontal scrolling is needed." msgstr "" -#: src/config/options.inc:826 +#: src/config/options.inc:832 msgid "Plain rendering" msgstr "" -#: src/config/options.inc:828 +#: src/config/options.inc:834 msgid "Options concerning the display of plain text pages." msgstr "Keuses aangaandie die vertoon van gewone teksblaaie." -#: src/config/options.inc:830 +#: src/config/options.inc:836 msgid "Display URIs" msgstr "Wys URI's" -#: src/config/options.inc:832 +#: src/config/options.inc:838 msgid "Display URIs in the document as links." msgstr "Wys URI's in die dokument as skakels." -#: src/config/options.inc:834 +#: src/config/options.inc:840 msgid "Compress empty lines" msgstr "Pers leë lyne saam" -#: src/config/options.inc:836 +#: src/config/options.inc:842 msgid "Compress successive empty lines to only one in displayed text." msgstr "Pers opeenvolgende leë lyne saam tot een in die vertoonde teks." -#: src/config/options.inc:840 +#: src/config/options.inc:846 msgid "URI passing" msgstr "URI-oordrag" -#: src/config/options.inc:842 +#: src/config/options.inc:848 msgid "" "Rules for passing URIs to external commands. When one rule is defined the " "link and tab menu will have a menu item that makes it possible to pass the " @@ -3361,7 +3375,7 @@ msgid "" "the link-external-command, and the tab-external-command actions." msgstr "" -#: src/config/options.inc:858 +#: src/config/options.inc:864 msgid "" "A rule for passing URI to an external command. The format is:\n" "%c in the string means the current URL\n" @@ -3370,19 +3384,19 @@ msgid "" msgstr "" #. Keep options in alphabetical order. -#: src/config/options.inc:868 +#: src/config/options.inc:874 msgid "Information files" msgstr "Inligtinglêers" -#: src/config/options.inc:870 +#: src/config/options.inc:876 msgid "Options for information files in ~/.elinks." msgstr "Keuses vir inligtinglêers in ~/.elinks." -#: src/config/options.inc:872 +#: src/config/options.inc:878 msgid "Save interval" msgstr "Stoorinterval" -#: src/config/options.inc:874 +#: src/config/options.inc:880 #, fuzzy msgid "" "Interval at which to trigger information files in ~/.elinks to be saved to " @@ -3391,11 +3405,11 @@ msgstr "" "Interval waarna die stoor van veranderde inligtinglêers\n" "in ~/.elinks geaktiveer moet word (sekondes; 0 deaktiveer)" -#: src/config/options.inc:878 +#: src/config/options.inc:884 msgid "Use secure file saving" msgstr "" -#: src/config/options.inc:880 +#: src/config/options.inc:886 msgid "" "First write data to unique temporary file, then rename this file upon " "successfully finishing this. Note that this relates only to config files, " @@ -3408,11 +3422,11 @@ msgid "" "reliability of this feature." msgstr "" -#: src/config/options.inc:892 +#: src/config/options.inc:898 msgid "Use fsync(3) with secure file saving" msgstr "" -#: src/config/options.inc:894 +#: src/config/options.inc:900 msgid "" "When using secure file saving, call fsync(3), if the OS supports it, to " "force the OS immediately to write the data to permanent storage. This is " @@ -3420,19 +3434,19 @@ msgid "" msgstr "" #. Keep options in alphabetical order. -#: src/config/options.inc:903 +#: src/config/options.inc:909 msgid "Terminals" msgstr "Terminale" -#: src/config/options.inc:905 +#: src/config/options.inc:911 msgid "Terminal options." msgstr "Terminaalkeuses." -#: src/config/options.inc:909 +#: src/config/options.inc:915 msgid "Options specific to this terminal type (according to $TERM value)." msgstr "" -#: src/config/options.inc:936 +#: src/config/options.inc:942 msgid "" "Terminal type; matters mostly only when drawing frames and dialog box " "borders:\n" @@ -3444,11 +3458,11 @@ msgid "" "5 is fbterm" msgstr "" -#: src/config/options.inc:945 +#: src/config/options.inc:951 msgid "Always encode xterm title in ISO-8859-1" msgstr "" -#: src/config/options.inc:947 +#: src/config/options.inc:953 msgid "" "When updating the window title of xterm or a similar terminal emulator, " "encode the title in ISO-8859-1 (Latin-1), rather than in the charset used " @@ -3460,11 +3474,11 @@ msgid "" "different page so that ELinks notices it needs to update the title." msgstr "" -#: src/config/options.inc:958 src/dialogs/options.c:230 +#: src/config/options.inc:964 src/dialogs/options.c:230 msgid "Switch fonts for line drawing" msgstr "" -#: src/config/options.inc:960 +#: src/config/options.inc:966 msgid "" "Switch fonts when drawing lines, enabling both local characters and lines " "working at the same time. ELinks uses this option only if UTF-8 I/O is " @@ -3476,41 +3490,41 @@ msgstr "" #. * and if so, behave as if "utf_8_io" were 1. (When CONFIG_UTF8 is #. * not defined, it should not be possible to set UTF-8 as "codepage"; #. * please report any such possibilities as bugs.) -#: src/config/options.inc:970 src/dialogs/options.c:236 +#: src/config/options.inc:976 src/dialogs/options.c:236 msgid "UTF-8 I/O" msgstr "" -#: src/config/options.inc:972 +#: src/config/options.inc:978 msgid "" "Enable I/O in UTF-8 for Unicode terminals. Note that currently, only the " "subset of UTF-8 according to terminal codepage is used. ELinks ignores this " "option if the terminal codepage is UTF-8." msgstr "" -#: src/config/options.inc:978 src/dialogs/options.c:238 src/main/version.c:156 +#: src/config/options.inc:984 src/dialogs/options.c:238 src/main/version.c:156 msgid "Combining characters" msgstr "" -#: src/config/options.inc:980 +#: src/config/options.inc:986 msgid "" "Enable combining characters. It works only with the xterm in UTF-8 mode." msgstr "" -#: src/config/options.inc:984 src/dialogs/options.c:231 +#: src/config/options.inc:990 src/dialogs/options.c:231 msgid "Restrict frames in cp850/852" msgstr "" -#: src/config/options.inc:986 +#: src/config/options.inc:992 msgid "" "Restrict the characters used when drawing lines. Makes sense only with linux " "terminals using the cp850/852 character sets." msgstr "" -#: src/config/options.inc:990 src/dialogs/options.c:232 +#: src/config/options.inc:996 src/dialogs/options.c:232 msgid "Block cursor" msgstr "" -#: src/config/options.inc:992 +#: src/config/options.inc:998 msgid "" "Move cursor to bottom right corner when done drawing. This is particularly " "useful when we have a block cursor, so that inversed text is displayed " @@ -3522,7 +3536,7 @@ msgstr "" #. * an outer list entry after an inner list. #. * TRANSLATORS: This restriction applies only to the #. * "en" (English) translation. (See doc/Makefile.) -#: src/config/options.inc:1003 +#: src/config/options.inc:1009 msgid "" "The color mode controls what colors are used and how they are output to the " "terminal.\n" @@ -3539,11 +3553,11 @@ msgid "" "4 is true color mode, uses konsole RGB codes" msgstr "" -#: src/config/options.inc:1018 src/dialogs/options.c:234 +#: src/config/options.inc:1024 src/dialogs/options.c:234 msgid "Transparency" msgstr "Deursigtigheid" -#: src/config/options.inc:1020 +#: src/config/options.inc:1026 msgid "" "If we should not set the background to black. This is particularly useful " "when we have a terminal (typically in some windowing environment) with a " @@ -3553,401 +3567,410 @@ msgid "" "problems). Note that this option makes sense only when colors are enabled." msgstr "" -#: src/config/options.inc:1030 src/dialogs/options.c:233 +#: src/config/options.inc:1036 src/dialogs/options.c:233 #, fuzzy msgid "Italic" msgstr "Italiaans" -#: src/config/options.inc:1032 +#: src/config/options.inc:1038 msgid "If we should use italics." msgstr "" -#: src/config/options.inc:1036 +#: src/config/options.inc:1042 msgid "If we should use underline or enhance the color instead." msgstr "" -#: src/config/options.inc:1041 +#: src/config/options.inc:1047 msgid "" "Codepage of charset used for displaying content on terminal. 'System' stands " "for a codepage determined by a selected locale." msgstr "" #. Keep options in alphabetical order. -#: src/config/options.inc:1049 +#: src/config/options.inc:1055 msgid "User interface" msgstr "Gebruikerkoppelvlak" -#: src/config/options.inc:1051 +#: src/config/options.inc:1057 msgid "User interface options." msgstr "Keuses oor die gebruikerkoppevlak." -#: src/config/options.inc:1055 +#: src/config/options.inc:1061 msgid "Color settings" msgstr "Kleurinstellings" -#: src/config/options.inc:1057 +#: src/config/options.inc:1063 msgid "Default user interface color settings." msgstr "Verstek-kleurinstellings van die gebruikerkoppelvlak." -#: src/config/options.inc:1084 +#: src/config/options.inc:1090 msgid "Color terminals" msgstr "Kleurterminale" -#: src/config/options.inc:1086 +#: src/config/options.inc:1092 msgid "Color settings for color terminal." msgstr "Kleurinstellings vir kleur terminale." -#: src/config/options.inc:1088 +#: src/config/options.inc:1094 msgid "Non-color terminals" msgstr "" -#: src/config/options.inc:1090 +#: src/config/options.inc:1096 msgid "Color settings for non-color terminal." msgstr "" #. FIXME: obsolete, how to alias them correctly ? --Zas -#: src/config/options.inc:1093 +#: src/config/options.inc:1099 msgid "Main menu bar" msgstr "" -#: src/config/options.inc:1095 +#: src/config/options.inc:1101 msgid "Main menu bar colors." msgstr "" -#: src/config/options.inc:1097 +#: src/config/options.inc:1103 msgid "Unselected main menu bar item" msgstr "" -#: src/config/options.inc:1099 +#: src/config/options.inc:1105 msgid "Unselected main menu bar item colors." msgstr "" -#: src/config/options.inc:1101 +#: src/config/options.inc:1107 msgid "Selected main menu bar item" msgstr "" -#: src/config/options.inc:1103 +#: src/config/options.inc:1109 msgid "Selected main menu bar item colors." msgstr "" -#: src/config/options.inc:1105 src/config/options.inc:1134 +#: src/config/options.inc:1111 src/config/options.inc:1140 msgid "Hotkey" msgstr "" -#: src/config/options.inc:1107 +#: src/config/options.inc:1113 msgid "Main menu hotkey colors." msgstr "" -#: src/config/options.inc:1109 src/config/options.inc:1138 +#: src/config/options.inc:1115 src/config/options.inc:1144 msgid "Unselected hotkey" msgstr "" -#: src/config/options.inc:1111 +#: src/config/options.inc:1117 msgid "Main menu unselected hotkey colors." msgstr "" -#: src/config/options.inc:1113 src/config/options.inc:1142 +#: src/config/options.inc:1119 src/config/options.inc:1148 msgid "Selected hotkey" msgstr "" -#: src/config/options.inc:1115 +#: src/config/options.inc:1121 msgid "Main menu selected hotkey colors." msgstr "" -#: src/config/options.inc:1118 +#: src/config/options.inc:1124 msgid "Menu bar" msgstr "" -#: src/config/options.inc:1120 +#: src/config/options.inc:1126 msgid "Menu bar colors." msgstr "" -#: src/config/options.inc:1122 +#: src/config/options.inc:1128 msgid "Unselected menu item" msgstr "" -#: src/config/options.inc:1124 +#: src/config/options.inc:1130 msgid "Unselected menu item colors." msgstr "" -#: src/config/options.inc:1126 +#: src/config/options.inc:1132 msgid "Selected menu item" msgstr "" -#: src/config/options.inc:1128 +#: src/config/options.inc:1134 msgid "Selected menu item colors." msgstr "" -#: src/config/options.inc:1130 +#: src/config/options.inc:1136 msgid "Marked menu item" msgstr "" -#: src/config/options.inc:1132 +#: src/config/options.inc:1138 msgid "Marked menu item colors." msgstr "" -#: src/config/options.inc:1136 +#: src/config/options.inc:1142 msgid "Menu item hotkey colors." msgstr "" -#: src/config/options.inc:1140 +#: src/config/options.inc:1146 msgid "Menu item unselected hotkey colors." msgstr "" -#: src/config/options.inc:1144 +#: src/config/options.inc:1150 msgid "Menu item selected hotkey colors." msgstr "" -#: src/config/options.inc:1146 +#: src/config/options.inc:1152 msgid "Menu frame" msgstr "" -#: src/config/options.inc:1148 +#: src/config/options.inc:1154 msgid "Menu frame colors." msgstr "" -#: src/config/options.inc:1151 +#: src/config/options.inc:1157 msgid "Dialog" msgstr "" -#: src/config/options.inc:1153 +#: src/config/options.inc:1159 msgid "Dialog colors." msgstr "" -#: src/config/options.inc:1163 +#: src/config/options.inc:1169 msgid "Generic" msgstr "" -#: src/config/options.inc:1165 +#: src/config/options.inc:1171 msgid "Generic dialog colors." msgstr "" -#: src/config/options.inc:1167 +#: src/config/options.inc:1173 msgid "Frame" msgstr "" -#: src/config/options.inc:1169 +#: src/config/options.inc:1175 msgid "Dialog frame colors." msgstr "" -#: src/config/options.inc:1171 +#: src/config/options.inc:1177 msgid "Scrollbar" msgstr "" -#: src/config/options.inc:1173 +#: src/config/options.inc:1179 msgid "Scrollbar colors." msgstr "" -#: src/config/options.inc:1175 +#: src/config/options.inc:1181 msgid "Selected scrollbar" msgstr "" -#: src/config/options.inc:1177 +#: src/config/options.inc:1183 msgid "Scrollbar selected colors." msgstr "" -#: src/config/options.inc:1181 +#: src/config/options.inc:1187 msgid "Dialog title colors." msgstr "" -#: src/config/options.inc:1183 +#: src/config/options.inc:1189 msgid "Text" msgstr "Teks" -#: src/config/options.inc:1185 +#: src/config/options.inc:1191 msgid "Dialog text colors." msgstr "" -#: src/config/options.inc:1187 src/viewer/text/form.c:1930 +#: src/config/options.inc:1193 src/viewer/text/form.c:1930 msgid "Checkbox" msgstr "" -#: src/config/options.inc:1189 +#: src/config/options.inc:1195 msgid "Dialog checkbox colors." msgstr "" -#: src/config/options.inc:1191 +#: src/config/options.inc:1197 msgid "Selected checkbox" msgstr "" -#: src/config/options.inc:1193 +#: src/config/options.inc:1199 msgid "Dialog selected checkbox colors." msgstr "" -#: src/config/options.inc:1195 +#: src/config/options.inc:1201 msgid "Checkbox label" msgstr "" -#: src/config/options.inc:1197 +#: src/config/options.inc:1203 msgid "Dialog checkbox label colors." msgstr "" -#: src/config/options.inc:1199 +#: src/config/options.inc:1205 msgid "Button" msgstr "Knoppie" -#: src/config/options.inc:1201 src/config/options.inc:1209 +#: src/config/options.inc:1207 src/config/options.inc:1215 msgid "Dialog button colors." msgstr "" -#: src/config/options.inc:1203 +#: src/config/options.inc:1209 msgid "Selected button" msgstr "" -#: src/config/options.inc:1205 src/config/options.inc:1213 +#: src/config/options.inc:1211 src/config/options.inc:1219 msgid "Dialog selected button colors." msgstr "" -#: src/config/options.inc:1207 +#: src/config/options.inc:1213 msgid "Button shortcut" msgstr "" -#: src/config/options.inc:1211 +#: src/config/options.inc:1217 msgid "Selected button shortcut" msgstr "" -#: src/config/options.inc:1215 src/viewer/text/form.c:1934 +#: src/config/options.inc:1221 src/viewer/text/form.c:1934 msgid "Text field" msgstr "Teksveld" -#: src/config/options.inc:1217 +#: src/config/options.inc:1223 msgid "Dialog text field colors." msgstr "Teksveldkleur in dialoë." -#: src/config/options.inc:1219 +#: src/config/options.inc:1225 msgid "Text field text" msgstr "Teksveldteks" -#: src/config/options.inc:1221 +#: src/config/options.inc:1227 msgid "Dialog field text colors." msgstr "" -#: src/config/options.inc:1223 +#: src/config/options.inc:1229 msgid "Meter" msgstr "" -#: src/config/options.inc:1225 +#: src/config/options.inc:1231 msgid "Dialog meter colors." msgstr "" -#: src/config/options.inc:1227 +#: src/config/options.inc:1233 msgid "Shadow" msgstr "Skadu" -#: src/config/options.inc:1229 +#: src/config/options.inc:1235 msgid "Dialog shadow colors (see ui.shadows option)." msgstr "Skadukleure vir dialoog (sien die ui.shadows-keuse)" -#: src/config/options.inc:1231 +#: src/config/options.inc:1237 msgid "Title bar" msgstr "" -#: src/config/options.inc:1233 +#: src/config/options.inc:1239 msgid "Title bar colors." msgstr "" -#: src/config/options.inc:1235 +#: src/config/options.inc:1241 msgid "Generic title bar" msgstr "" -#: src/config/options.inc:1237 +#: src/config/options.inc:1243 msgid "Generic title bar colors." msgstr "" -#: src/config/options.inc:1239 +#: src/config/options.inc:1245 msgid "Title bar text" msgstr "" -#: src/config/options.inc:1241 +#: src/config/options.inc:1247 msgid "Title bar text colors." msgstr "" -#: src/config/options.inc:1244 +#: src/config/options.inc:1250 msgid "Status bar" msgstr "" -#: src/config/options.inc:1246 +#: src/config/options.inc:1252 msgid "Status bar colors." msgstr "" -#: src/config/options.inc:1248 +#: src/config/options.inc:1254 msgid "Status bar show ip" msgstr "" -#: src/config/options.inc:1250 +#: src/config/options.inc:1256 msgid "Status bar show ip text colors." msgstr "" -#: src/config/options.inc:1252 +#: src/config/options.inc:1258 msgid "Generic status bar" msgstr "" -#: src/config/options.inc:1254 +#: src/config/options.inc:1260 msgid "Generic status bar colors." msgstr "" -#: src/config/options.inc:1257 +#: src/config/options.inc:1263 msgid "Status bar text" msgstr "" -#: src/config/options.inc:1259 +#: src/config/options.inc:1265 msgid "Status bar text colors." msgstr "" -#: src/config/options.inc:1262 +#: src/config/options.inc:1268 msgid "Tabs bar" msgstr "" -#: src/config/options.inc:1264 +#: src/config/options.inc:1270 msgid "Tabs bar colors." msgstr "" -#: src/config/options.inc:1266 +#: src/config/options.inc:1272 msgid "Unvisited tab" msgstr "" -#: src/config/options.inc:1268 +#: src/config/options.inc:1274 msgid "" "Tab colors for tabs that have not been selected since they completed loading." msgstr "" -#: src/config/options.inc:1271 +#: src/config/options.inc:1277 msgid "Unselected tab" msgstr "" -#: src/config/options.inc:1273 +#: src/config/options.inc:1279 msgid "Unselected tab colors." msgstr "" -#: src/config/options.inc:1275 +#: src/config/options.inc:1281 msgid "Loading tab" msgstr "" -#: src/config/options.inc:1277 +#: src/config/options.inc:1283 msgid "Tab colors for tabs that are loading in the background." msgstr "" -#: src/config/options.inc:1279 +#: src/config/options.inc:1285 msgid "Selected tab" msgstr "" -#: src/config/options.inc:1281 +#: src/config/options.inc:1287 msgid "Selected tab colors." msgstr "" -#: src/config/options.inc:1283 +#: src/config/options.inc:1289 msgid "Tab separator" msgstr "" -#: src/config/options.inc:1285 +#: src/config/options.inc:1291 msgid "Tab separator colors." msgstr "" -#: src/config/options.inc:1288 +#: src/config/options.inc:1293 +#, fuzzy +msgid "Clipboard" +msgstr "%ld lêer" + +#: src/config/options.inc:1295 +msgid "Clipboard highlight colors." +msgstr "" + +#: src/config/options.inc:1297 msgid "Searched strings" msgstr "" -#: src/config/options.inc:1290 +#: src/config/options.inc:1299 msgid "Searched string highlight colors." msgstr "" @@ -3955,66 +3978,66 @@ msgstr "" #. ============= BORING PART (colors) END =================== #. ========================================================== #. Keep options in alphabetical order. -#: src/config/options.inc:1299 +#: src/config/options.inc:1308 msgid "Dialog settings" msgstr "" -#: src/config/options.inc:1301 +#: src/config/options.inc:1310 msgid "Dialogs-specific appearance and behaviour settings." msgstr "" -#: src/config/options.inc:1304 +#: src/config/options.inc:1313 msgid "Minimal height of listbox widget" msgstr "" -#: src/config/options.inc:1306 +#: src/config/options.inc:1315 msgid "" "Minimal height of the listbox widget (used e.g. for bookmarks or global " "history)." msgstr "" -#: src/config/options.inc:1309 +#: src/config/options.inc:1318 msgid "Drop shadows" msgstr "" -#: src/config/options.inc:1311 +#: src/config/options.inc:1320 msgid "" "Make dialogs drop shadows (the shadows are solid, you can adjust their color " "by ui.colors.*.dialog.shadow). You may also want to eliminate the wide " "borders by adjusting setup.h." msgstr "" -#: src/config/options.inc:1316 +#: src/config/options.inc:1325 msgid "Underline menu hotkeys" msgstr "" -#: src/config/options.inc:1318 +#: src/config/options.inc:1327 msgid "" "Whether to underline hotkeys in menus to make them more visible. Requires " "that underlining is enabled for the terminal." msgstr "" -#: src/config/options.inc:1322 +#: src/config/options.inc:1331 msgid "Underline button shortcuts" msgstr "" -#: src/config/options.inc:1324 +#: src/config/options.inc:1333 msgid "" "Whether to underline button shortcuts to make them more visible. Requires " "that underlining is enabled for the terminal." msgstr "" -#: src/config/options.inc:1329 +#: src/config/options.inc:1338 msgid "Timer options" msgstr "" -#: src/config/options.inc:1331 +#: src/config/options.inc:1340 msgid "" "Timed action after certain interval of user inactivity. Someone can even " "find this useful, although you may not believe that." msgstr "" -#: src/config/options.inc:1338 +#: src/config/options.inc:1347 msgid "" "Whether to enable the timer or not:\n" "0 is don't count down anything\n" @@ -4022,7 +4045,7 @@ msgid "" "2 is count down and show the timer near LEDs" msgstr "" -#: src/config/options.inc:1345 +#: src/config/options.inc:1354 msgid "" "Whether to enable the timer or not:\n" "0 is don't count down anything\n" @@ -4030,33 +4053,33 @@ msgid "" "2 is count down and show the timer near LEDs (DISABLED)" msgstr "" -#: src/config/options.inc:1351 +#: src/config/options.inc:1360 msgid "Duration" msgstr "" -#: src/config/options.inc:1353 +#: src/config/options.inc:1362 msgid "" "Inactivity timeout in seconds. The maximum of one day should be enough for " "just everyone (TM)." msgstr "" -#: src/config/options.inc:1358 +#: src/config/options.inc:1367 msgid "Keybinding action to be triggered when timer reaches zero." msgstr "" -#: src/config/options.inc:1362 +#: src/config/options.inc:1371 msgid "Window tabs" msgstr "" -#: src/config/options.inc:1364 +#: src/config/options.inc:1373 msgid "Window tabs settings." msgstr "" -#: src/config/options.inc:1366 +#: src/config/options.inc:1375 msgid "Display tabs bar" msgstr "" -#: src/config/options.inc:1368 +#: src/config/options.inc:1377 msgid "" "Show tabs bar on the screen:\n" "0 means never\n" @@ -4064,130 +4087,130 @@ msgid "" "2 means always" msgstr "" -#: src/config/options.inc:1373 +#: src/config/options.inc:1382 msgid "Tab bar at top" msgstr "" -#: src/config/options.inc:1375 +#: src/config/options.inc:1384 msgid "Whether display tab bar at top like other browsers do." msgstr "" -#: src/config/options.inc:1377 +#: src/config/options.inc:1386 msgid "Wrap-around tabs cycling" msgstr "" -#: src/config/options.inc:1379 +#: src/config/options.inc:1388 msgid "" "When moving right from the last tab, jump to the first one, and vice versa." msgstr "" -#: src/config/options.inc:1382 +#: src/config/options.inc:1391 msgid "Confirm tab closing" msgstr "" -#: src/config/options.inc:1384 +#: src/config/options.inc:1393 msgid "When closing a tab show confirmation dialog." msgstr "" -#: src/config/options.inc:1386 +#: src/config/options.inc:1395 #, fuzzy msgid "Disallow writing to terminal" msgstr "Fout met die skryf na die lêer" -#: src/config/options.inc:1388 +#: src/config/options.inc:1397 msgid "Whether to disallow writing to terminal by background processes." msgstr "" #. OPT_LANGUAGE -#: src/config/options.inc:1390 src/config/opttypes.c:491 +#: src/config/options.inc:1399 src/config/opttypes.c:491 msgid "Language" msgstr "Taal" -#: src/config/options.inc:1392 +#: src/config/options.inc:1401 msgid "" "Language of user interface. 'System' means that the language will be " "extracted from the environment dynamically." msgstr "" -#: src/config/options.inc:1396 +#: src/config/options.inc:1405 msgid "Display menu bar always" msgstr "" -#: src/config/options.inc:1398 +#: src/config/options.inc:1407 msgid "Always show menu bar on the screen." msgstr "" -#: src/config/options.inc:1400 +#: src/config/options.inc:1409 msgid "Display status bar" msgstr "" -#: src/config/options.inc:1402 +#: src/config/options.inc:1411 msgid "Show status bar on the screen." msgstr "" -#: src/config/options.inc:1404 +#: src/config/options.inc:1413 msgid "Display title bar" msgstr "" -#: src/config/options.inc:1406 +#: src/config/options.inc:1415 msgid "Show title bar on the screen." msgstr "" -#: src/config/options.inc:1408 +#: src/config/options.inc:1417 msgid "Display goto dialog in new tabs" msgstr "" -#: src/config/options.inc:1410 +#: src/config/options.inc:1419 msgid "" "Pop up goto dialog in newly created tabs when there's no homepage set. This " "means also showing goto dialog on startup." msgstr "" -#: src/config/options.inc:1414 +#: src/config/options.inc:1423 msgid "Show a message box when file is saved successfully" msgstr "" -#: src/config/options.inc:1416 +#: src/config/options.inc:1425 msgid "" "When you pressed a [ Save ] button in some manager, this option will make " "sure that a box confirming success of the operation will pop up." msgstr "" -#: src/config/options.inc:1421 +#: src/config/options.inc:1430 msgid "Sessions" msgstr "" -#: src/config/options.inc:1423 +#: src/config/options.inc:1432 msgid "Sessions settings." msgstr "" -#: src/config/options.inc:1425 +#: src/config/options.inc:1434 msgid "Auto restore session" msgstr "" -#: src/config/options.inc:1427 +#: src/config/options.inc:1436 msgid "" "Automatically restore the session at start.\n" "\n" "This feature requires bookmark support." msgstr "" -#: src/config/options.inc:1431 +#: src/config/options.inc:1440 msgid "Auto save session" msgstr "" -#: src/config/options.inc:1433 +#: src/config/options.inc:1442 msgid "" "Automatically save the session when quitting.\n" "\n" "This feature requires bookmark support." msgstr "" -#: src/config/options.inc:1437 +#: src/config/options.inc:1446 msgid "Auto save and restore session folder name" msgstr "" -#: src/config/options.inc:1439 +#: src/config/options.inc:1448 msgid "" "Name of the bookmarks folder used for auto saving and restoring session. The " "name has to be unique. Any folders with the same name will be deleted.\n" @@ -4195,41 +4218,41 @@ msgid "" "This only makes sense with bookmark support." msgstr "" -#: src/config/options.inc:1445 +#: src/config/options.inc:1454 msgid "Fork on start" msgstr "" -#: src/config/options.inc:1447 +#: src/config/options.inc:1456 msgid "" "Fork on start to let other terminals function even if the first terminal " "exits." msgstr "" -#: src/config/options.inc:1450 +#: src/config/options.inc:1459 msgid "Homepage URI" msgstr "" -#: src/config/options.inc:1452 +#: src/config/options.inc:1461 msgid "" "The URI to load either at startup time when no URI was given on the command " "line or when requested by the goto-url-home action. Set to \"\" if the " "environment variable WWW_HOME should be used as homepage URI instead." msgstr "" -#: src/config/options.inc:1457 +#: src/config/options.inc:1466 msgid "Keep session active" msgstr "" -#: src/config/options.inc:1459 +#: src/config/options.inc:1468 msgid "Keep the session active even if the last terminal exits." msgstr "" -#: src/config/options.inc:1462 +#: src/config/options.inc:1471 #, fuzzy msgid "Clipboard filename" msgstr "%ld lêer" -#: src/config/options.inc:1464 +#: src/config/options.inc:1473 msgid "" "The filename of the clipboard. The 'copy-clipboard' action will append to " "it. This file can be also a named pipe. See contrib/clipboard/clip.sh for " @@ -4237,28 +4260,28 @@ msgid "" "clipboard." msgstr "" -#: src/config/options.inc:1469 +#: src/config/options.inc:1478 msgid "Date format" msgstr "Datumformaat" -#: src/config/options.inc:1471 +#: src/config/options.inc:1480 msgid "Date format to use in dialogs. See strftime(3)." msgstr "Datumformaat om in dialoë te gebruik. Sien strftime(3)." #. date added -#: src/config/options.inc:1476 +#: src/config/options.inc:1485 msgid "Disable mouse" msgstr "" -#: src/config/options.inc:1478 +#: src/config/options.inc:1487 msgid "Disable mouse. Changes take effect at the next elinks restart." msgstr "" -#: src/config/options.inc:1482 +#: src/config/options.inc:1491 msgid "Set window title" msgstr "Stel venstertitel" -#: src/config/options.inc:1484 +#: src/config/options.inc:1493 msgid "" "Set the window title when running in a windowing environment in an xterm-" "like terminal. This way the document's title is shown on the window titlebar." @@ -4445,144 +4468,144 @@ msgstr "" msgid "ELinks was started with the -anonymous option." msgstr "" -#: src/cookies/dialogs.c:40 src/cookies/dialogs.c:415 +#: src/cookies/dialogs.c:43 src/cookies/dialogs.c:418 msgid "Domain" msgstr "Domein" -#: src/cookies/dialogs.c:41 src/mime/backend/mailcap.c:97 +#: src/cookies/dialogs.c:44 src/mime/backend/mailcap.c:97 #: src/mime/backend/mimetypes.c:56 src/protocol/file/cgi.c:45 msgid "Path" msgstr "Pad" -#: src/cookies/dialogs.c:45 +#: src/cookies/dialogs.c:48 msgid "at quit time" msgstr "met afsluiting" -#: src/cookies/dialogs.c:53 src/cookies/dialogs.c:417 +#: src/cookies/dialogs.c:56 src/cookies/dialogs.c:420 msgid "Secure" msgstr "" -#: src/cookies/dialogs.c:54 src/cookies/dialogs.c:56 +#: src/cookies/dialogs.c:57 src/cookies/dialogs.c:59 msgid "yes" msgstr "ja" -#: src/cookies/dialogs.c:54 src/cookies/dialogs.c:56 +#: src/cookies/dialogs.c:57 src/cookies/dialogs.c:59 msgid "no" msgstr "nee" -#: src/cookies/dialogs.c:55 src/cookies/dialogs.c:418 +#: src/cookies/dialogs.c:58 src/cookies/dialogs.c:421 msgid "HttpOnly" msgstr "" -#: src/cookies/dialogs.c:88 +#: src/cookies/dialogs.c:91 #, c-format msgid "Do you want to accept a cookie from %s?" msgstr "Wil u 'n koekie van %s aanvaar?" -#: src/cookies/dialogs.c:96 +#: src/cookies/dialogs.c:99 msgid "Accept cookie?" msgstr "Aanvaar koekie?" #. accelerator_context(accept_cookie_dialog) -#: src/cookies/dialogs.c:99 +#: src/cookies/dialogs.c:102 msgid "~Accept" msgstr "~Aanvaar" #. accelerator_context(accept_cookie_dialog) -#: src/cookies/dialogs.c:100 +#: src/cookies/dialogs.c:103 msgid "~Reject" msgstr "~Keur af" -#: src/cookies/dialogs.c:167 src/cookies/dialogs.c:404 +#: src/cookies/dialogs.c:170 src/cookies/dialogs.c:407 #: src/dialogs/document.c:198 msgid "Server" msgstr "Bediener" #. cant_delete_item -#: src/cookies/dialogs.c:215 +#: src/cookies/dialogs.c:218 #, c-format msgid "Sorry, but cookie \"%s\" cannot be deleted." msgstr "Jammer, maar koekie \"%s\" kan nie geskrap word nie." #. cant_delete_used_item -#: src/cookies/dialogs.c:217 +#: src/cookies/dialogs.c:220 #, c-format msgid "Sorry, but cookie \"%s\" is being used by something else." msgstr "Jammer, maar koekie \"%s\" word deur iets anders gebruik." #. cant_delete_folder -#: src/cookies/dialogs.c:219 +#: src/cookies/dialogs.c:222 #, c-format msgid "Sorry, but cookie domain \"%s\" cannot be deleted." msgstr "Jammer, maar koekiedomein \"%s\" kan nie geskrap word nie." #. cant_delete_used_folder -#: src/cookies/dialogs.c:221 +#: src/cookies/dialogs.c:224 #, c-format msgid "Sorry, but cookie domain \"%s\" is being used by something else." msgstr "Jammer, maar koekiedomein \"%s\" word deur iets anders gebruik." #. delete_marked_items_title -#: src/cookies/dialogs.c:223 +#: src/cookies/dialogs.c:226 msgid "Delete marked cookies" msgstr "Skrap gemerkte koekies" #. delete_marked_items -#: src/cookies/dialogs.c:225 +#: src/cookies/dialogs.c:228 msgid "Delete marked cookies?" msgstr "Skrap gemerkte koekies?" #. delete_folder_title -#: src/cookies/dialogs.c:227 +#: src/cookies/dialogs.c:230 msgid "Delete domain's cookies" msgstr "Skrap domein se koekies" #. delete_folder -#: src/cookies/dialogs.c:229 +#: src/cookies/dialogs.c:232 #, c-format msgid "Delete all cookies from domain \"%s\"?" msgstr "Skrap alle koekies van domein \"%s\"?" #. delete_item_title -#: src/cookies/dialogs.c:231 +#: src/cookies/dialogs.c:234 msgid "Delete cookie" msgstr "Skrap koekie" -#: src/cookies/dialogs.c:233 +#: src/cookies/dialogs.c:236 #, c-format msgid "Delete this cookie?" msgstr "Skrap hierdie koekie?" #. clear_all_items_title -#: src/cookies/dialogs.c:235 +#: src/cookies/dialogs.c:238 msgid "Clear all cookies" msgstr "Skrap alle koekies" #. clear_all_items_title -#: src/cookies/dialogs.c:237 +#: src/cookies/dialogs.c:240 msgid "Do you really want to remove all cookies?" msgstr "Wil u regtig alle koekies skrap?" -#: src/cookies/dialogs.c:512 +#: src/cookies/dialogs.c:515 msgid "Add server" msgstr "Voeg bediener by" -#: src/cookies/dialogs.c:516 +#: src/cookies/dialogs.c:519 msgid "Server name" msgstr "Bedienernaam" #. accelerator_context(src/cookies/dialogs.c:cookie_buttons) -#: src/cookies/dialogs.c:539 +#: src/cookies/dialogs.c:542 msgid "Add ~server" msgstr "Voeg ~bediener by" #. accelerator_context(do_edit_dialog, src/cookies/dialogs.c:cookie_buttons, src/dialogs/download.c:download_buttons, src/globhist/dialogs.c:globhist_buttons, src/protocol/auth/dialogs.c:auth_buttons) -#: src/cookies/dialogs.c:542 src/dialogs/download.c:507 src/dialogs/edit.c:99 +#: src/cookies/dialogs.c:545 src/dialogs/download.c:510 src/dialogs/edit.c:99 #: src/globhist/dialogs.c:236 src/protocol/auth/dialogs.c:308 msgid "C~lear" msgstr "Maak skoon" -#: src/cookies/dialogs.c:548 +#: src/cookies/dialogs.c:551 msgid "Cookie manager" msgstr "Koekiebestuurder" @@ -4646,79 +4669,79 @@ msgstr "Interne kopinligting" msgid "No header info." msgstr "Geen kopinligting." -#: src/dialogs/download.c:252 src/dialogs/menu.c:601 -#: src/protocol/bittorrent/dialogs.c:228 src/session/download.c:487 +#: src/dialogs/download.c:255 src/dialogs/menu.c:601 +#: src/protocol/bittorrent/dialogs.c:229 src/session/download.c:487 msgid "Download" msgstr "Aflaai" #. accelerator_context(display_download) -#: src/dialogs/download.c:259 +#: src/dialogs/download.c:262 msgid "~Background" msgstr "~Agtergrond" #. accelerator_context(display_download) -#: src/dialogs/download.c:260 +#: src/dialogs/download.c:263 msgid "Background with ~notify" msgstr "Agtergrond met ~kennisgewing" #. accelerator_context(display_download, src/dialogs/download.c:download_buttons) -#: src/dialogs/download.c:267 src/dialogs/download.c:502 +#: src/dialogs/download.c:270 src/dialogs/download.c:505 msgid "~Abort" msgstr "~Staak" #. accelerator_context(display_download) -#: src/dialogs/download.c:272 +#: src/dialogs/download.c:275 msgid "Abort and ~delete file" msgstr "Staak en s~krap lêer" #. cant_delete_item -#: src/dialogs/download.c:432 +#: src/dialogs/download.c:435 #, c-format msgid "Sorry, but download \"%s\" cannot be interrupted." msgstr "Jammer, maar aflaai \"%s\" kan nie onderbreek word nie." #. cant_delete_used_item -#: src/dialogs/download.c:434 +#: src/dialogs/download.c:437 #, c-format msgid "Sorry, but download \"%s\" is being used by something else." msgstr "Jammer, maar aflaai \"%s\" word deur iets anders gebruik." #. delete_marked_items_title -#: src/dialogs/download.c:440 +#: src/dialogs/download.c:443 msgid "Interrupt marked downloads" msgstr "Onderbreek gemerkte aflaaie" #. delete_marked_items -#: src/dialogs/download.c:442 +#: src/dialogs/download.c:445 msgid "Interrupt marked downloads?" msgstr "Onderbreek gemerkte aflaaie?" #. delete_item_title -#: src/dialogs/download.c:448 +#: src/dialogs/download.c:451 msgid "Interrupt download" msgstr "Onderbreek aflaai" -#: src/dialogs/download.c:450 +#: src/dialogs/download.c:453 #, c-format msgid "Interrupt this download?" msgstr "Onderbreek hierdie aflaai?" #. clear_all_items_title -#: src/dialogs/download.c:452 +#: src/dialogs/download.c:455 msgid "Interrupt all downloads" msgstr "Onderbreek alle aflaaie" #. clear_all_items_title -#: src/dialogs/download.c:454 +#: src/dialogs/download.c:457 msgid "Do you really want to interrupt all downloads?" msgstr "Wil u regtig alle aflaaie onderbreek?" #. This requires more work to make locking work and query the user -#: src/dialogs/download.c:505 +#: src/dialogs/download.c:508 msgid "Abort and delete file" msgstr "Staak en skrap lêer" -#: src/dialogs/download.c:512 +#: src/dialogs/download.c:515 msgid "Download manager" msgstr "Aflaaibestuurder" @@ -4855,8 +4878,8 @@ msgstr[0] "" msgstr[1] "" #. name: -#: src/dialogs/info.c:236 src/ecmascript/ecmascript.c:40 -#: src/ecmascript/ecmascript.c:337 +#: src/dialogs/info.c:236 src/ecmascript/ecmascript.c:41 +#: src/ecmascript/ecmascript.c:382 msgid "ECMAScript" msgstr "ECMAScript" @@ -5292,15 +5315,15 @@ msgstr "Gaan na URL" msgid "Save to file" msgstr "Stoor na lêer" -#: src/dialogs/menu.c:938 +#: src/dialogs/menu.c:943 msgid "Empty directory" msgstr "Leë gids" -#: src/dialogs/menu.c:982 +#: src/dialogs/menu.c:987 msgid "Directories:" msgstr "Gidse:" -#: src/dialogs/menu.c:995 +#: src/dialogs/menu.c:1000 msgid "Files:" msgstr "Lêers:" @@ -5384,63 +5407,63 @@ msgstr "" msgid "Height=" msgstr "" -#: src/dialogs/progress.c:36 +#: src/dialogs/progress.c:37 msgid "of" msgstr "van" -#: src/dialogs/progress.c:47 +#: src/dialogs/progress.c:48 msgid "Average speed" msgstr "Gemiddelde spoed" -#: src/dialogs/progress.c:48 +#: src/dialogs/progress.c:49 msgid "average speed" msgstr "gemiddelde spoed" -#: src/dialogs/progress.c:49 +#: src/dialogs/progress.c:50 msgid "avg" msgstr "gem" -#: src/dialogs/progress.c:57 +#: src/dialogs/progress.c:58 msgid "current speed" msgstr "huidige spoed" -#: src/dialogs/progress.c:57 +#: src/dialogs/progress.c:58 msgid "cur" msgstr "tans" -#: src/dialogs/progress.c:64 +#: src/dialogs/progress.c:65 msgid "Elapsed time" msgstr "Tyd verby" -#: src/dialogs/progress.c:65 +#: src/dialogs/progress.c:66 msgid "elapsed time" msgstr "tyd verby" -#: src/dialogs/progress.c:66 +#: src/dialogs/progress.c:67 msgid "ETT" msgstr "" -#: src/dialogs/progress.c:72 +#: src/dialogs/progress.c:73 msgid "Speed" msgstr "Spoed" -#: src/dialogs/progress.c:72 +#: src/dialogs/progress.c:73 msgid "speed" msgstr "spoed" -#: src/dialogs/progress.c:82 +#: src/dialogs/progress.c:83 msgid "estimated time" msgstr "geskatte tyd" -#: src/dialogs/progress.c:83 +#: src/dialogs/progress.c:84 msgid "ETA" msgstr "" -#: src/dialogs/progress.c:96 +#: src/dialogs/progress.c:97 msgid "Sent" msgstr "" -#: src/dialogs/progress.c:103 +#: src/dialogs/progress.c:104 msgid "Received" msgstr "Het ontvang" @@ -5536,53 +5559,53 @@ msgid "" "html" msgstr "" -#: src/ecmascript/ecmascript.c:42 +#: src/ecmascript/ecmascript.c:43 msgid "ECMAScript options." msgstr "ECMAScript-keuses." -#: src/ecmascript/ecmascript.c:46 +#: src/ecmascript/ecmascript.c:47 msgid "Whether to run those scripts inside of documents." msgstr "" -#: src/ecmascript/ecmascript.c:48 +#: src/ecmascript/ecmascript.c:49 msgid "Script error reporting" msgstr "" -#: src/ecmascript/ecmascript.c:50 +#: src/ecmascript/ecmascript.c:51 msgid "Open a message box when a script reports an error." msgstr "" -#: src/ecmascript/ecmascript.c:52 +#: src/ecmascript/ecmascript.c:53 msgid "Ignore