bug 983322 - sanitize preferencesBranch
bug 983322 - keep test logic out of shipping code
Merge pull request #1648 from zombie/983322-sane-prefsBranch

bug 983322 - sanitize preferencesBranch, r=@erikvold