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: consider HTML form elements as scripted content #1419

Merged
merged 1 commit into from
Dec 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
9 changes: 7 additions & 2 deletions src/main/java/com/adobe/epubcheck/ops/OPSHandler30.java
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,10 @@ else if (EpubConstants.HtmlNamespaceUri.equals(e.getNamespace()) && name.equals(
{
processMeta();
}
else if (name.equals("form"))
{
requiredProperties.add(ITEM_PROPERTIES.SCRIPTED);
}
else if (name.equals("link"))
{
processLink();
Expand Down Expand Up @@ -538,7 +542,8 @@ protected void processVideo()
protected void processHyperlink(URL href)
{
super.processHyperlink(href);
if ("data".equals(href.scheme())) {
if ("data".equals(href.scheme()))
{
report.message(MessageId.RSC_029, location());
return;
}
Expand Down Expand Up @@ -912,7 +917,7 @@ protected void checkOverlaysStyles()
if (context.opfItem.isPresent() && context.opfItem.get().getMediaOverlay() != null
&& (context.featureReport.hasFeature(FeatureEnum.MEDIA_OVERLAYS_ACTIVE_CLASS)
|| context.featureReport.hasFeature(FeatureEnum.MEDIA_OVERLAYS_PLAYBACK_ACTIVE_CLASS))
&& !this.hasCSS)
&& !this.hasCSS)
{
report.message(MessageId.CSS_030, location());
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta charset="utf-8" />
<title>Minimal EPUB</title>
</head>
<body>
<h1>Loomings</h1>
<p>Call me Ishmael.</p>
<form action="https://example.org" method="get">
<label for="email">Enter your email: </label>
<input type="email" name="email" id="email" required="" />
<input type="submit" value="Subscribe!" />
</form>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops" xml:lang="en" lang="en">
<head>
<meta charset="utf-8"/>
<title>Minimal Nav</title>
</head>
<body>
<nav epub:type="toc">
<ol>
<li><a href="content_001.xhtml">content 001</a></li>
</ol>
</nav>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<package xmlns="http://www.idpf.org/2007/opf" version="3.0" xml:lang="en" unique-identifier="q">
<metadata xmlns:dc="http://purl.org/dc/elements/1.1/">
<dc:title id="title">Minimal EPUB 3.0</dc:title>
<dc:language>en</dc:language>
<dc:identifier id="q">NOID</dc:identifier>
<meta property="dcterms:modified">2017-06-14T00:00:01Z</meta>
</metadata>
<manifest>
<item id="content_001" href="content_001.xhtml" media-type="application/xhtml+xml"/>
<item id="nav" href="nav.xhtml" media-type="application/xhtml+xml" properties="nav"/>
</manifest>
<spine>
<itemref idref="content_001" />
</spine>
</package>
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8" ?>
<container version="1.0" xmlns="urn:oasis:names:tc:opendocument:xmlns:container">
<rootfiles>
<rootfile full-path="EPUB/package.opf" media-type="application/oebps-package+xml"/>
</rootfiles>
</container>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
application/epub+zip
Original file line number Diff line number Diff line change
Expand Up @@ -587,8 +587,14 @@ Feature: EPUB 3 — Package document
And no other errors or warnings are reported

@spec @xref:sec-item-resource-properties
Scenario: Report a scripted document without the `scripted` property declared in the package document
When checking EPUB 'package-manifest-prop-scripted-undeclared-error'
Scenario: Report a scripted document (javascript) without the `scripted` property declared in the package document
When checking EPUB 'package-manifest-prop-scripted-undeclared-javascript-error'
Then error OPF-014 is reported
And no other errors or warnings are reported

@spec @xref:sec-item-resource-properties
Scenario: Report a scripted document (form) without the `scripted` property declared in the package document
When checking EPUB 'package-manifest-prop-scripted-undeclared-form-error'
Then error OPF-014 is reported
And no other errors or warnings are reported

Expand Down