Check that uri.pathname is not undefined before using path to resolve it

See bottom of http://techblog.realestate.com.au/setup-cartodb-dev-environment-on-mac-os-x/. Also necessary for standalone Windshaft-based app.