Fixed CORS breaking logic error

Caught a stealthy bug that prevented any cross origin requests, as reported here: https://bugzilla.mozilla.org/show_bug.cgi?id=863239