Page MenuHomePhabricator

Fix Javascript busy loop when trying to delete tokens from an empty tokenizer
ClosedPublic

Authored by epriestley on Jun 1 2018, 8:08 PM.
Tags
None
Referenced Files
Unknown Object (File)
Apr 22 2026, 5:25 AM
Unknown Object (File)
Apr 21 2026, 8:05 PM
Unknown Object (File)
Apr 10 2026, 2:56 AM
Unknown Object (File)
Mar 7 2026, 9:45 AM
Unknown Object (File)
Nov 15 2025, 6:28 PM
Unknown Object (File)
Nov 8 2025, 4:14 PM
Unknown Object (File)
Nov 7 2025, 7:38 PM
Unknown Object (File)
Oct 7 2025, 9:34 AM
Subscribers
None

Details

Summary

Fixes T13147. In D19437, I changed this logic to support deleting the "" (empty string) token, but [].pop() returns undefined, not null, if the list is empty and I didn't think to try deleting an empty input.

Fix the logic so we don't end up in a loop if the input is empty.

Test Plan
  • In any browser, deleted all tokens in a tokenizer; then pressed delete again.
  • Before: tab hangs in an infinte loop.
  • After: smooth sailing.

Diff Detail

Repository
rP Phabricator
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

👍
Javascript is !!fun!!.

This revision is now accepted and ready to land.Jun 1 2018, 8:27 PM
This revision was automatically updated to reflect the committed changes.