зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1689147 - Part 1: Add extended attribute syntax to IPDL, r=mccr8
Differential Revision: https://phabricator.services.mozilla.com/D103366
This commit is contained in:
Родитель
a9371fd893
Коммит
63fd915bfb
|
@ -13,7 +13,7 @@ include CacheTypes;
|
|||
|
||||
include "ipc/ErrorIPCUtils.h";
|
||||
|
||||
using moveonly mozilla::ErrorResult from "mozilla/ErrorResult.h";
|
||||
[MoveOnly] using mozilla::ErrorResult from "mozilla/ErrorResult.h";
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
|
|
@ -35,7 +35,7 @@ using class mozilla::dom::indexedDB::KeyPath
|
|||
using mozilla::dom::quota::PersistenceType
|
||||
from "mozilla/dom/quota/PersistenceType.h";
|
||||
|
||||
using moveonly mozilla::SerializedStructuredCloneBuffer
|
||||
[MoveOnly] using mozilla::SerializedStructuredCloneBuffer
|
||||
from "mozilla/ipc/SerializedStructuredCloneBuffer.h";
|
||||
|
||||
namespace mozilla {
|
||||
|
|
|
@ -21,7 +21,7 @@ include ProtocolTypes;
|
|||
|
||||
using struct mozilla::void_t from "mozilla/ipc/IPCCore.h";
|
||||
|
||||
using moveonly struct mozilla::SerializedStructuredCloneBuffer
|
||||
[MoveOnly] using struct mozilla::SerializedStructuredCloneBuffer
|
||||
from "mozilla/ipc/SerializedStructuredCloneBuffer.h";
|
||||
|
||||
using class mozilla::dom::LoadingSessionHistoryInfo
|
||||
|
@ -39,15 +39,15 @@ using nsSizeMode from "nsIWidgetListener.h";
|
|||
using ScrollbarPreference from "mozilla/ScrollbarPreferences.h";
|
||||
using hal::ScreenOrientation from "mozilla/HalScreenConfiguration.h";
|
||||
using mozilla::gfx::SurfaceFormat from "mozilla/gfx/Types.h";
|
||||
using refcounted class nsIPrincipal from "nsIPrincipal.h";
|
||||
[RefCounted] using class nsIPrincipal from "nsIPrincipal.h";
|
||||
using mozilla::dom::MaybeDiscardedBrowsingContext from "mozilla/dom/BrowsingContext.h";
|
||||
using refcounted class nsIURI from "nsIURI.h";
|
||||
using refcounted class nsIContentSecurityPolicy from "nsIContentSecurityPolicy.h";
|
||||
using refcounted class nsIInputStream from "mozilla/ipc/IPCStreamUtils.h";
|
||||
using refcounted class nsIReferrerInfo from "nsIReferrerInfo.h";
|
||||
using refcounted class nsIVariant from "nsIVariant.h";
|
||||
[RefCounted] using class nsIURI from "nsIURI.h";
|
||||
[RefCounted] using class nsIContentSecurityPolicy from "nsIContentSecurityPolicy.h";
|
||||
[RefCounted] using class nsIInputStream from "mozilla/ipc/IPCStreamUtils.h";
|
||||
[RefCounted] using class nsIReferrerInfo from "nsIReferrerInfo.h";
|
||||
[RefCounted] using class nsIVariant from "nsIVariant.h";
|
||||
using class mozilla::TimeStamp from "mozilla/TimeStamp.h";
|
||||
using refcounted class mozilla::dom::BrowsingContext from "mozilla/dom/BrowsingContext.h";
|
||||
[RefCounted] using class mozilla::dom::BrowsingContext from "mozilla/dom/BrowsingContext.h";
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
|
|
@ -106,7 +106,7 @@ using struct CollectedInputDataValue from "mozilla/dom/SessionStoreMessageUtils.
|
|||
using mozilla::ContentBlockingNotifier::StorageAccessPermissionGrantedReason from "mozilla/ContentBlockingNotifier.h";
|
||||
using CallerType from "mozilla/dom/BindingDeclarations.h";
|
||||
using mozilla::dom::EmbedderElementEventType from "mozilla/dom/TabMessageTypes.h";
|
||||
using refcounted class nsDocShellLoadState from "nsDocShellLoadState.h";
|
||||
[RefCounted] using class nsDocShellLoadState from "nsDocShellLoadState.h";
|
||||
using mozilla::IntrinsicSize from "nsIFrame.h";
|
||||
using mozilla::AspectRatio from "mozilla/AspectRatio.h";
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ using struct nsRect from "nsRect.h";
|
|||
using CallerType from "mozilla/dom/BindingDeclarations.h";
|
||||
using nsIntRect from "nsRect.h";
|
||||
using mozilla::dom::EmbedderElementEventType from "mozilla/dom/TabMessageTypes.h";
|
||||
using refcounted class nsDocShellLoadState from "nsDocShellLoadState.h";
|
||||
[RefCounted] using class nsDocShellLoadState from "nsDocShellLoadState.h";
|
||||
using mozilla::IntrinsicSize from "nsIFrame.h";
|
||||
using mozilla::AspectRatio from "mozilla/AspectRatio.h";
|
||||
|
||||
|
|
|
@ -83,8 +83,8 @@ include "mozilla/ipc/ByteBufUtils.h";
|
|||
include "mozilla/ipc/URIUtils.h";
|
||||
include "mozilla/PermissionDelegateIPCUtils.h";
|
||||
|
||||
using refcounted class nsIDOMGeoPosition from "nsGeoPositionIPCSerialiser.h";
|
||||
using refcounted class nsIAlertNotification from "mozilla/AlertNotificationIPCSerializer.h";
|
||||
[RefCounted] using class nsIDOMGeoPosition from "nsGeoPositionIPCSerialiser.h";
|
||||
[RefCounted] using class nsIAlertNotification from "mozilla/AlertNotificationIPCSerializer.h";
|
||||
|
||||
using struct ChromePackage from "mozilla/chrome/RegistryMessageUtils.h";
|
||||
using struct SubstitutionMapping from "mozilla/chrome/RegistryMessageUtils.h";
|
||||
|
@ -112,9 +112,9 @@ using mozilla::Telemetry::ScalarAction from "mozilla/TelemetryComms.h";
|
|||
using mozilla::Telemetry::KeyedScalarAction from "mozilla/TelemetryComms.h";
|
||||
using mozilla::Telemetry::DynamicScalarDefinition from "mozilla/TelemetryComms.h";
|
||||
using mozilla::Telemetry::ChildEventData from "mozilla/TelemetryComms.h";
|
||||
using moveonly mozilla::UntrustedModulesData from "mozilla/UntrustedModulesData.h";
|
||||
using moveonly mozilla::ModulePaths from "mozilla/UntrustedModulesData.h";
|
||||
using moveonly mozilla::ModulesMapResult from "mozilla/UntrustedModulesData.h";
|
||||
[MoveOnly] using mozilla::UntrustedModulesData from "mozilla/UntrustedModulesData.h";
|
||||
[MoveOnly] using mozilla::ModulePaths from "mozilla/UntrustedModulesData.h";
|
||||
[MoveOnly] using mozilla::ModulesMapResult from "mozilla/UntrustedModulesData.h";
|
||||
using mozilla::Telemetry::DiscardedData from "mozilla/TelemetryComms.h";
|
||||
using mozilla::CrossProcessMutexHandle from "mozilla/ipc/CrossProcessMutex.h";
|
||||
using mozilla::dom::MaybeDiscardedBrowsingContext from "mozilla/dom/BrowsingContext.h";
|
||||
|
@ -134,7 +134,7 @@ using mozilla::dom::MediaMetadataBase from "mozilla/dom/MediaMetadata.h";
|
|||
using mozilla::dom::MediaSessionAction from "mozilla/dom/MediaSessionBinding.h";
|
||||
using mozilla::dom::MediaSessionPlaybackState from "mozilla/dom/MediaSessionBinding.h";
|
||||
using mozilla::dom::PositionState from "mozilla/dom/MediaSession.h";
|
||||
using refcounted class nsDocShellLoadState from "nsDocShellLoadState.h";
|
||||
[RefCounted] using class nsDocShellLoadState from "nsDocShellLoadState.h";
|
||||
using mozilla::dom::ServiceWorkerShutdownState::Progress from "mozilla/dom/ServiceWorkerShutdownState.h";
|
||||
using mozilla::ContentBlockingNotifier::StorageAccessPermissionGrantedReason from "mozilla/ContentBlockingNotifier.h";
|
||||
using mozilla::ContentBlockingNotifier::BlockingDecision from "mozilla/ContentBlockingNotifier.h";
|
||||
|
@ -142,14 +142,14 @@ using mozilla::ContentBlocking::StorageAccessPromptChoices from "mozilla/Content
|
|||
using JSActorMessageKind from "mozilla/dom/JSActor.h";
|
||||
using JSActorMessageMeta from "mozilla/dom/PWindowGlobal.h";
|
||||
using mozilla::PermissionDelegateHandler::DelegatedPermissionList from "mozilla/PermissionDelegateHandler.h";
|
||||
using refcounted class nsILayoutHistoryState from "nsILayoutHistoryState.h";
|
||||
[RefCounted] using class nsILayoutHistoryState from "nsILayoutHistoryState.h";
|
||||
using class mozilla::dom::SessionHistoryInfo from "mozilla/dom/SessionHistoryEntry.h";
|
||||
using struct nsPoint from "nsPoint.h";
|
||||
using struct mozilla::dom::LoadingSessionHistoryInfo from "mozilla/dom/SessionHistoryEntry.h";
|
||||
using mozilla::PDMFactory::MediaCodecsSupported from "PDMFactory.h";
|
||||
using mozilla::RemoteDecodeIn from "mozilla/RemoteDecoderManagerChild.h";
|
||||
using mozilla::dom::PerformanceTimingData from "mozilla/dom/PerformanceTiming.h";
|
||||
using refcounted mozilla::dom::FeaturePolicy from "mozilla/dom/FeaturePolicy.h";
|
||||
[RefCounted] using mozilla::dom::FeaturePolicy from "mozilla/dom/FeaturePolicy.h";
|
||||
|
||||
union ChromeRegistryItem
|
||||
{
|
||||
|
|
|
@ -11,7 +11,7 @@ include PURLClassifierInfo;
|
|||
|
||||
include "mozilla/ipc/URIUtils.h";
|
||||
|
||||
using refcounted class nsIURI from "nsIURI.h";
|
||||
[RefCounted] using class nsIURI from "nsIURI.h";
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
|
|
@ -22,16 +22,16 @@ include "mozilla/layers/LayersMessageUtils.h";
|
|||
|
||||
using JSActorMessageKind from "mozilla/dom/JSActor.h";
|
||||
using mozilla::gfx::IntRect from "mozilla/gfx/Rect.h";
|
||||
using moveonly mozilla::gfx::PaintFragment from "mozilla/gfx/CrossProcessPaint.h";
|
||||
[MoveOnly] using mozilla::gfx::PaintFragment from "mozilla/gfx/CrossProcessPaint.h";
|
||||
using nscolor from "nsColor.h";
|
||||
using refcounted class nsDocShellLoadState from "nsDocShellLoadState.h";
|
||||
[RefCounted] using class nsDocShellLoadState from "nsDocShellLoadState.h";
|
||||
using mozilla::dom::XPCOMPermitUnloadAction from "nsIContentViewer.h";
|
||||
using mozilla::dom::TabId from "mozilla/dom/ipc/IdType.h";
|
||||
using mozilla::layers::LayersId from "mozilla/layers/LayersTypes.h";
|
||||
using refcounted class nsITransportSecurityInfo from "nsITransportSecurityInfo.h";
|
||||
[RefCounted] using class nsITransportSecurityInfo from "nsITransportSecurityInfo.h";
|
||||
using mozilla::UseCounters from "mozilla/UseCounter.h";
|
||||
using mozilla::dom::MaybeDiscardedWindowContext from "mozilla/dom/WindowContext.h";
|
||||
using refcounted mozilla::dom::FeaturePolicy from "mozilla/dom/FeaturePolicy.h";
|
||||
[RefCounted] using mozilla::dom::FeaturePolicy from "mozilla/dom/FeaturePolicy.h";
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
|
|
@ -12,7 +12,7 @@ include NeckoChannelParams;
|
|||
include DOMTypes;
|
||||
|
||||
using mozilla::dom::WindowContextInitializer from "mozilla/dom/WindowContext.h";
|
||||
using refcounted class nsITransportSecurityInfo from "nsITransportSecurityInfo.h";
|
||||
[RefCounted] using class nsITransportSecurityInfo from "nsITransportSecurityInfo.h";
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
|
|
@ -12,9 +12,9 @@ include protocol PRemoteDecoderManager;
|
|||
include protocol PVideoBridge;
|
||||
|
||||
using mozilla::dom::NativeThreadId from "mozilla/dom/NativeThreadId.h";
|
||||
using moveonly mozilla::UntrustedModulesData from "mozilla/UntrustedModulesData.h";
|
||||
using moveonly mozilla::ModulePaths from "mozilla/UntrustedModulesData.h";
|
||||
using moveonly mozilla::ModulesMapResult from "mozilla/UntrustedModulesData.h";
|
||||
[MoveOnly] using mozilla::UntrustedModulesData from "mozilla/UntrustedModulesData.h";
|
||||
[MoveOnly] using mozilla::ModulePaths from "mozilla/UntrustedModulesData.h";
|
||||
[MoveOnly] using mozilla::ModulesMapResult from "mozilla/UntrustedModulesData.h";
|
||||
using mozilla::PDMFactory::MediaCodecsSupported from "PDMFactory.h";
|
||||
|
||||
namespace mozilla {
|
||||
|
|
|
@ -11,9 +11,9 @@ using mozilla::MediaDataDecoder::ConversionRequired from "PlatformDecoderModule.
|
|||
using mozilla::TrackInfo::TrackType from "MediaInfo.h";
|
||||
using mozilla::layers::LayersBackend from "mozilla/layers/LayersTypes.h";
|
||||
using mozilla::MediaResult from "MediaResult.h";
|
||||
using refcounted class mozilla::ArrayOfRemoteMediaRawData from "mozilla/RemoteMediaData.h";
|
||||
using refcounted class mozilla::ArrayOfRemoteAudioData from "mozilla/RemoteMediaData.h";
|
||||
using refcounted class mozilla::ArrayOfRemoteVideoData from "mozilla/RemoteMediaData.h";
|
||||
[RefCounted] using class mozilla::ArrayOfRemoteMediaRawData from "mozilla/RemoteMediaData.h";
|
||||
[RefCounted] using class mozilla::ArrayOfRemoteAudioData from "mozilla/RemoteMediaData.h";
|
||||
[RefCounted] using class mozilla::ArrayOfRemoteVideoData from "mozilla/RemoteMediaData.h";
|
||||
include PMediaDecoderParams;
|
||||
include LayersSurfaces;
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ include protocol PBrowser;
|
|||
|
||||
include "mozilla/dom/PermissionMessageUtils.h";
|
||||
|
||||
using refcounted class nsIPrincipal from "nsIPrincipal.h";
|
||||
[RefCounted] using class nsIPrincipal from "nsIPrincipal.h";
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
|
|
@ -12,7 +12,7 @@ include InputStreamParams;
|
|||
|
||||
include "mozilla/dom/PermissionMessageUtils.h";
|
||||
|
||||
using refcounted class nsIPrincipal from "nsIPrincipal.h";
|
||||
[RefCounted] using class nsIPrincipal from "nsIPrincipal.h";
|
||||
using mozilla::dom::TabId from "mozilla/dom/ipc/IdType.h";
|
||||
|
||||
namespace mozilla {
|
||||
|
|
|
@ -16,7 +16,7 @@ include NeckoChannelParams;
|
|||
|
||||
include "mozilla/dom/ReferrerInfoUtils.h";
|
||||
|
||||
using refcounted class nsIReferrerInfo from "nsIReferrerInfo.h";
|
||||
[RefCounted] using class nsIReferrerInfo from "nsIReferrerInfo.h";
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
|
|
|
@ -25,8 +25,8 @@ using mozilla::wr::BuiltDisplayListDescriptor from "mozilla/webrender/webrender_
|
|||
using mozilla::wr::IdNamespace from "mozilla/webrender/WebRenderTypes.h";
|
||||
using mozilla::wr::MaybeIdNamespace from "mozilla/webrender/WebRenderTypes.h";
|
||||
using mozilla::wr::ExternalImageKeyPair from "mozilla/webrender/WebRenderTypes.h";
|
||||
using moveonly mozilla::layers::DisplayListData from "mozilla/layers/RenderRootTypes.h";
|
||||
using moveonly mozilla::layers::MaybeTransactionData from "mozilla/layers/RenderRootTypes.h";
|
||||
[MoveOnly] using mozilla::layers::DisplayListData from "mozilla/layers/RenderRootTypes.h";
|
||||
[MoveOnly] using mozilla::layers::MaybeTransactionData from "mozilla/layers/RenderRootTypes.h";
|
||||
using mozilla::layers::FocusTarget from "mozilla/layers/FocusTarget.h";
|
||||
using mozilla::layers::LayersObserverEpoch from "mozilla/layers/LayersTypes.h";
|
||||
using mozilla::layers::TransactionId from "mozilla/layers/LayersTypes.h";
|
||||
|
|
|
@ -55,6 +55,8 @@ class Visitor:
|
|||
t.accept(self)
|
||||
|
||||
def visitUsingStmt(self, using):
|
||||
for a in using.attributes.values():
|
||||
a.accept(self)
|
||||
pass
|
||||
|
||||
def visitProtocol(self, p):
|
||||
|
@ -88,6 +90,9 @@ class Visitor:
|
|||
def visitTypeSpec(self, ts):
|
||||
pass
|
||||
|
||||
def visitAttribute(self, a):
|
||||
pass
|
||||
|
||||
def visitDecl(self, d):
|
||||
pass
|
||||
|
||||
|
@ -193,8 +198,7 @@ class UsingStmt(Node):
|
|||
cxxTypeSpec,
|
||||
cxxHeader=None,
|
||||
kind=None,
|
||||
refcounted=False,
|
||||
moveonly=False,
|
||||
attributes={},
|
||||
):
|
||||
Node.__init__(self, loc)
|
||||
assert not isinstance(cxxTypeSpec, str)
|
||||
|
@ -203,8 +207,7 @@ class UsingStmt(Node):
|
|||
self.type = cxxTypeSpec
|
||||
self.header = cxxHeader
|
||||
self.kind = kind
|
||||
self.refcounted = refcounted
|
||||
self.moveonly = moveonly
|
||||
self.attributes = attributes
|
||||
|
||||
def canBeForwardDeclared(self):
|
||||
return self.isClass() or self.isStruct()
|
||||
|
@ -216,10 +219,10 @@ class UsingStmt(Node):
|
|||
return self.kind == "struct"
|
||||
|
||||
def isRefcounted(self):
|
||||
return self.refcounted
|
||||
return "RefCounted" in self.attributes
|
||||
|
||||
def isMoveonly(self):
|
||||
return self.moveonly
|
||||
return "MoveOnly" in self.attributes
|
||||
|
||||
|
||||
# "singletons"
|
||||
|
@ -372,6 +375,13 @@ class TypeSpec(Node):
|
|||
return str(self.spec)
|
||||
|
||||
|
||||
class Attribute(Node):
|
||||
def __init__(self, loc, name, value):
|
||||
Node.__init__(self, loc)
|
||||
self.name = name
|
||||
self.value = value
|
||||
|
||||
|
||||
class QualifiedId: # FIXME inherit from node?
|
||||
def __init__(self, loc, baseid, quals=[]):
|
||||
assert isinstance(baseid, str)
|
||||
|
|
|
@ -140,7 +140,6 @@ reserved = set(
|
|||
"prio",
|
||||
"protocol",
|
||||
"refcounted",
|
||||
"moveonly",
|
||||
"returns",
|
||||
"struct",
|
||||
"sync",
|
||||
|
@ -160,7 +159,7 @@ tokens = [
|
|||
|
||||
t_COLONCOLON = "::"
|
||||
|
||||
literals = "(){}[]<>;:,?"
|
||||
literals = "(){}[]<>;:,?="
|
||||
t_ignore = " \f\t\v"
|
||||
|
||||
|
||||
|
@ -313,21 +312,14 @@ def p_MaybeRefcounted(p):
|
|||
p[0] = 2 == len(p)
|
||||
|
||||
|
||||
def p_MaybeMoveOnly(p):
|
||||
"""MaybeMoveOnly : MOVEONLY
|
||||
|"""
|
||||
p[0] = 2 == len(p)
|
||||
|
||||
|
||||
def p_UsingStmt(p):
|
||||
"""UsingStmt : USING MaybeRefcounted MaybeMoveOnly UsingKind CxxType FROM STRING"""
|
||||
"""UsingStmt : Attributes USING UsingKind CxxType FROM STRING"""
|
||||
p[0] = UsingStmt(
|
||||
locFromTok(p, 1),
|
||||
refcounted=p[2],
|
||||
moveonly=p[3],
|
||||
kind=p[4],
|
||||
cxxTypeSpec=p[5],
|
||||
cxxHeader=p[7],
|
||||
locFromTok(p, 2),
|
||||
attributes=p[1],
|
||||
kind=p[3],
|
||||
cxxTypeSpec=p[4],
|
||||
cxxHeader=p[6],
|
||||
)
|
||||
|
||||
|
||||
|
@ -582,6 +574,41 @@ def p_MessageTainted(p):
|
|||
p[0] = p[1]
|
||||
|
||||
|
||||
# --------------------
|
||||
# Attributes
|
||||
def p_Attributes(p):
|
||||
"""Attributes : '[' AttributeList ']'
|
||||
|"""
|
||||
p[0] = {}
|
||||
if 4 == len(p):
|
||||
for attr in p[2]:
|
||||
if attr.name in p[0]:
|
||||
_error(attr.loc, "Repeated extended attribute `%s'", attr.name)
|
||||
p[0][attr.name] = attr
|
||||
|
||||
|
||||
def p_AttributeList(p):
|
||||
"""AttributeList : Attribute ',' AttributeList
|
||||
| Attribute"""
|
||||
p[0] = [p[1]]
|
||||
if 4 == len(p):
|
||||
p[0] += p[3]
|
||||
|
||||
|
||||
def p_Attribute(p):
|
||||
"""Attribute : ID AttributeValue"""
|
||||
p[0] = Attribute(locFromTok(p, 1), p[1], p[2])
|
||||
|
||||
|
||||
def p_AttributeValue(p):
|
||||
"""AttributeValue : '=' ID
|
||||
|"""
|
||||
if 1 == len(p):
|
||||
p[0] = None
|
||||
else:
|
||||
p[0] = p[2]
|
||||
|
||||
|
||||
# --------------------
|
||||
# Minor stuff
|
||||
def p_Nested(p):
|
||||
|
|
|
@ -839,6 +839,38 @@ class GatherDecls(TcheckVisitor):
|
|||
self.symtab.declare(d)
|
||||
return d
|
||||
|
||||
# Check that only attributes allowed by an attribute spec are present
|
||||
# within the given attribute dictionary. The spec value may be either
|
||||
# `None`, for a valueless attribute, a list of valid attribute values, or a
|
||||
# callable which returns a truthy value if the attribute is valid.
|
||||
def checkAttributes(self, attributes, spec):
|
||||
for attr in attributes.values():
|
||||
if attr.name not in spec:
|
||||
self.error(attr.loc, "unknown attribute `%s'", attr.name)
|
||||
continue
|
||||
|
||||
aspec = spec[attr.name]
|
||||
if aspec is None:
|
||||
if attr.value is not None:
|
||||
self.error(
|
||||
attr.loc,
|
||||
"unexpected value for valueless attribute `%s'",
|
||||
attr.name,
|
||||
)
|
||||
elif isinstance(aspec, (list, tuple)):
|
||||
if attr.value not in aspec:
|
||||
self.error(
|
||||
attr.loc,
|
||||
"invalid value for attribute `%s', expected one of: %s",
|
||||
attr.name,
|
||||
", ".join(aspec),
|
||||
)
|
||||
elif callable(aspec):
|
||||
if not aspec(attr.value):
|
||||
self.error(attr.loc, "invalid value for attribute `%s'", attr.name)
|
||||
else:
|
||||
raise Exception("INTERNAL ERROR: Invalid attribute spec")
|
||||
|
||||
def visitTranslationUnit(self, tu):
|
||||
# all TranslationUnits declare symbols in global scope
|
||||
if hasattr(tu, "visited"):
|
||||
|
@ -1064,6 +1096,15 @@ class GatherDecls(TcheckVisitor):
|
|||
# there is nothing to typedef. With UniquePtrs, basenames
|
||||
# are generic so typedefs would be illegal.
|
||||
fullname = None
|
||||
|
||||
self.checkAttributes(
|
||||
using.attributes,
|
||||
{
|
||||
"MoveOnly": None,
|
||||
"RefCounted": None,
|
||||
},
|
||||
)
|
||||
|
||||
if fullname == "mozilla::ipc::Shmem":
|
||||
ipdltype = ShmemType(using.type.spec)
|
||||
elif fullname == "mozilla::ipc::ByteBuf":
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
//error: unexpected value for valueless attribute `RefCounted'
|
||||
|
||||
[RefCounted=Invalid] using SomeType from "SomeFile.h";
|
||||
|
||||
struct ExtendedAttrBadValue {};
|
|
@ -0,0 +1,5 @@
|
|||
//error: bad syntax near `]'
|
||||
|
||||
[ ] using SomeType from "SomeFile.h";
|
||||
|
||||
struct ExtendedAttrEmpty {};
|
|
@ -0,0 +1,5 @@
|
|||
//error: Repeated extended attribute `RefCounted'
|
||||
|
||||
[RefCounted, RefCounted] using SomeType from "SomeFile.h";
|
||||
|
||||
struct ExtendedAttrRepeated {};
|
|
@ -0,0 +1,5 @@
|
|||
//error: unknown attribute `InvalidAttribute'
|
||||
|
||||
[InvalidAttribute] using SomeType from "SomeFile.h";
|
||||
|
||||
struct ExtendedAttrUnknown {};
|
|
@ -1,6 +1,6 @@
|
|||
//error: inconsistent moveonly status of type `mozilla::ipc::SomeMoveonlyType`
|
||||
|
||||
using moveonly class mozilla::ipc::SomeMoveonlyType from "SomeFile.h";
|
||||
[MoveOnly] using class mozilla::ipc::SomeMoveonlyType from "SomeFile.h";
|
||||
using class mozilla::ipc::SomeMoveonlyType from "SomeFile.h";
|
||||
|
||||
protocol PInconsistentMoveOnly {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
//error: inconsistent refcounted status of type `mozilla::ipc::SomeRefcountedType`
|
||||
|
||||
using refcounted class mozilla::ipc::SomeRefcountedType from "SomeFile.h";
|
||||
[RefCounted] using class mozilla::ipc::SomeRefcountedType from "SomeFile.h";
|
||||
using class mozilla::ipc::SomeRefcountedType from "SomeFile.h";
|
||||
|
||||
protocol inconsistentRC {
|
||||
|
|
|
@ -2,17 +2,17 @@ using SomeType from "SomeFile.h";
|
|||
using class SomeClass from "SomeFile.h";
|
||||
using struct SomeStruct from "SomeFile.h";
|
||||
|
||||
using refcounted SomeRefcountedType from "SomeFile.h";
|
||||
using refcounted class SomeRefcountedClass from "SomeFile.h";
|
||||
using refcounted struct SomeRefcountedStruct from "SomeFile.h";
|
||||
[RefCounted] using SomeRefcountedType from "SomeFile.h";
|
||||
[RefCounted] using class SomeRefcountedClass from "SomeFile.h";
|
||||
[RefCounted] using struct SomeRefcountedStruct from "SomeFile.h";
|
||||
|
||||
using moveonly SomeMoveonlyType from "SomeFile.h";
|
||||
using moveonly class SomeMoveonlyClass from "SomeFile.h";
|
||||
using moveonly struct SomeMoveonlyStruct from "SomeFile.h";
|
||||
[MoveOnly] using SomeMoveonlyType from "SomeFile.h";
|
||||
[MoveOnly] using class SomeMoveonlyClass from "SomeFile.h";
|
||||
[MoveOnly] using struct SomeMoveonlyStruct from "SomeFile.h";
|
||||
|
||||
using refcounted moveonly SomeRefcountedMoveonlyType from "SomeFile.h";
|
||||
using refcounted moveonly class SomeRefcountedMoveonlyClass from "SomeFile.h";
|
||||
using refcounted moveonly struct SomeRefcountedMoveonlyStruct from "SomeFile.h";
|
||||
[RefCounted, MoveOnly] using SomeRefcountedMoveonlyType from "SomeFile.h";
|
||||
[RefCounted, MoveOnly] using class SomeRefcountedMoveonlyClass from "SomeFile.h";
|
||||
[RefCounted, MoveOnly] using struct SomeRefcountedMoveonlyStruct from "SomeFile.h";
|
||||
|
||||
union SomeUnion
|
||||
{
|
||||
|
|
|
@ -9,7 +9,7 @@ include "mozilla/dom/IPCBlobUtils.h";
|
|||
|
||||
using struct mozilla::void_t from "mozilla/ipc/IPCCore.h";
|
||||
using struct nsPoint from "nsPoint.h";
|
||||
using refcounted class mozilla::dom::BlobImpl from "mozilla/dom/BlobImpl.h";
|
||||
[RefCounted] using class mozilla::dom::BlobImpl from "mozilla/dom/BlobImpl.h";
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ include protocol PNecko;
|
|||
include NeckoChannelParams;
|
||||
|
||||
using mozilla::OriginAttributes from "mozilla/ipc/BackgroundUtils.h";
|
||||
using refcounted class nsIURI from "mozilla/ipc/URIUtils.h";
|
||||
[RefCounted] using class nsIURI from "mozilla/ipc/URIUtils.h";
|
||||
|
||||
namespace mozilla {
|
||||
namespace net {
|
||||
|
|
|
@ -25,8 +25,8 @@ using RequestHeaderTuples from "mozilla/net/PHttpChannelParams.h";
|
|||
using struct nsHttpAtom from "nsHttp.h";
|
||||
using class mozilla::net::nsHttpResponseHead from "nsHttpResponseHead.h";
|
||||
using class mozilla::TimeStamp from "mozilla/TimeStamp.h";
|
||||
using refcounted class nsIPropertyBag2 from "nsIPropertyBag2.h";
|
||||
using refcounted class nsDOMNavigationTiming from "nsDOMNavigationTiming.h";
|
||||
[RefCounted] using class nsIPropertyBag2 from "nsIPropertyBag2.h";
|
||||
[RefCounted] using class nsDOMNavigationTiming from "nsDOMNavigationTiming.h";
|
||||
using nsContentPolicyType from "nsIContentPolicy.h";
|
||||
using nsILoadInfo::CrossOriginEmbedderPolicy from "nsILoadInfo.h";
|
||||
using class mozilla::dom::LoadingSessionHistoryInfo from "mozilla/dom/SessionHistoryEntry.h";
|
||||
|
|
|
@ -38,9 +38,9 @@ include "mozilla/dom/PermissionMessageUtils.h";
|
|||
using mozilla::dom::MaybeDiscardedBrowsingContext from "mozilla/dom/BrowsingContext.h";
|
||||
using class IPC::SerializedLoadContext from "SerializedLoadContext.h";
|
||||
using mozilla::dom::TabId from "mozilla/dom/ipc/IdType.h";
|
||||
using refcounted class nsIInputStream from "mozilla/ipc/IPCStreamUtils.h";
|
||||
using refcounted class nsIURI from "mozilla/ipc/URIUtils.h";
|
||||
using refcounted class nsIPrincipal from "nsIPrincipal.h";
|
||||
[RefCounted] using class nsIInputStream from "mozilla/ipc/IPCStreamUtils.h";
|
||||
[RefCounted] using class nsIURI from "mozilla/ipc/URIUtils.h";
|
||||
[RefCounted] using class nsIPrincipal from "nsIPrincipal.h";
|
||||
|
||||
|
||||
namespace mozilla {
|
||||
|
|
|
@ -37,7 +37,7 @@ using mozilla::Telemetry::DiscardedData from "mozilla/TelemetryComms.h";
|
|||
using base::ProcessId from "base/process.h";
|
||||
using mozilla::OriginAttributes from "mozilla/ipc/BackgroundUtils.h";
|
||||
using PRTime from "prtime.h";
|
||||
using refcounted class nsIURI from "mozilla/ipc/URIUtils.h";
|
||||
[RefCounted] using class nsIURI from "mozilla/ipc/URIUtils.h";
|
||||
using struct nsID from "nsID.h";
|
||||
using mozilla::net::SocketInfo from "mozilla/net/DashboardTypes.h";
|
||||
using mozilla::net::DNSCacheEntries from "mozilla/net/DashboardTypes.h";
|
||||
|
|
|
@ -15,7 +15,7 @@ include "mozilla/net/NeckoMessageUtils.h";
|
|||
using class mozilla::net::nsHttpHeaderArray from "nsHttpHeaderArray.h";
|
||||
using mozilla::net::NetAddr from "mozilla/net/DNS.h";
|
||||
using nsILoadInfo::CrossOriginOpenerPolicy from "nsILoadInfo.h";
|
||||
using refcounted class nsIReferrerInfo from "nsIReferrerInfo.h";
|
||||
[RefCounted] using class nsIReferrerInfo from "nsIReferrerInfo.h";
|
||||
|
||||
namespace mozilla {
|
||||
namespace net {
|
||||
|
|
|
@ -16,7 +16,7 @@ include protocol PChildToParentStream; //FIXME: bug #792908
|
|||
include protocol PParentToChildStream; //FIXME: bug #792908
|
||||
|
||||
using class IPC::SerializedLoadContext from "SerializedLoadContext.h";
|
||||
using refcounted class nsIURI from "mozilla/ipc/URIUtils.h";
|
||||
[RefCounted] using class nsIURI from "mozilla/ipc/URIUtils.h";
|
||||
|
||||
namespace mozilla {
|
||||
namespace net {
|
||||
|
|
Загрузка…
Ссылка в новой задаче