Closed
Bug 838705
Opened 12 years ago
Closed 12 years ago
Show the file names or "No file selected" in tooltip
Categories
(Firefox :: General, defect)
Firefox
General
Tracking
()
RESOLVED
FIXED
Firefox 22
People
(Reporter: mounir, Assigned: mounir)
References
Details
Attachments
(2 files, 2 obsolete files)
2.74 KB,
patch
|
Details | Diff | Splinter Review | |
3.83 KB,
patch
|
ttaubert
:
review+
|
Details | Diff | Splinter Review |
No description provided.
Attachment #710796 -
Flags: review?(ttaubert)
Comment 1•12 years ago
|
||
Comment on attachment 710796 [details] [diff] [review]
Patch
Review of attachment 710796 [details] [diff] [review]:
-----------------------------------------------------------------
I like the idea and think this is indeed a useful thing to have, especially if the file path is really long and you're not totally sure you attached the right file.
::: browser/base/content/browser.js
@@ +2953,5 @@
> + tipElement.type == 'file' &&
> + !tipElement.hasAttribute('title')) {
> + let files = tipElement.files;
> +
> + if (files.length == 0) {
The file input field might be "required" and |titleText| might have already been filled with the .validationMessage. We should not overwrite it and check that |titleText| is empty.
@@ +2961,5 @@
> + } else {
> + titleText = bundle.GetStringFromName("NoFileSelected");
> + }
> + } else if (files.length == 1) {
> + titleText = files[0].name;
We don't really need that branch as it's covered by the one below.
Attachment #710796 -
Flags: review?(ttaubert) → feedback+
Assignee | ||
Comment 2•12 years ago
|
||
Attachment #710803 -
Flags: review?(ttaubert)
Assignee | ||
Updated•12 years ago
|
Attachment #710796 -
Attachment is obsolete: true
Assignee | ||
Comment 3•12 years ago
|
||
(In reply to Tim Taubert [:ttaubert] from comment #1)
> Comment on attachment 710796 [details] [diff] [review]
> Patch
>
> Review of attachment 710796 [details] [diff] [review]:
> -----------------------------------------------------------------
>
> I like the idea and think this is indeed a useful thing to have, especially
> if the file path is really long and you're not totally sure you attached the
> right file.
Thanks for those comments :)
The change is actually part of a bigger change in <input type='file'> (see bug 838675). Hopefully, we will no longer be ashamed by our <input type='file'> implementation :)
Comment 4•12 years ago
|
||
Comment on attachment 710803 [details] [diff] [review]
Patch v2
Review of attachment 710803 [details] [diff] [review]:
-----------------------------------------------------------------
::: browser/base/content/browser.js
@@ +2957,5 @@
> +
> + if (files.length == 0) {
> + var bundle = Services.strings.createBundle("chrome://global/locale/layout/HtmlForm.properties");
> + if (tipElement.multiple) {
> + titleText = bundle.GetStringFromName("NoFilesSelected");
Seems like these strings don't exist in HtmlForm.properties, yet. These lines throw errors and cause old tooltips to be displayed.
Attachment #710803 -
Flags: review?(ttaubert)
Assignee | ||
Comment 5•12 years ago
|
||
Comment on attachment 710803 [details] [diff] [review]
Patch v2
Those strings are added by bug 345195. The changes in <input type='file'> are a long patch queue. Let me know if you want to actually test the change.
Attachment #710803 -
Flags: review?(ttaubert)
Comment 6•12 years ago
|
||
Comment on attachment 710803 [details] [diff] [review]
Patch v2
Review of attachment 710803 [details] [diff] [review]:
-----------------------------------------------------------------
Ok, I tested the patch with other existing strings and it works fine. This then needs to wait for bug 345195 to land.
::: browser/base/content/browser.js
@@ +2957,5 @@
> +
> + if (files.length == 0) {
> + var bundle = Services.strings.createBundle("chrome://global/locale/layout/HtmlForm.properties");
> + if (tipElement.multiple) {
> + titleText = bundle.GetStringFromName("NoFilesSelected");
Seems like these strings don't exist in HtmlForm.properties, yet. These lines throw errors and cause old tooltips to be displayed.
Attachment #710803 -
Flags: review?(ttaubert) → review+
Assignee | ||
Comment 7•12 years ago
|
||
Tim, feel free to review the tests. Most ppl don't want to do that so I will not formally ask for a review.
Attachment #710803 -
Attachment is obsolete: true
Comment 8•12 years ago
|
||
(In reply to Mounir Lamouri (:mounir) from comment #7)
> Tim, feel free to review the tests. Most ppl don't want to do that so I will
> not formally ask for a review.
Seriously? I'm fine with only skimming a test but not reviewing at all seems strange to me. I'll do that of course if you include the file in the patch ;)
Assignee | ||
Comment 9•12 years ago
|
||
Attachment #711325 -
Flags: review?(ttaubert)
Comment 10•12 years ago
|
||
Comment on attachment 711325 [details] [diff] [review]
Patch
Review of attachment 711325 [details] [diff] [review]:
-----------------------------------------------------------------
::: browser/base/content/test/browser_input_file_tooltips.js
@@ +12,5 @@
> + let tooltip = document.getElementById("aHTMLTooltip");
> +
> + for (let test of data) {
> + let input = doc.createElement('input');
> + doc.body.appendChild(input);
Should we care about removing those elements afterwards?
Attachment #711325 -
Flags: review?(ttaubert) → review+
Assignee | ||
Comment 11•12 years ago
|
||
I do not think that is needed.
Assignee | ||
Comment 12•12 years ago
|
||
Flags: in-testsuite+
Assignee | ||
Updated•12 years ago
|
Target Milestone: --- → Firefox 22
Comment 13•12 years ago
|
||
> + var bundle = Services.strings.createBundle("chrome://global/locale/layout/HtmlForm.properties");
'Services' hasn't been imported here. This should probably just get the service directly.
Also, this would be better wrapped in a try/catch block.
Comment 14•12 years ago
|
||
Status: ASSIGNED → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•