Fixing bug 103904. Don't let pref change callbacks run wild on documents that are partially torn down already. r=bzbarsky@mit.edu, sr=rpotts@netscape.com

git-svn-id: svn://10.0.0.236/trunk@106922 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
jst%netscape.com 2001-11-01 04:42:57 +00:00
parent e65e0f6378
commit 8360b93aa5
2 changed files with 36 additions and 10 deletions

View File

@ -2001,6 +2001,22 @@ PresShell::ArePrefStyleRulesEnabled(PRBool& aEnabled)
NS_IMETHODIMP
PresShell::SetPreferenceStyleRules(PRBool aForceReflow)
{
if (!mDocument) {
return NS_ERROR_NULL_POINTER;
}
nsCOMPtr<nsIScriptGlobalObject> globalObj;
mDocument->GetScriptGlobalObject(getter_AddRefs(globalObj));
// If the document doesn't have a global object there's no need to
// notify its presshell about changes to preferences since the
// document is in a state where it doesn't matter any more (see
// DocumentViewerImpl::Close()).
if (!globalObj) {
return NS_ERROR_NULL_POINTER;
}
NS_PRECONDITION(mPresContext, "presContext cannot be null");
if (mPresContext) {
nsresult result = NS_OK;
@ -2081,9 +2097,9 @@ PresShell::SetPreferenceStyleRules(PRBool aForceReflow)
return result;
} else {
return NS_ERROR_NULL_POINTER;
}
return NS_ERROR_NULL_POINTER;
}
nsresult PresShell::ClearPreferenceStyleRules(void)
@ -3244,9 +3260,6 @@ PresShell::CompleteMove(PRBool aForward, PRBool aExtend)
result = GetPrimaryFrameFor(bodyContent, &frame);
if (frame)
{
PRInt32 offset;
PRInt32 offsetend;
PRBool beginFrameContent;
PRInt8 outsideLimit = -1;//search from beginning
nsPeekOffsetStruct pos;
pos.mAmount = eSelectLine;

View File

@ -2001,6 +2001,22 @@ PresShell::ArePrefStyleRulesEnabled(PRBool& aEnabled)
NS_IMETHODIMP
PresShell::SetPreferenceStyleRules(PRBool aForceReflow)
{
if (!mDocument) {
return NS_ERROR_NULL_POINTER;
}
nsCOMPtr<nsIScriptGlobalObject> globalObj;
mDocument->GetScriptGlobalObject(getter_AddRefs(globalObj));
// If the document doesn't have a global object there's no need to
// notify its presshell about changes to preferences since the
// document is in a state where it doesn't matter any more (see
// DocumentViewerImpl::Close()).
if (!globalObj) {
return NS_ERROR_NULL_POINTER;
}
NS_PRECONDITION(mPresContext, "presContext cannot be null");
if (mPresContext) {
nsresult result = NS_OK;
@ -2081,9 +2097,9 @@ PresShell::SetPreferenceStyleRules(PRBool aForceReflow)
return result;
} else {
return NS_ERROR_NULL_POINTER;
}
return NS_ERROR_NULL_POINTER;
}
nsresult PresShell::ClearPreferenceStyleRules(void)
@ -3244,9 +3260,6 @@ PresShell::CompleteMove(PRBool aForward, PRBool aExtend)
result = GetPrimaryFrameFor(bodyContent, &frame);
if (frame)
{
PRInt32 offset;
PRInt32 offsetend;
PRBool beginFrameContent;
PRInt8 outsideLimit = -1;//search from beginning
nsPeekOffsetStruct pos;
pos.mAmount = eSelectLine;