Title: [276128] trunk/Tools
Revision
276128
Author
[email protected]
Date
2021-04-16 02:04:23 -0700 (Fri, 16 Apr 2021)

Log Message

Avoid converting HTML chars in _W3CTestConverter
https://bugs.webkit.org/show_bug.cgi?id=224658

Reviewed by Adrian Perez de Castro.

There has been a change in Python HTMLParser in version 3.5 that makes convert_charrefs to be True by default:
https://docs.python.org/3/library/html.parser.html

This is causing that we're modifying the tests that have HTML characters, which is something
we shouldn't change and was not happening in previous Python 3 versions, or Python 2.

* Scripts/webkitpy/w3c/test_converter.py:
(_W3CTestConverter.__init__): Set convert_charrefs to False.
* Scripts/webkitpy/w3c/test_converter_unittest.py: Update test to include HTML chars and check that they're not modified.

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (276127 => 276128)


--- trunk/Tools/ChangeLog	2021-04-16 08:53:33 UTC (rev 276127)
+++ trunk/Tools/ChangeLog	2021-04-16 09:04:23 UTC (rev 276128)
@@ -1,3 +1,20 @@
+2021-04-16  Manuel Rego Casasnovas  <[email protected]>
+
+        Avoid converting HTML chars in _W3CTestConverter
+        https://bugs.webkit.org/show_bug.cgi?id=224658
+
+        Reviewed by Adrian Perez de Castro.
+
+        There has been a change in Python HTMLParser in version 3.5 that makes convert_charrefs to be True by default:
+        https://docs.python.org/3/library/html.parser.html
+
+        This is causing that we're modifying the tests that have HTML characters, which is something
+        we shouldn't change and was not happening in previous Python 3 versions, or Python 2.
+
+        * Scripts/webkitpy/w3c/test_converter.py:
+        (_W3CTestConverter.__init__): Set convert_charrefs to False.
+        * Scripts/webkitpy/w3c/test_converter_unittest.py: Update test to include HTML chars and check that they're not modified.
+
 2021-04-16  Youenn Fablet  <[email protected]>
 
         Promote WKWebView device orientation permission delegate to API

Modified: trunk/Tools/Scripts/webkitpy/w3c/test_converter.py (276127 => 276128)


--- trunk/Tools/Scripts/webkitpy/w3c/test_converter.py	2021-04-16 08:53:33 UTC (rev 276127)
+++ trunk/Tools/Scripts/webkitpy/w3c/test_converter.py	2021-04-16 09:04:23 UTC (rev 276128)
@@ -66,7 +66,10 @@
 
 class _W3CTestConverter(HTMLParser):
     def __init__(self, new_path, filename, reference_support_info, host=Host(), convert_test_harness_links=True, webkit_test_runner_options=''):
-        HTMLParser.__init__(self)
+        if sys.version_info > (3, 0):
+            HTMLParser.__init__(self, convert_charrefs=False)
+        else:
+            HTMLParser.__init__(self)
 
         self._host = host
         self._filesystem = self._host.filesystem

Modified: trunk/Tools/Scripts/webkitpy/w3c/test_converter_unittest.py (276127 => 276128)


--- trunk/Tools/Scripts/webkitpy/w3c/test_converter_unittest.py	2021-04-16 08:53:33 UTC (rev 276127)
+++ trunk/Tools/Scripts/webkitpy/w3c/test_converter_unittest.py	2021-04-16 09:04:23 UTC (rev 276128)
@@ -80,6 +80,7 @@
 </head>
 <body>
 CONTENT OF TEST
+&lt;We shouldn't convert HTML characters.&gt;
 </body>
 </html>
 """
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to