Bug 393432 - "Firefox crashes sometimes if you click the back button on www.userfriendly.org [@ DummyParserRequest::Cancel 334d84da]" (Store the sink in a nsWeakPtr and verify it is still valid before using) [p=colin@theblakes.com (Colin Blake) r=jst sr=bzbarsky a=ss]

git-svn-id: svn://10.0.0.236/branches/MOZILLA_1_8_BRANCH@247396 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
reed%reedloden.com
2008-03-08 13:21:25 +00:00
parent dd929d099f
commit 6230b4eb2e

View File

@@ -458,7 +458,7 @@ protected:
nsCOMPtr<nsILoadGroup> mLoadGroup;
nsIHTMLContentSink* mSink; // Weak reference
nsWeakPtr mSink; // Weak reference
public:
static nsresult
@@ -668,7 +668,7 @@ DummyParserRequest::DummyParserRequest(nsIHTMLContentSink* aSink)
"unable to create about:parser-dummy-request");
}
mSink = aSink;
mSink = do_GetWeakReference(aSink);
}
@@ -684,9 +684,13 @@ DummyParserRequest::Cancel(nsresult status)
{
// Cancel parser
nsresult rv = NS_OK;
HTMLContentSink* sink = NS_STATIC_CAST(HTMLContentSink*, mSink);
if ((sink) && (sink->mParser)) {
sink->mParser->CancelParsingEvents();
nsCOMPtr<nsIHTMLContentSink> sink = do_QueryReferent(mSink);
if (sink) {
nsIHTMLContentSink* actualSink = sink;
HTMLContentSink* htmlContentSink = NS_STATIC_CAST(HTMLContentSink*, actualSink);
if (htmlContentSink->mParser) {
htmlContentSink->mParser->CancelParsingEvents();
}
}
return rv;
}