mirror of
https://github.com/rn10950/RetroZilla.git
synced 2024-07-08 02:10:14 +02:00
243 lines
6.9 KiB
HTML
243 lines
6.9 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
|
|
|
<html>
|
|
<head>
|
|
<title>SessionHistory.html</title>
|
|
<!-- Descrpt: test Sesion History interfaces
|
|
Author: radha@netscape.com
|
|
Revs: 06.27.01 - Created
|
|
|
|
- ***** BEGIN LICENSE BLOCK *****
|
|
- Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
|
-
|
|
- The contents of this file are subject to the Mozilla Public License Version
|
|
- 1.1 (the "License"); you may not use this file except in compliance with
|
|
- the License. You may obtain a copy of the License at
|
|
- http://www.mozilla.org/MPL/
|
|
-
|
|
- Software distributed under the License is distributed on an "AS IS" basis,
|
|
- WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
|
- for the specific language governing rights and limitations under the
|
|
- License.
|
|
-
|
|
- The Original Code is Mozilla Communicator Test Cases.
|
|
-
|
|
- The Initial Developer of the Original Code is
|
|
- Netscape Communications Corp.
|
|
- Portions created by the Initial Developer are Copyright (C) 1999
|
|
- the Initial Developer. All Rights Reserved.
|
|
-
|
|
- Contributor(s):
|
|
- depstein@netscape.com
|
|
-
|
|
- Alternatively, the contents of this file may be used under the terms of
|
|
- either the GNU General Public License Version 2 or later (the "GPL"), or
|
|
- the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
|
- in which case the provisions of the GPL or the LGPL are applicable instead
|
|
- of those above. If you wish to allow use of your version of this file only
|
|
- under the terms of either the GPL or the LGPL, and not to allow others to
|
|
- use your version of this file under the terms of the MPL, indicate your
|
|
- decision by deleting the provisions above and replace them with the notice
|
|
- and other provisions required by the GPL or the LGPL. If you do not delete
|
|
- the provisions above, a recipient may use your version of this file under
|
|
- the terms of any one of the MPL, the GPL or the LGPL.
|
|
-
|
|
- ***** END LICENSE BLOCK ***** -->
|
|
|
|
<script TYPE="text/javascript" SRC="nsISHistoryTestLib.js">
|
|
</script>
|
|
|
|
<script TYPE="text/javascript" SRC="nsISHListenerTestLib.js">
|
|
</script>
|
|
|
|
<script TYPE="text/javascript">
|
|
|
|
// *** Variables ***
|
|
var results = null;
|
|
var SHListener=null;
|
|
var debug = 1;
|
|
var testWin=null;
|
|
var updateInfo="<p>Creating New window ....<br>";
|
|
|
|
var cnt = 0;
|
|
var urlList = ["file://D|/Embed-info/scripts/nsISHistory/loadHistoryPage.html",
|
|
"http://www.intel.com",
|
|
"http://www.yahoo.com",
|
|
"http://www.mozilla.org",
|
|
"http://www.mozilla.org/newsbot",
|
|
"http://www.cisco.com"
|
|
];
|
|
// Variables to verify if the callbacks are invoked properly
|
|
var backCallback = false;
|
|
var forwardCallback = false;
|
|
var reloadCallback = false;
|
|
var gotoCallback = false;
|
|
var purgeCallback = false;
|
|
var histLenInChild = 0;
|
|
|
|
|
|
function ddump(s)
|
|
{
|
|
if (debug==1) {
|
|
t = s + "\n";
|
|
dump(t);
|
|
}
|
|
else if (debug==2)
|
|
alert(s);
|
|
}
|
|
|
|
function startTestcase()
|
|
{
|
|
results = "<p> About to create new child window ...<br></p>";
|
|
loadPages();
|
|
}
|
|
|
|
function loadPages()
|
|
{
|
|
ddump("In loadPages");
|
|
alert("cnt = " + cnt);
|
|
alert("the uri = " + urlList[cnt]);
|
|
|
|
/* Load pages sequentially in the child window
|
|
* The first url will set up the listener
|
|
* The last url will test nsISHistory
|
|
*/
|
|
|
|
if (cnt == 0) {
|
|
testWin = window.open(urlList[cnt++], "testWin");
|
|
testWin.onLoad = myLoadFunction();
|
|
}
|
|
else
|
|
testWin.location = urlList[cnt++];
|
|
|
|
uriTotal = urlList.length;
|
|
if (cnt == (uriTotal - 1)) {
|
|
DoWebNavigationInChild(); // includes loading last page
|
|
}
|
|
else {
|
|
ddump("calling SetTimeOut again");
|
|
setTimeout("loadPages()", 6000);
|
|
}
|
|
}
|
|
|
|
function myLoadFunction()
|
|
{
|
|
setTimeout("SetListenerInChild()", 6000);
|
|
}
|
|
|
|
function DoWebNavigationInChild()
|
|
{
|
|
// Trigger History operations
|
|
setTimeout("GoBackInChild()", 5000);
|
|
}
|
|
|
|
function GoBackInChild()
|
|
{
|
|
ddump("Inside GoBackInChild");
|
|
if (testWin) {
|
|
netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserAccess");
|
|
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
|
testWin.history.back();
|
|
setTimeout("GoForwardInChild()", 6000);
|
|
}
|
|
}
|
|
|
|
function GoForwardInChild()
|
|
{
|
|
ddump("Inside GoForwardInChild");
|
|
if (testWin) {
|
|
netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserAccess");
|
|
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
|
testWin.history.forward();
|
|
setTimeout("DoReloadInChild()", 6000);
|
|
}
|
|
}
|
|
|
|
function DoReloadInChild()
|
|
{
|
|
ddump("Inside DoReloadInChild");
|
|
if (testWin) {
|
|
netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserAccess");
|
|
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
|
|
|
testWin.location.reload();
|
|
setTimeout("GotoIndexInChild(-1)", 6000);
|
|
}
|
|
}
|
|
|
|
|
|
function GotoIndexInChild(index)
|
|
{
|
|
ddump("Inside GotoIndexInChild; index = " + index);
|
|
if (testWin) {
|
|
netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserAccess");
|
|
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
|
testWin.history.go(index);
|
|
setTimeout("LoadLastPageInChild()", 5000);
|
|
}
|
|
}
|
|
|
|
function LoadLastPageInChild()
|
|
{
|
|
ddump("Inside LoadLastPageInChild");
|
|
if (testWin) {
|
|
netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserAccess");
|
|
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
|
// Load the last page in the child window
|
|
testWin.location.href = urlList[cnt];
|
|
setTimeout("PurgeHistoryInChild()", 6000);
|
|
}
|
|
}
|
|
|
|
function PurgeHistoryInChild()
|
|
{
|
|
ddump("Inside PurgeHistoryInChild");
|
|
if (testWin) {
|
|
netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserAccess");
|
|
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
|
histLenInChild = testWin.history.length;
|
|
|
|
// Purge all history entries in the child window.
|
|
if (histLenInChild >0) {
|
|
netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserAccess");
|
|
sHistory = sHistoryInit(testWin);
|
|
purgeEntries(sHistory, histLenInChild);
|
|
}
|
|
}
|
|
ddump("End of script.");
|
|
}
|
|
|
|
|
|
// Called back by the child to set listener object in it.
|
|
function SetListenerInChild()
|
|
{
|
|
netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserAccess");
|
|
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
|
|
|
sHListener = new sessionHistoryListener();
|
|
ddump("in SHListenerTest.html: sHistoryListener object = " + sHListener);
|
|
testWin.SetListener(sHListener);
|
|
}
|
|
|
|
</script>
|
|
</head>
|
|
|
|
<body>
|
|
<form name="results" action="/ngdriver/cgi-bin/writeresults.cgi" method="post">
|
|
|
|
<textarea cols=60 rows=10 name="textarea">
|
|
</TEXTAREA>
|
|
</form>
|
|
|
|
<script TYPE="text/javascript">
|
|
setTimeout("startTestcase()", 3000);
|
|
</script>
|
|
|
|
<p>
|
|
This is test case for Session History Listener. <br>
|
|
|
|
|
|
</body>
|
|
</html>
|
|
|