(url, locationObj, html5Mode)
| 13837 | |
| 13838 | var DOUBLE_SLASH_REGEX = /^\s*[\\/]{2,}/; |
| 13839 | function parseAppUrl(url, locationObj, html5Mode) { |
| 13840 | |
| 13841 | if (DOUBLE_SLASH_REGEX.test(url)) { |
| 13842 | throw $locationMinErr('badpath', 'Invalid url "{0}".', url); |
| 13843 | } |
| 13844 | |
| 13845 | var prefixed = (url.charAt(0) !== '/'); |
| 13846 | if (prefixed) { |
| 13847 | url = '/' + url; |
| 13848 | } |
| 13849 | var match = urlResolve(url); |
| 13850 | var path = prefixed && match.pathname.charAt(0) === '/' ? match.pathname.substring(1) : match.pathname; |
| 13851 | locationObj.$$path = decodePath(path, html5Mode); |
| 13852 | locationObj.$$search = parseKeyValue(match.search); |
| 13853 | locationObj.$$hash = decodeURIComponent(match.hash); |
| 13854 | |
| 13855 | // make sure path starts with '/'; |
| 13856 | if (locationObj.$$path && locationObj.$$path.charAt(0) !== '/') { |
| 13857 | locationObj.$$path = '/' + locationObj.$$path; |
| 13858 | } |
| 13859 | } |
| 13860 | |
| 13861 | function startsWith(str, search) { |
| 13862 | return str.slice(0, search.length) === search; |
no test coverage detected