Closed mraleph closed 8 years ago
This was originally done because readAsText
apparently normalizes all line endings to native.
The web UI cannot load .cfg and .asm correctly on Windows Chrome. The reason is that FileReader.readAsText returns the native end of line \r\n, which is different from Linux \n. Therefore cannot match the regular expression r"(begin|end)_(compilation|cfg)\n".
https://code.google.com/p/irhydra/issues/detail?id=23
Needs investigation on Windows. Maybe we should be loading as binary instead to prevent line endings normalization.
(maybe endings are already normalized by IO functions? this brings us to an unfortunately situation.)
Indeed output in code.asm
has line endings normalized because CodeTracer
opens file in "a"
mode instead of "ab"
mode.
Now displaying more meaningful errors (instead of raw obfuscated stack traces) 137ccaf1facc8a6f78157d9e62603b6832c2383b
I just dropped support for older V8, switched to using readAsBinaryString
and removed line endings normalization entirely.
V8's CodeTracer
has been fixed back in February.
We force normalize line endings in files when loading, this however does not work for the source.
If original source use \r\n endings source positions will no longer match the original source.
This leads to random breakage inside the source_annotator which is very hard to diagnose.