Bug 1465512 [wpt PR 11251] - Add support for // META: title=..., a=testonly
authorSimon Pieters <zcorpan@gmail.com>
Wed, 06 Jun 2018 17:19:05 +0000
changeset 422225 353ecca0069588d118757e9c849680e83168944d
parent 422224 898838b493f9ff1a7a94f17c40998c08d50c16c9
child 422226 391a284a284f7f35050b7c8eb742dda760ac6af1
push id104190
push userjames@hoppipolla.co.uk
push dateSun, 10 Jun 2018 08:46:47 +0000
treeherdermozilla-inbound@0154f49c8c47 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstestonly
bugs1465512, 11251
milestone62.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 1465512 [wpt PR 11251] - Add support for // META: title=..., a=testonly Automatic update from web-platform-testsAdd support for // META: title=... -- wpt-commits: 730415d240e28dc6e829d70675cc8815ed8fe813 wpt-pr: 11251
testing/web-platform/tests/tools/lint/lint.py
testing/web-platform/tests/tools/lint/tests/test_file_lints.py
testing/web-platform/tests/tools/serve/serve.py
--- a/testing/web-platform/tests/tools/lint/lint.py
+++ b/testing/web-platform/tests/tools/lint/lint.py
@@ -659,16 +659,18 @@ def check_script_metadata(repo_root, pat
         m = meta_re.match(line)
         if m:
             key, value = m.groups()
             if key == b"global":
                 errors.extend((kind, message, path, idx + 1) for (kind, message) in check_global_metadata(value))
             elif key == b"timeout":
                 if value != b"long":
                     errors.append(("UNKNOWN-TIMEOUT-METADATA", "Unexpected value for timeout metadata", path, idx + 1))
+            elif key == b"title":
+                pass
             elif key == b"script":
                 pass
             elif key == b"variant":
                 pass
             else:
                 errors.append(("UNKNOWN-METADATA", "Unexpected kind of metadata", path, idx + 1))
         else:
             done = True
--- a/testing/web-platform/tests/tools/lint/tests/test_file_lints.py
+++ b/testing/web-platform/tests/tools/lint/tests/test_file_lints.py
@@ -516,16 +516,17 @@ def test_css_missing_file_manual():
     ]
 
 
 @pytest.mark.parametrize("filename", [
     "foo.worker.js",
     "foo.any.js",
 ])
 @pytest.mark.parametrize("input,error", [
+    (b"""//META: title=foo\n""", None),
     (b"""//META: timeout=long\n""", None),
     (b"""// META: timeout=long\n""", None),
     (b"""//  META: timeout=long\n""", None),
     (b"""// META: script=foo.js\n""", None),
     (b"""// META: variant=\n""", None),
     (b"""// META: variant=?wss\n""", None),
     (b"""# META:\n""", None),
     (b"""\n// META: timeout=long\n""", (2, "STRAY-METADATA")),
--- a/testing/web-platform/tests/tools/serve/serve.py
+++ b/testing/web-platform/tests/tools/serve/serve.py
@@ -155,18 +155,21 @@ class HtmlWrapperHandler(WrapperHandler)
                 raise HTTPException(404, "This test cannot be loaded in %s mode" %
                                     self.global_type)
 
     def _meta_replacement(self, key, value):
         if key == b"timeout":
             if value == b"long":
                 return '<meta name="timeout" content="long">'
         if key == b"script":
-            attribute = value.decode('utf-8').replace('"', "&quot;").replace(">", "&gt;")
+            attribute = value.decode('utf-8').replace("&", "&amp;").replace('"', "&quot;")
             return '<script src="%s"></script>' % attribute
+        if key == b"title":
+            value = value.decode('utf-8').replace("&", "&amp;").replace("<", "&lt;")
+            return '<title>%s</title>' % value
         return None
 
 
 class WorkersHandler(HtmlWrapperHandler):
     global_type = b"dedicatedworker"
     path_replace = [(".any.worker.html", ".any.js", ".any.worker.js"),
                     (".worker.html", ".worker.js")]
     wrapper = """<!doctype html>