Skip to content

Commit

Permalink
Bug 1814686 - Part 1b: Add nullable annotations to refcounted types i…
Browse files Browse the repository at this point in the history
…n ipdl, r=ipc-reviewers,mccr8

Manual changes to make all refcounted types be marked as `nullable` after the
changes in part 1a. This was done without any investigation into whether the
actual types want to be nullable, in order to avoid code changes.

Differential Revision: https://phabricator.services.mozilla.com/D168889
  • Loading branch information
mystor committed Mar 20, 2023
1 parent 9e5c372 commit c4bc184
Show file tree
Hide file tree
Showing 35 changed files with 261 additions and 261 deletions.
2 changes: 1 addition & 1 deletion accessible/ipc/DocAccessibleTypes.ipdlh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace a11y {
struct CacheData
{
uint64_t ID;
AccAttributes Fields;
nullable AccAttributes Fields;
};

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ namespace a11y {
struct TextAttributesRun {
nsString Text;
uint64_t ContainerID;
AccAttributes TextAttributes;
nullable AccAttributes TextAttributes;
};


Expand Down
12 changes: 6 additions & 6 deletions accessible/ipc/other/PDocAccessible.ipdl
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ struct AccessibleData
AccType Type;
AccGenericType GenericTypes;
uint8_t RoleMapEntryIndex;
AccAttributes CacheFields;
nullable AccAttributes CacheFields;
};

union OriginDocument
Expand All @@ -55,7 +55,7 @@ struct BatchData
double MinValue;
double MaxValue;
double Step;
AccAttributes Attributes;
nullable AccAttributes Attributes;
};

struct ShowEventData
Expand Down Expand Up @@ -167,7 +167,7 @@ child:
[Nested=inside_sync] sync Value(uint64_t aID) returns(nsString value);
[Nested=inside_sync] sync Help(uint64_t aID) returns(nsString help);
[Nested=inside_sync] sync Description(uint64_t aID) returns(nsString desc);
[Nested=inside_sync] sync Attributes(uint64_t aID) returns(AccAttributes attributes);
[Nested=inside_sync] sync Attributes(uint64_t aID) returns(nullable AccAttributes attributes);
[Nested=inside_sync] sync RelationByType(uint64_t aID, uint32_t aRelationType)
returns(uint64_t[] targets);
[Nested=inside_sync] sync Relations(uint64_t aID) returns(RelationTargets[] relations);
Expand Down Expand Up @@ -200,8 +200,8 @@ child:
[Nested=inside_sync] sync CharAt(uint64_t aID, int32_t aOffset) returns(uint16_t aChar);

[Nested=inside_sync] sync TextAttributes(uint64_t aID, bool aIncludeDefAttrs, int32_t aOffset)
returns(AccAttributes aAttributes, int32_t aStartOffset, int32_t aEndOffset);
[Nested=inside_sync] sync DefaultTextAttributes(uint64_t aID) returns(AccAttributes aAttributes);
returns(nullable AccAttributes aAttributes, int32_t aStartOffset, int32_t aEndOffset);
[Nested=inside_sync] sync DefaultTextAttributes(uint64_t aID) returns(nullable AccAttributes aAttributes);

[Nested=inside_sync] sync TextBounds(uint64_t aID, int32_t aStartOffset, int32_t aEndOffset,
uint32_t aCoordType)
Expand Down Expand Up @@ -357,7 +357,7 @@ child:
/*
* Verify the cache. Used for testing purposes.
*/
async VerifyCache(uint64_t aID, uint64_t aCacheDomain, AccAttributes aFields);
async VerifyCache(uint64_t aID, uint64_t aCacheDomain, nullable AccAttributes aFields);

};

Expand Down
4 changes: 2 additions & 2 deletions accessible/ipc/win/PDocAccessible.ipdl
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ struct AccessibleData
AccType Type;
AccGenericType GenericTypes;
uint8_t RoleMapEntryIndex;
AccAttributes CacheFields;
nullable AccAttributes CacheFields;
};

struct ShowEventData
Expand Down Expand Up @@ -145,7 +145,7 @@ child:
/*
* Verify the cache. Used for testing purposes.
*/
async VerifyCache(uint64_t aID, uint64_t aCacheDomain, AccAttributes aFields);
async VerifyCache(uint64_t aID, uint64_t aCacheDomain, nullable AccAttributes aFields);

async DoActionAsync(uint64_t aID, uint8_t aIndex);

Expand Down
2 changes: 1 addition & 1 deletion dom/cache/CacheTypes.ipdlh
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ struct CacheResponse
HeadersEntry[] headers;
HeadersGuardEnum headersGuard;
CacheReadStream? body;
nsITransportSecurityInfo securityInfo;
nullable nsITransportSecurityInfo securityInfo;
PrincipalInfo? principalInfo;
uint32_t paddingInfo;
int64_t paddingSize;
Expand Down
4 changes: 2 additions & 2 deletions dom/fetch/FetchTypes.ipdlh
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ struct ParentToParentStream {
};

union ParentToChildStream {
RemoteLazyInputStream;
nullable RemoteLazyInputStream;
IPCStream;
};

Expand Down Expand Up @@ -85,7 +85,7 @@ struct InternalResponseMetadata {
HeadersEntry[] headers;
nsresult errorCode;
nsCString alternativeDataType;
nsITransportSecurityInfo securityInfo;
nullable nsITransportSecurityInfo securityInfo;
PrincipalInfo? principalInfo;
nsCString bodyBlobURISpec;
nsString bodyLocalPath;
Expand Down
2 changes: 1 addition & 1 deletion dom/file/ipc/IPCBlob.ipdlh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ union RemoteLazyStream
{
// Parent to Child: The child will receive a RemoteLazyInputStream. Nothing
// can be done with it except retrieving the size.
RemoteLazyInputStream;
nullable RemoteLazyInputStream;

// Child to Parent: Normal serialization.
IPCStream;
Expand Down
42 changes: 20 additions & 22 deletions dom/ipc/DOMTypes.ipdlh
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ using mozilla::dom::MaybeDiscardedBrowsingContext from "mozilla/dom/BrowsingCont
[RefCounted] using class nsIReferrerInfo from "nsIReferrerInfo.h";
[RefCounted] using class nsIVariant from "nsIVariant.h";
using mozilla::TimeStamp from "mozilla/TimeStamp.h";
[RefCounted] using class mozilla::dom::BrowsingContext from "mozilla/dom/BrowsingContext.h";
[RefCounted] using class mozilla::RemoteLazyInputStream from "mozilla/RemoteLazyInputStream.h";
[MoveOnly] using class mozilla::ipc::BigBuffer from "mozilla/ipc/BigBuffer.h";

Expand Down Expand Up @@ -192,9 +191,9 @@ struct FeaturePolicyInfo
nsString[] inheritedDeniedFeatureNames;
nsString[] attributeEnabledFeatureNames;
nsString declaredString;
nsIPrincipal defaultOrigin;
nsIPrincipal selfOrigin;
nsIPrincipal srcOrigin;
nullable nsIPrincipal defaultOrigin;
nullable nsIPrincipal selfOrigin;
nullable nsIPrincipal srcOrigin;
};

/**
Expand Down Expand Up @@ -272,24 +271,24 @@ struct PerformanceInfo

struct DocShellLoadStateInit
{
nsIURI URI;
nsIURI OriginalURI;
nsIURI ResultPrincipalURI;
nsIPrincipal TriggeringPrincipal;
nsIReferrerInfo ReferrerInfo;
nsIPrincipal PrincipalToInherit;
nsIPrincipal PartitionedPrincipalToInherit;
nsIURI BaseURI;
nullable nsIURI URI;
nullable nsIURI OriginalURI;
nullable nsIURI ResultPrincipalURI;
nullable nsIPrincipal TriggeringPrincipal;
nullable nsIReferrerInfo ReferrerInfo;
nullable nsIPrincipal PrincipalToInherit;
nullable nsIPrincipal PartitionedPrincipalToInherit;
nullable nsIURI BaseURI;
// The Content Security Policy of the load, that is, the CSP of the entity
// responsible for causing the load to occur. Most likely this is the CSP
// of the document that started the load. In case the entity starting the
// load did not use a CSP, then Csp can be null. Please note that this is
// also the CSP that will be applied to the load in case the load
// encounters a server side redirect.
nsIContentSecurityPolicy Csp;
nsIInputStream PostDataStream;
nsIInputStream HeadersStream;
nsIURI UnstrippedURI;
nullable nsIContentSecurityPolicy Csp;
nullable nsIInputStream PostDataStream;
nullable nsIInputStream HeadersStream;
nullable nsIURI UnstrippedURI;
uint64_t LoadIdentifier;
nsString Target;
nsCString TypeHint;
Expand Down Expand Up @@ -319,7 +318,6 @@ struct DocShellLoadStateInit
uint32_t TriggeringSandboxFlags;
int32_t? CancelContentJSEpoch;


bool ResultPrincipalURIIsSome;
bool KeepResultPrincipalURIIfSet;
bool LoadReplace;
Expand Down Expand Up @@ -375,9 +373,9 @@ struct ReplacementChannelConfigInit
ClassOfService classOfService;
bool? privateBrowsing;
nsCString? method;
nsIReferrerInfo referrerInfo;
nullable nsIReferrerInfo referrerInfo;
TimedChannelInfo? timedChannelInfo;
RemoteLazyInputStream uploadStream;
nullable RemoteLazyInputStream uploadStream;
uint64_t uploadStreamLength;
bool uploadStreamHasHeaders;
nsCString? contentType;
Expand All @@ -397,8 +395,8 @@ union IPDLVariantValue
nsID;
nsString;
nsCString;
nsIURI;
nsIPrincipal;
nullable nsIURI;
nullable nsIPrincipal;
};

struct IDPLVariant
Expand All @@ -411,7 +409,7 @@ struct IDPLVariant
struct IPDLProperty
{
nsString name;
nsIVariant value;
nullable nsIVariant value;
};

// Struct with information to show a frame from the parent process.
Expand Down
41 changes: 21 additions & 20 deletions dom/ipc/PBrowser.ipdl
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,8 @@ struct WebProgressData

struct RequestData
{
nsIURI requestURI;
nsIURI originalRequestURI;
nullable nsIURI requestURI;
nullable nsIURI originalRequestURI;
nsCString matchedList;
};

Expand All @@ -136,7 +136,7 @@ struct WebProgressStateChangeData
// this struct is |nsIWebProgress.STATE_STOP|.
nsString contentType;
nsString charset;
nsIURI documentURI;
nullable nsIURI documentURI;
};

struct WebProgressLocationChangeData
Expand All @@ -147,11 +147,11 @@ struct WebProgressLocationChangeData
nsString contentType;
nsString title;
nsString charset;
nsIURI documentURI;
nsIPrincipal contentPrincipal;
nsIPrincipal contentPartitionedPrincipal;
nsIContentSecurityPolicy csp;
nsIReferrerInfo referrerInfo;
nullable nsIURI documentURI;
nullable nsIPrincipal contentPrincipal;
nullable nsIPrincipal contentPartitionedPrincipal;
nullable nsIContentSecurityPolicy csp;
nullable nsIReferrerInfo referrerInfo;
uint64_t? requestContextID;
};

Expand Down Expand Up @@ -531,16 +531,16 @@ parent:

async AccessKeyNotHandled(WidgetKeyboardEvent event);

async RegisterProtocolHandler(nsString scheme, nsIURI handlerURI, nsString title,
nsIURI documentURI);
async RegisterProtocolHandler(nsString scheme, nullable nsIURI handlerURI, nsString title,
nullable nsIURI documentURI);

async OnStateChange(WebProgressData aWebProgressData,
RequestData aRequestData, uint32_t aStateFlags,
nsresult aStatus,
WebProgressStateChangeData? aStateChangeData);

async OnLocationChange(WebProgressData aWebProgressData,
RequestData aRequestData, nsIURI aLocation,
RequestData aRequestData, nullable nsIURI aLocation,
uint32_t aFlags, bool aCanGoBack,
bool aCanGoForward,
WebProgressLocationChangeData? aLocationChangeData);
Expand Down Expand Up @@ -632,7 +632,8 @@ parent:
BigBuffer? visualData,
uint32_t stride, SurfaceFormat format,
LayoutDeviceIntRect dragRect,
nsIPrincipal principal, nsIContentSecurityPolicy csp,
nullable nsIPrincipal principal,
nullable nsIContentSecurityPolicy csp,
CookieJarSettingsArgs cookieJarSettings,
MaybeDiscardedWindowContext sourceWindowContext,
MaybeDiscardedWindowContext sourceTopWindowContext);
Expand Down Expand Up @@ -693,10 +694,10 @@ child:

async CompositorOptionsChanged(CompositorOptions newOptions);

async LoadURL(nsDocShellLoadState loadState, ParentShowInfo info);
async LoadURL(nullable nsDocShellLoadState loadState, ParentShowInfo info);

async CreateAboutBlankContentViewer(nsIPrincipal principal,
nsIPrincipal partitionedPrincipal);
async CreateAboutBlankContentViewer(nullable nsIPrincipal principal,
nullable nsIPrincipal partitionedPrincipal);

async ResumeLoad(uint64_t pendingSwitchID, ParentShowInfo info);

Expand Down Expand Up @@ -844,8 +845,8 @@ child:
* don't need support RealDragEvent with input priority.
*/
async RealDragEvent(WidgetDragEvent aEvent, uint32_t aDragAction,
uint32_t aDropEffect, nsIPrincipal aPrincipal,
nsIContentSecurityPolicy csp);
uint32_t aDropEffect, nullable nsIPrincipal aPrincipal,
nullable nsIContentSecurityPolicy csp);

[Priority=input] async CompositionEvent(WidgetCompositionEvent event);
async NormalPriorityCompositionEvent(WidgetCompositionEvent event);
Expand All @@ -865,7 +866,7 @@ child:
*/
async PasteTransferable(IPCDataTransfer aDataTransfer,
bool aIsPrivateData,
nsIPrincipal aRequestingPrincipal,
nullable nsIPrincipal aRequestingPrincipal,
nsContentPolicyType aContentPolicyType);

async LoadRemoteScript(nsString aURL, bool aRunInGlobalScope);
Expand Down Expand Up @@ -1003,10 +1004,10 @@ parent:
async IsWindowSupportingWebVR(uint64_t aOuterWindowID) returns(bool isSupported);

/** Records a history visit. */
async VisitURI(nsIURI aURI, nsIURI aLastVisitedURI, uint32_t aFlags, uint64_t aBrowserId);
async VisitURI(nullable nsIURI aURI, nullable nsIURI aLastVisitedURI, uint32_t aFlags, uint64_t aBrowserId);

/** Fetches the visited status for an array of URIs (Android-only). */
async QueryVisitedState(nsIURI[] aURIs);
async QueryVisitedState(nullable nsIURI[] aURIs);

/** Create a session store for a browser child. */
async PSessionStore();
Expand Down
2 changes: 1 addition & 1 deletion dom/ipc/PBrowserBridge.ipdl
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ parent:
async BeginDestroy();

// DocShell messaging.
async LoadURL(nsDocShellLoadState aLoadState);
async LoadURL(nullable nsDocShellLoadState aLoadState);
async ResumeLoad(uint64_t aPendingSwitchID);

// Out of process rendering.
Expand Down
Loading

0 comments on commit c4bc184

Please sign in to comment.