Skip to content

Commit

Permalink
Validator rollup (ampproject#22413)
Browse files Browse the repository at this point in the history
* cl/248381896 Revision bump for ampproject#22289

* cl/249156543 Allow amp-script with an experiment token.

* cl/249265307 Revision bump for ampproject#22372
  • Loading branch information
alin04 authored May 21, 2019
1 parent 13dc93d commit fc9b8fc
Show file tree
Hide file tree
Showing 6 changed files with 115 additions and 44 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<!--
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:
This usage of amp-script is valid, other than the fact that it is missing
the required origin-trial meta 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>
<script async custom-element="amp-script" src="https://cdn.ampproject.org/v0/amp-script-0.1.js"></script>
</head>
<body>
<!-- Valid. -->
<amp-script layout=container src="https://example.com/foo.js"><div class="root"><p>Some text to hydrate.</p></div></amp-script>
</body>
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
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:
| This usage of amp-script is valid, other than the fact that it is missing
| the required origin-trial meta 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>
| <script async custom-element="amp-script" src="https://cdn.ampproject.org/v0/amp-script-0.1.js"></script>
| </head>
| <body>
| <!-- Valid. -->
| <amp-script layout=container src="https://example.com/foo.js"><div class="root"><p>Some text to hydrate.</p></div></amp-script>
| </body>
>> ^~~~~~~~~
amp-script/0.1/test/validator-amp-script-not-origin-trial.html:34:6 The tag 'amp-experiment-token' is missing or incorrect, but required by 'amp-script'. (see https://amp.dev/documentation/components/amp-script) [AMP_TAG_PROBLEM]
1 change: 1 addition & 0 deletions extensions/amp-script/0.1/test/validator-amp-script.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
<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>
<script async custom-element="amp-script" src="https://cdn.ampproject.org/v0/amp-script-0.1.js"></script>
<meta name="amp-experiment-token" content="{copy your token here}">
</head>
<body>
<!-- Valid. -->
Expand Down
11 changes: 4 additions & 7 deletions extensions/amp-script/0.1/test/validator-amp-script.out
Original file line number Diff line number Diff line change
Expand Up @@ -27,27 +27,24 @@ FAIL
| <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>
| <script async custom-element="amp-script" src="https://cdn.ampproject.org/v0/amp-script-0.1.js"></script>
>> ^~~~~~~~~
amp-script/0.1/test/validator-amp-script.html:28:2 Custom JavaScript is not allowed. (see https://amp.dev/documentation/guides-and-tutorials/learn/spec/amphtml#html-tags) [CUSTOM_JAVASCRIPT_DISALLOWED]
| <meta name="amp-experiment-token" content="{copy your token here}">
| </head>
| <body>
| <!-- Valid. -->
| <amp-script layout=container src="https://example.com/foo.js"><div class="root"><p>Some text to hydrate.</p></div></amp-script>
>> ^~~~~~~~~
amp-script/0.1/test/validator-amp-script.html:32:2 The tag 'amp-script' is disallowed. [DISALLOWED_HTML]
|
| <!-- Invalid: Relative URL. -->
| <amp-script layout=container src="/foo.js"></amp-script>
>> ^~~~~~~~~
amp-script/0.1/test/validator-amp-script.html:35:2 The tag 'amp-script' is disallowed. [DISALLOWED_HTML]
amp-script/0.1/test/validator-amp-script.html:36:2 The relative URL '/foo.js' for attribute 'src' in tag 'amp-script' is disallowed. (see https://amp.dev/documentation/components/amp-script) [AMP_TAG_PROBLEM]
|
| <!-- Invalid: Missing 'src' attribute. -->
| <amp-script layout=container></amp-script>
>> ^~~~~~~~~
amp-script/0.1/test/validator-amp-script.html:38:2 The tag 'amp-script' is disallowed. [DISALLOWED_HTML]
amp-script/0.1/test/validator-amp-script.html:39:2 The mandatory attribute 'src' is missing in tag 'amp-script'. (see https://amp.dev/documentation/components/amp-script) [AMP_TAG_PROBLEM]
|
| <!-- Invalid: Non-https 'src' attribute. -->
| <amp-script layout=container src="http://not.https.url"></amp-script>
>> ^~~~~~~~~
amp-script/0.1/test/validator-amp-script.html:41:2 The tag 'amp-script' is disallowed. [DISALLOWED_HTML]
amp-script/0.1/test/validator-amp-script.html:42:2 Invalid URL protocol 'http:' for attribute 'src' in tag 'amp-script'. (see https://amp.dev/documentation/components/amp-script) [AMP_TAG_PROBLEM]
| </body>
73 changes: 37 additions & 36 deletions extensions/amp-script/validator-amp-script.protoascii
Original file line number Diff line number Diff line change
Expand Up @@ -14,40 +14,41 @@
# limitations under the license.
#

# Invalid until launch ready.
# tags: {
# tag_name: "SCRIPT"
# extension_spec: {
# name: "amp-script"
# version: "0.1"
# version: "latest"
# }
# attr_lists: "common-extension-attrs"
# }
tags: {
html_format: AMP
tag_name: "SCRIPT"
extension_spec: {
name: "amp-script"
version: "0.1"
version: "latest"
}
attr_lists: "common-extension-attrs"
}

# tags: { # <amp-script>
# html_format: AMP
# tag_name: "AMP-SCRIPT"
# disallowed_ancestor: "AMP-SCRIPT"
# requires_extension: "amp-script"
# unique: true # TODO(choumx): Remove when global size limit is implemented.
# attrs: {
# name: "src"
# mandatory: true
# value_url: {
# protocol: "https"
# allow_relative: false
# }
# blacklisted_value_regex: "__amp_source_origin"
# }
# attr_lists: "extended-amp-global"
# amp_layout {
# supported_layouts: CONTAINER
# supported_layouts: FILL
# supported_layouts: FIXED
# supported_layouts: FIXED_HEIGHT
# supported_layouts: FLEX_ITEM
# supported_layouts: NODISPLAY
# supported_layouts: RESPONSIVE
# }
# }
tags: { # <amp-script>
html_format: AMP
tag_name: "AMP-SCRIPT"
disallowed_ancestor: "AMP-SCRIPT"
requires_extension: "amp-script"
requires: "amp-experiment-token"
unique: true # TODO(choumx): Remove when global size limit is implemented.
attrs: {
name: "src"
mandatory: true
value_url: {
protocol: "https"
allow_relative: false
}
blacklisted_value_regex: "__amp_source_origin"
}
attr_lists: "extended-amp-global"
amp_layout {
supported_layouts: CONTAINER
supported_layouts: FILL
supported_layouts: FIXED
supported_layouts: FIXED_HEIGHT
supported_layouts: FLEX_ITEM
supported_layouts: NODISPLAY
supported_layouts: RESPONSIVE
}
}
3 changes: 2 additions & 1 deletion validator/validator-main.protoascii
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ min_validator_revision_required: 375
# newer versions of the spec file. This is currently a Google internal
# mechanism, validator.js does not use this facility. However, any
# change to this file (validator-main.js) requires updating this revision id.
spec_file_revision: 873
spec_file_revision: 876

styles_spec_url: "https://amp.dev/documentation/guides-and-tutorials/develop/style_and_layout/style_pages"
script_spec_url: "https://amp.dev/documentation/guides-and-tutorials/learn/spec/amphtml#html-tags"
Expand Down Expand Up @@ -566,6 +566,7 @@ tags: {
value_casei: "amp-experiment-token"
dispatch_key: NAME_VALUE_DISPATCH
}
satisfies: "amp-experiment-token"
}
# AMP metadata, name=amp-link-variable-allowed-origin
# https://github.com/ampproject/amphtml/issues/8132
Expand Down

0 comments on commit fc9b8fc

Please sign in to comment.