Skip to content

Commit da10be2

Browse files
committed
Add test for amp-subscriptions and note what is lacking
1 parent 72b6554 commit da10be2

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

includes/sanitizers/class-amp-tag-and-attribute-sanitizer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2224,7 +2224,7 @@ private function is_amp_allowed_tag( DOMElement $node ) {
22242224
*
22252225
* @since 0.5
22262226
*
2227-
* @todo It would be more robust if the the actual tag spec were looked up and then matched against the parent, but this is currently overkill.
2227+
* @todo It would be more robust if the the actual tag spec were looked up (see https://github.com/ampproject/amp-wp/pull/3817) and then matched against the parent. This is needed to support the spec 'subscriptions script ciphertext'.
22282228
*
22292229
* @param DOMElement $node Node.
22302230
* @param string $parent_spec_name Parent spec name, for example 'body' or 'form [method=post]'.

tests/php/test-tag-and-attribute-sanitizer.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2753,6 +2753,25 @@ public function get_html_data() {
27532753
null,
27542754
[],
27552755
],
2756+
'amp-subscriptions' => [
2757+
// @todo The <script ciphertext type="application/octet-stream">...</script> but it is not yet supported. Support depends on todo in \AMP_Tag_And_Attribute_Sanitizer::has_parent().
2758+
'
2759+
<html>
2760+
<head>
2761+
<meta charset="utf-8">
2762+
<script cryptokeys sha-256-hash type="application/json">{}</script>
2763+
</head>
2764+
<body>
2765+
<section subscriptions-section="content" encrypted swg_amp_cache_nonce="NONCE">
2766+
...
2767+
</section>
2768+
<span swg_amp_cache_nonce="NONCE"></span>
2769+
</body>
2770+
</html>
2771+
',
2772+
null,
2773+
[ 'amp-subscriptions' ],
2774+
],
27562775
];
27572776

27582777
$bad_dev_mode_document = sprintf(

0 commit comments

Comments
 (0)