Closed Bug 328981 Opened 18 years ago Closed 18 years ago

History DB page titles are displayed corrupt in url bar autocomplete, endian problem turns Latin characters into Chinese

Categories

(Firefox :: Bookmarks & History, defect)

1.5.0.x Branch
All
macOS
defect
Not set
major

Tracking

()

RESOLVED FIXED

People

(Reporter: mark, Assigned: mark)

References

Details

(Keywords: fixed1.8.1, verified1.8.0.2, Whiteboard: [rft-dl])

Attachments

(1 file, 2 obsolete files)

Strings stored in history.dat are stored as UCS2.  This includes page titles.  history.dat is supposed to have a native endianness, set when the file is created or reset.  When using a history.dat file whose native endianness does not match the host architecture's endianness, existing page titles in the database are not being swapped (or are double-swapped?) for display in the url bar autocomplete.  This results in corrupt page titles being displayed in the history autocomplete dropdown.

Although bytes aren't swapped when reading from history.dat, they are swapped as needed when writing to it.  This means that if you have a history.dat file set as other-endian, even new pages you visit will wind up with bad page titles being displayed.  Other reads from history seem unaffected: the Go menu and history sidebar do not have corrupt text.

This will affect people who had run Firefox under Rosetta on x86 and switch to a native version, people who migrate from a ppc to x86 and copy their profile (or have their profile copied by a migration assistant), and people who wish to flip Rosetta on and off to use plugins that haven't yet been ported to x86.

This was fixed for Core:History in bug 108134.  The byte-swapping code is still in the toolkit history implementation, we need to find out why the swaps don't happen (or happen twice?) during reads from history for url bar autocomplete display.
Is this problem going to be nullified with the Places landing I wonder?
Yeah, that's why I set the version to 1.5.0.x.
Nominating because of the effect this has on the x86 transition.
Flags: blocking1.8.0.2?
Flags: blocking1.8.0.2? → blocking1.8.0.2+
nsAutoCompleteController (toolkit) isn't getting its strings from nsGlobalHistory, here:

http://bonsai.mozilla.org/cvsblame.cgi?file=mozilla/toolkit/components/history/src/nsGlobalHistory.cpp&rev=1.58.2.2.2.2&mark=992-1004#976

Instead, it's getting them from nsAutoCompleteMdbResult, here:

http://bonsai.mozilla.org/cvsblame.cgi?file=mozilla/toolkit/components/autocomplete/src/nsAutoCompleteMdbResult.cpp&rev=1.9&mark=249-250#228

nsAutoCompleteMdbResult doesn't do any byte-swapping.
This patch was prepared against the 1.8.0 branch, because Places nullifies it on the trunk and 1.8 branch.  Even so, I intend to bake it there - that code shouldn't fall behind until it's permanently disabled.  This applies to the trunk with fuzz 7 (UCS2 APIs were deprecated in favor of UTF16).
Attachment #213700 - Flags: review?(bryner)
Attachment #213700 - Flags: approval-branch-1.8.1?(bryner)
Attached patch v2, avoid an AND in SwapBytes (obsolete) — Splinter Review
Updated with feedback from 328982
Attachment #213700 - Attachment is obsolete: true
Attachment #213846 - Flags: review?(bryner)
Attachment #213700 - Flags: review?(bryner)
Attachment #213700 - Flags: approval-branch-1.8.1?(bryner)
Blocks: 328982
i thought we weren't going to change interfaces for 1.5.0.x. releases...?
Well, I doubt anyone else is using anything as specific as nsIAutoCompleteMdbResult, but OK.  Here, the change is forked out into an extended nsIAutoCompleteMdbResult2 interface.
Attachment #213846 - Attachment is obsolete: true
Attachment #213851 - Flags: review?(bryner)
Attachment #213846 - Flags: review?(bryner)
Whiteboard: has patch, needs review
Whiteboard: has patch, needs review → has patch, needs r=bryner
Attachment #213851 - Flags: review?(bryner) → review+
Comment on attachment 213851 [details] [diff] [review]
v3, with extended interface

Checked in on the trunk, but with Places on, it's not part of the build there.
Attachment #213851 - Flags: approval1.8.0.2?
Attachment #213851 - Flags: approval-branch-1.8.1?(bryner)
Status: NEW → RESOLVED
Closed: 18 years ago
Resolution: --- → FIXED
Whiteboard: has patch, needs r=bryner
Oops, my comment about new/delete vs malloc/free from bug 328982 applies here as well.
Attachment #213851 - Flags: approval-branch-1.8.1?(bryner) → approval-branch-1.8.1+
Comment 10 addressed on trunk.
Comment on attachment 213851 [details] [diff] [review]
v3, with extended interface

a=timr for drivers.  We were waiting for bryner's review.  Got that.  Land it!
Attachment #213851 - Flags: approval1.8.0.2? → approval1.8.0.2+
Landed on 1_8 and 1_8_0 branches.
Whiteboard: [rft-dl]
Changing OS to MacOS X.  This is MacOS X only, right?  From Mark's comments, someone with an x86 Mac should verify this.  Cc'ing Marcia in case she can do it.
OS: All → MacOS X
This is not Mac OS X only, it affects any profile shared beteween different-endian systems.  Practically speaking, though, it's OS X-only, because that's the only platform for which official builds are produced for big-endian processors.
verified on 180 branch using universal binary built on maya - Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US; rv:1.8.0.2) Gecko/20060310 Firefox/1.5.0.2
*** Bug 330249 has been marked as a duplicate of this bug. ***
How to install this attach "v3, with extended interface"?? I have I Imac Intel. 

I need to copile??  If I click on the link just open a "text" code.
Firefox 1.5.0.2, release planned soon, will ship with this fix.  In the mean time, you can download a nightly universal build (http://ftp.mozilla.org/pub/mozilla.org/firefox/nightly/experimental/universal-binaries/latest-Mozilla1.8.0/).  For help compiling Mozilla from source yourself, see http://developer.mozilla.org/en/docs/Mac_OS_X_Build_Prerequisites .
Component: History → Bookmarks & History
QA Contact: history → bookmarks
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: