how to try SourceMaps with GWT? - gwt

https://plus.google.com/u/1/110412141990454266397/posts/Nvr6Se6eAPh
does anyone know how to try it with last build of GWT (from svn) and Chrome Canary?

See http://code.google.com/p/google-web-toolkit/wiki/SourceMaps
it's only a matter of adding the following to your gwt.xml:
<set-property name="compiler.useSourceMaps" value="true" />
The compiler will then output source maps and the necessary triggers in the JS code (currently only for the safari permutation, to target Chrome only).
Beware, it's rather resource consuming! Be prepared to bump your -Xmx et al.

Related

Google Chrome Canary Version 54.0.2830.0 not loading Type script source

I am using Google Chrome canary Version 54.0.2830.0. Typescript files are there but those are not loading the code to debug.
Posting an answer here so that it may help others.
I was using visual studio Web API project and project settings were not allowing client the access to static files. Due to which chrome was unable to load the Typescript files and map files.
To solve this, i had to add the following line in my web.config file to allow state contents.
<system.webServer>
<staticContent>
<mimeMap fileExtension=".ts" mimeType="application/x-typescript" />
</staticContent>
</system.webServer>

GWT issue 2079 error message not possible to remove

i am using gwt and mgwt for my project.
When i am running my project on eclipse jetty server i get the following alert error message:
cross-site hosted mode not yet implemented. See issue http:// code.google.com/p/google-web-toolkit/issues/detail?id=2079
and this has to do wih the following linker in the appname.gwt.xml file
<add-linker name="xs" />
but when i remove the linker from the gwt.xml module the error is still there.
I cleaned the project and refreshed it but i get still the error message.
It's not possible to test the app in the browser any more.
How to solve the problem. Please help!
Try deleting the *.nocache.js file.
BTW, xs linker is deprecated, use the xsiframe one (which supports DevMode, as stated in issue 2079)
Replace 'xs' to 'xsiframe' in add-linker tag then after add this tag
<set-configuration-property name='xsiframe.failIfScriptTag' value='FALSE'/>
then rebuild project

GWT user.agent for Hosted Mode?

As far as I know the "user.agent" property in the Google Web Toolkit .gwt.xml file specifies the targets for the Java to Java Script translation. Because the hosted mode still runs Java and not Javascript I don't understand why google chrome complains that the "user.agent" value is not set correctly. Even more strange, it keeps complaining even if I add "safari" to it with <set-property name="user.agent" value="gecko1_8,safari" />.
What can I do here?
I use GWT version 2.3.0 and GXT version 2.2.5.
DevMode does not compile to JavaScript but still has to honor deferred binding rules, and many of them are based on the user.agent property, so it must be correctly set.
The user.agent property value is determined by some script snippet generated in the so-called selection script (the *.nocache.js file), and the content of this script can depend on the set-propertys you have in your GWT module(s).
For instance, if you compile a GWT module with <set-property name="user.agent" value="gecko1_8" />, the user.agent property will be hard-coded to the gecko1_8 value in the *.nocache.js.
If you later run DevMode, unless it thinks it has to overwrite the existing *.nocache.js, it'll use it; so running the app using Chrome when the *.nocache.js was generated for gecko1_8 only will cause an error similar to:
com.google.gwt.core.client.JavaScriptException: (TypeError): Property 'user.agent' of object is not a function
In case you compiled for several browsers, but then run DevMode with a module only for gecko1_8, then the DevMode will use the property provider found in the *.nocache.js to determine the actual user agent being used (woul dbe safari for Chrome), and will compare it with the one determined from the module (hard-coded here to gecko1_8), and will then warn you that they don't match (and as such that you app might dysfunction: the code will use DOMImplMozilla for instance, whereas DOMImplSafari should have been used in Chrome).
So, to fix this, either delete the *.nocache.js file so DevMode will have to generate a new one, or recompile your app with a module whose user.agent values match the browser you'll use in DevMode.

GWT and Google Chrome Frame Bug: "compile time user.agent value does not match runtime user.agent value"

I have a GWT 2.4.0 website hosted in Jetty. When I browse this website using IE8 I get the following alert message:
ERROR: Possible problem with your *.gwt.xmi module file.
The compile time user.agent value (ie8) does not match the runtime user.agent
value (safari). Expect more errors.
Why does GWT think my runtime user agent is Safari? How can I let it know it's actually IE8? Am I right in suspecting that having the Chrome Frame plug-in installed in my IE8 has something to do with this?
Check your *gwt.xml files. Does it have something that looks like this:
<set-property name="user.agent" value="safari" />
That's telling it to only compile the safari version.
When GWT module is compiled with only one user.agent it doesn't check it in the bootstrap javascript, but loads directly that version. When that version checks the user.agent it finds (I guess) your Chrome frame and complains about its safari.
So... I guess you have only compiled your module with:
<set-property name="user.agent" value="ie8">
I should either check how ChromeFrame vs. GWT behaviour is... or simply add both user.agents and let module bootstrap load what's correct for your runtime environment.
<set-property name="user.agent" value="ie8,safari">
And of course I should check your ChromeFrame configuration to see what pages are loaded with it: all, none, some URLs, etc...

GWT module XML - how to redefine and use more than one user agent

http://code.google.com/docreader/#p=google-web-toolkit-doc-1-5&s=google-web-toolkit-doc-1-5&t=FAQ_CompileOnePermutation
In the article I learned I can speed up the compiler but specifying the target user agent. The problem how can I specify more than one user agent? Suppose my application supports ie6 and FF3
<set-property name="user.agent" value="ie6,geck1_8" />
doesn't work - I got XML parsing error:
[ERROR] Invalid property value 'ie6,gecko1_8'
I'm wondering if there's a way to specify more than one specific user agent in the module XML file?
I've had a similar error message, when setting the user.agent value to gecko in GWT2.4. So I looked around and found where the gwt code defines the possible values.
If you look in the gwt-user.jar at com.google.gwt.user.UserAgent.gwt.xml you can see the possible values for the version of GWT you are using.
For GWT2.4, this is what i found:
<!-- Browser-sensitive code should use the 'user.agent' property -->
<define-property name="user.agent" values="ie6" />
<extend-property name="user.agent" values="ie8" />
<extend-property name="user.agent" values="gecko1_8" />
<extend-property name="user.agent" values="safari" />
<extend-property name="user.agent" values="opera" />
<extend-property name="user.agent" values="ie9" fallback-value="ie8" />
<property-provider name="user.agent" generator="com.google.gwt.user.rebind.UserAgentPropertyGenerator"/>
Therefore gecko is not a valid value for user.agent in my case, and if I use gecko1_8 it compiles for Firefox fine.
Works in GWT 1.6, your *.gwt.xml file :
<module rename-to="moduleName">
<!-- blah blah -->
<set-property name="user.agent" value="ie6,gecko,gecko1_8" />
<!-- generate perms for IE and firefox only -->
</module>
for webkit based browsers like chrome, use "safari" as the user agent
In order to rapidly deploy any application, you'll need two targets; once for the engine your hosted mode deploys on {Firefox / Linux, Safari / Mac, IE6 / Win}, and one for your agile browser that lets you build css in real-time {Firefox + Firebug}.
Linux: <set-property name="user.agent" value="gecko1_8,gecko"/>
Mac: <set-property name="user.agent" value="gecko1_8,safari"/>
...etc...
This is GWT >= 1.6 ONLY!
For older gwt projects, you must super-source the com/google/gwt/user/UserAgent.gwt.xml file... Put it in a source location that is included BEFORE your gwt-*.jar on the classpath. Basically, you can copy that file into a new one in the same package as the original, and edit the CDATA javascript block that returns the actual user.agent value. Play with this all you like, but don't go getting too crazy with their user.agent property, as it WILL be changing for ie8 in a future build.
To target ie browsers, make up your own ie.version property, and tweak a copy of the property-provider in UserAgent.gwt.xml to target different versions of ie. Just make sure that when you use the custom property for deferred binding you do:
<all>
<when-property-is name="user.agent" value="ie6"/>
<any>
<when-property-is name="ie.version" value="ie7"/>
<when-property-is name="ie.version" value="ie8"/>
</any>
</all>
Or you'll get ie7 + gecko/safari builds and other silly junk that will never be used.
Note: Any code in a property-provider is loaded in the .nocache.js, and can be useful to preload images / css whilst the .cache.js payload is being downloaded.
Just add var __cached = new Image('Url To Compiled Image / Whatever you want to load');
Not yet. The idea is that you develop rapidly to one browser and then compile once to deploy (i.e., do final testing) for all browsers, with GWT handling the browser differences. Don't forget that at deploy time GWT will optimize the downloads per browser so that in the end it doesn't matter how many user agents you chose.