зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1318303 - Mochitest for object node data attribute removal; a=TEST-ONLY
MozReview-Commit-ID: 8yP5c0s6Zwx
This commit is contained in:
Родитель
226dfab8ad
Коммит
7fb38d2806
|
@ -595,6 +595,7 @@ skip-if = toolkit == 'android'
|
|||
[test_bug1307730.html]
|
||||
[test_bug1308069.html]
|
||||
[test_bug1314032.html]
|
||||
[test_bug1318303.html]
|
||||
[test_caretPositionFromPoint.html]
|
||||
[test_change_policy.html]
|
||||
[test_classList.html]
|
||||
|
|
|
@ -0,0 +1,49 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=1318303
|
||||
-->
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Test for Bug 1318303</title>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
<script>
|
||||
var _createIterator = function (root) {
|
||||
return document.createNodeIterator.call(root.ownerDocument || root,
|
||||
root,
|
||||
NodeFilter.SHOW_ELEMENT
|
||||
| NodeFilter.SHOW_COMMENT
|
||||
| NodeFilter.SHOW_TEXT,
|
||||
function () {
|
||||
return NodeFilter.FILTER_ACCEPT;
|
||||
},
|
||||
false
|
||||
);
|
||||
};
|
||||
|
||||
evil = "<body><object data=''><p></p></object></body>";
|
||||
doc = new DOMParser().parseFromString(evil, 'text/html');
|
||||
body = doc.getElementsByTagName("body")[0];
|
||||
nodeIterator = _createIterator(body);
|
||||
try {
|
||||
while ((currentNode = nodeIterator.nextNode())) {
|
||||
currentNode.removeAttribute("data");
|
||||
}
|
||||
ok(true, "Removing data attributes did not throw error");
|
||||
} catch(err) {
|
||||
ok(false, "Removing data attribute threw error!");
|
||||
}
|
||||
obj = doc.getElementsByTagName("object")[0];
|
||||
const objLC = SpecialPowers.Ci.nsIObjectLoadingContent;
|
||||
|
||||
obj instanceof objLC;
|
||||
obj = SpecialPowers.wrap(obj);
|
||||
|
||||
ok(obj.pluginFallbackType == objLC.PLUGIN_ALTERNATE,
|
||||
"expected alternate fallback mode");
|
||||
|
||||
</script>
|
||||
</head>
|
||||
</html>
|
||||
|
Загрузка…
Ссылка в новой задаче