summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiloslav Trmač <mitr@redhat.com>2014-07-01 20:00:48 +0200
committerMiloslav Trmač <mitr@redhat.com>2015-06-19 04:30:54 +0200
commitb544f10dd469ae3cfedc026db71ee76e9ef511a2 (patch)
tree914889428bc1a8efc6987b67dc15be5ee906e116
parent2881f8b260c03df29afb0e35e6d1707240f95ad7 (diff)
downloadpolkit-b544f10dd469ae3cfedc026db71ee76e9ef511a2.tar.gz
Clear the JS operation callback before invoking JS in the callback
Setting the callback to NULL is required by https://developer.mozilla.org/en-US/docs/SpiderMonkey/JSAPI_Reference/JS_SetOperationCallback to avoid the possibility of recursion. https://bugs.freedesktop.org/show_bug.cgi?id=69501
-rw-r--r--src/polkitbackend/polkitbackendjsauthority.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/polkitbackend/polkitbackendjsauthority.c b/src/polkitbackend/polkitbackendjsauthority.c
index 22812a6..8a0a097 100644
--- a/src/polkitbackend/polkitbackendjsauthority.c
+++ b/src/polkitbackend/polkitbackendjsauthority.c
@@ -961,9 +961,11 @@ js_operation_callback (JSContext *cx)
polkit_backend_authority_log (POLKIT_BACKEND_AUTHORITY (authority), "Terminating runaway script");
/* Throw an exception - this way the JS code can ignore the runaway script handling */
+ JS_SetOperationCallback (authority->priv->cx, NULL);
val_str = JS_NewStringCopyZ (cx, "Terminating runaway script");
val = STRING_TO_JSVAL (val_str);
JS_SetPendingException (authority->priv->cx, val);
+ JS_SetOperationCallback (authority->priv->cx, js_operation_callback);
return JS_FALSE;
}