What do you get when a programmer is bored on the train?

Posted by on August 19, 2008

Well, the correct answer to this is a piece of code that can parse the file Firefox uses to store it’s sessions in. This file is located in ~/Library/Application\ Support/Firefox/Profiles/*/sessionstore.js (on an OS X machine).

Upon initial inspection of this file, I thought it might be in JSON. This proved to be an incorrect guess, as some of the keys for the dictionary are not in quotes. After discovering this, I set about writing a parser… Thinking what better way to parse something than with a recursive decent parser.

The code, for those who are interested, is available from my repository.

Comments

Respond | Trackback

  1. They keys do not have to be in quotes, and they are not dictionaries (as such)

    if My JSON is:
    {name: “Mathew”, age: 22}

    This is called an Object Literal and should result in a JavaScript object with amongst other things a property called name with value “Mathew” etc.

Comments

Comments: