mirror of
https://github.com/rkd77/elinks.git
synced 2024-12-04 14:46:47 -05:00
SpiderMonkey: Handling both 'document.location.href ='
and 'document.location ='
This commit is contained in:
parent
73c06aaa10
commit
d267fcc747
@ -57,11 +57,11 @@ const JSClass document_class = {
|
|||||||
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, JS_FinalizeStub
|
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, JS_FinalizeStub
|
||||||
};
|
};
|
||||||
|
|
||||||
enum document_prop { JSP_DOC_REF, JSP_DOC_TITLE, JSP_DOC_URL };
|
enum document_prop { JSP_DOC_LOC, JSP_DOC_REF, JSP_DOC_TITLE, JSP_DOC_URL };
|
||||||
/* "cookie" is special; it isn't a regular property but we channel it to the
|
/* "cookie" is special; it isn't a regular property but we channel it to the
|
||||||
* cookie-module. XXX: Would it work if "cookie" was defined in this array? */
|
* cookie-module. XXX: Would it work if "cookie" was defined in this array? */
|
||||||
const JSPropertySpec document_props[] = {
|
const JSPropertySpec document_props[] = {
|
||||||
{ "location", JSP_DOC_URL, JSPROP_ENUMERATE },
|
{ "location", JSP_DOC_LOC, JSPROP_ENUMERATE },
|
||||||
{ "referrer", JSP_DOC_REF, JSPROP_ENUMERATE | JSPROP_READONLY },
|
{ "referrer", JSP_DOC_REF, JSPROP_ENUMERATE | JSPROP_READONLY },
|
||||||
{ "title", JSP_DOC_TITLE, JSPROP_ENUMERATE }, /* TODO: Charset? */
|
{ "title", JSP_DOC_TITLE, JSPROP_ENUMERATE }, /* TODO: Charset? */
|
||||||
{ "url", JSP_DOC_URL, JSPROP_ENUMERATE },
|
{ "url", JSP_DOC_URL, JSPROP_ENUMERATE },
|
||||||
@ -114,6 +114,9 @@ document_get_property(JSContext *ctx, JSObject *obj, jsval id, jsval *vp)
|
|||||||
undef_to_jsval(ctx, vp);
|
undef_to_jsval(ctx, vp);
|
||||||
|
|
||||||
switch (JSVAL_TO_INT(id)) {
|
switch (JSVAL_TO_INT(id)) {
|
||||||
|
case JSP_DOC_LOC:
|
||||||
|
JS_GetProperty(ctx, parent, "location", vp);
|
||||||
|
break;
|
||||||
case JSP_DOC_REF:
|
case JSP_DOC_REF:
|
||||||
switch (get_opt_int("protocol.http.referer.policy")) {
|
switch (get_opt_int("protocol.http.referer.policy")) {
|
||||||
case REFERER_NONE:
|
case REFERER_NONE:
|
||||||
@ -179,6 +182,7 @@ document_set_property(JSContext *ctx, JSObject *obj, jsval id, jsval *vp)
|
|||||||
mem_free_set(&document->title, stracpy(jsval_to_string(ctx, vp)));
|
mem_free_set(&document->title, stracpy(jsval_to_string(ctx, vp)));
|
||||||
print_screen_status(doc_view->session);
|
print_screen_status(doc_view->session);
|
||||||
break;
|
break;
|
||||||
|
case JSP_DOC_LOC:
|
||||||
case JSP_DOC_URL:
|
case JSP_DOC_URL:
|
||||||
/* According to the specs this should be readonly but some
|
/* According to the specs this should be readonly but some
|
||||||
* broken sites still assign to it (i.e.
|
* broken sites still assign to it (i.e.
|
||||||
|
Loading…
Reference in New Issue
Block a user