mirror of
https://github.com/rkd77/elinks.git
synced 2024-12-04 14:46:47 -05:00
[spidermonkey] return location object
so document.location.href= redirects
This commit is contained in:
parent
99387a3104
commit
13c4a1ce4d
@ -64,6 +64,7 @@ struct ecmascript_interpreter {
|
||||
void *ac2;
|
||||
void *ar;
|
||||
void *document_obj;
|
||||
void *location_obj;
|
||||
JS::RootedValue fun;
|
||||
bool changed;
|
||||
};
|
||||
|
@ -308,6 +308,8 @@ spidermonkey_get_interpreter(struct ecmascript_interpreter *interpreter)
|
||||
goto release_and_fail;
|
||||
}
|
||||
|
||||
interpreter->location_obj = location_obj;
|
||||
|
||||
screen_obj = spidermonkey_InitClass(ctx, window_obj, NULL,
|
||||
&screen_class, NULL, 0,
|
||||
screen_props,
|
||||
|
@ -641,29 +641,9 @@ document_get_property_location(JSContext *ctx, unsigned int argc, JS::Value *vp)
|
||||
if (!comp) {
|
||||
return false;
|
||||
}
|
||||
|
||||
struct session *ses;
|
||||
int index;
|
||||
struct location *loc;
|
||||
|
||||
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
|
||||
|
||||
struct view_state *vs;
|
||||
vs = interpreter->vs;
|
||||
struct document *document;
|
||||
struct document_view *doc_view = interpreter->vs->doc_view;
|
||||
doc_view = vs->doc_view;
|
||||
document = doc_view->document;
|
||||
char *str = get_uri_string(document->uri, URI_ORIGINAL);
|
||||
if (str)
|
||||
{
|
||||
args.rval().setString(JS_NewStringCopyZ(ctx, str));
|
||||
mem_free(str);
|
||||
|
||||
} else {
|
||||
args.rval().setUndefined();
|
||||
}
|
||||
|
||||
args.rval().setObject(*(JSObject *)(interpreter->location_obj));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user