Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve CDDL syntax #870

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 16 additions & 16 deletions index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -1612,7 +1612,7 @@ session.CapabilityRequest = {
? proxy: session.ProxyConfiguration,
? unhandledPromptBehavior: session.UserPromptHandler,
Extensible
};
}
caugner marked this conversation as resolved.
Show resolved Hide resolved
</pre>

The <code>session.CapabilityRequest</code> type represents a specific set of
Expand Down Expand Up @@ -1660,7 +1660,7 @@ session.ProxyConfiguration = {
session.DirectProxyConfiguration //
session.ManualProxyConfiguration //
session.PacProxyConfiguration //
session.SystemProxyConfiguration //
session.SystemProxyConfiguration
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW, trailing // are also valid per the CDDL grammar (and I don't see any text in the RFC that forbidd them), so if you keep trailing commas, you could keep // for the same reason.

}

session.AutodetectProxyConfiguration = (
Expand Down Expand Up @@ -1695,7 +1695,7 @@ session.PacProxyConfiguration = (
)

session.SystemProxyConfiguration = (
proxyType: "system"
proxyType: "system",
Copy link
Contributor

@OrKoN OrKoN Jan 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@OrKoN Would you suggest adding commas on the last item as well (e.g. behind Extensible)?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In my opinion, this would at least help with future changes along those lines, ensuring that only the added or removed item is affected, rather than modifying an existing one just to add or remove a comma.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we then keep trailing // for the same reason?

Extensible
)

Expand All @@ -1712,7 +1712,7 @@ session.UserPromptHandler = {
? confirm: session.UserPromptHandlerType,
? default: session.UserPromptHandlerType,
? prompt: session.UserPromptHandlerType,
};
}
</pre>

The <code>session.UserPromptHandler</code> type represents the configuration of
Expand Down Expand Up @@ -2262,7 +2262,7 @@ BrowserCommand = (
browser.GetClientWindows //
browser.GetUserContexts //
browser.RemoveUserContext //
browser.SetClientWindowState //
browser.SetClientWindowState
)
</pre>

Expand Down Expand Up @@ -5809,7 +5809,7 @@ network.Cookie = {
sameSite: network.SameSite,
? expiry: js-uint,
Extensible,
};
}
</pre>

The <code>network.Cookie</code> type represents a cookie.
Expand Down Expand Up @@ -5863,7 +5863,7 @@ samesite-flag, which is from [[SAME-SITE-COOKIES]].
network.CookieHeader = {
name: text,
value: network.BytesValue,
};
}
</pre>

The <code>network.CookieHeader</code> type represents the subset of cookie data
Expand Down Expand Up @@ -5905,7 +5905,7 @@ network.FetchTimingInfo = {
responseStart: float,
<!-- TODO responseHeadersEnd: float: Not sure quite what to use for this -->
responseEnd: float,
};
}
</pre>

The <code>network.FetchTimingInfo</code> type represents the time of each part
Expand Down Expand Up @@ -6031,7 +6031,7 @@ network.Initiator = {
? request: network.Request,
? stackTrace: script.StackTrace,
? type: "parser" / "script" / "preflight" / "other"
};
}
</pre>

The <code>network.Initiator</code> type represents the source of a network
Expand Down Expand Up @@ -6115,7 +6115,7 @@ network.RequestData = {
destination: text,
initiatorType: text / null,
timings: network.FetchTimingInfo,
};
}
</pre>

The <code>network.RequestData</code> type represents an ongoing network request.
Expand Down Expand Up @@ -6188,7 +6188,7 @@ To <dfn>get the request data</dfn> given |request|:
<pre class="cddl local-cddl">
network.ResponseContent = {
size: js-uint
};
}
</pre>

The <code>network.ResponseContent</code> type represents the decoded response to
Expand Down Expand Up @@ -6224,7 +6224,7 @@ network.ResponseData = {
bodySize: js-uint / null,
content: network.ResponseContent,
?authChallenges: [*network.AuthChallenge],
};
}
</pre>

The <code>network.ResponseData</code> type represents the response to a network
Expand Down Expand Up @@ -7928,7 +7928,7 @@ used to send custom messages from the [=remote end=] to the [=local end=].
script.ChannelValue = {
type: "channel",
value: script.ChannelProperties,
};
}

script.ChannelProperties = {
channel: script.Channel,
Expand Down Expand Up @@ -7997,7 +7997,7 @@ script.ExceptionDetails = {
lineNumber: js-uint,
stackTrace: script.StackTrace,
text: text,
};
}
</pre>

The <code>script.ExceptionDetails</code> type represents a JavaScript exception.
Expand Down Expand Up @@ -9692,7 +9692,7 @@ To <dfn>get the source</dfn> given |source realm|:
<pre class="cddl remote-cddl">
script.RealmTarget = {
realm: script.Realm
};
}

script.ContextTarget = {
context: browsingContext.BrowsingContext,
Expand All @@ -9702,7 +9702,7 @@ script.ContextTarget = {
script.Target = (
script.ContextTarget /
script.RealmTarget
);
)
</pre>

The <code>script.Target</code> type represents a value that is either a
Expand Down
Loading