Closed
Bug 981036
Opened 11 years ago
Closed 11 years ago
Disallow calling WebIDL constructors as functions for system callers in non-release builds
Categories
(Core :: DOM: Core & HTML, defect)
Tracking
()
RESOLVED
FIXED
mozilla30
People
(Reporter: bzbarsky, Assigned: bzbarsky)
References
Details
(Keywords: addon-compat, dev-doc-needed)
Attachments
(1 file)
8.19 KB,
patch
|
bholley
:
review+
|
Details | Diff | Splinter Review |
+++ This bug was initially created as a clone of Bug #979591 +++
Let's just do this in nightly/aurora for now
Assignee | ||
Comment 1•11 years ago
|
||
Attachment #8387794 -
Flags: review?(bobbyholley)
Assignee | ||
Updated•11 years ago
|
Whiteboard: [need review]
Comment 2•11 years ago
|
||
Comment on attachment 8387794 [details] [diff] [review]
Disallow calling DOM constructors as functions in non-release builds.
Review of attachment 8387794 [details] [diff] [review]:
-----------------------------------------------------------------
::: dom/bindings/Codegen.py
@@ +1200,5 @@
> + name = self._ctor.identifier.name
> + if name != "constructor":
> + ctorName = name
> + else:
> + ctorName = self.descriptor.interface.identifier.name
I don't quite follow this part, or why you need to pass this name to CGMethodCall, but I'll defer to you on this one.
Attachment #8387794 -
Flags: review?(bobbyholley) → review+
Assignee | ||
Comment 3•11 years ago
|
||
> I don't quite follow this part, or why you need to pass this name to CGMethodCall
Just to get nicer error reporting. For unnamed webidl constructors, identifier.name is "constructor"; for named ones it's the actual name. So for Event if I want "Event" instead of "constructor" I need self.descriptor.interface.identifier.name, but for Image if I want "Image" instead of "HTMLImageElement" I need self._ctor.identifier.name.
And CGMethodCall uses this string for some error reporting as well (e.g. the "not enough arguments" case), so I figured I might as well share it.
Comment 4•11 years ago
|
||
(In reply to Boris Zbarsky [:bz] from comment #3)
> > I don't quite follow this part, or why you need to pass this name to CGMethodCall
>
> Just to get nicer error reporting. For unnamed webidl constructors,
> identifier.name is "constructor"; for named ones it's the actual name. So
> for Event if I want "Event" instead of "constructor" I need
> self.descriptor.interface.identifier.name, but for Image if I want "Image"
> instead of "HTMLImageElement" I need self._ctor.identifier.name.
I see. It might be nice to comment that.
Assignee | ||
Comment 5•11 years ago
|
||
Added a comment, and pushed https://hg.mozilla.org/integration/mozilla-inbound/rev/2045471633ac
Flags: in-testsuite?
Whiteboard: [need review]
Assignee | ||
Comment 6•11 years ago
|
||
> Added a comment
Except failed to qref.
https://hg.mozilla.org/integration/mozilla-inbound/rev/da877497bf3e
Comment 7•11 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/2045471633ac
https://hg.mozilla.org/mozilla-central/rev/da877497bf3e
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla30
Comment 8•11 years ago
|
||
Hm. Is there some reason that this can't be a warning rather than an error for at least one release cycle? This is going to break a lot of add-ons.
Assignee | ||
Comment 9•11 years ago
|
||
Kris, you mean _has_ broken a lot of addons? This is already on all the channels where it matters... Have there been reports of broken addons? I'd love to see them!
Are you perhaps confusing this bug and bug 979591?
Comment 10•11 years ago
|
||
Well, it's broken several of my add-ons. It's hard to find out how many others are affected from MXR, in this case, but given how long this was allowed, and the fact that even core code was broken by it, it would have been nice to start with a warning rather than an error in the first place.
Assignee | ||
Comment 11•11 years ago
|
||
That's fair, but note that this is why the patch is nightly-and-aurora only... The idea was to find addons that are affected and get them fixed. Doing that with warnings has not been very effective in the past, unfortunately. :(
Comment 12•11 years ago
|
||
(In reply to Boris Zbarsky [:bz] from comment #11)
> That's fair, but note that this is why the patch is nightly-and-aurora
> only... The idea was to find addons that are affected and get them fixed.
> Doing that with warnings has not been very effective in the past,
> unfortunately. :(
Yeah. The kind of addons authors that respond to deprecation warnings are also the kind that instant fix their addons when they're broken. And it's not like this requires any complicated refactoring - it's a purely syntactic change.
Updated•6 years ago
|
Component: DOM → DOM: Core & HTML
You need to log in
before you can comment on or make changes to this bug.
Description
•