-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
Allow any layout for amp-social-share, with test. #3099
Changes from all commits
c361ef6
926a6cb
3f759da
7a39b54
736eea9
0fc0b3a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
FAIL | ||
amp-social-share/0.1/test/validator-amp-social-share.html:31:2 The specified layout 'CONTAINER' is not supported by tag 'amp-social-share'. (see https://www.ampproject.org/docs/reference/extended/amp-social-share.html) [AMP_LAYOUT_PROBLEM] | ||
amp-social-share/0.1/test/validator-amp-social-share.html:45:7 The tag 'amp-social-share extension .js script' is missing or incorrect, but required by 'amp-social-share'. (see https://www.ampproject.org/docs/reference/extended/amp-social-share.html) [AMP_TAG_PROBLEM] | ||
amp-social-share/0.1/test/validator-amp-social-share.html:68:2 Invalid URL protocol 'votethisup:' for attribute 'data-share-endpoint' in tag 'amp-social-share'. (see https://www.ampproject.org/docs/reference/extended/amp-social-share.html) [AMP_TAG_PROBLEM] | ||
amp-social-share/0.1/test/validator-amp-social-share.html:76:2 Invalid URL protocol 'j a v a s c r i p t :' for attribute 'data-share-endpoint' in tag 'amp-social-share'. (see https://www.ampproject.org/docs/reference/extended/amp-social-share.html) [AMP_TAG_PROBLEM] |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,24 +46,6 @@ tags: { # amp-social-share | |
} | ||
spec_url: "https://www.ampproject.org/docs/reference/extended/amp-social-share.html" | ||
} | ||
tags: { # amp-social-share (json) | ||
tag_name: "script" | ||
spec_name: "amp-social-share extension .json script" | ||
mandatory_parent: "amp-social-share" | ||
attrs: { | ||
name: "type" | ||
mandatory: true | ||
value: "application/json" | ||
dispatch_key: true | ||
} | ||
cdata: { | ||
blacklisted_cdata_regex: { | ||
regex: "<!--" | ||
error_message: "html comments" | ||
} | ||
} | ||
spec_url: "https://www.ampproject.org/docs/reference/extended/amp-social-share.html" | ||
} | ||
tags: { # <amp-social-share> | ||
tag_name: "amp-social-share" | ||
disallowed_ancestor: "head" | ||
|
@@ -72,11 +54,33 @@ tags: { # <amp-social-share> | |
attrs: { | ||
name: "type" | ||
mandatory: true | ||
value_regex: "(twitter|facebook|pinterest|linkedin|gplus|email)" | ||
} | ||
attrs: { | ||
name: "data-share-endpoint" | ||
value_url: { | ||
allowed_protocol: "ftp" | ||
allowed_protocol: "http" | ||
allowed_protocol: "https" | ||
allowed_protocol: "mailto" | ||
# Whitelisting additional commonly observed third party | ||
# protocols which should be safe | ||
allowed_protocol: "snapchat" | ||
allowed_protocol: "sms" | ||
allowed_protocol: "tel" | ||
allowed_protocol: "viber" | ||
allowed_protocol: "whatsapp" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @dvoytenko I want to get your opinion on this as well. @powdercloud and I chatted about this, this is mainly to blacklist bad protocols (I know The problem with this is that it really limits what users can use until they add them to the validator, which I am not really a big fan of. Should we just drop the whitelisting in the validator and enforce it on runtime? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a fairly important topic. I have two questions here:
Ideally we'd have a blacklist here, but let's first see what are the answers to these questions. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The gist is that the validator will detect the protocol and compare it to a whitelist. |
||
allow_relative: false | ||
} | ||
} | ||
attr_lists: "extended-amp-global" | ||
spec_url: "https://www.ampproject.org/docs/reference/extended/amp-social-share.html" | ||
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 | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. I think runtime error should be good enough. @dvoytenko what do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. I believe this should be a runtime error, not a validator error.