Closed
Bug 37406
Opened 26 years ago
Closed 25 years ago
nsIFile.delete conflicts with JS reserved name[NEED REVIEWERS]
Categories
(Core :: XPCOM, defect, P3)
Core
XPCOM
Tracking
()
RESOLVED
FIXED
mozilla0.9.3
People
(Reporter: dougt, Assigned: pete)
Details
(Keywords: arch)
Attachments
(13 files)
|
280 bytes,
patch
|
Details | Diff | Splinter Review | |
|
420 bytes,
patch
|
Details | Diff | Splinter Review | |
|
967 bytes,
patch
|
Details | Diff | Splinter Review | |
|
1.21 KB,
patch
|
Details | Diff | Splinter Review | |
|
2.65 KB,
patch
|
Details | Diff | Splinter Review | |
|
3.30 KB,
patch
|
Details | Diff | Splinter Review | |
|
3.30 KB,
patch
|
Details | Diff | Splinter Review | |
|
1.78 KB,
patch
|
Details | Diff | Splinter Review | |
|
3.40 KB,
patch
|
Details | Diff | Splinter Review | |
|
3.35 KB,
patch
|
Details | Diff | Splinter Review | |
|
3.34 KB,
patch
|
Details | Diff | Splinter Review | |
|
27.10 KB,
patch
|
Details | Diff | Splinter Review | |
|
27.87 KB,
patch
|
Details | Diff | Splinter Review |
No description provided.
| Reporter | ||
Updated•26 years ago
|
Severity: normal → critical
Target Milestone: --- → M16
| Assignee | ||
Comment 1•26 years ago
|
||
| Assignee | ||
Comment 2•26 years ago
|
||
Here is a real simple patch.
I just renamed "delete" to "Delete" in nsIFIle.idl
This should be good enough right??
Otherwise if you rename it to "Remove" or something there are member
references across *many* files that will need changing.
This is a two minute fix.
pete
Comment 3•26 years ago
|
||
So as I wrote in e-mail, XPIDL style is to name methods and attributes interCaps
not InterCaps, so Delete is bad style. How about remove (or *shudder* unlink)?
/be
| Reporter | ||
Comment 5•26 years ago
|
||
using uppercase D in Delete() break javascript style guidelins.
| Assignee | ||
Comment 6•26 years ago
|
||
I'll vote Break style w/ DougT.
Time is an issue here.
pete
| Reporter | ||
Comment 7•26 years ago
|
||
huh? maybe I did not read what I wrote ;-) , but I did not mean to imply that
we should just hack this. If you want, apply this fix to your tree for a few
days until we fix it correctly.
brendan, i vote for remove(). unlink, although posix and really more descriptive
of the action, will cause me ear pain.
Comment 8•26 years ago
|
||
Pete: Time is not an issue if you use file["delete"]() from JS, right? In fact
we could declare victory and not even change the method name -- too bad that it
is reserved in JS. What's the rush to rename to Delete?
/be
| Assignee | ||
Comment 9•26 years ago
|
||
True. But i just checked, it is not used in any js file I can find.
DougT, i was just trying to save you some work.
If you change it to remove or unlink etc . . .
There is much more work involved there.
I'll use file['delete'](); for now.
And watch this bug for any changes.
thanks
pete
| Assignee | ||
Comment 10•26 years ago
|
||
For the style purests, you might want to look at:
unsigned long Write(in string buf, in unsigned long count);
in nsIOutputStream.idl
i guess it should be
unsigned long write(in string buf, in unsigned long count);
pete
Comment 11•26 years ago
|
||
The "xpidl capitalizes C++ bindings" change was made a year ago, but then no one
swept through and renamed a bunch of methods and attributes to be uncapitalized.
It was easier then, because there were fewer scripts and [scriptables]. Oh
well. We'll get to it, but two (or N) wrongs don't make a right!
I'm going to avoid cleaning up name style incongruence for its own sake, but as
part of the Mozilla interface freeze I'm nerving myself to propose, I'll propose
that Mozilla XPIDL interCaps style be applied uniformly in the public APIs.
/be
/be
Comment 13•26 years ago
|
||
Probable part of API freeze; hope to do quickly, when there are few uses.
/be
Target Milestone: M16 → M17
Updated•26 years ago
|
| Reporter | ||
Comment 14•26 years ago
|
||
*** Bug 46774 has been marked as a duplicate of this bug. ***
Updated•26 years ago
|
Target Milestone: M18 → mozilla0.9
Updated•25 years ago
|
QA Contact: leger → kandrot
| Assignee | ||
Comment 15•25 years ago
|
||
Hey Doug, why not keep delete for backward compatability and then add another
method called "rm" or "remove" or something. Then it won't break any existing
code and the new name can be used nicely from any js code.
--pete
Comment 16•25 years ago
|
||
Pete's right, let's extend the vtbl and keep old code working.
/be
Comment 17•25 years ago
|
||
Slipping and sliding.
/be
Keywords: mozilla1.0
Target Milestone: mozilla0.9 → mozilla0.9.1
| Assignee | ||
Comment 18•25 years ago
|
||
| Assignee | ||
Comment 19•25 years ago
|
||
| Assignee | ||
Comment 20•25 years ago
|
||
| Assignee | ||
Comment 21•25 years ago
|
||
Is something like this a good solution?
A simple wrapper around nsLocalFile::Delete
Interface method name = remove
Implementation name = nsLocalFile::Remove
--pete
| Assignee | ||
Comment 22•25 years ago
|
||
It works:
js> f.create(f.NORMAL_FILE_TYPE, 0644);
null
js> f.exists();
true
js> f.path;
/tmp/fubar
js> f.remove(false);
null
js> f.exists();
false
js>
Comment 23•25 years ago
|
||
Is renaming an interface method really the way that kind of naming conflicts
should be resolved in XPCOM?
Shouldn't XPCOM/xpidl instead define some general rule to escape names which are
reserved in a programming language? I.e. prepend a "_" if an IDL-defined name is
reserved in the programming language.
Comment 24•25 years ago
|
||
My laptop is dying (bad SIMM?), I'm doomed for 0.9.1 unless a patch is in hand.
/be
Target Milestone: mozilla0.9.1 → mozilla0.9.2
| Assignee | ||
Comment 25•25 years ago
|
||
| Assignee | ||
Comment 26•25 years ago
|
||
If i get some review love we can move on . . .
--pete
| Assignee | ||
Comment 27•25 years ago
|
||
removed shaver by mistake. Sorry.
--pete
| Assignee | ||
Comment 28•25 years ago
|
||
Verify patch:
js> const localFile='/tmp/baz';
js> const File=new Components.Constructor("@mozilla.org/file/local;1",
"nsILocalFile");
js> var f=new File();
js> f.initWithPath(localFile);
js> f.exists();
true
js> f.remove(false);
js> f.exists();
false
js>
Comment 29•25 years ago
|
||
Thanks pete -- let's get this in for 0.9.2. Do you want to take this bug from
me (please ;-) ?
/be
| Assignee | ||
Comment 30•25 years ago
|
||
Sure, lets get this in. Assign it to me.
Do i have an sr from you Brendan?
--pete
Comment 31•25 years ago
|
||
The cvs.mozilla.org trunk is closed for 0.9.1 right now, so wait a week or two
for the branch to be cut and the trunk to be opened to 0.9.2 fixes.
Review: can you move remove()'s prototype in the .idl file to the very end of
the interface, with a doc-comment explaining that it's the new name, and that it
is at the end to promote binary compatibility. Deprecate delete while you're at
it, with a comment above that prototype.
/be
Assignee: brendan → petejc
Status: ASSIGNED → NEW
| Assignee | ||
Comment 32•25 years ago
|
||
| Assignee | ||
Comment 33•25 years ago
|
||
Test of patch:
js> const localFile='/tmp/baz';
js> const File=new Components.Constructor("@mozilla.org/file/local;1",
"nsILocalFile");
js> var f=new File();
js> f.initWithPath(localFile);
js> f.exists();
true
js> f.remove(false);
js> f.exists();
false
js>
| Assignee | ||
Comment 34•25 years ago
|
||
| Assignee | ||
Comment 35•25 years ago
|
||
| Assignee | ||
Updated•25 years ago
|
| Assignee | ||
Comment 36•25 years ago
|
||
This has been sitting in my tree for a veryt long time.
Can I get some review love on this?
Thanks
--pete
| Assignee | ||
Comment 37•25 years ago
|
||
Comment 38•25 years ago
|
||
Shouldn't Remove be implemented as "return Delete(recursive);" instead of always
returning NS_OK?
| Assignee | ||
Comment 39•25 years ago
|
||
| Assignee | ||
Comment 40•25 years ago
|
||
| Assignee | ||
Comment 41•25 years ago
|
||
moving Target Milestone to 0.9.3
Can we get it in as soon as the tree opens?
Target Milestone: mozilla0.9.2 → mozilla0.9.3
| Assignee | ||
Updated•25 years ago
|
Summary: nsIFile.delete conflicts with JS reserved name[PATCH] → nsIFile.delete conflicts with JS reserved name[NEED REVIEWERS]
Comment 42•25 years ago
|
||
Hmm, I'm not sure I agree with this, what exactly are the reasons for just not
renaming 'delete' to 'remove', is this method really used that often that
changing the name would be that hard (hmm, lxr isn't talking to me right now so
I can't tell)? Renaming the method would be better from a backwards
compatibility point of view, adding the method causes the vtable to grow which
will make the ABI (i.e. binary foot print) of interfaces that inherit nsIFile
incompatible with earlier versions whereas reanming the current method simply
causes compile time problems that are trivial to fix and no binary compatibility
problems what so ever.
Are we sure we wanto add this method?
| Assignee | ||
Updated•25 years ago
|
Status: NEW → ASSIGNED
| Assignee | ||
Comment 43•25 years ago
|
||
Changing email address
Assignee: petejc → petejc
Status: ASSIGNED → NEW
| Assignee | ||
Updated•25 years ago
|
Status: NEW → ASSIGNED
| Assignee | ||
Comment 44•25 years ago
|
||
| Assignee | ||
Comment 45•25 years ago
|
||
Going w/ jst's suggestions i renamed delete to remove.
Can i get a review on this patch?
Thanks
--pete
Comment 46•25 years ago
|
||
sr=jst, assuming that we all agree that this is the right thing to do here,
Brendan? Dougt?
| Reporter | ||
Comment 47•25 years ago
|
||
remove is fine i guess.
| Assignee | ||
Comment 48•25 years ago
|
||
So, Doug is that an r= ??
If so please put it here in writing and i will check it in in the morning and
then spam various news groups about this API change.
--pete
| Reporter | ||
Comment 49•25 years ago
|
||
Why don't you do it the other way around: spam the newsgroups tonight that you
care changing the name. If you get no feedback tomorrow night, check it in....
r=me.
Comment 50•25 years ago
|
||
Spam today, change tomorrow. I say let's get this over with. Thanks, pete.
/be
| Assignee | ||
Comment 51•25 years ago
|
||
| Assignee | ||
Comment 52•25 years ago
|
||
checked in.
--pete
| Assignee | ||
Comment 53•25 years ago
|
||
Well, i don't see any flames.
Marking fixed.
--pete
Status: ASSIGNED → RESOLVED
Closed: 25 years ago
Resolution: --- → FIXED
Comment 54•25 years ago
|
||
it would have been nice if this had been coordinated with someone checking in
the same API changes on the Netscape tree which is now in flames and closed.
| Assignee | ||
Comment 55•25 years ago
|
||
I have no knowledge of the Netscape tree . . .
Brendan, Doug, jst . . . ?
I posted a heads up yetserday to XPCOM ng. Again this morning in the builds ng.
I need to be told about such things. I would have gladly coordiniated this had i
known . . .
--pete
Comment 56•25 years ago
|
||
Pete, we (me and dougt) should've told you about that, but I at least simply
forgot about it, this is our fault, not your fault.
Looks like mcafee already fixed the *one* occurance of nsIFile->Delete() in the
commercial tree so there shouldn't be anything to worry about any more.
| Reporter | ||
Comment 57•25 years ago
|
||
I suck. I should have caugh this... but just illistrates another reason why the
nscp commercial tree should pull a tag of mozilla.
You need to log in
before you can comment on or make changes to this bug.
Description
•