Tuesday, August 4, 2015

GWT + Polymer - Script base detection breaks the encapsulation of GWT-backed web component (GWT 2.8-SNAPSHOT)

Hi,

The script base detection in the <module>.nocache.js file in GWT (2.8-SNAPSHOT) breaks the encapsulation of web components that have their business logic provided by GWT.

GWT script base detection - provided by computeScriptBase() in <module>.nocache.js - sets the path relative to the location of the host HTML page instead of to the location of the Polymer component HTML file (which is imported by the host page).
For example, component <collaborne-hello-world> is defined in collaborne-hello-world.html (see link to code below). The component is used by demo/index.html. Now, <module>.nocache.js tries to load the JavaScript from demo/XXX.cache.js instead of hello/XXX.cache.js
GTW allows to manually set the script base via the meta property "baseurl". Unfortunately, the property is ignored if it's in the included web component file (collaborne-hello-world.html).
The workaround is to defined the meta property in the host page (demo/index.html), which now leaks out internal information about the component to the host.

See: https://github.com/Collaborne/gwt-polymer-component-example/blob/master/src/main/webapp/demo/index.html#L9

Ronny

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment