force XBL parameter names to be non-zero

RESOLVED FIXED

Status

()

Core
XBL
--
enhancement
RESOLVED FIXED
5 years ago
5 years ago

People

(Reporter: Benjamin, Assigned: smaug)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment, 1 obsolete attachment)

(Reporter)

Description

5 years ago
Otherwise XBL can pass empty parameter names through the JS API, which is not exactly supported.
(Assignee)

Updated

5 years ago
Assignee: nobody → bugs
(Assignee)

Comment 1

5 years ago
Can JSAPI handle cases when param name contains whitespaces?
(Reporter)

Comment 2

5 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.
(Assignee)

Comment 3

5 years ago
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 :(
(Assignee)

Comment 5

5 years ago
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;
}
(Assignee)

Comment 6

5 years ago
Created attachment 641208 [details] [diff] [review]
patch
Attachment #641208 - Flags: review?(jonas)
(Assignee)

Updated

5 years ago
Attachment #641200 - Attachment is obsolete: true
Attachment #641200 - Flags: review?(jonas)
Attachment #641208 - Flags: review?(jonas) → review+
(Assignee)

Comment 7

5 years ago
https://hg.mozilla.org/mozilla-central/rev/588424024294
Status: NEW → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.