This fixes bug 20748 and bug 15819 without breaking the other tests. Reverts r88971. The conflict with CategoryTree was the old problem of a message being called inside of a parser callback, this time with clearState for which the hook is global.