mirror of
https://github.com/pewdiepie-archdaemon/odysseus.git
synced 2026-11-08 14:12:22 +01:00
_isAgent was a const inside the try block of handleChatSubmit, but the catch block reads it to pick the timeout message, so a client timeout threw a ReferenceError and left the reply bubble empty. Declare it next to the other catch-visible variables and assign it where it is computed.
14 lines
447 B
Python
14 lines
447 B
Python
from pathlib import Path
|
|
import re
|
|
|
|
|
|
ROOT = Path(__file__).resolve().parents[1]
|
|
|
|
|
|
def test_timeout_catch_can_read_is_agent():
|
|
"""The catch block reads _isAgent, so it must not be a try-scoped const (#6764)."""
|
|
src = (ROOT / "static/js/chat.js").read_text()
|
|
assert re.search(r"^\s*let _isAgent = false;", src, re.M)
|
|
assert not re.search(r"\bconst _isAgent\b", src)
|
|
assert re.search(r"^\s*_isAgent = \(_tState\.mode", src, re.M)
|