Comment 46 for bug 261595

Created attachment 756486
Write updated popstate in tempfile first, then move over

As in Bug 246675, using NS_NewSafeLocalFileOutputStream now, which is an existing implementation that writes to a temp file first.

I verified that this patch works using strace and filling the disk. Writing to the temp file fails, and rename is not done, preserving the original file.

I think MsgNewSafeBufferedFileOutputStream should now be used in a number of other places. Please review.