-
-
Notifications
You must be signed in to change notification settings - Fork 971
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
LibWeb: Reject invalid processing instructions
- Loading branch information
1 parent
80d9949
commit f88f41c
Showing
6 changed files
with
115 additions
and
2 deletions.
There are no files selected for viewing
22 changes: 22 additions & 0 deletions
22
.../LibWeb/Text/expected/wpt-import/dom/nodes/Document-createProcessingInstruction-xhtml.txt
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,22 @@ | ||
Summary | ||
|
||
Harness status: OK | ||
|
||
Rerun | ||
|
||
Found 12 tests | ||
|
||
12 Pass | ||
Details | ||
Result Test Name MessagePass Document.createProcessingInstruction in XML documents | ||
Pass Should throw an INVALID_CHARACTER_ERR for target "A" and data "?>". | ||
Pass Should throw an INVALID_CHARACTER_ERR for target "·A" and data "x". | ||
Pass Should throw an INVALID_CHARACTER_ERR for target "×A" and data "x". | ||
Pass Should throw an INVALID_CHARACTER_ERR for target "A×" and data "x". | ||
Pass Should throw an INVALID_CHARACTER_ERR for target "\\A" and data "x". | ||
Pass Should throw an INVALID_CHARACTER_ERR for target "\f" and data "x". | ||
Pass Should throw an INVALID_CHARACTER_ERR for target 0 and data "x". | ||
Pass Should throw an INVALID_CHARACTER_ERR for target "0" and data "x". | ||
Pass Should get a ProcessingInstruction for target "xml:fail" and data "x". | ||
Pass Should get a ProcessingInstruction for target "A·A" and data "x". | ||
Pass Should get a ProcessingInstruction for target "a0" and data "x". |
22 changes: 22 additions & 0 deletions
22
Tests/LibWeb/Text/expected/wpt-import/dom/nodes/Document-createProcessingInstruction.txt
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,22 @@ | ||
Summary | ||
|
||
Harness status: OK | ||
|
||
Rerun | ||
|
||
Found 12 tests | ||
|
||
12 Pass | ||
Details | ||
Result Test Name MessagePass Document.createProcessingInstruction in HTML documents | ||
Pass Should throw an INVALID_CHARACTER_ERR for target "A" and data "?>". | ||
Pass Should throw an INVALID_CHARACTER_ERR for target "·A" and data "x". | ||
Pass Should throw an INVALID_CHARACTER_ERR for target "×A" and data "x". | ||
Pass Should throw an INVALID_CHARACTER_ERR for target "A×" and data "x". | ||
Pass Should throw an INVALID_CHARACTER_ERR for target "\\A" and data "x". | ||
Pass Should throw an INVALID_CHARACTER_ERR for target "\f" and data "x". | ||
Pass Should throw an INVALID_CHARACTER_ERR for target 0 and data "x". | ||
Pass Should throw an INVALID_CHARACTER_ERR for target "0" and data "x". | ||
Pass Should get a ProcessingInstruction for target "xml:fail" and data "x". | ||
Pass Should get a ProcessingInstruction for target "A·A" and data "x". | ||
Pass Should get a ProcessingInstruction for target "a0" and data "x". |
15 changes: 15 additions & 0 deletions
15
...s/LibWeb/Text/input/wpt-import/dom/nodes/Document-createProcessingInstruction-xhtml.xhtml
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,15 @@ | ||
<html xmlns="http://www.w3.org/1999/xhtml"> | ||
<head> | ||
<title>Document.createProcessingInstruction in XML documents</title> | ||
<link rel="help" href="https://dom.spec.whatwg.org/#dom-document-createprocessinginstruction"/> | ||
<link rel="help" href="https://dom.spec.whatwg.org/#dom-processinginstruction-target"/> | ||
<link rel="help" href="https://dom.spec.whatwg.org/#dom-characterdata-data"/> | ||
<link rel="help" href="https://dom.spec.whatwg.org/#dom-node-ownerdocument"/> | ||
<script src="../../resources/testharness.js"></script> | ||
<script src="../../resources/testharnessreport.js"></script> | ||
</head> | ||
<body> | ||
<div id="log"/> | ||
<script src="Document-createProcessingInstruction.js"/> | ||
</body> | ||
</html> |
11 changes: 11 additions & 0 deletions
11
Tests/LibWeb/Text/input/wpt-import/dom/nodes/Document-createProcessingInstruction.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,11 @@ | ||
<!DOCTYPE html> | ||
<meta charset=utf-8> | ||
<title>Document.createProcessingInstruction in HTML documents</title> | ||
<link rel=help href="https://dom.spec.whatwg.org/#dom-document-createprocessinginstruction"> | ||
<link rel=help href="https://dom.spec.whatwg.org/#dom-processinginstruction-target"> | ||
<link rel=help href="https://dom.spec.whatwg.org/#dom-characterdata-data"> | ||
<link rel=help href="https://dom.spec.whatwg.org/#dom-node-ownerdocument"> | ||
<script src="../../resources/testharness.js"></script> | ||
<script src="../../resources/testharnessreport.js"></script> | ||
<div id=log></div> | ||
<script src="Document-createProcessingInstruction.js"></script> |
39 changes: 39 additions & 0 deletions
39
Tests/LibWeb/Text/input/wpt-import/dom/nodes/Document-createProcessingInstruction.js
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,39 @@ | ||
test(function() { | ||
var invalid = [ | ||
["A", "?>"], | ||
["\u00B7A", "x"], | ||
["\u00D7A", "x"], | ||
["A\u00D7", "x"], | ||
["\\A", "x"], | ||
["\f", "x"], | ||
[0, "x"], | ||
["0", "x"] | ||
], | ||
valid = [ | ||
["xml:fail", "x"], | ||
["A\u00B7A", "x"], | ||
["a0", "x"] | ||
] | ||
|
||
for (var i = 0, il = invalid.length; i < il; i++) { | ||
test(function() { | ||
assert_throws_dom("INVALID_CHARACTER_ERR", function() { | ||
document.createProcessingInstruction(invalid[i][0], invalid[i][1]) | ||
}) | ||
}, "Should throw an INVALID_CHARACTER_ERR for target " + | ||
format_value(invalid[i][0]) + " and data " + | ||
format_value(invalid[i][1]) + ".") | ||
} | ||
for (var i = 0, il = valid.length; i < il; ++i) { | ||
test(function() { | ||
var pi = document.createProcessingInstruction(valid[i][0], valid[i][1]); | ||
assert_equals(pi.target, valid[i][0]); | ||
assert_equals(pi.data, valid[i][1]); | ||
assert_equals(pi.ownerDocument, document); | ||
assert_true(pi instanceof ProcessingInstruction); | ||
assert_true(pi instanceof Node); | ||
}, "Should get a ProcessingInstruction for target " + | ||
format_value(valid[i][0]) + " and data " + | ||
format_value(valid[i][1]) + ".") | ||
} | ||
}) |
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