1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-12-04 14:46:47 -05:00

Move delayed_goto_uri_frame to src/session/task.c

Until the last change in src/ecmascript/see/window.c, the two copies
of delayed_goto_uri_frame in src/ecmascript/spidermonkey/window.c and
in src/ecmascript/see/window.c were identical. That change applies to
both versions, so move the newer one to src/session/task.c and eliminate
the duplication. Also move struct delayed_open to src/session/session.h.
This commit is contained in:
Miciah Dashiel Butler Masters 2006-01-16 19:18:33 +00:00 committed by Miciah Dashiel Butler Masters
parent 1082c85bd0
commit 1f68492d57
5 changed files with 23 additions and 39 deletions

View File

@ -49,7 +49,6 @@
static struct js_window_object *js_get_global_object(void *);
static struct js_window_object *js_try_resolve_frame(struct document_view *, unsigned char *);
static void delayed_open(void *);
static void delayed_goto_uri_frame(void *);
static void window_get(struct SEE_interpreter *, struct SEE_object *, struct SEE_string *, struct SEE_value *);
static void window_put(struct SEE_interpreter *, struct SEE_object *, struct SEE_string *, struct SEE_value *, int);
static int window_canput(struct SEE_interpreter *, struct SEE_object *, struct SEE_string *);
@ -59,12 +58,6 @@ static void js_window_open(struct SEE_interpreter *, struct SEE_object *, struct
void location_goto(struct document_view *, unsigned char *);
struct delayed_open {
struct session *ses;
struct uri *uri;
unsigned char *target;
};
struct SEE_objectclass js_window_object_class = {
NULL,
window_get,
@ -113,21 +106,6 @@ delayed_open(void *data)
mem_free(deo);
}
static void
delayed_goto_uri_frame(void *data)
{
struct delayed_open *deo = data;
struct frame *frame;
assert(deo);
frame = ses_find_frame(deo->ses, deo->target);
if (frame)
goto_uri_frame(deo->ses, deo->uri, frame->name, CACHE_MODE_NORMAL);
done_uri(deo->uri);
mem_free(deo->target);
mem_free(deo);
}
static void

View File

@ -289,12 +289,6 @@ window_alert(JSContext *ctx, JSObject *obj, uintN argc, jsval *argv, jsval *rval
return JS_TRUE;
}
struct delayed_open {
struct session *ses;
struct uri *uri;
unsigned char *target;
};
static void
delayed_open(void *data)
{
@ -306,17 +300,6 @@ delayed_open(void *data)
mem_free(deo);
}
static void
delayed_goto_uri_frame(void *data)
{
struct delayed_open *deo = data;
assert(deo);
goto_uri_frame(deo->ses, deo->uri, deo->target, CACHE_MODE_NORMAL);
done_uri(deo->uri);
mem_free(deo);
}
static JSBool
window_open(JSContext *ctx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{

View File

@ -20,6 +20,13 @@ struct terminal;
struct uri;
struct window;
/* Used by delayed_open and delayed_goto_uri_frame. */
struct delayed_open {
struct session *ses;
struct uri *uri;
unsigned char *target;
};
enum remote_session_flags {
SES_REMOTE_NEW_TAB = 1,
SES_REMOTE_NEW_WINDOW = 2,

View File

@ -662,6 +662,21 @@ goto_uri_frame(struct session *ses, struct uri *uri,
follow_url(ses, uri, target, TASK_FORWARD, cache_mode, 1);
}
void
delayed_goto_uri_frame(void *data)
{
struct delayed_open *deo = data;
struct frame *frame;
assert(deo);
frame = ses_find_frame(deo->ses, deo->target);
if (frame)
goto_uri_frame(deo->ses, deo->uri, frame->name, CACHE_MODE_NORMAL);
done_uri(deo->uri);
mem_free(deo->target);
mem_free(deo);
}
/* menu_func_T */
void
map_selected(struct terminal *term, void *ld_, void *ses_)

View File

@ -27,6 +27,7 @@ struct uri *get_hooked_uri(unsigned char *uristring, struct session *ses, unsign
void goto_uri(struct session *ses, struct uri *uri);
void goto_uri_frame(struct session *, struct uri *, unsigned char *, enum cache_mode);
void delayed_goto_uri_frame(void *);
void goto_url(struct session *, unsigned char *);
void goto_url_with_hook(struct session *, unsigned char *);
int goto_url_home(struct session *ses);