Bug 998372 - part 4 - explain the escape-fest in permissions.py better; r=jmaher
☠☠ backed out by 8f28e657fcec ☠ ☠
authorNathan Froyd <froydnj@mozilla.com>
Fri, 18 Apr 2014 12:48:01 -0400
changeset 198024 b9abacaf54532d22e4a6c726a6786e982f9420aa
parent 198023 4029dbea3291edd556186b6a6ae49a56a2922552
child 198025 0db7896686a02d030077812bf7bc4230c551561c
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+.]*)' +
                           '://' +
                           '(?:[^/@]*@)?' +
                           '(.*?)' +