gremlins.js
gremlins.js copied to clipboard
Bug: gremlins.js aborts too early.
-
gremlins.js
version: 2.2.0 -
node
version: - -
npm
(oryarn
) version : - - browser version: 98.0.2
Steps To Reproduce
When executing code below, gremlins.js
aborted too early.
(function() { function callback() { gremlins.createHorde({ species: [gremlins.species.clicker(),gremlins.species.toucher(),gremlins.species.formFiller(),gremlins.species.scroller(),gremlins.species.typer()], mogwais: [gremlins.mogwais.alert(),gremlins.mogwais.fps(),gremlins.mogwais.gizmo()], strategies: [gremlins.strategies.distribution(),gremlins.strategies.allTogether(),gremlins.strategies.bySpecies()] }).unleash(); } var s = document.createElement("script"); s.src = "https://unpkg.com/gremlins.js"; if (s.addEventListener) { s.addEventListener("load", callback, false); } else if (s.readyState) { s.onreadystatechange = callback; } document.body.appendChild(s); })()
The current behavior
Error occurs, and gremlins.js stops.
Uncaught (in promise) TypeError: m is null La https://unpkg.com/gremlins.js:1 Na https://unpkg.com/gremlins.js:1 promise callback*Na/< https://unpkg.com/gremlins.js:1 Na https://unpkg.com/gremlins.js:1 i https://unpkg.com/gremlins.js:1 n https://unpkg.com/gremlins.js:1 unleash https://unpkg.com/gremlins.js:1 callback debugger eval code:1 EventListener.handleEvent* debugger eval code:1 <anonymous> debugger eval code:1 getEvalResult resource://devtools/server/actors/webconsole/eval-with-debugger.js:243 evalWithDebugger resource://devtools/server/actors/webconsole/eval-with-debugger.js:167 evaluateJS resource://devtools/server/actors/webconsole.js:1127 evaluateJSAsync resource://devtools/server/actors/webconsole.js:1019 makeInfallible resource://devtools/shared/ThreadSafeDevToolsUtils.js:103 }
The expected behavior
gremlins.js should not stop.
Suggested solution:
By auditing and debugging the source code, I found that the reason for the bug is that sometimes https://github.com/marmelab/gremlins.js/blob/master/src/species/typer.js#L69
returns undefined.