Implement a TextResource used by ScriptResource and StyleSheetResource.

There is a bunch of logic that was duplicated and I need something
similar for the Web Manifest.

BUG=None

Review URL: https://codereview.chromium.org/292983012

git-svn-id: svn://svn.chromium.org/blink/trunk@174760 bbb929c8-8fbe-4397-9dbb-9b2b20218538