5 Yes, there is some ECMAScript support in ELinks. There isn't anything we could
6 call complete, but some bits could help with the most common ECMAScript usage
7 cases - help you (and then us ;) get into your banking account, pass through
8 those ignorant page redirects done by JavaScript code snippets and so.
10 ELinks does not have own ECMAScript parser and compiler; instead it reuses
11 other people's work (this may eventually change, see the bottom of this file).
12 First we aimed at the NJS engine, which is easy to install, small and compact;
13 has nice naming scheme, horrible calling conventions and very lacking
14 documentation; is not actively developed; and generally looks broken and
15 extremely clumsy to work with. So we instead went the way of the SpiderMonkey
16 (SM) engine (property of Mozilla), which is hard to install, bigger (mind you,
17 it comes from Mozilla ;), has ugly naming scheme but nice calling conventions,
18 acceptable documentation, is actively developed and ought to work.
21 Ok, so how to get the ECMAScript support working?
22 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
24 Some systems come with either the SpiderMonkey installed or as an option. It
25 would be good to test if you can take the easy path and let the system take
26 care of installation through a package system. Below are listed instructions
27 on what package you need to install on various systems (please help improve
28 the list). If all goes well you can proceed to rebuilding ELinks.
30 On Debian testing or unstable, install the packages 'libsmjs1' and
31 'libsmjs-dev' by running:
33 $ apt-get install libsmjs1 libsmjs-dev
35 So, you need to get (and install) SpiderMonkey and then recompile your ELinks
36 (if you installed SM properly, ELinks should autodetect it during the
37 configure phase) and you are ready to fly.
39 Note that this procedure enables you to install SpiderMonkey, but in such a
40 way that it might not work with anything else but ELinks. It is unlikely that
41 anything else is ever going to use SpiderMonkey on your system, but if you
42 want to take the safe way, get SM and follow the instructions in
43 `src/README.html` instead. You will probably need to do some checkouting of
44 bits of the Mozilla CVS tree and so, have fun.
46 To get SpiderMonkey source, go at
47 link:ftp://ftp.mozilla.org/pub/mozilla.org/js/[] and fetch the newest `js-`
48 tarball there (`js-1.5-rc6a.tar.gz` at the time of writing this; you may try
49 the RPMs, but we didn't test them).
52 $ wget ftp://ftp.mozilla.org/pub/mozilla.org/js/js-1.5-rc6a.tar.gz
53 $ tar xvzf js-1.5-rc6a.tar.gz
55 Next, you need to patch it so that you will have any chance to install it as
56 you fetched it. Grab it in ELinks at `contrib/js-1.5-rc6a+elinks.patch` (if
57 you have a different version, still try to go ahead, you might have some
58 success), then go to the SpiderMonkey directory (called js) and apply it as
61 $ patch -p1 <../contrib/js-1.5-rc6a+elinks.patch
64 Now, edit config.mk and adjust the `$PREFIX` variable - you probably won't
65 like the default value - ELinks will find it there, but your dynamic linker
68 E.g., for /usr/local installation:
70 $ sed 's#^PREFIX = /opt/spidermonkey#PREFIX = /usr/local#' < config.mk > config.mk.t
71 $ mv -f config.mk.t config.mk
73 Now you can finally go for it:
75 $ make -f Makefile.ref
76 $ make -f Makefile.ref export
80 $ su -c 'make -f Makefile.ref install && (ldconfig -v | grep libjs)'
86 If all went well, you can proceed to rebuild ELinks now. If something broke,
87 see you on #elinks @ FreeNode or in the mailing list.
88 You may add your options to `./configure` as usual; SpiderMonkey should be
94 Check for "`Ecmascript .................... SpiderMonkey`" in Feature summary.
97 $ su -c 'make install'
102 The ECMAScript support is buggy! Shall I blame Mozilla people?
103 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
105 Likely not. The ECMAScript engine provides only the language compiler and some
106 basic built-in objects, and it's more than likely that the problem is on our
107 side in the implementation of some of the HTML/DOM objects (perhaps we just
108 haven't bothered to implement it at all yet). So better tell us first, and if
109 we think it's not our fault we will tell you to go complain to Mozilla (better
110 yet if it does not work in the Mozilla browsers neither ;-).
113 Now, I would still like NJS or a new JS engine from scratch...
114 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
116 ...and you don't fear some coding? That's fine then! ELinks is in no way tied
117 to SpiderMonkey, in fact the ECMAScript support was carefully implemented so
118 that there are no SpiderMonkey references outside of
119 `src/ecmascript/spidermonkey.*`. If you want to implement an alternative
120 ECMAScript backend, go ahead - you will just need to write an autoconf
121 detection for it and tie it to `src/ecmascript/ecmascript.c`, which should be
122 easy. We await your patches eagerly.