mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-03-17 07:40:22 +00:00
fix($location): parse FirefoxOS packaged app urls
FirefoxOS uses special URLs like
app://{d0419af1-8b42-41c5-96f4-ef4179e52315}/index.html for packaged Apps.
Closes #2112
This commit is contained in:
parent
df9bff13b2
commit
3a81dd8bdd
2 changed files with 14 additions and 1 deletions
|
|
@ -1,6 +1,6 @@
|
|||
'use strict';
|
||||
|
||||
var URL_MATCH = /^([^:]+):\/\/(\w+:{0,1}\w*@)?([\w\.-]*)(:([0-9]+))?(\/[^\?#]*)?(\?([^#]*))?(#(.*))?$/,
|
||||
var URL_MATCH = /^([^:]+):\/\/(\w+:{0,1}\w*@)?(\{?[\w\.-]*\}?)(:([0-9]+))?(\/[^\?#]*)?(\?([^#]*))?(#(.*))?$/,
|
||||
PATH_MATCH = /^([^\?#]*)?(\?([^#]*))?(#(.*))?$/,
|
||||
HASH_MATCH = PATH_MATCH,
|
||||
DEFAULT_PORTS = {'http': 80, 'https': 443, 'ftp': 21};
|
||||
|
|
|
|||
|
|
@ -676,6 +676,19 @@ describe('$location', function() {
|
|||
expect(match[8]).toBe('foo');
|
||||
expect(match[10]).toBe('bar');
|
||||
});
|
||||
|
||||
it('should parse FFOS app:// urls', function() {
|
||||
var match = URL_MATCH.exec('app://{d0419af1-8b42-41c5-96f4-ef4179e52315}/path');
|
||||
|
||||
expect(match[1]).toBe('app');
|
||||
expect(match[3]).toBe('{d0419af1-8b42-41c5-96f4-ef4179e52315}');
|
||||
expect(match[5]).toBeFalsy();
|
||||
expect(match[6]).toBe('/path');
|
||||
expect(match[8]).toBeFalsy();
|
||||
|
||||
match = URL_MATCH.exec('app://}foo{')
|
||||
expect(match).toBe(null);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue