Closed Bug 375259 Opened 14 years ago Closed 3 years ago
Directory service can return uninitialized ns
From bug 373640 comment 2: var file = Components.classes["@mozilla.org/file/directory_service;1"] .getService(Components.interfaces.nsIProperties) .get("Drivs", Components.interfaces.nsILocalFile); alert(file.path); // Shows empty string alert(file.parent); // Throws NS_ERROR_FILE_UNRECOGNIZED PATH For "Drivs" |folder| at the provided URL is CSIDL_DRIVES, and Windows returns the empty string. This causes NS_NewLocalFile to return an uninitialized file (empty path), but code which calls the directory service certainly expects to get back an initialized file. |GetWindowsFolder| should return an error if the returned path is empty, because the empty path circumvents the Windows nsLocalFile's path-checking code. The patch is untested; I assume NS_ERROR_FILE_UNRECOGNIZED_PATH is included somewhere in the file.
Attachment #259568 - Flags: review?(benjamin)
Maybe it'd be a better idea just to remove "Drivs" from the recognized keys. Thoughts?
Hello, How could i help to solve this issue? Thanks,
(In reply to jbonnafo from comment #2) > How could i help to solve this issue? This issue already has a patch, and it looks like the patch still applies. So I don't think there's anything for you to do here; Waldo does need to be poked to land his patch, though. ;)
Pushed by email@example.com: https://hg.mozilla.org/integration/mozilla-inbound/rev/353bb6fbb683 The directory service shouldn't return an uninitialized (safely) nsILocalFile for the "Drivs" key. r=bsmedberg 11 years ago
Best guess is I held off, initially, on landing the patch because I wanted to resolve comment 1 first. But really, I have no idea what precisely I was thinking here. :-) Thanks for the poke, and the opportunity for possibly my bestest commit message evar.
You need to log in before you can comment on or make changes to this bug.