Share code between HTMLScriptElement:Text and Node:GetTextContent

Added a function in Node called collect_text_contents which is called
from both places.

Fixes #3157
Merge pull request #3189 from gilles-leblanc/issue-3157

Share code between HTMLScriptElement:Text and Node:GetTextContent; r=Manishearth