proper implementation and usage of indices for DOMStubs
proper processing of dom indices
(cherry picked from commit e5401d6)