We hope to soon start using ES6 features in Gaia, but we have not started that yet.  MDN says that the contains() method is in Gecko 19. But we're still using Gecko 18 for FirefoxOS, so we shouldn't use contains().  Don't use endsWith either.

A regexp would work here, or you could just use substring() and indexOf() to acomplish the test.