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

Add network.BytesValue type #472

Merged
merged 4 commits into from
Jul 10, 2023
Merged

Add network.BytesValue type #472

merged 4 commits into from
Jul 10, 2023

Conversation

jgraham
Copy link
Member

@jgraham jgraham commented Jul 5, 2023

This provides a uniform representation of network data that may be UTF-8 text or may be arbitary binary data. Non-UTF-8 data is always encoded as base64 for transport.

This is a backwards-incompatible change since it coverts the network.Cookie and network.Headers types from either having a value or binaryValue field to always having a value field, but the value being an object with a type field to distinguish the variants.


Preview | Diff

index.bs Outdated Show resolved Hide resolved
index.bs Outdated Show resolved Hide resolved
index.bs Outdated Show resolved Hide resolved
@thiagowfx thiagowfx changed the title Add network.BytesValue type Add network.BytesValue type Jul 5, 2023
@jgraham
Copy link
Member Author

jgraham commented Jul 5, 2023

@juliandescottes can you review this?

index.bs Outdated Show resolved Hide resolved
index.bs Show resolved Hide resolved
This provides a uniform representation of network data that may be
UTF-8 text or may be arbitary binary data. Non-UTF-8 data is always
encoded as base64 for transport.

This is a backwards-incompatible change since it coverts the
network.Cookie and network.Headers types from either having a `value`
or `binaryValue` field to always having a `value` field, but the value
being an object with a `type` field to distinguish the variants.
Copy link
Contributor

@juliandescottes juliandescottes left a comment

Choose a reason for hiding this comment

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

Sorry for the delay, some questions about the deserialize/serialize steps, but either I'm misunderstanding it, or it should be easy to address.

index.bs Outdated Show resolved Hide resolved
index.bs Show resolved Hide resolved
index.bs Show resolved Hide resolved
index.bs Outdated
Comment on lines 3601 to 3608
1. If |bytes| matches the <code>network.StringValue</code> production,
let |protocol value| be [=UTF-8 encode=] |bytes|["<code>value</code>"].

1. Otherwise if |bytes| matches the <code>network.Base64Value</code>
production. Let |protocol value| be [=forgiving-base64 decode=]
|bytes|["<code>value</code>"].

1. Return |protocol value|.
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure about the serialization steps? We should not expect bytes to match one of those productions, but rather decide based on whether it's valid UTF 8 or not?

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh wow, yes, this is total nonsense :)

Copy link
Member Author

Choose a reason for hiding this comment

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

Now should be fixed.

jgraham and others added 2 commits July 10, 2023 12:00
Co-authored-by: Julian Descottes <jdescottes@mozilla.com>
Co-authored-by: Thiago Perrotta <tperrotta@chromium.org>
Copy link
Contributor

@juliandescottes juliandescottes left a comment

Choose a reason for hiding this comment

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

Lgtm after the last update.

index.bs Show resolved Hide resolved
index.bs Show resolved Hide resolved
@jgraham jgraham merged commit a492d0d into master Jul 10, 2023
3 checks passed
@jgraham jgraham deleted the network_bytes_value branch July 10, 2023 15:28
github-actions bot added a commit that referenced this pull request Jul 10, 2023
SHA: a492d0d
Reason: push, by jgraham

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants