Bug 1113005 - Copy only the necessary number of bytes from the source buffer; r=froydnj

--HG--
extra : amend_source : 2367a3ad35a599790fc333e35e1b9272653463a1
Bug 1113796 - Use the WhiteSpaceOrNewlineIsSignificant() helper method; r=roc