Closed Bug 296207 Opened 21 years ago Closed 20 years ago

nsDOMAttributeMap::SetNamedItemInternal() could be optimized

Categories

(Core :: DOM: Core & HTML, defect)

defect
Not set
minor

Tracking

()

RESOLVED FIXED

People

(Reporter: allan, Assigned: sicking)

Details

Attachments

(1 file)

Attached patch patchSplinter Review
Fixes this bug and makes sure .ownerDocument is always right (was required to be able to just grab the existing nodeinfo)
Attachment #185816 - Flags: superreview?(peterv)
Attachment #185816 - Flags: review?(allan)
Comment on attachment 185816 [details] [diff] [review] patch base/src/nsDOMAttributeMap.cpp L 100: +SetDocumentFunc(nsAttrHashKey::KeyType aKey, nsCOMPtr<nsIDOMNode>& aData, void* aUserArg) W 115: + return NS_OK; with that r=me
Attachment #185816 - Flags: review?(allan) → review+
Comment on attachment 185816 [details] [diff] [review] patch > Index: base/public/nsIAttribute.h > =================================================================== > + /** > + * Called when our ownerElement is moved into a new document. > + * Updates the nodeinfo of this node. > + */ > + virtual nsresult SetDocument(nsIDocument* aDocument) = 0; SetOwnerDocument? > Index: base/src/nsDOMAttributeMap.cpp > =================================================================== > +nsresult > +nsDOMAttributeMap::SetDocument(nsIDocument* aDocument) > +{ > + PRUint32 n = mAttributeCache.Enumerate(SetDocumentFunc, aDocument); > + NS_ENSURE_TRUE(n == mAttributeCache.Count(), NS_ERROR_OUT_OF_MEMORY); NS_ERROR_FAILURE > @@ -208,46 +226,46 @@ nsDOMAttributeMap::SetNamedItemInternal( > + // setting a preexisting attribute is a no-op > + return NS_OK; "If the new Node replaces an existing node the replaced Node is returned, otherwise null is returned." I think you need to return the source node in this case, not null.
Attachment #185816 - Flags: superreview?(peterv) → superreview+
To sicking, since it's his patch... Requesting blocking so we don't forget to check this in.
Assignee: general → bugmail
Flags: blocking1.9a1?
Checked in
Status: NEW → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
Flags: blocking1.9a1?
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: