Don't try to look up a number in an array of strings

For #5104. @dangoor 

The actual bug fix is one line. The only other changes here were to move `_dumpMarks()` into HTMLInstrumentation (it wasn't being used in the unit tests and we could just re-expose it there later if we want) and to add something to the unit tests that double-checks the marks to make sure we don't create multiple marks with the same tag ID in any of the editing tests.