Refactored debug toolbar to use plain javascript #7400

`getSize()` is MT as well.