diff options
author | Vincent Sanders <vince@kyllikki.org> | 2015-10-05 15:46:22 +0100 |
---|---|---|
committer | Vincent Sanders <vince@kyllikki.org> | 2015-10-05 15:46:22 +0100 |
commit | fbc3f36fb5a72c2cc399d5e83291ffabc299017e (patch) | |
tree | 3fc9807e1a07b5a46ede9fb6af7d1b5002619583 /javascript/duktape/Window.bnd | |
parent | 9ebdc7dd7abb7537f9e47a5dd8dab8585696da0b (diff) | |
download | netsurf-fbc3f36fb5a72c2cc399d5e83291ffabc299017e.tar.gz netsurf-fbc3f36fb5a72c2cc399d5e83291ffabc299017e.tar.bz2 |
initial js navigator binding
Diffstat (limited to 'javascript/duktape/Window.bnd')
-rw-r--r-- | javascript/duktape/Window.bnd | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/javascript/duktape/Window.bnd b/javascript/duktape/Window.bnd index 81f605931..af62eb711 100644 --- a/javascript/duktape/Window.bnd +++ b/javascript/duktape/Window.bnd @@ -95,3 +95,24 @@ getter Window::location() } return 1; %} + +getter Window::navigator() +%{ + duk_push_this(ctx); + duk_get_prop_string(ctx, -1, MAGIC(Navigator)); + if (duk_is_undefined(ctx, -1)) { + duk_pop(ctx); + + if (dukky_create_object(ctx, + PROTO_NAME(NAVIGATOR), + 0) != DUK_EXEC_SUCCESS) { + duk_error(ctx, + DUK_ERR_ERROR, + "Unable to create navigator object"); + return 0; + } + duk_dup(ctx, -1); + duk_put_prop_string(ctx, -3, MAGIC(Navigator)); + } + return 1; +%} |