Last Comment Bug 772966 - force XBL parameter names to be non-zero
: force XBL parameter names to be non-zero
Status: RESOLVED FIXED
:
Product: Core
Classification: Components
Component: XBL (show other bugs)
: unspecified
: All All
: -- enhancement (vote)
: ---
Assigned To: Olli Pettay [:smaug]
:
Mentors:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-07-11 11:35 PDT by :Benjamin Peterson
Modified: 2012-08-02 00:25 PDT (History)
3 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
bypass empty params (2.69 KB, patch)
2012-07-11 14:23 PDT, Olli Pettay [:smaug]
no flags Details | Diff | Splinter Review
patch (2.75 KB, patch)
2012-07-11 14:49 PDT, Olli Pettay [:smaug]
jonas: review+
Details | Diff | Splinter Review

Description :Benjamin Peterson 2012-07-11 11:35:44 PDT
Otherwise XBL can pass empty parameter names through the JS API, which is not exactly supported.
Comment 1 Olli Pettay [:smaug] 2012-07-11 12:20:24 PDT
Can JSAPI handle cases when param name contains whitespaces?
Comment 2 :Benjamin Peterson 2012-07-11 12:59:03 PDT
(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.
Comment 3 Olli Pettay [:smaug] 2012-07-11 14:23:50 PDT
Created attachment 641200 [details] [diff] [review]
bypass empty params
Comment 4 :Ms2ger (⌚ UTC+1/+2) 2012-07-11 14:28:48 PDT
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 :(
Comment 5 Olli Pettay [:smaug] 2012-07-11 14:33:24 PDT
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;
}
Comment 6 Olli Pettay [:smaug] 2012-07-11 14:49:04 PDT
Created attachment 641208 [details] [diff] [review]
patch
Comment 7 Olli Pettay [:smaug] 2012-08-02 00:25:38 PDT
https://hg.mozilla.org/mozilla-central/rev/588424024294

Note You need to log in before you can comment on or make changes to this bug.