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 href="chrome://global/skin" type="text/css"?> |
michael@0 | 3 | <window title="Mozilla Bug 449780" onload="doTheTest()" |
michael@0 | 4 | xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> |
michael@0 | 5 | |
michael@0 | 6 | <hbox id="parent"> |
michael@0 | 7 | </hbox> |
michael@0 | 8 | |
michael@0 | 9 | <!-- test code goes here --> |
michael@0 | 10 | <script type="application/javascript"><![CDATA[ |
michael@0 | 11 | var imports = [ "SimpleTest", "is", "isnot", "ok", "onerror" ]; |
michael@0 | 12 | for each (var name in imports) { |
michael@0 | 13 | window[name] = window.opener.wrappedJSObject[name]; |
michael@0 | 14 | } |
michael@0 | 15 | |
michael@0 | 16 | function $(id) { |
michael@0 | 17 | return document.getElementById(id); |
michael@0 | 18 | } |
michael@0 | 19 | |
michael@0 | 20 | function addBrowser(parent, id, width, height) { |
michael@0 | 21 | var b = |
michael@0 | 22 | document.createElementNS("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul", "browser"); |
michael@0 | 23 | b.setAttribute("type", "content"); |
michael@0 | 24 | b.setAttribute("id", id); |
michael@0 | 25 | b.setAttribute("width", width); |
michael@0 | 26 | b.setAttribute("height", height); |
michael@0 | 27 | $(parent).appendChild(b); |
michael@0 | 28 | } |
michael@0 | 29 | addBrowser("parent", "f1", 300, 200); |
michael@0 | 30 | addBrowser("parent", "f2", 300, 200); |
michael@0 | 31 | |
michael@0 | 32 | /** Test for Bug 449780 **/ |
michael@0 | 33 | var doc1 = "data:text/html,<html><body>This is a test</body></html>"; |
michael@0 | 34 | var doc2 = "data:text/html,<html><body>This is a second test</body></html>"; |
michael@0 | 35 | |
michael@0 | 36 | function getDOM(id) { |
michael@0 | 37 | return $(id).contentDocument.documentElement.innerHTML; |
michael@0 | 38 | } |
michael@0 | 39 | |
michael@0 | 40 | var tester = (function() { |
michael@0 | 41 | var origDOM = getDOM("f1"); |
michael@0 | 42 | $("f1").contentDocument.body.textContent = "Modified"; |
michael@0 | 43 | var modifiedDOM = getDOM("f1"); |
michael@0 | 44 | isnot(origDOM, modifiedDOM, "DOM should be different"); |
michael@0 | 45 | $("f1").contentWindow.location.href = doc2; |
michael@0 | 46 | yield undefined; |
michael@0 | 47 | |
michael@0 | 48 | $("f1").goBack(); |
michael@0 | 49 | yield undefined; |
michael@0 | 50 | |
michael@0 | 51 | is(getDOM("f1"), modifiedDOM, "Should have been bfcached"); |
michael@0 | 52 | $("f1").goForward(); |
michael@0 | 53 | yield undefined; |
michael@0 | 54 | |
michael@0 | 55 | // Ignore the notifications during swap |
michael@0 | 56 | $("f1").removeEventListener("pageshow", testDriver, false); |
michael@0 | 57 | $("f1").swapDocShells($("f2")); |
michael@0 | 58 | $("f2").addEventListener("pageshow", testDriver, false); |
michael@0 | 59 | $("f2").goBack(); |
michael@0 | 60 | yield undefined; |
michael@0 | 61 | |
michael@0 | 62 | is(getDOM("f2"), origDOM, "Should have not have been bfcached"); |
michael@0 | 63 | window.close(); |
michael@0 | 64 | SimpleTest.finish(); |
michael@0 | 65 | yield undefined; |
michael@0 | 66 | })(); |
michael@0 | 67 | |
michael@0 | 68 | function testDriver() { |
michael@0 | 69 | setTimeout(function() { tester.next() }, 0); |
michael@0 | 70 | } |
michael@0 | 71 | |
michael@0 | 72 | function doTheTest() { |
michael@0 | 73 | $("f1").addEventListener("pageshow", testDriver, false); |
michael@0 | 74 | $("f1").setAttribute("src", doc1); |
michael@0 | 75 | } |
michael@0 | 76 | ]]></script> |
michael@0 | 77 | </window> |