Ticket #11290: 0001-Latest-TBB-isn-t-recognized-as-likely.patch

File 0001-Latest-TBB-isn-t-recognized-as-likely.patch, 2.8 KB (added by arlolra, 6 years ago)
  • proxy/flashproxy-test.js

    From 7ba0194ba7e380796d0795f209669d284c8da8ae Mon Sep 17 00:00:00 2001
    From: Arlo Breault <arlolra@gmail.com>
    Date: Sun, 23 Mar 2014 19:48:57 -0700
    Subject: [PATCH] Latest TBB isn't recognized as likely
    
     * Adds a v24 userAgent string.
    
     * Adds a test for is_likely_tor_browser().
    ---
     proxy/flashproxy-test.js | 27 +++++++++++++++++++++++++++
     proxy/flashproxy.js      |  1 +
     2 files changed, 28 insertions(+)
    
    diff --git a/proxy/flashproxy-test.js b/proxy/flashproxy-test.js
    index e004ee8..fc4fcd2 100755
    a b function test_have_websocket_binary_frames() { 
    345345    window.navigator = _navigator;
    346346}
    347347
     348function test_is_likely_tor_browser() {
     349    var TESTS = [
     350        { ua: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:10.0.2) Gecko/20100101 Firefox/10.0.2", expected: false },
     351        { ua: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:11.0) Gecko/20100101 Firefox/11.0", expected: false },
     352        { ua: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.110 Safari/537.36", expected: false },
     353        { ua: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_4) AppleWebKit/536.30.1 (KHTML, like Gecko) Version/6.0.5 Safari/536.30.1", expected: false },
     354        { ua: "Mozilla/5.0 (Windows NT 6.1; rv:10.0) Gecko/20100101 Firefox/10.0", expected: true },
     355        { ua: "Mozilla/5.0 (Windows NT 6.1; rv:17.0) Gecko/20100101 Firefox/17.0", expected: true },
     356        { ua: "Mozilla/5.0 (Windows NT 6.1; rv:24.0) Gecko/20100101 Firefox/24.0", expected: true },
     357        { expected: false },  // no userAgent
     358    ];
     359    var _navigator = window.navigator;
     360    window.navigator = { mimeTypes: [] };
     361    for (var i = 0; i < TESTS.length; i++) {
     362        var test = TESTS[i];
     363        window.navigator.userAgent = test.ua;
     364        var actual = is_likely_tor_browser();
     365
     366        if (objects_equal(actual, test.expected))
     367            pass(test.ua);
     368        else
     369            fail(test.ua, test.expected, actual);
     370    }
     371    window.navigator = _navigator;
     372}
     373
    348374test_build_url();
    349375test_parse_cookie_string();
    350376test_parse_query_string();
    test_parse_addr_spec(); 
    353379test_get_param_addr();
    354380test_lang_keys();
    355381test_have_websocket_binary_frames();
     382test_is_likely_tor_browser();
    356383
    357384if (num_failed == 0)
    358385    process.exit(0);
  • proxy/flashproxy.js

    diff --git a/proxy/flashproxy.js b/proxy/flashproxy.js
    index 12c4c1e..e50785c 100644
    a b function safe_repr(s) { 
    10491049var TBB_UAS = [
    10501050    "Mozilla/5.0 (Windows NT 6.1; rv:10.0) Gecko/20100101 Firefox/10.0",
    10511051    "Mozilla/5.0 (Windows NT 6.1; rv:17.0) Gecko/20100101 Firefox/17.0",
     1052    "Mozilla/5.0 (Windows NT 6.1; rv:24.0) Gecko/20100101 Firefox/24.0",
    10521053];
    10531054function is_likely_tor_browser() {
    10541055    return TBB_UAS.indexOf(window.navigator.userAgent) > -1