| 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];
|
| }
|
|
|