gecko/toolkit/components/places/tests/test_bug_94514.html
Ted Mielczarek 06e04ce1b2 Bug 968837 - Move more Mochitests into manifests. r=jmaher
--HG--
rename : toolkit/components/places/tests/browser/bug_399606/399606-history.go-0.html => toolkit/components/places/tests/browser/399606-history.go-0.html
rename : toolkit/components/places/tests/browser/bug_399606/399606-httprefresh.html => toolkit/components/places/tests/browser/399606-httprefresh.html
rename : toolkit/components/places/tests/browser/bug_399606/399606-location.reload.html => toolkit/components/places/tests/browser/399606-location.reload.html
rename : toolkit/components/places/tests/browser/bug_399606/399606-location.replace.html => toolkit/components/places/tests/browser/399606-location.replace.html
rename : toolkit/components/places/tests/browser/bug_399606/399606-window.location.href.html => toolkit/components/places/tests/browser/399606-window.location.href.html
rename : toolkit/components/places/tests/browser/bug_399606/399606-window.location.html => toolkit/components/places/tests/browser/399606-window.location.html
rename : toolkit/components/places/tests/browser/visituri/begin.html => toolkit/components/places/tests/browser/begin.html
rename : toolkit/components/places/tests/browser/visituri/final.html => toolkit/components/places/tests/browser/final.html
rename : toolkit/components/places/tests/browser/visituri/redirect_once.sjs => toolkit/components/places/tests/browser/redirect_once.sjs
rename : toolkit/components/places/tests/browser/visituri/redirect_twice.sjs => toolkit/components/places/tests/browser/redirect_twice.sjs
rename : toolkit/components/places/tests/browser/settitle/title1.html => toolkit/components/places/tests/browser/title1.html
rename : toolkit/components/places/tests/browser/settitle/title2.html => toolkit/components/places/tests/browser/title2.html
rename : toolkit/components/places/tests/mochitest/bug94514-postpage.html => toolkit/components/places/tests/bug94514-postpage.html
rename : toolkit/components/places/tests/mochitest/test_bug_411966.html => toolkit/components/places/tests/test_bug_411966.html
rename : toolkit/components/places/tests/mochitest/test_bug_461710_perwindowpb.html => toolkit/components/places/tests/test_bug_461710_perwindowpb.html
rename : toolkit/components/places/tests/mochitest/test_bug_94514.html => toolkit/components/places/tests/test_bug_94514.html
2014-02-06 15:37:30 -05:00

80 lines
2.6 KiB
HTML

<!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>
<script type="text/javascript" src="http://mochi.test:8888/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="http://mochi.test:8888/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();
var startURI = "http://mochi.test:8888/tests/toolkit/components/places/tests/bug94514-postpage.html";
var postedURI = startURI + "?posted=1";
const Cc = Components.classes;
const Ci = Components.interfaces;
Components.utils.import("resource://gre/modules/PlacesUtils.jsm");
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 w = null;
// Because adding visits is async, we will not be notified imemdiately.
var os = Cc["@mozilla.org/observer-service;1"].
getService(Ci.nsIObserverService);
var visitObserver = {
_visitCount: 0,
observe: function(aSubject, aTopic, aData) {
if (!startPage.equals(aSubject.QueryInterface(Ci.nsIURI)) ||
++this._visitCount < 2) {
return;
}
os.removeObserver(this, aTopic);
finishTest();
},
};
os.addObserver(visitObserver, "uri-visit-saved", false);
PlacesUtils.asyncHistory.isURIVisited(startPage, function(aURI, aIsVisited) {
SimpleTest.ok(!aIsVisited, "Initial page does not start in global history. " +
"Note: this will also fail if you run the test twice.");
PlacesUtils.asyncHistory.isURIVisited(postedPage, function(aURI, aIsVisited) {
SimpleTest.ok(!aIsVisited, "Posted page does not start in global history.");
w = window.open(startURI, "", "width=10,height=10");
});
});
function finishTest() {
// We need to check that this was not added to global history.
PlacesUtils.asyncHistory.isURIVisited(startPage, function(aURI, aIsVisited) {
SimpleTest.ok(aIsVisited, "Initial page was added to global history.");
PlacesUtils.asyncHistory.isURIVisited(postedPage, function(aURI, aIsVisited) {
SimpleTest.ok(!aIsVisited, "Posted page was not added to global history.");
w.close();
SimpleTest.finish();
});
});
}
</script>
</pre>
</body>
</html>