[tern addon] Fix bug in findDoc method causing docs to get added with name of 'undefined'

The name var was getting clobbered in the initial for-in loop, so the
second loop would never be entered.