Commit c1c76ee9 authored by Hiroshige Hayashizaki's avatar Hiroshige Hayashizaki Committed by Commit Bot

[Import Maps] WPT: Explicitly reject data: base URLs in tests

For easier test failure triage.

Bug: 990561
Change-Id: I4abeed8c2b97366316f7ed77f8df815f8f3a32ed
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1864014
Commit-Queue: Hiroshige Hayashizaki <hiroshige@chromium.org>
Reviewed-by: default avatarDomenic Denicola <domenic@chromium.org>
Cr-Commit-Position: refs/heads/master@{#707011}
parent 1d5b803f
This is a testharness.js-based test.
PASS Relative URL-like addresses / should accept strings prefixed with ./, ../, or /
FAIL Relative URL-like addresses / should not accept strings prefixed with ./, ../, or / for data: base URLs assert_equals: expected "{\"imports\":{\"dotDotSlash\":[],\"dotSlash\":[],\"slash\":[]},\"scopes\":{}}" but got "{\"imports\":{\"dotDotSlash\":[\"http://web-platform.test:8001/import-maps/builtin-support.tentative/foo\"],\"dotSlash\":[\"http://web-platform.test:8001/import-maps/builtin-support.tentative/imported/foo\"],\"slash\":[\"http://web-platform.test:8001/foo\"]},\"scopes\":{}}"
FAIL Relative URL-like addresses / should not accept strings prefixed with ./, ../, or / for data: base URLs test helper does not support data: base URLs
PASS Relative URL-like addresses / should accept the literal strings ./, ../, or / with no suffix
PASS Relative URL-like addresses / should ignore percent-encoded variants of ./, ../, or /
PASS Built-in module addresses / should accept URLs using the built-in module scheme
......
......@@ -7,6 +7,6 @@ PASS Relative URL scope keys / should work with / suffixes
PASS Relative URL scope keys / should deduplicate based on URL parsing rules
PASS Absolute URL scope keys / should accept all absolute URL scope keys, with or without fetch schemes
FAIL Absolute URL scope keys / should parse absolute URL scope keys, ignoring unparseable ones assert_equals: expected "{\"imports\":{},\"scopes\":{\"https://base.example/path1/path2/example.org\":{},\"https://example.com/%41\":{},\"https://example.com///\":{},\"https://example.com/foo/\":{},\"https://example.net/\":{}}}" but got "{\"imports\":{},\"scopes\":{\"https://base.example/path1/path2/example.org\":{},\"https://ex%20ample.org/\":{},\"https://example.com///\":{},\"https://example.com/A\":{},\"https://example.com/foo/\":{},\"https://example.net/\":{}}}"
FAIL Absolute URL scope keys / should ignore relative URL scope keys when the base URL is a data: URL assert_equals: expected "{\"imports\":{},\"scopes\":{}}" but got "{\"imports\":{},\"scopes\":{\"http://web-platform.test:8001/foo\":{},\"http://web-platform.test:8001/import-maps/builtin-support.tentative/foo\":{},\"http://web-platform.test:8001/import-maps/builtin-support.tentative/imported/foo\":{}}}"
FAIL Absolute URL scope keys / should ignore relative URL scope keys when the base URL is a data: URL test helper does not support data: base URLs
Harness: the test ran to completion.
This is a testharness.js-based test.
PASS Relative URL-like specifier keys / should absolutize strings prefixed with ./, ../, or / into the corresponding URLs
FAIL Relative URL-like specifier keys / should not absolutize strings prefixed with ./, ../, or / with a data: URL base assert_equals: expected "{\"imports\":{\"../foo\":[\"https://example.com/dotdotslash\"],\"./foo\":[\"https://example.com/dotslash\"],\"/foo\":[\"https://example.com/slash\"]},\"scopes\":{}}" but got "{\"imports\":{\"http://web-platform.test:8001/foo\":[\"https://example.com/slash\"],\"http://web-platform.test:8001/import-maps/builtin-support.tentative/foo\":[\"https://example.com/dotdotslash\"],\"http://web-platform.test:8001/import-maps/builtin-support.tentative/imported/foo\":[\"https://example.com/dotslash\"]},\"scopes\":{}}"
FAIL Relative URL-like specifier keys / should not absolutize strings prefixed with ./, ../, or / with a data: URL base test helper does not support data: base URLs
PASS Relative URL-like specifier keys / should absolutize the literal strings ./, ../, or / with no suffix
PASS Relative URL-like specifier keys / should treat percent-encoded variants of ./, ../, or / as bare specifiers
FAIL Absolute URL specifier keys / should only accept absolute URL specifier keys with fetch schemes, treating others as bare specifiers assert_equals: expected "{\"imports\":{\"about:good\":[\"https://base.example/about\"],\"blob:good\":[\"https://base.example/blob\"],\"data:good\":[\"https://base.example/data\"],\"file:///good\":[\"https://base.example/file\"],\"filesystem:good\":[\"https://base.example/filesystem\"],\"ftp://good/\":[\"https://base.example/ftp/\"],\"http://good/\":[\"https://base.example/http/\"],\"https://good/\":[\"https://base.example/https/\"],\"import:bad\":[\"https://base.example/import\"],\"javascript:bad\":[\"https://base.example/javascript\"],\"mailto:bad\":[\"https://base.example/mailto\"],\"wss:bad\":[\"https://base.example/wss\"]},\"scopes\":{}}" but got "{\"imports\":{\"about:good\":[\"https://base.example/about\"],\"blob:good\":[\"https://base.example/blob\"],\"data:good\":[\"https://base.example/data\"],\"file:///good\":[\"https://base.example/file\"],\"filesystem:good\":[\"https://base.example/filesystem\"],\"ftp://good/\":[\"https://base.example/ftp/\"],\"http://good/\":[\"https://base.example/http/\"],\"https://good/\":[\"https://base.example/https/\"],\"import:bad\":[\"https://base.example/import\"],\"javascript:bad\":[\"https://base.example/javascript\"],\"mailto:bad\":[\"https://base.example/mailto\"],\"wss://bad/\":[\"https://base.example/wss\"]},\"scopes\":{}}"
......
......@@ -89,6 +89,11 @@ function it(message, f) {
// Currently document.write() is used to make everything synchronous, which
// is just needed for running the existing Jest-based tests easily.
function parseFromString(mapString, mapBaseURL) {
// We can't test data: base URLs because <base> rejects data: URLs.
if (new URL(mapBaseURL).protocol === 'data:') {
throw Error('test helper does not support data: base URLs');
}
const iframe = document.createElement('iframe');
document.body.appendChild(iframe);
iframe.contentDocument.write(`
......
This is a testharness.js-based test.
PASS Relative URL-like addresses / should accept strings prefixed with ./, ../, or /
FAIL Relative URL-like addresses / should not accept strings prefixed with ./, ../, or / for data: base URLs assert_equals: expected "{\"imports\":{},\"scopes\":{}}" but got "{\"imports\":{\"dotDotSlash\":\"http://web-platform.test:8001/import-maps/foo\",\"dotSlash\":\"http://web-platform.test:8001/import-maps/imported/foo\",\"slash\":\"http://web-platform.test:8001/foo\"},\"scopes\":{}}"
FAIL Relative URL-like addresses / should not accept strings prefixed with ./, ../, or / for data: base URLs test helper does not support data: base URLs
PASS Relative URL-like addresses / should accept the literal strings ./, ../, or / with no suffix
FAIL Relative URL-like addresses / should ignore percent-encoded variants of ./, ../, or / assert_equals: expected "{\"imports\":{},\"scopes\":{}}" but got "{\"imports\":{\"dotDotSlash1\":[],\"dotDotSlash2\":[],\"dotDotSlash3\":[],\"dotSlash1\":[],\"dotSlash2\":[],\"dotSlash3\":[],\"slash2\":[]},\"scopes\":{}}"
PASS Absolute URL addresses / should only accept absolute URL addresses with fetch schemes
......
......@@ -7,6 +7,6 @@ PASS Relative URL scope keys / should work with / suffixes
PASS Relative URL scope keys / should deduplicate based on URL parsing rules
PASS Absolute URL scope keys / should accept all absolute URL scope keys, with or without fetch schemes
FAIL Absolute URL scope keys / should parse absolute URL scope keys, ignoring unparseable ones assert_equals: expected "{\"imports\":{},\"scopes\":{\"https://base.example/path1/path2/example.org\":{},\"https://example.com/%41\":{},\"https://example.com///\":{},\"https://example.com/foo/\":{},\"https://example.net/\":{}}}" but got "{\"imports\":{},\"scopes\":{\"https://base.example/path1/path2/example.org\":{},\"https://ex%20ample.org/\":{},\"https://example.com///\":{},\"https://example.com/A\":{},\"https://example.com/foo/\":{},\"https://example.net/\":{}}}"
FAIL Absolute URL scope keys / should ignore relative URL scope keys when the base URL is a data: URL assert_equals: expected "{\"imports\":{},\"scopes\":{}}" but got "{\"imports\":{},\"scopes\":{\"http://web-platform.test:8001/foo\":{},\"http://web-platform.test:8001/import-maps/foo\":{},\"http://web-platform.test:8001/import-maps/imported/foo\":{}}}"
FAIL Absolute URL scope keys / should ignore relative URL scope keys when the base URL is a data: URL test helper does not support data: base URLs
Harness: the test ran to completion.
This is a testharness.js-based test.
PASS Relative URL-like specifier keys / should absolutize strings prefixed with ./, ../, or / into the corresponding URLs
FAIL Relative URL-like specifier keys / should not absolutize strings prefixed with ./, ../, or / with a data: URL base assert_equals: expected "{\"imports\":{\"../foo\":\"https://example.com/dotdotslash\",\"./foo\":\"https://example.com/dotslash\",\"/foo\":\"https://example.com/slash\"},\"scopes\":{}}" but got "{\"imports\":{\"http://web-platform.test:8001/foo\":\"https://example.com/slash\",\"http://web-platform.test:8001/import-maps/foo\":\"https://example.com/dotdotslash\",\"http://web-platform.test:8001/import-maps/imported/foo\":\"https://example.com/dotslash\"},\"scopes\":{}}"
FAIL Relative URL-like specifier keys / should not absolutize strings prefixed with ./, ../, or / with a data: URL base test helper does not support data: base URLs
PASS Relative URL-like specifier keys / should absolutize the literal strings ./, ../, or / with no suffix
PASS Relative URL-like specifier keys / should treat percent-encoded variants of ./, ../, or / as bare specifiers
PASS Absolute URL specifier keys / Accept all absolute URL specifier keys even with fetch schemes as URLs
......
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