2 <?xml-stylesheet href=
"chrome://global/skin" type=
"text/css"?>
3 <window title=
"Mozilla Bug 449780" onload=
"doTheTest()"
4 xmlns=
"http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
9 <!-- test code goes here -->
10 <script type=
"application/javascript"><![CDATA[
11 var imports = [
"SimpleTest",
"is",
"isnot",
"ok",
"onerror" ];
12 for each (var name in imports) {
13 window[name] = window.opener.wrappedJSObject[name];
17 return document.getElementById(id);
20 function addBrowser(parent, id, width, height) {
22 document.createElementNS(
"http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul",
"browser");
23 b.setAttribute(
"type",
"content");
24 b.setAttribute(
"id", id);
25 b.setAttribute(
"width", width);
26 b.setAttribute(
"height", height);
27 $(parent).appendChild(b);
29 addBrowser(
"parent",
"f1",
300,
200);
30 addBrowser(
"parent",
"f2",
300,
200);
32 /** Test for Bug
449780 **/
33 var doc1 =
"data:text/html,<html><body>This is a test</body></html>";
34 var doc2 =
"data:text/html,<html><body>This is a second test</body></html>";
37 return $(id).contentDocument.documentElement.innerHTML;
40 var tester = (function() {
41 var origDOM = getDOM(
"f1");
42 $(
"f1").contentDocument.body.textContent =
"Modified";
43 var modifiedDOM = getDOM(
"f1");
44 isnot(origDOM, modifiedDOM,
"DOM should be different");
45 $(
"f1").contentWindow.location.href = doc2;
51 is(getDOM(
"f1"), modifiedDOM,
"Should have been bfcached");
55 // Ignore the notifications during swap
56 $(
"f1").removeEventListener(
"pageshow", testDriver, false);
57 $(
"f1").swapDocShells($(
"f2"));
58 $(
"f2").addEventListener(
"pageshow", testDriver, false);
62 is(getDOM(
"f2"), origDOM,
"Should have not have been bfcached");
68 function testDriver() {
69 setTimeout(function() { tester.next() },
0);
72 function doTheTest() {
73 $(
"f1").addEventListener(
"pageshow", testDriver, false);
74 $(
"f1").setAttribute(
"src", doc1);