Skip to content

Update allowed tags/attributes from spec in amphtml 1910071803120#3239

Merged
westonruter merged 4 commits intodevelopfrom
update/amphtml-1909051756330
Oct 8, 2019
Merged

Update allowed tags/attributes from spec in amphtml 1910071803120#3239
westonruter merged 4 commits intodevelopfrom
update/amphtml-1909051756330

Conversation

@westonruter
Copy link
Copy Markdown
Member

@westonruter westonruter commented Sep 13, 2019

Previously #3084.

  • Run ./bin/amphtml-update.sh
  • Examine diff for changelog
  • Update spec generator as needed based on spec format changes.
  • Modify validating sanitizer based on changes to spec, if needed.
  • Add tests for key changes

Changelog

  • Allow http protocol for amp-img > noscript > img fallbacks.
  • Add amp-megaphone component.
  • Add amp-minute-media-player component.
  • Add diffable attribute to amp-list component.

Details

(
    PREV_VERSION=1908162134430;
    THIS_VERSION=1910071803120; 
    git checkout $THIS_VERSION;
    git diff $PREV_VERSION...$THIS_VERSION -w -- $( git ls-files | grep '.protoascii' );
    git checkout - > /dev/null
)
Compare 1908162134430..1910071803120
diff --git a/extensions/amp-autocomplete/validator-amp-autocomplete.protoascii b/extensions/amp-autocomplete/validator-amp-autocomplete.protoascii
index 03ec7cfb0..803ec9a2c 100644
--- a/extensions/amp-autocomplete/validator-amp-autocomplete.protoascii
+++ b/extensions/amp-autocomplete/validator-amp-autocomplete.protoascii
@@ -65,6 +65,7 @@ tags: {  # <amp-autocomplete>
   }
   attrs: { name: "highlight-user-entry" }
   attrs: { name: "template" }
+  attrs: { name: "items" }
   # amp-bind
   attrs: {
     name: "[src]"
diff --git a/extensions/amp-carousel/validator-amp-carousel.protoascii b/extensions/amp-carousel/validator-amp-carousel.protoascii
index 821c34fdb..b29a9b5e5 100644
--- a/extensions/amp-carousel/validator-amp-carousel.protoascii
+++ b/extensions/amp-carousel/validator-amp-carousel.protoascii
@@ -17,7 +17,6 @@
 tags: {  # amp-carousel
   html_format: AMP
   html_format: AMP4ADS
-  html_format: AMP4EMAIL
   html_format: ACTIONS
   tag_name: "SCRIPT"
   extension_spec: {
@@ -30,6 +29,16 @@ tags: {  # amp-carousel
   }
   attr_lists: "common-extension-attrs"
 }
+tags: {  # amp-carousel for AMP4EMAIL
+  html_format: AMP4EMAIL
+  tag_name: "SCRIPT"
+  spec_name: "SCRIPT[custom-element=amp-carousel] (AMP4EMAIL)"
+  extension_spec: {
+    name: "amp-carousel"
+    version: "0.1"
+  }
+  attr_lists: "common-extension-attrs"
+}
 attr_lists: {
   name: "amp-carousel-common"
   attrs: {
diff --git a/extensions/amp-date-countdown/validator-amp-date-countdown.protoascii b/extensions/amp-date-countdown/validator-amp-date-countdown.protoascii
index 4ab0cde35..32e59aff9 100644
--- a/extensions/amp-date-countdown/validator-amp-date-countdown.protoascii
+++ b/extensions/amp-date-countdown/validator-amp-date-countdown.protoascii
@@ -64,9 +64,10 @@ tags: {  # <amp-date-countdown>
     name: "offset-seconds"
     value_regex: "-?\\d+"
   }
-  # TODO(gregable): Implement validation that requires the template attr value
-  # to reference the id of an existing template element.
-  attrs: { name: "template" }
+  attrs: {
+    name: "template"
+    value_oneof_set: TEMPLATE_IDS
+  }
   attrs: {
     name: "timeleft-ms"
     mandatory_oneof: "['end-date', 'timeleft-ms', 'timestamp-ms', 'timestamp-seconds']"
diff --git a/extensions/amp-date-display/validator-amp-date-display.protoascii b/extensions/amp-date-display/validator-amp-date-display.protoascii
index e7e1550bb..94db81ff2 100644
--- a/extensions/amp-date-display/validator-amp-date-display.protoascii
+++ b/extensions/amp-date-display/validator-amp-date-display.protoascii
@@ -42,7 +42,10 @@ tags: {  # <amp-date-display>
     value_regex: "-?\\d+"
   }
   attrs: { name: "locale" }
-  attrs: { name: "template" }
+  attrs: {
+    name: "template"
+    value_oneof_set: TEMPLATE_IDS
+  }
   attrs: {
     name: "timestamp-ms"
     mandatory_oneof: "['datetime', 'timestamp-ms', 'timestamp-seconds']"
diff --git a/extensions/amp-list/validator-amp-list.protoascii b/extensions/amp-list/validator-amp-list.protoascii
index b5f35a026..f41c4446b 100644
--- a/extensions/amp-list/validator-amp-list.protoascii
+++ b/extensions/amp-list/validator-amp-list.protoascii
@@ -64,6 +64,10 @@ tags: {  # <amp-list> with mandatory src and/or [src] attr
     value: "refresh"
   }
   attrs: { name: "credentials" }
+  attrs: {
+    name: "diffable"
+    value: ""
+  }
   attrs: { name: "items" }
   attrs: {
     name: "load-more"
@@ -93,9 +97,10 @@ tags: {  # <amp-list> with mandatory src and/or [src] attr
     }
     blacklisted_value_regex: "__amp_source_origin"
   }
-  # TODO(gregable): Implement validation that requires the template attr value
-  # to reference the id of an existing template element.
-  attrs: { name: "template" }
+  attrs: {
+    name: "template"
+    value_oneof_set: TEMPLATE_IDS
+  }
   # <amp-bind>
   attrs: {
     name: "[is-layout-container]"
@@ -220,9 +225,10 @@ tags: {  # <amp-list>
     blacklisted_value_regex: "__amp_source_origin|"
         "{{|}}"    # Mustache is disallowed in src.
   }
-  # TODO(gregable): Implement validation that requires the template attr value
-  # to reference the id of an existing template element.
-  attrs: { name: "template" }
+  attrs: {
+    name: "template"
+    value_oneof_set: TEMPLATE_IDS
+  }
   attr_lists: "extended-amp-global"
   amp_layout: {
     supported_layouts: FILL
diff --git a/extensions/amp-megaphone/validator-amp-megaphone.protoascii b/extensions/amp-megaphone/validator-amp-megaphone.protoascii
new file mode 100644
index 000000000..7f885a70c
--- /dev/null
+++ b/extensions/amp-megaphone/validator-amp-megaphone.protoascii
@@ -0,0 +1,92 @@
+#
+# Copyright 2019 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.
+#
+
+tags: {  # amp-megaphone
+  html_format: AMP
+  tag_name: "SCRIPT"
+  extension_spec: {
+    name: "amp-megaphone"
+    version: "0.1"
+    version: "latest"
+  }
+  attr_lists: "common-extension-attrs"
+}
+
+attr_lists: {
+  name: "amp-megaphone-common"
+  attrs: {
+    name: "data-light"
+    value: ""
+  }
+  attrs: {
+    name: "data-sharing"
+    value: ""
+  }
+}
+
+tags: {  # <amp-megaphone> for playlists
+  html_format: AMP
+  tag_name: "AMP-MEGAPHONE"
+  requires_extension: "amp-megaphone"
+  spec_name: "amp-megaphone [data-playlist]"
+
+  attrs: {
+    name: "data-playlist"
+    mandatory: true
+    value_regex: "[A-Za-z0-9]+"
+    dispatch_key: NAME_DISPATCH
+  }
+
+  attrs: {
+    name: "data-episodes"
+    value_regex: "[0-9]+"
+  }
+
+  attr_lists: "amp-megaphone-common"
+  attr_lists: "extended-amp-global"
+  amp_layout: {
+    supported_layouts: FIXED
+    supported_layouts: FIXED_HEIGHT
+  }
+}
+
+tags: {  # <amp-megaphone> for episodes
+  html_format: AMP
+  tag_name: "AMP-MEGAPHONE"
+  requires_extension: "amp-megaphone"
+  spec_name: "amp-megaphone [data-episode]"
+  attrs: {
+    name: "data-episode"
+    mandatory: true
+    value_regex: "[A-Za-z0-9]+"
+    dispatch_key: NAME_DISPATCH
+  }
+  attrs: {
+    name: "data-start"
+    value_regex: "\\d+(\\.\\d+)?"
+  }
+  attrs: {
+    name: "data-tile"
+    value: ""
+  }
+
+  attr_lists: "amp-megaphone-common"
+  attr_lists: "extended-amp-global"
+  amp_layout: {
+    supported_layouts: FIXED
+    supported_layouts: FIXED_HEIGHT
+  }
+}
diff --git a/extensions/amp-date-display/validator-amp-date-display.protoascii b/extensions/amp-minute-media-player/validator-amp-minute-media-player.protoascii
similarity index 51%
copy from extensions/amp-date-display/validator-amp-date-display.protoascii
copy to extensions/amp-minute-media-player/validator-amp-minute-media-player.protoascii
index e7e1550bb..9dbfa2e67 100644
--- a/extensions/amp-date-display/validator-amp-date-display.protoascii
+++ b/extensions/amp-minute-media-player/validator-amp-minute-media-player.protoascii
@@ -1,5 +1,5 @@
 #
-# Copyright 2018 The AMP HTML Authors. All Rights Reserved.
+# Copyright 2019 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.
@@ -14,52 +14,51 @@
 # limitations under the license.
 #
 
-tags: {  # amp-date-display
+tags: {  # amp-minute-media-player
   html_format: AMP
   tag_name: "SCRIPT"
   extension_spec: {
-    name: "amp-date-display"
+    name: "amp-minute-media-player"
     version: "0.1"
     version: "latest"
   }
   attr_lists: "common-extension-attrs"
 }
-tags: {  # <amp-date-display>
+tags: {  # <amp-minute-media-player>
   html_format: AMP
-  tag_name: "AMP-DATE-DISPLAY"
-  requires_extension: "amp-date-display"
+  tag_name: "AMP-MINUTE-MEDIA-PLAYER"
+  requires_extension: "amp-minute-media-player"
+  attrs: { name: "autoplay" }
   attrs: {
-    name: "datetime"
-    mandatory_oneof: "['datetime', 'timestamp-ms', 'timestamp-seconds']"
-    value_regex: "now|(\\d{4}-[01]\\d-[0-3]\\d(T[0-2]\\d:[0-5]\\d(:[0-6]\\d(\\.\\d\\d?\\d?)?)?(Z|[+-][0-1]\\d:[0-5]\\d)?)?)"
+    name: "dock"
+    requires_extension: "amp-video-docking"
   }
   attrs: {
-    name: "display-in"
-    value_casei: "utc"
+    name: "data-content-type"
+    mandatory: true
+    value: "curated"
+    value: "specific"
+    value: "semantic"
   }
+  attrs: { name: "data-content-id" }
+  attrs: { name: "data-scanned-element" }
   attrs: {
-    name: "offset-seconds"
-    value_regex: "-?\\d+"
-  }
-  attrs: { name: "locale" }
-  attrs: { name: "template" }
-  attrs: {
-    name: "timestamp-ms"
-    mandatory_oneof: "['datetime', 'timestamp-ms', 'timestamp-seconds']"
-    value_regex: "\\d+"
-  }
-  attrs: {
-    name: "timestamp-seconds"
-    mandatory_oneof: "['datetime', 'timestamp-ms', 'timestamp-seconds']"
-    value_regex: "\\d+"
+    name: "data-scanned-element-type"
+    value: "className"
+    value: "id"
+    value: "tag"
   }
+  attrs: { name: "data-tags" }
+  attrs: { name: "data-minimum-date-factor" }
+  attrs: { name: "data-scoped-keywords" }
+
   attr_lists: "extended-amp-global"
+  spec_url: "https://amp.dev/documentation/components/amp-minute-media-player"
   amp_layout: {
+    supported_layouts: RESPONSIVE
     supported_layouts: FILL
     supported_layouts: FIXED
     supported_layouts: FIXED_HEIGHT
     supported_layouts: FLEX_ITEM
-    supported_layouts: NODISPLAY
-    supported_layouts: RESPONSIVE
   }
 }
diff --git a/extensions/amp-mustache/validator-amp-mustache.protoascii b/extensions/amp-mustache/validator-amp-mustache.protoascii
index 351872b1c..dc2acc1e5 100644
--- a/extensions/amp-mustache/validator-amp-mustache.protoascii
+++ b/extensions/amp-mustache/validator-amp-mustache.protoascii
@@ -140,6 +140,131 @@ tags: {
   disallowed_ancestor: "FORM DIV [submitting][template]"
   disallowed_ancestor: "FORM DIV [verify-error][template]"
   requires_extension: "amp-mustache"
+  attrs: {
+    name: "id"
+    add_value_to_set: TEMPLATE_IDS
+    # When updating this blacklisted_value_regex, also update below, and in
+    # mandatory-id-attr and $GLOBAL_ATTRS in validator-main.protoascii.
+    blacklisted_value_regex: "(^|\\s)("  # Values are space separated
+        "__amp_\\S*|"
+        "__count__|"
+        "__defineGetter__|"
+        "__defineSetter__|"
+        "__lookupGetter__|"
+        "__lookupSetter__|"
+        "__noSuchMethod__|"
+        "__parent__|"
+        "__proto__|"
+        "__AMP_\\S*|"
+        "\\$p|"
+        "\\$proxy|"
+        "acceptCharset|"
+        "addEventListener|"
+        "appendChild|"
+        "assignedSlot|"
+        "attachShadow|"
+        "AMP|"
+        "baseURI|"
+        "checkValidity|"
+        "childElementCount|"
+        "childNodes|"
+        "classList|"
+        "className|"
+        "clientHeight|"
+        "clientLeft|"
+        "clientTop|"
+        "clientWidth|"
+        "compareDocumentPosition|"
+        "computedName|"
+        "computedRole|"
+        "contentEditable|"
+        "createShadowRoot|"
+        "enqueAction|"
+        "firstChild|"
+        "firstElementChild|"
+        "getAnimations|"
+        "getAttribute|"
+        "getAttributeNS|"
+        "getAttributeNode|"
+        "getAttributeNodeNS|"
+        "getBoundingClientRect|"
+        "getClientRects|"
+        "getDestinationInsertionPoints|"
+        "getElementsByClassName|"
+        "getElementsByTagName|"
+        "getElementsByTagNameNS|"
+        "getRootNode|"
+        "hasAttribute|"
+        "hasAttributeNS|"
+        "hasAttributes|"
+        "hasChildNodes|"
+        "hasPointerCapture|"
+        "i-amphtml-\\S*|"
+        "innerHTML|"
+        "innerText|"
+        "inputMode|"
+        "insertAdjacentElement|"
+        "insertAdjacentHTML|"
+        "insertAdjacentText|"
+        "isContentEditable|"
+        "isDefaultNamespace|"
+        "isEqualNode|"
+        "isSameNode|"
+        "lastChild|"
+        "lastElementChild|"
+        "lookupNamespaceURI|"
+        "namespaceURI|"
+        "nextElementSibling|"
+        "nextSibling|"
+        "nodeName|"
+        "nodeType|"
+        "nodeValue|"
+        "offsetHeight|"
+        "offsetLeft|"
+        "offsetParent|"
+        "offsetTop|"
+        "offsetWidth|"
+        "outerHTML|"
+        "outerText|"
+        "ownerDocument|"
+        "parentElement|"
+        "parentNode|"
+        "previousElementSibling|"
+        "previousSibling|"
+        "querySelector|"
+        "querySelectorAll|"
+        "releasePointerCapture|"
+        "removeAttribute|"
+        "removeAttributeNS|"
+        "removeAttributeNode|"
+        "removeChild|"
+        "removeEventListener|"
+        "replaceChild|"
+        "reportValidity|"
+        "requestPointerLock|"
+        "scrollHeight|"
+        "scrollIntoView|"
+        "scrollIntoViewIfNeeded|"
+        "scrollLeft|"
+        "scrollWidth|"
+        "setAttribute|"
+        "setAttributeNS|"
+        "setAttributeNode|"
+        "setAttributeNodeNS|"
+        "setPointerCapture|"
+        "shadowRoot|"
+        "styleMap|"
+        "tabIndex|"
+        "tagName|"
+        "textContent|"
+        "toString|"
+        "valueOf|"
+        "(webkit|ms|moz|o)dropzone|"
+        "(webkit|moz|ms|o)MatchesSelector|"
+        "(webkit|moz|ms|o)RequestFullScreen|"
+        "(webkit|moz|ms|o)RequestFullscreen"
+        ")(\\s|$)"
+  }
   attrs: {
     name: "type"
     mandatory: true
@@ -167,6 +292,131 @@ tags: {
   # AMP4EMAIL addition.
   disallowed_ancestor: "FORM DIV [submitting]"
   requires_extension: "amp-mustache"
+  attrs: {
+    name: "id"
+    add_value_to_set: TEMPLATE_IDS
+    # When updating this blacklisted_value_regex, also update above, and in
+    # mandatory-id-attr and $GLOBAL_ATTRS in validator-main.protoascii.
+    blacklisted_value_regex: "(^|\\s)("  # Values are space separated
+        "__amp_\\S*|"
+        "__count__|"
+        "__defineGetter__|"
+        "__defineSetter__|"
+        "__lookupGetter__|"
+        "__lookupSetter__|"
+        "__noSuchMethod__|"
+        "__parent__|"
+        "__proto__|"
+        "__AMP_\\S*|"
+        "\\$p|"
+        "\\$proxy|"
+        "acceptCharset|"
+        "addEventListener|"
+        "appendChild|"
+        "assignedSlot|"
+        "attachShadow|"
+        "AMP|"
+        "baseURI|"
+        "checkValidity|"
+        "childElementCount|"
+        "childNodes|"
+        "classList|"
+        "className|"
+        "clientHeight|"
+        "clientLeft|"
+        "clientTop|"
+        "clientWidth|"
+        "compareDocumentPosition|"
+        "computedName|"
+        "computedRole|"
+        "contentEditable|"
+        "createShadowRoot|"
+        "enqueAction|"
+        "firstChild|"
+        "firstElementChild|"
+        "getAnimations|"
+        "getAttribute|"
+        "getAttributeNS|"
+        "getAttributeNode|"
+        "getAttributeNodeNS|"
+        "getBoundingClientRect|"
+        "getClientRects|"
+        "getDestinationInsertionPoints|"
+        "getElementsByClassName|"
+        "getElementsByTagName|"
+        "getElementsByTagNameNS|"
+        "getRootNode|"
+        "hasAttribute|"
+        "hasAttributeNS|"
+        "hasAttributes|"
+        "hasChildNodes|"
+        "hasPointerCapture|"
+        "i-amphtml-\\S*|"
+        "innerHTML|"
+        "innerText|"
+        "inputMode|"
+        "insertAdjacentElement|"
+        "insertAdjacentHTML|"
+        "insertAdjacentText|"
+        "isContentEditable|"
+        "isDefaultNamespace|"
+        "isEqualNode|"
+        "isSameNode|"
+        "lastChild|"
+        "lastElementChild|"
+        "lookupNamespaceURI|"
+        "namespaceURI|"
+        "nextElementSibling|"
+        "nextSibling|"
+        "nodeName|"
+        "nodeType|"
+        "nodeValue|"
+        "offsetHeight|"
+        "offsetLeft|"
+        "offsetParent|"
+        "offsetTop|"
+        "offsetWidth|"
+        "outerHTML|"
+        "outerText|"
+        "ownerDocument|"
+        "parentElement|"
+        "parentNode|"
+        "previousElementSibling|"
+        "previousSibling|"
+        "querySelector|"
+        "querySelectorAll|"
+        "releasePointerCapture|"
+        "removeAttribute|"
+        "removeAttributeNS|"
+        "removeAttributeNode|"
+        "removeChild|"
+        "removeEventListener|"
+        "replaceChild|"
+        "reportValidity|"
+        "requestPointerLock|"
+        "scrollHeight|"
+        "scrollIntoView|"
+        "scrollIntoViewIfNeeded|"
+        "scrollLeft|"
+        "scrollWidth|"
+        "setAttribute|"
+        "setAttributeNS|"
+        "setAttributeNode|"
+        "setAttributeNodeNS|"
+        "setPointerCapture|"
+        "shadowRoot|"
+        "styleMap|"
+        "tabIndex|"
+        "tagName|"
+        "textContent|"
+        "toString|"
+        "valueOf|"
+        "(webkit|ms|moz|o)dropzone|"
+        "(webkit|moz|ms|o)MatchesSelector|"
+        "(webkit|moz|ms|o)RequestFullScreen|"
+        "(webkit|moz|ms|o)RequestFullscreen"
+        ")(\\s|$)"
+  }
   attrs: {
     name: "type"
     mandatory: true
diff --git a/extensions/amp-script/validator-amp-script.protoascii b/extensions/amp-script/validator-amp-script.protoascii
index 7e7c62f01..bf05ad10c 100644
--- a/extensions/amp-script/validator-amp-script.protoascii
+++ b/extensions/amp-script/validator-amp-script.protoascii
@@ -62,11 +62,11 @@ tags: {  # <amp-script>
   attrs: { name: "sandbox" }
   attrs: {
     name: "script"
-    mandatory_anyof: "['script', 'src']"
+    mandatory_oneof: "['script', 'src']"
   }
   attrs: {
     name: "src"
-    mandatory_anyof: "['script', 'src']"
+    mandatory_oneof: "['script', 'src']"
     value_url: {
       protocol: "https"
       allow_relative: false
diff --git a/extensions/amp-story/validator-amp-story.protoascii b/extensions/amp-story/validator-amp-story.protoascii
index afc738f2f..d798ffdac 100644
--- a/extensions/amp-story/validator-amp-story.protoascii
+++ b/extensions/amp-story/validator-amp-story.protoascii
@@ -804,6 +804,7 @@ descendant_tag_list {
   tag: "AMP-LIVE-LIST"
   tag: "AMP-LIVE-LIST"
   tag: "AMP-MATHML"
+  tag: "AMP-MEGAPHONE"
   tag: "AMP-MOWPLAYER"
   tag: "AMP-NEXXTV-PLAYER"
   tag: "AMP-O2-PLAYER"
diff --git a/extensions/amp-viewer-gpay-button/validator-amp-viewer-gpay-button.protoascii b/extensions/amp-viewer-gpay-button/validator-amp-viewer-gpay-button.protoascii
new file mode 100644
index 000000000..0dd3de865
--- /dev/null
+++ b/extensions/amp-viewer-gpay-button/validator-amp-viewer-gpay-button.protoascii
@@ -0,0 +1,36 @@
+#
+# Copyright 2019 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.
+#
+
+# tags: {  # amp-viewer-gpay-button
+#  html_format: AMP
+#  tag_name: "SCRIPT"
+#  extension_spec: {
+#    name: "amp-viewer-gpay-button"
+#    version: "0.1"
+#    version: "latest"
+#  }
+#  attr_lists: "common-extension-attrs"
+#}
+#tags: {  # <amp-viewer-gpay-button>
+#  html_format: AMP
+#  tag_name: "AMP-VIEWER-GPAY-BUTTON"
+#  requires_extension: "amp-viewer-gpay-button"
+#  attr_lists: "extended-amp-global"
+#  spec_url: "https://amp.dev/documentation/components/amp-viewer-gpay-button"
+#  amp_layout: {
+#    supported_layouts: RESPONSIVE
+#  }
+#}
diff --git a/extensions/amp-viewer-gpay-inline/validator-amp-viewer-gpay-inline.protoascii b/extensions/amp-viewer-gpay-inline/validator-amp-viewer-gpay-inline.protoascii
new file mode 100644
index 000000000..40036bcdb
--- /dev/null
+++ b/extensions/amp-viewer-gpay-inline/validator-amp-viewer-gpay-inline.protoascii
@@ -0,0 +1,36 @@
+#
+# Copyright 2019 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.
+#
+
+#tags: {  # amp-viewer-gpay-inline
+#  html_format: AMP
+#  tag_name: "SCRIPT"
+#  extension_spec: {
+#    name: "amp-viewer-gpay-inline"
+#    version: "0.1"
+#    version: "latest"
+#  }
+#  attr_lists: "common-extension-attrs"
+#}
+#tags: {  # <amp-viewer-gpay-inline>
+#  html_format: AMP
+#  tag_name: "AMP-VIEWER-GPAY-INLINE"
+#  requires_extension: "amp-viewer-gpay-inline"
+#  attr_lists: "extended-amp-global"
+#  spec_url: "https://amp.dev/documentation/components/amp-viewer-gpay-inline"
+#  amp_layout: {
+#    supported_layouts: RESPONSIVE
+#  }
+#}
diff --git a/validator/validator-main.protoascii b/validator/validator-main.protoascii
index aa86c144e..aaa099d82 100644
--- a/validator/validator-main.protoascii
+++ b/validator/validator-main.protoascii
@@ -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: 935
+spec_file_revision: 957
 
 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"
@@ -310,6 +310,7 @@ tags: {
   spec_name: "link rel=stylesheet for fonts"
   named_id: LINK_FONT_STYLESHEET
   mandatory_parent: "HEAD"
+  attr_lists: "nonce-attr"
   attrs: { name: "async" }
   attrs: { name: "crossorigin" }  # SRI attribute (https://www.w3.org/TR/SRI/)
   attrs: {
@@ -1115,6 +1116,40 @@ tags: {  # Special custom 'author' spreadsheet for AMP
   }
   spec_url: "https://amp.dev/documentation/guides-and-tutorials/learn/spec/amphtml#stylesheets"
 }
+# This variant of <style amp-custom> is designed to help developers see how
+# close they are to the byte limit, even if the page is passing. By changing
+# the attribute to <style amp-custom-length-check>, this tagspec will be used
+# to match errors. It cannot pass however as it has a cdata.max_bytes set to
+# -1. As a result, it will always fail and report the length found in the
+# tag's cdata. This is a small hack, and may be deleted in the future if there
+# are problems maintaining it. Deleting this tagspec will of course never
+# break any valid AMP documents as if it matches, the page will be invalid.
+tags: {
+  html_format: AMP
+  html_format: AMP4ADS
+  html_format: AMP4EMAIL
+  html_format: ACTIONS
+  disabled_by: "transformed"
+  tag_name: "STYLE"
+  spec_name: "style amp-custom-length-check"
+  unique: true
+  mandatory_parent: "HEAD"
+  attrs: {
+    name: "amp-custom-length-check"
+    mandatory: true
+    value: ""
+    dispatch_key: NAME_DISPATCH
+  }
+  attr_lists: "nonce-attr"
+  attrs: {  # This is a default, but it doesn't hurt.
+    name: "type"
+    value_casei: "text/css"
+  }
+  cdata: {
+    # This will always cause the tagspec matching to fail.
+    max_bytes: -1
+  }
+}
 # For transformed AMP non-data URLs are not counted against the total byte
 # limit for <style amp-custom>. This is done by setting url_bytes_included
 # to false for CdataSpec below.
@@ -1984,7 +2019,6 @@ tags: {
     name: "type"
     value_casei: "text/html"
   }
-  attr_lists: "name-attr"
 }
 
 # 4.5.2 The em element
@@ -2298,8 +2332,9 @@ tags: {
     mandatory: true
     value_url: {
       protocol: "data"
+      protocol: "http" # For parity with amp-img's mandatory-src-or-srcset.
       protocol: "https"
-      allow_relative: true  # Will be set to false at a future date.
+      allow_relative: true
     }
     blacklisted_value_regex: "__amp_source_origin"
   }
@@ -6376,7 +6411,7 @@ attr_lists: {
   attrs: {
     name: "id"
     # When updating this blacklisted_value_regex, also update for
-    # mandatory-id-attr.
+    # mandatory-id-attr and validator-amp-mustache.protoascii.
     blacklisted_value_regex: "(^|\\s)("  # Values are space separated
         "__amp_\\S*|"
         "__count__|"
@@ -6874,6 +6909,10 @@ error_specificity {
   code: DOCUMENT_SIZE_LIMIT_EXCEEDED
   specificity: 120
 }
+error_specificity {
+  code: VALUE_SET_MISMATCH
+  specificity: 121
+}
 error_specificity {
   code: DEV_MODE_ONLY
   # This should always trump any other error. It is asserting
@@ -7346,8 +7385,13 @@ error_formats {
   code: DOCUMENT_SIZE_LIMIT_EXCEEDED
   format: "Document exceeded %1 bytes limit. Actual size %2 bytes."
 }
+error_formats {
+  code: VALUE_SET_MISMATCH
+  format: "Attribute '%1' in tag '%2' contains a value that does not match any "
+          "other tags on the page."
+}
 error_formats {
   code: DEV_MODE_ONLY
-  format: "Tag 'html' marked with attribute 'ampdevmode'. Validator "
+  format: "Tag 'html' marked with attribute 'data-ampdevmode'. Validator "
           "will suppress errors regarding any other tag with this attribute."
 }

@westonruter westonruter added this to the v1.3 milestone Sep 13, 2019
@googlebot googlebot added the cla: yes Signed the Google CLA label Sep 13, 2019
'requires_extension' => array(
'amp-carousel',
),
'spec_name' => 'AMP-CAROUSEL [type=slides]',
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Merged with the above spec.

'amp-carousel',
'amp-lightbox-gallery',
),
'spec_name' => 'AMP-CAROUSEL [lightbox] [type=carousel]',
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Merged with the above spec.

'allow_relative' => true,
'protocol' => array(
'data',
'http',
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@westonruter westonruter changed the title Update allowed tags/attributes from spec in amphtml 1909051756330 Update allowed tags/attributes from spec in amphtml 1909131932180 Sep 13, 2019
@MackenzieHartung MackenzieHartung modified the milestones: v1.3, v1.3.1 Sep 18, 2019
@westonruter westonruter changed the title Update allowed tags/attributes from spec in amphtml 1909131932180 Update allowed tags/attributes from spec in amphtml 1910071803120 Oct 7, 2019
@westonruter westonruter force-pushed the update/amphtml-1909051756330 branch from d8eb8ec to c06841c Compare October 7, 2019 22:43
@westonruter westonruter marked this pull request as ready for review October 7, 2019 23:35
@westonruter westonruter requested a review from kienstra October 7, 2019 23:36
Copy link
Copy Markdown
Contributor

@kienstra kienstra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved

Hi @westonruter,
This looks good.

A <noscript> inside an <amp-img> still looks good:

noscript-here

[ 'amp-user-location' ],
],

'amp-megaphone' => [
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, amp-megaphone looks interesting.

@westonruter westonruter merged commit 00e5139 into develop Oct 8, 2019
@westonruter westonruter deleted the update/amphtml-1909051756330 branch October 8, 2019 02:17
@swissspidy swissspidy modified the milestones: v1.3.1, v1.4 Oct 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla: yes Signed the Google CLA

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants