summaryrefslogtreecommitdiff
path: root/javascript/duktape/Window.bnd
diff options
context:
space:
mode:
authorVincent Sanders <vince@kyllikki.org>2015-09-07 13:52:57 +0100
committerVincent Sanders <vince@kyllikki.org>2015-09-07 13:53:59 +0100
commit1a43dd21b38805424d717c68a95635d4386bd6d8 (patch)
tree268e3c5f9e76dadd8c7d954f132e79c12dbbe356 /javascript/duktape/Window.bnd
parent1f07c457401a6d944c26319571beb32f3b9009f5 (diff)
downloadnetsurf-1a43dd21b38805424d717c68a95635d4386bd6d8.tar.gz
netsurf-1a43dd21b38805424d717c68a95635d4386bd6d8.tar.bz2
Add initial readonly location implementation
Diffstat (limited to 'javascript/duktape/Window.bnd')
-rw-r--r--javascript/duktape/Window.bnd19
1 files changed, 19 insertions, 0 deletions
diff --git a/javascript/duktape/Window.bnd b/javascript/duktape/Window.bnd
index 1aacd5ac6..4121ac6ca 100644
--- a/javascript/duktape/Window.bnd
+++ b/javascript/duktape/Window.bnd
@@ -76,3 +76,22 @@ getter Window::console()
}
return 1;
%}
+
+getter Window::location()
+%{
+ duk_push_this(ctx);
+ duk_get_prop_string(ctx, -1, MAGIC(Location));
+ if (duk_is_undefined(ctx, -1)) {
+ duk_pop(ctx);
+
+ duk_push_pointer(ctx, llcache_handle_get_url(priv->htmlc->base.llcache));
+
+ if (dukky_create_object(ctx, PROTO_NAME(LOCATION), 1) != DUK_EXEC_SUCCESS) {
+ duk_error(ctx, DUK_ERR_ERROR, "Unable to create location object");
+ return 0;
+ }
+ duk_dup(ctx, -1);
+ duk_put_prop_string(ctx, -3, MAGIC(Location));
+ }
+ return 1;
+%}