could you try with a newer version of mozilla? I think this is a duplicate of a bug I may have already fixed. If you can still reproduce this bug with a newer version, could you please attach a more complete example? For example, I can't tell if your document.write stuff is in an attribute or in a <script> section or ?
just did some testing on this one, I will attach my test case. 1. open test case in browser, select File|Edit 2. in composer, enter some text, save it out under a new name 3. open saved test case in a simple text editor, content is fine marking as wfm, reporter if your test is different than the one I have attached, please attach a test case and reopen if you can repro this one.
Verified in 8-30 build