Reviewers: rchandia,
Description:
Change default of UiBinder.useLazyWidgetBuilders to true, in
preparation for deleting the old code.
Also fixes unreported bad code gen for things like <a href="{uh.oh}">
when
safehtml is off. Fix is a bit squirrelly, but the intent is to delete
the code
in question almost immediately if nothing blows up with new default.
Review by: rchan...@google.com
Please review this at http://gwt-code-reviews.appspot.com/1574803/
Affected files:
M user/src/com/google/gwt/uibinder/UiBinder.gwt.xml
M user/src/com/google/gwt/uibinder/rebind/UiBinderGenerator.java
M user/src/com/google/gwt/uibinder/rebind/UiBinderWriter.java
Index: user/src/com/google/gwt/uibinder/UiBinder.gwt.xml
===================================================================
--- user/src/com/google/gwt/uibinder/UiBinder.gwt.xml (revision 10704)
+++ user/src/com/google/gwt/uibinder/UiBinder.gwt.xml (working copy)
@@ -27,11 +27,11 @@
<define-configuration-property name="UiBinder.useSafeHtmlTemplates"
is-multi-valued="false"/>
<set-configuration-property name="UiBinder.useSafeHtmlTemplates"
value="true"/>
- <!-- UiBinder can be configured to use a new strategy that enables a
faster
- rendering mode and make some widgets lazily created. This is still
experimental
- but should be the default option in a soon future. -->
+ <!-- Set this property to false to revert to the old code gen strategy,
+ and lose features like support for LazyPanel and forward references.
This
+ property will soon disappear. -->
<define-configuration-property name="UiBinder.useLazyWidgetBuilders"
is-multi-valued="false"/>
- <set-configuration-property name="UiBinder.useLazyWidgetBuilders"
value="false"/>
+ <set-configuration-property name="UiBinder.useLazyWidgetBuilders"
value="true"/>
<generate-with class="com.google.gwt.uibinder.rebind.UiBinderGenerator">
<when-type-assignable
class="com.google.gwt.uibinder.client.UiRenderer"/>
Index: user/src/com/google/gwt/uibinder/rebind/UiBinderGenerator.java
===================================================================
--- user/src/com/google/gwt/uibinder/rebind/UiBinderGenerator.java
(revision 10704)
+++ user/src/com/google/gwt/uibinder/rebind/UiBinderGenerator.java (working
copy)
@@ -52,6 +52,7 @@
private static final String LAZY_WIDGET_BUILDERS_PROPERTY
= "UiBinder.useLazyWidgetBuilders";
private static boolean gaveSafeHtmlWarning;
+ private static boolean gaveLazyBuildersWarning;
/**
* Given a UiBinder interface, return the path to its ui.xml file,
suitable
@@ -212,7 +213,14 @@
}
private Boolean useLazyWidgetBuilders(MortalLogger logger,
PropertyOracle propertyOracle) {
- return extractConfigProperty(logger, propertyOracle,
LAZY_WIDGET_BUILDERS_PROPERTY, false);
+ Boolean rtn = extractConfigProperty(logger, propertyOracle,
LAZY_WIDGET_BUILDERS_PROPERTY, false);
+ if (!gaveLazyBuildersWarning && !rtn) {
+ logger.warn("Configuration property %s is false. Deprecated code
generation is in play. " +
+ "This property will soon become a no-op.",
+ LAZY_WIDGET_BUILDERS_PROPERTY);
+ gaveLazyBuildersWarning = true;
+ }
+ return rtn;
}
private Boolean useSafeHtmlTemplates(MortalLogger logger, PropertyOracle
propertyOracle) {
@@ -221,7 +229,8 @@
if (!gaveSafeHtmlWarning && !rtn) {
logger.warn("Configuration property %s is false! UiBinder SafeHtml
integration is off, "
- + "leaving your users more vulnerable to cross-site scripting
attacks.",
+ + "leaving your users more vulnerable to cross-site scripting
attacks. This property " +
+ "will soon become a no-op, and SafeHtml integration will always
be on.",
XSS_SAFE_CONFIG_PROPERTY);
gaveSafeHtmlWarning = true;
}
Index: user/src/com/google/gwt/uibinder/rebind/UiBinderWriter.java
===================================================================
--- user/src/com/google/gwt/uibinder/rebind/UiBinderWriter.java (revision
10704)
+++ user/src/com/google/gwt/uibinder/rebind/UiBinderWriter.java (working
copy)
@@ -1030,7 +1030,7 @@
*/
public String tokenForSafeUriExpression(XMLElement source, String
expression) {
if (!useSafeHtmlTemplates) {
- return tokenForStringExpression(source, expression + ".asString()");
+ return tokenForStringExpression(source, expression);
}
htmlTemplates.noteUri(expression);
--
http://groups.google.com/group/Google-Web-Toolkit-Contributors