Draft compile with compiler.stackMode=strip seems to break stack trace deobfuscation with sourcemaps
niloc132 opened this issue · comments
LoggingRPCSuite was apparently written to support running in Chrome with stack mode strip, but still using the "modern" collector (renamed about three years after this commit):
gwt/user/test/com/google/gwt/user/LoggingRPCSuite.gwt.xml
Lines 25 to 40 in 469ef14
However, this wasn't run since at least ChromeCollector was renamed to ModernCollector (and possibly earlier, haven't confirmed), and running it in recent versions seems to break. When compiled without draft, HtmlUnit is able to send stack traces to the server and have them deobfuscated, so this is likely not a limitation of HtmlUnit vs some other browser.
Chrome does behave differently than htmlunit here, but still fails the test with draft+stackMode=strip.
Chrome's failure:
expected: <40>, actual: <26>
junit.framework.AssertionFailedError: expected: <40>, actual: <26>
at java.lang.Throwable.Throwable(com/google/gwt/emul/java/lang/Throwable.java:73)
at java.lang.Error.Error(com/google/gwt/emul/java/lang/Error.java:30)
at java.lang.AssertionError.AssertionError(com/google/gwt/emul/java/lang/AssertionError.java:51)
at com/google/gwt/junit/translatable/junit/framework/AssertionFailedError.java.(com/google/gwt/junit/translatable/junit/framework/AssertionFailedError.java:27)
at com.google.gwt.jsonp.client.TimeoutException_FieldSerializer.instantiate(TimeoutException_FieldSerializer.java:6)
at java.lang.Object.$getClass(Object.java:6)
at com.google.gwt.core.client.impl.Impl.apply(com/google/gwt/user/client/rpc/impl/RequestCallbackAdapter.java:232)
at com.google.gwt.core.client.impl.AsyncFragmentLoader$HttpDownloadFailure.AsyncFragmentLoader$HttpDownloadFailure(com/google/gwt/http/client/Request.java:227)
at com/google/gwt/http/client/RequestBuilder.java.(com/google/gwt/http/client/RequestBuilder.java:412)
at com/google/gwt/xhr/client/XMLHttpRequest.java.(com/google/gwt/xhr/client/XMLHttpRequest.java:329)
at com.google.gwt.core.client.impl.Impl.apply(com/google/gwt/core/client/impl/Impl.java:299)
at com.google.gwt.core.client.impl.Impl.entry0(com/google/gwt/core/client/impl/Impl.java:351)
at com/google/gwt/core/client/impl/Impl.java.(com/google/gwt/core/client/impl/Impl.java:78)
Chrome's actual exception after deobf:
java.lang.RuntimeException: Runtime Exception
at java.lang.Throwable.Throwable(com/google/gwt/emul/java/lang/Throwable.java:66)
at java.lang.Exception.Exception(com/google/gwt/emul/java/lang/Exception.java:29)
at com/google/gwt/emul/java/lang/RuntimeException.java.(com/google/gwt/emul/java/lang/RuntimeException.java:29)
at com.google.gwt.jsonp.client.TimeoutException_FieldSerializer.$clinit(com/google/gwt/dev/jjs/intrinsic/com/google/gwt/lang/ModuleUtils.java:39)
at com.google.gwt.core.client.CodeDownloadException$Reason.valueOf(com/google/gwt/dev/jjs/intrinsic/com/google/gwt/lang/ModuleUtils.java:35)
at com.google.gwt.core.client.impl.JavaScriptExceptionBase.$clinit(com/google/gwt/core/client/impl/AsyncFragmentLoader.java:582)
at com.google.gwt.core.client.impl.AsyncFragmentLoader.onLoad(com/google/gwt/core/client/impl/AsyncFragmentLoader.java:276)
at com.google.gwt.core.client.impl.Impl.apply(com/google/gwt/core/client/impl/Impl.java:299)
at com.google.gwt.core.client.impl.Impl.entry0(com/google/gwt/core/client/impl/Impl.java:351)
at com/google/gwt/core/client/impl/Impl.java.(com/google/gwt/core/client/impl/Impl.java:78)
at gen/com/google/gwt/user/client/rpc/LoggingRPCTestService_Proxy.java.(gen/com/google/gwt/user/client/rpc/LoggingRPCTestService_Proxy.java:26)
at Unknown.__installRunAsyncCode(http://localhost:10000/com.google.gwt.user.LoggingRPCSuite.JUnit/com.google.gwt.user.LoggingRPCSuite.JUnit.nocache.js@241:11)
at Unknown.__gwtInstallCode(com.google.gwt.user.LoggingRPCSuite.JUnit-0.js@584:1)
at com.google.gwt.core.client.impl.LoadingStrategyBase.gwtInstallCode(com/google/gwt/core/client/impl/LoadingStrategyBase.java:173)
at com.google.gwt.core.client.JsArrayString.$length(com/google/gwt/core/client/impl/LoadingStrategyBase.java:150)
at com.google.gwt.core.client.impl.ScriptTagLoadingStrategy.asyncCallback(com/google/gwt/core/client/impl/ScriptTagLoadingStrategy.java:60)
at com/google/gwt/core/client/impl/ScriptTagLoadingStrategy.java.(com/google/gwt/core/client/impl/ScriptTagLoadingStrategy.java:85)
at com.google.gwt.core.client.impl.Impl.apply(com/google/gwt/core/client/impl/Impl.java:299)
at com.google.gwt.core.client.impl.Impl.entry0(com/google/gwt/core/client/impl/Impl.java:351)
at com/google/gwt/core/client/impl/Impl.java.(com/google/gwt/core/client/impl/Impl.java:78)
at com/google/gwt/dev/jjs/intrinsic/com/google/gwt/lang/CollapsedPropertyHolder.java.(com/google/gwt/dev/jjs/intrinsic/com/google/gwt/lang/CollapsedPropertyHolder.java:32)
Chrome's exception after deobf when not using draft:
java.lang.RuntimeException: Runtime Exception
at java.lang.Throwable.Throwable(com/google/gwt/emul/java/lang/Throwable.java:66)
at java.lang.Exception.Exception(com/google/gwt/emul/java/lang/Exception.java:29)
at com/google/gwt/emul/java/lang/RuntimeException.java.(com/google/gwt/emul/java/lang/RuntimeException.java:29)
at com.google.gwt.user.client.rpc.LoggingRPCTest.$throwException(com/google/gwt/user/client/rpc/LoggingRPCTest.java:40)
at java.lang.Throwable.Throwable(com/google/gwt/dev/jjs/intrinsic/com/google/gwt/lang/ModuleUtils.java:62)
at com.google.gwt.core.client.impl.AsyncFragmentLoader.$onLoadImpl(com/google/gwt/core/client/impl/AsyncFragmentLoader.java:582)
at com.google.gwt.core.client.impl.AsyncFragmentLoader.onLoad(com/google/gwt/core/client/impl/AsyncFragmentLoader.java:276)
at com.google.gwt.core.client.impl.Impl.apply(com/google/gwt/core/client/impl/Impl.java:299)
at com.google.gwt.core.client.impl.Impl.entry0(com/google/gwt/core/client/impl/Impl.java:351)
at com/google/gwt/core/client/impl/Impl.java.(com/google/gwt/core/client/impl/Impl.java:78)
at Unknown.anonymous(com.google.gwt.user.LoggingRPCSuite.JUnit-1.js@7:8)
at Unknown.__installRunAsyncCode(http://localhost:10000/com.google.gwt.user.LoggingRPCSuite.JUnit/com.google.gwt.user.LoggingRPCSuite.JUnit.nocache.js@241:11)
at com/google/web/bindery/event/shared/UmbrellaException.java.(com/google/web/bindery/event/shared/UmbrellaException.java:27)
at com.google.gwt.core.client.impl.LoadingStrategyBase$RequestData.$tryInstall(com/google/gwt/core/client/impl/LoadingStrategyBase.java:173)
at com.google.gwt.core.client.impl.ScriptTagLoadingStrategy.asyncCallback(com/google/gwt/core/client/impl/ScriptTagLoadingStrategy.java:59)
at com/google/gwt/core/client/impl/ScriptTagLoadingStrategy.java.(com/google/gwt/core/client/impl/ScriptTagLoadingStrategy.java:85)
at com.google.gwt.core.client.impl.Impl.apply(com/google/gwt/core/client/impl/Impl.java:299)
at com.google.gwt.core.client.impl.Impl.entry0(com/google/gwt/core/client/impl/Impl.java:351)
at com/google/gwt/core/client/impl/Impl.java.(com/google/gwt/core/client/impl/Impl.java:78)
at Unknown.anonymous(http://localhost:10000/com.google.gwt.user.LoggingRPCSuite.JUnit/deferredjs/474E62227CCEEC7D5C90D27E197E3557/1.cache.js@48:1)
The expected line is
at com.google.gwt.user.client.rpc.LoggingRPCTest.$throwException(com/google/gwt/user/client/rpc/LoggingRPCTest.java:40)
but going by counting stack frames, we instead get
at com.google.gwt.jsonp.client.TimeoutException_FieldSerializer.$clinit(com/google/gwt/dev/jjs/intrinsic/com/google/gwt/lang/ModuleUtils.java:39)
which looks like nonsense (or confusion from merging too many functions due to strip mode).