Permalink
Browse files

Final set of changes (needed for Facebook Connect tests in another pr…

…oject).
  • Loading branch information...
1 parent 3f1db49 commit 4fd16e3c4bb880e9ea8ae4db9324eb0425cd8e00 @bnoguchi bnoguchi committed Jul 1, 2011
Showing with 8 additions and 4 deletions.
  1. +8 −4 lib/browser.js
View
@@ -118,7 +118,7 @@ Browser.prototype.context = function(selector, fn){
Browser.prototype.hostBrowser = function(uri) {
var otherHostname = uri.hostname
- , port = uri.port || (uri.protocol === 'https:' ? 443 : 80)
+ , port = uri.port || (uri.protocol === 'https:' ? 443 : (this.port || 80))
, browsers = Browser.browsers
, otherBrowser;
if (!browsers) {
@@ -176,7 +176,9 @@ Browser.prototype.request = function(method, path, options, fn, saveHistory){
uri = url.parse(path);
path = uri.pathname + (uri.search || '');
otherHostname = uri.hostname;
- if ((otherHostname !== 'undefined') && (otherHostname !== host)) {
+ if (otherHostname &&
+ (otherHostname !== 'undefined') &&
+ (otherHostname !== host)) {
otherBrowser = this.hostBrowser(uri);
return otherBrowser.request(method, path, options, fn, saveHistory);
}
@@ -203,7 +205,7 @@ Browser.prototype.request = function(method, path, options, fn, saveHistory){
var req = (this.https ? https : http).request({
method: method
, path: path
- , port: this.host ? this.port : server.__port
+ , port: this.host ? this.port : (server && server.__port)
, host: this.host
, headers: headers
});
@@ -260,7 +262,9 @@ Browser.prototype.request = function(method, path, options, fn, saveHistory){
, uri = url.parse(location)
, path = uri.pathname + (uri.search || '');
otherHostname = uri.hostname;
- if ((otherHostname !== 'undefined') && (otherHostname !== self.host)) {
+ if (otherHostname &&
+ (otherHostname !== 'undefined') &&
+ (otherHostname !== self.host)) {
self = self.hostBrowser(uri);
}
self.emit('redirect', location);

0 comments on commit 4fd16e3

Please sign in to comment.