The default bug view has changed. See this FAQ.

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

VERIFIED FIXED

Status

()

Core
Widget: Win32
VERIFIED FIXED
5 years ago
5 years ago

People

(Reporter: Alice0775 White, Assigned: neil@parkwaycc.co.uk)

Tracking

({regression})

11 Branch
x86
Windows 7
regression
Points:
---

Firefox Tracking Flags

(firefox11 verified)

Details

(Whiteboard: [qa!])

Attachments

(1 attachment)

(Reporter)

Description

5 years ago
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

Updated

5 years ago
Assignee: nobody → jmathies

Updated

5 years ago
Assignee: jmathies → neil
(Assignee)

Comment 1

5 years ago
Created attachment 585758 [details] [diff] [review]
Proposed patch
Attachment #585758 - Flags: review?(jmathies)

Comment 2

5 years ago
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+
(Assignee)

Comment 3

5 years ago
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?

Comment 4

5 years ago
(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.

Comment 5

5 years ago
Comment on attachment 585758 [details] [diff] [review]
Proposed patch

https://hg.mozilla.org/mozilla-central/rev/3ec9d6539335
Attachment #585758 - Flags: approval-mozilla-aurora?

Updated

5 years ago
Status: NEW → RESOLVED
Last Resolved: 5 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
(Assignee)

Comment 7

5 years ago
(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 8

5 years ago
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+

Comment 9

5 years ago
Neil, would you like me to land 3ec9d6539335 on Aurora?
(Assignee)

Comment 10

5 years ago
Yes please, I don't have an aurora tree.

Comment 11

5 years ago
https://hg.mozilla.org/releases/mozilla-aurora/rev/c6e163903f18
status-firefox11: --- → fixed
Whiteboard: [qa+]

Comment 12

5 years ago
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
status-firefox11: fixed → verified
Whiteboard: [qa+] → [qa!]
You need to log in before you can comment on or make changes to this bug.