Closed Bug 676857 Opened 8 years ago Closed 8 years ago

Make it a compile-time error to have a script-implementable interface with more methods than xptcall stubs can handle

Categories

(Core :: XPCOM, defect)

x86
macOS
defect
Not set

Tracking

()

RESOLVED FIXED
mozilla8

People

(Reporter: bzbarsky, Assigned: jcranmer)

Details

Attachments

(1 file, 1 obsolete file)

xptcall is capped at something like 249 methods.  I ran into that today with some DOM interfaces and orange builds.... but that code should just have not compiled instead of dying on pure virtual calls, imo.
I have a patch which:
1. Causes an error with xpidl
2. Prevents the interface from being loaded with xpt

(un)Fortunately, nsIDOMCSS2Properties has 469 methods on my machine, so it's a good check to make sure that we actually fail hard in these cases.
Attached patch First cut (obsolete) — Splinter Review
This is a first cut at the bug. bz suggested over IRC that I elide the check in case of builtinclass interfaces. Since the real problem is over whether or not in can be stubbed, I'm also going to track down the stub generation code and make that fail.
Assignee: nobody → Pidgeot18
Status: NEW → ASSIGNED
http://dxr.mozilla.org/mozilla/mozilla-central/xpcom/reflect/xptcall/src/xptcall.cpp.html#l69

Builtinclasses already fail the stub generation, so there shouldn't be a problem to failing to load that xpt file.
Attached patch Patch, version 1Splinter Review
This omits the error in case of builtinclass.
Attachment #551089 - Attachment is obsolete: true
Attachment #551103 - Flags: review?(benjamin)
(In reply to Boris Zbarsky (:bz) from comment #0)
> xptcall is capped at something like 249 methods.  I ran into that today with
> some DOM interfaces and orange builds.... but that code should just have not
> compiled instead of dying on pure virtual calls, imo.

When you say 'xptcall' is capped, you mean the stubs, and not NS_InvokeByIndex, right?
I mean the stubs, yes.
Summary: Make it a compile-time error to have an interface with more methods than xptcall can handle → Make it a compile-time error to have an interface with more methods than xptcall stubs can handle
Summary: Make it a compile-time error to have an interface with more methods than xptcall stubs can handle → Make it a compile-time error to have a script-implementable interface with more methods than xptcall stubs can handle
Attachment #551103 - Flags: review?(benjamin) → review+
Keywords: checkin-needed
Just a few days, and I can't import this to m-i atm, clearing checkin-needed until patch is updated.
Keywords: checkin-needed
I refreshed the patch and pushed to mozilla-inbound...
Whiteboard: [inbound]
http://hg.mozilla.org/mozilla-central/rev/16107d140423
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Whiteboard: [inbound]
Target Milestone: --- → mozilla8
You need to log in before you can comment on or make changes to this bug.