Closed Bug 1276938 Opened 3 years ago Closed 3 years ago

Optimize string usage in setAttribute when dealing with HTML elements

Categories

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

36 Branch
defect
Not set

Tracking

()

RESOLVED FIXED
mozilla49
Tracking Status
firefox49 --- fixed

People

(Reporter: smaug, Assigned: smaug)

Details

Attachments

(1 file)

We do a virtual call to InternalGetExistingAttrNameFromQName and nsContentUtils::ASCIIToLower is called twice when adding an attribute.

The patch tries to be consistent with the new aNameToUse handling so that it is set to some
value only if there isn't existing attribute.

https://treeherder.mozilla.org/#/jobs?repo=try&revision=dd4376104618b3320af40503bd366b78063f7811
Attachment #8758272 - Flags: review?(amarchesini)
Comment on attachment 8758272 [details] [diff] [review]
less_attr_lowercase.diff

Review of attachment 8758272 [details] [diff] [review]:
-----------------------------------------------------------------

::: dom/base/Element.h
@@ +659,5 @@
>                           const nsAString& aLocalName,
>                           ErrorResult& aError);
>    bool HasAttribute(const nsAString& aName) const
>    {
> +    return InternalGetAttrNameFromQName(aName) != nullptr;

maybe !!InternalGetAttrNameFromQName(aName);
Attachment #8758272 - Flags: review?(amarchesini) → review+
well, I just renamed the method, not changed its usage.
hmm, tryserver seems to have some unrelated issues atm.
Pushed by opettay@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/b7b7ea5b410e
Optimize string usage in setAttribute when dealing with HTML elements, r=baku
https://hg.mozilla.org/mozilla-central/rev/b7b7ea5b410e
Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla49
You need to log in before you can comment on or make changes to this bug.