Community
Participate
Working Groups
Issue reported @ https://bugs.eclipse.org/bugs/show_bug.cgi?id=404543#c5 The cause was an earlier run of SWT not clearing out one of its browser related registry entries on exit, but since it was almost certainly caused by a crash or forced program termination I'm not sure that it can be classified as an SWT bug. When this occurs though it permanently prevents changing the IE compatibility mode via command line or directly setting the system property org.eclipse.swt.browser.IEVersion. To replicate the issue: ----------------------- 1. Regular Windows 7 installation, having any version of IE installed. Other versions of Windows will probably also be affected. 2. Start a bare bones Java program with embedded SWT browser, using the command line to force the IE into an earlier compatibility mode, eg. -Dorg.eclipse.swt.browser.IEVersion=9000. 3. Verify the IE user agent to ensure that the compatibility mode has been set. 4. SWT will check for a registry key to set the embedded IE compatibility mode for the Java process, adding it only if it's not already there. The key is HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION\<java process name>. 5. Force the Java program to terminate abruptly so that SWT doesn't have a chance to remove the temporary key. 6. Re-run the Java program, this time either without the command line option altogether or try to force a different IE compatibility mode than that set in step 2. 7. Again check the IE user agent string, which will now be stuck at the compatibility mode from step 2. Workaround: ----------- Delete the registry key at HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION\<java process name>, eg. java.exe Cause: ------ The problem is caused by an abrupt termination of any Java program that embeds an SWT browser in IE mode. Code reference: --------------- SWT's browser/IE.java, specifically the initialiser code within the create() method. This code checks for a registry key entry for the current Java process to ensure the IE compatibility mode. If there's none present it adds the key and registers a Display dispose listener to clean up the key when SWT has finished. The critical issue is that if the key is already there, no changes are made, and the existing entry will be used no matter what IE compatibility mode has been specified elsewhere. Leaving the registry key as-is rather than obliterating it is probably the right thing to do though. I hope that helps anyone else that comes across this problem.
During IE#create(), program name & IE version entry is added to the Windows registry and same gets deleted during the dispose cycle. Since there is a possibility of the entry not getting deleted, if the SWT application crashes or is exited forcefully. Proposed solution: Not only just create a new registry entry for Program name and IE version pair, but also update it with the new IE version when such entry already exists in the registry during IE#create. And the same gets deleted from the registry on proper application dispose.
Fixed the issue via below patch: http://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?id=0f2010e79a3a02a0e6cbbcfb3b9b4f3413094c2f
Thank you, Niraj.
Verified the fix in I20140804-2000 build.
Reopening this bug for back-port to 4.4.1 release. Arun, for your review.
(In reply to Niraj Modi from comment #5) > Reopening this bug for back-port to 4.4.1 release. > Arun, for your review. Approved for back port to 4.4.1.
Thanks for the quick review Arun. Back-ported the change to 'R4_4_maintenance' branch via below patch: http://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?h=R4_4_maintenance&id=944405bda7af034dbc2cb634b07677d56d54280a
Verified the fix in M20140827-1200 build
*** Bug 422056 has been marked as a duplicate of this bug. ***