From d7cb97a2681a2369ff0b2697a85723280665e8e0 Mon Sep 17 00:00:00 2001 From: Marco Castelluccio Date: Tue, 18 Feb 2020 16:47:06 +0000 Subject: [PATCH] Bug 1614503 [wpt PR 21707] - [Import Maps] Make errors block the whole resolution, Blink-side, a=testonly Automatic update from web-platform-tests [Import Maps] Make errors block the whole resolution, Blink-side Reflects https://github.com/WICG/import-maps/pull/205. This CL updates tests from #205. To match the behavior with the updated spec, this CL turns non-String values into `null` entries (i.e. make whole resolution fail without further fallback), instead of ignoring such entries. Other aspects were already conformant with the updated spec (i.e. weren't matching with the spec before #205). This CL updates (test-only) import maps serialization code so that it matches with the reference implementation, i.e. dump `null` entries as `null` instead of `[]`. This CL also updates spec comments. Bug: 990561, https://github.com/WICG/import-maps/issues/184 Change-Id: Ifa2d04bf20fcef5575c14d135c328730ea09c454 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2037012 Commit-Queue: Hiroshige Hayashizaki Reviewed-by: Kouhei Ueno Cr-Commit-Position: refs/heads/master{#740847} -- wpt-commits: 8767abfffb790e4928ac9433282928caa2357ee8 wpt-pr: 21707 UltraBlame original commit: e620b95565ea737f093567c22c6b8ce07e37b7dc --- .../common/resolving.tentative.html | 9 + .../resources/parsing-addresses-absolute.json | 10 + .../resources/parsing-addresses-invalid.json | 25 + .../common/resources/parsing-addresses.json | 50 + .../parsing-schema-specifier-map.json | 30 + .../resources/parsing-trailing-slashes.json | 6 + .../common/resources/resolving-null.json | 918 ++++++++++++++++++ 7 files changed, 1048 insertions(+) create mode 100644 testing/web-platform/tests/import-maps/common/resources/resolving-null.json diff --git a/testing/web-platform/tests/import-maps/common/resolving.tentative.html b/testing/web-platform/tests/import-maps/common/resolving.tentative.html index c07e6a7b72513..314f098723d02 100644 --- a/testing/web-platform/tests/import-maps/common/resolving.tentative.html +++ b/testing/web-platform/tests/import-maps/common/resolving.tentative.html @@ -168,6 +168,15 @@ . json ' +' +resources +/ +resolving +- +null +. +json +' ] ) { diff --git a/testing/web-platform/tests/import-maps/common/resources/parsing-addresses-absolute.json b/testing/web-platform/tests/import-maps/common/resources/parsing-addresses-absolute.json index d43abda407fad..7d8c873aaa8e8 100644 --- a/testing/web-platform/tests/import-maps/common/resources/parsing-addresses-absolute.json +++ b/testing/web-platform/tests/import-maps/common/resources/parsing-addresses-absolute.json @@ -482,6 +482,16 @@ imports : { " +unparseable2 +" +: +null +" +unparseable3 +" +: +null +" invalidButParseable1 " : diff --git a/testing/web-platform/tests/import-maps/common/resources/parsing-addresses-invalid.json b/testing/web-platform/tests/import-maps/common/resources/parsing-addresses-invalid.json index bf81042f80450..3ad78c48ec8da 100644 --- a/testing/web-platform/tests/import-maps/common/resources/parsing-addresses-invalid.json +++ b/testing/web-platform/tests/import-maps/common/resources/parsing-addresses-invalid.json @@ -107,6 +107,31 @@ imports " : { +" +foo1 +" +: +null +" +foo2 +" +: +null +" +foo3 +" +: +null +" +foo4 +" +: +null +" +foo5 +" +: +null } " scopes diff --git a/testing/web-platform/tests/import-maps/common/resources/parsing-addresses.json b/testing/web-platform/tests/import-maps/common/resources/parsing-addresses.json index 35c3edd545a5b..f0596d3f1e784 100644 --- a/testing/web-platform/tests/import-maps/common/resources/parsing-addresses.json +++ b/testing/web-platform/tests/import-maps/common/resources/parsing-addresses.json @@ -242,6 +242,21 @@ imports " : { +" +dotSlash +" +: +null +" +dotDotSlash +" +: +null +" +slash +" +: +null } " scopes @@ -520,6 +535,41 @@ imports " : { +" +dotSlash1 +" +: +null +" +dotDotSlash1 +" +: +null +" +dotSlash2 +" +: +null +" +dotDotSlash2 +" +: +null +" +slash2 +" +: +null +" +dotSlash3 +" +: +null +" +dotDotSlash3 +" +: +null } " scopes diff --git a/testing/web-platform/tests/import-maps/common/resources/parsing-schema-specifier-map.json b/testing/web-platform/tests/import-maps/common/resources/parsing-schema-specifier-map.json index ff49a26b2240e..f19b984f9f1c0 100644 --- a/testing/web-platform/tests/import-maps/common/resources/parsing-schema-specifier-map.json +++ b/testing/web-platform/tests/import-maps/common/resources/parsing-schema-specifier-map.json @@ -123,6 +123,36 @@ imports : { " +null +" +: +null +" +boolean +" +: +null +" +number +" +: +null +" +object +" +: +null +" +array +" +: +null +" +array2 +" +: +null +" string " : diff --git a/testing/web-platform/tests/import-maps/common/resources/parsing-trailing-slashes.json b/testing/web-platform/tests/import-maps/common/resources/parsing-trailing-slashes.json index 3e1f6f7c2f977..676ab53fc0631 100644 --- a/testing/web-platform/tests/import-maps/common/resources/parsing-trailing-slashes.json +++ b/testing/web-platform/tests/import-maps/common/resources/parsing-trailing-slashes.json @@ -61,6 +61,12 @@ imports " : { +" +trailer +/ +" +: +null } " scopes diff --git a/testing/web-platform/tests/import-maps/common/resources/resolving-null.json b/testing/web-platform/tests/import-maps/common/resources/resolving-null.json new file mode 100644 index 0000000000000..08904fc91f05e --- /dev/null +++ b/testing/web-platform/tests/import-maps/common/resources/resolving-null.json @@ -0,0 +1,918 @@ +{ +" +importMapBaseURL +" +: +" +https +: +/ +/ +example +. +com +/ +app +/ +index +. +html +" +" +baseURL +" +: +" +https +: +/ +/ +example +. +com +/ +js +/ +app +. +mjs +" +" +name +" +: +" +Entries +with +errors +shouldn +' +t +allow +fallback +" +" +tests +" +: +{ +" +No +fallback +to +less +- +specific +prefixes +" +: +{ +" +importMap +" +: +{ +" +imports +" +: +{ +" +null +/ +" +: +" +/ +1 +/ +" +" +null +/ +b +/ +" +: +null +" +null +/ +b +/ +c +/ +" +: +" +/ +1 +/ +2 +/ +" +" +invalid +- +url +/ +" +: +" +/ +1 +/ +" +" +invalid +- +url +/ +b +/ +" +: +" +https +: +/ +/ +: +invalid +- +url +: +/ +" +" +invalid +- +url +/ +b +/ +c +/ +" +: +" +/ +1 +/ +2 +/ +" +" +without +- +trailing +- +slashes +/ +" +: +" +/ +1 +/ +" +" +without +- +trailing +- +slashes +/ +b +/ +" +: +" +/ +x +" +" +without +- +trailing +- +slashes +/ +b +/ +c +/ +" +: +" +/ +1 +/ +2 +/ +" +" +prefix +- +resolution +- +error +/ +" +: +" +/ +1 +/ +" +" +prefix +- +resolution +- +error +/ +b +/ +" +: +" +data +: +text +/ +javascript +/ +" +" +prefix +- +resolution +- +error +/ +b +/ +c +/ +" +: +" +/ +1 +/ +2 +/ +" +} +} +" +expectedResults +" +: +{ +" +null +/ +x +" +: +" +https +: +/ +/ +example +. +com +/ +1 +/ +x +" +" +null +/ +b +/ +x +" +: +null +" +null +/ +b +/ +c +/ +x +" +: +" +https +: +/ +/ +example +. +com +/ +1 +/ +2 +/ +x +" +" +invalid +- +url +/ +x +" +: +" +https +: +/ +/ +example +. +com +/ +1 +/ +x +" +" +invalid +- +url +/ +b +/ +x +" +: +null +" +invalid +- +url +/ +b +/ +c +/ +x +" +: +" +https +: +/ +/ +example +. +com +/ +1 +/ +2 +/ +x +" +" +without +- +trailing +- +slashes +/ +x +" +: +" +https +: +/ +/ +example +. +com +/ +1 +/ +x +" +" +without +- +trailing +- +slashes +/ +b +/ +x +" +: +null +" +without +- +trailing +- +slashes +/ +b +/ +c +/ +x +" +: +" +https +: +/ +/ +example +. +com +/ +1 +/ +2 +/ +x +" +" +prefix +- +resolution +- +error +/ +x +" +: +" +https +: +/ +/ +example +. +com +/ +1 +/ +x +" +" +prefix +- +resolution +- +error +/ +b +/ +x +" +: +null +" +prefix +- +resolution +- +error +/ +b +/ +c +/ +x +" +: +" +https +: +/ +/ +example +. +com +/ +1 +/ +2 +/ +x +" +} +} +" +No +fallback +to +less +- +specific +scopes +" +: +{ +" +importMap +" +: +{ +" +imports +" +: +{ +" +null +" +: +" +https +: +/ +/ +example +. +com +/ +a +" +" +invalid +- +url +" +: +" +https +: +/ +/ +example +. +com +/ +b +" +" +without +- +trailing +- +slashes +/ +" +: +" +https +: +/ +/ +example +. +com +/ +c +/ +" +" +prefix +- +resolution +- +error +/ +" +: +" +https +: +/ +/ +example +. +com +/ +d +/ +" +} +" +scopes +" +: +{ +" +/ +js +/ +" +: +{ +" +null +" +: +null +" +invalid +- +url +" +: +" +https +: +/ +/ +: +invalid +- +url +: +/ +" +" +without +- +trailing +- +slashes +/ +" +: +" +/ +x +" +" +prefix +- +resolution +- +error +/ +" +: +" +data +: +text +/ +javascript +/ +" +} +} +} +" +expectedResults +" +: +{ +" +null +" +: +null +" +invalid +- +url +" +: +null +" +without +- +trailing +- +slashes +/ +x +" +: +null +" +prefix +- +resolution +- +error +/ +x +" +: +null +} +} +" +No +fallback +to +absolute +URL +parsing +" +: +{ +" +importMap +" +: +{ +" +imports +" +: +{ +} +" +scopes +" +: +{ +" +/ +js +/ +" +: +{ +" +https +: +/ +/ +example +. +com +/ +null +" +: +null +" +https +: +/ +/ +example +. +com +/ +invalid +- +url +" +: +" +https +: +/ +/ +: +invalid +- +url +: +/ +" +" +https +: +/ +/ +example +. +com +/ +without +- +trailing +- +slashes +/ +" +: +" +/ +x +" +" +https +: +/ +/ +example +. +com +/ +prefix +- +resolution +- +error +/ +" +: +" +data +: +text +/ +javascript +/ +" +} +} +} +" +expectedResults +" +: +{ +" +https +: +/ +/ +example +. +com +/ +null +" +: +null +" +https +: +/ +/ +example +. +com +/ +invalid +- +url +" +: +null +" +https +: +/ +/ +example +. +com +/ +without +- +trailing +- +slashes +/ +x +" +: +null +" +https +: +/ +/ +example +. +com +/ +prefix +- +resolution +- +error +/ +x +" +: +null +} +} +} +}