From 04825c62df92c8adef3f40f89c7b5d88b963f833 Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Fri, 7 Dec 2012 15:50:24 +0000 Subject: implement document.URL and document.documentURI --- javascript/jsapi/htmldocument.bnd | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) (limited to 'javascript/jsapi/htmldocument.bnd') diff --git a/javascript/jsapi/htmldocument.bnd b/javascript/jsapi/htmldocument.bnd index 72bc81482..f17190d0c 100644 --- a/javascript/jsapi/htmldocument.bnd +++ b/javascript/jsapi/htmldocument.bnd @@ -56,6 +56,7 @@ api finalise %{ } %} + getter location %{ if (!JSVAL_IS_VOID(JSAPI_PROP_RVAL(cx,vp))) { /* already created - return it */ @@ -64,10 +65,27 @@ getter location %{ jsret = jsapi_new_Location(cx, NULL, NULL, - private->htmlc->bw, - llcache_handle_get_url(private->htmlc->base.llcache)); + llcache_handle_get_url(private->htmlc->base.llcache), + private->htmlc); +%} + +getter URL %{ + jsval loc; + jsval jsstr = JSVAL_NULL; + if (JS_GetProperty(cx, obj, "location", &loc) == JS_TRUE) { + JS_GetProperty(cx, JSVAL_TO_OBJECT(loc), "href", &jsstr); + } + jsret = JSVAL_TO_STRING(jsstr); %} +getter documentURI %{ + jsval loc; + jsval jsstr = JSVAL_NULL; + if (JS_GetProperty(cx, obj, "location", &loc) == JS_TRUE) { + JS_GetProperty(cx, JSVAL_TO_OBJECT(loc), "href", &jsstr); + } + jsret = JSVAL_TO_STRING(jsstr); +%} getter cookie %{ char *cookie_str; -- cgit v1.2.3