I think that the newer changes are actually an improvement, though the output changes slightly as a result.  I haven't tweaked the createTCPError function.  But that's probably OK for now.

createTCPError() is, as I have noted, busted.  But that is manageable.  (It uses a component name that I can't find an implementation for in the gecko tree, despite being in a manifest, so it's not that surprising that it's wrong).