diff options
author | Ray Strode <rstrode@redhat.com> | 2018-03-22 13:00:33 -0400 |
---|---|---|
committer | Ray Strode <rstrode@redhat.com> | 2018-04-03 14:16:39 -0400 |
commit | b69e2f7cff4f93dad29ec629aca1a0a0d604f557 (patch) | |
tree | beb3dd1103edac0b2702a5060f1366f1197f5c91 /src | |
parent | ba48e5213c75fc1108f9adf3593aa956fc091926 (diff) | |
download | polkit-b69e2f7cff4f93dad29ec629aca1a0a0d604f557.tar.gz |
jsauthority: use InterruptCallback api instead of OperationCallback
seems like it got renamed.
Signed-off-by: Ray Strode <rstrode@redhat.com>
https://bugs.freedesktop.org/show_bug.cgi?id=105865
Diffstat (limited to 'src')
-rw-r--r-- | src/polkitbackend/polkitbackendjsauthority.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/polkitbackend/polkitbackendjsauthority.cpp b/src/polkitbackend/polkitbackendjsauthority.cpp index 2e26af9..830f5cd 100644 --- a/src/polkitbackend/polkitbackendjsauthority.cpp +++ b/src/polkitbackend/polkitbackendjsauthority.cpp @@ -950,11 +950,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); + JS_ResetInterruptCallback (authority->priv->cx, TRUE); val_str = JS_NewStringCopyZ (cx, "Terminating runaway script"); val = JS::StringValue (val_str); JS_SetPendingException (authority->priv->cx, val); - JS_SetOperationCallback (authority->priv->cx, js_operation_callback); + JS_ResetInterruptCallback (authority->priv->cx, FALSE); return false; } @@ -968,7 +968,7 @@ rkt_on_timeout (gpointer user_data) g_mutex_unlock (&authority->priv->rkt_timeout_pending_mutex); /* Supposedly this is thread-safe... */ - JS_TriggerOperationCallback (authority->priv->rt); + JS_RequestInterruptCallback (authority->priv->cx); /* keep source around so we keep trying to kill even if the JS bit catches the exception * thrown in js_operation_callback() @@ -992,13 +992,15 @@ runaway_killer_setup (PolkitBackendJsAuthority *authority) /* ... rkt_on_timeout() will then poke the JSContext so js_operation_callback() is * called... and from there we throw an exception */ - JS_SetOperationCallback (authority->priv->cx, js_operation_callback); + JS_AddInterruptCallback (authority->priv->cx, js_operation_callback); + JS_ResetInterruptCallback (authority->priv->cx, FALSE); } static void runaway_killer_teardown (PolkitBackendJsAuthority *authority) { - JS_SetOperationCallback (authority->priv->cx, NULL); + JS_ResetInterruptCallback (authority->priv->cx, TRUE); + g_source_destroy (authority->priv->rkt_source); g_source_unref (authority->priv->rkt_source); authority->priv->rkt_source = NULL; |