Closed Bug 772966 Opened 12 years ago Closed 12 years ago

force XBL parameter names to be non-zero

Categories

(Core :: XBL, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: Benjamin, Assigned: smaug)

Details

Attachments

(1 file, 1 obsolete file)

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?
(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.
Attached patch bypass empty params (obsolete) — Splinter Review
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;
}
Attached patch patchSplinter Review
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
Closed: 12 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: