bindings codegen doesn't include nsContentUtils in all cases where necessary

RESOLVED FIXED in Firefox 45



3 years ago
3 years ago


(Reporter: froydnj, Assigned: froydnj)


Dependency tree / graph

Firefox Tracking Flags

(firefox45 fixed)



(1 attachment)



3 years ago
CacheStorageBinding has this function:

static bool
_constructor(JSContext* cx, unsigned argc, JS::Value* vp)
  JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
  JS::Rooted<JSObject*> obj(cx, &args.callee());
  if (!nsContentUtils::ThreadsafeIsCallerChrome()) {
    return ThrowingConstructor(cx, argc, vp);

which comes from this bit of

because CacheStorage is hasInterfaceObject.  But CacheStorage has a ChromeConstructor:

and we don't check the special ctor() method for whether it's ChromeOnly or not here:

We should fix this (it's possible there are other instances, but this is at least one of the things that makes my bug 1218454 patches fail to compile).

Comment 1

3 years ago
Created attachment 8693909 [details] [diff] [review]
make check for ChromeOnly interfaces for header inclusion more complete

If an interface has a {Chrome,}Constructor(), it doesn't show up as a
normal member.  If the interface has a ChromeConstructor, we need to
include nsContentUtils.h in the generated file for a
ThreadsafeIsCallerChrome check.  There is an existing check for a
descriptor's ChromeOnly-ness in CGBindingRoot; this check is used to
determine whether nsContentUtils.h is included in the generated file..
But the check in descriptorHasChromeOnly doesn't detect
this (ChromeOnly) constructor, and so nsContentUtils.h won't be included
if there are no other ChromeOnly members, or if the interface itself is
not ChromeOnly.

Therefore, we need to take the constructor of the interface (if any)
into account when checking for ChromeOnly-ness.
Attachment #8693909 - Flags: review?(bzbarsky)
Comment on attachment 8693909 [details] [diff] [review]
make check for ChromeOnly interfaces for header inclusion more complete

r=me.  Good catch.
Attachment #8693909 - Flags: review?(bzbarsky) → review+

Comment 4

3 years ago
Last Resolved: 3 years ago
status-firefox45: --- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla45
Blocks: 1230291
See Also: → bug 1247000
You need to log in before you can comment on or make changes to this bug.