Community
Participate
Working Groups
Hi, I thought there was already a bug report about this problem, but I did not find it. When using the IE as Browser on Windows within a SWT application, any webpages containing erroneus JavaScript will result in a warning dialog poping up, asking wether to continue loading the page. I just checked it with the IE, outside the SWT application, and found out that its not showing any dialog, but a small warning icon in the status area at the bottom left. It would be cool, if SWT could handle that problem the same way with not showing the dialog and maybe set a boolean flag indicating that JavaScript is malformed on the current page. The testpage I was using is: http://sports.espn.go.com/nba/news/story?id=1914791&CMP=OTC-DT9705204233 Regards, Ben
From a user: "In Internet Explorer, there is an option to only show a hint in the status bar, instead of popping up the annoying window each time." Is the SWT Browser widget somehow overiding this option? My normal IE is showing JS Script errors inside the status bar. Ben
Any plans to resolve this issue? If not, does somebody know of the setting in Internet Options that affects this popup? Ben
*** This bug has been marked as a duplicate of 49969 ***
Hm, duplicate of "IE5 - Browser badly resizes when it loses focus"?
Chris could you please reopen the bug, I dont see how Bug 49969 is connected to this bug. Ben
Oops, typo
The Browser widget does not seem to respect some IE settings. It is possible to disable JavaScript debugging in Internet Options, but this does not have any effect on the Browser widget. http://www.cnn.com is always a good candidate to show the Dialog: public class Main { public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); shell.setLayout(new FillLayout()); Browser browser = new Browser(shell, SWT.NONE); browser.setUrl("http://www.cnn.com"); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } } } Opening that site with my standalone IE does not show any dialog. Ben
Created attachment 22280 [details] Patch File I have a fix that will work in most of the cases except when you have a javascript debugging enabled in which case MS debugger will show a message box. When a script error is encountered the script engine component forwards the error to the WebBrowser control, which then queries its ControlSite and calls Exec method with the command group ID of CGID_DocHostCommandHandler and a command ID of OLECMDID_SHOWSCRIPTERROR. If the host does not return S_OK, MSHTML displays the default "An error has occurred on this page" error message. In the patch I am suppressing the error , in future you might be able to throw your custom error message. In Lotus Workplace Client DOMBrowser Component we infact have an implementation that throws custom error message. These are the changes - 1) Add in COM.java static variable public static final GUID CGID_DocHostCommandHandler = COM.IIDFromString("{f38bc242-b950-11d1-8918-00c04fc2c836}"); 2) Add following lines in the WebSite class , Exec() method int Exec(int pguidCmdGroup, int nCmdID, int nCmdExecOpt, int pvaIn, int pvaOut) { if (pguidCmdGroup != 0) { GUID guid = new GUID(); COM.MoveMemory(guid, pguidCmdGroup, GUID.sizeof); if (COM.IsEqualGUID(guid, COM.CGID_DocHostCommandHandler)) { if (nCmdID == OLECMDID_SHOWSCRIPTERROR) return COM.S_OK; else return OLECMDERR_E_UNKNOWNGROUP; } }
Cool! I would really vote to get thix fix into 3.1! Ben
me too a fix in 3.1 would be grand.
Thanks for the patch Jobi. Suppressing the javascript errors silently is not ideal, but will make embedded IE be consistent with embedded Mozilla and Safari. Fixed > 0603. The ideal solution is to have a callback that allows the client to handle the error in a context-appropriate way. This is something to consider post-3.1, so I've logged bug 98302.
*** Bug 105951 has been marked as a duplicate of this bug. ***