anchor.diff:   */
   void _loadLibrary(String uriString) {
     var uri = _rootUri.resolve(uriString);
  -  var lib;
  -  var match = _inlineScriptRegExp.firstMatch(uriString);
  -  if (match != null) {
  -    var baseUri = Uri.parse(match.group(1));
  -    var list = _inlinedScriptMapping[baseUri];
  -    var pos = int.parse(match.group(2), onError: (_) => -1);
  -    if (list != null && pos >= 0 && pos < list.length && list[pos] != null) {
  -      lib = _libs[list[pos]];
  -    }
  -  } else if (uri.path.startsWith(_packageRoot)) {
  +  var lib = _libs[uri];
  +  if (uri.path.startsWith(_packageRoot) && uri.path.endsWith('.dart')) {
       var packageUri =
           Uri.parse('package:${uri.path.substring(_packageRoot.length)}');
  -    lib = _libs[packageUri];
  -    if (lib == null) {
  -      lib = _libs[uri];
  -    }
  -  } else {
  -    lib = _libs[uri];
  -  }
  +    var canonicalLib = _libs[packageUri];
  +    if (canonicalLib != null) {
  +      lib = canonicalLib;
  +    }
  +  }
  +
     if (lib == null) {
       print('warning: $uri library not found');
       return;
  
positive.code: 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]\+\)');
  
  /**
   * Map URLs fabricated by polymer to URLs fabricated by Dartium to represent
   * inlined scripts. Polymer uses baseUri:script#, Dartium uses baseUri:line#
   */
  // TODO(sigmund): figure out if we can generate the same URL and expose it.
  final Map<Uri, List<Uri>> _inlinedScriptMapping = () {
    var map = {};
    for (var uri in _libs.keys) {
      var uriString = uri.toString();
      var match = _inlineScriptRegExp.firstMatch(uriString);
      if (match == null) continue;
      var baseUri = Uri.parse(match.group(1));
      if (map[baseUri] == null) map[baseUri] = [];
      map[baseUri].add(uri);
    }
    return map;
  }();
  
  /** Returns a new Uri that replaces [path] in [uri]. */
  Uri _replacePath(Uri uri, String path) {
    return new Uri(scheme: uri.scheme, host: uri.host, port: uri.port,
        path: path, query: uri.query, fragment: uri.fragment);
  }
  
  /** Returns the Uri in [href] without query parameters or fragments. */
  String _baseUri(String href) {
    var uri = Uri.parse(window.location.href);
    var trimUri = new Uri(scheme: uri.scheme, host: uri.host,
        port: uri.port, path: uri.path);
    return trimUri.toString();
  }
  
  /**
   * Reads the library at [uriString] (which can be an absolute URI or a relative
   * URI from the root library), and:
  
negative.code:   if (seen.contains(doc)) return scripts;
    seen.add(doc);
  
    bool scriptSeen = false;
    for (var node in doc.queryAll('script,link[rel="import"]')) {
      if (node is LinkElement) {
        _discoverScripts(node.import, node.href, seen, scripts);
      } else if (node is ScriptElement && node.type == 'application/dart') {
        if (!scriptSeen) {
          var url = node.src;
          scripts.add(url == '' ? baseUri : url);
          scriptSeen = true;
        } else {
          print('warning: more than one Dart script tag in $baseUri. Dartium '
              'currently only allows a single Dart script tag per document.');
        }
      }
    }
  