Closed
Bug 157135
Opened 22 years ago
Closed 22 years ago
nsIFileURL need to be frozen
Categories
(Core Graveyard :: Embedding: APIs, defect, P2)
Tracking
(Not tracked)
VERIFIED
FIXED
mozilla1.2beta
People
(Reporter: dougt, Assigned: darin.moz)
References
Details
(Keywords: arch, topembed)
Attachments
(1 file, 1 obsolete file)
31.16 KB,
patch
|
dougt
:
review+
bzbarsky
:
superreview+
|
Details | Diff | Splinter Review |
Needed Functionality
using nsIFileChannel to determine if channel is file.
maybe this can be on the nsIChannel?
Comment 2•22 years ago
|
||
-> schemeis("file", &ret) will allow you "to determine if channel is file",
won't it?
Reporter | ||
Comment 3•22 years ago
|
||
if the answer to that is a definitive yes, then we can close this bug.
Comment 4•22 years ago
|
||
IF you can give an example of why/where this is needed, then I can tell you if
it will.
nsIFileChannel gives you more functionality, though, which you may or may not need.
Reporter | ||
Comment 5•22 years ago
|
||
> IF you can give an example of why/where this is needed, then I can tell you if
it will
If i had a concrete example, I could *also* tell if this is a problem. This bug
is mainly for me to figure out if it is needed. :-)
Assignee | ||
Comment 6•22 years ago
|
||
SchemeIs("file", &ret) tells you the protocol type of a nsIURI, which also tells
you that the URL is handled by the file protocol handler. so, the SchemeIs test
is sufficient.
however, doug, i thought you mentioned that there was also need for nsIFileURL
to be frozen? what i really wanted to do was add a new parameter to
nsIStandardURL::Init that would determine if the nsStandardURL object could QI
to nsIFileURL. then the HTTP protocol handler for example could pass FALSE, and
the file protocol handler could pass TRUE. this would allow people to QI a
nsIURI to nsIFileURL to determine the nsIFile without having to first call
SchemeIs("file"). this is important since the resource URLs also map to local
files exposed via nsIFileURL.
Reporter | ||
Comment 7•22 years ago
|
||
good plan. I never like QI to nsIFileURL, have it succeed, then detecting the
failure when you call getFile().
Assignee | ||
Updated•22 years ago
|
Status: NEW → ASSIGNED
Priority: -- → P3
Target Milestone: --- → mozilla1.2beta
Assignee | ||
Comment 9•22 years ago
|
||
ok, to summarize what needs to be done here: **freeze nsIFileURL only**
i'll work on the necessary changes to nsStandardURL and nsIStandardURL to
implement comment #6 paragraph 2.
Summary: File Interface need to be frozen → nsIFileURL need to be frozen
Assignee | ||
Updated•22 years ago
|
Assignee | ||
Updated•22 years ago
|
Keywords: mozilla1.2
Assignee | ||
Comment 10•22 years ago
|
||
this patch breaks nsIFileURL out of nsStandardURL, and introduces a subclass of
nsStandardURL specific to the file protocol handler. nsResURL, which has
always been a subclass of nsStandardURL, now explicitly implements nsIFileURL
(instead of just overriding the impl from nsStandardURL).
this cleans up the "QI to nsIFileURL" issue... now only file: and resource:
nsIURI's can QI to nsIFileURL. i think this is way more inline with what folks
expect.
i've also gotten rid of a couple of create instance calls, and added in a
cleanup/optimization in the HTTP NewURI code (now it just calls new on a
nsStandardURL instead of talking to the component manager to get a
nsStandardURL object).
Assignee | ||
Comment 11•22 years ago
|
||
oh, one more important thing... it seemed cleaner to make nsIFileURL inherit
from nsISupports instead of nsIURL. this simplifies the inheritance, and i
found that it doesn't really hurt the usability of the interface since most
folks just QI to nsIFileURL to get/set the nsIFile... few actually keep a
nsIFileURL around in order to access the nsIURI/nsIURL methods. FWIW,
nsIStandardURL also inherits from nsISupports.
Reporter | ||
Comment 12•22 years ago
|
||
Comment on attachment 99291 [details] [diff] [review]
v1 patch
fix the spacing in nsExternalHelperAppService.cpp
+ nsCOMPtr <nsIFile> file;
please replace the comments that you removed from nsIStandardURL.idl with
something that reflects reality.
net_GetFileFromURLSpec doesn't null the in result. In nsFileURLImpl::GetFile,
we should null *result if there is a failur. You can fix this either in
nsFileURLImpl::GetFile or in the net_ calls.
Do we really have to clone the file in SetFile()? Shouldn't the caller just
not mess with the object it passes?
If nsIFileURL doesn't derive from nsIURL, why is it named nsXXXURL?
Assignee | ||
Comment 13•22 years ago
|
||
dougt and i talked about this bug, and we came up with a much better solution.
now, instead of subclassing nsStandardURL to add support for nsIFileURL,
nsStandardURL now provides a constructor, which allows support for nsIFileURL
to be conditionally allowed. this simplifies the inheritance structure as well
as the patch :)
a lot of the changes that i made throughout the tree in the v1 patch are still
needed since the assumption that nsStandardURL always implements nsIFileURL is
no longer valid.
Attachment #99291 -
Attachment is obsolete: true
Assignee | ||
Comment 14•22 years ago
|
||
darn, looks like i didn't address all of dougt's comments... new patch coming up.
Updated•22 years ago
|
QA Contact: mdunn → depstein
Assignee | ||
Comment 15•22 years ago
|
||
> net_GetFileFromURLSpec doesn't null the in result. In nsFileURLImpl::GetFile,
> we should null *result if there is a failur. You can fix this either in
> nsFileURLImpl::GetFile or in the net_ calls.
nsStandardURL::GetFile() never NULL'd out the return param on failure. that's
not required by XPCOM. consumers are supposed to check the nsresult returned
for failure.
otherwise, i just tweaked the patch to fix the "nsCOMPtr <nsIFile>" issue.
Reporter | ||
Comment 16•22 years ago
|
||
I could have swore that xpconnect had problems with not nulling the out var.
Comment 17•22 years ago
|
||
If the function returns an error code XPConnect doesn't touch the out parameters.
Reporter | ||
Comment 18•22 years ago
|
||
Comment on attachment 100265 [details] [diff] [review]
v2 patch
r=dougt
Before landing this, please see:
http://www.mozilla.org/projects/embedding/HowToFreeze.html
You should send a mail announcing that this interface is frozen.
Attachment #100265 -
Flags: review+
Comment 19•22 years ago
|
||
Comment on attachment 100265 [details] [diff] [review]
v2 patch
sr=bzbarsky if you file another bug on an NS_INTERFACE_MAP_ENTRY_CONDITIONAL
macro.
Attachment #100265 -
Flags: superreview+
Assignee | ||
Comment 20•22 years ago
|
||
fixed-on-trunk :)
Status: ASSIGNED → RESOLVED
Closed: 22 years ago
Resolution: --- → FIXED
Comment 21•22 years ago
|
||
Verified patch checkin against Mozilla 1.2b Mozilla/5.0 (Windows; U; WinNT4.0;
en-US; rv:1.2b) Gecko/20021026 build.
Status: RESOLVED → VERIFIED
Updated•6 years ago
|
Product: Core → Core Graveyard
You need to log in
before you can comment on or make changes to this bug.
Description
•