rem: var path = aDocumentURI.path.match(/\/([^\/]+)\/$/); 
add: var path = aURI.path.match(/\/([^\/]+)\/$/); 
context: function getDefaultFileName(aDefaultFileName, aDocumentURI, aDocument){  if (aDocument) {    // 1) look for a filename in the content-disposition header, if any    try {      // Get to the window as best we can, and get the header from it.      var dispHeader =         aDocument.defaultView                 .QueryInterface(Components.interfaces.nsIInterfaceRequestor)                 .getInterface(Components.interfaces.nsIDOMWindowUtils)                 .getDocumentMetadata("content-disposition");      if (dispHeader) {        const mhpContractID = "@mozilla.org/network/mime-hdrparam;1";        const mhpIID = Components.interfaces.nsIMIMEHeaderParam;        const mhp = Components.classes[mhpContractID].getService(mhpIID);        var dummy = { value: null };  // Need an out param...        var charset = getCharsetforSave(aDocument);              var fileName;        try {          fileName = mhp.getParameter(dispHeader, "filename", charset, true,                                      dummy);        }        catch (e) {          try {            fileName = mhp.getParameter(dispHeader, "name", charset, true,                                        dummy);          }          catch (e) {          }        }        if (fileName) {          return fileName;        }      }    } catch (e) {      // Move on    }  }  try {    var url = aDocumentURI.QueryInterface(Components.interfaces.nsIURL);    if (url.fileName != "") {      // 2) Use the actual file name, if present      var textToSubURI = Components.classes["@mozilla.org/intl/texttosuburi;1"]                                   .getService(Components.interfaces.nsITextToSubURI);      return validateFileName(textToSubURI.unEscapeURIForUI(url.originCharset || "UTF-8", url.fileName));    }  } catch (e) {    // This is something like a data: and so forth URI... no filename here.  }  if (aDocument) {    var docTitle = GenerateValidFilename(aDocument.title, "");    if (docTitle) {      // 3) Use the document title      return docTitle;    }  }  if (aDefaultFileName)    // 4) Use the caller-provided name, if any    return validateFileName(aDefaultFileName);  // 5) If this is a directory, use the last directory name  var path = aDocumentURI.path.match(/\/([^\/]+)\/$/);  if (path && path.length > 1) {    return validateFileName(path[1]);  }  try {    if (aDocumentURI.host)      // 6) Use the host.      return aDocumentURI.host;  } catch (e) {    // Some files have no information at all, like Javascript generated pages  }  try {    // 7) Use the default file name    return getStringBundle().GetStringFromName("DefaultSaveFileName");  } catch (e) {    //in case localized string cannot be found  }  // 8) If all else fails, use "index"  return "index";}
meta: 9421	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/9421/33a6e559694c38e675c3ed55e3eb109ae6cbda08/contentAreaUtils.js/clean/suite/common/contentAreaUtils.js