Closed Bug 715129 Opened 13 years ago Closed 13 years ago

fp.appendFilters(nsIFilePicker.filterApps) does not show ".exe" file in the file picker

Categories

(Core :: Widget: Win32, defect)

11 Branch
x86
Windows 7
defect
Not set
normal

Tracking

()

VERIFIED FIXED
Tracking Status
firefox11 --- verified

People

(Reporter: alice0775, Assigned: neil)

References

Details

(Keywords: regression, Whiteboard: [qa!])

Attachments

(1 file)

Build Identifier:
http://hg.mozilla.org/releases/mozilla-aurora/rev/e2fe885dce01
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:11.0a2) Gecko/20120102 Firefox/11.0a2 ID:20120102042006

fp.appendFilters(nsIFilePicker.filterApps) does not show ".exe" file in the file picker

Reproducible: Always

Steps to Reproduce:
1. Start Firefox with clean profile
2. Open Error Console (Ctrl+Shift+J)
3. Paste the following code

const nsIFilePicker = Components.interfaces.nsIFilePicker;
var fp = Components.classes["@mozilla.org/filepicker;1"]
	           .createInstance(nsIFilePicker);
fp.init(window, "Dialog Title", nsIFilePicker.modeOpen);
fp.appendFilters(nsIFilePicker.filterApps);
var rv = fp.show();

4. Click Evaluate
5. Go to folder which contain ".exe" file (Ex. "C:\Program Files (x86)\Mozilla Firefox")
   and Try to select any ".exe" file

Actual Results:
  No ".exe" file is listed in the file picker

Expected Results:
  ".exe" file should be listed in the file picker


Regression window
Works:
http://hg.mozilla.org/mozilla-central/rev/d508455660d3
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:11.0a1) Gecko/20111214 Firefox/11.0a1 ID:20111214125611
Fails:
http://hg.mozilla.org/mozilla-central/rev/5131c0b1982f
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:11.0a1) Gecko/20111214 Firefox/11.0a1 ID:20111214132414
Pushlog:
http://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=d508455660d3&tochange=5131c0b1982f

Suspected : Bug 661991
Assignee: nobody → jmathies
Assignee: jmathies → neil
Attached patch Proposed patchSplinter Review
Attachment #585758 - Flags: review?(jmathies)
Comment on attachment 585758 [details] [diff] [review]
Proposed patch

Review of attachment 585758 [details] [diff] [review]:
-----------------------------------------------------------------

::: widget/src/windows/nsFilePicker.cpp
@@ +1356,5 @@
> +  else {
> +    pStr->StripWhitespace();
> +    if (pStr->EqualsLiteral("*"))
> +      pStr->AppendLiteral(".*");
> +  }

In the second part you're missing the initial assignment - 

pStr->Assign(aFilter);
pStr->StripWhitespace();
..


r+ with this addressed.
Attachment #585758 - Flags: review?(jmathies) → review+
Comment on attachment 585758 [details] [diff] [review]
Proposed patch

>-  pStr = mStrings.AppendElement(aFilter);
>+  pStr = mStrings.AppendElement();
Or I could alternatively revert this change. Which would you prefer?
(In reply to neil@parkwaycc.co.uk from comment #3)
> Comment on attachment 585758 [details] [diff] [review]
> Proposed patch
> 
> >-  pStr = mStrings.AppendElement(aFilter);
> >+  pStr = mStrings.AppendElement();
> Or I could alternatively revert this change. Which would you prefer?

Thought we might still get the '..apps' in the drop down here, but we over write the value, so yeah this is fine by me.
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Comment on attachment 585758 [details] [diff] [review]
Proposed patch

> nsFilePicker::ComDlgFilterSpec::Append(const nsAString& aTitle, const nsAString& aFilter)
> {
>-  PRUint32 size = sizeof(COMDLG_FILTERSPEC);
>-  PRUint32 hdrLen = size * (mLength + 1);
>-  mSpecList = (COMDLG_FILTERSPEC*)realloc(mSpecList, hdrLen);
>-  if (!mSpecList) {
>+  COMDLG_FILTERSPEC* pSpecForward = mSpecList.AppendElement();
>+  if (!pSpecForward) {
>     NS_WARNING("mSpecList realloc failed.");
>     return;
>   }

This is infallible; if it shouldn't be, the declaration should use an explicitly fallible nsAutoTArray
(In reply to Ms2ger from comment #6)
> This is infallible
Sorry, I was copying the style of the rest of the function, which also checks.
Comment on attachment 585758 [details] [diff] [review]
Proposed patch

[Triage Comment]
Approving for Aurora along with bug 712571. As noted there, it would be higher risk to back out all or part of 661991.
Attachment #585758 - Flags: approval-mozilla-aurora? → approval-mozilla-aurora+
Neil, would you like me to land 3ec9d6539335 on Aurora?
Yes please, I don't have an aurora tree.
Whiteboard: [qa+]
Verified as fixed on:
Mozilla/5.0 (Windows NT 6.1; rv:11.0) Gecko/20100101 Firefox/11.0

The .exe files are displayed in the file picker.
Status: RESOLVED → VERIFIED
Whiteboard: [qa+] → [qa!]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: