On 4/4/13 1:10 PM, [email protected] wrote:
   nsAString& str1 = NS_LITERAL_STRING("string1");

I would really hope this doesn't compile....

   nsAString& str2 = csp->getMyStringValue();

   str1.Append(str2);

What you want is more like:

  nsAutoString str1(NS_LITERAL_STRING("string1"));
  str1.Append(csp->getMyStringValue());

Question 2: nsDOMTokenList defines Contains(const nsAString& aToken,
             ErrorResult& aError). However, I found this function nowhere used
             in this way.

It's called that way from DOMTokentListBinding.cpp, which is autogenerated from DOMTokenList.webidl.

Can I simply call it via Contains(str1) as it is
             done in lines 111 or 148?

_If_ you are 100% sure that your string is nonempty and does not contain whitespace, you can just call the XPCOM version of Contains() and ignore the return value. Or call the above WebIDL version and ignore the ErrorResult, of course.

-Boris
_______________________________________________
dev-security mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-security

Reply via email to