зеркало из https://github.com/mozilla/gecko-dev.git
46 строки
1.4 KiB
HTML
46 строки
1.4 KiB
HTML
<!DOCTYPE HTML>
|
|
<html>
|
|
<!--
|
|
https://bugzilla.mozilla.org/show_bug.cgi?id=467035
|
|
-->
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<title>Test for Bug 467035</title>
|
|
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
|
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
|
<script type="application/javascript">
|
|
|
|
/** Test for Bug 467035 **/
|
|
SimpleTest.waitForExplicitFinish();
|
|
addLoadEvent(() => {
|
|
const s = `<!DOCTYPE html SYSTEM \"chrome://branding/locale/brand.dtd\">
|
|
<html xmlns=\"http://www.w3.org/1999/xhtml\">
|
|
<head>
|
|
<meta charset=\"utf-8\"/>
|
|
<title>&brandShortName;</title>
|
|
</head>
|
|
</html>`;
|
|
|
|
const parser = new DOMParser();
|
|
let doc = parser.parseFromString(s, 'application/xhtml+xml');
|
|
is(doc.getElementsByTagName('parsererror').length, 1, 'parseFromString cannot access locale DTD');
|
|
|
|
SpecialPowers.wrap(parser).forceEnableDTD();
|
|
doc = parser.parseFromString(s, 'application/xhtml+xml');
|
|
const isTitleLocalized = doc.getElementsByTagName('parsererror').length === 0 &&
|
|
typeof doc.title === 'string' &&
|
|
!!doc.title;
|
|
ok(isTitleLocalized, 'parseFromString can access locale DTD with forceEnableDTD');
|
|
|
|
SimpleTest.finish();
|
|
});
|
|
</script>
|
|
</head>
|
|
<body>
|
|
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=467035">Mozilla Bug 467035</a>
|
|
<p id="display"></p>
|
|
<pre id="test">
|
|
</pre>
|
|
</body>
|
|
</html>
|