2008-02-06 10:18:07 -08:00
|
|
|
<!DOCTYPE HTML>
|
|
|
|
<html>
|
|
|
|
<!--
|
|
|
|
https://bugzilla.mozilla.org/show_bug.cgi?id=94514
|
|
|
|
Specifically, this tests that a page that is obtained via a post request does
|
|
|
|
not get added to global history.
|
|
|
|
-->
|
|
|
|
<head>
|
|
|
|
<title>Test for Bug 94515</title>
|
2009-05-06 13:46:04 -07:00
|
|
|
<script type="text/javascript" src="/MochiKit/packed.js"></script>
|
2008-02-06 10:18:07 -08:00
|
|
|
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
|
|
|
|
|
|
|
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=94514">Mozilla Bug 94514</a>
|
|
|
|
|
|
|
|
<div id="content" style="display: none">
|
|
|
|
|
|
|
|
</div>
|
|
|
|
<pre id="test">
|
|
|
|
<script class="testbody" type="text/javascript">
|
|
|
|
|
|
|
|
SimpleTest.waitForExplicitFinish();
|
|
|
|
|
2010-03-12 13:53:36 -08:00
|
|
|
var startURI = "http://mochi.test:8888/tests/docshell/test/bug94514-postpage.html";
|
2008-02-06 10:18:07 -08:00
|
|
|
var postedURI = startURI + "?posted=1";
|
|
|
|
|
|
|
|
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
|
|
|
|
|
|
|
const Cc = Components.classes;
|
|
|
|
const Ci = Components.interfaces;
|
|
|
|
|
|
|
|
var ios = Cc["@mozilla.org/network/io-service;1"].
|
|
|
|
getService(Ci.nsIIOService);
|
|
|
|
var startPage = ios.newURI(startURI, null, null);
|
|
|
|
var postedPage = ios.newURI(postedURI, null, null);
|
|
|
|
|
|
|
|
var gh = Cc["@mozilla.org/browser/global-history;2"].
|
|
|
|
getService(Ci.nsIGlobalHistory2);
|
|
|
|
SimpleTest.ok(!gh.isVisited(startPage),
|
|
|
|
"Initial page does not start in global history. Note: " +
|
|
|
|
"this will also fail if you run the test twice.");
|
|
|
|
SimpleTest.ok(!gh.isVisited(postedPage),
|
|
|
|
"Posted page does not start in global history.");
|
|
|
|
|
|
|
|
var w = window.open(startURI, "", "width=10,height=10");
|
|
|
|
|
|
|
|
function finishTest()
|
|
|
|
{
|
|
|
|
// We need to check that this was not added to global history.
|
|
|
|
SimpleTest.ok(gh.isVisited(startPage),
|
|
|
|
"Initial page was added to global history.");
|
|
|
|
SimpleTest.ok(!gh.isVisited(postedPage),
|
|
|
|
"Posted page was not added to global history.");
|
|
|
|
|
|
|
|
w.close();
|
|
|
|
SimpleTest.finish();
|
|
|
|
}
|
|
|
|
|
|
|
|
</script>
|
|
|
|
</pre>
|
|
|
|
</body>
|
|
|
|
</html>
|