rem: var nameWithoutExtension = filesFolder.leafName; nameWithoutExtension = nameWithoutExtension.substring(0, nameWithoutExtension.lastIndexOf(".")); 
add: var nameWithoutExtension = filesFolder.leafName.replace(/\.[^.]*$/, ""); 
context: function onLoad() {    // Set global variables.    try {      helperAppLoader = window.arguments[0].QueryInterface( Components.interfaces.nsIHelperAppLauncher );    }    catch (e) {      webBrowserPersist = window.arguments[0].QueryInterface( Components.interfaces.nsIWebBrowserPersist );      setTimeout("checkPersistComplete()", 100);    }     if ( !helperAppLoader && !webBrowserPersist ) {        dump( "Invalid argument to helperAppDldProgress.xul\n" );        window.close()        return;    }    dialog = new Object;    dialog.strings = new Array;    dialog.location    = document.getElementById("dialog.location");    dialog.contentType = document.getElementById("dialog.contentType");    dialog.fileName    = document.getElementById("dialog.fileName");    dialog.status      = document.getElementById("dialog.status");    dialog.progress    = document.getElementById("dialog.progress");    dialog.progressText = document.getElementById("dialog.progressText");    dialog.timeLeft    = document.getElementById("dialog.timeLeft");    dialog.timeElapsed = document.getElementById("dialog.timeElapsed");    dialog.cancel      = document.getElementById("cancel");    dialog.pause       = document.getElementById("pause");    dialog.resume      = document.getElementById("resume");    dialog.pauseResumeDeck = document.getElementById("pauseResumeDeck");    dialog.request     = 0;    dialog.downloadPaused = false;    keepProgressWindowUpBox = document.getElementById('keepProgressDialogUp');    // Set up dialog button callbacks.    var object = this;    doSetOKCancel("", function () { return object.onCancel();});    // set our web progress listener on the helper app launcher    if (helperAppLoader)       helperAppLoader.setWebProgressListener(progressListener);    else if (webBrowserPersist) {      webBrowserPersist.progressListener = progressListener;            persistArgs = window.arguments[1];            targetFile = persistArgs.target;              // If the code reaches this point, the user has agreed to replace existing files in the      // file picker.       const flags = nsIWBP.PERSIST_FLAGS_NO_CONVERSION | nsIWBP.PERSIST_FLAGS_REPLACE_EXISTING_FILES;      if (persistArgs.bypassCache)        webBrowserPersist.persistFlags |= nsIWBP.PERSIST_FLAGS_BYPASS_CACHE;      else         webBrowserPersist.persistFlags |= nsIWBP.PERSIST_FLAGS_FROM_CACHE;            try {        var uri = persistArgs.source.QueryInterface(Components.interfaces.nsIURI);        webBrowserPersist.saveURI(uri, null, null, persistArgs.postData, null, targetFile);      }      catch (e) {        // Saving a Document, not a URI:                var filesFolder = null;        if (persistArgs.contentType != "text/plain") {          // Create the local directory into which to save associated files.           const lfContractID = "@mozilla.org/file/local;1";          const lfIID = Components.interfaces.nsILocalFile;          filesFolder = Components .classes[lfContractID].createInstance(lfIID);          filesFolder.initWithPath(persistArgs.target.path);                    var nameWithoutExtension = filesFolder.leafName;          nameWithoutExtension = nameWithoutExtension.substring(0, nameWithoutExtension.lastIndexOf("."));          var filesFolderLeafName = getString("filesFolder");          filesFolderLeafName = filesFolderLeafName.replace(/\^BASE\^/, nameWithoutExtension);          filesFolder.leafName = filesFolderLeafName;                    if (!filesFolder.exists())            filesFolder.create(lfIID.DIRECTORY_TYPE, 0755);        }                  var encodingFlags = 0;        if (persistArgs.contentType == "text/plain") {          encodingFlags |= nsIWBP.ENCODE_FLAGS_FORMATTED;          encodingFlags |= nsIWBP.ENCODE_FLAGS_ABSOLUTE_LINKS;          encodingFlags |= nsIWBP.ENCODE_FLAGS_NOFRAMES_CONTENT;                }        else {          encodingFlags |= nsIWBP.ENCODE_FLAGS_ENCODE_BASIC_ENTITIES;        }        const kWrapColumn = 80;        webBrowserPersist.saveDocument(persistArgs.source, targetFile, filesFolder,                                        persistArgs.contentType, encodingFlags, kWrapColumn);      }    }        // Fill dialog.    loadDialog();    if ( window.opener ) {        moveToAlertPosition();    } else {        centerWindowOnScreen();    }        // Set initial focus    if ( !completed )    {        keepProgressWindowUpBox.focus();    }}
meta: 5459	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/5459/d53ce7fcf767e80306ba6e9d2780b49c41fb1b71/nsProgressDlg.js/buggy/embedding/components/ui/progressDlg/nsProgressDlg.js