gecko/dom/tests/mochitest/bugs/test_bug396843.html
Boris Zbarsky 788803a0af Bug 660233 part 1. Fix tests that assume UniversalXPConnect in otherwise-untrusted pages will get one nodePrincipal, documentURIObject, baseURIObject properties. r=mrbkap
--HG--
rename : dom/tests/mochitest/bugs/test_bug396843.html => dom/tests/browser/browser_bug396843.js
2011-09-23 01:03:50 -04:00

243 lines
6.4 KiB
HTML

<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=396843
-->
<head>
<title>Test for Bug 396843</title>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=396843">Mozilla Bug 396843</a>
<p id="display">
<iframe src="http://example.org:80/" id="t"></iframe>
</p>
<div id="content" style="display: none">
</div>
<pre id="test">
<script class="testbody" type="text/javascript">
/** Test for Bug 396843 **/
SimpleTest.waitForExplicitFinish();
var allNodes = [];
var XMLNodes = [];
// HTML
function HTML_TAG(name) {
allNodes.push(document.createElement(name));
}
/* List copy/pasted from nsHTMLTagList.h */
HTML_TAG("a", "Anchor")
HTML_TAG("abbr", "Span")
HTML_TAG("acronym", "Span")
HTML_TAG("address", "Span")
HTML_TAG("applet", "SharedObject")
HTML_TAG("area", "Area")
HTML_TAG("b", "Span")
HTML_TAG("base", "Shared")
HTML_TAG("basefont", "Span")
HTML_TAG("bdo", "Span")
HTML_TAG("bgsound", "Span")
HTML_TAG("big", "Span")
HTML_TAG("blink", "Span")
HTML_TAG("blockquote", "Shared")
HTML_TAG("body", "Body")
HTML_TAG("br", "BR")
HTML_TAG("button", "Button")
HTML_TAG("canvas", "Canvas")
HTML_TAG("caption", "TableCaption")
HTML_TAG("center", "Span")
HTML_TAG("cite", "Span")
HTML_TAG("code", "Span")
HTML_TAG("col", "TableCol")
HTML_TAG("colgroup", "TableCol")
HTML_TAG("dd", "Span")
HTML_TAG("del", "Mod")
HTML_TAG("dfn", "Span")
HTML_TAG("dir", "Shared")
HTML_TAG("div", "Div")
HTML_TAG("dl", "SharedList")
HTML_TAG("dt", "Span")
HTML_TAG("em", "Span")
HTML_TAG("embed", "SharedObject")
HTML_TAG("fieldset", "FieldSet")
HTML_TAG("font", "Font")
HTML_TAG("form", "Form")
HTML_TAG("frame", "Frame")
HTML_TAG("frameset", "FrameSet")
HTML_TAG("h1", "Heading")
HTML_TAG("h2", "Heading")
HTML_TAG("h3", "Heading")
HTML_TAG("h4", "Heading")
HTML_TAG("h5", "Heading")
HTML_TAG("h6", "Heading")
HTML_TAG("head", "Head")
HTML_TAG("hr", "HR")
HTML_TAG("html", "Html")
HTML_TAG("i", "Span")
HTML_TAG("iframe", "IFrame")
HTML_TAG("image", "Span")
HTML_TAG("img", "Image")
HTML_TAG("input", "Input")
HTML_TAG("ins", "Mod")
HTML_TAG("isindex", "Shared")
HTML_TAG("kbd", "Span")
HTML_TAG("keygen", "Span")
HTML_TAG("label", "Label")
HTML_TAG("legend", "Legend")
HTML_TAG("li", "LI")
HTML_TAG("link", "Link")
HTML_TAG("listing", "Span")
HTML_TAG("map", "Map")
HTML_TAG("marquee", "Div")
HTML_TAG("menu", "Shared")
HTML_TAG("meta", "Meta")
HTML_TAG("multicol", "Span")
HTML_TAG("nobr", "Span")
HTML_TAG("noembed", "Div")
HTML_TAG("noframes", "Div")
HTML_TAG("noscript", "Div")
HTML_TAG("object", "Object")
HTML_TAG("ol", "SharedList")
HTML_TAG("optgroup", "OptGroup")
HTML_TAG("option", "Option")
HTML_TAG("p", "Paragraph")
HTML_TAG("param", "Shared")
HTML_TAG("plaintext", "Span")
HTML_TAG("pre", "Pre")
HTML_TAG("q", "Shared")
HTML_TAG("s", "Span")
HTML_TAG("samp", "Span")
HTML_TAG("script", "Script")
HTML_TAG("select", "Select")
HTML_TAG("small", "Span")
HTML_TAG("spacer", "Shared")
HTML_TAG("span", "Span")
HTML_TAG("strike", "Span")
HTML_TAG("strong", "Span")
HTML_TAG("style", "Style")
HTML_TAG("sub", "Span")
HTML_TAG("sup", "Span")
HTML_TAG("table", "Table")
HTML_TAG("tbody", "TableSection")
HTML_TAG("td", "TableCell")
HTML_TAG("textarea", "TextArea")
HTML_TAG("tfoot", "TableSection")
HTML_TAG("th", "TableCell")
HTML_TAG("thead", "TableSection")
HTML_TAG("title", "Title")
HTML_TAG("tr", "TableRow")
HTML_TAG("tt", "Span")
HTML_TAG("u", "Span")
HTML_TAG("ul", "SharedList")
HTML_TAG("var", "Span")
HTML_TAG("wbr", "Shared")
HTML_TAG("xmp", "Span")
function SVG_TAG(name) {
allNodes.push(document.createElementNS("http://www.w3.org/2000/svg", name));
}
// List sorta stolen from SVG element factory.
SVG_TAG("a")
SVG_TAG("polyline")
SVG_TAG("polygon")
SVG_TAG("circle")
SVG_TAG("ellipse")
SVG_TAG("line")
SVG_TAG("rect")
SVG_TAG("svg")
SVG_TAG("g")
SVG_TAG("foreignObject")
SVG_TAG("path")
SVG_TAG("text")
SVG_TAG("tspan")
SVG_TAG("image")
SVG_TAG("style")
SVG_TAG("linearGradient")
SVG_TAG("metadata")
SVG_TAG("radialGradient")
SVG_TAG("stop")
SVG_TAG("defs")
SVG_TAG("desc")
SVG_TAG("script")
SVG_TAG("use")
SVG_TAG("symbol")
SVG_TAG("marker")
SVG_TAG("title")
SVG_TAG("clipPath")
SVG_TAG("textPath")
SVG_TAG("filter")
SVG_TAG("feBlend")
SVG_TAG("feColorMatrix")
SVG_TAG("feComponentTransfer")
SVG_TAG("feComposite")
SVG_TAG("feFuncR")
SVG_TAG("feFuncG")
SVG_TAG("feFuncB")
SVG_TAG("feFuncA")
SVG_TAG("feGaussianBlur")
SVG_TAG("feMerge")
SVG_TAG("feMergeNode")
SVG_TAG("feMorphology")
SVG_TAG("feOffset")
SVG_TAG("feFlood")
SVG_TAG("feTile")
SVG_TAG("feTurbulence")
SVG_TAG("feConvolveMatrix")
SVG_TAG("feDistantLight")
SVG_TAG("fePointLight")
SVG_TAG("feSpotLight")
SVG_TAG("feDiffuseLighting")
SVG_TAG("feSpecularLighting")
SVG_TAG("feDisplacementMap")
SVG_TAG("feImage")
SVG_TAG("pattern")
SVG_TAG("mask")
SVG_TAG("svgSwitch")
// Toss in some other namespaced stuff too, for good measure
allNodes.push(document.createElementNS(
"http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul",
"window"));
allNodes.push(document.createElementNS("http://www.w3.org/1998/Math/MathML",
"math"));
allNodes.push(document.createElementNS("http://www.w3.org/2001/xml-events",
"testname"));
allNodes.push(document.createElementNS("bogus.namespace", "testname"));
var XMLDoc = document.implementation.createDocument("", "", null);
// And non-elements
allNodes.push(document.createTextNode("some text"));
allNodes.push(document.createComment("some text"));
allNodes.push(document.createDocumentFragment());
XMLNodes.push(XMLDoc.createCDATASection("some text"));
XMLNodes.push(XMLDoc.createProcessingInstruction("PI", "data"));
function runTest() {
ok(document.nodePrincipal === undefined, "Must not have document principal");
ok(document.baseURIObject === undefined, "Must not have document base URI");
ok(document.documentURIObject === undefined, "Must have document URI");
for (var i = 0; i < allNodes.length; ++i) {
ok(allNodes[i].nodePrincipal === undefined,
"Unexpected principal appears for " + allNodes[i].nodeName);
ok(allNodes[i].baseURIObject === undefined,
"Unexpected base URI appears for " + allNodes[i].nodeName);
}
}
addLoadEvent(runTest);
addLoadEvent(SimpleTest.finish);
</script>
</pre>
</body>
</html>