summaryrefslogtreecommitdiff
path: root/javascript/jsapi/htmldocument.bnd
diff options
context:
space:
mode:
authorVincent Sanders <vince@netsurf-browser.org>2012-12-07 15:50:24 +0000
committerVincent Sanders <vince@netsurf-browser.org>2012-12-07 15:50:24 +0000
commit04825c62df92c8adef3f40f89c7b5d88b963f833 (patch)
treec25b0abd1934c0dd2aeccffd13083510c1fa6aa8 /javascript/jsapi/htmldocument.bnd
parent99f93da0f3a510df51c5a057e7597c570a636f9d (diff)
downloadnetsurf-04825c62df92c8adef3f40f89c7b5d88b963f833.tar.gz
netsurf-04825c62df92c8adef3f40f89c7b5d88b963f833.tar.bz2
implement document.URL and document.documentURI
Diffstat (limited to 'javascript/jsapi/htmldocument.bnd')
-rw-r--r--javascript/jsapi/htmldocument.bnd22
1 files changed, 20 insertions, 2 deletions
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;