mirror of
https://github.com/rkd77/elinks.git
synced 2025-02-02 15:09:23 -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 *ac2;
|
||||||
void *ar;
|
void *ar;
|
||||||
void *document_obj;
|
void *document_obj;
|
||||||
|
void *location_obj;
|
||||||
JS::RootedValue fun;
|
JS::RootedValue fun;
|
||||||
bool changed;
|
bool changed;
|
||||||
};
|
};
|
||||||
|
@ -308,6 +308,8 @@ spidermonkey_get_interpreter(struct ecmascript_interpreter *interpreter)
|
|||||||
goto release_and_fail;
|
goto release_and_fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interpreter->location_obj = location_obj;
|
||||||
|
|
||||||
screen_obj = spidermonkey_InitClass(ctx, window_obj, NULL,
|
screen_obj = spidermonkey_InitClass(ctx, window_obj, NULL,
|
||||||
&screen_class, NULL, 0,
|
&screen_class, NULL, 0,
|
||||||
screen_props,
|
screen_props,
|
||||||
|
@ -641,29 +641,9 @@ document_get_property_location(JSContext *ctx, unsigned int argc, JS::Value *vp)
|
|||||||
if (!comp) {
|
if (!comp) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct session *ses;
|
|
||||||
int index;
|
|
||||||
struct location *loc;
|
|
||||||
|
|
||||||
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
|
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
|
||||||
|
|
||||||
struct view_state *vs;
|
args.rval().setObject(*(JSObject *)(interpreter->location_obj));
|
||||||
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();
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user