It was caused by lines 550-1 in preferences.js that attempted to get the "torbutton_CustomReferer" and "torbutton_CustomRef" elements (and associated preferences) that were removed in the smart ref spoofing commit. I also fixed the exception mentioned above.