Closed DragonSlayer62 closed 3 months ago
Any help on this project or ideas how to solve this isssue would be greatful because we been working for months on this.
I'd suggest the following:
Also, this is not an appropriate place to get support for each project. If you need more help, please use https://discourse.mozilla.org/c/spidermonkey/551 , or ask in https://chat.mozilla.org/#/room/#spidermonkey:mozilla.org
From the error message you posted, it looks like the conversion to a string is not the problem; the constructor of std::string
copies its argument so it shouldn't matter if the UniqueChars goes out of scope. Anyway, happy to chat elsewhere about this.
so my issue at the moment is two fold Validating that I can find the functions in a script - I think I have this Converting a JSScript * to a std::string. It works, but when the conversion goes out of scope (it's a UniquePtr) I get a memory crash
std::string ConvertJSScriptToString(JSContext cx, JSScript script) { // Ensure the script and context are valid if (!script || !cx) { std::cerr << "Invalid script or context!" << std::endl; return ""; }
}
void ExampleUsage(JSContext cx, JSScript script) { std::string scriptContents = ConvertJSScriptToString(cx, script); std::cout << "Converted script content: " << scriptContents << std::endl; }
i tryed this still get memory crash or null erorr cant find it.
https://github.com/UOX3DevTeam/UOX3/tree/feature/spidermonkey-esr115
here is the project we are working on upgrading from spidermoneky 1.8 to 115
here some of the errors for the stirng console outp[uts
Loading JS Scripts ERROR: JS script failure: Script Number (65535) Message (GetServerSetting is not defined) ERROR: Filename: D:/Local/media/Code/repos/UOX3/UOX3/data/js/server/global.js Line Number: 114 script result: null/undefined (D:/Local/media/Code/repos/UOX3/UOX3/data/js/server/global.js) script result: null/undefined (D:/Local/media/Code/repos/UOX3/UOX3/data/js/server/misc/helpgump.js) script result: null/undefined (D:/Local/media/Code/repos/UOX3/UOX3/data/js/server/timer/long_term_timers.js) WARNING: JS script failure: Message (unreachable code after return statement) ERROR: Compiling D:/Local/media/Code/repos/UOX3/UOX3/data/js/server/resource/pitchers.js caused a construction failure (Details: Compilation failed) script result: null/undefined (D:/Local/media/Code/repos/UOX3/UOX3/data/js/server/misc/facetRuleset.js) ERROR: JS script failure: Script Number (65535) Message (GetServerSetting is not defined) ERROR: Filename: D:/Local/media/Code/repos/UOX3/UOX3/data/js/npc/pets/static_horse.js Line Number: 4 script result: null/undefined (D:/Local/media/Code/repos/UOX3/UOX3/data/js/npc/pets/static_horse.js) ERROR: JS script failure: Script Number (65535) Message (GetServerSetting is not defined) ERROR: Filename: D:/Local/media/Code/repos/UOX3/UOX3/data/js/npc/pets/static_ostard.js Line Number: 4
GetServerSetting is the stirng its tyring to read but seems cant