Use String#slice instead of discouraged String#substr

Follows-up 7004717af5.

Aside from the confusion and differences between substr() and
substring() and IE8 bugs with substr(), substr() was removed from
the spec as of ECMAScript 5. It's been standardised in the
optional Annex B section of ES5.

Change-Id: I1f9f46f73ea0c79ec7e4c726a86bfe3ffa1924d3