Skip to content

Commit

Permalink
Validator Rollup (#13338)
Browse files Browse the repository at this point in the history
* Revision bump for #13036

* Revision bump for #13073

* Add DEDUPE_ON_MINIFY flags to license tags so that release process can
reduce the number of identical duplicate licenses in the minified
validator.

* Add requires_extension to AttrSpec.

* JSDoc updates.

* Generated validator javascript improvements.

* Add comment to ValidationError hinting at how to render.

* Revision bump for #12955

* Add new error types for future CSS validation.

* Revision bump for #12798

* Fix a typo.

* Allow animation-timing-function for keyframes

* Fix typo
  • Loading branch information
Gregable authored Feb 7, 2018
1 parent 8e92030 commit 681ba06
Show file tree
Hide file tree
Showing 29 changed files with 340 additions and 177 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,4 @@ PASS
| ad goes here
| </section>
| </body>
| </html>
| </html>
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ FAIL
| <script async custom-element="amp-youtube" src="https://cdn.ampproject.org/v0/amp-youtube-0.1.js"></script>
| <script id="amp-access" type="application/json">
>> ^~~~~~~~~
amp-access/0.1/test/validator-amp-access-missing-extension.html:32:2 The tag 'amp-access extension .json script' requires including the 'amp-access' extension JavaScript. (see https://www.ampproject.org/docs/reference/components/amp-access) [AMP_TAG_PROBLEM]
amp-access/0.1/test/validator-amp-access-missing-extension.html:32:2 The tag 'amp-access extension .json script' requires including the 'amp-access' extension JavaScript. (see https://www.ampproject.org/docs/reference/components/amp-access) [MANDATORY_AMP_TAG_MISSING_OR_INCORRECT]
| {
| "contents": "currently untested"
| }
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<!--
Copyright 2018 The AMP HTML Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS-IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the license.
-->
<!--
Test Description:
Tests for the amp-fx-collection tag.
-->
<!doctype html>
<html >
<head>
<meta charset="utf-8">
<link rel="canonical" href="./regular-html-version.html">
<meta name="viewport" content="width=device-width,minimum-scale=1">
<style amp-boilerplate>body{-webkit-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-moz-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-ms-animation:-amp-start 8s steps(1,end) 0s 1 normal both;animation:-amp-start 8s steps(1,end) 0s 1 normal both}@-webkit-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-moz-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-ms-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-o-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}</style><noscript><style amp-boilerplate>body{-webkit-animation:none;-moz-animation:none;-ms-animation:none;animation:none}</style></noscript>
<script async src="https://cdn.ampproject.org/v0.js"></script>
</head>
<body>
<!-- Invalid: Missing extension script -->
<div amp-fx="parallax" data-parallax-factor="0.8"></div>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
FAIL
| <!--
| Copyright 2018 The AMP HTML Authors. All Rights Reserved.
|
| Licensed under the Apache License, Version 2.0 (the "License");
| you may not use this file except in compliance with the License.
| You may obtain a copy of the License at
|
| http://www.apache.org/licenses/LICENSE-2.0
|
| Unless required by applicable law or agreed to in writing, software
| distributed under the License is distributed on an "AS-IS" BASIS,
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
| See the License for the specific language governing permissions and
| limitations under the license.
| -->
| <!--
| Test Description:
| Tests for the amp-fx-collection tag.
| -->
| <!doctype html>
| <html ⚡>
| <head>
| <meta charset="utf-8">
| <link rel="canonical" href="./regular-html-version.html">
| <meta name="viewport" content="width=device-width,minimum-scale=1">
| <style amp-boilerplate>body{-webkit-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-moz-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-ms-animation:-amp-start 8s steps(1,end) 0s 1 normal both;animation:-amp-start 8s steps(1,end) 0s 1 normal both}@-webkit-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-moz-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-ms-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-o-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}</style><noscript><style amp-boilerplate>body{-webkit-animation:none;-moz-animation:none;-ms-animation:none;animation:none}</style></noscript>
| <script async src="https://cdn.ampproject.org/v0.js"></script>
| </head>
| <body>
| <!-- Invalid: Missing extension script -->
| <div amp-fx="parallax" data-parallax-factor="0.8"></div>
>> ^~~~~~~~~
amp-fx-collection/0.1/test/validator-amp-fx-collection-missing-extension.html:31:2 The attribute 'amp-fx' requires including the 'amp-fx-collection' extension JavaScript. [MANDATORY_AMP_TAG_MISSING_OR_INCORRECT]
| </body>
| </html>
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@ PASS
| <h1 amp-fx="parallax"></h1>
| </div>
| </body>
| </html>
| </html>
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,16 @@
# limitations under the license.
#
tags: { # amp-fx-collection
# Accepted amp-fx-collection attributes can be found in validator-main.protoascii
# Accepted amp-fx-collection attributes can be found in
# validator-main.protoascii
html_format: AMP
tag_name: "SCRIPT"
extension_spec: {
name: "amp-fx-collection"
allowed_versions: "0.1"
allowed_versions: "latest"
# amp-fx-parallax has no associated tag which indicates usage of the extension.
# amp-fx-parallax has no associated tag which indicates usage of the
# extension.
requires_usage: NONE
}
attr_lists: "common-extension-attrs"
Expand Down
14 changes: 7 additions & 7 deletions extensions/amp-mustache/0.1/test/validator-amp-mustache.out
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ FAIL
|
| <template type="amp-mustache">
>> ^~~~~~~~~
amp-mustache/0.1/test/validator-amp-mustache.html:31:0 The tag 'template' requires including the 'amp-mustache' extension JavaScript. (see https://www.ampproject.org/docs/reference/components/amp-mustache) [AMP_TAG_PROBLEM]
amp-mustache/0.1/test/validator-amp-mustache.html:31:0 The tag 'template' requires including the 'amp-mustache' extension JavaScript. (see https://www.ampproject.org/docs/reference/components/amp-mustache) [MANDATORY_AMP_TAG_MISSING_OR_INCORRECT]
| <{{not-actually-parsed-as-an-html-tag-so-allowed}}>
| <p title="{{allowed}}">{{allowed}}</p>
| <p {{notallowed}}></p>
Expand Down Expand Up @@ -224,13 +224,13 @@ amp-mustache/0.1/test/validator-amp-mustache.html:75:2 The attribute 'title' in
|
| <template type="amp-mustache">
>> ^~~~~~~~~
amp-mustache/0.1/test/validator-amp-mustache.html:98:0 The tag 'template' requires including the 'amp-mustache' extension JavaScript. (see https://www.ampproject.org/docs/reference/components/amp-mustache) [AMP_TAG_PROBLEM]
amp-mustache/0.1/test/validator-amp-mustache.html:98:0 The tag 'template' requires including the 'amp-mustache' extension JavaScript. (see https://www.ampproject.org/docs/reference/components/amp-mustache) [MANDATORY_AMP_TAG_MISSING_OR_INCORRECT]
| <div>
| <template type="amp-mustache">
>> ^~~~~~~~~
amp-mustache/0.1/test/validator-amp-mustache.html:100:4 The tag 'template' may not appear as a descendant of tag 'template'. (see https://www.ampproject.org/docs/reference/components/amp-mustache) [AMP_HTML_TEMPLATE_PROBLEM]
>> ^~~~~~~~~
amp-mustache/0.1/test/validator-amp-mustache.html:100:4 The tag 'template' requires including the 'amp-mustache' extension JavaScript. (see https://www.ampproject.org/docs/reference/components/amp-mustache) [AMP_TAG_PROBLEM]
amp-mustache/0.1/test/validator-amp-mustache.html:100:4 The tag 'template' requires including the 'amp-mustache' extension JavaScript. (see https://www.ampproject.org/docs/reference/components/amp-mustache) [MANDATORY_AMP_TAG_MISSING_OR_INCORRECT]
| Nested Template tags are not allowed.
| </template>
| </div>
Expand All @@ -246,21 +246,21 @@ amp-mustache/0.1/test/validator-amp-mustache.html:100:4 The tag 'template' requi
>> ^~~~~~~~~
amp-mustache/0.1/test/validator-amp-mustache.html:112:0 The attribute 'autoplay' in tag 'amp-audio' is set to the invalid value '{{invalid}}'. (see https://www.ampproject.org/docs/reference/components/amp-audio) [AMP_TAG_PROBLEM]
>> ^~~~~~~~~
amp-mustache/0.1/test/validator-amp-mustache.html:112:0 The tag 'amp-audio' requires including the 'amp-audio' extension JavaScript. (see https://www.ampproject.org/docs/reference/components/amp-audio) [AMP_TAG_PROBLEM]
amp-mustache/0.1/test/validator-amp-mustache.html:112:0 The tag 'amp-audio' requires including the 'amp-audio' extension JavaScript. (see https://www.ampproject.org/docs/reference/components/amp-audio) [MANDATORY_AMP_TAG_MISSING_OR_INCORRECT]
| <template type="amp-mustache">
>> ^~~~~~~~~
amp-mustache/0.1/test/validator-amp-mustache.html:113:0 The tag 'template' requires including the 'amp-mustache' extension JavaScript. (see https://www.ampproject.org/docs/reference/components/amp-mustache) [AMP_TAG_PROBLEM]
amp-mustache/0.1/test/validator-amp-mustache.html:113:0 The tag 'template' requires including the 'amp-mustache' extension JavaScript. (see https://www.ampproject.org/docs/reference/components/amp-mustache) [MANDATORY_AMP_TAG_MISSING_OR_INCORRECT]
| <amp-audio src="https://example.com/audio" layout="fixed" autoplay="{{valid}}">
>> ^~~~~~~~~
amp-mustache/0.1/test/validator-amp-mustache.html:114:0 The tag 'amp-audio' requires including the 'amp-audio' extension JavaScript. (see https://www.ampproject.org/docs/reference/components/amp-audio) [AMP_TAG_PROBLEM]
amp-mustache/0.1/test/validator-amp-mustache.html:114:0 The tag 'amp-audio' requires including the 'amp-audio' extension JavaScript. (see https://www.ampproject.org/docs/reference/components/amp-audio) [MANDATORY_AMP_TAG_MISSING_OR_INCORRECT]
| </template>
|
| <!-- Since layout calculations follow a different code path, test that layouts
| validate. -->
| <!-- See https://github.com/ampproject/amphtml/issues/2670 -->
| <template type="amp-mustache">
>> ^~~~~~~~~
amp-mustache/0.1/test/validator-amp-mustache.html:120:0 The tag 'template' requires including the 'amp-mustache' extension JavaScript. (see https://www.ampproject.org/docs/reference/components/amp-mustache) [AMP_TAG_PROBLEM]
amp-mustache/0.1/test/validator-amp-mustache.html:120:0 The tag 'template' requires including the 'amp-mustache' extension JavaScript. (see https://www.ampproject.org/docs/reference/components/amp-mustache) [MANDATORY_AMP_TAG_MISSING_OR_INCORRECT]
| <amp-img src="{{image.url}}" width={{image.width}} height={{image.height}}></amp-img>
| </template>
|
Expand Down
4 changes: 2 additions & 2 deletions extensions/amp-story/0.1/test/validator-amp-story-error.out
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ FAIL
>> ^~~~~~~~~
amp-story/0.1/test/validator-amp-story-error.html:31:2 The mandatory attribute 'standalone' is missing in tag 'amp-story'. (see https://www.ampproject.org/docs/reference/components/amp-story) [AMP_TAG_PROBLEM]
>> ^~~~~~~~~
amp-story/0.1/test/validator-amp-story-error.html:31:2 The tag 'amp-story' requires including the 'amp-story' extension JavaScript. (see https://www.ampproject.org/docs/reference/components/amp-story) [AMP_TAG_PROBLEM]
amp-story/0.1/test/validator-amp-story-error.html:31:2 The tag 'amp-story' requires including the 'amp-story' extension JavaScript. (see https://www.ampproject.org/docs/reference/components/amp-story) [MANDATORY_AMP_TAG_MISSING_OR_INCORRECT]
| <amp-story-page> <!-- error because the 'id' attribute isn't set -->
>> ^~~~~~~~~
amp-story/0.1/test/validator-amp-story-error.html:32:4 The mandatory attribute 'id' is missing in tag 'amp-story-page'. (see https://www.ampproject.org/docs/reference/components/amp-story) [AMP_TAG_PROBLEM]
>> ^~~~~~~~~
amp-story/0.1/test/validator-amp-story-error.html:32:4 The tag 'amp-story-page' requires including the 'amp-story' extension JavaScript. (see https://www.ampproject.org/docs/reference/components/amp-story) [AMP_TAG_PROBLEM]
amp-story/0.1/test/validator-amp-story-error.html:32:4 The tag 'amp-story-page' requires including the 'amp-story' extension JavaScript. (see https://www.ampproject.org/docs/reference/components/amp-story) [MANDATORY_AMP_TAG_MISSING_OR_INCORRECT]
| <amp-story-grid-layer> <!-- error because one of 'fill', 'horizontal', 'vertical', 'thirds' should be set. -->
>> ^~~~~~~~~
amp-story/0.1/test/validator-amp-story-error.html:33:6 The mandatory attribute 'template' is missing in tag 'amp-story-grid-layer'. [AMP_TAG_PROBLEM]
Expand Down
2 changes: 1 addition & 1 deletion validator/engine/amp4ads-parse-css.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* @license
* @license DEDUPE_ON_MINIFY
* Copyright 2016 The AMP HTML Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
2 changes: 1 addition & 1 deletion validator/engine/amp4ads-parse-css_test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* @license
* @license DEDUPE_ON_MINIFY
* Copyright 2016 The AMP HTML Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
2 changes: 1 addition & 1 deletion validator/engine/css-selectors.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* @license
* @license DEDUPE_ON_MINIFY
* Copyright 2015 The AMP HTML Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
2 changes: 1 addition & 1 deletion validator/engine/definitions.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* @license
* @license DEDUPE_ON_MINIFY
* Copyright 2015 The AMP HTML Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
14 changes: 4 additions & 10 deletions validator/engine/htmlparser-interface.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* @license
* @license DEDUPE_ON_MINIFY
* Copyright 2015 The AMP HTML Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -13,12 +13,6 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the license.
*
* Credits:
* Copyright 2006-2008, The Google Caja project, licensed under the
* Apache License (http://code.google.com/p/google-caja/).
* Copyright 2009, The Closure Library Authors, licensed under the
* Apache License.
*/

goog.provide('amp.htmlparser.DocLocator');
Expand Down Expand Up @@ -166,7 +160,7 @@ amp.htmlparser.ParsedHtmlTag = class {


/**
* An interface to the {@code amp.htmlparser.HtmlParser} visitor, that gets
* An interface to the `amp.htmlparser.HtmlParser` visitor, that gets
* called while the HTML is being parsed.
*/
amp.htmlparser.HtmlSaxHandler = class {
Expand Down Expand Up @@ -230,7 +224,7 @@ amp.htmlparser.HtmlSaxHandler = class {

/**
* An interface for determining the line/column information for SAX events that
* are being received by a {@code amp.htmlparser.HtmlSaxHandler}. Please see
* are being received by a `amp.htmlparser.HtmlSaxHandler`. Please see
* the {@code amp.htmlparser.HtmlSaxHandler#setDocLocator} method.
*/
amp.htmlparser.DocLocator = class {
Expand Down Expand Up @@ -265,7 +259,7 @@ amp.htmlparser.HtmlSaxHandlerWithLocation =
constructor() { super(); }

/**
* Called prior to parsing a document, that is, before {@code startTag}.
* Called prior to parsing a document, that is, before `startTag`.
* @param {amp.htmlparser.DocLocator} locator A locator instance which
* provides access to the line/column information while SAX events
* are being received by the handler.
Expand Down
26 changes: 13 additions & 13 deletions validator/engine/htmlparser.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
/**
* @fileoverview A Html SAX parser.
*
* Examples of usage of the {@code goog.string.html.HtmlParser}:
* Examples of usage of the `goog.string.html.HtmlParser`:
* <pre>
* const handler = new MyCustomHtmlVisitorHandlerThatExtendsHtmlSaxHandler();
* const parser = new goog.string.html.HtmlParser();
Expand Down Expand Up @@ -394,21 +394,21 @@ class TagNameStack {


/**
* An Html parser: {@code parse} takes a string and calls methods on
* {@code amp.htmlparser.HtmlSaxHandler} while it is visiting it.
* An Html parser: `parse` takes a string and calls methods on
* `amp.htmlparser.HtmlSaxHandler` while it is visiting it.
*/
amp.htmlparser.HtmlParser = class {
constructor() {}

/**
* Given a SAX-like {@code amp.htmlparser.HtmlSaxHandler} parses a
* {@code htmlText} and lets the {@code handler} know the structure while
* Given a SAX-like `amp.htmlparser.HtmlSaxHandler` parses a
* `htmlText` and lets the `handler` know the structure while
* visiting the nodes. If the provided handler is an implementation of
* {@code amp.htmlparser.HtmlSaxHandlerWithLocation}, then its
* {@code setDocLocator} method will get called prior to
* {@code startDoc}, and the {@code getLine} / {@code getCol} methods will
* `amp.htmlparser.HtmlSaxHandlerWithLocation`, then its
* `setDocLocator` method will get called prior to
* `startDoc`, and the `getLine` / `getCol` methods will
* reflect the current line / column while a SAX callback (e.g.,
* {@code startTag}) is active.
* `startTag`) is active.
*
* @param {amp.htmlparser.HtmlSaxHandler|
* amp.htmlparser.HtmlSaxHandlerWithLocation} handler The
Expand Down Expand Up @@ -593,7 +593,7 @@ amp.htmlparser.HtmlParser = class {
/**
* The plain text of a chunk of HTML CDATA which possibly containing.
*
* TODO(goto): use {@code goog.string.unescapeEntities} instead ?
* TODO(goto): use `goog.string.unescapeEntities` instead ?
* @param {string} s A chunk of HTML CDATA. It must not start or end inside
* an HTML entity.
* @return {string} The unescaped entities.
Expand Down Expand Up @@ -621,7 +621,7 @@ amp.htmlparser.HtmlParser = class {

/**
* HTML entities that are encoded/decoded.
* TODO(goto): use {@code goog.string.htmlEncode} instead.
* TODO(goto): use `goog.string.htmlEncode` instead.
* @type {!Object<string, string>}
*/
amp.htmlparser.HtmlParser.Entities = {
Expand Down Expand Up @@ -941,8 +941,8 @@ amp.htmlparser.HtmlParser.OUTSIDE_TAG_TOKEN_ = new RegExp(


/**
* An implementation of the {@code amp.htmlparser.DocLocator} interface
* for use within the {@code amp.htmlparser.HtmlParser}.
* An implementation of the `amp.htmlparser.DocLocator` interface
* for use within the `amp.htmlparser.HtmlParser`.
*/
amp.htmlparser.HtmlParser.DocLocatorImpl =
class extends amp.htmlparser.DocLocator {
Expand Down
2 changes: 1 addition & 1 deletion validator/engine/json-testutil.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* @license
* @license DEDUPE_ON_MINIFY
* Copyright 2015 The AMP HTML Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
2 changes: 1 addition & 1 deletion validator/engine/keyframes-parse-css.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* @license
* @license DEDUPE_ON_MINIFY
* Copyright 2017 The AMP HTML Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
2 changes: 1 addition & 1 deletion validator/engine/keyframes-parse-css_test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* @license
* @license DEDUPE_ON_MINIFY
* Copyright 2017 The AMP HTML Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
2 changes: 1 addition & 1 deletion validator/engine/parse-srcset.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* @license
* @license DEDUPE_ON_MINIFY
* Copyright 2015 The AMP HTML Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
2 changes: 1 addition & 1 deletion validator/engine/parse-url.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* @license
* @license DEDUPE_ON_MINIFY
* Copyright 2016 The AMP HTML Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
2 changes: 1 addition & 1 deletion validator/engine/validator-in-browser.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* @license
* @license DEDUPE_ON_MINIFY
* Copyright 2015 The AMP HTML Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
Loading

0 comments on commit 681ba06

Please sign in to comment.