Last Comment Bug 768190 - Dictionary members should not allow [TreatNullAs] or [TreatUndefinedAs] annotations
: Dictionary members should not allow [TreatNullAs] or [TreatUndefinedAs] annot...
Status: RESOLVED FIXED
:
Product: Core
Classification: Components
Component: DOM (show other bugs)
: unspecified
: x86 Mac OS X
: -- normal (vote)
: mozilla16
Assigned To: Boris Zbarsky [:bz] (still a bit busy)
:
: Andrew Overholt [:overholt]
Mentors:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-06-25 13:21 PDT by Boris Zbarsky [:bz] (still a bit busy)
Modified: 2012-06-30 12:41 PDT (History)
2 users (show)
bzbarsky: in‑testsuite+
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
Don't allow [TreatNullAs] or [TreatUndefinedAs] on dictionary members. (4.27 KB, patch)
2012-06-25 13:33 PDT, Boris Zbarsky [:bz] (still a bit busy)
justin.lebar+bug: review+
Details | Diff | Splinter Review

Description Boris Zbarsky [:bz] (still a bit busy) 2012-06-25 13:21:08 PDT
Spec says so.
Comment 1 Kyle Huey [:khuey] (Exited; not receiving bugmail, email if necessary) 2012-06-25 13:23:57 PDT
Honestly, unless this is really easy to implement in the parser (and it's not clear that it would be), I don't think we should bother.
Comment 2 Boris Zbarsky [:bz] (still a bit busy) 2012-06-25 13:33:29 PDT
Created attachment 636473 [details] [diff] [review]
Don't allow [TreatNullAs] or [TreatUndefinedAs] on dictionary members.
Comment 3 Boris Zbarsky [:bz] (still a bit busy) 2012-06-25 13:33:47 PDT
See above: pretty trivial to implement, imo.
Comment 4 Justin Lebar (not reading bugmail) 2012-06-29 06:31:36 PDT
Comment on attachment 636473 [details] [diff] [review]
Don't allow [TreatNullAs] or [TreatUndefinedAs] on dictionary members.

> class IDLArgument(IDLObjectWithIdentifier):
>-    def __init__(self, location, identifier, type, optional=False, defaultValue=None, variadic=False):
>+    def __init__(self, location, identifier, type, optional=False, defaultValue=None, variadic=False, dictionaryMember=False):
>         IDLObjectWithIdentifier.__init__(self, location, None, identifier)
> 
>         assert isinstance(type, IDLType)
>         self.type = type
> 
>         if defaultValue:
>             defaultValue = defaultValue.coerceToType(type, location)
>             assert defaultValue
> 
>         self.optional = optional
>         self.defaultValue = defaultValue
>         self.variadic = variadic
>+        self.dictionaryMember = dictionaryMember
> 
>         assert not variadic or optional
> 
>     def addExtendedAttributes(self, attrs):
>+        if self.dictionaryMember:
>+            for (attr, value) in attrs:
>+                if attr == "TreatUndefinedAs":
>+                    raise WebIDLError("[TreatUndefinedAs] is not allowed for "
>+                                      "dictionary members", [self.location])
>+                elif attr == "TreatNullAs":
>+                    raise WebIDLError("[TreatNullAs] is not allowed for "
>+                                      "dictionary members", [self.location])

This could be just |if 'TreatUndefinedAs' in attrs| and so on.
Comment 5 Boris Zbarsky [:bz] (still a bit busy) 2012-06-29 07:02:23 PDT
> This could be just |if 'TreatUndefinedAs' in attrs| and so on.

Attrs is a list of tuples, so I'm not sure it could.
Comment 6 Boris Zbarsky [:bz] (still a bit busy) 2012-06-29 22:54:38 PDT
https://hg.mozilla.org/integration/mozilla-inbound/rev/41412974ed77
Comment 7 Ryan VanderMeulen [:RyanVM] 2012-06-30 12:41:59 PDT
https://hg.mozilla.org/mozilla-central/rev/41412974ed77

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