Commit 8f618c88 authored by Robert Ma's avatar Robert Ma Committed by Commit Bot

Roll in new WPT tools

Most notably we would like to have this new lint for Blink internal APIs
in external/wpt: https://github.com/w3c/web-platform-tests/pull/7544

Bug: 749879
Change-Id: Ia1b2a1832b53e98d0c3204948a003a88d24dfff0
Reviewed-on: https://chromium-review.googlesource.com/702534
Commit-Queue: Philip Jägenstedt <foolip@chromium.org>
Reviewed-by: default avatarPhilip Jägenstedt <foolip@chromium.org>
Cr-Commit-Position: refs/heads/master@{#506781}
parent 9dc83102
......@@ -9,7 +9,7 @@ cd $DIR
TARGET_DIR=$DIR/wpt
REMOTE_REPO="https://chromium.googlesource.com/external/w3c/web-platform-tests.git"
WPT_HEAD=53008fece70040f1886d2ba5ff92a97eed1e4037
WPT_HEAD=6439a72ba71f99e2f01abb9f69edc779698ba9bc
function clone {
# Remove existing repo if already exists.
......
......@@ -17,7 +17,7 @@ from .. import localpaths
from ..gitignore.gitignore import PathFilter
from ..wpt import testfiles
from manifest.sourcefile import SourceFile, js_meta_re, python_meta_re
from manifest.sourcefile import SourceFile, js_meta_re, python_meta_re, space_chars
from six import binary_type, iteritems, itervalues
from six.moves import range
from six.moves.urllib.parse import urlsplit, urljoin
......@@ -355,6 +355,12 @@ class PrintRegexp(Regexp):
file_extensions = [".py"]
description = "Print function used"
class LayoutTestsRegexp(Regexp):
pattern = b"eventSender|testRunner|window\.internals"
error = "LAYOUTTESTS APIS"
file_extensions = [".html", ".htm", ".js", ".xht", ".xhtml", ".svg"]
description = "eventSender/testRunner/window.internals used; these are LayoutTests-specific APIs (WebKit/Blink)"
regexps = [item() for item in
[TrailingWhitespaceRegexp,
TabsRegexp,
......@@ -364,7 +370,8 @@ regexps = [item() for item in
Webidl2Regexp,
ConsoleRegexp,
GenerateTestsRegexp,
PrintRegexp]]
PrintRegexp,
LayoutTestsRegexp]]
def check_regexp_line(repo_root, path, f, css_mode):
errors = []
......@@ -410,7 +417,7 @@ def check_parsed(repo_root, path, f, css_mode):
return [("CONTENT-VISUAL", "Visual test whose filename doesn't end in '-visual'", path, None)]
for reftest_node in source_file.reftest_nodes:
href = reftest_node.attrib.get("href", "")
href = reftest_node.attrib.get("href", "").strip(space_chars)
parts = urlsplit(href)
if parts.scheme or parts.netloc:
errors.append(("ABSOLUTE-URL-REF",
......
......@@ -21,6 +21,8 @@ python_meta_re = re.compile(b"#\s*META:\s*(\w*)=(.*)$")
reference_file_re = re.compile(r'(^|[\-_])(not)?ref[0-9]*([\-_]|$)')
space_chars = u"".join(html5lib.constants.spaceCharacters)
def replace_end(s, old, new):
"""
Given a string `s` that ends with `old`, replace that occurrence of `old`
......@@ -399,7 +401,7 @@ class SourceFile(object):
rel_map = {"match": "==", "mismatch": "!="}
for item in self.reftest_nodes:
if "href" in item.attrib:
ref_url = urljoin(self.url, item.attrib["href"])
ref_url = urljoin(self.url, item.attrib["href"].strip(space_chars))
ref_type = rel_map[item.attrib["rel"]]
rv.append((ref_url, ref_type))
return rv
......@@ -451,7 +453,7 @@ class SourceFile(object):
rv = set()
for item in self.spec_link_nodes:
if "href" in item.attrib:
rv.add(item.attrib["href"])
rv.add(item.attrib["href"].strip(space_chars))
return rv
@cached_property
......
......@@ -58,7 +58,9 @@ class DirectoryHandler(object):
url_path = request.url_parts.path
if not url_path.endswith("/"):
raise HTTPException(404)
response.status = 301
response.headers = [("Location", "%s/" % request.url)]
return
path = filesystem_path(self.base_path, request, self.url_base)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment