forked from pool/elinks
Accepting request 124374 from home:adra:branches:network
Updated License to GPL-2.0, Added some patches to support js-1.8.5, lua-5.1 and to fix compilation, Added/Removed/Fixed some build dependencies, Make the package provide web_browser, Enabled some additional build options OBS-URL: https://build.opensuse.org/request/show/124374 OBS-URL: https://build.opensuse.org/package/show/network/elinks?expand=0&rev=3
This commit is contained in:
parent
c81ccf2280
commit
e8f0ff71e3
12
elinks-0.12_pre5-compilation-fix.patch
Normal file
12
elinks-0.12_pre5-compilation-fix.patch
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
diff -Naurp elinks-0.12pre5-orig//src/intl/charsets.c elinks-0.12pre5/src/intl/charsets.c
|
||||||
|
--- elinks-0.12pre5-orig//src/intl/charsets.c 2010-04-04 12:19:02.000000000 +0200
|
||||||
|
+++ elinks-0.12pre5/src/intl/charsets.c 2010-04-04 12:19:20.000000000 +0200
|
||||||
|
@@ -821,7 +821,7 @@ free_utf_table(void)
|
||||||
|
|
||||||
|
/* Cast away const. */
|
||||||
|
for (i = 128; i < 256; i++)
|
||||||
|
- mem_free((unsigned char *) utf_table[i].u.str);
|
||||||
|
+ mem_free(utf_table[i].u.str);
|
||||||
|
}
|
||||||
|
|
||||||
|
static struct conv_table *
|
376
elinks-0.12_pre5-js185-1-heartbeat.patch
Normal file
376
elinks-0.12_pre5-js185-1-heartbeat.patch
Normal file
@ -0,0 +1,376 @@
|
|||||||
|
From a3f59264b9504e8bf3d0ac70b99a237bc964089d Mon Sep 17 00:00:00 2001
|
||||||
|
From: Miciah Dashiel Butler Masters <miciah.masters@gmail.com>
|
||||||
|
Date: Sat, 18 Jul 2009 23:41:01 +0000
|
||||||
|
Subject: [PATCH 1/3] Heartbeat code using JS_TriggerOperationCallback
|
||||||
|
|
||||||
|
Implement new heartbeat code to catch runaway execution of document
|
||||||
|
ECMAScript code. The old code uses JS_SetBranchCallback which is
|
||||||
|
deprecated in new versions of SpiderMonkey. The new code uses setitimer(2)
|
||||||
|
and the JS_SetOperationCallback and JS_TriggerOperationCallback interfaces,
|
||||||
|
introduced in SpiderMonkey 1.8.1. Compatibility with both the old
|
||||||
|
JS_SetBranchCallback and the new interfaces is maintained.
|
||||||
|
|
||||||
|
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
|
||||||
|
---
|
||||||
|
Makefile.config.in | 1 +
|
||||||
|
configure.in | 12 +++
|
||||||
|
src/ecmascript/ecmascript.h | 4 +
|
||||||
|
src/ecmascript/spidermonkey.c | 38 ++++++++-
|
||||||
|
src/ecmascript/spidermonkey/Makefile | 2 +
|
||||||
|
src/ecmascript/spidermonkey/heartbeat.c | 125 +++++++++++++++++++++++++++++++
|
||||||
|
src/ecmascript/spidermonkey/heartbeat.h | 24 ++++++
|
||||||
|
7 files changed, 201 insertions(+), 5 deletions(-)
|
||||||
|
create mode 100644 src/ecmascript/spidermonkey/heartbeat.c
|
||||||
|
create mode 100644 src/ecmascript/spidermonkey/heartbeat.h
|
||||||
|
|
||||||
|
diff --git a/Makefile.config.in b/Makefile.config.in
|
||||||
|
index c463868..40a8cd7 100644
|
||||||
|
--- a/Makefile.config.in
|
||||||
|
+++ b/Makefile.config.in
|
||||||
|
@@ -117,6 +117,7 @@ CONFIG_DOM = @CONFIG_DOM@
|
||||||
|
CONFIG_ECMASCRIPT = @CONFIG_ECMASCRIPT@
|
||||||
|
CONFIG_ECMASCRIPT_SEE = @CONFIG_ECMASCRIPT_SEE@
|
||||||
|
CONFIG_ECMASCRIPT_SMJS = @CONFIG_ECMASCRIPT_SMJS@
|
||||||
|
+CONFIG_ECMASCRIPT_SMJS_HEARTBEAT = @CONFIG_ECMASCRIPT_SMJS@
|
||||||
|
CONFIG_EXMODE = @CONFIG_EXMODE@
|
||||||
|
CONFIG_FASTMEM = @CONFIG_FASTMEM@
|
||||||
|
CONFIG_FINGER = @CONFIG_FINGER@
|
||||||
|
diff --git a/configure.in b/configure.in
|
||||||
|
index f3e3d77..f79ca78 100644
|
||||||
|
--- a/configure.in
|
||||||
|
+++ b/configure.in
|
||||||
|
@@ -283,6 +283,7 @@ AC_CHECK_FUNCS(snprintf vsnprintf asprintf vasprintf)
|
||||||
|
AC_CHECK_FUNCS(getifaddrs getpwnam inet_pton inet_ntop)
|
||||||
|
AC_CHECK_FUNCS(fflush fsync fseeko ftello sigaction)
|
||||||
|
AC_CHECK_FUNCS(gettimeofday clock_gettime)
|
||||||
|
+AC_CHECK_FUNCS(setitimer, HAVE_SETITIMER=yes)
|
||||||
|
|
||||||
|
AC_CHECK_FUNCS([cygwin_conv_to_full_win32_path])
|
||||||
|
|
||||||
|
@@ -651,6 +652,8 @@ AC_MSG_RESULT($cf_result)
|
||||||
|
CONFIG_SPIDERMONKEY="$cf_result"
|
||||||
|
if test "$cf_result" = "yes"; then
|
||||||
|
AC_CHECK_FUNCS([[JS_ReportAllocationOverflow]])
|
||||||
|
+ AC_CHECK_FUNCS(JS_SetBranchCallback)
|
||||||
|
+ AC_CHECK_FUNCS(JS_TriggerOperationCallback, HAVE_JS_TRIGGEROPERATIONCALLBACK=yes)
|
||||||
|
fi
|
||||||
|
EL_RESTORE_FLAGS
|
||||||
|
|
||||||
|
@@ -665,6 +668,15 @@ EL_CONFIG_DEPENDS(CONFIG_ECMASCRIPT, [CONFIG_ECMASCRIPT_SEE CONFIG_ECMASCRIPT_SM
|
||||||
|
AC_SUBST(CONFIG_ECMASCRIPT_SEE)
|
||||||
|
AC_SUBST(CONFIG_ECMASCRIPT_SMJS)
|
||||||
|
|
||||||
|
+if test "x$CONFIG_ECMASCRIPT_SMJS" = xyes &&
|
||||||
|
+ test "x$HAVE_JS_TRIGGEROPERATIONCALLBACK" = xyes &&
|
||||||
|
+ test "x$HAVE_SETITIMER" = xyes; then
|
||||||
|
+ EL_CONFIG(CONFIG_ECMASCRIPT_SMJS_HEARTBEAT, [ECMAScript heartbeat support])
|
||||||
|
+else
|
||||||
|
+ CONFIG_ECMASCRIPT_SMJS_HEARTBEAT=no
|
||||||
|
+fi
|
||||||
|
+AC_SUBST(CONFIG_ECMASCRIPT_SMJS_HEARTBEAT)
|
||||||
|
+
|
||||||
|
|
||||||
|
# ===================================================================
|
||||||
|
# Optional Spidermonkey-based ECMAScript browser scripting
|
||||||
|
diff --git a/src/ecmascript/ecmascript.h b/src/ecmascript/ecmascript.h
|
||||||
|
index e8d84b5..8613b34 100644
|
||||||
|
--- a/src/ecmascript/ecmascript.h
|
||||||
|
+++ b/src/ecmascript/ecmascript.h
|
||||||
|
@@ -32,7 +32,11 @@ 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/spidermonkey.c b/src/ecmascript/spidermonkey.c
|
||||||
|
index 78c3bca..16fb0a4 100644
|
||||||
|
--- a/src/ecmascript/spidermonkey.c
|
||||||
|
+++ b/src/ecmascript/spidermonkey.c
|
||||||
|
@@ -25,6 +25,7 @@
|
||||||
|
#include "ecmascript/spidermonkey.h"
|
||||||
|
#include "ecmascript/spidermonkey/document.h"
|
||||||
|
#include "ecmascript/spidermonkey/form.h"
|
||||||
|
+#include "ecmascript/spidermonkey/heartbeat.h"
|
||||||
|
#include "ecmascript/spidermonkey/location.h"
|
||||||
|
#include "ecmascript/spidermonkey/navigator.h"
|
||||||
|
#include "ecmascript/spidermonkey/unibar.h"
|
||||||
|
@@ -109,6 +110,7 @@ reported:
|
||||||
|
JS_ClearPendingException(ctx);
|
||||||
|
}
|
||||||
|
|
||||||
|
+#if !defined(CONFIG_ECMASCRIPT_SMJS_HEARTBEAT) && defined(HAVE_JS_SETBRANCHCALLBACK)
|
||||||
|
static JSBool
|
||||||
|
safeguard(JSContext *ctx, JSScript *script)
|
||||||
|
{
|
||||||
|
@@ -132,6 +134,7 @@ setup_safeguard(struct ecmascript_interpreter *interpreter,
|
||||||
|
interpreter->exec_start = time(NULL);
|
||||||
|
JS_SetBranchCallback(ctx, safeguard);
|
||||||
|
}
|
||||||
|
+#endif
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
@@ -172,6 +175,9 @@ spidermonkey_get_interpreter(struct ecmascript_interpreter *interpreter)
|
||||||
|
* some kind of bytecode cache. (If we will ever do that.) */
|
||||||
|
JS_SetOptions(ctx, JSOPTION_VAROBJFIX | JSOPTION_COMPILE_N_GO);
|
||||||
|
JS_SetErrorReporter(ctx, error_reporter);
|
||||||
|
+#if defined(CONFIG_ECMASCRIPT_SMJS_HEARTBEAT)
|
||||||
|
+ JS_SetOperationCallback(ctx, heartbeat_callback);
|
||||||
|
+#endif
|
||||||
|
|
||||||
|
window_obj = JS_NewObject(ctx, (JSClass *) &window_class, NULL, NULL);
|
||||||
|
if (!window_obj) goto release_and_fail;
|
||||||
|
@@ -263,10 +269,17 @@ spidermonkey_eval(struct ecmascript_interpreter *interpreter,
|
||||||
|
assert(interpreter);
|
||||||
|
if (!js_module_init_ok) return;
|
||||||
|
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),
|
||||||
|
code->source, code->length, "", 0, &rval);
|
||||||
|
+#if defined(CONFIG_ECMASCRIPT_SMJS_HEARTBEAT)
|
||||||
|
+ done_heartbeat(interpreter->heartbeat);
|
||||||
|
+#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -274,17 +287,25 @@ unsigned char *
|
||||||
|
spidermonkey_eval_stringback(struct ecmascript_interpreter *interpreter,
|
||||||
|
struct string *code)
|
||||||
|
{
|
||||||
|
+ JSBool ret;
|
||||||
|
JSContext *ctx;
|
||||||
|
jsval rval;
|
||||||
|
|
||||||
|
assert(interpreter);
|
||||||
|
if (!js_module_init_ok) return NULL;
|
||||||
|
ctx = interpreter->backend_data;
|
||||||
|
- setup_safeguard(interpreter, ctx);
|
||||||
|
interpreter->ret = NULL;
|
||||||
|
- if (JS_EvaluateScript(ctx, JS_GetGlobalObject(ctx),
|
||||||
|
- code->source, code->length, "", 0, &rval)
|
||||||
|
- == JS_FALSE) {
|
||||||
|
+#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),
|
||||||
|
+ code->source, code->length, "", 0, &rval);
|
||||||
|
+#if defined(CONFIG_ECMASCRIPT_SMJS_HEARTBEAT)
|
||||||
|
+ done_heartbeat(interpreter->heartbeat);
|
||||||
|
+#endif
|
||||||
|
+ if (ret == JS_FALSE) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
if (JSVAL_IS_VOID(rval)) {
|
||||||
|
@@ -308,14 +329,21 @@ spidermonkey_eval_boolback(struct ecmascript_interpreter *interpreter,
|
||||||
|
assert(interpreter);
|
||||||
|
if (!js_module_init_ok) return 0;
|
||||||
|
ctx = interpreter->backend_data;
|
||||||
|
- setup_safeguard(interpreter, ctx);
|
||||||
|
interpreter->ret = NULL;
|
||||||
|
fun = JS_CompileFunction(ctx, NULL, "", 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, NULL, fun, 0, NULL, &rval);
|
||||||
|
+#if defined(CONFIG_ECMASCRIPT_SMJS_HEARTBEAT)
|
||||||
|
+ 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 f1c0fef..377ca80 100644
|
||||||
|
--- a/src/ecmascript/spidermonkey/Makefile
|
||||||
|
+++ b/src/ecmascript/spidermonkey/Makefile
|
||||||
|
@@ -2,6 +2,8 @@ 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
|
||||||
|
|
||||||
|
include $(top_srcdir)/Makefile.lib
|
||||||
|
diff --git a/src/ecmascript/spidermonkey/heartbeat.c b/src/ecmascript/spidermonkey/heartbeat.c
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000..bf95d92
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/src/ecmascript/spidermonkey/heartbeat.c
|
||||||
|
@@ -0,0 +1,125 @@
|
||||||
|
+/* The SpiderMonkey ECMAScript backend heartbeat fuctionality. */
|
||||||
|
+
|
||||||
|
+#ifdef HAVE_CONFIG_H
|
||||||
|
+#include "config.h"
|
||||||
|
+#endif
|
||||||
|
+
|
||||||
|
+#include <sys/time.h> /* setitimer(2) */
|
||||||
|
+
|
||||||
|
+#include "elinks.h"
|
||||||
|
+
|
||||||
|
+#include "ecmascript/spidermonkey/util.h"
|
||||||
|
+
|
||||||
|
+#include "config/options.h"
|
||||||
|
+#include "document/view.h"
|
||||||
|
+#include "ecmascript/ecmascript.h"
|
||||||
|
+#include "ecmascript/spidermonkey.h"
|
||||||
|
+#include "ecmascript/spidermonkey/heartbeat.h"
|
||||||
|
+#include "osdep/signals.h"
|
||||||
|
+#include "session/session.h"
|
||||||
|
+#include "util/lists.h"
|
||||||
|
+#include "util/math.h" /* int_upper_bound */
|
||||||
|
+#include "util/memory.h"
|
||||||
|
+#include "viewer/text/vs.h"
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+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
|
||||||
|
+heartbeat_callback(JSContext *ctx)
|
||||||
|
+{
|
||||||
|
+ return JS_FALSE;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+/* Callback for SIGVTALRM. Go through all heartbeats, decrease each
|
||||||
|
+ * one's TTL, and call JS_TriggerOperationCallback if a heartbeat's TTL
|
||||||
|
+ * goes to 0. */
|
||||||
|
+static void
|
||||||
|
+check_heartbeats(void *data)
|
||||||
|
+{
|
||||||
|
+ struct heartbeat *hb;
|
||||||
|
+
|
||||||
|
+ foreach (hb, heartbeats) {
|
||||||
|
+ assert(hb->interpreter);
|
||||||
|
+
|
||||||
|
+ --hb->ttl;
|
||||||
|
+
|
||||||
|
+ if (hb->ttl <= 0) {
|
||||||
|
+ if (hb->interpreter->vs
|
||||||
|
+ && hb->interpreter->vs->doc_view
|
||||||
|
+ && hb->interpreter->vs->doc_view->session
|
||||||
|
+ && hb->interpreter->vs->doc_view->session->tab
|
||||||
|
+ && hb->interpreter->vs->doc_view->session->tab->term) {
|
||||||
|
+ struct session *ses = hb->interpreter->vs->doc_view->session;
|
||||||
|
+ struct terminal *term = ses->tab->term;
|
||||||
|
+ int max_exec_time = get_opt_int("ecmascript.max_exec_time");
|
||||||
|
+
|
||||||
|
+ ecmascript_timeout_dialog(term, max_exec_time);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ JS_TriggerOperationCallback(hb->interpreter->backend_data);
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ install_signal_handler(SIGVTALRM, check_heartbeats, NULL, 1);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+/* Create a new heartbeat for the given interpreter. */
|
||||||
|
+struct heartbeat *
|
||||||
|
+add_heartbeat(struct ecmascript_interpreter *interpreter)
|
||||||
|
+{
|
||||||
|
+ struct session *ses;
|
||||||
|
+ struct heartbeat *hb;
|
||||||
|
+
|
||||||
|
+ assert(interpreter);
|
||||||
|
+
|
||||||
|
+ if (!interpreter->vs || !interpreter->vs->doc_view)
|
||||||
|
+ ses = NULL;
|
||||||
|
+ else
|
||||||
|
+ ses = interpreter->vs->doc_view->session;
|
||||||
|
+
|
||||||
|
+ hb = mem_alloc(sizeof(struct heartbeat));
|
||||||
|
+ if (!hb) return NULL;
|
||||||
|
+
|
||||||
|
+ hb->ttl = get_opt_int("ecmascript.max_exec_time");
|
||||||
|
+ hb->interpreter = interpreter;
|
||||||
|
+
|
||||||
|
+ add_to_list(heartbeats, hb);
|
||||||
|
+
|
||||||
|
+ /* Update the heartbeat timer. */
|
||||||
|
+ if (list_is_singleton(*hb)) {
|
||||||
|
+ heartbeat_timer.it_value.tv_sec = 1;
|
||||||
|
+ setitimer(ITIMER_VIRTUAL, &heartbeat_timer, NULL);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ /* We install the handler every call to add_heartbeat instead of only on
|
||||||
|
+ * module initialisation because other code may set other handlers for
|
||||||
|
+ * the signal. */
|
||||||
|
+ install_signal_handler(SIGVTALRM, check_heartbeats, NULL, 1);
|
||||||
|
+
|
||||||
|
+ return hb;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+/* Destroy the given heartbeat. */
|
||||||
|
+void
|
||||||
|
+done_heartbeat(struct heartbeat *hb)
|
||||||
|
+{
|
||||||
|
+ assert(hb->interpreter);
|
||||||
|
+
|
||||||
|
+ /* Stop the heartbeat timer if this heartbeat is the only one. */
|
||||||
|
+ if (list_is_singleton(*hb)) {
|
||||||
|
+ heartbeat_timer.it_value.tv_sec = 0;
|
||||||
|
+ setitimer(ITIMER_VIRTUAL, &heartbeat_timer, NULL);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ del_from_list(hb);
|
||||||
|
+ hb->interpreter->heartbeat = NULL;
|
||||||
|
+ mem_free(hb);
|
||||||
|
+}
|
||||||
|
diff --git a/src/ecmascript/spidermonkey/heartbeat.h b/src/ecmascript/spidermonkey/heartbeat.h
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000..f7c8b12
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/src/ecmascript/spidermonkey/heartbeat.h
|
||||||
|
@@ -0,0 +1,24 @@
|
||||||
|
+#ifndef EL__ECMASCRIPT_SPIDERMONKEY_HEARTBEAT_H
|
||||||
|
+#define EL__ECMASCRIPT_SPIDERMONKEY_HEARTBEAT_H
|
||||||
|
+
|
||||||
|
+#include "ecmascript/spidermonkey/util.h"
|
||||||
|
+
|
||||||
|
+#include "ecmascript/spidermonkey.h"
|
||||||
|
+
|
||||||
|
+struct heartbeat {
|
||||||
|
+ LIST_HEAD(struct heartbeat);
|
||||||
|
+
|
||||||
|
+ int ttl; /* Time to live. This value is assigned when the
|
||||||
|
+ * script begins execution and is decremented every
|
||||||
|
+ * second. When it reaches 0, script execution is
|
||||||
|
+ * terminated. */
|
||||||
|
+
|
||||||
|
+ struct ecmascript_interpreter *interpreter;
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+struct heartbeat *add_heartbeat(struct ecmascript_interpreter *interpreter);
|
||||||
|
+void done_heartbeat(struct heartbeat *hb);
|
||||||
|
+
|
||||||
|
+JSBool heartbeat_callback(JSContext *ctx);
|
||||||
|
+
|
||||||
|
+#endif
|
||||||
|
--
|
||||||
|
1.7.4.2
|
||||||
|
|
1900
elinks-0.12_pre5-js185-2-up.patch
Normal file
1900
elinks-0.12_pre5-js185-2-up.patch
Normal file
File diff suppressed because it is too large
Load Diff
57
elinks-0.12_pre5-js185-3-histback.patch
Normal file
57
elinks-0.12_pre5-js185-3-histback.patch
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
From 32109054ce40067b8c55837fb69f1bc1249e38fd Mon Sep 17 00:00:00 2001
|
||||||
|
From: witekfl <witekfl@poczta.onet.pl>
|
||||||
|
Date: Mon, 25 Apr 2011 21:04:03 +0200
|
||||||
|
Subject: [PATCH 3/3] SpiderMonkey: fix issue with javascript:history.back()
|
||||||
|
|
||||||
|
In history.back() and others set rval to NULL.
|
||||||
|
Do not convert NULL to string in spidermoney_eval_stringback.
|
||||||
|
|
||||||
|
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
|
||||||
|
---
|
||||||
|
src/ecmascript/spidermonkey.c | 2 +-
|
||||||
|
src/ecmascript/spidermonkey/location.c | 3 +++
|
||||||
|
2 files changed, 4 insertions(+), 1 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/ecmascript/spidermonkey.c b/src/ecmascript/spidermonkey.c
|
||||||
|
index 021e6bd..5360455 100644
|
||||||
|
--- a/src/ecmascript/spidermonkey.c
|
||||||
|
+++ b/src/ecmascript/spidermonkey.c
|
||||||
|
@@ -303,7 +303,7 @@ spidermonkey_eval_stringback(struct ecmascript_interpreter *interpreter,
|
||||||
|
if (ret == JS_FALSE) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
- if (JSVAL_IS_VOID(rval)) {
|
||||||
|
+ if (JSVAL_IS_VOID(rval) || JSVAL_IS_NULL(rval)) {
|
||||||
|
/* Undefined value. */
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
diff --git a/src/ecmascript/spidermonkey/location.c b/src/ecmascript/spidermonkey/location.c
|
||||||
|
index 752a890..d1fbdfb 100644
|
||||||
|
--- a/src/ecmascript/spidermonkey/location.c
|
||||||
|
+++ b/src/ecmascript/spidermonkey/location.c
|
||||||
|
@@ -78,6 +78,7 @@ history_back(JSContext *ctx, uintN argc, jsval *rval)
|
||||||
|
* and return non zero for <a href="javascript:history.back()"> to prevent
|
||||||
|
* "calculating" new link. Returned value 2 is changed to 0 in function
|
||||||
|
* spidermonkey_eval_boolback */
|
||||||
|
+ JS_SET_RVAL(ctx, rval, JSVAL_NULL);
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -91,6 +92,7 @@ history_forward(JSContext *ctx, uintN argc, jsval *rval)
|
||||||
|
|
||||||
|
go_unback(ses);
|
||||||
|
|
||||||
|
+ JS_SET_RVAL(ctx, rval, JSVAL_NULL);
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -121,6 +123,7 @@ history_go(JSContext *ctx, uintN argc, jsval *rval)
|
||||||
|
index += index > 0 ? -1 : 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
+ JS_SET_RVAL(ctx, rval, JSVAL_NULL);
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
--
|
||||||
|
1.7.4.4
|
@ -1,3 +1,30 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Sun Jun 10 17:19:18 UTC 2012 - asterios.dramis@gmail.com
|
||||||
|
|
||||||
|
- Updated License to GPL-2.0.
|
||||||
|
- Added the following patches:
|
||||||
|
* elinks-0.12_pre5-js185-1-heartbeat.patch,
|
||||||
|
elinks-0.12_pre5-js185-2-up.patch,
|
||||||
|
elinks-0.12_pre5-js185-3-histback.patch: Support for new js-1.8.5
|
||||||
|
* elinks-0.12_pre5-compilation-fix.patch: Fix compilation with gc
|
||||||
|
* use_lua-5.1.patch: Support for lua-5.1
|
||||||
|
- Added automake in BuildRequires in order to regenerate the build system
|
||||||
|
because of patches modifying configure.in.
|
||||||
|
- Corrected gmp-devel build dependency to gpm-devel.
|
||||||
|
- Removed guile-devel build dependency (wasn't used anyway and the support is
|
||||||
|
expiremental).
|
||||||
|
- Removed python-devel build dependency since the support is expiremental.
|
||||||
|
- Use ruby-devel only in openSUSE <= 12.1 since it fails with ruby 1.9 from
|
||||||
|
Factory.
|
||||||
|
- Added the following build dependencies that can be used by the package:
|
||||||
|
gc-devel (for openSUSE > 11.4), js-devel (for openSUSE > 11.4), krb5-devel,
|
||||||
|
lua*-devel, pkg-config and tre-devel.
|
||||||
|
- Make the package provide "web_browser", similar to other web browser
|
||||||
|
packages.
|
||||||
|
- Removed build time references so build-compare can do its work.
|
||||||
|
- Enabled the following build options: true-color and fastmem.
|
||||||
|
- Install documentation only for the scripting languages that are compiled.
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Fri Jun 10 12:54:28 UTC 2011 - lijewski.stefan@gmail.com
|
Fri Jun 10 12:54:28 UTC 2011 - lijewski.stefan@gmail.com
|
||||||
|
|
||||||
|
175
elinks.spec
175
elinks.spec
@ -1,27 +1,67 @@
|
|||||||
#
|
#
|
||||||
|
# spec file for package elinks
|
||||||
|
#
|
||||||
|
# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany.
|
||||||
|
#
|
||||||
|
# All modifications and additions to the file contributed by third parties
|
||||||
|
# remain the property of their copyright owners, unless otherwise agreed
|
||||||
|
# upon. The license for this file, and modifications and additions to the
|
||||||
|
# file, is the same license as for the pristine package itself (unless the
|
||||||
|
# license for the pristine package is not an Open Source License, in which
|
||||||
|
# case the license is the MIT License). An "Open Source License" is a
|
||||||
|
# license that conforms to the Open Source Definition (Version 1.9)
|
||||||
|
# published by the Open Source Initiative.
|
||||||
|
|
||||||
|
# Please submit bugfixes or comments via http://bugs.opensuse.org/
|
||||||
|
#
|
||||||
|
|
||||||
|
%define pkg_version 0.12pre5
|
||||||
|
|
||||||
Name: elinks
|
Name: elinks
|
||||||
Version: 0.11.995
|
Version: 0.11.995
|
||||||
Release: 0
|
Release: 0
|
||||||
%define pkg_version 0.12pre5
|
License: GPL-2.0
|
||||||
#
|
|
||||||
License: GPL
|
|
||||||
#
|
|
||||||
Summary: An advanced and well-established feature-rich text mode web browser
|
Summary: An advanced and well-established feature-rich text mode web browser
|
||||||
#
|
|
||||||
Url: http://elinks.or.cz/
|
Url: http://elinks.or.cz/
|
||||||
Group: Productivity/Networking/Web/Browsers
|
Group: Productivity/Networking/Web/Browsers
|
||||||
Source: http://elinks.or.cz/download/elinks-%{pkg_version}.tar.bz2
|
Source0: http://elinks.or.cz/download/%{name}-%{pkg_version}.tar.bz2
|
||||||
BuildRequires: gmp-devel
|
# PATCH-FIX-UPSTREAM elinks-0.12_pre5-js185-1-heartbeat.patch asterios.dramis@gmail.com -- Support for new js-1.8.5 (patch taken from Gentoo)
|
||||||
BuildRequires: guile-devel
|
Patch0: elinks-0.12_pre5-js185-1-heartbeat.patch
|
||||||
|
# PATCH-FIX-UPSTREAM elinks-0.12_pre5-js185-2-up.patch asterios.dramis@gmail.com -- Support for new js-1.8.5 (patch taken from Gentoo)
|
||||||
|
Patch1: elinks-0.12_pre5-js185-2-up.patch
|
||||||
|
# PATCH-FIX-UPSTREAM elinks-0.12_pre5-js185-3-histback.patch asterios.dramis@gmail.com -- Support for new js-1.8.5 (patch taken from Gentoo)
|
||||||
|
Patch2: elinks-0.12_pre5-js185-3-histback.patch
|
||||||
|
# PATCH-FIX-UPSTREAM elinks-0.12_pre5-compilation-fix.patch asterios.dramis@gmail.com -- Fix compilation with gc (patch taken from Gentoo)
|
||||||
|
Patch3: elinks-0.12_pre5-compilation-fix.patch
|
||||||
|
# PATCH-FIX-UPSTREAM use_lua-5.1.patch asterios.dramis@gmail.com -- Support for lua-5.1 (based on patch from Debian)
|
||||||
|
Patch4: use_lua-5.1.patch
|
||||||
|
BuildRequires: automake
|
||||||
|
%if 0%{?suse_version} > 1140
|
||||||
|
BuildRequires: gc-devel
|
||||||
|
%endif
|
||||||
|
BuildRequires: gpm-devel
|
||||||
|
%if 0%{?suse_version} > 1140
|
||||||
|
BuildRequires: js-devel
|
||||||
|
%endif
|
||||||
|
BuildRequires: krb5-devel
|
||||||
BuildRequires: libbz2-devel
|
BuildRequires: libbz2-devel
|
||||||
BuildRequires: libexpat-devel
|
BuildRequires: libexpat-devel
|
||||||
BuildRequires: libidn-devel
|
BuildRequires: libidn-devel
|
||||||
|
%if 0%{?suse_version} > 1210
|
||||||
|
BuildRequires: lua51-devel
|
||||||
|
%else
|
||||||
|
BuildRequires: lua-devel
|
||||||
|
%endif
|
||||||
BuildRequires: openssl-devel
|
BuildRequires: openssl-devel
|
||||||
BuildRequires: python-devel
|
BuildRequires: pkg-config
|
||||||
|
%if 0%{?suse_version} && 0%{?suse_version} <= 1210
|
||||||
BuildRequires: ruby-devel
|
BuildRequires: ruby-devel
|
||||||
|
%endif
|
||||||
|
BuildRequires: tre-devel
|
||||||
BuildRequires: zlib-devel
|
BuildRequires: zlib-devel
|
||||||
#
|
Provides: web_browser
|
||||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||||
|
|
||||||
%description
|
%description
|
||||||
ELinks is an advanced and well-established feature-rich text mode web
|
ELinks is an advanced and well-established feature-rich text mode web
|
||||||
(HTTP/FTP/..) browser. ELinks can render both frames and tables, is highly
|
(HTTP/FTP/..) browser. ELinks can render both frames and tables, is highly
|
||||||
@ -30,61 +70,94 @@ and runs on a variety of platforms. Check the about page for a more complete
|
|||||||
description.
|
description.
|
||||||
|
|
||||||
%prep
|
%prep
|
||||||
%setup -n elinks-%{pkg_version}
|
%setup -q -n %{name}-%{pkg_version}
|
||||||
|
%patch0 -p1
|
||||||
|
%patch1 -p1
|
||||||
|
%patch2 -p1
|
||||||
|
%patch3 -p1
|
||||||
|
%patch4
|
||||||
|
|
||||||
|
# Remove build time references so build-compare can do its work
|
||||||
|
FAKE_BUILDTIME=$(LC_ALL=C date -u -r %{_sourcedir}/%{name}.changes '+%%H:%%M')
|
||||||
|
FAKE_BUILDDATE=$(LC_ALL=C date -u -r %{_sourcedir}/%{name}.changes '+%%b %%e %%Y')
|
||||||
|
sed -i "s/__TIME__/\"$FAKE_BUILDTIME\"/" src/vernum.c
|
||||||
|
sed -i "s/__DATE__/\"$FAKE_BUILDDATE\"/" src/vernum.c
|
||||||
|
|
||||||
%build
|
%build
|
||||||
#./autogen.sh
|
# Regenerate build system because of patches modifying configure.in
|
||||||
export CFLAGS="%{optflags} -fstack-protector -I/usr/include/js/"
|
autoreconf -vif
|
||||||
export LIBS="-lm" # for spidermonkey
|
export CFLAGS="%{optflags} -fstack-protector"
|
||||||
%configure \
|
%configure \
|
||||||
--sysconfdir=/etc/elinks \
|
--sysconfdir=%{_sysconfdir}/elinks \
|
||||||
--enable-nntp \
|
--enable-bittorrent \
|
||||||
--enable-cgi \
|
--enable-cgi \
|
||||||
--enable-gopher \
|
|
||||||
--enable-finger \
|
--enable-finger \
|
||||||
--enable-exmode \
|
--disable-fsp \
|
||||||
--enable-html-highlight \
|
--enable-gopher \
|
||||||
|
--enable-nntp \
|
||||||
|
--disable-smb \
|
||||||
--enable-88-colors \
|
--enable-88-colors \
|
||||||
--enable-256-colors \
|
--enable-256-colors \
|
||||||
--enable-leds \
|
--enable-true-color \
|
||||||
--with-idn \
|
--enable-exmode \
|
||||||
--without-lua \
|
--enable-html-highlight \
|
||||||
--with-perl \
|
--enable-fastmem \
|
||||||
--with-ruby \
|
|
||||||
--without-guile \
|
|
||||||
--with-python \
|
|
||||||
--without-see \
|
|
||||||
--with-xterm \
|
--with-xterm \
|
||||||
--enable-bittorrent
|
%if 0%{?suse_version} > 1140
|
||||||
make
|
--with-gc \
|
||||||
|
%else
|
||||||
|
--without-gc \
|
||||||
|
%endif
|
||||||
|
--without-lzma \
|
||||||
|
--with-gssapi \
|
||||||
|
--without-see \
|
||||||
|
--without-guile \
|
||||||
|
--with-perl \
|
||||||
|
--without-python \
|
||||||
|
--with-lua \
|
||||||
|
%if 0%{?suse_version} && 0%{?suse_version} <= 1210
|
||||||
|
--with-ruby \
|
||||||
|
%else
|
||||||
|
--without-ruby \
|
||||||
|
%endif
|
||||||
|
--without-gnutls \
|
||||||
|
--without-x
|
||||||
|
make %{?_smp_mflags}
|
||||||
|
|
||||||
%install
|
%install
|
||||||
%make_install
|
%make_install
|
||||||
rm -f %{buildroot}%{_datadir}/locale/locale.alias
|
|
||||||
%find_lang %{name}
|
|
||||||
#
|
|
||||||
%define _pkgdocdir %{buildroot}%{_docdir}/%{name}
|
|
||||||
install -Dd -m 0755 %{_pkgdocdir}/scripts
|
|
||||||
cp -r \
|
|
||||||
ABOUT-NLS AUTHORS BUGS ChangeLog COPYING INSTALL NEWS README \
|
|
||||||
features.* SITES THANKS TODO doc/*.txt doc/html \
|
|
||||||
contrib/*.conf contrib/*.vim contrib/*.css contrib/TIPS-AND-TRICKS \
|
|
||||||
%{_pkgdocdir}
|
|
||||||
install -m 0644 contrib/wipe-out-ssl* contrib/conv/* \
|
|
||||||
%{_pkgdocdir}/scripts/
|
|
||||||
for lang in perl python guile ruby lua ; do
|
|
||||||
install -Dd -m 0755 %{_pkgdocdir}/${lang}
|
|
||||||
install -m 0644 contrib/${lang}/* \
|
|
||||||
%{_pkgdocdir}/${lang}/
|
|
||||||
done
|
|
||||||
|
|
||||||
%clean
|
# Remove unneeded file
|
||||||
rm -rf %{buildroot};
|
rm -f %{buildroot}%{_datadir}/locale/locale.alias
|
||||||
|
|
||||||
|
%find_lang %{name}
|
||||||
|
|
||||||
|
# Install documentation
|
||||||
|
%define _pkgdocdir %{buildroot}%{_docdir}/%{name}
|
||||||
|
install -Dd -m 0755 %{_pkgdocdir}
|
||||||
|
install -pm 0644 AUTHORS BUGS COPYING ChangeLog NEWS README SITES THANKS TODO features.conf %{_pkgdocdir}
|
||||||
|
cp -a doc/ %{_pkgdocdir}
|
||||||
|
rm -rf %{_pkgdocdir}/doc/{.deps/,.gitignore,Doxyfile.in,Makefile,man/,tools/}
|
||||||
|
install -Dd -m 0755 %{_pkgdocdir}/contrib/
|
||||||
|
install -pm 0644 contrib/*.conf contrib/*.vim contrib/*.css contrib/TIPS-AND-TRICKS %{_pkgdocdir}/contrib/
|
||||||
|
install -Dd -m 0755 %{_pkgdocdir}/scripts/
|
||||||
|
install -pm 0644 contrib/wipe-out-ssl* contrib/conv/* %{_pkgdocdir}/scripts/
|
||||||
|
rm -f %{_pkgdocdir}/scripts/conv/.gitignore
|
||||||
|
# Install only the languages that are compiled
|
||||||
|
for lang in lua perl smjs; do
|
||||||
|
install -Dd -m 0755 %{_pkgdocdir}/${lang}
|
||||||
|
install -pm 0644 contrib/${lang}/* %{_pkgdocdir}/${lang}
|
||||||
|
done
|
||||||
|
rm -f %{_pkgdocdir}/lua/.gitignore
|
||||||
|
%if 0%{?suse_version} && 0%{?suse_version} <= 1210
|
||||||
|
cp -a contrib/ruby %{_pkgdocdir}/
|
||||||
|
%endif
|
||||||
|
|
||||||
%files -f %{name}.lang
|
%files -f %{name}.lang
|
||||||
%defattr(-,root,root)
|
%defattr(-,root,root,-)
|
||||||
%{_bindir}/%{name}
|
%{_bindir}/%{name}
|
||||||
%{_mandir}/man?/%{name}*
|
%doc %{_docdir}/%{name}/
|
||||||
%doc %{_docdir}/%{name}
|
%{_mandir}/man1/%{name}.1%{ext_man}
|
||||||
|
%{_mandir}/man5/%{name}*.5%{ext_man}
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
61
use_lua-5.1.patch
Normal file
61
use_lua-5.1.patch
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
--- configure.in.orig 2009-07-07 15:23:17.000000000 +0300
|
||||||
|
+++ configure.in 2012-06-10 15:47:58.962180590 +0300
|
||||||
|
@@ -884,11 +884,11 @@
|
||||||
|
withval="";
|
||||||
|
fi
|
||||||
|
for luadir in "$withval" "" /usr /usr/local; do
|
||||||
|
- for suffix in "" 50; do
|
||||||
|
+ for suffix in "" 50 51; do
|
||||||
|
if test "$cf_result" = no && ( test -f "$luadir/include/lua.h" || \
|
||||||
|
test -f "$luadir/include/lua$suffix/lua.h" ) ; then
|
||||||
|
- LUA_LIBS="-L$luadir/lib -llua$suffix -llualib$suffix -lm"
|
||||||
|
- LUA_CFLAGS="-I$luadir/include -I$luadir/include/lua$suffix"
|
||||||
|
+ LUA_LIBS=`pkg-config --libs lua`
|
||||||
|
+ LUA_CFLAGS=`pkg-config --cflags lua`
|
||||||
|
|
||||||
|
LIBS="$LUA_LIBS $LIBS_X"
|
||||||
|
CFLAGS="$CFLAGS_X $LUA_CFLAGS"
|
||||||
|
--- src/scripting/lua/core.c.orig 2009-07-07 15:23:17.000000000 +0300
|
||||||
|
+++ src/scripting/lua/core.c 2012-06-10 14:20:57.215111234 +0300
|
||||||
|
@@ -658,7 +658,7 @@
|
||||||
|
if (file_can_read(file)) {
|
||||||
|
int oldtop = lua_gettop(S);
|
||||||
|
|
||||||
|
- if (lua_dofile(S, file) != 0)
|
||||||
|
+ if (luaL_dofile(S, file) != 0)
|
||||||
|
sleep(3); /* Let some time to see error messages. */
|
||||||
|
lua_settop(S, oldtop);
|
||||||
|
}
|
||||||
|
@@ -671,11 +671,7 @@
|
||||||
|
{
|
||||||
|
L = lua_open();
|
||||||
|
|
||||||
|
- luaopen_base(L);
|
||||||
|
- luaopen_table(L);
|
||||||
|
- luaopen_io(L);
|
||||||
|
- luaopen_string(L);
|
||||||
|
- luaopen_math(L);
|
||||||
|
+ luaL_openlibs(L);
|
||||||
|
|
||||||
|
lua_register(L, LUA_ALERT, l_alert);
|
||||||
|
lua_register(L, "current_url", l_current_url);
|
||||||
|
@@ -780,7 +776,7 @@
|
||||||
|
int oldtop = lua_gettop(L);
|
||||||
|
|
||||||
|
if (prepare_lua(ses) == 0) {
|
||||||
|
- lua_dostring(L, expr);
|
||||||
|
+ (void) luaL_dostring(L, expr);
|
||||||
|
lua_settop(L, oldtop);
|
||||||
|
finish_lua();
|
||||||
|
}
|
||||||
|
--- src/scripting/lua/hooks.c.orig 2009-07-07 15:23:17.000000000 +0300
|
||||||
|
+++ src/scripting/lua/hooks.c 2012-06-10 14:21:26.216351680 +0300
|
||||||
|
@@ -200,7 +200,7 @@
|
||||||
|
script_hook_quit(va_list ap, void *data)
|
||||||
|
{
|
||||||
|
if (!prepare_lua(NULL)) {
|
||||||
|
- lua_dostring(lua_state, "if quit_hook then quit_hook() end");
|
||||||
|
+ (void) luaL_dostring(lua_state, "if quit_hook then quit_hook() end");
|
||||||
|
finish_lua();
|
||||||
|
}
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user