Commit 4bfc3816 authored by Hiroshige Hayashizaki's avatar Hiroshige Hayashizaki Committed by Commit Bot

[Import Maps] Skip non-array/string values

Bug: 990561
Change-Id: I83d46be4821ce90cce7768c7bcb2b4a1d9e15a7c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1761870
Commit-Queue: Hiroshige Hayashizaki <hiroshige@chromium.org>
Reviewed-by: default avatarKouhei Ueno <kouhei@chromium.org>
Cr-Commit-Position: refs/heads/master@{#688444}
parent bfc2c547
......@@ -234,9 +234,10 @@ ImportMap::SpecifierMap ImportMap::SortAndNormalizeSpecifierMap(
// <spec step="2.6">Otherwise, report a warning to the console that
// addresses must be strings, arrays, or null.</spec>
AddIgnoredValueMessage(logger, entry.first, "Invalid value type.");
// TODO(hiroshige): Return here. Currently an empty list is set, while
// according to the spec no value should be set.
break;
// By continuing here, we leave |normalized[normalized_specifier_key]|
// unset, and continue processing.
continue;
case JSONValue::ValueType::kTypeString: {
// <spec step="2.3">If value is a string, then set
......
......@@ -4,7 +4,7 @@ FAIL Mismatching the top-level schema / should throw for top-level non-objects a
FAIL Mismatching the top-level schema / should throw if imports is a non-object assert_throws: function "() => parseFromString(input, baseURL)" did not throw
FAIL Mismatching the top-level schema / should throw if scopes is a non-object assert_throws: function "() => parseFromString(input, baseURL)" did not throw
FAIL Mismatching the top-level schema / should ignore unspecified top-level entries assert_object_equals: expected property "0" missing
FAIL Mismatching the specifier map schema / should ignore entries where the address is not a string, array, or null assert_equals: expected "{\"bar\":[\"https://example.com/\"]}" but got "{\"bar\":[\"https://example.com/\"],\"foo\":[]}"
PASS Mismatching the specifier map schema / should ignore entries where the address is not a string, array, or null
PASS Mismatching the specifier map schema / should ignore entries where the specifier key is an empty string
PASS Mismatching the specifier map schema / should ignore members of an address array that are not strings
FAIL Mismatching the specifier map schema / should throw if a scope's value is not an object assert_throws: function "() => parseFromString(input, baseURL)" did not throw
......
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