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 | <!DOCTYPE HTML> |
michael@0 | 2 | <html> |
michael@0 | 3 | <!-- |
michael@0 | 4 | https://bugzilla.mozilla.org/show_bug.cgi?id=92264 |
michael@0 | 5 | --> |
michael@0 | 6 | <head> |
michael@0 | 7 | <title>Test for Bug 92264</title> |
michael@0 | 8 | <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> |
michael@0 | 9 | <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> |
michael@0 | 10 | </head> |
michael@0 | 11 | <body onload="runTest();"> |
michael@0 | 12 | <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=92264">Mozilla Bug 92264</a> |
michael@0 | 13 | <p id="display"></p> |
michael@0 | 14 | <div id="content" style="display: none"> |
michael@0 | 15 | <div id="wrap"><dl></dl><p id="thep">foo<span>bar</span></p><ol></ol></div> |
michael@0 | 16 | <table id="thetable"><tbody><tr><td>1</td></tr><tr id="thetr"><td>2</td></tr><tr><td>3</td></tr></tbody></table> |
michael@0 | 17 | <iframe></iframe> |
michael@0 | 18 | <div id="fragmentwrap"></div> |
michael@0 | 19 | </div> |
michael@0 | 20 | <pre id="test"> |
michael@0 | 21 | <script type="application/javascript"> |
michael@0 | 22 | |
michael@0 | 23 | /** Test for Bug 92264 **/ |
michael@0 | 24 | |
michael@0 | 25 | SimpleTest.waitForExplicitFinish(); |
michael@0 | 26 | |
michael@0 | 27 | function runTest() { |
michael@0 | 28 | |
michael@0 | 29 | var thep = document.getElementById("thep"); |
michael@0 | 30 | var wrap = document.getElementById("wrap"); |
michael@0 | 31 | is(thep.outerHTML, '<p id="thep">foo<span>bar</span></p>', "Unexpected thep outerHTML"); |
michael@0 | 32 | thep.outerHTML = "<ul></ul><tr></tr><p></p>"; |
michael@0 | 33 | is(wrap.innerHTML, "<dl></dl><ul></ul><p></p><ol></ol>", "Bad outerHTML parsing inside wrap"); |
michael@0 | 34 | |
michael@0 | 35 | var thetr = document.getElementById("thetr"); |
michael@0 | 36 | thetr.outerHTML = "<tr><td>a</td></tr><div></div><tr><td>b</td></tr>"; |
michael@0 | 37 | var thetable = document.getElementById("thetable"); |
michael@0 | 38 | is(thetable.innerHTML, "<tbody><tr><td>1</td></tr><tr><td>a</td></tr><div></div><tr><td>b</td></tr><tr><td>3</td></tr></tbody>", "Wrong outerHTML parsing inside table"); |
michael@0 | 39 | |
michael@0 | 40 | var iframe = document.getElementsByTagName("iframe")[0]; |
michael@0 | 41 | var oldbody = iframe.contentDocument.body; |
michael@0 | 42 | iframe.contentDocument.body.outerHTML = "<body></body>"; |
michael@0 | 43 | isnot(oldbody, iframe.contentDocument.body, "Failed to replace body"); |
michael@0 | 44 | is(iframe.contentDocument.getElementsByTagName("body").length, 1, "Should have gotten one body"); |
michael@0 | 45 | // Yes, two heads per spec. Also Ragnarök and Chrome produce two heads. |
michael@0 | 46 | is(iframe.contentDocument.getElementsByTagName("head").length, 2, "Should have gotten two heads"); |
michael@0 | 47 | |
michael@0 | 48 | try { |
michael@0 | 49 | document.documentElement.outerHTML = "<html></html>"; |
michael@0 | 50 | ok(false, "Should have thrown an exception"); |
michael@0 | 51 | } catch(e) { |
michael@0 | 52 | is(e.name, "NoModificationAllowedError", "outerHTML should throw NoModificationAllowedError"); |
michael@0 | 53 | is(e.code, 7, "outerHTML should throw NO_MODIFICATION_ALLOWED_ERR"); |
michael@0 | 54 | } |
michael@0 | 55 | |
michael@0 | 56 | var f = document.createDocumentFragment(); |
michael@0 | 57 | var dl = document.createElement("dl"); |
michael@0 | 58 | var p = document.createElement("p"); |
michael@0 | 59 | var ol = document.createElement("ol"); |
michael@0 | 60 | f.appendChild(dl); |
michael@0 | 61 | f.appendChild(p); |
michael@0 | 62 | f.appendChild(ol); |
michael@0 | 63 | p.outerHTML = "<ul></ul><tr></tr><body></body><p></p>"; |
michael@0 | 64 | var fragmentwrap = document.getElementById("fragmentwrap"); |
michael@0 | 65 | fragmentwrap.appendChild(f); |
michael@0 | 66 | is(fragmentwrap.innerHTML, "<dl></dl><ul></ul><p></p><ol></ol>", "Bad outerHTML parsing in fragment"); |
michael@0 | 67 | |
michael@0 | 68 | SimpleTest.finish(); |
michael@0 | 69 | } |
michael@0 | 70 | |
michael@0 | 71 | </script> |
michael@0 | 72 | </pre> |
michael@0 | 73 | </body> |
michael@0 | 74 | </html> |