Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » Client-Error: Browser-Widget can not access unkown domain from
Client-Error: Browser-Widget can not access unkown domain from [message #1823248] Mon, 23 March 2020 15:51 Go to next message
Marco Descher is currently offline Marco DescherFriend
Messages: 197
Registered: October 2010
Location: Austria
Senior Member
I have a RCP application that I want to make runnable in RAP. The sample I am working on embedds https://fullcalender.io in a Browser widget, with some BrowserFunction contributions etc.

Using this in an e4 RAP application leaves the internal IDE browser with "The application terminated unexpectedly" and Details showing

Error: Error: Operation "call" on target "w13" of type "rwt.widgets.Browser" failed:
SecurityRestriction:
Browser-Widget can not access unkown domain from "127.0.0.1:61163".
Properties: 
script = $('#calendar').fullCalendar('option', 'maxTime', '23:59:00');$('#calendar').fullCalendar('option', 'minTime', '00:00:00');


  Script: {"head":{},"operations":[["call","w13","evaluate",{"script":"$('#calendar').fullCalendar('option', 'maxTime', '23:59:00');$('#calendar').fullCalendar('option', 'minTime', '00:00:00');"}]]}
  line: 62748
  column: 20
  sourceURL: http://127.0.0.1:61163/rwt-resources/3120/rap-client.js
  Stack: _processError@http://127.0.0.1:61163/rwt-resources/3120/rap-client.js:62748:20
processOperationArray@http://127.0.0.1:61163/rwt-resources/3120/rap-client.js:62587:25
processMessage@http://127.0.0.1:61163/rwt-resources/3120/rap-client.js:62539:33
_handleSuccess@http://127.0.0.1:61163/rwt-resources/3120/rap-client.js:63227:33
_success@http://127.0.0.1:61163/rwt-resources/3120/rap-client.js:31585:46
_onReadyStateChange@http://127.0.0.1:61163/rwt-resources/3120/rap-client.js:31622:24
http://127.0.0.1:61163/rwt-resources/3120/rap-client.js:624:22
  Debug: on
  Request: {"head":{"requestCounter":3},"operations":[["notify","w13","Progress",{}],["set","w1",{"cursorLocation":[337,417]}]]}


The external Chrome browser does not show anything, except in the developers console you see a stalled request that never returns.

I found little on the interwebs to this like https://bugs.eclipse.org/bugs/show_bug.cgi?id=508289 or https://www.eclipse.org/forums/index.php/t/241398/

I don't really understand the problem, and where to start to get it working!

Grateful for any hints or pokes on this!
Re: Client-Error: Browser-Widget can not access unkown domain from [message #1823255 is a reply to message #1823248] Mon, 23 March 2020 16:49 Go to previous messageGo to next message
Cole Markham is currently offline Cole MarkhamFriend
Messages: 150
Registered: July 2009
Location: College Station, TX
Senior Member

What you're running into is a browser limitation put in place for security purposes. See the mozilla documentation which should be similar for all browsers, specifically the section on Cross-origin Script API Access: https://developer.mozilla.org/en-US/docs/Web/Security/Same-origin_policy - And the microsoft version: https://docs.microsoft.com/en-us/skype-sdk/ucwa/cross_domainiframe

In short, you can't call javascript on an iframe that belongs to another domain. To my knowledge there's not even a way to disable it for local testing. I was running into a similar issue with local services on two different ports (e.g. RAP running on localhost:10080 and another service in my iframe running on localhost:8080). The only workaround I know of is to use a reverse proxy so that both services are hosted on the same domain. Even a subdomain won't work properly (there is supposed to be a workaround where the script in the iframe explicitly allows calls from another domain, but I couldn't get it to work in my limited testing).

Hope you get it working.
Re: Client-Error: Browser-Widget can not access unkown domain from [message #1823257 is a reply to message #1823255] Mon, 23 March 2020 16:59 Go to previous messageGo to next message
Cole Markham is currently offline Cole MarkhamFriend
Messages: 150
Registered: July 2009
Location: College Station, TX
Senior Member

I did forget to mention the postMessage API, which is referenced on both the mozilla and microsoft sites I linked. The idea is that you post a message to the iframe, and it subscribes to the event and chooses to process it. It would probably be possible to modify the RAP BrowserFunction to use postMessage. I'm not sure of any way to do it using javascript without modifying RAP. Currently BrowserFunction injects a javascript function into the iframe, and that is what is currently not possible. This could be changed so that BrowserFunction instead registers an event listener for the iframe calling postMessage on the parent window.

Another alternative is to modify the code in the iframe to call a service handler on the application. You would probably need to pass the url of the service handler to the iframe as a URL parameter. https://download.eclipse.org/rt/rap/doc/3.3/guide/reference/api/org/eclipse/rap/rwt/service/ServiceHandler.html
Re: Client-Error: Browser-Widget can not access unkown domain from [message #1823264 is a reply to message #1823255] Mon, 23 March 2020 20:35 Go to previous messageGo to next message
Marco Descher is currently offline Marco DescherFriend
Messages: 197
Registered: October 2010
Location: Austria
Senior Member
Hy Cole,

thank you very much for your message. I think I understand your first response:

Cole Markham wrote on Mon, 23 March 2020 17:49
...
In short, you can't call javascript on an iframe that belongs to another domain. To my knowledge there's not even a way to disable it for local testing.....


What I do not understand, however, where this domain difference should come from? The message says unknown domain - the resp. code gets directly injected via browser.execute() (the code can be found here https://github.com/elexis/elexis-3-base/blob/37505bde69c7a4e110d5487ea522e37549f20861/bundles/at.medevit.elexis.agenda.ui/src/at/medevit/elexis/agenda/ui/composite/ScriptingHelper.java#L56) so where is this domain indifference

unkown domain vs "127.0.0.1:61163" coming from?
Re: Client-Error: Browser-Widget can not access unkown domain from [message #1823271 is a reply to message #1823264] Tue, 24 March 2020 07:14 Go to previous messageGo to next message
Marco Descher is currently offline Marco DescherFriend
Messages: 197
Registered: October 2010
Location: Austria
Senior Member
If I move certain parts of the code from browser.addProgressListener to browser.addControlListener the SecurityRestriction problem does not seem to occur anymore. Are these
Listeners part of different "web domains"? Does this make sense?

Putting this in the control listener, however, seems to call the scripts to fast, as on like every third call I get

java.lang.IllegalStateException: Another script is already pending
	at org.eclipse.swt.browser.Browser.execute(Browser.java:259)
	at at.medevit.elexis.agenda.ui.composite.ScriptingHelper.setCalenderTime(ScriptingHelper.java:60)
	at at.medevit.elexis.agenda.ui.composite.ParallelComposite$1.controlResized(ParallelComposite.java:132)
	at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:257)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:109)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:687)
Re: Client-Error: Browser-Widget can not access unkown domain from [message #1823486 is a reply to message #1823271] Fri, 27 March 2020 08:40 Go to previous message
Marco Descher is currently offline Marco DescherFriend
Messages: 197
Registered: October 2010
Location: Austria
Senior Member
I think I found the error for a lot of problems:

I was setting an url of type file://you/name/it/view.html instead of an url like /you/name/it/view.html (relative to my rap host) - this is what was called the unknown domain.
And even - on a remote client you can't expect file urls to work
Previous Topic:Do you accept contributions via github?
Next Topic:Browser context menu way off from mouse position
Goto Forum:
  


Current Time: Sat Jul 27 01:22:17 GMT 2024

Powered by FUDForum. Page generated in 0.03648 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top