like js::ComputeStackString and other browsers do; r=jorendorff https://bugzilla.mozilla.org/show_bug.cgi?id=1038238