Bug 998372 - part 4 - explain the escape-fest in permissions.py better; r=jmaher
authorNathan Froyd <froydnj@mozilla.com>
Fri, 18 Apr 2014 12:48:01 -0400
changeset 198112 3c39d43169c04459a2342d45b5a9c88c668d277c
parent 198111 cbbf7905937be8859e933efbef16394888606bde
child 198113 70fa92170fad3b39cd49a6d0295ed0795949d7ab
push id3624
push userasasaki@mozilla.com
push dateMon, 09 Jun 2014 21:49:01 +0000
treeherdermozilla-beta@b1a5da15899a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjmaher
bugs998372
milestone31.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 998372 - part 4 - explain the escape-fest in permissions.py better; r=jmaher
testing/mozbase/mozprofile/mozprofile/permissions.py
--- a/testing/mozbase/mozprofile/mozprofile/permissions.py
+++ b/testing/mozbase/mozprofile/mozprofile/permissions.py
@@ -299,19 +299,23 @@ class Permissions(object):
                 proxy["remote"] = l.host
                 proxy[l.scheme] = l.port
 
         # overwrite defaults with user specified proxy
         if isinstance(user_proxy, dict):
             proxy.update(user_proxy)
 
         # TODO: this should live in a template!
-        # TODO: So changing the 5th line of the regex below from (\\\\\\\\d+)
-        # to (\\\\d+) makes this code work. Not sure why there would be this
-        # difference between automation.py.in and this file.
+        # If you must escape things in this string with backslashes, be aware
+        # of the multiple layers of escaping at work:
+        #
+        # - Python will unescape backslashes;
+        # - Writing out the prefs will escape things via JSON serialization;
+        # - The prefs file reader will unescape backslashes;
+        # - The JS engine parser will unescape backslashes.
         pacURL = """data:text/plain,
 var knownOrigins = (function () {
   return [%(origins)s].reduce(function(t, h) { t[h] = true; return t; }, {})
 })();
 var uriRegex = new RegExp('^([a-z][-a-z0-9+.]*)' +
                           '://' +
                           '(?:[^/@]*@)?' +
                           '(.*?)' +