I'm trying to fix a bug ( 
https://code.google.com/p/google-web-toolkit/issues/detail?id=8100
), and I could use some expert advice.  I'm a long time GWT user (7
years), but only recently started hacking the internals, and I need
help on this one.

Background:

SelectionScriptLinker.splitPrimaryJavaScript attempts to check whether
the property "compiler.useSourceMaps" is "true" and if it is, the
method avoids splitting the javascript into chunks (which would
destroy the accuracy of the line numbers in the source map).

The Problem:

This method tries to get the property value from
LinkerContext.getProperties, which is not a PropertyOracle, and hence
it can't return the correct property value for the current
permutation.  In fact, it will return a null value unless the property
has a static value for all permutations (e.g. <set-property
name="compiler.useSourceMaps" value="true"/>)

However, something like

  <set-property name="compiler.useSourceMaps" value="true">
    <when-property-is name="user.agent" value="safari"/>
  </set-property>

will not work because SelectionScriptLinker.splitPrimaryJavaScript can
only read static property values.

Could someone advise me on how to fix this bug?

Here's is there relevant source code for quick reference:

  public static String splitPrimaryJavaScript(StatementRanges ranges,
String js,
      int charsPerChunk, String scriptChunkSeparator, LinkerContext
context) {
    boolean useSourceMaps = false;
    for (SelectionProperty prop : context.getProperties()) {
      if (USE_SOURCE_MAPS_PROPERTY.equals(prop.getName())) {
        String str = prop.tryGetValue();
        useSourceMaps = str == null ? false :
Boolean.parseBoolean(str);
        break;
      }
    }

    // TODO(cromwellian) enable chunking with sourcemaps
    if (charsPerChunk < 0 || ranges == null || useSourceMaps) {
      return js;
    }
...

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


Reply via email to