Commit e00664d3 authored by Tsuyoshi Horo's avatar Tsuyoshi Horo Committed by Commit Bot

Make manifest section of bundled exchanges optional

Spec side PR: https://github.com/WICG/webpackage/pull/505

TBR=palmer@chromium.org

Bug: 969596
Change-Id: I862fd24c2b3d8a4b237d0852829361dcf9cdde40
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1861614Reviewed-by: default avatarTsuyoshi Horo <horo@chromium.org>
Reviewed-by: default avatarKunihiko Sakamoto <ksakamoto@chromium.org>
Commit-Queue: Tsuyoshi Horo <horo@chromium.org>
Cr-Commit-Position: refs/heads/master@{#706749}
parent 1a4e7aff
...@@ -596,16 +596,12 @@ class BundledExchangesParser::MetadataParser ...@@ -596,16 +596,12 @@ class BundledExchangesParser::MetadataParser
// Step 23. "Assert: metadata has an entry with the key "primaryUrl"." // Step 23. "Assert: metadata has an entry with the key "primaryUrl"."
DCHECK(!metadata_->primary_url.is_empty()); DCHECK(!metadata_->primary_url.is_empty());
// Step 24. "If metadata doesn't have entries with keys "requests" and // Step 24. "If metadata doesn't have an entry with the key "requests",
// "manifest", return a "format error" with fallbackUrl." // return a "format error" with fallbackUrl."
if (metadata_->requests.empty()) { if (metadata_->requests.empty()) {
RunErrorCallbackAndDestroy("Bundle must have an index section."); RunErrorCallbackAndDestroy("Bundle must have an index section.");
return; return;
} }
if (metadata_->manifest_url.is_empty()) {
RunErrorCallbackAndDestroy("Bundle must have a manifest URL.");
return;
}
// Step 25. "Return metadata." // Step 25. "Return metadata."
RunSuccessCallbackAndDestroy(); RunSuccessCallbackAndDestroy();
......
...@@ -635,7 +635,8 @@ TEST_F(BundledExchangeParserTest, NoManifest) { ...@@ -635,7 +635,8 @@ TEST_F(BundledExchangeParserTest, NoManifest) {
"payload"); "payload");
TestDataSource data_source(builder.CreateBundle()); TestDataSource data_source(builder.CreateBundle());
ExpectFormatErrorWithFallbackURL(ParseBundle(&data_source)); mojom::BundleMetadataPtr metadata = ParseBundle(&data_source).first;
ASSERT_TRUE(metadata);
} }
TEST_F(BundledExchangeParserTest, InvalidManifestURL) { TEST_F(BundledExchangeParserTest, InvalidManifestURL) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment