Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for // META: spec=url to satisfy MISSING-LINK #10289

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion css/geometry/DOMMatrix-css-string.worker.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// https://drafts.fxtf.org/geometry/#DOMMatrix
// META: spec=https://drafts.fxtf.org/geometry/#DOMMatrix

importScripts("/resources/testharness.js");

Expand Down
2 changes: 1 addition & 1 deletion css/geometry/WebKitCSSMatrix.worker.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// https://drafts.fxtf.org/geometry/#DOMMatrix
// META: spec=https://drafts.fxtf.org/geometry/#DOMMatrix

importScripts('/resources/testharness.js');

Expand Down
9 changes: 5 additions & 4 deletions css/geometry/interfaces.worker.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
// META: spec=https://drafts.fxtf.org/geometry/#DOMPoint
// META: spec=https://drafts.fxtf.org/geometry/#DOMRect
// META: spec=https://drafts.fxtf.org/geometry/#DOMQuad
// META: spec=https://drafts.fxtf.org/geometry/#DOMMatrix

"use strict";
// https://drafts.fxtf.org/geometry/#DOMPoint
// https://drafts.fxtf.org/geometry/#DOMRect
// https://drafts.fxtf.org/geometry/#DOMQuad
// https://drafts.fxtf.org/geometry/#DOMMatrix

importScripts("/resources/testharness.js");
importScripts("/resources/WebIDLParser.js", "/resources/idlharness.js");
Expand Down
3 changes: 1 addition & 2 deletions lint.whitelist
Original file line number Diff line number Diff line change
Expand Up @@ -919,8 +919,7 @@ MISSING-LINK: css/cssom-view/scrollTop-display-change.html
CSS-COLLIDING-TEST-NAME: css/cssom-view/interfaces.html
CSS-COLLIDING-TEST-NAME: css/cssom/interfaces.html

# TODO https://github.com/w3c/web-platform-tests/issues/5770
MISSING-LINK: css/geometry/*.worker.js
# TODO https://github.com/w3c/web-platform-tests/issues/10288
MISSING-LINK: css/filter-effects/*.any.js

WEBIDL2.JS: .gitmodules
Expand Down
2 changes: 2 additions & 0 deletions tools/lint/lint.py
Original file line number Diff line number Diff line change
Expand Up @@ -636,6 +636,8 @@ def check_script_metadata(repo_root, path, f):
errors.append(("UNKNOWN-TIMEOUT-METADATA", "Unexpected value for timeout metadata", path, idx + 1))
elif key == b"script":
pass
elif key == b"spec":
pass
else:
errors.append(("UNKNOWN-METADATA", "Unexpected kind of metadata", path, idx + 1))
else:
Expand Down
1 change: 1 addition & 0 deletions tools/lint/tests/test_file_lints.py
Original file line number Diff line number Diff line change
Expand Up @@ -525,6 +525,7 @@ def test_css_missing_file_manual():
(b"""// META: timeout=long\n""", None),
(b"""// META: timeout=long\n""", None),
(b"""// META: script=foo.js\n""", None),
(b"""// META: spec=foo.html\n""", None),
(b"""# META:\n""", None),
(b"""\n// META: timeout=long\n""", (2, "STRAY-METADATA")),
(b""" // META: timeout=long\n""", (1, "INDENTED-METADATA")),
Expand Down
3 changes: 3 additions & 0 deletions tools/manifest/sourcefile.py
Original file line number Diff line number Diff line change
Expand Up @@ -466,6 +466,9 @@ def spec_links(self):
for item in self.spec_link_nodes:
if "href" in item.attrib:
rv.add(item.attrib["href"].strip(space_chars))
if self.script_metadata:
for item in filter(lambda x: x[0] == b"spec", self.script_metadata):
rv.add(item[1].strip(space_chars))
return rv

@cached_property
Expand Down
16 changes: 14 additions & 2 deletions tools/manifest/tests/test_sourcefile.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,18 @@ def test_multi_global_long_timeout():
assert item.timeout == "long"


def test_spec_meta_tag():
contents = b"""// META: spec=foo.html
importScripts('/resources/testharness.js')
test()"""

metadata = list(read_script_metadata(BytesIO(contents), js_meta_re))
assert metadata == [(b"spec", b"foo.html")]

s = create("html/test.any.js", contents=contents)
assert "foo.html" in s.spec_links


@pytest.mark.parametrize("input,expected", [
(b"""//META: foo=bar\n""", [(b"foo", b"bar")]),
(b"""// META: foo=bar\n""", [(b"foo", b"bar")]),
Expand Down Expand Up @@ -395,7 +407,7 @@ def test_testharness_svg():
assert not s.name_is_worker
assert not s.name_is_reference

assert s.root
assert len(s.root)
assert s.content_is_testharness

assert items(s) == [("testharness", "/" + filename)]
Expand Down Expand Up @@ -424,7 +436,7 @@ def test_relative_testharness_svg():
assert not s.name_is_worker
assert not s.name_is_reference

assert s.root
assert len(s.root)
assert not s.content_is_testharness

assert items(s) == []
Expand Down