Closed
Bug 838821
Opened 12 years ago
Closed 12 years ago
don't use file.exists() when not necessary (browser/components)
Categories
(Firefox :: General, defect)
Tracking
()
RESOLVED
FIXED
Firefox 21
People
(Reporter: marco, Assigned: marco)
References
(Blocks 1 open bug)
Details
(Whiteboard: [Snappy])
Attachments
(1 file, 4 obsolete files)
1.28 KB,
patch
|
Details | Diff | Splinter Review |
No description provided.
Assignee | ||
Comment 1•12 years ago
|
||
Attachment #710951 -
Flags: review?(dietrich)
Updated•12 years ago
|
Attachment #710951 -
Flags: review?(dietrich) → review?(mak77)
Comment 2•12 years ago
|
||
Comment on attachment 710951 [details] [diff] [review]
Patch
Drive-by yoink!
For nsBrowserContentHandler, we're going to remove that code anyways in bug 703377, and it essentially never runs anymore, so I would just leave it.
For applications.js, it seems like we should convert all of that code to OS.File, rather than fixing only this very specific piece of it.
The _SessionFile.jsm change looks fine.
Attachment #710951 -
Flags: review?(mak77) → review-
Assignee | ||
Comment 3•12 years ago
|
||
Thank you Marco.
> For applications.js, it seems like we should convert all of that code to
> OS.File, rather than fixing only this very specific piece of it.
Can we apply this fix in this patch, and open a new bug to port everything to OS.File?
Attachment #710951 -
Attachment is obsolete: true
Attachment #710964 -
Flags: review?(mak77)
Comment 4•12 years ago
|
||
Comment on attachment 710964 [details] [diff] [review]
Patch v2
since Gavin started looking at this, let's fix requests properly!
Attachment #710964 -
Flags: review?(mak77) → review?(gavin.sharp)
Comment 5•12 years ago
|
||
Comment on attachment 710964 [details] [diff] [review]
Patch v2
I don't think it's worth touching the code only to change the exists() call, since the benefit is negligible (the isExecutable call right after it will do a stat as well).
It makes sense to remove uses of exists() in places where it's the only use of nsIFile (or where we can't yet get rid of the synchronous I/O entirely, as in the _SessionFile.jsm change here), but otherwise we should focus on porting to OS.File.
Attachment #710964 -
Flags: review?(gavin.sharp) → review-
Assignee | ||
Comment 6•12 years ago
|
||
Attachment #710964 -
Attachment is obsolete: true
Attachment #710971 -
Flags: review?(gavin.sharp)
Comment 7•12 years ago
|
||
Comment on attachment 710971 [details] [diff] [review]
Patch v3
Seems like Cr isn't defined in this file? Did you test this patch?
Assignee | ||
Comment 8•12 years ago
|
||
(In reply to :Gavin Sharp (use gavin@gavinsharp.com for email) from comment #7)
> Comment on attachment 710971 [details] [diff] [review]
> Patch v3
>
> Seems like Cr isn't defined in this file? Did you test this patch?
I've sent it to try, waiting for the results.
Assignee | ||
Comment 9•12 years ago
|
||
Attachment #710971 -
Attachment is obsolete: true
Attachment #710971 -
Flags: review?(gavin.sharp)
Attachment #711561 -
Flags: review?(gavin.sharp)
Comment 10•12 years ago
|
||
Comment on attachment 711561 [details] [diff] [review]
Patch v4
Can you change the |return null| in the catch block to |return "";|? It doesn't make a difference in practice at the moment because the only callers just end up null checking, but it makes more sense semantically (there's no need to distinguish "nonexistent file" from "failed to read file" or "empty file").
Attachment #711561 -
Flags: review?(gavin.sharp) → review+
Assignee | ||
Comment 11•12 years ago
|
||
Attachment #711561 -
Attachment is obsolete: true
Assignee | ||
Updated•12 years ago
|
Keywords: checkin-needed
Comment 12•12 years ago
|
||
Keywords: checkin-needed
Comment 13•12 years ago
|
||
Status: ASSIGNED → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 21
You need to log in
before you can comment on or make changes to this bug.
Description
•