Improves search of EI (end of inlined image)

Fixes https://bugzilla.mozilla.org/show_bug.cgi?id=878194