diff --git a/xpfe/browser/resources/content/navigator.js b/xpfe/browser/resources/content/navigator.js index b3d1320fd8a..7df32e72413 100644 --- a/xpfe/browser/resources/content/navigator.js +++ b/xpfe/browser/resources/content/navigator.js @@ -704,20 +704,17 @@ function RevealSearchPanel() newWin.saveFileAndPos = true; } + const nsIFilePicker = Components.interfaces.nsIFilePicker; function BrowserOpenFileWindow() { - // Get filespecwithui component. - var fileSpec = createInstance( "component://netscape/filespecwithui", "nsIFileSpecWithUI" ); - var url = null; + // Get filepicker component. try { - fileSpec.parentWindow = window; - url = fileSpec.chooseFile( bundle.GetStringFromName( "openFile" ) ); - fileSpec.parentWindow = null; - } catch ( exception ) { - } - if ( url && url != "" ) { - openNewWindowWith( url ); - } + var fp = Components.classes["component://mozilla/filepicker"].createInstance(nsIFilePicker); + fp.init(window, bundle.GetStringFromName("openFile"), nsIFilePicker.modeOpen); + fp.setFilters(nsIFilePicker.filterAll); + fp.show(); + openNewWindowWith(fp.file.path); + } catch (ex) { } } function OpenFile(url) { diff --git a/xpfe/browser/resources/content/openLocation.js b/xpfe/browser/resources/content/openLocation.js index fa102a15d5e..ecd632736e3 100644 --- a/xpfe/browser/resources/content/openLocation.js +++ b/xpfe/browser/resources/content/openLocation.js @@ -111,19 +111,14 @@ function createInstance( progid, iidName ) return Components.classes[ progid ].createInstance( iid ); } +const nsIFilePicker = Components.interfaces.nsIFilePicker; function onChooseFile() - { - // Get filespecwithui component. - var fileSpec = createInstance( "component://netscape/filespecwithui", "nsIFileSpecWithUI" ); - try - { - fileSpec.parentWindow = window; - var url = fileSpec.chooseFile( bundle.GetStringFromName("chooseFileDialogTitle") ); - fileSpec.parentWindow = null; - dialog.input.value = fileSpec.URLString; - } - catch( exception ) - { - // Just a cancel, probably. - } - } \ No newline at end of file +{ + try { + var fp = Components.classes["component://mozilla/filepicker"].createInstance(nsIFilePicker); + fp.init(window, bundle.GetStringFromName("chooseFileDialogTitle"), nsIFilePicker.modeOpen); + fp.setFilters(nsIFilePicker.filterAll); + fp.show(); + dialog.input.value = fp.file.path; + } catch(ex) { } +}