Closed
Bug 790273
Opened 12 years ago
Closed 12 years ago
Implement support for [LenientThis] in WebIDL
Categories
(Core :: DOM: Core & HTML, defect)
Tracking
()
RESOLVED
FIXED
mozilla18
People
(Reporter: bzbarsky, Assigned: bzbarsky)
References
(Blocks 1 open bug)
Details
Attachments
(2 files, 1 obsolete file)
31.24 KB,
patch
|
peterv
:
review+
|
Details | Diff | Splinter Review |
20.54 KB,
patch
|
Details | Diff | Splinter Review |
We'll need this for DOM nodes.
Assignee | ||
Comment 1•12 years ago
|
||
This has a slight conflict with bug 742191 that I can deal with if that lands first.
Attachment #660129 -
Flags: review?(peterv)
Comment 2•12 years ago
|
||
Comment on attachment 660129 [details] [diff] [review] This should do the trick Review of attachment 660129 [details] [diff] [review]: ----------------------------------------------------------------- ::: dom/bindings/Codegen.py @@ +3475,5 @@ > + "JS_SET_RVAL(cx, vp, JS::UndefinedValue());\n" > + "return true;") > + else: > + unwrapFailureCode = None > + name = "genericLenientGetter" if lenientThis else "genericGetter" I'd just set name in the if/else above. @@ +3527,5 @@ > + "MOZ_ASSERT(!JS_IsExceptionPending(cx));\n" > + "return true;") > + else: > + unwrapFailureCode = None > + name = "genericLenientSetter" if lenientThis else "genericSetter" Same here. @@ +3528,5 @@ > + "return true;") > + else: > + unwrapFailureCode = None > + name = "genericLenientSetter" if lenientThis else "genericSetter" > + CGAbstractBindingMethod.__init__(self, descriptor, name, args, unwrapFailureCode) Long line? (You wrapped it above) ::: dom/bindings/parser/WebIDL.py @@ +1997,5 @@ > + elif name == "LenientThis": > + if self.isStatic(): > + raise WebIDLError("[LenientThis] is only allowed on non-static " > + "attributes", [self.location]) > + self.lenientThis = True Do we need to check list to make sure no arguments where specified? (I guess we don't check anywhere else either :-/)
Attachment #660129 -
Flags: review?(peterv) → review+
Assignee | ||
Comment 3•12 years ago
|
||
That last comment above is about stuff like [LenientThis=foo], which is not allowed. I'll add a check for it, and a test.
Assignee | ||
Comment 4•12 years ago
|
||
I got a bit carried away with the changes to check for lack of arguments and have better error reportings for issues with extended attributes... I'll attach an interdiff so you can just review that
Attachment #660244 -
Flags: review?(peterv)
Assignee | ||
Updated•12 years ago
|
Attachment #660129 -
Attachment is obsolete: true
Assignee | ||
Comment 5•12 years ago
|
||
Comment 6•12 years ago
|
||
Comment on attachment 660244 [details] [diff] [review] With review comments addressed Review of attachment 660244 [details] [diff] [review]: ----------------------------------------------------------------- ::: dom/bindings/parser/WebIDL.py @@ +348,2 @@ > raise WebIDLError("[TreatNullAs] must take the identifier " > "EmptyString", [self.location]) Maybe make this |"'EmptyString', not '" + value + "'"| and drop the print? @@ +661,5 @@ > elif identifier == "NoInterfaceObject": > + if not attr.noArguments(): > + raise WebIDLError("[NoInterfaceObject] must take no arguments", > + [attr.location]) > + Trailing whitespace. @@ +2513,5 @@ > + self._tuple = tuple > + > + def identifier(self): > + return self._tuple[0] > + Trailing whitespace. @@ +2518,5 @@ > + def noArguments(self): > + return len(self._tuple) == 1 > + > + def hasValue(self): > + return len(self._tuple) == 2 and isinstance(self._tuple[1], str) So i guess this means "has an identifier as the value", it seems like the named argument list would also be a value but this won't return it? @@ +2529,5 @@ > + return (len(self._tuple) == 2 and isinstance(self._tuple[1], list) or > + len(self._tuple) == 3) > + > + def args(self): > + assert(self.hasArgs) self.hasArgs()? ::: dom/bindings/parser/tests/test_extended_attributes.py @@ +29,5 @@ > + > + results = parser.finish() > + harness.ok(results[0].members[0].hasLenientThis(), > + "Should have a lenient this") > + Trailing whitespace. @@ +59,5 @@ > + harness.ok(results[0].members[0].signatures()[0][1][0].clamp, > + "Should be clamped") > + harness.ok(not results[0].members[1].signatures()[0][1][0].clamp, > + "Should not be clamped") > + Trailing whitespace. @@ +73,5 @@ > + except: > + threw = True > + > + harness.ok(threw, "[Clamp] must take no arguments") > + Trailing whitespace. @@ +103,5 @@ > + except: > + threw = True > + > + harness.ok(threw, "[EnforceRange] must take no arguments") > + Trailing whitespace.
Attachment #660244 -
Flags: review?(peterv) → review+
Assignee | ||
Comment 7•12 years ago
|
||
> Maybe make this |"'EmptyString', not '" + value + "'"| and drop the print? Fixed. Good catch on the print. That should not have been there. > So i guess this means "has an identifier as the value" It can be an identifier or a string (e.g. in the [Pref] case). > it seems like the named argument list would also be a value but this won't return it? That's correct. > self.hasArgs()? Yes. I fixed the whitespace nits. https://hg.mozilla.org/integration/mozilla-inbound/rev/83380c25f756
Flags: in-testsuite+
Whiteboard: [need review]
Target Milestone: --- → mozilla18
Comment 8•12 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/83380c25f756
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Updated•5 years ago
|
Component: DOM → DOM: Core & HTML
You need to log in
before you can comment on or make changes to this bug.
Description
•