Fix session checking code

https://bugzilla.mozilla.org/show_bug.cgi?id=1099007
This could be reduced to just the first part of the and clause