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
F18765110: D19456.diff
Tue, Oct 7, 9:34 AM
F18759274: D19456.id46543.diff
Mon, Oct 6, 2:48 AM
F18677745: D19456.id46547.diff
Thu, Sep 25, 9:26 PM
F18638655: D19456.diff
Sep 17 2025, 11:18 AM
F18623056: D19456.diff
Sep 15 2025, 2:05 PM
F18575607: D19456.id46547.diff
Sep 10 2025, 1:32 PM
F18574896: D19456.id46547.diff
Sep 10 2025, 11:59 AM
F18543895: D19456.diff
Sep 8 2025, 12:09 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
Branch
loop1
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 20352
Build 27639: Run Core Tests
Build 27638: arc lint + arc unit

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.