Skip to content

Cleaning up the history of Firefox 4


While trying out Firefox 4.0b7 I saw that the „remember my browsing history for at least XX days“ in the privacy settings is now gone. Even using the „Use custom settings for history“ option doesn’t offer that anymore.

After a little digging through Mozillas Bugzilla I found this comment, stating that this was intended, reasons being explained by Marco Bonardo in a blog post. I haven’t quite stress-tested the „save as much history as we can“-approach, but I definitely will.

This got me into looking into the design of the places database (it’s a simple sqlite database called „places.sqlite“ in the profile directory) to bring the good old time-limit of the history back and I found this ERD. There’s also the „.schema TABLE“ command of sqlite which shows the CREATE statements of a table.
Querying this database is really easy.

To get all google pages you visited in the last 24 hours a simple

select url, title, visit_count from moz_historyvisits, moz_places where moz_historyvisits.place_id = and datetime(moz_historyvisits.visit_date/1000000,"unixepoch") > datetime("now","-1 day") and url like "%google%";

does the trick.

Knowing that, we can delete all entries older than 24 hours from moz_places:

delete from moz_places where id in (select place_id from moz_historyvisits where datetime(moz_historyvisits.visit_date/1000000,"unixepoch") > datetime("now","-1 day") and visit_type  3)

The value 3 is taken from the Forensics Wiki.

Now all that’s left is to delete the entries in some other tables holding information about the entries we just deleted. As the „.schema“ command doesn’t tell me anything about „ON DELETE“ actions, I’m doing this manually:

delete from moz_input_history where place_id not in (select id from moz_places);
delete from moz_favicons where id not in (select favicon_id from moz_places);
delete from moz_historyvisits where place_id not in (select id from moz_places);

Obviously you can’t have firefox running (read: accessing the database) at the same time you’re fooling around in there.

From here on it’s just a small step to world domination a regular automatic clean-up of your browsing history.


From → Serious business

Schreibe einen Kommentar

Kommentar verfassen

Trage deine Daten unten ein oder klicke ein Icon um dich einzuloggen:

Du kommentierst mit Deinem Abmelden /  Ändern )

Google+ Foto

Du kommentierst mit Deinem Google+-Konto. Abmelden /  Ändern )


Du kommentierst mit Deinem Twitter-Konto. Abmelden /  Ändern )


Du kommentierst mit Deinem Facebook-Konto. Abmelden /  Ändern )


Verbinde mit %s

%d Bloggern gefällt das: