From 0b3c5d2a252d8873907833a8f8bb991fa758ac68 Mon Sep 17 00:00:00 2001 From: Ray Strode Date: Thu, 22 Mar 2018 13:00:33 -0400 Subject: [PATCH] jsauthority: adapt arguments for new JS::Compile API The global object is implicit now and the result is an out arg. This commit adapts to the new api. Signed-off-by: Ray Strode https://bugs.freedesktop.org/show_bug.cgi?id=105865 --- src/polkitbackend/polkitbackendjsauthority.cpp | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/polkitbackend/polkitbackendjsauthority.cpp b/src/polkitbackend/polkitbackendjsauthority.cpp index 9bb6da8..f20ec9d 100644 --- a/src/polkitbackend/polkitbackendjsauthority.cpp +++ b/src/polkitbackend/polkitbackendjsauthority.cpp @@ -275,67 +275,62 @@ load_scripts (PolkitBackendJsAuthority *authority) dir = g_dir_open (dir_name, 0, &error); if (dir == NULL) { polkit_backend_authority_log (POLKIT_BACKEND_AUTHORITY (authority), "Error opening rules directory: %s (%s, %d)", error->message, g_quark_to_string (error->domain), error->code); g_clear_error (&error); } else { const gchar *name; while ((name = g_dir_read_name (dir)) != NULL) { if (g_str_has_suffix (name, ".rules")) files = g_list_prepend (files, g_strdup_printf ("%s/%s", dir_name, name)); } g_dir_close (dir); } } files = g_list_sort (files, (GCompareFunc) rules_file_name_cmp); for (l = files; l != NULL; l = l->next) { const gchar *filename = (gchar *)l->data; JS::RootedScript script(authority->priv->cx); JS::CompileOptions options(authority->priv->cx); - JS::RootedObject obj(authority->priv->cx,authority->priv->js_global); options.setUTF8(true); - script = JS::Compile (authority->priv->cx, - obj, options, - filename); - - if (script == NULL) + if (!JS::Compile (authority->priv->cx, options, filename, &script)) { polkit_backend_authority_log (POLKIT_BACKEND_AUTHORITY (authority), "Error compiling script %s", filename); continue; } /* evaluate the script */ JS::RootedValue rval(authority->priv->cx); if (!execute_script_with_runaway_killer (authority, script, &rval)) { polkit_backend_authority_log (POLKIT_BACKEND_AUTHORITY (authority), "Error executing script %s", filename); continue; } //g_print ("Successfully loaded and evaluated script `%s'\n", filename); num_scripts++; } polkit_backend_authority_log (POLKIT_BACKEND_AUTHORITY (authority), "Finished loading, compiling and executing %d rules", num_scripts); g_list_free_full (files, g_free); } -- 2.16.2