Skip to content
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

Prevent backtracking above /-prefix entries #229

Merged
merged 3 commits into from
Dec 2, 2020
Merged

Conversation

domenic
Copy link
Collaborator

@domenic domenic commented Oct 22, 2020

Closes #207.

Also changes the error message suggestion for a nearby case to be more helpful and accurate.


Preview | Diff

Closes #207.

Also changes the error message suggestion for a nearby case to be more helpful and accurate.
Copy link
Collaborator

@guybedford guybedford left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice to see and this is what we implemented in Node.js as well (in addition to banning node_modules segments in the target).

@@ -6,7 +6,8 @@
"lodash-dot": "./node_modules/lodash-es/lodash.js",
"lodash-dot/": "./node_modules/lodash-es/",
"lodash-dotdot": "../node_modules/lodash-es/lodash.js",
"lodash-dotdot/": "../node_modules/lodash-es/"
"lodash-dotdot/": "../node_modules/lodash-es/",
"mapped/path/": "https://github.com/WICG/import-maps/issues/207/"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add an entry of "mapped/" here, and "mapped/backtrack" to the expectedResults below?
This is to test that the backtracking failure at a more specific key doesn't allow fallback to less specific key -- i.e. "mapped/path/../backtrack" can't be resolved while "mapped/backtrack" can be resolved.

@@ -6,7 +6,8 @@
"lodash-dot": "./node_modules/lodash-es/lodash.js",
"lodash-dot/": "./node_modules/lodash-es/",
"lodash-dotdot": "../node_modules/lodash-es/lodash.js",
"lodash-dotdot/": "../node_modules/lodash-es/"
"lodash-dotdot/": "../node_modules/lodash-es/",
"mapped/path/": "https://github.com/WICG/import-maps/issues/207/"
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, how about adding test cases for URL-like specfiers + backtracking? (perhaps in url-specifiers.json, where URL-like specifiers + trailing slash is tested)

Copy link
Collaborator

@hiroshige-g hiroshige-g left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, once the comments on tests are addressed.

@domenic
Copy link
Collaborator Author

domenic commented Dec 2, 2020

Note to self: PR title is wrong; it should be /-suffix not /-prefix

@domenic domenic merged commit ebb6ebe into master Dec 2, 2020
@domenic domenic deleted the no-backtracking branch December 2, 2020 19:06
blueboxd pushed a commit to blueboxd/chromium-legacy that referenced this pull request Dec 5, 2020
Reflecting
WICG/import-maps#229

Bug: 848607, WICG/import-maps#207
Change-Id: Id056b3fd27489ecdfe45456220fd1d8c01dc8d3f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2570012
Commit-Queue: Hiroshige Hayashizaki <hiroshige@chromium.org>
Reviewed-by: Kouhei Ueno <kouhei@chromium.org>
Reviewed-by: Domenic Denicola <domenic@chromium.org>
Cr-Commit-Position: refs/heads/master@{#833945}
mjfroman pushed a commit to mjfroman/moz-libwebrtc-third-party that referenced this pull request Oct 14, 2022
Reflecting
WICG/import-maps#229

Bug: 848607, WICG/import-maps#207
Change-Id: Id056b3fd27489ecdfe45456220fd1d8c01dc8d3f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2570012
Commit-Queue: Hiroshige Hayashizaki <hiroshige@chromium.org>
Reviewed-by: Kouhei Ueno <kouhei@chromium.org>
Reviewed-by: Domenic Denicola <domenic@chromium.org>
Cr-Commit-Position: refs/heads/master@{#833945}
GitOrigin-RevId: 916cc2354cae22a6e8280f2a2b7ac66b30b99e67
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Trailing slash map backtracking
3 participants