-
Notifications
You must be signed in to change notification settings - Fork 118
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
Update the bundle format #450
Conversation
…in kinds of errors.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm from my side
@@ -289,103 +339,130 @@ steps, taking the `stream` as input. | |||
Note: The `ignoredSections` enables sections that supercede other sections | |||
to be introduced in the future. Implementations that don't implement any | |||
such sections are free to omit the relevant steps. | |||
1. If `sectionOffsets["name"]` exists, return an error. That is, duplicate | |||
sections are forbidden. | |||
1. If `sectionOffsets["name"]` exists, return a "format error". That is, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A "format error" with fallbackUrl
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, done.
`location-in-responses` in responses), return an error. | ||
1. Otherwise, assert that `requests`\[`parsedUrl`] does not exist, and set | ||
`requests`\[`parsedUrl`] to | ||
`MakeRelativeToStream(location-in-responses)`. If that returns an |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Say that location-in-responses
is the second and the third element of responses
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea. Done.
@@ -739,6 +881,14 @@ at <https://www.iana.org/assignments/media-types>. | |||
|
|||
* Required parameters: N/A |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove "N/A"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whoops, done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm % some comments.
This takes the bundle's stream and returns a map ({{INFRA}}) of metadata | ||
containing at least keys named: | ||
This takes the bundle's stream and returns either an error, an error with a | ||
fallback URL (where an error is a "format error" or a "version error"), or a map |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fallback URL == primaryUrl, is that right? Felt it could be more clearly written out somewhere earlier than 3.3, step 21.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed, I've added a statement of that in 2.2.
1. If `metadata` doesn't have entries with keys "requests" and "manifest", | ||
return an error. | ||
1. If `metadata` doesn't have entries with keys "primaryUrl", "requests" and | ||
"manifest", return a "format error" with `fallbackUrl`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At this point we must have primaryUrl (or we can't return an error with fallbackUrl)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, I've moved this to an Assert on the previous line.
- Adds PrimaryURL field to Bundle struct, and adds parsing / serializing code for that - Updates loadMetadata() to reflect the spec changes of #450 - Now it returns a fallback URL if available - Updated spec ref comments
This updates BundledExchangesParser to parse the new bundle format [1]. Changes: - Updated the magic header bytes [2] - Version field is added (we use implementation-specific version string "b1\0\0", which matches gen-bundle's output [3]) - Fallback URL (== Primary URL) field is added - ParseMetadata() returns error type ("format error" or "version error") and fallback URL if available - Updated spec ref comments The structure change of the index section is not reflected yet. It will be updated in the next CL. The test bundle file (hello.wbn) is generated with gen-bundle of github.com/WICG/webpackage revision a3cef2c, which supports the new bundle format except for the new index section structure. [1] WICG/webpackage#450 [2] WICG/webpackage#454 [3] WICG/webpackage#458 Bug: 969596 Change-Id: I95744ed00fdd09d369bb8648d1cdf62ca181d0dd Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1715487 Reviewed-by: Robert Sesek <rsesek@chromium.org> Reviewed-by: Tsuyoshi Horo <horo@chromium.org> Reviewed-by: Takashi Toyoshima <toyoshim@chromium.org> Reviewed-by: Kinuko Yasuda <kinuko@chromium.org> Commit-Queue: Kunihiko Sakamoto <ksakamoto@chromium.org> Cr-Commit-Position: refs/heads/master@{#684200}
This reverts commit d8c863a. Reason for revert: broke build, example: https://logs.chromium.org/logs/chromium/buildbucket/cr-buildbucket.appspot.com/8905916412276160432/+/steps/compile__with_patch_/0/stdout Original change's description: > BundledExchangesParser: Update the bundle format [1/2] > > This updates BundledExchangesParser to parse the new bundle format [1]. > > Changes: > - Updated the magic header bytes [2] > - Version field is added (we use implementation-specific version string > "b1\0\0", which matches gen-bundle's output [3]) > - Fallback URL (== Primary URL) field is added > - ParseMetadata() returns error type ("format error" or "version error") > and fallback URL if available > - Updated spec ref comments > > The structure change of the index section is not reflected yet. It will > be updated in the next CL. > > The test bundle file (hello.wbn) is generated with gen-bundle of > github.com/WICG/webpackage revision a3cef2c, which supports the new > bundle format except for the new index section structure. > > [1] WICG/webpackage#450 > [2] WICG/webpackage#454 > [3] WICG/webpackage#458 > > Bug: 969596 > Change-Id: I95744ed00fdd09d369bb8648d1cdf62ca181d0dd > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1715487 > Reviewed-by: Robert Sesek <rsesek@chromium.org> > Reviewed-by: Tsuyoshi Horo <horo@chromium.org> > Reviewed-by: Takashi Toyoshima <toyoshim@chromium.org> > Reviewed-by: Kinuko Yasuda <kinuko@chromium.org> > Commit-Queue: Kunihiko Sakamoto <ksakamoto@chromium.org> > Cr-Commit-Position: refs/heads/master@{#684200} TBR=horo@chromium.org,kinuko@chromium.org,toyoshim@chromium.org,ksakamoto@chromium.org,rsesek@chromium.org Change-Id: Ifce2b07c15a57a2030887cbfaad5853cbc5af992 No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: 969596 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1737883 Reviewed-by: Andrey Kosyakov <caseq@chromium.org> Commit-Queue: Andrey Kosyakov <caseq@chromium.org> Cr-Commit-Position: refs/heads/master@{#684207}
This adds parsing / serializing code of the index section in the new (b1) format (#450). Currently, multiple responses for a single URL is not supported. After this patch, gen-bundle generates valid bundles in b1 format.
This is a reland of d8c863a PS1 is the original CL, PS2 is the fix for the new callsite of BundleMetadataParseError::New() introduced by https://crrev.com/c/1732518. Original change's description: > BundledExchangesParser: Update the bundle format [1/2] > > This updates BundledExchangesParser to parse the new bundle format [1]. > > Changes: > - Updated the magic header bytes [2] > - Version field is added (we use implementation-specific version string > "b1\0\0", which matches gen-bundle's output [3]) > - Fallback URL (== Primary URL) field is added > - ParseMetadata() returns error type ("format error" or "version error") > and fallback URL if available > - Updated spec ref comments > > The structure change of the index section is not reflected yet. It will > be updated in the next CL. > > The test bundle file (hello.wbn) is generated with gen-bundle of > github.com/WICG/webpackage revision a3cef2c, which supports the new > bundle format except for the new index section structure. > > [1] WICG/webpackage#450 > [2] WICG/webpackage#454 > [3] WICG/webpackage#458 > > Bug: 969596 > Change-Id: I95744ed00fdd09d369bb8648d1cdf62ca181d0dd > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1715487 > Reviewed-by: Robert Sesek <rsesek@chromium.org> > Reviewed-by: Tsuyoshi Horo <horo@chromium.org> > Reviewed-by: Takashi Toyoshima <toyoshim@chromium.org> > Reviewed-by: Kinuko Yasuda <kinuko@chromium.org> > Commit-Queue: Kunihiko Sakamoto <ksakamoto@chromium.org> > Cr-Commit-Position: refs/heads/master@{#684200} Bug: 969596 Change-Id: I1d68a3cb2975fc7856449180517f67131d7b7817 Tbr: toyoshim@chromium.org Tbr: kinuko@chromium.org Tbr: rsesek@chromium.org Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1736907 Reviewed-by: Kunihiko Sakamoto <ksakamoto@chromium.org> Reviewed-by: Takashi Toyoshima <toyoshim@chromium.org> Commit-Queue: Kunihiko Sakamoto <ksakamoto@chromium.org> Cr-Commit-Position: refs/heads/master@{#684216}
This reverts commit d8c863a. Reason for revert: https://findit-for-me.appspot.com/waterfall/failure?url=https://build.chromium.org/p/chromium.linux/builders/Deterministic%20Linux/builds/24310 https://luci-milo.appspot.com/p/chromium/builders/ci/Deterministic%20Linux/24310 Compile failure, List of errors: ../../mojo/public/cpp/bindings/struct_ptr.h:56:18: error: no matching constructor for initialization of 'mojo::StructPtr<data_decoder::mojom::BundleMetadataParseError>::Struct' (aka 'data_decoder::mojom::BundleMetadataParseError') Original change's description: > BundledExchangesParser: Update the bundle format [1/2] > > This updates BundledExchangesParser to parse the new bundle format [1]. > > Changes: > - Updated the magic header bytes [2] > - Version field is added (we use implementation-specific version string > "b1\0\0", which matches gen-bundle's output [3]) > - Fallback URL (== Primary URL) field is added > - ParseMetadata() returns error type ("format error" or "version error") > and fallback URL if available > - Updated spec ref comments > > The structure change of the index section is not reflected yet. It will > be updated in the next CL. > > The test bundle file (hello.wbn) is generated with gen-bundle of > github.com/WICG/webpackage revision a3cef2c, which supports the new > bundle format except for the new index section structure. > > [1] WICG/webpackage#450 > [2] WICG/webpackage#454 > [3] WICG/webpackage#458 > > Bug: 969596 > Change-Id: I95744ed00fdd09d369bb8648d1cdf62ca181d0dd > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1715487 > Reviewed-by: Robert Sesek <rsesek@chromium.org> > Reviewed-by: Tsuyoshi Horo <horo@chromium.org> > Reviewed-by: Takashi Toyoshima <toyoshim@chromium.org> > Reviewed-by: Kinuko Yasuda <kinuko@chromium.org> > Commit-Queue: Kunihiko Sakamoto <ksakamoto@chromium.org> > Cr-Commit-Position: refs/heads/master@{#684200} TBR=horo@chromium.org,kinuko@chromium.org,toyoshim@chromium.org,ksakamoto@chromium.org,rsesek@chromium.org Change-Id: I0e4c550179c4433022646f8ecc27cbdf4983ce87 No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: 969596 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1738036 Reviewed-by: Noel Gordon <noel@chromium.org> Commit-Queue: Noel Gordon <noel@chromium.org> Cr-Commit-Position: refs/heads/master@{#684219}
This reverts commit 3a99193. Reason for revert: This was already reverted at [1] and relanded with a fix at [2]. [1] https://chromium.googlesource.com/chromium/src/+/5bd3e578821d1daacdb92dd5180255a771bf6d6c [2] https://chromium.googlesource.com/chromium/src/+/4f518dc059bb7e0167335a3bb01b47d01bd0da80 Original change's description: > Revert "BundledExchangesParser: Update the bundle format [1/2]" > > This reverts commit d8c863a. > > Reason for revert: > https://findit-for-me.appspot.com/waterfall/failure?url=https://build.chromium.org/p/chromium.linux/builders/Deterministic%20Linux/builds/24310 > > > https://luci-milo.appspot.com/p/chromium/builders/ci/Deterministic%20Linux/24310 > > Compile failure, List of errors: > > ../../mojo/public/cpp/bindings/struct_ptr.h:56:18: error: no matching constructor for initialization of 'mojo::StructPtr<data_decoder::mojom::BundleMetadataParseError>::Struct' (aka 'data_decoder::mojom::BundleMetadataParseError') > > > Original change's description: > > BundledExchangesParser: Update the bundle format [1/2] > > > > This updates BundledExchangesParser to parse the new bundle format [1]. > > > > Changes: > > - Updated the magic header bytes [2] > > - Version field is added (we use implementation-specific version string > > "b1\0\0", which matches gen-bundle's output [3]) > > - Fallback URL (== Primary URL) field is added > > - ParseMetadata() returns error type ("format error" or "version error") > > and fallback URL if available > > - Updated spec ref comments > > > > The structure change of the index section is not reflected yet. It will > > be updated in the next CL. > > > > The test bundle file (hello.wbn) is generated with gen-bundle of > > github.com/WICG/webpackage revision a3cef2c, which supports the new > > bundle format except for the new index section structure. > > > > [1] WICG/webpackage#450 > > [2] WICG/webpackage#454 > > [3] WICG/webpackage#458 > > > > Bug: 969596 > > Change-Id: I95744ed00fdd09d369bb8648d1cdf62ca181d0dd > > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1715487 > > Reviewed-by: Robert Sesek <rsesek@chromium.org> > > Reviewed-by: Tsuyoshi Horo <horo@chromium.org> > > Reviewed-by: Takashi Toyoshima <toyoshim@chromium.org> > > Reviewed-by: Kinuko Yasuda <kinuko@chromium.org> > > Commit-Queue: Kunihiko Sakamoto <ksakamoto@chromium.org> > > Cr-Commit-Position: refs/heads/master@{#684200} > > TBR=horo@chromium.org,kinuko@chromium.org,toyoshim@chromium.org,ksakamoto@chromium.org,rsesek@chromium.org > > Change-Id: I0e4c550179c4433022646f8ecc27cbdf4983ce87 > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: 969596 > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1738036 > Reviewed-by: Noel Gordon <noel@chromium.org> > Commit-Queue: Noel Gordon <noel@chromium.org> > Cr-Commit-Position: refs/heads/master@{#684219} TBR=horo@chromium.org,kinuko@chromium.org,toyoshim@chromium.org,noel@chromium.org,ksakamoto@chromium.org,rsesek@chromium.org Change-Id: I27423f80338576b35506bb8f7e6010fc4c2d2ec7 No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: 969596 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1735802 Reviewed-by: Kunihiko Sakamoto <ksakamoto@chromium.org> Commit-Queue: Kunihiko Sakamoto <ksakamoto@chromium.org> Cr-Commit-Position: refs/heads/master@{#684221}
This updates BundledExchangesParser to parse the new strucure of the index section [1]. After this patch, BundledExchange's index metadata is returned as a map from URL to BundleIndexValue struct, which contains a variants string and one or more response locations. The test bundle file (hello.wbn) is generated with gen-bundle of github.com/WICG/webpackage revision 31e1847, which supports the new index section structure. [1] WICG/webpackage#450 [2] WICG/webpackage#466 Bug: 969596 Change-Id: I026da3e325eec702678a1136181be8f5f3308c68 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1722833 Commit-Queue: Kunihiko Sakamoto <ksakamoto@chromium.org> Reviewed-by: Takashi Toyoshima <toyoshim@chromium.org> Reviewed-by: Robert Sesek <rsesek@chromium.org> Reviewed-by: Kinuko Yasuda <kinuko@chromium.org> Cr-Commit-Position: refs/heads/master@{#684631}
The index section of bundle maps URLs to a Variants value + a list of the responses for each possible Variant-Key (WICG#450), but before this patch gen-bundle could not generate a bundle that have multiple variants for single URL. This patch teaches indexSection.Finalize() to generate entries with non-empty variants-value, based on the responses' Variant and Variant-Key headers [1]. [1] https://tools.ietf.org/html/draft-ietf-httpbis-variants-05
The index section of bundle maps URLs to a Variants value + a list of the responses for each possible Variant-Key (WICG#450). But before this patch gen-bundle could not generate a bundle that have multiple variants for single URL. This patch teaches indexSection.Finalize() to generate entries with non-empty variants-value, based on the responses' Variant and Variant-Key headers [1]. [1] https://tools.ietf.org/html/draft-ietf-httpbis-variants-05
The index section of bundle maps URLs to a Variants value + a list of the responses for each possible Variant-Key (#450). But before this patch gen-bundle could not generate a bundle that have multiple variants for single URL. This patch teaches indexSection.Finalize() to generate entries with non-empty variants-value, based on the responses' Variant and Variant-Key headers [1]. [1] https://tools.ietf.org/html/draft-ietf-httpbis-variants-05
Preview at https://jyasskin.github.io/webpackage/update-bundle-format/draft-yasskin-wpack-bundled-exchanges.html.
Sorry for the late mail: I belatedly realized the IETF deadline is Monday, and it’d be nice to have an update to the bundle format published then. We’ll be able to publish another revision at the beginning of the IETF week.
This update includes: