Add assertion that warns when we're about to crash due to bug 136927. b=136927 r+sr=jst a=asa

This commit is contained in:
dbaron%dbaron.org 2005-04-14 21:50:46 +00:00
Родитель 2b51b19d3b
Коммит 20b20044e6
2 изменённых файлов: 19 добавлений и 0 удалений

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

@ -614,6 +614,9 @@ nsObjectFrame::Init(nsPresContext* aPresContext,
nsStyleContext* aContext, nsStyleContext* aContext,
nsIFrame* aPrevInFlow) nsIFrame* aPrevInFlow)
{ {
#ifdef DEBUG
mInstantiating = PR_FALSE;
#endif
mIsBrokenPlugin = PR_FALSE; mIsBrokenPlugin = PR_FALSE;
if (sDefaultPluginDisabled == (PRBool)0xffffffff) { if (sDefaultPluginDisabled == (PRBool)0xffffffff) {
@ -699,6 +702,8 @@ nsObjectFrame::Init(nsPresContext* aPresContext,
NS_IMETHODIMP NS_IMETHODIMP
nsObjectFrame::Destroy(nsPresContext* aPresContext) nsObjectFrame::Destroy(nsPresContext* aPresContext)
{ {
NS_ASSERTION(!mInstantiating, "about to crash due to bug 136927");
// we need to finish with the plugin before native window is destroyed // we need to finish with the plugin before native window is destroyed
// doing this in the destructor is too late. // doing this in the destructor is too late.
if (mInstanceOwner != nsnull) { if (mInstanceOwner != nsnull) {
@ -1347,6 +1352,10 @@ nsObjectFrame::InstantiatePlugin(nsPresContext* aPresContext,
} }
} }
#ifdef DEBUG
mInstantiating = PR_TRUE;
#endif
nsCOMPtr<nsIDocument> doc; nsCOMPtr<nsIDocument> doc;
nsresult rv = mInstanceOwner->GetDocument(getter_AddRefs(doc)); nsresult rv = mInstanceOwner->GetDocument(getter_AddRefs(doc));
nsCOMPtr<nsIPluginDocument> pDoc (do_QueryInterface(doc)); nsCOMPtr<nsIPluginDocument> pDoc (do_QueryInterface(doc));
@ -1369,6 +1378,9 @@ nsObjectFrame::InstantiatePlugin(nsPresContext* aPresContext,
rv = aPluginHost->InstantiateEmbededPlugin(aMimeType, aURI, rv = aPluginHost->InstantiateEmbededPlugin(aMimeType, aURI,
mInstanceOwner); mInstanceOwner);
} }
#ifdef DEBUG
mInstantiating = PR_FALSE;
#endif
return rv; return rv;
} }

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

@ -208,6 +208,13 @@ private:
nsIFrame *mFirstChild; nsIFrame *mFirstChild;
nsCOMPtr<nsIWidget> mWidget; nsCOMPtr<nsIWidget> mWidget;
nsRect mWindowlessRect; nsRect mWindowlessRect;
#ifdef DEBUG
// For assertions that make it easier to determine if a crash is due
// to the underlying problem described in bug 136927.
PRBool mInstantiating;
#endif
PRPackedBool mIsBrokenPlugin; PRPackedBool mIsBrokenPlugin;
}; };