Bug 998372 - part 1 - lift regex construction out of FindProxyForURL; r=jmaher

This commit is contained in:
Nathan Froyd 2014-04-18 12:16:11 -04:00
parent 04304493b7
commit 089c81cc0d

View File

@ -308,15 +308,16 @@ class Permissions(object):
# to (\\\\d+) makes this code work. Not sure why there would be this
# difference between automation.py.in and this file.
pacURL = """data:text/plain,
var uriRegex = new RegExp('^([a-z][-a-z0-9+.]*)' +
'://' +
'(?:[^/@]*@)?' +
'(.*?)' +
'(?::(\\\\d+))?/');
function FindProxyForURL(url, host)
{
var origins = [%(origins)s];
var regex = new RegExp('^([a-z][-a-z0-9+.]*)' +
'://' +
'(?:[^/@]*@)?' +
'(.*?)' +
'(?::(\\\\d+))?/');
var matches = regex.exec(url);
var matches = uriRegex.exec(url);
if (!matches)
return 'DIRECT';
var isHttp = matches[1] == 'http';