Tuesday, July 24, 2012

Re: GWT Cross Site Iframe Linker and Script Tags


On Monday, July 23, 2012 4:33:01 PM UTC+2, Daniel wrote:
Hi,
can someone please explain to me the technical details why the xsiframe Link can not compile GWT apps which load <script> tags in their .gwt.xml module?
It gives the following error:
[ERROR] The Cross-Site-Iframe linker does not support <script> tags in the gwt.xml files, but the gwt.xml file (or the gwt.xml files which it includes) contains the following script tags: 
.....
In order for your application to run correctly, you will need to include these tags in your host page directly. In order to avoid this error, you will need to remove the script tags from the gwt.xml file, or add this property to the gwt.xml file: <set-configuration-property name='xsiframe.failIfScriptTag' value='FALSE'/>

The error message already tells the workaround, so I know how to compile it. Still, I'm wondering about the reason why it can't compile with <script> tags? I understand the same origin policy problem with the regular Iframe Linker and XHR. But including a script tag doesn't require XHR. So whats the technical reason behind this?

It's not about the SOP (not directly at least), it's about how the *.cache.* script is (or can be) injected.
<script>s in gwt.xml are guaranteed to be fully loaded by by the time the onModuleLoad is called, so you can directly make calls to functions or objects declared in those scripts. This is done by using document.write()s and some trickery to make it work in all browsers. The xsiframe linker no longer uses document.write, so it couldn't guarantee the loading order; as a consequence, scripts are simply not injected (at all); they fail the build by default, or can be ignored with the xsiframe.failIfScriptTag configuration property.

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/BRVnQ66RGY4J.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

1 comment:

  1. What if you are including .jar files in your project that contain script tags? How to handle it?

    ReplyDelete