Tapestry 5.6.1 and IE11

classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

Tapestry 5.6.1 and IE11

H. Sahin

Hi there,

I have a issue, when I am starting my web app (Tapestry 5.6.1) with IE 11. I receive the following error message in every page load. The effect is, that jQuery is not loading correctly and I can not use jQuery in my web app. Do you have an idea, how I can solve this? Is their any work around to skip/solve this error?

    • translation: Not closed constant

Thank you for your support and best regards from Germany,
H. Sahin

Reply | Threaded
Open this post in threaded view
|

Re: Tapestry 5.6.1 and IE11

Ben Weidig
Hi,

does the problem occur in production only, or also in dev?

We had some issues with Google Closure Compiler and IE11 in the past, optimizing "too much".

You could try to disable minification to narrow the problem down: org.apache.tapestry5.SymbolConstants.MINIFICATION_ENABLED

Or you can check the core.js file received in the browser, too see the actual JS that IE11 doesn't like.

I couldn't recreate your error, even though we're running 5.6.0. But there weren't changes to coffee files in 5.6.1 as far as I know.

Ben

On Tue, Oct 27, 2020 at 8:14 AM Hakan Sahin <[hidden email]> wrote:

Hi there,

I have a issue, when I am starting my web app (Tapestry 5.6.1) with IE 11. I receive the following error message in every page load. The effect is, that jQuery is not loading correctly and I can not use jQuery in my web app. Do you have an idea, how I can solve this? Is their any work around to skip/solve this error?

    • translation: Not closed constant

Thank you for your support and best regards from Germany,
H. Sahin



Reply | Threaded
Open this post in threaded view
|

Re: Tapestry 5.6.1 and IE11

H. Sahin

Thank you for your response.

The error message occurs on core.js(121,20). I put the screenshot and the cursor shows the position 20 below.

Disabling MINIFICATION_ENABLED worked. I can not see the error on the console any more. But did that has an effect for the web app in production mode?

I am using Tapestry 5.6.1.

Thank you and regards,
H.Sahin

Am 27.10.2020 um 10:08 schrieb Ben Weidig:
Hi,

does the problem occur in production only, or also in dev?

We had some issues with Google Closure Compiler and IE11 in the past, optimizing "too much".

You could try to disable minification to narrow the problem down: org.apache.tapestry5.SymbolConstants.MINIFICATION_ENABLED

Or you can check the core.js file received in the browser, too see the actual JS that IE11 doesn't like.

I couldn't recreate your error, even though we're running 5.6.0. But there weren't changes to coffee files in 5.6.1 as far as I know.

Ben
Reply | Threaded
Open this post in threaded view
|

Re: Tapestry 5.6.1 and IE11

Ben Weidig
Yes, that's the closure compiler:


The effect of the symbol is that no minimizer won't be run, so no CSS and JS minification.

We added a request filter to restrict disabling minification to IE11:

 @Contribute(RequestHandler.class)
    public static void contributeRequestFilter(OrderedConfiguration<RequestFilter> conf,
                                               UserAgentDetector userAgentDetector) {
        conf.add("IE11-underscore-fix", new RequestFilter() {

            @Override
            public boolean service(Request request, Response response, RequestHandler handler) throws IOException {
                Optional<UserAgent> currentUserAgent = userAgentDetector.current();
                currentUserAgent.ifPresent(userAgent -> {
                    Browser browser = userAgent.getBrowser();
                    if (Browser.IE == browser.getGroup()) {
                        request.setAttribute(TapestryConstants.DISABLE_JAVASCRIPT_MINIMIZATION, Boolean.TRUE);
                    }
                });
                return handler.service(request, response);
            }
        });
    }

UserAgentDetector is a custom service from us, not Tapestry.

It could be improved to just blacklist the non-working source files, and not disable it for every JS and IE 11.

Ben



On Tue, Oct 27, 2020 at 10:30 AM Hakan Sahin <[hidden email]> wrote:

Thank you for your response.

The error message occurs on core.js(121,20). I put the screenshot and the cursor shows the position 20 below.

Disabling MINIFICATION_ENABLED worked. I can not see the error on the console any more. But did that has an effect for the web app in production mode?

I am using Tapestry 5.6.1.

Thank you and regards,
H.Sahin

Am 27.10.2020 um 10:08 schrieb Ben Weidig:
Hi,

does the problem occur in production only, or also in dev?

We had some issues with Google Closure Compiler and IE11 in the past, optimizing "too much".

You could try to disable minification to narrow the problem down: org.apache.tapestry5.SymbolConstants.MINIFICATION_ENABLED

Or you can check the core.js file received in the browser, too see the actual JS that IE11 doesn't like.

I couldn't recreate your error, even though we're running 5.6.0. But there weren't changes to coffee files in 5.6.1 as far as I know.

Ben


--
Netzgut GmbH

Kirchstr. 18
69115 Heidelberg

Telefon:
+49 6221 39298 53

Telefax:
+49 6221 39298 59

E-Mail:
[hidden email]

Handelsregister: Amtsgericht Mannheim, HRB 709833
Sitz der Gesellschaft: Heidelberg
Geschäftsführer: Felix Gonschorek, Benjamin Weidig
Ust-IdNr.: DE272871752
Reply | Threaded
Open this post in threaded view
|

Re: Tapestry 5.6.1 and IE11

H. Sahin
Okey thank you very much. I do not like the idea to disable minimizer
itself. Maybe Tapestry uses a lot of JS and CSS as minimizer. This can
have a big effect, during the runtime and the web app lost his functions.

If their is an other opportunity, that will be great. But currently it
seems this is the only possible way to support IE11.

Regards,
H.Sahin

Am 27.10.2020 um 10:39 schrieb Ben Weidig:

> Yes, that's the closure compiler:
>
> https://github.com/google/closure-compiler/issues/3280
>
> The effect of the symbol is that no minimizer won't be run, so no CSS
> and JS minification.
>
> We added a request filter to restrict disabling minification to IE11:
>
>  @Contribute(RequestHandler.class)
>     public static void
> contributeRequestFilter(OrderedConfiguration<RequestFilter> conf,
>                                                UserAgentDetector
> userAgentDetector) {
>         conf.add("IE11-underscore-fix", new RequestFilter() {
>
>             @Override
>             public boolean service(Request request, Response response,
> RequestHandler handler) throws IOException {
>                 Optional<UserAgent> currentUserAgent =
> userAgentDetector.current();
>                 currentUserAgent.ifPresent(userAgent -> {
>                     Browser browser = userAgent.getBrowser();
>                     if (Browser.IE == browser.getGroup()) {
>                        
> request.setAttribute(TapestryConstants.DISABLE_JAVASCRIPT_MINIMIZATION,
> Boolean.TRUE);
>                     }
>                 });
>                 return handler.service(request, response);
>             }
>         });
>     }
>
> UserAgentDetector is a custom service from us, not Tapestry.
>
> It could be improved to just blacklist the non-working source files,
> and not disable it for every JS and IE 11.
>
> Ben
>
>
>
> On Tue, Oct 27, 2020 at 10:30 AM Hakan Sahin <[hidden email]
> <mailto:[hidden email]>> wrote:
>
>     Thank you for your response.
>
>     The error message occurs on core.js(121,20). I put the screenshot
>     and the cursor shows the position 20 below.
>
>     Disabling MINIFICATION_ENABLED worked. I can not see the error on
>     the console any more. But did that has an effect for the web app
>     in production mode?
>
>     I am using Tapestry 5.6.1.
>
>     Thank you and regards,
>     H.Sahin
>
>     Am 27.10.2020 um 10:08 schrieb Ben Weidig:
>>     Hi,
>>
>>     does the problem occur in production only, or also in dev?
>>
>>     We had some issues with Google Closure Compiler and IE11 in the
>>     past, optimizing "too much".
>>
>>     You could try to disable minification to narrow the problem
>>     down: org.apache.tapestry5.SymbolConstants.MINIFICATION_ENABLED
>>
>>     Or you can check the core.js file received in the browser, too
>>     see the actual JS that IE11 doesn't like.
>>
>>     I couldn't recreate your error, even though we're running 5.6.0.
>>     But there weren't changes to coffee files in 5.6.1 as far as I know.
>>
>>     Ben
>
>
>
> --
> Netzgut GmbH
>
> Kirchstr. 18
> 69115 Heidelberg
>
> Telefon:
> +49 6221 39298 53
>
> Telefax:
> +49 6221 39298 59
>
> E-Mail:
> [hidden email] <mailto:[hidden email]>
>
> Handelsregister: Amtsgericht Mannheim, HRB 709833
> Sitz der Gesellschaft: Heidelberg
> Geschäftsführer: Felix Gonschorek, Benjamin Weidig
> Ust-IdNr.: DE272871752

--
Dipl.-Inform.
Hakan Sahin
avetana GmbH
Unterreut 6
76135 Karlsruhe

Tel: +49 721 1328342
eMail: [hidden email]
Internet: www.avetana-gmbh.de

Geschäftsführer: Moritz Gmelin & Dr. Michael Schlapp
Sitz der Gesellschaft: Karlsruhe
Amtsgericht Mannheim HRB 362834
UST-ID DE211535427

Reply | Threaded
Open this post in threaded view
|

Re: Tapestry 5.6.1 and IE11

H. Sahin
I played with this a bit. In the AppModule it is also possible using
/contributeRequestHandler/-method(see below)

  public static void
contributeRequestHandler(OrderedConfiguration<RequestFilter> config,
                    final RequestGlobals requestGlobals){

        RequestFilter filter = new RequestFilter()
         {
                @Override
                public boolean service(Request request, Response
response, RequestHandler handler) throws IOException
                {
                        ....

                       
request.setAttribute(TapestryConstants.DISABLE_JAVASCRIPT_MINIMIZATION,
Boolean.TRUE);
                }

        }
 }

I want to add it into the config, but which /contributing module's id/
shall I use? Do anybody have an idea? Thanks and regards.

Reply | Threaded
Open this post in threaded view
|

Re: Tapestry 5.6.1 and IE11

vlamp
In reply to this post by Ben Weidig
Hello Ben + Hakan

Not sure if this is off topic, but I experienced a minification-related
problem also - across various browser types, not only IE 11.

Page loading mask ("spinning wheel") never disappears. Problem also is in
core.js as I understand the JS debugger. See my comments in TAP5-2605
<https://issues.apache.org/jira/browse/TAP5-2605> for details.

My workaround is to disable minification altogether, which is ok for my
small webapp, but I appreciate the code you shared, Ben.

Volker


Am Di., 27. Okt. 2020 um 10:39 Uhr schrieb Ben Weidig <[hidden email]>:

> Yes, that's the closure compiler:
>
> https://github.com/google/closure-compiler/issues/3280
>
> The effect of the symbol is that no minimizer won't be run, so no CSS and
> JS minification.
>
> We added a request filter to restrict disabling minification to IE11:
>
>  @Contribute(RequestHandler.class)
>     public static void
> contributeRequestFilter(OrderedConfiguration<RequestFilter> conf,
>                                                UserAgentDetector
> userAgentDetector) {
>         conf.add("IE11-underscore-fix", new RequestFilter() {
>
>             @Override
>             public boolean service(Request request, Response response,
> RequestHandler handler) throws IOException {
>                 Optional<UserAgent> currentUserAgent =
> userAgentDetector.current();
>                 currentUserAgent.ifPresent(userAgent -> {
>                     Browser browser = userAgent.getBrowser();
>                     if (Browser.IE == browser.getGroup()) {
>
> request.setAttribute(TapestryConstants.DISABLE_JAVASCRIPT_MINIMIZATION,
> Boolean.TRUE);
>                     }
>                 });
>                 return handler.service(request, response);
>             }
>         });
>     }
>
> UserAgentDetector is a custom service from us, not Tapestry.
>
> It could be improved to just blacklist the non-working source files, and
> not disable it for every JS and IE 11.
>
> Ben
>
>
>
> On Tue, Oct 27, 2020 at 10:30 AM Hakan Sahin <[hidden email]> wrote:
>
>> Thank you for your response.
>>
>> The error message occurs on core.js(121,20). I put the screenshot and the
>> cursor shows the position 20 below.
>>
>> Disabling MINIFICATION_ENABLED worked. I can not see the error on the
>> console any more. But did that has an effect for the web app in production
>> mode?
>>
>> I am using Tapestry 5.6.1.
>>
>> Thank you and regards,
>> H.Sahin
>> Am 27.10.2020 um 10:08 schrieb Ben Weidig:
>>
>> Hi,
>>
>> does the problem occur in production only, or also in dev?
>>
>> We had some issues with Google Closure Compiler and IE11 in the past,
>> optimizing "too much".
>>
>> You could try to disable minification to narrow the problem
>> down: org.apache.tapestry5.SymbolConstants.MINIFICATION_ENABLED
>>
>> Or you can check the core.js file received in the browser, too see the
>> actual JS that IE11 doesn't like.
>>
>> I couldn't recreate your error, even though we're running 5.6.0. But
>> there weren't changes to coffee files in 5.6.1 as far as I know.
>>
>> Ben
>>
>>
>
> --
>
> Netzgut GmbH
>
> Kirchstr. 18
> 69115 Heidelberg
>
> Telefon:
> +49 6221 39298 53
>
> Telefax:
> +49 6221 39298 59
>
> E-Mail:[hidden email]
>
> Handelsregister: Amtsgericht Mannheim, HRB 709833
> Sitz der Gesellschaft: Heidelberg
> Geschäftsführer: Felix Gonschorek, Benjamin Weidig
> Ust-IdNr.: DE272871752
>
>
Reply | Threaded
Open this post in threaded view
|

Re: Tapestry 5.6.1 and IE11

H. Sahin
Hi Volker,

I do not want to disable minifaction at all. Maybe some other pieces of
code can be effected.

I like the idea from Ben as well and tried to integrate it within
/contributeRequestHandler(OrderedConfiguration<RequestFilter> config,
final RequestGlobals requestGlobals)/, with no success.

Thank you both, I appreciate you took time for this "issue".

Regards,
Hakan

Reply | Threaded
Open this post in threaded view
|

Re: Tapestry 5.6.1 and IE11

Ben Weidig
Hi,

minification can always be a problem, we ran into issues in other
frameworks / languages,  too...

Instead of disabling Minification for all files, or for a single browser,
you could also just replace the Google Closure compiler with a more
selective one:

https://gist.github.com/benweidig/db9d427c01c573b94cc5a492f88f7c39

public class CustomGoogleClosureMinimizer extends GoogleClosureMinimizer {

    public CustomGoogleClosureMinimizer(Logger logger,
                                        OperationTracker tracker,
                                        AssetChecksumGenerator
checksumGenerator,
                                        Request request,

@Symbol(WebResourcesSymbols.COMPILATION_LEVEL) CompilationLevel
compilationLevel) {
        super(logger, tracker, checksumGenerator, request,
compilationLevel);
    }

    @Override
    protected boolean isEnabled(StreamableResource resource) {

        if (resource.getDescription().endsWith("underscore-1.8.3.js")) {
            return false;
        }

        return super.isEnabled(resource);
    }
}


and overriding the original with

@Contribute(ResourceMinimizer.class)
@Primary
public static void
overrideGoogleClosureCompiler(MappedConfiguration<String,
ResourceMinimizer> conf,
                                                 @Autobuild
CustomGoogleClosureMinimizer gcm) {
    conf.override("text/javascript", gcm);
}

This way only the offending file won't be minimized, everything else will
be handled as usual.

I've debugged through a project of mine, it looked good for me.

To implement browser-related compression of a single file you would have to
go even earlier in the request (e.g. StreamableResourceSource).


Ben


On Thu, Oct 29, 2020 at 7:44 AM Hakan Sahin <[hidden email]> wrote:

> Hi Volker,
>
> I do not want to disable minifaction at all. Maybe some other pieces of
> code can be effected.
>
> I like the idea from Ben as well and tried to integrate it within
> /contributeRequestHandler(OrderedConfiguration<RequestFilter> config,
> final RequestGlobals requestGlobals)/, with no success.
>
> Thank you both, I appreciate you took time for this "issue".
>
> Regards,
> Hakan
>
>
Reply | Threaded
Open this post in threaded view
|

Re: Tapestry 5.6.1 and IE11

H. Sahin
Hi Ben,

thank you for your solution.

I have troubles with core.js (121,20) on IE. The error has an effect to
not loading JSON-functions in background. I do not know, is it depended
with GCM or not?

Thank you and take care. Best regards


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Tapestry 5.6.1 and IE11

Ben Weidig
Hi,

the console log you've posted is an error due to Google Closure Compiler
replacing unicode that it deems safe with the actual unicode characters.
Some unicode whitespace is supposed to be "safe", but IE11 doesn't think so
and your error occurs.

There's no option in Google Closure Compiler to disable this replacement,
as far as I know.
That's why replacing the minimizer with a custom version and deactivating
minification for some files is a workaround.


The core.js file is actually JavaScript stack, which is a combination of
many different JS files:
https://github.com/apache/tapestry-5/blob/4fcd88f92c7e6e2ab21551d2c7248871e8d8938b/tapestry-core/src/main/java/org/apache/tapestry5/modules/JavaScriptModule.java#L143-L212
One if this files is "underscore".

Check out the actual source code of underscore and compare it with your
console log to see it's the origin of the IE problem:
https://github.com/apache/tapestry-5/blob/73e327b4f8/tapestry-core/src/main/resources/META-INF/assets/tapestry5/underscore-1.8.3.js#L1401

Ben


On Thu, Oct 29, 2020 at 10:03 AM Hakan Sahin <[hidden email]> wrote:

> Hi Ben,
>
> thank you for your solution.
>
> I have troubles with core.js (121,20) on IE. The error has an effect to
> not loading JSON-functions in background. I do not know, is it depended
> with GCM or not?
>
> Thank you and take care. Best regards
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>