Closed
Bug 96478
Opened 23 years ago
Closed 23 years ago
AttributeNodes are slow, prefer to do hasAttribute?
Categories
(Core :: XSLT, defect, P2)
Core
XSLT
Tracking
()
VERIFIED
FIXED
mozilla1.0.1
People
(Reporter: axel, Assigned: sicking)
References
Details
Attachments
(2 files)
3.87 KB,
patch
|
peterv
:
review+
jst
:
superreview+
asa
:
approval+
|
Details | Diff | Splinter Review |
10.91 KB,
patch
|
peterv
:
review+
jst
:
superreview+
asa
:
approval+
|
Details | Diff | Splinter Review |
Another one in the sad tale of AttributeNode in module.
We use the following pattern a few times:
Attr* modeAttr = actionElement->getAttributeNode(MODE_ATTR);
if (modeAttr)
mode = new String(modeAttr->getValue());
(whitespace cleaned copy ;-) )
Should we move that to
if (actionElement->hasAttribute(MODE_ATTR))
mode = actionElement->getAttribute(MODE_ATTR);
?
This way we have to lookup the attribute twice, but don't generate an
AttributeNode with wrappers and foo.
jst, just from the mozilla dom side, is there a speed benefit for either
solution?
UGH. I just happen to realize, the ownership of AttributeNodes is different
in module and standalone, in module we prolly leak each and every AttributeNode,
but in standalone we mustn't delete them, as we just get references from
the node. yacyacyac.
Occurences:
./source/xslt/ProcessorState.cpp: Attr* modeAttr =
xslTemplate->getAttributeNode(MODE_ATTR);
./source/xslt/XSLTProcessor.cpp: Attr* modeAttr =
actionElement->getAttributeNode(MODE_ATTR);
./source/xslt/XSLTProcessor.cpp: Attr* attr =
actionElement->getAttributeNode(NAME_ATTR);
./source/xslt/XSLTProcessor.cpp: Attr* attr =
actionElement->getAttributeNode(NAME_ATTR);
./source/xslt/XSLTProcessor.cpp: Attr* attr =
actionElement->getAttributeNode(NAME_ATTR);
./source/xslt/XSLTProcessor.cpp: Attr* attr =
xslVariable->getAttributeNode(SELECT_ATTR);
Reporter | ||
Comment 1•23 years ago
|
||
So I have been taught that we don't leak. Due to nsCOMPtr in
MozillaObjectWrapper and deleting the wrappers on deleting the doc.
Axel
Reporter | ||
Comment 2•23 years ago
|
||
we should use getAttr, introduced in nsdoom (bug 76070).
Priority: -- → P2
Target Milestone: --- → mozilla1.0
Comment 3•23 years ago
|
||
Bugs targeted at mozilla1.0 without the mozilla1.0 keyword moved to mozilla1.0.1
(you can query for this string to delete spam or retrieve the list of bugs I've
moved)
Target Milestone: mozilla1.0 → mozilla1.0.1
Assignee | ||
Comment 4•23 years ago
|
||
what's left for this bug being marked fixed?
Assignee | ||
Comment 5•23 years ago
|
||
the preffered method is |hasAttr(); getAttr();| over |getAttrNode();
getValue();| since the node doesn't contain the actual value. So getValue() will
result in a call to getAttr() behind the scenes.
Patch coming up that removes our last uses of getAttributeNode
Assignee | ||
Comment 6•23 years ago
|
||
Comment 7•23 years ago
|
||
Comment on attachment 71247 [details] [diff] [review]
patch to fix
r=peterv
Attachment #71247 -
Flags: review+
Assignee | ||
Comment 8•23 years ago
|
||
Comment 9•23 years ago
|
||
Comment on attachment 71260 [details] [diff] [review]
remove |getAttribute|
r=peterv but i think you should check that replacing isEmpty with the "has
attribute" check is the right thing to do.
Attachment #71260 -
Flags: review+
Assignee | ||
Comment 10•23 years ago
|
||
in most cases "" is not allowed, however there are many other values that are
not allowed since the names should be q-names. So once we start keying stuff on
qnames we should also check for qname-validity. I'll make a note of that in bug
96802.
The only thing that i changed that is not a "qname-attribute" is the "elements"
attribute for xsl:strip-space and xsl:preserve-space. For those elements i would
say it is allowed with "" as attribute value, but the attribute must exist.
Which is what the new code enforces.
(snatching bug since i've got the patch)
Assignee: axel → sicking
Comment 11•23 years ago
|
||
Comment on attachment 71247 [details] [diff] [review]
patch to fix
sr=jst
Attachment #71247 -
Flags: superreview+
Comment 12•23 years ago
|
||
Comment on attachment 71260 [details] [diff] [review]
remove |getAttribute|
sr=jst
Attachment #71260 -
Flags: superreview+
Comment 13•23 years ago
|
||
Comment on attachment 71247 [details] [diff] [review]
patch to fix
a=asa (on behalf of drivers) for checkin to the 1.0 trunk
Attachment #71247 -
Flags: approval+
Comment 14•23 years ago
|
||
Comment on attachment 71260 [details] [diff] [review]
remove |getAttribute|
a=asa (on behalf of drivers) for checkin to the 1.0 trunk
Attachment #71260 -
Flags: approval+
Assignee | ||
Comment 15•23 years ago
|
||
checked in both patches, thanks for reviews
Status: NEW → RESOLVED
Closed: 23 years ago
Resolution: --- → FIXED
Reporter | ||
Comment 16•22 years ago
|
||
we didn't verify for a long time.
I really checked, so VERIFIED.
Status: RESOLVED → VERIFIED
You need to log in
before you can comment on or make changes to this bug.
Description
•