mirror of
https://github.com/rkd77/elinks.git
synced 2024-09-14 00:48:28 -04:00
b94657869b
Previously, spidermonkey_get_interpreter() and init_smjs() each called JS_SetErrorReporter on the JSContexts they created. However, JS_SetErrorReporter actually sets the error reporter of the JSRuntime associated with the JSContext, and all of our JSContexts use the same JSRuntime nowadays, so only the error_reporter() of src/ecmascript/spidermonkey.c was left installed. Because this error_reporter() asserts that JS_GetContextPrivate(ctx) returns a non-NULL pointer, and init_smjs() does not set a private pointer for smjs_ctx, any error in smjs_ctx could cause an assertion failure, at least in principle. Fix this by making spidermonkey_runtime_addref() install a shared error_reporter() when it creates the JSRuntime and the first JSContext. The shared error_reporter() then checks the JSContext and calls the appropriate function. The two error reporters are quite similar with each other. In the future, we could move the common code into shared functions. I'm not doing that yet though, because fixing the bug doesn't require it. |
||
---|---|---|
.. | ||
see | ||
spidermonkey | ||
ecmascript.c | ||
ecmascript.h | ||
Makefile | ||
see.c | ||
see.h | ||
spidermonkey-shared.c | ||
spidermonkey-shared.h | ||
spidermonkey.c | ||
spidermonkey.h |