summaryrefslogtreecommitdiff
path: root/content/handlers/javascript/duktape/Window.bnd
diff options
context:
space:
mode:
authorMichael Drake <michael.drake@codethink.co.uk>2017-03-22 15:44:53 +0000
committerMichael Drake <tlsa@netsurf-browser.org>2017-03-23 14:56:32 +0000
commit5d39972b9fe74b3618d08cf1bf4b14a01d420809 (patch)
treeb3cb17228c2f141f71f5114aa56321b59291fd6f /content/handlers/javascript/duktape/Window.bnd
parentff8e5c99a038d6325b72e90ada824bcfd3ab9cc7 (diff)
downloadnetsurf-5d39972b9fe74b3618d08cf1bf4b14a01d420809.tar.gz
netsurf-5d39972b9fe74b3618d08cf1bf4b14a01d420809.tar.bz2
Duktape 2.X: duk_error now returns a duk_ret_t
https://github.com/svaarala/duktape/blob/master/doc/release-notes-v2-0.rst#duk_error-duk_error_va-duk_throw-duk_fatal-have-a-return-value This also changes Console.bnd to return on error, rather than ignoring it.
Diffstat (limited to 'content/handlers/javascript/duktape/Window.bnd')
-rw-r--r--content/handlers/javascript/duktape/Window.bnd9
1 files changed, 3 insertions, 6 deletions
diff --git a/content/handlers/javascript/duktape/Window.bnd b/content/handlers/javascript/duktape/Window.bnd
index 489587899..4af8c7aa9 100644
--- a/content/handlers/javascript/duktape/Window.bnd
+++ b/content/handlers/javascript/duktape/Window.bnd
@@ -72,8 +72,7 @@ getter Window::console()
if (duk_is_undefined(ctx, -1)) {
duk_pop(ctx);
if (dukky_create_object(ctx, PROTO_NAME(CONSOLE), 0) != DUK_EXEC_SUCCESS) {
- duk_error(ctx, DUK_ERR_ERROR, "Unable to create console object");
- return 0;
+ return duk_error(ctx, DUK_ERR_ERROR, "Unable to create console object");
}
duk_dup(ctx, -1);
duk_put_prop_string(ctx, -3, MAGIC(Console));
@@ -91,8 +90,7 @@ getter Window::location()
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;
+ return duk_error(ctx, DUK_ERR_ERROR, "Unable to create location object");
}
duk_dup(ctx, -1);
duk_put_prop_string(ctx, -3, MAGIC(Location));
@@ -110,10 +108,9 @@ getter Window::navigator()
if (dukky_create_object(ctx,
PROTO_NAME(NAVIGATOR),
0) != DUK_EXEC_SUCCESS) {
- duk_error(ctx,
+ return 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));