Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | <?xml version="1.0"?> |
michael@0 | 2 | <?xml-stylesheet type="text/css" href="chrome://global/skin"?> |
michael@0 | 3 | <?xml-stylesheet type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"?> |
michael@0 | 4 | <!-- |
michael@0 | 5 | https://bugzilla.mozilla.org/show_bug.cgi?id=683852 |
michael@0 | 6 | --> |
michael@0 | 7 | <window title="Mozilla Bug 683852" |
michael@0 | 8 | xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> |
michael@0 | 9 | <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/> |
michael@0 | 10 | <button value="testbutton" id="testbutton"/> |
michael@0 | 11 | <!-- test results are displayed in the html:body --> |
michael@0 | 12 | <body xmlns="http://www.w3.org/1999/xhtml"> |
michael@0 | 13 | <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=683852" |
michael@0 | 14 | target="_blank" id="link">Mozilla Bug 683852</a> |
michael@0 | 15 | </body> |
michael@0 | 16 | |
michael@0 | 17 | <!-- test code goes here --> |
michael@0 | 18 | <script type="application/javascript"> |
michael@0 | 19 | <![CDATA[ |
michael@0 | 20 | /** Test for Bug 683852 **/ |
michael@0 | 21 | SimpleTest.waitForExplicitFinish(); |
michael@0 | 22 | |
michael@0 | 23 | function startTest() { |
michael@0 | 24 | is(document.contains(document), true, "Document should contain itself!"); |
michael@0 | 25 | |
michael@0 | 26 | var tb = document.getElementById("testbutton"); |
michael@0 | 27 | is(document.contains(tb), true, "Document should contain element in it!"); |
michael@0 | 28 | is(tb.contains(tb), true, "Element should contain itself.") |
michael@0 | 29 | var anon = document.getAnonymousElementByAttribute(tb, "anonid", "button-box"); |
michael@0 | 30 | is(document.contains(anon), false, "Document should not contain anonymous element in it!"); |
michael@0 | 31 | is(tb.contains(anon), false, "Element should not contain anonymous element in it!"); |
michael@0 | 32 | is(anon.contains(anon), true, "Anonymous element should contain itself.") |
michael@0 | 33 | is(document.documentElement.contains(tb), true, "Element should contain element in it!"); |
michael@0 | 34 | is(document.contains(document.createElement("foo")), false, "Document shouldn't contain element which is't in the document"); |
michael@0 | 35 | is(document.contains(document.createTextNode("foo")), false, "Document shouldn't contain text node which is't in the document"); |
michael@0 | 36 | |
michael@0 | 37 | var link = document.getElementById("link"); |
michael@0 | 38 | is(document.contains(link.firstChild), true, |
michael@0 | 39 | "Document should contain a text node in it."); |
michael@0 | 40 | is(link.contains(link.firstChild), true, |
michael@0 | 41 | "Element should contain a text node in it."); |
michael@0 | 42 | is(link.firstChild.contains(link), false, "text node shouldn't contain its parent."); |
michael@0 | 43 | |
michael@0 | 44 | is(document.contains(null), false, "Document shouldn't contain null."); |
michael@0 | 45 | |
michael@0 | 46 | var pi = document.createProcessingInstruction("adf", "asd"); |
michael@0 | 47 | is(pi.contains(document), false, "Processing instruction shouldn't contain document"); |
michael@0 | 48 | document.documentElement.appendChild(pi); |
michael@0 | 49 | document.contains(pi, true, "Document should contain processing instruction"); |
michael@0 | 50 | |
michael@0 | 51 | var df = document.createRange().createContextualFragment("<div>foo</div>"); |
michael@0 | 52 | is(df.contains(df.firstChild), true, "Document fragment should contain its child"); |
michael@0 | 53 | is(df.contains(df.firstChild.firstChild), true, |
michael@0 | 54 | "Document fragment should contain its descendant"); |
michael@0 | 55 | is(df.contains(df), true, "Document fragment should contain itself."); |
michael@0 | 56 | |
michael@0 | 57 | var d = document.implementation.createHTMLDocument(""); |
michael@0 | 58 | is(document.contains(d), false, |
michael@0 | 59 | "Document shouldn't contain another document."); |
michael@0 | 60 | is(document.contains(d.createElement("div")), false, |
michael@0 | 61 | "Document shouldn't contain an element from another document."); |
michael@0 | 62 | |
michael@0 | 63 | SimpleTest.finish(); |
michael@0 | 64 | } |
michael@0 | 65 | |
michael@0 | 66 | addLoadEvent(startTest); |
michael@0 | 67 | ]]> |
michael@0 | 68 | </script> |
michael@0 | 69 | </window> |