Add pointer test to prevent crashes on frame/iframe elements with no src attribute. b=119939 r=timeless@bemail.org sr=rpotts@netscape.com a=dbaron@fas.harvard.edu

This commit is contained in:
locka%iol.ie 2002-01-17 12:15:44 +00:00
parent 9dc7de0bb1
commit 8270e25e99

View File

@ -1308,15 +1308,18 @@ nsWebBrowserPersist::OnWalkDOMNode(nsIDOMNode *aNode, PRBool *aAbort)
{
URIData *data = nsnull;
StoreURIAttribute(aNode, "src", PR_FALSE, &data);
data->mIsSubFrame = PR_TRUE;
// TODO how do we get the proper extension (or MIME type) from a DOM document?
data->mSubFrameExt.Assign(NS_LITERAL_STRING(".htm"));
// Save the frame content
nsCOMPtr<nsIDOMDocument> content;
nodeAsFrame->GetContentDocument(getter_AddRefs(content));
if (content)
if (data)
{
SaveSubframeContent(content, data);
data->mIsSubFrame = PR_TRUE;
// TODO how do we get the proper extension (or MIME type) from a DOM document?
data->mSubFrameExt.Assign(NS_LITERAL_STRING(".htm"));
// Save the frame content
nsCOMPtr<nsIDOMDocument> content;
nodeAsFrame->GetContentDocument(getter_AddRefs(content));
if (content)
{
SaveSubframeContent(content, data);
}
}
return NS_OK;
}
@ -1326,15 +1329,18 @@ nsWebBrowserPersist::OnWalkDOMNode(nsIDOMNode *aNode, PRBool *aAbort)
{
URIData *data = nsnull;
StoreURIAttribute(aNode, "src", PR_FALSE, &data);
data->mIsSubFrame = PR_TRUE;
// TODO how do we get the proper extension (or MIME type) from a DOM document?
data->mSubFrameExt.Assign(NS_LITERAL_STRING(".htm"));
// Save the frame content
nsCOMPtr<nsIDOMDocument> content;
nodeAsIFrame->GetContentDocument(getter_AddRefs(content));
if (content && data)
if (data)
{
SaveSubframeContent(content, data);
data->mIsSubFrame = PR_TRUE;
// TODO how do we get the proper extension (or MIME type) from a DOM document?
data->mSubFrameExt.Assign(NS_LITERAL_STRING(".htm"));
// Save the frame content
nsCOMPtr<nsIDOMDocument> content;
nodeAsIFrame->GetContentDocument(getter_AddRefs(content));
if (content)
{
SaveSubframeContent(content, data);
}
}
return NS_OK;
}