From d04650839efecd761c1cc2b0341c62cc4f2a3fac Mon Sep 17 00:00:00 2001 From: "locka%iol.ie" Date: Thu, 17 Jan 2002 12:15:44 +0000 Subject: [PATCH] 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 git-svn-id: svn://10.0.0.236/trunk@112385 18797224-902f-48f8-a5cc-f745e15eee43 --- .../src/nsWebBrowserPersist.cpp | 38 +++++++++++-------- 1 file changed, 22 insertions(+), 16 deletions(-) diff --git a/mozilla/embedding/components/webbrowserpersist/src/nsWebBrowserPersist.cpp b/mozilla/embedding/components/webbrowserpersist/src/nsWebBrowserPersist.cpp index c89cce021d7..d0b6174f5b0 100644 --- a/mozilla/embedding/components/webbrowserpersist/src/nsWebBrowserPersist.cpp +++ b/mozilla/embedding/components/webbrowserpersist/src/nsWebBrowserPersist.cpp @@ -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 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 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 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 content; + nodeAsIFrame->GetContentDocument(getter_AddRefs(content)); + if (content) + { + SaveSubframeContent(content, data); + } } return NS_OK; }