From 0e5762a48df91b127f6976a1adb4df7bfa24d1b2 Mon Sep 17 00:00:00 2001 From: Ray Strode Date: Thu, 22 Mar 2018 13:00:33 -0400 Subject: [PATCH] jsauthority: fix how classes are defined mozjs no longer has public stub functions that implementers of JSClass objects are supposed to use. Instead NULL means to use the default stub implementations. Furthermore, the structure has been broken out into a JSClassOps sub structure now. This commit adapts the code to the new layout. Signed-off-by: Ray Strode https://bugs.freedesktop.org/show_bug.cgi?id=105865 --- src/polkitbackend/polkitbackendjsauthority.cpp | 49 ++++++++++++++++---------- 1 file changed, 31 insertions(+), 18 deletions(-) diff --git a/src/polkitbackend/polkitbackendjsauthority.cpp b/src/polkitbackend/polkitbackendjsauthority.cpp index 0f3761b..384ea79 100644 --- a/src/polkitbackend/polkitbackendjsauthority.cpp +++ b/src/polkitbackend/polkitbackendjsauthority.cpp @@ -122,88 +122,101 @@ enum /* ---------------------------------------------------------------------------------------------------- */ static gpointer runaway_killer_thread_func (gpointer user_data); static void runaway_killer_terminate (PolkitBackendJsAuthority *authority); static GList *polkit_backend_js_authority_get_admin_auth_identities (PolkitBackendInteractiveAuthority *authority, PolkitSubject *caller, PolkitSubject *subject, PolkitIdentity *user_for_subject, gboolean subject_is_local, gboolean subject_is_active, const gchar *action_id, PolkitDetails *details); static PolkitImplicitAuthorization polkit_backend_js_authority_check_authorization_sync ( PolkitBackendInteractiveAuthority *authority, PolkitSubject *caller, PolkitSubject *subject, PolkitIdentity *user_for_subject, gboolean subject_is_local, gboolean subject_is_active, const gchar *action_id, PolkitDetails *details, PolkitImplicitAuthorization implicit); G_DEFINE_TYPE (PolkitBackendJsAuthority, polkit_backend_js_authority, POLKIT_BACKEND_TYPE_INTERACTIVE_AUTHORITY); /* ---------------------------------------------------------------------------------------------------- */ +static const struct JSClassOps js_global_class_ops = { + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL +}; + static JSClass js_global_class = { "global", JSCLASS_GLOBAL_FLAGS, - JS_PropertyStub, - JS_DeletePropertyStub, - JS_PropertyStub, - JS_StrictPropertyStub, - JS_EnumerateStub, - JS_ResolveStub, - JS_ConvertStub, - NULL, - JSCLASS_NO_OPTIONAL_MEMBERS + &js_global_class_ops }; /* ---------------------------------------------------------------------------------------------------- */ +static const struct JSClassOps js_polkit_class_ops = { + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL +}; static JSClass js_polkit_class = { "Polkit", 0, - JS_PropertyStub, - JS_DeletePropertyStub, - JS_PropertyStub, - JS_StrictPropertyStub, - JS_EnumerateStub, - JS_ResolveStub, - JS_ConvertStub, - NULL, - JSCLASS_NO_OPTIONAL_MEMBERS + &js_polkit_class_ops }; static JSBool js_polkit_log (JSContext *cx, unsigned argc, jsval *vp); static JSBool js_polkit_spawn (JSContext *cx, unsigned argc, jsval *vp); static JSBool js_polkit_user_is_in_netgroup (JSContext *cx, unsigned argc, jsval *vp); static JSFunctionSpec js_polkit_functions[] = { JS_FS("log", js_polkit_log, 0, 0), JS_FS("spawn", js_polkit_spawn, 0, 0), JS_FS("_userIsInNetGroup", js_polkit_user_is_in_netgroup, 0, 0), JS_FS_END }; /* ---------------------------------------------------------------------------------------------------- */ static void report_error (JSContext *cx, const char *message, JSErrorReport *report) { PolkitBackendJsAuthority *authority = POLKIT_BACKEND_JS_AUTHORITY (JS_GetContextPrivate (cx)); polkit_backend_authority_log (POLKIT_BACKEND_AUTHORITY (authority), "%s:%u: %s", report->filename ? report->filename : "", (unsigned int) report->lineno, message); } static void polkit_backend_js_authority_init (PolkitBackendJsAuthority *authority) -- 2.16.2