aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/ng/location.js2
-rw-r--r--test/ng/locationSpec.js11
2 files changed, 12 insertions, 1 deletions
diff --git a/src/ng/location.js b/src/ng/location.js
index 575feb7e..6d38d1ac 100644
--- a/src/ng/location.js
+++ b/src/ng/location.js
@@ -1,6 +1,6 @@
'use strict';
-var URL_MATCH = /^(file|ftp|http|https):\/\/(\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};
diff --git a/test/ng/locationSpec.js b/test/ng/locationSpec.js
index 648fa42d..b866b1e3 100644
--- a/test/ng/locationSpec.js
+++ b/test/ng/locationSpec.js
@@ -632,6 +632,17 @@ describe('$location', function() {
expect(match[10]).toBe('?book=moby');
});
+
+
+ it('should parse chrome extension urls', function() {
+ var match = URL_MATCH.exec('chrome-extension://jjcldkdmokihdaomalanmlohibnoplog/index.html?foo#bar');
+
+ expect(match[1]).toBe('chrome-extension');
+ expect(match[3]).toBe('jjcldkdmokihdaomalanmlohibnoplog');
+ expect(match[6]).toBe('/index.html');
+ expect(match[8]).toBe('foo');
+ expect(match[10]).toBe('bar');
+ });
});