polkit-github-migration-bot / t4_polkit

Other
0 stars 0 forks source link

jsauthority: ensure to call JS_Init() and JS_ShutDown() exactly once - [closed] #302

Closed polkit-github-migration-bot closed 9 months ago

polkit-github-migration-bot commented 3 years ago

In gitlab.freedesktop.org by xry111 on Aug 10, 2021, 13:04

Link to the original merge request: https://gitlab.freedesktop.org/polkit/polkit/-/merge_requests/91 This merge request consists of the following commits:

Before this commit, we were calling JS_Init() in polkit_backend_js_authority_class_init and never called JS_ShutDown. This is actually a misusage of SpiderMonkey API. Quote from a comment in js/Initialization.h (both mozjs-78 and mozjs-91):

It is currently not possible to initialize SpiderMonkey multiple
times (that is, calling JS_Init/JSAPI methods/JS_ShutDown in that
order, then doing so again).

This misusage does not cause severe issues with mozjs-78. However, when we eventually port jsauthority to use mozjs-91, bad thing will happen: see the test failure mentioned in #150.

This commit is tested with both mozjs-78 and mozjs-91, all tests pass with it.")