Title: [250992] trunk/Tools
Revision
250992
Author
[email protected]
Date
2019-10-10 14:57:57 -0700 (Thu, 10 Oct 2019)

Log Message

W3C test importer breaks svg files.
https://bugs.webkit.org/show_bug.cgi?id=202806

Reviewed by Jonathan Bedard.

The WebKit W3C importer tries to rewrite the xml/html/css files
when importing the tests to rewrite paths and such.

The issue is that to decide if rewrite the file or not uses the
mimetype and the current code was comparing for something like
if "xml" in str(mimetype[0])

But svg files have mimetype "image/svg+xml" so the previous code
was trying to rewrite svg files, breaking them.

This patches changes that code to only rewrite if the mimetype
also contains the "application/" or "text/" string.

It also adds an info log (printed when verbose enabled) to tell
that a file has been rewritten.

* Scripts/webkitpy/w3c/test_importer.py:
(TestImporter.import_tests):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (250991 => 250992)


--- trunk/Tools/ChangeLog	2019-10-10 21:57:36 UTC (rev 250991)
+++ trunk/Tools/ChangeLog	2019-10-10 21:57:57 UTC (rev 250992)
@@ -1,3 +1,29 @@
+2019-10-10  Carlos Alberto Lopez Perez  <[email protected]>
+
+        W3C test importer breaks svg files.
+        https://bugs.webkit.org/show_bug.cgi?id=202806
+
+        Reviewed by Jonathan Bedard.
+
+        The WebKit W3C importer tries to rewrite the xml/html/css files
+        when importing the tests to rewrite paths and such.
+
+        The issue is that to decide if rewrite the file or not uses the
+        mimetype and the current code was comparing for something like
+        if "xml" in str(mimetype[0])
+
+        But svg files have mimetype "image/svg+xml" so the previous code
+        was trying to rewrite svg files, breaking them.
+
+        This patches changes that code to only rewrite if the mimetype
+        also contains the "application/" or "text/" string.
+
+        It also adds an info log (printed when verbose enabled) to tell
+        that a file has been rewritten.
+
+        * Scripts/webkitpy/w3c/test_importer.py:
+        (TestImporter.import_tests):
+
 2019-10-10  Jonathan Bedard  <[email protected]>
 
         results.webkit.org: Serve correct exit codes when aborting

Modified: trunk/Tools/Scripts/webkitpy/w3c/test_importer.py (250991 => 250992)


--- trunk/Tools/Scripts/webkitpy/w3c/test_importer.py	2019-10-10 21:57:36 UTC (rev 250991)
+++ trunk/Tools/Scripts/webkitpy/w3c/test_importer.py	2019-10-10 21:57:57 UTC (rev 250992)
@@ -509,7 +509,9 @@
                 # Only html, xml, or css should be converted
                 # FIXME: Eventually, so should js when support is added for this type of conversion
                 mimetype = mimetypes.guess_type(orig_filepath)
-                if should_rewrite_files and ('html' in str(mimetype[0]) or 'xml' in str(mimetype[0])  or 'css' in str(mimetype[0])):
+                if should_rewrite_files and ('text/' in str(mimetype[0]) or 'application/' in str(mimetype[0])) \
+                                        and ('html' in str(mimetype[0]) or 'xml' in str(mimetype[0])  or 'css' in str(mimetype[0])):
+                    _log.info("Rewriting: %s" % new_filepath)
                     try:
                         converted_file = convert_for_webkit(new_path, filename=orig_filepath, reference_support_info=reference_support_info, host=self.host, convert_test_harness_links=self.should_convert_test_harness_links(subpath), webkit_test_runner_options=self._webkit_test_runner_options(new_filepath))
                     except:
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to