Skip to content
This repository has been archived by the owner on Aug 4, 2022. It is now read-only.

Commit

Permalink
Bug 383890 - crash creating new dom attribute with prefix [@inDOMView…
Browse files Browse the repository at this point in the history
…::GetChildNodesFor]. Patch by Mook <mook.moz+mozbz@gmail.com>. r=sdwilsh, sr=neil
  • Loading branch information
sdwilsh committed Jun 12, 2007
1 parent 06e07b3 commit 1c0d825
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion layout/inspector/src/inDOMView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
#include "nsIDOMNamedNodeMap.h"
#include "nsIDOMMutationEvent.h"
#include "nsBindingManager.h"
#include "nsINameSpaceManager.h"
#include "nsIDocument.h"
#include "nsIServiceManager.h"
#include "nsITreeColumns.h"
Expand Down Expand Up @@ -717,14 +718,35 @@ inDOMView::AttributeChanged(nsIDocument *aDocument, nsIContent* aContent,
nsCOMPtr<nsIDOMAttr> domAttr;
nsAutoString attrStr;
aAttribute->ToString(attrStr);
el->GetAttributeNode(attrStr, getter_AddRefs(domAttr));
if (aNameSpaceID) {
nsCOMPtr<nsINameSpaceManager> nsm =
do_GetService(NS_NAMESPACEMANAGER_CONTRACTID);
if (!nsm) {
// we can't find out which attribute we want :(
return;
}
nsString attrNS;
nsresult rv = nsm->GetNameSpaceURI(aNameSpaceID, attrNS);
if (NS_FAILED(rv)) {
return;
}
(void)el->GetAttributeNodeNS(attrNS, attrStr, getter_AddRefs(domAttr));
} else {
(void)el->GetAttributeNode(attrStr, getter_AddRefs(domAttr));
}

if (aModType == nsIDOMMutationEvent::MODIFICATION) {
// No fancy stuff here, just invalidate the changed row
if (!domAttr) {
return;
}
PRInt32 row = 0;
NodeToRow(domAttr, &row);
mTree->InvalidateRange(row, row);
} else if (aModType == nsIDOMMutationEvent::ADDITION) {
if (!domAttr) {
return;
}
// get the number of attributes on this content node
nsCOMPtr<nsIDOMNamedNodeMap> attrs;
content->GetAttributes(getter_AddRefs(attrs));
Expand Down Expand Up @@ -1217,6 +1239,7 @@ inDOMView::GetLastDescendantOf(inDOMViewNode* aNode, PRInt32 aRow, PRInt32* aRes
nsresult
inDOMView::GetChildNodesFor(nsIDOMNode* aNode, nsCOMArray<nsIDOMNode>& aResult)
{
NS_ENSURE_ARG(aNode);
// Need to do this test to prevent unfortunate NYI assertion
// on nsXULAttribute::GetChildNodes
nsCOMPtr<nsIDOMAttr> attr = do_QueryInterface(aNode);
Expand Down

0 comments on commit 1c0d825

Please sign in to comment.