Skip to content
Browse files

Merge branch 'master' into webworker

  • Loading branch information...
2 parents 332e5d9 + a935aeb commit bbdf68975c91a4d1e915ac3559259ace0dce7c20 @rauchg rauchg committed
Showing with 38 additions and 11 deletions.
  1. +1 −8 bin/builder.js
  2. +2 −2 lib/transport.js
  3. +34 −0 lib/transports/jsonp-polling.js
  4. +1 −1 lib/util.js
View
9 bin/builder.js
@@ -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
4 lib/transport.js
@@ -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
34 lib/transports/jsonp-polling.js
@@ -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);
+ }
};
/**
@@ -182,6 +199,23 @@
};
/**
+ * 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.
*
* @return {Boolean}
View
2 lib/util.js
@@ -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;
};

0 comments on commit bbdf689

Please sign in to comment.
Something went wrong with that request. Please try again.