Ragna.roBrowser
Ragna.roBrowser copied to clipboard
Config.js doesn't block callers when loading. Causing invalid values to be returned and crashes MapEngine.
Describe the bug Config.js needs to iterate through a loop to load the server's config. This takes time and is done async. As a result, any calls to Config.get() or Config.getServer() before that loop is finished, results in the default values being given back to the callers. Even if the actual config (such as from index.html) says otherwise.
The biggest issue caused by this is within MapEngine. Where CheckAttendance's and MapName's require() are behind a call to Config.get() === true. The default value is false for both, and a false result from Config.get() will result in the require() never being executed.
If this bug occurs and the server has one or both of these UIs enabled, then after Config finishes loading subsequent calls to Config.get() will return true, but the UI objects in MapEngine will still be undefined. This results in MapEngine calling functions like prepare() or append() on an undefined value, crashing MapEngine during init(), and leaving the user with an unusable black screen.
Screenshots (if applicable)
Packet/Client version PACKETVER 20210406
Browser/device info
- Browser: Version 126.0.6478.126 (Official Build) built on Debian 12.5, running on Debian 12.6 (64-bit)
- Device: Debian 12 / Linux PC
Additional context The correct fix would be to block callers to Config's getter and setter methods, until the init loop finishes execution. But a quick attempt at fixing it by modifying Config.js, results in a hung UI that stops loading anything after Online.js.