1
0
mirror of https://github.com/rkd77/elinks.git synced 2025-02-02 15:09:23 -05:00

Merge with git+ssh://pasky.or.cz/srv/git/elinks.git

This commit is contained in:
2006-01-30 22:11:25 +01:00
commit 8256d6b915
5 changed files with 33 additions and 50 deletions

View File

@ -56,7 +56,7 @@ function mangle_deb_bugnumbers(cached, vs) {
var closes_re = /closes:\s*(?:bug)?\#?\s?\d+(?:,\s*(?:bug)?\#?\s?\d+)*/gi; var closes_re = /closes:\s*(?:bug)?\#?\s?\d+(?:,\s*(?:bug)?\#?\s?\d+)*/gi;
var new_content = cached.content.replace(closes_re, rewrite_closes_fn); var new_content = cached.content.replace(closes_re, rewrite_closes_fn);
if (cached.content_type == 'text/plain') { if (cached.type == 'text/plain') {
cached.content = '<pre>' + new_content + '</pre>'; cached.content = '<pre>' + new_content + '</pre>';
vs.plain = "0"; vs.plain = "0";
} else { } else {

View File

@ -203,9 +203,9 @@ document_put(struct SEE_interpreter *interp, struct SEE_object *o,
} }
static void static void
js_document_write(struct SEE_interpreter *interp, struct SEE_object *self, js_document_write_do(struct SEE_interpreter *interp, struct SEE_object *self,
struct SEE_object *thisobj, int argc, struct SEE_value **argv, struct SEE_object *thisobj, int argc, struct SEE_value **argv,
struct SEE_value *res) struct SEE_value *res, int newline)
{ {
struct global_object *g = (struct global_object *)interp; struct global_object *g = (struct global_object *)interp;
struct view_state *vs = g->win->vs; struct view_state *vs = g->win->vs;
@ -217,6 +217,8 @@ js_document_write(struct SEE_interpreter *interp, struct SEE_object *self,
if (code) { if (code) {
add_to_string(ret, code); add_to_string(ret, code);
mem_free(code); mem_free(code);
if (newline)
add_char_to_string(ret, '\n');
} }
} }
#ifdef CONFIG_LEDS #ifdef CONFIG_LEDS
@ -233,36 +235,20 @@ js_document_write(struct SEE_interpreter *interp, struct SEE_object *self,
SEE_SET_BOOLEAN(res, 0); SEE_SET_BOOLEAN(res, 0);
} }
static void
js_document_write(struct SEE_interpreter *interp, struct SEE_object *self,
struct SEE_object *thisobj, int argc, struct SEE_value **argv,
struct SEE_value *res)
{
js_document_write_do(interp, self, thisobj, argc, argv, res, 0);
}
static void static void
js_document_writeln(struct SEE_interpreter *interp, struct SEE_object *self, js_document_writeln(struct SEE_interpreter *interp, struct SEE_object *self,
struct SEE_object *thisobj, int argc, struct SEE_value **argv, struct SEE_object *thisobj, int argc, struct SEE_value **argv,
struct SEE_value *res) struct SEE_value *res)
{ {
struct global_object *g = (struct global_object *)interp; js_document_write_do(interp, self, thisobj, argc, argv, res, 1);
struct view_state *vs = g->win->vs;
struct string *ret = g->ret;
if (argc >= 1 && ret) {
unsigned char *code = SEE_value_to_unsigned_char(interp, argv[0]);
if (code) {
add_to_string(ret, code);
mem_free(code);
add_char_to_string(ret, '\n');
}
}
#ifdef CONFIG_LEDS
/* XXX: I don't know about you, but I have *ENOUGH* of those 'Undefined
* function' errors, I want to see just the useful ones. So just
* lighting a led and going away, no muss, no fuss. --pasky */
/* TODO: Perhaps we can introduce ecmascript.error_report_unsupported
* -> "Show information about the document using some valid,
* nevertheless unsupported methods/properties." --pasky too */
set_led_value(vs->doc_view->session->status.ecmascript_led, 'J');
#endif
checktime(interp);
SEE_SET_BOOLEAN(res, 0);
} }
static int static int

View File

@ -201,7 +201,8 @@ const JSFunctionSpec document_funcs[] = {
}; };
static JSBool static JSBool
document_write(JSContext *ctx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) document_write_do(JSContext *ctx, JSObject *obj, uintN argc, jsval *argv,
jsval *rval, int newline)
{ {
struct ecmascript_interpreter *interpreter = JS_GetContextPrivate(ctx); struct ecmascript_interpreter *interpreter = JS_GetContextPrivate(ctx);
struct string *ret = interpreter->ret; struct string *ret = interpreter->ret;
@ -210,6 +211,8 @@ document_write(JSContext *ctx, JSObject *obj, uintN argc, jsval *argv, jsval *rv
unsigned char *code = jsval_to_string(ctx, &argv[0]); unsigned char *code = jsval_to_string(ctx, &argv[0]);
add_to_string(ret, code); add_to_string(ret, code);
if (newline)
add_char_to_string(ret, '\n');
} }
/* XXX: I don't know about you, but I have *ENOUGH* of those 'Undefined /* XXX: I don't know about you, but I have *ENOUGH* of those 'Undefined
* function' errors, I want to see just the useful ones. So just * function' errors, I want to see just the useful ones. So just
@ -227,24 +230,15 @@ document_write(JSContext *ctx, JSObject *obj, uintN argc, jsval *argv, jsval *rv
return JS_TRUE; return JS_TRUE;
} }
static JSBool
document_write(JSContext *ctx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
return document_write_do(ctx, obj, argc, argv, rval, 0);
}
static JSBool static JSBool
document_writeln(JSContext *ctx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) document_writeln(JSContext *ctx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{ {
struct ecmascript_interpreter *interpreter = JS_GetContextPrivate(ctx); return document_write_do(ctx, obj, argc, argv, rval, 1);
struct string *ret = interpreter->ret;
if (argc >= 1 && ret) {
unsigned char *code = jsval_to_string(ctx, &argv[0]);
add_to_string(ret, code);
add_char_to_string(ret, '\n');
}
#ifdef CONFIG_LEDS
set_led_value(interpreter->vs->doc_view->session->status.ecmascript_led, 'J');
#endif
boolean_to_jsval(ctx, rval, 0);
return JS_TRUE;
} }

View File

@ -847,7 +847,7 @@ load_uri(struct uri *uri, struct uri *referrer, struct download *download,
struct cache_entry *cached; struct cache_entry *cached;
struct connection *conn; struct connection *conn;
struct uri *proxy_uri, *proxied_uri; struct uri *proxy_uri, *proxied_uri;
int connection_state = S_OK; enum connection_state connection_state = S_OK;
if (download) { if (download) {
download->conn = NULL; download->conn = NULL;

View File

@ -16,6 +16,7 @@
#include "config/options.h" #include "config/options.h"
#include "main/event.h" #include "main/event.h"
#include "network/connection.h" #include "network/connection.h"
#include "network/state.h"
#include "protocol/protocol.h" #include "protocol/protocol.h"
#include "protocol/proxy.h" #include "protocol/proxy.h"
#include "protocol/uri.h" #include "protocol/uri.h"
@ -53,7 +54,8 @@ proxy_probe_no_proxy(unsigned char *url, unsigned char *no_proxy)
} }
static struct uri * static struct uri *
proxy_uri(struct uri *uri, unsigned char *proxy, int *connection_state) proxy_uri(struct uri *uri, unsigned char *proxy,
enum connection_state *connection_state)
{ {
struct string string; struct string string;
@ -114,7 +116,8 @@ get_protocol_proxy(unsigned char *opt,
} }
static struct uri * static struct uri *
get_proxy_worker(struct uri *uri, unsigned char *proxy, int *connection_state) get_proxy_worker(struct uri *uri, unsigned char *proxy,
enum connection_state *connection_state)
{ {
unsigned char *protocol_proxy = NULL; unsigned char *protocol_proxy = NULL;
@ -180,7 +183,7 @@ get_proxy_worker(struct uri *uri, unsigned char *proxy, int *connection_state)
} }
struct uri * struct uri *
get_proxy_uri(struct uri *uri, int *connection_state) get_proxy_uri(struct uri *uri, enum connection_state *connection_state)
{ {
if (uri->protocol == PROTOCOL_PROXY) { if (uri->protocol == PROTOCOL_PROXY) {
return get_composed_uri(uri, URI_BASE); return get_composed_uri(uri, URI_BASE);