A test for Bug 534178, a=testcase for a blocker
authorOlli Pettay <Olli.Pettay@helsinki.fi>
Mon, 06 Sep 2010 15:36:32 +0300
changeset 52078 e14130b81b5f70ddd7e6ede7cc95af9bcd97e834
parent 52077 eb533d80b036e6c8867816295efce63946dd7568
child 52079 f692ed55fb8af62d9fc34bb2ef40c4fcfdb04a1a
push idunknown
push userunknown
push dateunknown
reviewerstestcase
bugs534178
milestone2.0b6pre
A test for Bug 534178, a=testcase for a blocker
docshell/test/navigation/Makefile.in
docshell/test/navigation/file_bug534178.html
docshell/test/navigation/test_sessionhistory.html
--- a/docshell/test/navigation/Makefile.in
+++ b/docshell/test/navigation/Makefile.in
@@ -73,16 +73,17 @@ include $(topsrcdir)/config/rules.mk
 		file_bug508537_1.html \
 		file_document_write_1.html \
 		file_static_and_dynamic_1.html \
 		frame0.html \
 		frame1.html \
 		frame2.html \
 		frame3.html \
 		goback.html \
+		file_bug534178.html \
 		$(NULL)
 
 ifneq (mobile,$(MOZ_BUILD_APP))
 _BROWSER_TEST_FILES = \
 		browser_bug343515.js \
 		bug343515_pg1.html \
 		bug343515_pg2.html \
 		bug343515_pg3.html \
new file mode 100644
--- /dev/null
+++ b/docshell/test/navigation/file_bug534178.html
@@ -0,0 +1,32 @@
+<html>
+  <head>
+    <script>
+    
+      function testDone() {
+        document.body.removeChild(document.body.firstChild);
+        netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
+        var isOK = false;
+        try {
+          isOK = history.previous != location;
+        } catch(ex) {
+          // history.previous should throw if this is the first page in shistory.
+          isOK = true;
+        }
+        document.body.textContent = isOK ? "PASSED" : "FAILED";
+        opener.ok(isOK, "Duplicate session history transactions should have been removed!");
+        opener.nextTest();
+        window.close();
+      }
+      function ifrload() {
+        setTimeout(testDone, 0);
+      }
+      function test() {
+        var ifr = document.getElementsByTagName("iframe")[0];
+        ifr.onload = ifrload;
+        ifr.src = "data:text/html,doc2";
+      }
+    </script>
+  </head>
+  <body onload="setTimeout(test, 0)"><iframe src="data:text/html,doc1"></iframe>
+  </body>
+</html>
--- a/docshell/test/navigation/test_sessionhistory.html
+++ b/docshell/test/navigation/test_sessionhistory.html
@@ -21,17 +21,18 @@ https://bugzilla.mozilla.org/show_bug.cg
 /** Test for Bug  **/
 
 var testFiles =
   [ "file_bug462076_1.html",         // Dynamic frames before onload
     "file_bug462076_2.html",         // Dynamic frames when handling onload
     "file_bug462076_3.html",         // Dynamic frames after onload
     "file_bug508537_1.html",         // Dynamic frames and forward-back
     "file_document_write_1.html",    // Session history + document.write
-    "file_static_and_dynamic_1.html" // Static and dynamic frames and forward-back
+    "file_static_and_dynamic_1.html",// Static and dynamic frames and forward-back
+    "file_bug534178.html"            // Session history transaction clean-up.
   ];
 var testCount = 0; // Used by the test files.
 
 SimpleTest.waitForExplicitFinish();
 
 var testWindow;
 function nextTest_() {
   if (testFiles.length) {