Firefox bug: The history database is endian-specific

Introduction

This page demonstrates the endian-problems in Firefox's history database.

What's Wrong

The bug is that Firefox records and displays website titles in an endian-dependent fashion. If a user only ever uses one platform, they'll never notice. If the user changes between big-endian and little-endian machines, their history file will be filled half with big-endian titles and half with little-endian titles, and will not display properly on either platform.

The bug is particularly noticeable when typing URLs into the location bar, because the autocompletion window that pops up will be full of random chinese characters where web site titles should be. For example, compare these two screenshots, one taken on a little-endian machine, the other on a big-endian machine:

Firefox's URL bar, viewed on a little-endian machine:
screenshot of autocompletion pop-up menu

Firefox's URL bar, viewed on a big-endian machine.
screenshot of pop-up autocompletion menu

How to reproduce:

  1. Run Firefox on a little-endian machine, like an Intel PC running Linux. Visit some pages, such as:
    http://web.mit.edu/jmorzins/www/mozilla/little-endian.html
  2. Quit Firefox (to save your history).
  3. Run Firefox on a big-endian machine, like a Sun SunBlade running Solaris. Visit some pages, such as:
    http://web.mit.edu/jmorzins/www/mozilla/big-endian.html
  4. Quit Firefox (to save your history).
  5. Now restart Firefox. Notice that:
    1. if you type URLs into the location bar, the pop-up autocompletion menu has garbled (Chinese!) titles for other-endian platforms
    2. if you view your history, the list of titles in the history has garbled (Chinese!) titles for other-endian platforms.

What should have happened

Firefox should either store titles in an endian-independent fashion, or should use the unicode Byte Order Mark (U+FEFF) to label (and detect) the endian-ness of each title string.

Any other information?

I submitted this bug against Mozilla nearly three years ago - bug 108134. It was fixed in Mozilla about a year ago. Apparently it hasn't yet been fixed in Firefox.