2009-01-13 11:32:30 -08:00
|
|
|
<?xml version="1.0"?>
|
|
|
|
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
|
|
|
<window title="Mozilla Bug 449780" onload="doTheTest()"
|
|
|
|
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
|
|
|
|
|
|
|
<hbox id="parent">
|
|
|
|
</hbox>
|
|
|
|
|
|
|
|
<!-- test code goes here -->
|
|
|
|
<script type="application/javascript"><![CDATA[
|
2009-02-19 19:04:19 -08:00
|
|
|
var imports = [ "SimpleTest", "is", "isnot", "ok", "onerror" ];
|
2011-01-22 17:46:22 -08:00
|
|
|
for each (var name in imports) {
|
|
|
|
window[name] = window.opener.wrappedJSObject[name];
|
2009-01-13 11:32:30 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
function $(id) {
|
|
|
|
return document.getElementById(id);
|
|
|
|
}
|
|
|
|
|
|
|
|
function addBrowser(parent, id, width, height) {
|
|
|
|
var b =
|
|
|
|
document.createElementNS("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul", "browser");
|
|
|
|
b.setAttribute("type", "content");
|
|
|
|
b.setAttribute("id", id);
|
|
|
|
b.setAttribute("width", width);
|
|
|
|
b.setAttribute("height", height);
|
|
|
|
$(parent).appendChild(b);
|
|
|
|
}
|
|
|
|
addBrowser("parent", "f1", 300, 200);
|
|
|
|
addBrowser("parent", "f2", 300, 200);
|
|
|
|
|
|
|
|
/** Test for Bug 449780 **/
|
|
|
|
var doc1 = "data:text/html,<html><body>This is a test</body></html>";
|
|
|
|
var doc2 = "data:text/html,<html><body>This is a second test</body></html>";
|
|
|
|
|
|
|
|
function getDOM(id) {
|
|
|
|
return $(id).contentDocument.documentElement.innerHTML;
|
|
|
|
}
|
|
|
|
|
|
|
|
var tester = (function() {
|
|
|
|
var origDOM = getDOM("f1");
|
|
|
|
$("f1").contentDocument.body.textContent = "Modified";
|
|
|
|
var modifiedDOM = getDOM("f1");
|
|
|
|
isnot(origDOM, modifiedDOM, "DOM should be different");
|
|
|
|
$("f1").contentWindow.location.href = doc2;
|
|
|
|
yield;
|
|
|
|
|
|
|
|
$("f1").goBack();
|
|
|
|
yield;
|
|
|
|
|
|
|
|
is(getDOM("f1"), modifiedDOM, "Should have been bfcached");
|
|
|
|
$("f1").goForward();
|
|
|
|
yield;
|
|
|
|
|
|
|
|
// Ignore the notifications during swap
|
|
|
|
$("f1").removeEventListener("pageshow", testDriver, false);
|
|
|
|
$("f1").swapDocShells($("f2"));
|
|
|
|
$("f2").addEventListener("pageshow", testDriver, false);
|
|
|
|
$("f2").goBack();
|
|
|
|
yield;
|
|
|
|
|
|
|
|
is(getDOM("f2"), origDOM, "Should have not have been bfcached");
|
|
|
|
window.close();
|
|
|
|
SimpleTest.finish();
|
|
|
|
yield;
|
|
|
|
})();
|
|
|
|
|
|
|
|
function testDriver() {
|
|
|
|
setTimeout(function() { tester.next() }, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
function doTheTest() {
|
|
|
|
$("f1").addEventListener("pageshow", testDriver, false);
|
|
|
|
$("f1").setAttribute("src", doc1);
|
|
|
|
}
|
|
|
|
]]></script>
|
|
|
|
</window>
|