function joinAndCanonicalizePath(parts) {
    var path = parts[ComponentIndex.PATH] || '';
    path = removeDotSegments(path);
    parts[ComponentIndex.PATH] = path;

    return buildFromEncodedParts(
        parts[ComponentIndex.SCHEME],
        parts[ComponentIndex.USER_INFO],
        parts[ComponentIndex.DOMAIN],
        parts[ComponentIndex.PORT],
        parts[ComponentIndex.PATH],
        parts[ComponentIndex.QUERY_DATA],
        parts[ComponentIndex.FRAGMENT]);
  }
Takes an array of the parts from split and canonicalizes the path part
and then joins all the parts.
@param {Array.<string?} parts
@return {string}