A bug was discovered back in mid 2012 that caused the Firefox browser window to lose focus under certain circumstances when Flash contents were played in it.
What this meant is that Firefox users had to click on the browser window to make it the active window on the system again even if it was the active window before.
The system the bug was encountered on was a x86 Windows 7 operating system with Flash 11.3 initially but other systems such as Windows 8.1 are also affected by it according to user reports.
According to Mozilla, it is a bug in Flash and not in Firefox that is causing the issue for users of the browser.
The issue was quickly linked to Flash's Protected Mode. Users who disabled the mode or ran operating systems were it was not available did not experience the issue.
Reproduce the issue
To reproduce the issue you need to visit a web page that runs Flash contents, e.g. http://www.adobe.com/software/flash/about.
You will notice that Flash processes are loaded when you open the Task Manager of the system with Ctrl-Shift-Esc.
It is then necessary to close all windows that play Flash contents again and wait until the Flash process is terminated automatically.
When you then open a web page with Flash again, Firefox will lose focus.
Other bugs may be related to the issue, for instance that new windows open in the background and not foreground on the system.
Fixing the issue
Mozilla cooperated with Adobe on the bug but a solution was nowhere in sight.
Yesterday, Aaron Klotz published a comment on the Bugzilla but report that confirmed that a possible patch for the issue has been found.
Possible patch using LockSetForegroundWindow
This patch wraps out of process NP_Initialize calls with LockSetForegroundWindow. This appears to do the right thing.
The implementation is currently being tested but it looks promising so far. If no issues are discovered during tests, it may find its way into Firefox Nightly quickly and from there on all the way down to the stable version of the browser.
Update: It appears that Adobe has fixed the bug as well in Flash Player 15 which you can see on this page.
Firefox will now retain focus when Flash Player processes are launched (3223393)