Chrome Transition Values

The Chrome transition values are nothing new and haven’t changed much through all the different releases of Chrome.  They have been discussed in a number of places.  However, most of the articles I’ve seen focus on the meaning of the decoded value and only briefly reference just how to get to it.

The short explanation is to take the stored transition value, AND it with 0xFF, and look the resulting value up in a table.

Some of what is implied above might be confusing for someone without a computer science background or programming experience, so let’s break it down.

Let’s use the value 268435458, taken directly from visits.transition in the History database.

1.  Convert to hex
To better understand what is going on, the first implied step is to convert the stored value from decimal to hex.  This will make step 2 more clear.  Many applications can do this conversion, including the Windows Calculator or Google.

268435458 (decimal) = 0x10000002

2.  AND the value with 0xFF
Chrome calls 0xFF the ‘CORE_MASK’ because the last two hex digits make up the ‘core’ transition value.   Since the transition value we’re looking at (0x10000002) is bigger than just two hex characters, I’ll pad the CORE_MASK out with zeros to make it match (0x000000FF).  Since bitwise ANDing a value with 1 simply returns the value, and 0xF = 1111 (binary), all this mask does is say we care about the last two hex digits and can drop the preceding characters.  Performing this operation yields 2:

AND 0x000000FF
  = 0x00000002

If you don’t want to do the operation by hand or with a scripting language, Wolfram Alpha can do it.

3.  Look up value in transition table
Since Chrome is open source, we can look up in the code what each transition value means.  I’ve summarized what each transition code means in the table below; the source code has more complete descriptions of what each transition type means if you are curious.

 0  Link 6  Top Level / Start page
 1  Typed 7  Form Submit
 2  Auto Bookmark 8  Reload / Restore
 3  Auto Subframe 9  Keyword
 4  Manual Subframe 10  Keyword Generated
 5  Omnibar Generated

This means that a transition of type 2 is ‘Auto Bookmark’; the longer description from the source code is “User got to this page through a suggestion in the UI, for example through the destinations page.”

And that’s it!  That’s a quick walkthrough of how to take a big, strange decimal number in the ‘History’ SQLite DB and turn it into a meaning description of the transition.

Bonus Section: Qualifiers

You might be wondering what the point is of having all those bits in front of the core transition value if we are just going to drop them.  It turns out those first 24 bits are used to store qualifiers, which provide further information about the transition. I won’t go into as much detail on how to extract the qualifiers, as the process is very similar to what I described above.  The difference is that the ‘QUALIFIER_MASK’ is 0xFFFFFF00.  ANDing our example value with the ‘QUALIFIER_MASK’ yields:

  = 0x10000000

Looking at that same section of source code lists the qualifiers, we find that 0x10000000 is “the beginning of a navigation chain”.  So we now know that the URL in question was suggested to the user by the UI and that is was the start of a navigation chain!

Leave a Reply

Your email address will not be published.