summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHiroshi Ichikawa <gimite@gmail.com>2010-08-03 23:35:37 +0900
committerHiroshi Ichikawa <gimite@gmail.com>2010-08-03 23:35:37 +0900
commit18a7bccc0dd29dffbc1ff70739b5982b4db2024c (patch)
tree29e5ad8a67ea5a801c821fe0e3ea8abcb7135acb
parent911d92c873135a4193bb89eb31493507b13d72e8 (diff)
downloadweb-socket-js-18a7bccc0dd29dffbc1ff70739b5982b4db2024c.tar.gz
Adding comment about escaping issue.
-rwxr-xr-xweb_socket.js6
1 files changed, 6 insertions, 0 deletions
diff --git a/web_socket.js b/web_socket.js
index 945dae8..3d07a09 100755
--- a/web_socket.js
+++ b/web_socket.js
@@ -101,6 +101,12 @@
if (!this.__flash || this.readyState == WebSocket.CONNECTING) {
throw "INVALID_STATE_ERR: Web Socket connection has not been established";
}
+ // We use encodeURIComponent() here, because FABridge doesn't work if
+ // the argument includes some characters. We don't use escape() here
+ // because of this:
+ // https://developer.mozilla.org/en/Core_JavaScript_1.5_Guide/Functions#escape_and_unescape_Functions
+ // But it looks decodeURIComponent(encodeURIComponent(s)) doesn't
+ // preserve all Unicode characters either e.g. "\uffff" in Firefox.
var result = this.__flash.send(encodeURIComponent(data));
if (result < 0) { // success
return true;