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

Unified Diff: pkg/polymer/lib/src/loader.dart

Issue 38333004: Fixes all canonicalization problems... all of them. Ok, not all of them, but at (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 2 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 | « pkg/polymer/lib/src/build/runner.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/polymer/lib/src/loader.dart
diff --git a/pkg/polymer/lib/src/loader.dart b/pkg/polymer/lib/src/loader.dart
index f03576568fe1f097bf4efd00d07def6719794f6c..9681a930519b2f48c7a2ff2f917892c9844abd1d 100644
--- a/pkg/polymer/lib/src/loader.dart
+++ b/pkg/polymer/lib/src/loader.dart
@@ -104,6 +104,10 @@ List<String> _discoverScripts(Document doc, String baseUri,
[Set<Document> seen, List<String> scripts]) {
if (seen == null) seen = new Set<Document>();
if (scripts == null) scripts = <String>[];
+ if (doc == null) {
+ print('warning: $baseUri not found.');
+ return;
+ }
if (seen.contains(doc)) return scripts;
seen.add(doc);
@@ -136,6 +140,9 @@ final _libs = currentMirrorSystem().libraries;
// root library (see dartbug.com/12612)
final _rootUri = currentMirrorSystem().isolate.rootLibrary.uri;
+final String _packageRoot =
+ '${path.dirname(Uri.parse(window.location.href).path)}/packages/';
+
/** Regex that matches urls used to represent inlined scripts. */
final RegExp _inlineScriptRegExp = new RegExp('\(.*\.html.*\):\([0-9]\+\)');
@@ -192,6 +199,13 @@ void _loadLibrary(String uriString) {
if (list != null && pos >= 0 && pos < list.length && list[pos] != null) {
lib = _libs[list[pos]];
}
+ } else if (uri.path.startsWith(_packageRoot)) {
+ var packageUri =
+ Uri.parse('package:${uri.path.substring(_packageRoot.length)}');
+ lib = _libs[packageUri];
+ if (lib == null) {
+ lib = _libs[uri];
+ }
} else {
lib = _libs[uri];
}
« no previous file with comments | « pkg/polymer/lib/src/build/runner.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698