Currently, it will fail to handle zero length strings if it has a pending character.
Created attachment 295327 [details] proposed patch.
Comment on attachment 295327 [details] proposed patch. r=me
Thanks for the review. Landed in r208958: <http://trac.webkit.org/r208958>.