(url, locationObj, html5Mode)
| 13800 | |
| 13801 | var DOUBLE_SLASH_REGEX = /^\s*[\\/]{2,}/; |
| 13802 | function parseAppUrl(url, locationObj, html5Mode) { |
| 13803 | |
| 13804 | if (DOUBLE_SLASH_REGEX.test(url)) { |
| 13805 | throw $locationMinErr('badpath', 'Invalid url "{0}".', url); |
| 13806 | } |
| 13807 | |
| 13808 | var prefixed = (url.charAt(0) !== '/'); |
| 13809 | if (prefixed) { |
| 13810 | url = '/' + url; |
| 13811 | } |
| 13812 | var match = urlResolve(url); |
| 13813 | var path = prefixed && match.pathname.charAt(0) === '/' ? match.pathname.substring(1) : match.pathname; |
| 13814 | locationObj.$$path = decodePath(path, html5Mode); |
| 13815 | locationObj.$$search = parseKeyValue(match.search); |
| 13816 | locationObj.$$hash = decodeURIComponent(match.hash); |
| 13817 | |
| 13818 | // make sure path starts with '/'; |
| 13819 | if (locationObj.$$path && locationObj.$$path.charAt(0) !== '/') { |
| 13820 | locationObj.$$path = '/' + locationObj.$$path; |
| 13821 | } |
| 13822 | } |
| 13823 | |
| 13824 | function startsWith(str, search) { |
| 13825 | return str.slice(0, search.length) === search; |
no test coverage detected