fix($cookies): set cookies on Safari&IE when base[href] is undefined

Safari and IE don't like being told to store cookies with path set to
undefined. This change ensures that if base[href] (from which cookie path
is derived) is undefined then the cookie path defaults to ''.

The test verifies that the cookie is set instead of checking that cookie has correct path,
this is due to that cookie meta information is not avabile once the cookie is set.

Closes #1190, #1191
This commit is contained in:
Fredrik Bonander
2013-02-06 10:30:40 +01:00
committed by Igor Minar
parent 8d34bf2fea
commit 7cb8f8fb44
2 changed files with 15 additions and 3 deletions

View File

@@ -237,7 +237,7 @@ function Browser(window, document, $log, $sniffer) {
*/
self.baseHref = function() {
var href = baseElement.attr('href');
return href ? href.replace(/^https?\:\/\/[^\/]*/, '') : href;
return href ? href.replace(/^https?\:\/\/[^\/]*/, '') : '';
};
//////////////////////////////////////////////////////////////