Reputation: 6954
I'm using GWT 2.4 (and I can't upgrade my version to 2.5) I'm having the following issue: when I use Chrome, Firefox or Internet Explorer 9 o 10, my system works pretty good; by using Internet Explorer 8, my systems doesn't work at all; it shows a blank page to the user and I get the following javascript error:
Dettagli errore pagina Web
Agente utente: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0) Timestamp: Thu, 5 Sep 2013 10:56:58 UTC
Messaggio: Argomento non valido. Linea: 28410 Carattere: 54 Codice: 0 URI: http://app.it:8080/myApp/F662F41B287D1686DCB056062754DFEB.cache.html
I was searching on the net and I found this link: https://code.google.com/p/google-web-toolkit/issues/detail?id=6665 In this GWT issue it is explained that GWT 2.4 has some problems with IE8 and chromeframe; I did what they suggested; in fact what I did is:
PropertyProviderGenerator
import com.google.gwt.core.ext.TreeLogger;
import com.google.gwt.core.ext.linker.ConfigurationProperty;
import com.google.gwt.core.ext.linker.PropertyProviderGenerator;
import java.util.Arrays;
import java.util.List;
import java.util.SortedSet;
public class CustomUserAgentPropertyGenerator implements PropertyProviderGenerator {
private static final List<String> VALID_VALUES = Arrays.asList(new String[]{"ie6", "ie8", "gecko1_8", "safari", "opera", "ie9"});
private static UserAgentPropertyGeneratorPredicate[] predicates =
new UserAgentPropertyGeneratorPredicate[] {
// opera
new UserAgentPropertyGeneratorPredicate("opera")
.getPredicateBlock()
.println("return (ua.indexOf('opera') != -1);")
.returns("'opera'"),
// webkit family (chrome, safari and chromeframe).
new UserAgentPropertyGeneratorPredicate("safari")
.getPredicateBlock()
.println("return (ua.indexOf('webkit') != -1);")
.returns("'safari'"),
// IE9
new UserAgentPropertyGeneratorPredicate("ie9")
.getPredicateBlock()
.println("return (ua.indexOf('msie') != -1 && ($doc.documentMode >= 9));")
.returns("'ie9'"),
// IE8
new UserAgentPropertyGeneratorPredicate("ie8")
.getPredicateBlock()
.println("return (ua.indexOf('msie') != -1 && ($doc.documentMode >= 8));")
.returns("'ie8'"),
// IE6
new UserAgentPropertyGeneratorPredicate("ie6")
.getPredicateBlock()
.println("var result = /msie ([0-9]+)\\.([0-9]+)/.exec(ua);")
.println("if (result && result.length == 3)")
.indent()
.println("return (makeVersion(result) >= 6000);")
.outdent()
.returns("'ie6'"),
// gecko family
new UserAgentPropertyGeneratorPredicate("gecko1_8")
.getPredicateBlock()
.println("return (ua.indexOf('gecko') != -1);")
.returns("'gecko1_8'"),
};
static void writeUserAgentPropertyJavaScript(SourceWriter body, SortedSet<String> possibleValues) {
// write preamble
body.println("var ua = navigator.userAgent.toLowerCase();");
body.println("var makeVersion = function(result) {");
body.indent();
body.println("return (parseInt(result[1]) * 1000) + parseInt(result[2]);");
body.outdent();
body.println("};");
// write only selected user agents
for (int i = 0; i < predicates.length; i++) {
if (possibleValues.contains(predicates[i].getUserAgent())) {
body.println("if ((function() { ");
body.indent();
body.print(predicates[i].toString());
body.outdent();
body.println("})()) return " + predicates[i].getReturnValue() + ";");
}
}
// default return
body.println("return 'unknown';");
}
public String generate(TreeLogger logger, SortedSet<String> possibleValues, String fallback, SortedSet<ConfigurationProperty> configProperties) {
for (String value : possibleValues) {
if (!VALID_VALUES.contains(value)) {
logger.log(TreeLogger.WARN, "Unrecognized "
+ UserAgentGenerator.PROPERTY_USER_AGENT + " property value '"
+ value + "', possibly due to UserAgent.gwt.xml and "
+ UserAgentPropertyGenerator.class.getName()
+ " being out of sync." + " Use <set-configuration-property name=\""
+ UserAgentGenerator.PROPERTY_USER_AGENT_RUNTIME_WARNING
+ "\" value=\"false\"/> to suppress this warning message.");
}
}
assert predicates.length == VALID_VALUES.size();
StringSourceWriter body = new StringSourceWriter();
body.println("{");
body.indent();
writeUserAgentPropertyJavaScript(body, possibleValues);
body.outdent();
body.println("}");
return body.toString();
}
}
MySystem.gwt.xml
<?xml version="1.0" encoding="UTF-8"?>
<module rename-to='mysystem'>
<!-- some inherits -->
<property-provider name="user.agent" generator="com.google.gwt.user.rebind.mysystemUserAgentPropertyGenerator"/>
<inherits name="com.google.gwt.user.UserAgent"/>
<set-configuration-property name="user.agent.runtimeWarning" value="false"/>
<!-- the rest of the file -->
<extend-property name="locale" values="en, it" />
</module>
Sadly by doing in this way I didn't solve the issue Can anybody suggest to me any other thing to try?
Thank you
Angelo
Upvotes: 2
Views: 875
Reputation: 978
Did you try to clear all caches in the browser and your IDE? In intellij I often have to stop intellij idea, clear the cache/gwt dieclipse and to start intellij again to get rid of such spurious problems. Same with eclipse.
Upvotes: 0
Reputation: 64561
The way GWT modules are loaded, anything defined later overrides something defined earlier, and <inherits>
are processed as if the inherited module was included in-place.
You should thus move your <property-provider>
line after the <inherits name="com.google.gwt.user.UserAgent"/>
line.
Upvotes: 2