Bug 252836 Exception ``[Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIWebNavigation.sessionHistory]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: chrome://global/content/bindings/browser.xml :: onxbldestructor :: line 402" data: no]'' thrown from function onxbldestructor(event=Event:{0}) in <chrome://global/content/bindings/browser.xml> line 402.

r=neil sr=bz
This commit is contained in:
timeless%mozdev.org 2004-10-27 05:23:40 +00:00
Родитель 2009617be2
Коммит e0e3a32c7d
5 изменённых файлов: 16 добавлений и 27 удалений

Просмотреть файл

@ -649,7 +649,7 @@ function getPostData()
{
try {
var sessionHistory = getWebNavigation().sessionHistory;
entry = sessionHistory.getEntryAtIndex(sessionHistory.index, false);
var entry = sessionHistory.getEntryAtIndex(sessionHistory.index, false);
entry = entry.QueryInterface(Components.interfaces.nsISHEntry);
return entry.postData;
}

Просмотреть файл

@ -2984,16 +2984,11 @@ NS_IMETHODIMP
nsDocShell::GetSessionHistory(nsISHistory ** aSessionHistory)
{
NS_ENSURE_ARG_POINTER(aSessionHistory);
if (mSessionHistory) {
*aSessionHistory = mSessionHistory;
NS_IF_ADDREF(*aSessionHistory);
return NS_OK;
}
return NS_ERROR_FAILURE;
}
//*****************************************************************************
// nsDocShell::nsIWebPageDescriptor
//*****************************************************************************

Просмотреть файл

@ -61,28 +61,28 @@ function sHistoryInit(theWindow)
}
catch(e){
alert("Unable to get interface requestor object: " + e);
return false;
return null;
}
try {
webNav = ifaceReq.getInterface(Components.interfaces.nsIWebNavigation);
}
catch(e) {
alert("Unable to get WebNavigation: " + e);
return false;
return null;
}
try {
sHistory = webNav.sessionHistory;
}
catch(e) {
alert("Didn't get SessionHistory object: " + e);
return false;
return null;
}
return sHistory;
}
catch(e)
{
alert("Could not find Session History component: " + e);
return false;
return null;
}
}
@ -93,7 +93,7 @@ function testHistoryCount(sHistory)
{
if (!sHistory) {
alert("Didn't get SessionHistory object");
return false;
return 0;
}
var cnt = sHistory.count; // GetCount()
return cnt;
@ -101,13 +101,14 @@ function testHistoryCount(sHistory)
// *************************************************************************
// testHistoryIndex() returns the current session history index.
// returns negative one if the history object is null.
// It accepts the session history object as the input parameter.
// In your test script,
function testHistoryIndex(sHistory)
{
if (!sHistory) {
alert("Didn't get SessionHistory object");
return false;
return -1;
}
var shIndex = sHistory.index; // GetIndex()
return shIndex;
@ -120,7 +121,7 @@ function testMaxLength(sHistory)
{
if (!sHistory) {
alert("Didn't get SessionHistory object");
return false;
return 0;
}
var maxLen = sHistory.maxLength; // GetMaxLength
return maxLen;
@ -136,7 +137,7 @@ function testGetEntryAtIndex(sHistory, cnt, modIndex)
{
if (!sHistory) {
alert("Didn't get SessionHistory object");
return false;
return null;
}
var entry = sHistory.getEntryAtIndex(cnt, modIndex);
@ -150,7 +151,7 @@ function testSimpleEnum(sHistory)
{
if (!sHistory) {
alert("Didn't get SessionHistory object");
return false;
return null;
}
var simpleEnum = sHistory.SHistoryEnumerator;
@ -189,7 +190,7 @@ function testHistoryEntryUri(nextHE, index)
{
if (!nextHE) {
alert("Didn't get history entry object");
return false;
return null;
}
// Get URI for the next Entry
Uri = entry.URI;
@ -206,7 +207,7 @@ function testHistoryEntryTitle(nextHE, index)
{
if (!nextHE) {
alert("Didn't get history entry object");
return false;
return null;
}
// Get Title for the nextEntry
title = entry.title;
@ -222,7 +223,7 @@ function testHistoryEntryFrame(nextHE, index)
{
if (!nextHE) {
alert("Didn't get history entry object");
return false;
return null;
}
// Get SubFrame Status for the nextEntry
frameStatus = entry.isSubFrame;

Просмотреть файл

@ -275,7 +275,7 @@ function testSessionHistory(webNav)
{
if (!webNav) {
alert("Didn't get web navigation object");
return false;
return null;
}
// Get the session history
getSHistory = webNav.sessionHistory;

Просмотреть файл

@ -516,14 +516,7 @@ function Startup()
//initConsoleListener();
// XXXjag work-around for bug 113076
// there's another bug where we throw an exception when getting
// sessionHistory if it is null, which I'm exploiting here to
// detect the situation described in bug 113076.
// The same problem caused bug 139522, also worked around below.
try {
getBrowser().sessionHistory;
} catch (e) {
if (!getBrowser().sessionHistory) {
/* Session history might not be available,
so we wrap access to it in a try block */
try {