Merge branch 'master' into webworker

This commit is contained in:
Guillermo Rauch
2011-10-19 00:13:33 -07:00
4 changed files with 38 additions and 11 deletions

View File

@@ -209,18 +209,11 @@ var builder = module.exports = function () {
// check if we need to process it any further
if (settings.minify) {
// uglify hate unicode chars...
var separator = '@@OMGYUCHANGEME@@@';
code = code.replace(/(\\ufffd)/g, separator);
var ast = uglify.parser.parse(code);
ast = uglify.uglify.ast_mangle(ast);
ast = uglify.uglify.ast_squeeze(ast);
code = production + uglify.uglify.gen_code(ast);
// restore the code
code = code.replace(new RegExp('('+ separator + ')', 'g'), '\\ufffd');
code = production + uglify.uglify.gen_code(ast, { ascii_only: true });
}
callback(error, code);

View File

@@ -101,7 +101,7 @@
*/
Transport.prototype.onDisconnect = function () {
if (this.close) this.close();
if (this.close && this.open) this.close();
this.clearTimeouts();
this.socket.onDisconnect();
return this;
@@ -196,8 +196,8 @@
}, this.socket.options['reopen delay']);*/
this.open = false;
this.setCloseTimeout();
this.socket.onClose();
this.onDisconnect();
};
/**

View File

@@ -6,6 +6,15 @@
*/
(function (exports, io) {
/**
* There is a way to hide the loading indicator in Firefox. If you create and
* remove a iframe it will stop showing the current loading indicator.
* Unfortunately we can't feature detect that and UA sniffing is evil.
*
* @api private
*/
var indicator = "MozAppearance" in document.documentElement.style;
/**
* Expose constructor.
@@ -164,6 +173,14 @@
var insertAt = document.getElementsByTagName('script')[0]
insertAt.parentNode.insertBefore(script, insertAt);
this.script = script;
if (indicator) {
setTimeout(function () {
var iframe = document.createElement('iframe');
document.body.appendChild(iframe);
document.body.removeChild(iframe);
}, 100);
}
};
/**
@@ -181,6 +198,23 @@
return this;
};
/**
* The indicator hack only works after onload
*
* @param {Socket} socket The socket instance that needs a transport
* @param {Function} fn The callback
* @api private
*/
JSONPPolling.prototype.ready = function (socket, fn) {
var self = this;
if (!indicator) return fn.call(this);
io.util.load(function () {
fn.call(self);
});
};
/**
* Checks if browser supports this transport.
*

View File

@@ -304,7 +304,7 @@
}
for (var j = arr.length, i = i < 0 ? i + j < 0 ? 0 : i + j : i || 0;
i < j && arr[i] !== o; i++);
i < j && arr[i] !== o; i++) {}
return j <= i ? -1 : i;
};