Modified Files:
js_bbs.cpp js_com.c js_console.cpp js_file.c js_global.c
js_msgbase.c js_queue.c js_socket.c js_system.c js_user.c
main.cpp sbbs.h
Log Message:
Define and use a wrapper for JS_GetInstancePrivate(): js_GetClassPrivate()
Use this in place of JS_GetPrivate() in native class methods that need the class instance's private data pointer and will do bad things if that pointer points to something other than what is expected. mcmlxxix (matt) discovered that using Object.apply(), you can invoke class methods where the 'this' instance is a different class. This would result in
"Internal Error: No Private Data." or a crash.
So now, gracefully detect this condition and report a meaningful error: "'<class-name>' instance: No Private Data or Class Mismatch"
Also, important to note: if the method uses JS_THIS_OBJECT to get the JSObject* to pass to JS_Get*Private, then it must do this *before* it calls JS_SET_RVAL.
From jsapi.h:
* NB: there is an anti-dependency between JS_CALLEE and JS_SET_RVAL: native
* methods that may inspect their callee must defer setting their return value
* until after any such possible inspection. Otherwise the return value will be
* inspected instead of the callee function object.
The js_crypt*.c files still need this treatment.
---
þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net
Who's Online
Recent Visitors
Ragnarok
Sat Sep 13 04:32:13 2025
from
Dock Sud
via
Telnet
Gus8027
Sat Sep 13 03:35:28 2025
from
Buenos Aies
via
Telnet
Ragnarok
Sat Sep 13 01:51:04 2025
from
Dock Sud
via
HTTP
Ragnarok
Sat Sep 13 01:50:17 2025
from
Dock Sud
via
SSH
Guest
Sat Sep 13 00:25:47 2025
from
Linuxshell
via
Raw
Damian Kleiman
Fri Sep 12 22:55:56 2025
from
Rosario, Sf
via
Telnet
Ragnarok
Fri Sep 12 09:09:14 2025
from
Dock Sud
via
NNTP
Ragnarok
Thu Sep 11 20:41:27 2025
from
Dock Sud
via
SSH
Damian Kleiman
Thu Sep 11 00:01:30 2025
from
Rosario, Sf
via
Telnet
Ragnarok
Wed Sep 10 22:41:23 2025
from
Dock Sud
via
SSH