Fix for bug 582601 (Make GetContentInternal return Element*). r=bz.

This commit is contained in:
Peter Van der Beken 2010-07-30 15:42:11 +02:00
parent dfcfc976fb
commit e3ae7d53bb
5 changed files with 27 additions and 6 deletions

View File

@ -0,0 +1,12 @@
<html>
<head>
<title>Crashtest</title>
<script>
var attr = document.createAttribute("foo");
attr.lookupPrefix("");
</script>
</head>
<body>
</body>
</html>

View File

@ -68,3 +68,4 @@ load 558973.html
load 564079-1.html
load 564114.html
load 565125-1.html
load 582601.html

View File

@ -127,7 +127,7 @@ public:
protected:
virtual mozilla::dom::Element* GetNameSpaceElement()
{
return GetContentInternal()->AsElement();
return GetContentInternal();
}
static PRBool sInitialized;
@ -143,7 +143,7 @@ private:
// pointer so we can implement GetChildArray().
nsIContent* mChild;
nsIContent *GetContentInternal() const
mozilla::dom::Element *GetContentInternal() const
{
return mAttrMap ? mAttrMap->GetContent() : nsnull;
}

View File

@ -55,7 +55,7 @@
//----------------------------------------------------------------------
nsDOMAttributeMap::nsDOMAttributeMap(nsIContent* aContent)
nsDOMAttributeMap::nsDOMAttributeMap(Element* aContent)
: mContent(aContent)
{
// We don't add a reference to our content. If it goes away,

View File

@ -56,6 +56,12 @@ class nsDOMAttribute;
class nsINodeInfo;
class nsIDocument;
namespace mozilla {
namespace dom {
class Element;
} // namespace dom
} // namespace mozilla
/**
* Structure used as a key for caching nsDOMAttributes in nsDOMAttributeMap's mAttributeCache.
*/
@ -119,7 +125,9 @@ private:
class nsDOMAttributeMap : public nsIDOMNamedNodeMap
{
public:
nsDOMAttributeMap(nsIContent* aContent);
typedef mozilla::dom::Element Element;
nsDOMAttributeMap(Element *aContent);
virtual ~nsDOMAttributeMap();
/**
@ -134,7 +142,7 @@ public:
void DropReference();
nsIContent* GetContent()
Element* GetContent()
{
return mContent;
}
@ -193,7 +201,7 @@ public:
NS_DECL_CYCLE_COLLECTION_CLASS(nsDOMAttributeMap)
private:
nsIContent* mContent; // Weak reference
Element *mContent; // Weak reference
/**
* Cache of nsDOMAttributes.