essandess / easylist-pac-privoxy

EasyList Tracker and Adblocks to Proxy Auto Configuration (PAC) File and Privoxy Actions and Filters
GNU General Public License v3.0
103 stars 97 forks source link

JavaScript Objects of Length about 1000 hang iOS iCloud-based apps and services on an iPad #2

Closed essandess closed 6 years ago

essandess commented 7 years ago

I observe that PAC files with JavaScript objects of size 100 or so cause connectivity hangs in iOS iCloud-based apps and services on an iPad.

Mobile Safari and other browsers are not affected.

I believe that this is an iOS bug and I have filed issue #33093977.

Details:

proxy_test_create.py:

#!/usr/bin/env python

# Proxy Auto Configuration Generator for iOS
# Small values of n (less than 10) work; large (~1000) hangup iCloud and App Store access
# iOS Safari works with all values of n

# Syntax: python proxy_test_creator.py [size of JS objects]

import sys

# Get n from the first argument, with a small default value
n = int(sys.argv[1]) if len(sys.argv) > 1 else 9

print("""\
// Proxy Auto Configuration Example for iOS
// Small values of n (less than 10) work; large (100) hangup iCloud and App Store access

// n = {:d}

// JSON object
var jo = {{ {} }};
// Regular Expression
var re = /{}/i;

// Simple FindProxyForURL function
function FindProxyForURL(url, host) {{

    // Access the variables defined above, but ignore results
    jo.hasOwnProperty(host) || re.test(host);

    return "DIRECT";
}}
""".format(n,
", ".join('"field{:d}": null'.format(k+1) for k in range(n)),
"(?:" + "|".join('word{:d}'.format(k+1) for k in range(n)) + ")"))
essandess commented 6 years ago

Apple has fixed this bug (#33093977) with iOS 11.