Skip to content

Commit

Permalink
added header check for cookie in location.assign, which sets cookie o…
Browse files Browse the repository at this point in the history
…n document if present.
  • Loading branch information
thatcher committed Apr 27, 2010
1 parent 68d5e19 commit 521c6c8
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/xhr/location.js
Expand Up @@ -164,9 +164,10 @@ Location = function(url, doc, history) {
},

assign: function(url) {
var _this = this;
var xhr;
var event;
var _this = this,
xhr,
event,
cookie;

//console.log('assigning %s',url);

Expand All @@ -191,6 +192,14 @@ Location = function(url, doc, history) {
if (xhr.readyState === 4) {
$document.baseURI = new Location(url, $document);
//console.log('new document baseURI %s', $document.baseURI);
cookie = xhr.getResponseHeader('cookie');
if(cookie){
try{
$document.cookie = cookie;
}catch(e){
console.log("Failed to set cookie %s", cookie);
}
}
__exchangeHTMLDocument__($document, xhr.responseText, url);
}
};
Expand Down

0 comments on commit 521c6c8

Please sign in to comment.