diff --git a/bin/amphtml-update.py b/bin/amphtml-update.py
index 16915981377..302bd93b294 100755
--- a/bin/amphtml-update.py
+++ b/bin/amphtml-update.py
@@ -76,7 +76,10 @@ def GenValidatorProtoascii(validator_directory, out_dir):
"""
logging.info('entering ...')
- protoascii_segments = [open(os.path.join(validator_directory, 'validator-main.protoascii')).read()]
+ protoascii_segments = [
+ open(os.path.join(validator_directory, 'validator-main.protoascii')).read(),
+ open(os.path.join(validator_directory, 'validator-css.protoascii')).read()
+ ]
extensions = glob.glob(os.path.join(validator_directory, '../extensions/*/validator-*.protoascii'))
extensions.sort()
for extension in extensions:
@@ -445,10 +448,12 @@ def GetTagSpec(tag_spec, attr_lists):
if isinstance(field_value, (unicode, str, bool, int)):
cdata_dict[ field_descriptor.name ] = field_value
elif isinstance( field_value, google.protobuf.pyext._message.RepeatedCompositeContainer ):
- cdata_dict[ field_descriptor.name ] = {}
+ cdata_dict[ field_descriptor.name ] = []
for value in field_value:
+ entry = {}
for (key,val) in value.ListFields():
- cdata_dict[ field_descriptor.name ][ key.name ] = val
+ entry[ key.name ] = val
+ cdata_dict[ field_descriptor.name ].append( entry )
elif hasattr( field_value, '_values' ):
cdata_dict[ field_descriptor.name ] = {}
for _value in field_value._values:
@@ -482,10 +487,11 @@ def GetTagSpec(tag_spec, attr_lists):
cdata_dict['css_spec'] = css_spec
if len( cdata_dict ) > 0:
if 'blacklisted_cdata_regex' in cdata_dict:
- if 'error_message' not in cdata_dict['blacklisted_cdata_regex']:
- raise Exception( 'Missing error_message for blacklisted_cdata_regex.' );
- if cdata_dict['blacklisted_cdata_regex']['error_message'] not in ( 'CSS !important', 'contents', 'html comments' ):
- raise Exception( 'Unexpected error_message "%s" for blacklisted_cdata_regex.' % cdata_dict['blacklisted_cdata_regex']['error_message'] );
+ for entry in cdata_dict['blacklisted_cdata_regex']:
+ if 'error_message' not in entry:
+ raise Exception( 'Missing error_message for blacklisted_cdata_regex.' );
+ if entry['error_message'] not in ( 'contents', 'html comments', 'CSS i-amphtml- name prefix' ):
+ raise Exception( 'Unexpected error_message "%s" for blacklisted_cdata_regex.' % entry['error_message'] );
tag_spec_dict['cdata'] = cdata_dict
if 'spec_name' not in tag_spec_dict['tag_spec']:
@@ -674,6 +680,13 @@ def GetAttrs(attrs):
if value_dict is not None:
+ # Skip rules for dev mode attributes since the AMP plugin will allow them to pass through.
+ # See for how the rules are
+ # defined in a way that they can never be satisfied, and thus to make the attribute never allowed.
+ # This runs contrary to the needs of the AMP plugin, as the internal sanitizers are built to ignore them.
+ if 'data-ampdevmode' == attr_spec.name:
+ continue
+
# Normalize bracketed amp-bind attribute syntax to data-amp-bind-* syntax.
name = attr_spec.name
if name[0] == '[':
diff --git a/includes/sanitizers/class-amp-allowed-tags-generated.php b/includes/sanitizers/class-amp-allowed-tags-generated.php
index bca40da77a6..118cc5c1c12 100644
--- a/includes/sanitizers/class-amp-allowed-tags-generated.php
+++ b/includes/sanitizers/class-amp-allowed-tags-generated.php
@@ -13,7 +13,7 @@
*/
class AMP_Allowed_Tags_Generated {
- private static $spec_file_revision = 1012;
+ private static $spec_file_revision = 1028;
private static $minimum_validator_revision_required = 375;
private static $descendant_tag_lists = array(
@@ -566,6 +566,7 @@ class AMP_Allowed_Tags_Generated {
'bbmi',
'chrome',
'itms-services',
+ 'facetime',
'fb-me',
'fb-messenger',
'feed',
@@ -4070,6 +4071,7 @@ class AMP_Allowed_Tags_Generated {
'allow_relative' => true,
'protocol' => array(
'https',
+ 'amp-state',
),
),
),
@@ -5784,6 +5786,9 @@ class AMP_Allowed_Tags_Generated {
'amp-story-grid-layer' => array(
array(
'attr_spec_list' => array(
+ 'aspect-ratio' => array(
+ 'value_regex' => '\\d+:\\d+',
+ ),
'position' => array(
'value' => array(
'landscape-half-left',
@@ -8973,7 +8978,14 @@ class AMP_Allowed_Tags_Generated {
),
'html' => array(
array(
- 'attr_spec_list' => array(),
+ 'attr_spec_list' => array(
+ 'data-amp-autocomplete-opt-in' => array(
+ 'blacklisted_value_regex' => 'false',
+ 'value' => array(
+ 'false',
+ ),
+ ),
+ ),
'tag_spec' => array(
'mandatory' => true,
'mandatory_parent' => '!doctype',
@@ -11941,8 +11953,10 @@ class AMP_Allowed_Tags_Generated {
),
'cdata' => array(
'blacklisted_cdata_regex' => array(
- 'error_message' => 'contents',
- 'regex' => '.',
+ array(
+ 'error_message' => 'contents',
+ 'regex' => '.',
+ ),
),
),
'tag_spec' => array(
@@ -11982,8 +11996,10 @@ class AMP_Allowed_Tags_Generated {
),
'cdata' => array(
'blacklisted_cdata_regex' => array(
- 'error_message' => 'contents',
- 'regex' => '.',
+ array(
+ 'error_message' => 'contents',
+ 'regex' => '.',
+ ),
),
),
'tag_spec' => array(
@@ -12007,8 +12023,10 @@ class AMP_Allowed_Tags_Generated {
),
'cdata' => array(
'blacklisted_cdata_regex' => array(
- 'error_message' => 'html comments',
- 'regex' => ' */