Skip to content
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

Fix handling of "ambiguous ampersands" to report error when expected #83

Closed
wants to merge 27 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
066c671
CI: Drop Java 14 and 15 testing, add Java 17
sideshowbarker Sep 2, 2021
372b1e1
CI: Update to Java 17 (from 17-ea)
sideshowbarker Sep 24, 2021
fbc2cfb
CI: Add Java 18-ea; drop 16; pin to 11.0.3; use zulu
sideshowbarker Sep 29, 2021
cb4ac1a
Mozilla bug 1724243 - Make text/plain and MediaDocuments use the Stan…
hsivonen Sep 29, 2021
5bf8aa3
increase bufferSpace by at least 25%
MarkusKull Oct 7, 2021
6205b94
Use setup-java@v2
sideshowbarker Oct 13, 2021
0beae2c
chore: setup Dependabot
nschonni Oct 13, 2021
84ed5c9
chore: restrict push builds to main
nschonni Oct 13, 2021
190ac35
Mozilla bug 1701828 - Meta charset rewrite for Gecko.
hsivonen Oct 1, 2021
5fc01b1
Mozilla bug 1701828 addendum - More comments for meta charset rewrite…
hsivonen Jan 3, 2022
dad0086
Bump actions/checkout from 2 to 3
dependabot[bot] Mar 7, 2022
80a5fc5
Bump actions/cache from 2 to 3
dependabot[bot] Mar 28, 2022
07c3df8
Bump actions/setup-java from 2 to 3
dependabot[bot] Apr 11, 2022
83602ed
Bump icu4j from 4.0.1 to 71.1 (#68)
dependabot[bot] Apr 11, 2022
296f4a5
Mozilla bug 1747388. r=smaug
hsivonen May 4, 2022
c3a57da
Revert ParserException import that should not have been added in the …
hsivonen Jun 22, 2022
a57c00b
Mozilla bug 1372276 - Remove menuitem. (#70)
emilio Jun 23, 2022
2bb1958
Mozilla bug 1775477 - Fix parser-created keygen element interface. (#71)
emilio Jun 23, 2022
4c23b9e
Warn about self-closing tag syntax if profile is “html-strict” (#73)
sideshowbarker Sep 27, 2022
c358af4
Move the self-closing-tag warning to the TreeBuilder code (#74)
sideshowbarker Sep 27, 2022
f79f0ca
Streamline the warning about self-closing-tag syntax (#75)
sideshowbarker Oct 5, 2022
5f0eb3a
Skip template contents when checking ID uniqueness (#77)
sideshowbarker Oct 14, 2022
7bf3c23
Mozilla bug 1552008 - Track column number in the HTML. r=smaug,nchevobbe
hsivonen Mar 16, 2023
fccac59
WIP: Make the test harness recognize error-reporting failures
sideshowbarker May 31, 2023
cf8af40
Conform ampersand-error reporting to HTML spec
sideshowbarker Dec 14, 2015
b07aacc
Ensure ampersand handling across buffer boundaries
sideshowbarker Aug 6, 2020
8c718d3
Only reconsume from ampersand state if not in attr
sideshowbarker Aug 7, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
- package-ecosystem: "maven"
directory: "/"
schedule:
interval: "weekly"
15 changes: 10 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,30 @@
name: Build

on: [push, pull_request]
on:
push:
branches:
- main
pull_request:

jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
java: [11, 14, 15-ea, 16-ea]
java: [17, 11.0.3, 18-ea]
os: [ubuntu-latest, macos-latest, windows-latest]
name: Java ${{ matrix.java }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
submodules: true
- name: Set up java
uses: actions/setup-java@v1
uses: actions/setup-java@v3
with:
distribution: zulu
java-version: ${{ matrix.java }}
- name: Cache Maven packages
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
Expand Down
3 changes: 1 addition & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,6 @@
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<test>Html5libTest</test>
<testFailureIgnore>true</testFailureIgnore> <!-- FIXME: Remove this testFailureIgnore after we have all tests passing -->
<additionalClasspathElements>
<additionalClasspathElement>${project.build.testSourceDirectory}/test/resources</additionalClasspathElement>
</additionalClasspathElements>
Expand All @@ -144,7 +143,7 @@
<dependency>
<groupId>com.ibm.icu</groupId>
<artifactId>icu4j</artifactId>
<version>4.0.1</version>
<version>71.1</version>
<scope>compile</scope>
<optional>true</optional>
</dependency>
Expand Down
154 changes: 73 additions & 81 deletions src/nu/validator/htmlparser/impl/ElementName.java
Original file line number Diff line number Diff line change
Expand Up @@ -557,8 +557,6 @@ public void destructor() {
// return "ANNOTATION_XML";
// case TreeBuilder.FOREIGNOBJECT_OR_DESC:
// return "FOREIGNOBJECT_OR_DESC";
// case TreeBuilder.MENUITEM:
// return "MENUITEM";
// }
// return null;
// }
Expand Down Expand Up @@ -1143,10 +1141,6 @@ public void destructor() {
// CPPONLY: NS_NewHTMLFormElement,
// CPPONLY: NS_NewSVGUnknownElement,
TreeBuilder.FORM | SPECIAL);
public static final ElementName MENUITEM = new ElementName("menuitem", "menuitem",
// CPPONLY: NS_NewHTMLMenuItemElement,
// CPPONLY: NS_NewSVGUnknownElement,
TreeBuilder.MENUITEM);
public static final ElementName PARAM = new ElementName("param", "param",
// CPPONLY: NS_NewHTMLSharedElement,
// CPPONLY: NS_NewSVGUnknownElement,
Expand All @@ -1172,7 +1166,7 @@ public void destructor() {
// CPPONLY: NS_NewSVGUnknownElement,
TreeBuilder.MI_MO_MN_MS_MTEXT | SCOPING_AS_MATHML);
public static final ElementName KEYGEN = new ElementName("keygen", "keygen",
// CPPONLY: NS_NewHTMLElement,
// CPPONLY: NS_NewHTMLUnknownElement,
// CPPONLY: NS_NewSVGUnknownElement,
TreeBuilder.KEYGEN | SPECIAL);
public static final ElementName MAIN = new ElementName("main", "main",
Expand Down Expand Up @@ -1484,7 +1478,7 @@ public void destructor() {
// CPPONLY: NS_NewSVGUnknownElement,
TreeBuilder.TBODY_OR_THEAD_OR_TFOOT | SPECIAL | FOSTER_PARENTING | OPTIONAL_END_TAG);
private final static @NoLength ElementName[] ELEMENT_NAMES = {
FIGCAPTION,
MN,
CITE,
FRAMESET,
H1,
Expand All @@ -1495,7 +1489,7 @@ public void destructor() {
BGSOUND,
SOURCE,
HTML,
RP,
OPTGROUP,
NOFRAMES,
MTEXT,
VIEW,
Expand All @@ -1507,8 +1501,8 @@ public void destructor() {
GLYPHREF,
LI,
ACRONYM,
SECTION,
HR,
TSPAN,
FEFUNCR,
CANVAS,
BASEFONT,
FEDISTANTLIGHT,
Expand All @@ -1530,11 +1524,11 @@ public void destructor() {
PATH,
MALIGNMARK,
SMALL,
PARAM,
OPTION,
VIDEO,
BR,
FOOTER,
ANIMATEMOTION,
POLYGON,
COLGROUP,
ABBR,
FEGAUSSIANBLUR,
TR,
DETAILS,
DT,
Expand Down Expand Up @@ -1578,15 +1572,15 @@ public void destructor() {
LABEL,
ALTGLYPHITEM,
FORM,
BUTTON,
KEYGEN,
PATTERN,
AUDIO,
FEDISPLACEMENTMAP,
SAMP,
ANIMATECOLOR,
FECOMPONENTTRANSFER,
HEADER,
CAPTION,
MAIN,
SPAN,
MO,
HGROUP,
STOP,
CENTER,
FILTER,
MARKER,
NOBR,
ADDRESS,
DEFS,
Expand Down Expand Up @@ -1672,28 +1666,27 @@ public void destructor() {
SYMBOL,
ANIMATETRANSFORM,
EM,
MENUITEM,
ANIMATEMOTION,
CAPTION,
MN,
MAIN,
POLYGON,
SPAN,
TSPAN,
MO,
COLGROUP,
HGROUP,
OPTGROUP,
STOP,
ABBR,
CENTER,
FEFUNCR,
FILTER,
FEGAUSSIANBLUR,
MARKER,
PARAM,
BUTTON,
FIGCAPTION,
KEYGEN,
OPTION,
PATTERN,
SECTION,
AUDIO,
VIDEO,
FEDISPLACEMENTMAP,
RP,
SAMP,
BR,
ANIMATECOLOR,
HR,
FECOMPONENTTRANSFER,
FOOTER,
HEADER,
};
private final static int[] ELEMENT_HASHES = {
1900845386,
1902641154,
1748359220,
2001349720,
876609538,
Expand All @@ -1704,7 +1697,7 @@ public void destructor() {
1730965751,
1756474198,
1868312196,
1938817026,
1939219752,
1988763672,
2005324101,
2060065124,
Expand All @@ -1716,8 +1709,8 @@ public void destructor() {
1766992520,
1818230786,
1881613047,
1907661127,
1967128578,
1907959605,
1967760215,
1982935782,
1999397992,
2001392798,
Expand All @@ -1739,11 +1732,11 @@ public void destructor() {
1805502724,
1854228698,
1874053333,
1889085973,
1905563974,
1925844629,
1963982850,
1967795958,
1898223949,
1906087319,
1932928296,
1965115924,
1968053806,
1973420034,
1983633431,
1998585858,
Expand Down Expand Up @@ -1787,15 +1780,15 @@ public void destructor() {
1870268949,
1881288348,
1884120164,
1898753862,
1903302038,
1906135367,
1914900309,
1934172497,
1941178676,
1965334268,
1967788867,
1968836118,
1899272519,
1904412884,
1907435316,
1919418370,
1935549734,
1941221172,
1966223078,
1967795910,
1971461414,
1971938532,
1982173479,
1983533124,
Expand Down Expand Up @@ -1881,24 +1874,23 @@ public void destructor() {
1874102998,
1881498736,
1881669634,
1887579800,
1898223949,
1899272519,
1902641154,
1904412884,
1906087319,
1907435316,
1907959605,
1919418370,
1932928296,
1935549734,
1939219752,
1941221172,
1965115924,
1966223078,
1967760215,
1967795910,
1968053806,
1971461414,
1889085973,
1898753862,
1900845386,
1903302038,
1905563974,
1906135367,
1907661127,
1914900309,
1925844629,
1934172497,
1938817026,
1941178676,
1963982850,
1965334268,
1967128578,
1967788867,
1967795958,
1968836118,
};
}
9 changes: 9 additions & 0 deletions src/nu/validator/htmlparser/impl/ErrorReportingTokenizer.java
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,15 @@ public void setErrorProfile(HashMap<String, String> errorProfileMap) {
this.errorProfileMap = errorProfileMap;
}

/**
* Gets the errorProfile.
*
* @param errorProfile
*/
@Override public HashMap getErrorProfile() {
return errorProfileMap;
}

/**
* Reports on an event based on profile selected.
*
Expand Down
Loading