force XBL parameter names to be non-zero

RESOLVED FIXED

Status

()

--
enhancement
RESOLVED FIXED
6 years ago
6 years ago

People

(Reporter: Benjamin, Assigned: smaug)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment, 1 obsolete attachment)

(Reporter)

Description

6 years ago
Otherwise XBL can pass empty parameter names through the JS API, which is not exactly supported.
Assignee: nobody → bugs
Can JSAPI handle cases when param name contains whitespaces?
(Reporter)

Comment 2

6 years ago
(In reply to Olli Pettay [:smaug] from comment #1)
> Can JSAPI handle cases when param name contains whitespaces?

We don't check if anything is a valid identifier. If it contains whitespace, nothing will probably go wrong, but that's useless, right? You can use JS_IsIdentifier to do this check.
Created attachment 641200 [details] [diff] [review]
bypass empty params
Attachment #641200 - Flags: review?(jonas)
Comment on attachment 641200 [details] [diff] [review]
bypass empty params

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

::: content/xbl/src/nsXBLProtoImplMethod.cpp
@@ +57,5 @@
>  {
>    NS_PRECONDITION(!IsCompiled(),
>                    "Must not be compiled when accessing uncompiled method");
>  
> +  NS_ENSURE_TRUE(!aText.IsEmpty(), );

Empty macro arguments cause build warnings :(
Really? We have those in many places.
But I can change that to
if (aText.IsEmpty()) {
  NS_WARNING("Empty name attribute in xbl:parameter!");
  return;
}
Created attachment 641208 [details] [diff] [review]
patch
Attachment #641208 - Flags: review?(jonas)
Attachment #641200 - Attachment is obsolete: true
Attachment #641200 - Flags: review?(jonas)
https://hg.mozilla.org/mozilla-central/rev/588424024294
Status: NEW → RESOLVED
Last Resolved: 6 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.