Simplify code and add more checks. Fixes #2105. R=rsc CC=golang-dev https://golang.org/cl/4794060
Attach a file by drag & drop or click to upload