fix($location) : initialize $$absUrl to empty string
Initialize `$$absUrl` to an empty string, in order to avoid exception, when base href and current location have different domains. Fixes #11091 Fixes #13565 Closes #14488
This commit is contained in:
committed by
Georgios Kalpakas
parent
4ee5717a96
commit
b9ac3362ee
@@ -328,6 +328,12 @@ function LocationHashbangInHtml5Url(appBase, appBaseNoFile, hashPrefix) {
|
||||
|
||||
var locationPrototype = {
|
||||
|
||||
/**
|
||||
* Ensure absolute url is initialized.
|
||||
* @private
|
||||
*/
|
||||
$$absUrl:'',
|
||||
|
||||
/**
|
||||
* Are we in html5 mode?
|
||||
* @private
|
||||
|
||||
@@ -2559,6 +2559,18 @@ describe('$location', function() {
|
||||
it('should throw on url(urlString, stateObject)', function() {
|
||||
expectThrowOnStateChange(locationUrl);
|
||||
});
|
||||
|
||||
it('should not throw when base path is another domain', function() {
|
||||
initService({html5Mode: true, hashPrefix: '!', supportHistory: true});
|
||||
inject(
|
||||
initBrowser({url: 'http://domain.com/base/', basePath: 'http://otherdomain.com/base/'}),
|
||||
function($location) {
|
||||
expect(function() {
|
||||
$location.absUrl();
|
||||
}).not.toThrow();
|
||||
}
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user