forked from mozilla/gecko-dev
-
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.
Bug 1539759 - Improve DTD entity handling. Testcase. r=Gijs
Differential Revision: https://phabricator.services.mozilla.com/D33778
- Loading branch information
1 parent
af133ec
commit 4fc8956
Showing
4 changed files
with
48 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
<!ENTITY entitywithelement | ||
'<p id="fromdtd">From dtd</p>'> |
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,31 @@ | ||
/* Any copyright is dedicated to the Public Domain. | ||
* https://creativecommons.org/publicdomain/zero/1.0/ */ | ||
|
||
"use strict"; | ||
|
||
/* | ||
* Test for bug 1539759 | ||
* Loads a chrome XML document that has an exteernal DTD file with an entity | ||
* that contains an element, and verifies that that element was not inserted | ||
* into the document (but its content was). | ||
*/ | ||
|
||
add_task(async function test() { | ||
await BrowserTestUtils.withNewTab( | ||
getRootDirectory(gTestPath) + "browser_elementindtd.xml", | ||
async function(newBrowser) { | ||
// NB: We load the chrome:// page in the parent process. | ||
testNoElementFromEntity(newBrowser); | ||
} | ||
); | ||
}); | ||
|
||
function testNoElementFromEntity(newBrowser) { | ||
let doc = newBrowser.contentDocument; | ||
is(doc.body.textContent, "From dtd", "Should load DTD."); | ||
is( | ||
doc.body.firstElementChild, | ||
null, | ||
"Shouldn't have an element inserted from the DTD" | ||
); | ||
} |
10 changes: 10 additions & 0 deletions
10
parser/htmlparser/tests/mochitest/browser_elementindtd.xml
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,10 @@ | ||
<!DOCTYPE html | ||
[ | ||
<!ENTITY % externaldtd SYSTEM "chrome://mochitests/content/browser/parser/htmlparser/tests/mochitest/browser_elementindtd.dtd" > | ||
%externaldtd; | ||
]> | ||
<html xmlns="http://www.w3.org/1999/xhtml"> | ||
<body> | ||
&entitywithelement; | ||
</body> | ||
</html> |