From b544f10dd469ae3cfedc026db71ee76e9ef511a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miloslav=20Trma=C4=8D?= Date: Tue, 1 Jul 2014 20:00:48 +0200 Subject: 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 --- src/polkitbackend/polkitbackendjsauthority.c | 2 ++ 1 file changed, 2 insertions(+) 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; } -- cgit v1.2.1