Bug 1674080 - Add some required includes to the bindings generator. r=peterv

Differential Revision: https://phabricator.services.mozilla.com/D95147
This commit is contained in:
Simon Giesecke 2021-03-11 13:38:31 +00:00
Родитель 692373c939
Коммит c153cfe233
4 изменённых файлов: 26 добавлений и 15 удалений

Просмотреть файл

@ -26,12 +26,7 @@
#include <type_traits>
// XXX(Bug 1674080) Remove this and let Codegen.py generate it instead when
// needed.
#include "js/Value.h"
// XXX(Bug 1674080) Not really needed here, include should be generated by
// Codegen.py
#include "mozilla/RootedOwningNonNull.h"
#include "mozilla/RootedRefPtr.h"

Просмотреть файл

@ -46,11 +46,6 @@
#include "nsWrapperCacheInlines.h"
// XXX(Bug 1674080) Remove this and let Codegen.py generate it instead when
// needed.
#include "mozilla/BasePrincipal.h"
#include "nsJSPrincipals.h"
class nsGlobalWindowInner;
class nsGlobalWindowOuter;
class nsIInterfaceRequestor;

Просмотреть файл

@ -16205,6 +16205,7 @@ class CGDescriptor(CGThing):
elif m.getExtendedAttribute("Replaceable"):
cgThings.append(CGSpecializedReplaceableSetter(descriptor, m))
elif m.getExtendedAttribute("LenientSetter"):
# XXX In this case, we need to add an include for mozilla/dom/Document.h to the generated cpp file.
cgThings.append(CGSpecializedLenientSetter(descriptor, m))
if (
not m.isStatic()
@ -17982,7 +17983,9 @@ class CGBindingRoot(CGThing):
"""
def __init__(self, config, prefix, webIDLFile):
bindingHeaders = dict.fromkeys(("mozilla/dom/NonRefcountedDOMObject.h",), True)
bindingHeaders = dict.fromkeys(
("mozilla/dom/NonRefcountedDOMObject.h", "MainThreadUtils.h"), True
)
bindingDeclareHeaders = dict.fromkeys(
(
"mozilla/dom/BindingDeclarations.h",
@ -18022,6 +18025,27 @@ class CGBindingRoot(CGThing):
for d in descriptors
)
def memberNeedsSubjectPrincipal(d, m):
if m.isAttr():
return (
"needsSubjectPrincipal" in d.getExtendedAttributes(m, getter=True)
) or (
not m.readonly
and "needsSubjectPrincipal"
in d.getExtendedAttributes(m, setter=True)
)
return m.isMethod() and "needsSubjectPrincipal" in d.getExtendedAttributes(
m
)
if any(
memberNeedsSubjectPrincipal(d, m)
for d in descriptors
for m in d.interface.members
):
bindingHeaders["mozilla/BasePrincipal.h"] = True
bindingHeaders["nsJSPrincipals.h"] = True
# The conditions for which we generate profiler labels are fairly
# complicated. The check below is a little imprecise to make it simple.
# It includes the profiler header in all cases where it is necessary and
@ -23108,6 +23132,7 @@ class CGEventRoot(CGThing):
[
"%s.h" % interfaceName,
"js/GCAPI.h",
"mozilla/HoldDropJSObjects.h",
"mozilla/dom/Nullable.h",
],
"",

Просмотреть файл

@ -23,10 +23,6 @@
#include "nsStringFwd.h"
#include "nsWrapperCache.h"
// XXX(Bug 1674080) Remove this and let Codegen.py generate it instead when
// needed.
#include "mozilla/HoldDropJSObjects.h"
class PickleIterator;
class nsCycleCollectionTraversalCallback;
class nsIContent;