Add error checks around the permissions API stuff

It doesn't work on old versions of Firefox