Bug 565312 - [Browser][Windows] Eclipse windows browser listens to all location changes and can throw exception
Summary: [Browser][Windows] Eclipse windows browser listens to all location changes an...
Status: NEW
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.16   Edit
Hardware: PC Windows 10
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Platform-UI-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-07-17 17:23 EDT by G E CLA
Modified: 2020-12-21 07:29 EST (History)
1 user (show)

See Also:


Attachments
html sample file to reproduce the problem (452 bytes, text/html)
2020-07-17 17:23 EDT, G E CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description G E CLA 2020-07-17 17:23:30 EDT
Created attachment 283634 [details]
html sample file to reproduce the problem

What steps will reproduce the problem?
1. Use an Eclipse version 4.16, Win 10.
2. Open Error Log view
3. Open the attached html file (emptyJavascriptIFrameScript.html, or copied at the end of this bug) with Eclipse default internal browser.

What is the expected output? 
No exception on Error Log view

What do you see instead? Please provide screen shots if possible.
Exception thrown in the Error Log view: "Unhandled event loop exception"
See step 5. "Error stack trace" below.

Additional info:
1. This is a regression as it doesn't throw this error on prior versions of Eclipse. This works on Eclipse 4.15 and erlier versions, and was introduced in 4.16.
2. This works with Eclipse 4.16 Mac.
3. It seems the new way of the BrowserViewer of handling URI handlers caused this. https://www.eclipse.org/eclipse/news/4.16/platform_isv.html
Even though this error doesn't even get to the handlers.

On 4.15 the 1st statement of the BrowserViewer locationListener was:
if (!event.top) return;
but 4.16 this error occurs while trying to create a URI from 'javascript:""', before calling/using the handlers.
If we respect that same event.top statement on 4.16 my application loads back again.

4. Needless to say, the actual HTML that we are loading is way more complex than this attached example, but this was a much simpler version to reproduce the error.

5. Error stack trace:
null
org.eclipse.ui.workbench
Error
Fri Jul 17 13:58:07 PDT 2020
Unhandled event loop exception

java.lang.IllegalArgumentException: Illegal character in opaque part at index 11: javascript:""
	at java.net.URI.create(URI.java:863)
	at org.eclipse.ui.internal.browser.BrowserViewer.lambda$0(BrowserViewer.java:240)
	at org.eclipse.ui.internal.browser.BrowserViewer$$Lambda$1151.0000000023A1F170.accept(Unknown Source)
	at org.eclipse.swt.browser.LocationListener$1.changing(LocationListener.java:81)
	at org.eclipse.swt.browser.IE.lambda$6(IE.java:525)
	at org.eclipse.swt.browser.IE$$Lambda$1005.0000000021E26170.handleEvent(Unknown Source)
	at org.eclipse.swt.ole.win32.OleEventTable.sendEvent(OleEventTable.java:58)
	at org.eclipse.swt.ole.win32.OleEventSink.notifyListener(OleEventSink.java:160)
	at org.eclipse.swt.ole.win32.OleEventSink.Invoke(OleEventSink.java:128)
	at org.eclipse.swt.ole.win32.OleEventSink.access$1(OleEventSink.java:105)
	at org.eclipse.swt.ole.win32.OleEventSink$1.method6(OleEventSink.java:79)
	at org.eclipse.swt.internal.ole.win32.COMObject.callback6(COMObject.java:120)
	at org.eclipse.swt.internal.win32.OS.DispatchMessage(Native Method)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3628)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1158)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1047)
	at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:155)
	at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:658)
	at org.eclipse.ui.internal.Workbench$$Lambda$32.0000000014751AE0.run(Unknown Source)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:557)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:154)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:150)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:203)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:137)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:107)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:401)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:255)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:90)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55)
	at java.lang.reflect.Method.invoke(Method.java:508)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:657)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:594)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1447)
Caused by: java.net.URISyntaxException: Illegal character in opaque part at index 11: javascript:""
	at java.net.URI$Parser.fail(URI.java:2859)
	at java.net.URI$Parser.checkChars(URI.java:3032)
	at java.net.URI$Parser.parse(URI.java:3069)
	at java.net.URI.<init>(URI.java:599)
	at java.net.URI.create(URI.java:861)
	... 35 more

6. <emptyJavascriptIFrameScript.html>
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <title>w iframe</title>
	<script>
		function init() {
			var myiframe = document.createElement('iframe');
			myiframe.setAttribute('src', 'javascript:""');
			document.body.appendChild(myiframe);
			document.getElementById("mycontent").innerText = "loaded";
		}
	</script>
  </head>
  <body onload="init();">
	<p id="mycontent">loading...</p>
  </body>
</html>