Closed
Bug 18149
Opened 25 years ago
Closed 25 years ago
[DOGFOOD][blocker] bad consolidation of platform-specific code (nsFilePath)
Categories
(Core :: XPCOM, defect, P2)
Tracking
()
RESOLVED
FIXED
M14
People
(Reporter: warrensomebody, Assigned: dougt)
References
Details
(Whiteboard: [PDT-])
Shame on you guys for putting the following code into nsFileChannel.cpp:
93 beard 1.31 #ifdef XP_MAC
94 brendan 1.55 nsFilePath filePath(nsUnescape((char*)(const
char*)fileString));
95 mSpec = filePath;
96
97 // Don't assume we actually created a good file spec
98 FSSpec theSpec = mSpec.GetFSSpec();
99 if (!theSpec.name[0])
100 {
101 NS_ERROR("failed to create a file spec");
102
103 // Since we didn't actually create the file spec
104 // we return an error
105 return NS_ERROR_MALFORMED_URI;
106 }
107 beard 1.31 #else
108 brendan 1.55 nsFilePath filePath(nsUnescape((char*)(const
char*)fileString));
109 mSpec = filePath;
110 beard 1.31 #endif
This Mac-specific code belongs in nsFilePath (or nsFileSpec), not in
nsFileChannel.cpp which is xp. Let's get it out of here, and into someplace that
will benefit all callers.
Warren
Comment 1•25 years ago
|
||
I never touched this code except to auto-expand tabs, or strip trailing
whitespace on lines, or some such. Wish blame could "see through" that....
/be
Reporter | ||
Updated•25 years ago
|
Severity: normal → major
Priority: P3 → P2
Target Milestone: M12
Reporter | ||
Comment 2•25 years ago
|
||
I was just unlucky enough to hit an even more severe problem with this code
tonight. I tried to load the url file://Y|/foo.txt which ended up coming
through here. The GetFilePath call (a few lines above the code I gave) returned
"/foo.txt" which is the correct path portion of the url. This passed through
nsUnescape unscathed, but then nsFilePath made an object whose internal path
pointed to y:\mozilla\dist\win32_d.obj\bin\foo.txt!!! Somehow it'sthinking that
the leading slash in "/foo.txt" isn't significant to designate the root of the
file system and taking the current (process) directory instead.
This could be because it's a forward slash instead of a backslash, but it's
supposed to be a forward slash coming from nsIURL::GetFilePath. That's URL
syntax. There's obviously an impedence mismatch here between nsIURL and
nsFilepath, and possibly a bug in nsFilePath too.
Updated•25 years ago
|
Assignee: beard → dp
Comment 3•25 years ago
|
||
Sorry, I was merely fixing some bugs, I don't own this code. Clearly non-XP the
code should not be here. I'll be glad to make suggestions, but I shouldn't own
this bug.
Updated•25 years ago
|
Assignee: dp → dougt
Comment 4•25 years ago
|
||
Doug own filepath and stuff. Scott collins might be able to help.
Assignee | ||
Updated•25 years ago
|
Target Milestone: M12 → M14
Assignee | ||
Comment 5•25 years ago
|
||
moving to m14. I will fix this when nsIFile is done.
Reporter | ||
Updated•25 years ago
|
Severity: major → blocker
Summary: bad consolidation of platform-specific code (nsFilePath) → [DOGFOOD][blocker] bad consolidation of platform-specific code (nsFilePath)
Target Milestone: M14 → M12
Reporter | ||
Comment 6•25 years ago
|
||
This is critical. file: URLs just don't work if they're not relative to the
program directory. It's blocking my ability to get the jar: and res: protocols
working.
Assignee | ||
Updated•25 years ago
|
Status: NEW → ASSIGNED
Assignee | ||
Comment 8•25 years ago
|
||
This is a bogus fix. It looks like this area of code does checking for
existance of the url for mac only.
Warren, when I create a nsFileChannel, and I pass a bad nsIURI to the Init
method, when should the error be discovered?
Updated•25 years ago
|
Target Milestone: M12 → M14
Comment 9•25 years ago
|
||
No one is touching nsFileSpec. See if this is still a problem once nsIFile
lands.
Assignee | ||
Comment 10•25 years ago
|
||
will be fixed by 22047
Assignee | ||
Updated•25 years ago
|
Status: ASSIGNED → RESOLVED
Closed: 25 years ago
Resolution: --- → FIXED
Assignee | ||
Comment 11•25 years ago
|
||
fixed by nsIFile.
You need to log in
before you can comment on or make changes to this bug.
Description
•