function join(aRoot, aPath) {
	  if (aRoot === "") {
	    aRoot = ".";
	  }
	  if (aPath === "") {
	    aPath = ".";
	  }
	  var aPathUrl = urlParse(aPath);
	  var aRootUrl = urlParse(aRoot);
	  if (aRootUrl) {
	    aRoot = aRootUrl.path || '/';
	  }

	  // `join(foo, '//www.example.org')`
	  if (aPathUrl && !aPathUrl.scheme) {
	    if (aRootUrl) {
	      aPathUrl.scheme = aRootUrl.scheme;
	    }
	    return urlGenerate(aPathUrl);
	  }

	  if (aPathUrl || aPath.match(dataUrlRegexp)) {
	    return aPath;
	  }

	  // `join('http://', 'www.example.com')`
	  if (aRootUrl && !aRootUrl.host && !aRootUrl.path) {
	    aRootUrl.host = aPath;
	    return urlGenerate(aRootUrl);
	  }

	  var joined = aPath.charAt(0) === '/'
	    ? aPath
	    : normalize(aRoot.replace(/\/+$/, '') + '/' + aPath);

	  if (aRootUrl) {
	    aRootUrl.path = joined;
	    return urlGenerate(aRootUrl);
	  }
	  return joined;
	}
Joins two paths/URLs.

@param aRoot The root path or URL.
@param aPath The path or URL to be joined with the root.

- If aPath is a URL or a data URI, aPath is returned, unless aPath is a
  scheme-relative URL: Then the scheme of aRoot, if any, is prepended
  first.
- Otherwise aPath is a path. If aRoot is a URL, then its path portion
  is updated with the result and aRoot is returned. Otherwise the result
  is returned.
  - If aPath is absolute, the result is aPath.
  - Otherwise the two paths are joined with a slash.
- Joining for example 'http://' and 'www.example.com' is also supported.