Hello noel,
I'd like you to do a code review. Please execute
g4 diff -c 11169579
or point your web browser to
http://mondrian/11169579
to review the following code:
Change 11169579 by nigel...@nigeltao-srcgears2 on 2009/05/18 15:27:17 *pending*
For drag-and-drop Firefox/Linux, check whether or not we're dragging
directories, or special (i.e. not regular files, dirs or symlinks)
"files".
For Firefox/non-Linux, also check for special "files", and also
return early (rather than continue) if a multiple-file drag-and-drop
contains a directory.
PRESUBMIT=passed
R=noel
[email protected]
DELTA=10 (6 added, 0 deleted, 4 changed)
OCL=11169579
Affected files ...
...
//depot/googleclient/gears/opensource/gears/desktop/drag_and_drop_utils_ff.cc#17
edit
10 delta lines: 6 added, 0 deleted, 4 changed
Also consider running:
g4 lint -c 11169579
which verifies that the changelist doesn't introduce new style violations.
If you can't do the review, please let me know as soon as possible. During
your review, please ensure that all new code has corresponding unit tests and
that existing unit tests are updated appropriately. Visit
http://www/eng/code_review.html for more information.
This is a semiautomated message from "g4 mail". Complaints or suggestions?
Mail [email protected].
Change 11169579 by nigel...@nigeltao-srcgears2 on 2009/05/18 15:27:17 *pending*
For drag-and-drop Firefox/Linux, check whether or not we're dragging
directories, or special (i.e. not regular files, dirs or symlinks)
"files".
For Firefox/non-Linux, also check for special "files", and also
return early (rather than continue) if a multiple-file drag-and-drop
contains a directory.
Affected files ...
...
//depot/googleclient/gears/opensource/gears/desktop/drag_and_drop_utils_ff.cc#17
edit
====
//depot/googleclient/gears/opensource/gears/desktop/drag_and_drop_utils_ff.cc#17
-
/home/nigeltao/srcgears2/googleclient/gears/opensource/gears/desktop/drag_and_drop_utils_ff.cc
====
# action=edit type=text
--- googleclient/gears/opensource/gears/desktop/drag_and_drop_utils_ff.cc
2009-05-18 15:16:58.000000000 +1000
+++ googleclient/gears/opensource/gears/desktop/drag_and_drop_utils_ff.cc
2009-05-18 15:22:01.000000000 +1000
@@ -437,8 +437,12 @@
nsString filename;
nr = file->GetPath(filename);
if (NS_FAILED(nr)) { success = false; break; }
- // TODO(nigeltao): check if the file is actually readable (as opposed to,
- // for example, a directory).
+
+ PRBool bool_result;
+ nr = file->IsDirectory(&bool_result);
+ if (NS_FAILED(nr) || bool_result) { success = false; break; }
+ nr = file->IsSpecial(&bool_result);
+ if (NS_FAILED(nr) || bool_result) { success = false; break; }
filenames.push_back(std::string16(filename.get()));
}
@@ -594,8 +598,10 @@
PRBool bool_result = false;
if (NS_FAILED(file->IsDirectory(&bool_result)) || bool_result) {
- // TODO(nigeltao): Perhaps "return false" is better than "continue".
- continue;
+ return false;
+ }
+ if (NS_FAILED(file->IsSpecial(&bool_result)) || bool_result) {
+ return false;
}
nsCOMPtr<nsILocalFile> local_file =