You shouldn't listen for all pref modification, but only one or a subset:
`Services.prefs.addObserver(GAIA_DIR_PREF_NAME, observer, false);