Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(455)

Unified Diff: lib/build/import_inliner.dart

Issue 993423004: Fix normalization of relative paths inside of deep relative imports (Closed) Base URL: git@github.com:dart-lang/web-components.git@master
Patch Set: format Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « lib/build/import_crawler.dart ('k') | pubspec.yaml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/build/import_inliner.dart
diff --git a/lib/build/import_inliner.dart b/lib/build/import_inliner.dart
index 9101419248f41eb228cd4d1f37597f47ef065e22..4336587badf2db5631ec58b98a9f4068deafdad2 100644
--- a/lib/build/import_inliner.dart
+++ b/lib/build/import_inliner.dart
@@ -104,7 +104,7 @@ class ImportInliner {
.querySelectorAll('script[type="$dartType"]')
.forEach((script) => script.remove());
// Normalize urls in attributes and inline css.
- new _UrlNormalizer(primaryInput, asset, logger).visit(document);
+ new _UrlNormalizer(data.fromId, asset, logger).visit(document);
// Replace the import with its contents by appending the nodes
// immediately before the import one at a time, and then removing the
// import from the document.
@@ -266,7 +266,6 @@ class _UrlNormalizer extends TreeVisitor {
var id = uriToAssetId(sourceId, hrefToParse, logger, span);
if (id == null) return href;
- var primaryId = primaryInput;
// Build the new path, placing back any suffixes that we stripped earlier.
var prefix =
@@ -282,17 +281,17 @@ class _UrlNormalizer extends TreeVisitor {
return '${topLevelPath}assets/${id.package}/${newPath.substring(6)}';
}
- if (primaryId.package != id.package) {
+ if (primaryInput.package != id.package) {
// Technically we shouldn't get there
logger.error(internalErrorDontKnowHowToImport
- .create({'target': id, 'source': primaryId, 'extra': ''}),
+ .create({'target': id, 'source': primaryInput, 'extra': ''}),
span: span);
return href;
}
var builder = path.url;
return builder.normalize(builder.relative(builder.join('/', newPath),
- from: builder.join('/', builder.dirname(primaryId.path))));
+ from: builder.join('/', builder.dirname(primaryInput.path))));
}
}
« no previous file with comments | « lib/build/import_crawler.dart ('k') | pubspec.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698