rkd77 / elinks

Fork of elinks
Other
335 stars 35 forks source link

Spidermonkey 1.8.5 is deprecated #29

Open aelmahmoudy opened 5 years ago

aelmahmoudy commented 5 years ago

Spidermonkey 1.8.5 has been removed from Debian, because it is unmaintained and has a security vulnerability. Could elinks migrate to mozjs-52 or mozjs-60 ?

rkd77 commented 5 years ago

I updated code to mozjs-17.0. Is this version maintained in Debian?

aelmahmoudy commented 5 years ago

Debian only has mozjs-52 & mozjs-60

-- ‎أحمد المحمودي (Ahmed El-Mahmoudy) Digital design engineer GPG KeyIDs: 4096R/A7EF5671 2048R/EDDDA1B7 GPG Fingerprints: 6E2E E4BB 72E2 F417 D066 6ABF 7B30 B496 A7EF 5761 8206 A196 2084 7E6D 0DF8 B176 BC19 6A94 EDDD A1B7

aelmahmoudy commented 5 years ago

I tried building that commit (after patching confgure.ac to use mozjs-52), but configure script reported that Spidermonkey is found but not usable.

-- ‎أحمد المحمودي (Ahmed El-Mahmoudy) Digital design engineer GPG KeyIDs: 4096R/A7EF5671 2048R/EDDDA1B7 GPG Fingerprints: 6E2E E4BB 72E2 F417 D066 6ABF 7B30 B496 A7EF 5761 8206 A196 2084 7E6D 0DF8 B176 BC19 6A94 EDDD A1B7

aelmahmoudy commented 5 years ago

I tried building that commit (after patching confgure.ac to use mozjs-52), but configure script reported that Spidermonkey is found but not usable.

configure:10096: checking for SpiderMonkey (mozjs-17.0) in pkg-config mozjs-52 configure:10122: gcc -o conftest -isystem /usr/include/mit-krb5 -g -O2 -fdebug-prefix-map=/home/m/mahmoudy/build-area/elinks-0.13~20190210=. -fstack-protector-strong -Wformat -Werror=format-security -Wall -include /usr/include/mozjs-52/js/RequiredDefines.h -I/usr/include/mozjs-52 -I/usr/include/nspr -Wdate-time -D_FORTIFY_SOURCE=2 -include /usr/include/mozjs-52/js/RequiredDefines.h -I/usr/include/mozjs-52 -I/usr/include/nspr -Wl,-z,relro -Wl,-z,now -Wl,-z,defs conftest.c -L/usr/lib/x86_64-linux-gnu/ -lmozjs-52 -L/usr/lib/x86_64-linux-gnu/mit-krb5 -Wl,-z,relro -lgssapi_krb5 -lkrb5 -lk5crypto -lcom_err -ldl -ltinfo -lz -lbz2 -lidn -llzma -lexpat >&5 In file included from /usr/include/mozjs-52/mozilla/Casting.h:12:0, from /usr/include/mozjs-52/mozilla/FloatingPoint.h:13, from /usr/include/mozjs-52/jsapi.h:12, from conftest.c:171: /usr/include/mozjs-52/mozilla/TypeTraits.h:19:1: error: unknown type name 'namespace' namespace mozilla { ^ /usr/include/mozjs-52/mozilla/TypeTraits.h:19:19: error: expected '=', ',', ';', 'asm' or 'attribute' before '{' token namespace mozilla { ^ In file included from /usr/include/mozjs-52/mozilla/FloatingPoint.h:13:0, from /usr/include/mozjs-52/jsapi.h:12, from conftest.c:171: /usr/include/mozjs-52/mozilla/Casting.h:16:1: error: unknown type name 'namespace' namespace mozilla { ^ /usr/include/mozjs-52/mozilla/Casting.h:16:19: error: expected '=', ',', ';', 'asm' or 'attribute' before '{' token namespace mozilla { ^ In file included from /usr/include/mozjs-52/jsapi.h:12:0, from conftest.c:171: /usr/include/mozjs-52/mozilla/FloatingPoint.h:16:1: error: unknown type name 'namespace' namespace mozilla { ^ /usr/include/mozjs-52/mozilla/FloatingPoint.h:16:19: error: expected '=', ',', ';', 'asm' or 'attribute' before '{' token namespace mozilla { ^ In file included from /usr/include/mozjs-52/jsapi.h:13:0, from conftest.c:171: /usr/include/mozjs-52/mozilla/RangedPtr.h:18:1: error: unknown type name 'namespace' namespace mozilla { ^ /usr/include/mozjs-52/mozilla/RangedPtr.h:18:19: error: expected '=', ',', ';', 'asm' or 'attribute' before '{' token namespace mozilla { ^ In file included from /usr/include/mozjs-52/jsapi.h:15:0, from conftest.c:171: /usr/include/mozjs-52/mozilla/ThreadLocal.h:32:1: error: unknown type name 'namespace' namespace mozilla { ^ /usr/include/mozjs-52/mozilla/ThreadLocal.h:32:19: error: expected '=', ',', ';', 'asm' or 'attribute' before '{' token namespace mozilla { ^ In file included from /usr/include/mozjs-52/js/Utility.h:13:0, from /usr/include/mozjs-52/jsalloc.h:10, from /usr/include/mozjs-52/jsapi.h:23, from conftest.c:171: /usr/include/mozjs-52/mozilla/Scoped.h:56:1: error: unknown type name 'namespace' namespace mozilla { ^ /usr/include/mozjs-52/mozilla/Scoped.h:56:19: error: expected '=', ',', ';', 'asm' or 'attribute' before '{' token namespace mozilla { ^ In file included from /usr/include/mozjs-52/js/Utility.h:25:0, from /usr/include/mozjs-52/jsalloc.h:10, from /usr/include/mozjs-52/jsapi.h:23, from conftest.c:171: /usr/include/mozjs-52/js/TemplateLib.h:19:1: error: unknown type name 'namespace' namespace js { ^ /usr/include/mozjs-52/js/TemplateLib.h:19:14: error: expected '=', ',', ';', 'asm' or 'attribute' before '{' token namespace js { ^ In file included from /usr/include/mozjs-52/jsalloc.h:10:0, from /usr/include/mozjs-52/jsapi.h:23, from conftest.c:171: /usr/include/mozjs-52/js/Utility.h:28:1: error: unknown type name 'namespace' namespace JS {} ^ /usr/include/mozjs-52/js/Utility.h:28:14: error: expected '=', ',', ';', 'asm' or 'attribute' before '{' token namespace JS {} ^ /usr/include/mozjs-52/js/Utility.h:31:1: error: unknown type name 'namespace' namespace mozilla {} ^ /usr/include/mozjs-52/js/Utility.h:31:19: error: expected '=', ',', ';', 'asm' or 'attribute' before '{' token namespace mozilla {} ^ /usr/include/mozjs-52/js/Utility.h:34:1: error: unknown type name 'namespace' namespace js {} ^ /usr/include/mozjs-52/js/Utility.h:34:14: error: expected '=', ',', ';', 'asm' or 'attribute' before '{' token namespace js {} ^ /usr/include/mozjs-52/js/Utility.h:163:24: error: conflicting types for 'js_calloc' static JS_INLINE void js_calloc(size_t nmemb, size_t size) ^ /usr/include/mozjs-52/js/Utility.h:157:24: note: previous definition of 'js_calloc' was here static JS_INLINE void js_calloc(size_t bytes) ^ /usr/include/mozjs-52/js/Utility.h:368:15: fatal error: new: No such file or directory

include

           ^
compilation terminated. configure:10122: $? = 1 configure: failed program was: / confdefs.h / #define PACKAGE_NAME "" #define PACKAGE_TARNAME "" #define PACKAGE_VERSION "" #define PACKAGE_STRING "" #define PACKAGE_BUGREPORT "" #define PACKAGE_URL "" #define PACKAGE "elinks" #define VERSION "0.13.GIT" #define STDC_HEADERS 1 #define HAVE_SYS_TYPES_H 1 #define HAVE_SYS_STAT_H 1 #define HAVE_STDLIB_H 1 #define HAVE_STRING_H 1 #define HAVE_MEMORY_H 1 #define HAVE_STRINGS_H 1 #define HAVE_INTTYPES_H 1 #define HAVE_STDINT_H 1 #define HAVE_UNISTD_H 1 #define EXTENSIONS 1 #define _ALL_SOURCE 1 #define _GNU_SOURCE 1 #define _POSIX_PTHREAD_SEMANTICS 1 #define _TANDEM_SOURCE 1 #define CONFIG_ASCIIDOC 1 #define MANUAL_ASCIIDOC 1 #define MAN_ASCIIDOC 1 #define CONFIG_XMLTO 1 #define MANUAL_XMLTO 1 #define MAN_XMLTO 1 #define CONFIG_JW 1 #define MANUAL_JW 1 #define CONFIG_POD2HTML 1 #define CONFIG_DOC 1 #define CONFIG_MANUAL 1 #define CONFIG_MANPAGE 1 #define CONFIG_OS_UNIX 1 #define HAVE_DIRENT_H 1 #define STDC_HEADERS 1 #define HAVE_SYS_WAIT_H 1 #define TIME_WITH_SYS_TIME 1 #define HAVE_WCHAR_H 1 #define HAVE_WCTYPE_H 1 #define HAVE_FCNTL_H 1 #define HAVE_LIMITS_H 1 #define HAVE_TIME_H 1 #define HAVE_UNISTD_H 1 #define HAVE_ARPA_INET_H 1 #define HAVE_NETINET_IN_SYSTM_H 1 #define HAVE_NETINET_IP_H 1 #define HAVE_NETDB_H 1 #define HAVE_NETINET_IN_H 1 #define HAVE_IFADDRS_H 1 #define HAVE_SYS_IOCTL_H 1 #define HAVE_SYS_RESOURCE_H 1 #define HAVE_SYS_SELECT_H 1 #define HAVE_SYS_SOCKET_H 1 #define HAVE_SYS_TIME_H 1 #define HAVE_SYS_UTSNAME_H 1 #define HAVE_NET_IF_H 1 #define HAVE_STDINT_H 1 #define HAVE_INTTYPES_H 1 #define HAVE_LOCALE_H 1 #define HAVE_PWD_H 1 #define HAVE_TERMIOS_H 1 #define HAVE_POLL_H 1 #define HAVE_SYS_UN_H 1 #define CONFIG_INTERLINK 1 #define NONSTATIC_INLINE inline #define HAVE_TYPEOF 1 #define HAVE_LONG_LONG 1 #define HAVE_OFF_T 1 #define HAVE_INT32_T 1 #define HAVE_UINT32_T 1 #define HAVE_UINT16_T 1 #define SIZEOF_CHAR 1 #define SIZEOF_SHORT 2 #define SIZEOF_INT 4 #define SIZEOF_LONG 8 #define SIZEOF_LONG_LONG 8 #define SIZEOF_OFF_T 8 #define HAVE_VARIADIC_MACROS 1 #define HAVE_STDLIB_H 1 #define HAVE_UNISTD_H 1 #define HAVE_SYS_PARAM_H 1 #define HAVE_GETPAGESIZE 1 #define HAVE_MMAP 1 #define HAVE_STRFTIME 1 #define HAVE_STRPTIME 1 #define HAVE_ATOLL 1 #define HAVE_GETHOSTBYADDR 1 #define HAVE_HERROR 1 #define HAVE_STRERROR 1 #define HAVE_POPEN 1 #define HAVE_UNAME 1 #define HAVE_ACCESS 1 #define HAVE_CHMOD 1 #define HAVE_ALARM 1 #define HAVE_TIMEGM 1 #define HAVE_MREMAP 1 #define HAVE_STRCASECMP 1 #define HAVE_STRNCASECMP 1 #define HAVE_STRCASESTR 1 #define HAVE_STRSTR 1 #define HAVE_STRCHR 1 #define HAVE_STRRCHR 1 #define HAVE_MEMMOVE 1 #define HAVE_BCOPY 1 #define HAVE_STPCPY 1 #define HAVE_STRDUP 1 #define HAVE_INDEX 1 #define HAVE_ISDIGIT 1 #define HAVE_MEMPCPY 1 #define HAVE_MEMRCHR 1 #define HAVE_SNPRINTF 1 #define HAVE_VSNPRINTF 1 #define HAVE_ASPRINTF 1 #define HAVE_VASPRINTF 1 #define HAVE_GETIFADDRS 1 #define HAVE_GETPWNAM 1 #define HAVE_INET_PTON 1 #define HAVE_INET_NTOP 1 #define HAVE_FFLUSH 1 #define HAVE_FSYNC 1 #define HAVE_FSEEKO 1 #define HAVE_FTELLO 1 #define HAVE_SIGACTION 1 #define HAVE_GETTIMEOFDAY 1 #define HAVE_CLOCK_GETTIME 1 #define HAVE_SETITIMER 1 #define HAVE_SETENV 1 #define HAVE_PUTENV 1 #define HAVE_UNSETENV 1 #define HAVE_GETUID 1 #define HAVE_GETEUID 1 #define HAVE_WCWIDTH 1 #define HAVE_FORK 1 #define HAVE_GETPID 1 #define HAVE_SETPGID 1 #define HAVE_GETPGID 1 #define HAVE_SETPGRP 1 #define HAVE_GETPGRP 1 #define HAVE_RAISE 1 #define HAVE_KILL 1 #define HAVE_FPATHCONF 1 #define HAVE_POLL 1 #define HAVE_SC_PAGE_SIZE 1 #define HAVE_C99_VSNPRINTF 1 #define HAVE_LIBDL 1 #define HAVE_TERM_H 1 #define CONFIG_TERMINFO 1 #define HAVE_ZLIB_H 1 #define CONFIG_GZIP 1 #define HAVE_BZLIB_H 1 #define CONFIG_BZIP2 1 #define HAVE_IDNA_H 1 #define CONFIG_IDN 1 #define HAVE_LZMA_H 1 #define CONFIG_LZMA 1 #define CONFIG_GSSAPI 1 #define CONFIG_BOOKMARKS 1 #define HAVE_EXPAT_H 1 #define CONFIG_XBEL_BOOKMARKS 1 / end confdefs.h. /
/* mozilla-js.pc may have -DXP_UNIX or similar in Cflags.
Avoid warnings about conflicting definitions. /
#if !defined(XP_BEOS) && !defined(XP_OS2) && !defined(XP_UNIX) && !defined(XP_WIN)
# define XP_UNIX 1
#endif
#include
int
main ()
{
;
return 0;
}

configure:10128: result: found but unusable

-- ‎أحمد المحمودي (Ahmed El-Mahmoudy) Digital design engineer GPG KeyIDs: 4096R/A7EF5671 2048R/EDDDA1B7 GPG Fingerprints: 6E2E E4BB 72E2 F417 D066 6ABF 7B30 B496 A7EF 5761 8206 A196 2084 7E6D 0DF8 B176 BC19 6A94 EDDD A1B7

aelmahmoudy commented 5 years ago

I patched configure.ac by inserting: AC_LANG_PUSH([C++]) [...] AC_LANG_POP([C++]) around the AC_LINK test, and it passed. Yet the build failed, since the code is in C and the mozjs lib is using C++ constructs.

-- ‎أحمد المحمودي (Ahmed El-Mahmoudy) Digital design engineer GPG KeyIDs: 4096R/A7EF5671 2048R/EDDDA1B7 GPG Fingerprints: 6E2E E4BB 72E2 F417 D066 6ABF 7B30 B496 A7EF 5761 8206 A196 2084 7E6D 0DF8 B176 BC19 6A94 EDDD A1B7

aelmahmoudy commented 4 years ago

Couldn't this be done by adding a C wrapper around mozjs library instead of converting elinks' complete code to C++ ?

rkd77 commented 4 years ago

I don't know C++ nor SpiderMonkey. In the future it is possible, but not now.

doughdemon commented 4 years ago

I'm looking into porting to newer versions of SpiderMonkey by compiling only the src/ecmascript and src/scripting/smjs directories with C++. This might work, though is not completely ideal because the mixture of C and C++ produces many type conversion warnings.

rkd77 commented 4 years ago

I would rather switch to QuickJS . It is C and has smaller memory footprint, but first I want to finish libdom "migration". I stopped on tables. JS is rather next year, not now.

doughdemon commented 4 years ago

I would rather switch to QuickJS . It is C and has smaller memory footprint, but first I want to finish libdom "migration". I stopped on tables. JS is rather next year, not now.

I see, that makes sense. (QuickJS does look similar to old Spidermonkey.)

aelmahmoudy commented 4 years ago

Unfortunately QuickJS is not available on Debian

niutech commented 3 years ago

Can't you use the Mozjs C API?

rkd77 commented 3 years ago

I spent too much time on SpiderMonkey to give up now. It compiles with mozjs52, but segfaults. I have no idea yet, how to resolve it. If you know, please write it here, or prepare a patch. Usually it related to threads. js::PerThreadData::runtimeFromMainThread (this=0x0) or JS_AbortIfWrongThread(cx).

niutech commented 2 years ago

According to the NEWS file, elinks 0.15.0 now uses mozjs78-dev or QuickJS-2021-03-27 for ECMAScript support. So can we close this issue?

doughdemon commented 2 years ago

sounds good to me.

MagicalDrizzle commented 2 years ago

so currently you have to use mozjs78 correct? cause if yes then I wasted way too much time compiling mozjs17 oops

rkd77 commented 2 years ago

yes, either mozjs78 or quickjs, but do not expect too much.

raekuul commented 2 years ago

just as a heads-up: I had installed libmozjs-78-dev on a Debian Testing system and it was not detected by the configure script. The same system also has libmozjs-91-dev installed so it might be a package conflict.

rkd77 commented 2 years ago

You need also libsqlite3-dev and libxml++5.0.1.GIT or higher. I doubt libmozjs-91-dev has any influence on build process. And add CC=g++ to ./configure invocation. meson builds are faster.

holtzermann17 commented 1 year ago

Hi, just to update: I got it to build with recent libmozjs (revising to package=mozjs-102 in the configure file). I had to bring in some dependencies like this:

PKG_CONFIG_PATH="/opt/netsurf/pkgconfig:/opt/netsurf/inst-gtk2/lib/pkgconfig/" ./configure --with-spidermonkey --enable-256-colors

Configure reports:

...
checking for SpiderMonkey (mozjs-102) in pkg-config mozjs-102... yes
...
ECMAScript (JavaScript) ......... SpiderMonkey document scripting
...

The build completes successfully. However, even though I have the ECMAScript option turned on in elinks, when I go to https://www.whatismybrowser.com/detect/is-javascript-enabled, it tells me that it's not enabled.

Edit: I tried with quickjs instead, and still the site didn't detect Javascript enabled!

rkd77 commented 1 year ago

Besides examples in test directory, none of real scripts are operational. I want to "migrate" from libxml++ to libdom first, to be able to copy more code from netsurf. Progress is slow. js is postponed. The plan is to gradually make to work some scripts like a js terminal emulator, searching in Python docs, and playable tetris, but the first milestone I want to achieve is functional background colors in documents.

andrewp907 commented 9 months ago

What is the current status of enabling JavaScript support on elinks on Debian?