-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1333 from Gregable/regexpmatching
Fix some bugs regarding regular expression parsing in javascript.
- Loading branch information
Showing
7 changed files
with
155 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
FAIL | ||
feature_tests/dog_doc_type.html:23:0 DISALLOWED_ATTR 🐶 | ||
feature_tests/dog_doc_type.html:35:7 MANDATORY_TAG_MISSING html ⚡ for top-level html (see https://github.com/ampproject/amphtml/blob/master/spec/amp-html-format.md#ampd) | ||
feature_tests/dog_doc_type.html:35:7 MANDATORY_TAG_MISSING html ⚡ for top-level html (see https://github.com/ampproject/amphtml/blob/master/spec/amp-html-format.md#ampd) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
<!-- | ||
Copyright 2015 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 tests looks at specific errors related to positive and negative | ||
regexps used inside the validator. | ||
--> | ||
<!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>invalid body {opacity: 0}</style> | ||
<noscript><style>body {opacity: 1}</style></noscript> | ||
<script async src="https://cdn.ampproject.org/v0.js"></script> | ||
|
||
<!-- | ||
href value_regex: "https://fonts\\.googleapis\\.com/css\\?.*|https://fast\\.fonts\\.net/.*" | ||
The first example is valid, the second example is invalid. | ||
--> | ||
<link rel="stylesheet" type="text/css" | ||
href="https://fonts.googleapis.com/css?foobar"> | ||
<link rel="stylesheet" type="text/css" | ||
href="http://xss.com/https://fonts.googleapis.com/css?foobar"> | ||
|
||
<!-- | ||
rel value_regex: lenghty, see protoascii | ||
The first three examples are valid. The latter three examples are invalid. | ||
--> | ||
<link rel="accessibility"> | ||
<link rel="accessibility alternate"> | ||
<link rel="accessibility alternate archives"> | ||
<link rel="foo"> | ||
<link rel="accessibility foo"> | ||
<link rel="foo accessibility"> | ||
|
||
<!-- | ||
name blacklisted_value_regex: "(^|\\s)(viewport|content-disposition|revisit-after)($|\\s)" | ||
The first two examples are valid. The latter two examples are invalid. | ||
--> | ||
<meta name="valid" content=""> | ||
<meta name="validcontent-disposition" content=""> | ||
<meta name="content-disposition" content=""> | ||
<meta name="invalid content-disposition" content=""> | ||
|
||
</head> | ||
<body> | ||
|
||
<!-- | ||
autoplay value_regex: "^$|desktop|tablet|mobile" | ||
The first two examples are valid, the latter three examples are invalid. | ||
--> | ||
<amp-audio src="" layout="fixed" autoplay=""> | ||
<amp-audio src="" layout="fixed" autoplay="desktop"> | ||
<amp-audio src="" layout="fixed" autoplay="invalid"> | ||
<amp-audio src="" layout="fixed" autoplay="desktopfoo"> | ||
<amp-audio src="" layout="fixed" autoplay="foodesktop"> | ||
|
||
<!-- | ||
href blacklisted_value_regex: "^\\s*(javascript|vbscript|data):" | ||
The first example is valid, the latter two examples are invalid. | ||
--> | ||
<a href="https://example.com/article/about/javascript:alert.html"> | ||
<a href="javascript:alert"> | ||
<a href=" javascript:alert"> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
FAIL | ||
feature_tests/regexps.html:27:2 MANDATORY_CDATA_MISSING_OR_INCORRECT mandatory style (js enabled) opacity 0 (see https://github.com/ampproject/amphtml/blob/master/spec/amp-html-format.md#opacity) | ||
feature_tests/regexps.html:37:2 INVALID_ATTR_VALUE rel=stylesheet (see https://github.com/ampproject/amphtml/blob/master/spec/amp-html-format.md#canon) | ||
feature_tests/regexps.html:47:2 INVALID_ATTR_VALUE rel=foo (see https://github.com/ampproject/amphtml/blob/master/spec/amp-html-format.md#canon) | ||
feature_tests/regexps.html:48:2 INVALID_ATTR_VALUE rel=accessibility foo (see https://github.com/ampproject/amphtml/blob/master/spec/amp-html-format.md#canon) | ||
feature_tests/regexps.html:49:2 INVALID_ATTR_VALUE rel=foo accessibility (see https://github.com/ampproject/amphtml/blob/master/spec/amp-html-format.md#canon) | ||
feature_tests/regexps.html:57:2 INVALID_ATTR_VALUE name=content-disposition (see https://github.com/ampproject/amphtml/blob/master/spec/amp-html-format.md#vprt) | ||
feature_tests/regexps.html:58:2 INVALID_ATTR_VALUE name=invalid content-disposition (see https://github.com/ampproject/amphtml/blob/master/spec/amp-html-format.md#vprt) | ||
feature_tests/regexps.html:69:2 INVALID_ATTR_VALUE autoplay=invalid (see https://github.com/ampproject/amphtml/blob/master/extensions/amp-audio/amp-audio.md) | ||
feature_tests/regexps.html:70:2 INVALID_ATTR_VALUE autoplay=desktopfoo (see https://github.com/ampproject/amphtml/blob/master/extensions/amp-audio/amp-audio.md) | ||
feature_tests/regexps.html:71:2 INVALID_ATTR_VALUE autoplay=foodesktop (see https://github.com/ampproject/amphtml/blob/master/extensions/amp-audio/amp-audio.md) | ||
feature_tests/regexps.html:78:2 INVALID_ATTR_VALUE href=javascript:alert | ||
feature_tests/regexps.html:79:2 INVALID_ATTR_VALUE href= javascript:alert |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.