[tor-commits] [flashproxy/master] Merge branch 'bug9069'

dcf at torproject.org dcf at torproject.org
Sun Nov 10 08:12:36 UTC 2013


commit 458fa59cf38be1dd0329deb8f69e54f403e09d30
Merge: f8a0809 46a148d
Author: David Fifield <david at bamsoftware.com>
Date:   Sat Nov 9 23:58:43 2013 -0800

    Merge branch 'bug9069'
    
    Conflicts:
    	proxy/flashproxy.js

 proxy/flashproxy-test.js |   23 +++++++++++++++++++++++
 proxy/flashproxy.js      |   27 ++++++++++++++++-----------
 2 files changed, 39 insertions(+), 11 deletions(-)

diff --cc proxy/flashproxy.js
index cc14008,8353fe0..8aca4e5
--- a/proxy/flashproxy.js
+++ b/proxy/flashproxy.js
@@@ -426,22 -426,27 +426,27 @@@ function format_addr(addr) 
     6455 section 5.6.) If not, we have to use base64-encoded text frames. It is
     assumed that the client and relay endpoints always support binary frames. */
  function have_websocket_binary_frames() {
-     var ua, matches;
+     var ua, matches, browsers, reg;
  
      ua = window.navigator.userAgent;
 -    if (ua == null)
 +    if (!ua)
          return false;
  
-     /* We are cool for Chrome 16 or Safari 6.0. */
- 
-     matches = ua.match(/\bchrome\/(\d+)/i);
-     if (matches !== null && Number(matches[1]) >= 16)
-         return true;
- 
-     matches = ua.match(/\bversion\/(\d+)/i);
-     if (ua.match(/\bsafari\b/i) && !ua.match(/\bchrome\b/i)
-         && Number(matches[1]) >= 6)
-         return true;
+     browsers = [
+       { idString: "Chrome",  verString: "Chrome",  version: 16 },
+       { idString: "Safari",  verString: "Version", version: 6  },
+       { idString: "Firefox", verString: "Firefox", version: 11 }
+     ];
+ 
+     for (var i = 0; i < browsers.length; i++) {
+       reg = "\\b" + browsers[i].idString + "\\b";
+       if (ua.match(new RegExp(reg, "i")) == null)
+           continue;
+       reg = "\\b" + browsers[i].verString + "\\/(\\d+)";
+       matches = ua.match(new RegExp(reg, "i"));
+       return (matches != null
+           && Number(matches[1]) >= browsers[i].version) ? true : false;
+     }
  
      return false;
  }





More information about the tor-commits mailing list