rem: var docPath = IOService.extractUrlPart(docUrl, IOService.url_Directory, {start:0}, {end:0}); var urlPath = IOService.extractUrlPart(inputUrl, IOService.url_Directory, {start:0}, {end:0}); 
add: var docPath = IOService.extractUrlPart(docUrl, IOService.url_Path, {start:0}, {end:0}); var urlPath = IOService.extractUrlPart(inputUrl, IOService.url_Path, {start:0}, {end:0}); 
context: function MakeRelativeUrl(url){  var inputUrl = TrimString(url);  if (!inputUrl)    return inputUrl;  // Get the filespec relative to current document's location  // NOTE: Can't do this if file isn't saved yet!  var docUrl = GetDocumentBaseUrl();  var docScheme = GetScheme(docUrl);  // Can't relativize if no doc scheme (page hasn't been saved)  if (!docScheme)    return inputUrl;  var urlScheme = GetScheme(inputUrl);  // Do nothing if not the same scheme or url is already relativized  if (docScheme != urlScheme)    return inputUrl;  var IOService = GetIOService();  if (!IOService)    return inputUrl;  // Host must be the same  var docHost = GetHost(docUrl);  var urlHost = GetHost(inputUrl);  if (docHost != urlHost)    return inputUrl;  // Get just the file path part of the urls  var docPath = IOService.extractUrlPart(docUrl, IOService.url_Directory, {start:0}, {end:0});   var urlPath = IOService.extractUrlPart(inputUrl, IOService.url_Directory, {start:0}, {end:0});  // We only return "urlPath", so we can convert  //  the entire docPath for case-insensitive comparisons  var os = GetOS();  var doCaseInsensitive = (docScheme.toLowerCase() == "file" && os == gWin);  if (doCaseInsensitive)    docPath = docPath.toLowerCase();  // Get document filename before we start chopping up the docPath  var docFilename = GetFilename(docPath);  // Both url and doc paths now begin with "/"  // Look for shared dirs starting after that  urlPath = urlPath.slice(1);  docPath = docPath.slice(1);  var firstDirTest = true;  var nextDocSlash = 0;  var done = false;  // Remove all matching subdirs common to both doc and input urls  do {    nextDocSlash = docPath.indexOf("\/");    var nextUrlSlash = urlPath.indexOf("\/");    if (nextUrlSlash == -1)    {      // We're done matching and all dirs in url      // what's left is the filename      done = true;      // Remove filename for named anchors in the same file      if (nextDocSlash == -1 && docFilename)      {         var anchorIndex = urlPath.indexOf("#");        if (anchorIndex > 0)        {          var urlFilename = doCaseInsensitive ? urlPath.toLowerCase() : urlPath;                  if (urlFilename.indexOf(docFilename) == 0)            urlPath = urlPath.slice(anchorIndex);        }      }    }    else if (nextDocSlash >= 0)    {      // Test for matching subdir      var docDir = docPath.slice(0, nextDocSlash);      var urlDir = urlPath.slice(0, nextUrlSlash);      if (doCaseInsensitive)        urlDir = urlDir.toLowerCase();      if (urlDir == docDir)      {        // Remove matching dir+"/" from each path        //  and continue to next dir        docPath = docPath.slice(nextDocSlash+1);        urlPath = urlPath.slice(nextUrlSlash+1);      }      else      {        // No match, we're done        done = true;        // Be sure we are on the same local drive or volume         //   (the first "dir" in the path) because we can't         //   relativize to different drives/volumes.        // UNIX doesn't have volumes, so we must not do this else        //  the first directory will be misinterpreted as a volume name        if (firstDirTest && docScheme == "file" && os != gUNIX)          return inputUrl;      }    }    else  // No more doc dirs left, we're done      done = true;    firstDirTest = false;  }  while (!done);  // Add "../" for each dir left in docPath  while (nextDocSlash > 0)  {    urlPath = "../" + urlPath;    nextDocSlash = docPath.indexOf("\/", nextDocSlash+1);  }  return urlPath;}
meta: 8395	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/8395/221b53da6513daf3b55f52623b5f2e806d3f0527/EdDialogCommon.js/buggy/editor/ui/dialogs/content/EdDialogCommon.js