fix bug 863527 by updating test instead of parsing untrusted input (v2)

2nd attempt at fixing bug 863527 - exactly the same as PR https://github.com/mozilla-b2g/gaia/pull/9311 except now without the linter error. 

(I broke the last branch while trying to combine commits into one, so it was easier to start a new branch, hence the new PR).