1
0
mirror of https://github.com/rkd77/elinks.git synced 2025-05-18 00:48:57 -04:00

Merge branch 'elinks-0.12' into elinks-0.13

Conflicts:
	doc/installation.txt
	src/protocol/http/http.c
This commit is contained in:
Kalle Olavi Niemitalo 2009-02-28 18:22:54 +02:00 committed by Kalle Olavi Niemitalo
commit 3581e2848e
8 changed files with 29 additions and 63 deletions

10
NEWS
View File

@ -81,6 +81,7 @@ includes the changes listed under ``ELinks 0.11.5.GIT'' below.
Incompatibilities: Incompatibilities:
* bug 1060: Regexp searching now requires the TRE library. * bug 1060: Regexp searching now requires the TRE library.
* lzma disabled by default. It's rarely used and doesn't build with new xz.
Other changes: Other changes:
@ -98,6 +99,12 @@ Other changes:
title, note the charset. Don't truncate titles to the width of the title, note the charset. Don't truncate titles to the width of the
terminal. terminal.
* bug 1061: Correctly truncate UTF-8 titles in the tab bar. * bug 1061: Correctly truncate UTF-8 titles in the tab bar.
* bug 1068: ELinks used to display a blank or truncated page if an
HTTP/1.1 server sent a compressed body with incorrect Content-Length.
That has now been fixed, and a new option (protocol.http.compression)
has been added.
* Don't crash when the search-toggle-regex action is used and no regular
expression support is compiled in.
* minor bug 761: When reading bookmarks from an XBEL file, distinguish * minor bug 761: When reading bookmarks from an XBEL file, distinguish
attribute names from attribute values. attribute names from attribute values.
* enhancement: Updated ISO 8859-7, ISO 8859-16, KOI8-R, and MacRoman. * enhancement: Updated ISO 8859-7, ISO 8859-16, KOI8-R, and MacRoman.
@ -108,6 +115,9 @@ Bugs that should be removed from NEWS before the 0.12.0 release:
* critical bug 1067: Fixed a crash in the RSS parser that ``configure * critical bug 1067: Fixed a crash in the RSS parser that ``configure
--enable-html-highlight'' enables. ELinks 0.12pre1 was the first --enable-html-highlight'' enables. ELinks 0.12pre1 was the first
release that supported RSS at all. release that supported RSS at all.
* bug 1069: ELinks didn't report ECMAScript errors, even if the
ecmascript.error_reporting option was turned on. ELinks 0.12pre2
was the first release that had this bug.
ELinks 0.12pre2: ELinks 0.12pre2:
---------------- ----------------

View File

@ -47,7 +47,7 @@ zlib 1.2.0.2 or later |For handling gzip or deflate compressed documents \
both locally and sent from server. both locally and sent from server.
bzip2 |Likewise, for bzip2 compressed documents. bzip2 |Likewise, for bzip2 compressed documents.
LZMA Utils |Likewise, for LZMA compressed documents. \ LZMA Utils |Likewise, for LZMA compressed documents. \
Version 4.32.5 should work. Version 4.32.5 should work. XZ Utils does not work.
OpenSSL, GNU TLS, or nss_compat_ossl \ OpenSSL, GNU TLS, or nss_compat_ossl \
|For handling secure HTTP browsing. |For handling secure HTTP browsing.
GPM |'General Purpose Mouse' for mouse support. GPM |'General Purpose Mouse' for mouse support.

View File

@ -8,8 +8,6 @@
#include "elinks.h" #include "elinks.h"
#include "ecmascript/spidermonkey-shared.h" #include "ecmascript/spidermonkey-shared.h"
#include "ecmascript/spidermonkey.h"
#include "scripting/smjs/core.h"
/** A shared runtime used for both user scripts (scripting/smjs/) and /** A shared runtime used for both user scripts (scripting/smjs/) and
* scripts on web pages (ecmascript/spidermonkey/). * scripts on web pages (ecmascript/spidermonkey/).
@ -33,38 +31,6 @@ JSContext *spidermonkey_empty_context;
* it can be initialized and shut down in arbitrary order. */ * it can be initialized and shut down in arbitrary order. */
static int spidermonkey_runtime_refcount; static int spidermonkey_runtime_refcount;
static void
error_reporter(JSContext *ctx, const char *message, JSErrorReport *report)
{
/* We have three types of JSContexts.
* - spidermonkey_empty_context never has anything defined or
* evaluated in it, so this error_reporter() should not be
* called for it.
* - smjs_ctx for user scripts.
* - many JSContexts for web scripts.
* Check which one ctx is and call the appropriate function.
*
* Instead of the scheme used here, we could:
* (a) make the private pointer of every context point to a
* structure of known type and put a function pointer or
* enum in that structure, or
* (b) assume that JS_GetContextPrivate(smjs_ctx) == NULL. */
assert(ctx != spidermonkey_empty_context);
if_assert_failed return;
#ifdef CONFIG_SCRIPTING_SPIDERMONKEY
if (ctx == smjs_ctx) {
smjs_error_reporter(ctx, message, report);
return;
}
#endif
#ifdef CONFIG_ECMASCRIPT_SMJS
spidermonkey_error_reporter(ctx, message, report);
#endif
}
/** Initialize ::spidermonkey_runtime and ::spidermonkey_empty_context. /** Initialize ::spidermonkey_runtime and ::spidermonkey_empty_context.
* If already initialized, just increment the reference count. * If already initialized, just increment the reference count.
* *
@ -92,11 +58,6 @@ spidermonkey_runtime_addref(void)
JS_ShutDown(); JS_ShutDown();
return 0; return 0;
} }
/* Although JS_SetErrorReporter gets the JSContext as
* a parameter, it affects the whole JSRuntime. */
JS_SetErrorReporter(spidermonkey_empty_context,
error_reporter);
} }
assert(spidermonkey_runtime); assert(spidermonkey_runtime);

View File

@ -57,8 +57,8 @@
static int js_module_init_ok; static int js_module_init_ok;
void static void
spidermonkey_error_reporter(JSContext *ctx, const char *message, JSErrorReport *report) error_reporter(JSContext *ctx, const char *message, JSErrorReport *report)
{ {
struct ecmascript_interpreter *interpreter = JS_GetContextPrivate(ctx); struct ecmascript_interpreter *interpreter = JS_GetContextPrivate(ctx);
struct session *ses = interpreter->vs->doc_view->session; struct session *ses = interpreter->vs->doc_view->session;
@ -172,6 +172,7 @@ spidermonkey_get_interpreter(struct ecmascript_interpreter *interpreter)
/* XXX: JSOPTION_COMPILE_N_GO will go (will it?) when we implement /* XXX: JSOPTION_COMPILE_N_GO will go (will it?) when we implement
* some kind of bytecode cache. (If we will ever do that.) */ * some kind of bytecode cache. (If we will ever do that.) */
JS_SetOptions(ctx, JSOPTION_VAROBJFIX | JSOPTION_COMPILE_N_GO); JS_SetOptions(ctx, JSOPTION_VAROBJFIX | JSOPTION_COMPILE_N_GO);
JS_SetErrorReporter(ctx, error_reporter);
window_obj = JS_NewObject(ctx, (JSClass *) &window_class, NULL, NULL); window_obj = JS_NewObject(ctx, (JSClass *) &window_class, NULL, NULL);
if (!window_obj) { if (!window_obj) {

View File

@ -2,10 +2,6 @@
#define EL__ECMASCRIPT_SPIDERMONKEY_H #define EL__ECMASCRIPT_SPIDERMONKEY_H
struct ecmascript_interpreter; struct ecmascript_interpreter;
struct form_state;
struct form_view;
struct JSContext;
struct JSErrorReport;
struct string; struct string;
void *spidermonkey_get_interpreter(struct ecmascript_interpreter *interpreter); void *spidermonkey_get_interpreter(struct ecmascript_interpreter *interpreter);
@ -19,7 +15,5 @@ void spidermonkey_eval(struct ecmascript_interpreter *interpreter, struct string
unsigned char *spidermonkey_eval_stringback(struct ecmascript_interpreter *interpreter, struct string *code); unsigned char *spidermonkey_eval_stringback(struct ecmascript_interpreter *interpreter, struct string *code);
int spidermonkey_eval_boolback(struct ecmascript_interpreter *interpreter, struct string *code); int spidermonkey_eval_boolback(struct ecmascript_interpreter *interpreter, struct string *code);
void spidermonkey_error_reporter(struct JSContext *ctx, const char *message, struct JSErrorReport *report);
extern struct module spidermonkey_module; extern struct module spidermonkey_module;
#endif #endif

View File

@ -159,16 +159,18 @@ static struct option_info http_options[] = {
* we might wrap this option in #if CFG_DEBUG. */ * we might wrap this option in #if CFG_DEBUG. */
INIT_OPT_BOOL("protocol.http", N_("Enable on-the-fly compression"), INIT_OPT_BOOL("protocol.http", N_("Enable on-the-fly compression"),
"compression", 0, 1, "compression", 0, 1,
N_("If enabled, the capability to receive compressed content (gzip and/or\n" N_("If enabled, the capability to receive compressed content\n"
"bzip2) is announced to the server, which usually sends the reply\n" "(gzip and/or bzip2) is announced to the server, which\n"
"compressed, thus saving some bandwidth at slight CPU expense.\n" "usually sends the reply compressed, thus saving some\n"
"bandwidth at slight CPU expense.\n"
"\n" "\n"
"If ELinks displays a incomplete page or garbage, try disabling this\n" "If ELinks displays a incomplete page or garbage, try\n"
"option. If that helps, there may be a bug in the decompression part\n" "disabling this option. If that helps, there may be a bug in\n"
"of ELinks. Please report such bugs.\n" "the decompression part of ELinks. Please report such bugs.\n"
"\n" "\n"
"If ELinks has been compiled without compression support, this option\n" "If ELinks has been compiled without compression support,\n"
"has no effect. To check the supported features, see Help -> About.")), "this option has no effect. To check the supported features,\n"
"see Help -> About.")),
INIT_OPT_BOOL("protocol.http", N_("Activate HTTP TRACE debugging"), INIT_OPT_BOOL("protocol.http", N_("Activate HTTP TRACE debugging"),
"trace", 0, 0, "trace", 0, 0,

View File

@ -36,8 +36,8 @@ alert_smjs_error(unsigned char *msg)
smjs_ses, msg); smjs_ses, msg);
} }
void static void
smjs_error_reporter(JSContext *ctx, const char *message, JSErrorReport *report) error_reporter(JSContext *ctx, const char *message, JSErrorReport *report)
{ {
unsigned char *strict, *exception, *warning, *error; unsigned char *strict, *exception, *warning, *error;
struct string msg; struct string msg;
@ -130,15 +130,14 @@ init_smjs(struct module *module)
{ {
if (!spidermonkey_runtime_addref()) return; if (!spidermonkey_runtime_addref()) return;
/* Set smjs_ctx immediately after creating the JSContext, so
* that any error reports from SpiderMonkey are forwarded to
* smjs_error_reporter(). */
smjs_ctx = JS_NewContext(spidermonkey_runtime, 8192); smjs_ctx = JS_NewContext(spidermonkey_runtime, 8192);
if (!smjs_ctx) { if (!smjs_ctx) {
spidermonkey_runtime_release(); spidermonkey_runtime_release();
return; return;
} }
JS_SetErrorReporter(smjs_ctx, error_reporter);
smjs_init_global_object(); smjs_init_global_object();
smjs_init_elinks_object(); smjs_init_elinks_object();

View File

@ -10,7 +10,6 @@ struct string;
extern JSContext *smjs_ctx; extern JSContext *smjs_ctx;
extern struct session *smjs_ses; extern struct session *smjs_ses;
void smjs_error_reporter(JSContext *ctx, const char *message, JSErrorReport *report);
void alert_smjs_error(unsigned char *msg); void alert_smjs_error(unsigned char *msg);
void init_smjs(struct module *module); void init_smjs(struct module *module);