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

RESOLVED FIXED in Firefox 45

Status

()

RESOLVED FIXED
3 years ago
3 years ago

People

(Reporter: froydnj, Assigned: froydnj)

Tracking

unspecified
mozilla45
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(firefox45 fixed)

Details

Attachments

(1 attachment)

(Assignee)

Description

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 Codegen.py:

http://mxr.mozilla.org/mozilla-central/source/dom/bindings/Codegen.py#11770

because CacheStorage is hasInterfaceObject.  But CacheStorage has a ChromeConstructor:

http://mxr.mozilla.org/mozilla-central/source/dom/webidl/CacheStorage.webidl#16

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

http://mxr.mozilla.org/mozilla-central/source/dom/bindings/Codegen.py#12960

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).
(Assignee)

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
bugherder
https://hg.mozilla.org/mozilla-central/rev/14ea3aec5d84
Status: NEW → RESOLVED
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.