forked from LadybirdBrowser/ladybird
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
LibWeb: Disallow editing API calls on non-HTML documents
This is not directly mentioned in the Editing API spec, but all major browsers do this and there is a WPT for this behavior.
- Loading branch information
Showing
7 changed files
with
97 additions
and
8 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,5 +3,4 @@ DIV 0 - DIV 0 | |
BODY 0 - BODY 5 | ||
true | ||
false | ||
false | ||
Did not crash! |
6 changes: 6 additions & 0 deletions
6
Tests/LibWeb/Text/expected/wpt-import/editing/other/non-html-document.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,6 @@ | ||
Harness status: OK | ||
|
||
Found 1 tests | ||
|
||
1 Pass | ||
Pass editing APIs on an XML document should be disabled |
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
24 changes: 24 additions & 0 deletions
24
Tests/LibWeb/Text/input/wpt-import/editing/other/non-html-document.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,24 @@ | ||
<!doctype html> | ||
<meta charset=utf-8> | ||
<title>Non-HTML document tests</title> | ||
<script src=../../resources/testharness.js></script> | ||
<script src=../../resources/testharnessreport.js></script> | ||
<script> | ||
|
||
test(function() { | ||
let xmldoc = | ||
document.implementation.createDocument("http://www.w3.org/1999/xlink", | ||
"html", null); | ||
for (let f of [ | ||
() => xmldoc.execCommand("bold"), | ||
() => xmldoc.queryCommandEnabled("bold"), | ||
() => xmldoc.queryCommandIndeterm("bold"), | ||
() => xmldoc.queryCommandState("bold"), | ||
() => xmldoc.queryCommandSupported("bold"), | ||
() => xmldoc.queryCommandValue("bold"), | ||
]) { | ||
assert_throws_dom("InvalidStateError", f); | ||
} | ||
}, "editing APIs on an XML document should be disabled"); | ||
|
||
</script> |