Make sure screen.orientation is always valid

If the orientation has not been set by the extension yet, query it
synchronously.