Bug 1481509 [wpt PR 12341] - Don't try to re-encode already-encoded bytes when serializing., a=testonly
authorJosh Matthews <josh@joshmatthews.net>
Mon, 13 Aug 2018 18:19:31 +0000
changeset 486598 0b43c73b77ff855363c07a65e3ddf35fd6ac154a
parent 486597 35015a039883d03ce9fe937c877cd3ab15acd166
child 486599 fb7b1227df5bf5ce2606762aa749b0ec73056f47
push id9719
push userffxbld-merge
push dateFri, 24 Aug 2018 17:49:46 +0000
treeherdermozilla-beta@719ec98fba77 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstestonly
bugs1481509, 12341
milestone63.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 1481509 [wpt PR 12341] - Don't try to re-encode already-encoded bytes when serializing., a=testonly Automatic update from web-platform-testsDon't try to re-encode already-encoded bytes when serializing. -- wpt-commits: db02d2880ad332389e619262130354bf7f9e4e21 wpt-pr: 12341
testing/web-platform/meta/MANIFEST.json
testing/web-platform/tests/tools/wptrunner/wptrunner/wptmanifest/serializer.py
--- a/testing/web-platform/meta/MANIFEST.json
+++ b/testing/web-platform/meta/MANIFEST.json
@@ -641363,17 +641363,17 @@
    "33e9796c430c33aa0328559f12079f221180d679",
    "support"
   ],
   "tools/wptrunner/wptrunner/wptmanifest/parser.py": [
    "9763670663f9198433f611cf76b5b2db1221d0e2",
    "support"
   ],
   "tools/wptrunner/wptrunner/wptmanifest/serializer.py": [
-   "7439eff47ef9a56632bb8819f9f811f1e0cdb0e3",
+   "a7e01313ae5407c6086c60c45d4ab7059ccb2ba2",
    "support"
   ],
   "tools/wptrunner/wptrunner/wptmanifest/tests/__init__.py": [
    "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391",
    "support"
   ],
   "tools/wptrunner/wptrunner/wptmanifest/tests/test_conditional.py": [
    "9da1a0f180ca23e8cadb2c9b430e983ba75dbca0",
--- a/testing/web-platform/tests/tools/wptrunner/wptrunner/wptmanifest/serializer.py
+++ b/testing/web-platform/tests/tools/wptrunner/wptrunner/wptmanifest/serializer.py
@@ -1,29 +1,33 @@
 from node import NodeVisitor, ValueNode, ListNode, BinaryExpressionNode
 from parser import atoms, precedence
 
 atom_names = {v:"@%s" % k for (k,v) in atoms.iteritems()}
 
 named_escapes = set(["\a", "\b", "\f", "\n", "\r", "\t", "\v"])
 
 def escape(string, extras=""):
+    # Assumes input bytes are either UTF8 bytes or unicode.
     rv = ""
     for c in string:
         if c in named_escapes:
             rv += c.encode("unicode_escape")
         elif c == "\\":
             rv += "\\\\"
         elif c < '\x20':
             rv += "\\x%02x" % ord(c)
         elif c in extras:
             rv += "\\" + c
         else:
             rv += c
-    return rv.encode("utf8")
+    if isinstance(rv, unicode):
+        return rv.encode("utf8")
+    else:
+        return rv
 
 
 class ManifestSerializer(NodeVisitor):
     def __init__(self, skip_empty_data=False):
         self.skip_empty_data = skip_empty_data
 
     def serialize(self, root):
         self.indent = 2