Closed Bug 304995 Opened 19 years ago Closed 19 years ago

No filepicker comes up under WIN2000

Categories

(Toolkit Graveyard :: XULRunner, defect)

x86
Windows 2000
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED WORKSFORME

People

(Reporter: andreas.otte, Unassigned)

Details

In my xulrunner application I want to open a filepicker with code similar to the
one following below. This works as expected on linux, but on Win2000 nothing
happens, no filepicker comes up. Starting with -jsconsole reveals no errors or
warnings: 

var nsIFilePicker = Components.interfaces.nsIFilePicker;
var fp =
Components.classes["@mozilla.org/filepicker;1"].createInstance(nsIFilePicker );
fp.init( this.mDialog, 
         "Load",
         nsIFilePicker.modeOpen );
if ( fp.show() == nsIFilePicker.returnOK && fp.file ) {
    loadTask(fp.fileURL.spec);    
}

Happens on nightly builds of 1.8. What am I missing?
Is this still a problem?
I will try this again as soon as possible.
No, still does not work. Maybe it has something to do with developing under linux and deploying under windows too. Is there a ready example developed under windows that uses the filepicker I can try? 
Are you able to debug, at least from JS? Same code works for me, with s/this.mDialog/window/. Maybe this.mDialog is null? Is it not a nsIDOMWindow?
(On windows XP, but that shouldn't matter)
You should get an NS_ERROR_FAILURE exception when you pass a null (or otherwise invalid) parent window to init().

Also note that you must specifically set the pref javascript.options.showInConsole to true for any errors to show up in the JS Console.
reply to comment #6)
> Also note that you must specifically set the pref
> javascript.options.showInConsole to true for any errors to show up in the JS
> Console.

I will check this as soon as I have access to my computer at work again. 
Hmmm ... trying to open the FilePicker for load still does nothing, not even an error, but FilePicker for SaveAs results in this:

Error: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIFilePicker.init]"  nsresult: "0x80004005 (NS_ERROR_FAILURE)"  location: "JS frame :: chrome://venn/content/venn.js :: saveAsTask :: line 1870"  data: no]
Source File: chrome://venn/content/venn.js
Line: 1870

I will investigate ...
I now see the exception on linux too with the latest 1.8 xulrunner. Works fine with window instead of this.mDialog. Very interesting, I will check again against win2000.
Ok, works on linux and windows. Thanks guys for the hint. What did I learn: I was lucky that it worked on linux as long as it did. Beware of bad examples floating around.
Status: NEW → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Status: REOPENED → RESOLVED
Closed: 19 years ago19 years ago
Resolution: --- → WORKSFORME
Product: Toolkit → Toolkit Graveyard
You need to log in before you can comment on or make changes to this bug.