GWT app gets loaded multiple times in Firefox

257 visningar
Hoppa till det första olästa meddelandet

grue

oläst,
7 feb. 2023 08:03:252023-02-07
till GWT Users
I have observed a weird behaviour when opening a GWT app in Firefox. When I first open the page everything is normal but once I refresh the page all resources including the index.html get fetched twice. If I refresh the page once more everything gets fetched three times and so on... (see screenshot attached)
I see this behaviour only on FF, even on a freshly installed one and after clearing all the caches and data.
To reproduce the issue I created a minimalistic GWT app at https://github.com/mgrue/TestGWT
Reproducing is a bit tricky since sometimes the app behaves normal but once you close the tab and open a new on or restart FF the weird behaviour is back. I tested the app both on Wildfly and Jetty (I have included a Dockerfile) but can't see any difference.

I'd really appreciate if someone could help me figuring out what's going on here.

Thank you very much in advance!
Michael

Screen Shot 2023-02-07 at 1.40.03 PM.png

lofid...@gmail.com

oläst,
8 feb. 2023 04:32:382023-02-08
till GWT Users
Following question:
- What OS?
- Do you try in development mode or deployment mode?

Thanks,
Lofi

grue

oläst,
8 feb. 2023 05:47:432023-02-08
till GWT Users
I have tested it on MacOS 12.6.3 and Ubuntu and Windows 10 and in deploy mode but I also see the issue in development mode.

Michael

grue

oläst,
8 feb. 2023 07:02:372023-02-08
till GWT Users
I have deployed the example app here:

Michael Conrad

oläst,
8 feb. 2023 08:04:202023-02-08
till google-we...@googlegroups.com
We see the same behavior here. I'm convinced it is some sort of FF bug. Why else would a page reload increase the number of times the entry point is entered? Is not a page reload supposed to be the same as opening it up in a new tab while discarding all previous JS states?
--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-tool...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-web-toolkit/e2a0a891-04e1-4bd8-9e7f-8047fab9ea8en%40googlegroups.com.

grue

oläst,
8 feb. 2023 08:21:192023-02-08
till GWT Users
I agree. However, if I comment out the script tag that loads the nocache.js the problem is gone. That's why I suspect that GWT is somehow involved.

Sebastian

oläst,
8 feb. 2023 09:18:332023-02-08
till GWT Users
We experienced a similar issue a while ago.

This was related to explicitly submitting a form so that the browser's password save dialog can kick in.

In our case we found that the page reload was caused by not explicitly cancelling the corresponding SubmitEvent on submit.

Once we added event.cancel(), the page did no longer reload.

@Override
public void onSubmit(SubmitEvent event) {
// This is very important or we end up at onModuleLoad again and start from scratch.
// We need to submit this form so that the browser's password save dialog can kick in.
 event.cancel();
 // continue...
}
});

Hope this helps in one way or another.

Thomas Broyer

oläst,
8 feb. 2023 14:44:012023-02-08
till GWT Users
It seems to be due to the __gwt_historyFrame: the subsequent requests have initiator=subdocument in the dev tools network panel, and a Sec-Fetch-Dest:iframe request header; if you inspect the iframe in dev tools, you can see the host page being loaded inside it rather than an about:blank, and each reload will load one more level.
Given that this iframe was only there for old IE versions that didn't support onhashchange (according to caniuse.com, that was IE6 and IE7), you can safely remove it (code using it was removed in GWT 2.7 a bit more than 9 years ago, released more than 8 years ago: https://github.com/gwtproject/gwt/commit/802da200257a1ba1600638be217f55fda331bde9 – yet, the website still references it, and the GWT Plugin for Eclipse apparently still generates it: https://github.com/gwt-plugins/gwt-eclipse-plugin/blob/ceff817bc9e1af81cf007411dc11192c0c700cb1/plugins/com.gwtplugins.gwt.eclipse.core/src/com/google/gwt/eclipse/core/wizards/NewHostPageWizard.java#L171-L173)

Michael Conrad

oläst,
8 feb. 2023 14:46:362023-02-08
till google-we...@googlegroups.com, Jason Carter
Thank you very much!
--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-tool...@googlegroups.com.

grue

oläst,
9 feb. 2023 04:23:252023-02-09
till GWT Users
Thanks very much Thomas, I really appreciate it!

lofid...@gmail.com

oläst,
9 feb. 2023 13:30:532023-02-09
till GWT Users
Thanks Thomas,

I still used this line in my index.html

<iframe src="javascript:''" id="__gwt_historyFrame" tabIndex='-1'
style="position: absolute; width: 0; height: 0; border: 0"></iframe>

So, it's safe to delete this?

@grue: Is it working in FF after you delete the line? Thanks!

Michael Moser

oläst,
10 feb. 2023 08:08:242023-02-10
till google-we...@googlegroups.com

Hi all

I am trying to set my GWT development environment up such that I deploy to a local Tomcat (v8.5 in my case) from my IDE (Eclipse and IntelliJ – I am setting this up for an entire team) and then start CodeServer to supply the JS code, the code maps and what not.

 

I managed to get things starting up, the application gets deployed to Tomcat from the IDE and then I manually start the code server via mvn gtw:codeServer in a command window. Note: I am NOT using any GWT plugin, neither Eclipse’s nor IntelliJ’s. Maybe I will give them another  try later, but in my last installation neither worked.

 

I can then connect to the WebPage, I get the login-form and the initial webpage and the code-server starts compiling the JS-code. So far so good.

 

However, then the compilation in the code server always fails due to some missing source files. I analyzed the errors and there indeed bugs in our code. Earlier developers added code that should be server-side only into shared DTO classes . I will need to re-arrange and fix that but I don’t have the time right now.

 

The offending methods are never used on the client side and thus apparently they are ignored and do no harm. Amazingly the GWT compiler – when compiling the application for the version that gets packed up as war file – ignores those issues and continues with the compilation and the deployed application then runs just fine.

 

But when the very same application is compiled in code-server the compilation fails:

[INFO]       Compiling module ch.zh.ksta.zhstregisterjp.ZHStRegisterJPWeb

[INFO]          Ignored 8 units with compilation errors in first pass.

[INFO] Compile with -strict or with -logLevel set to TRACE or DEBUG to see all errors.

[INFO]          [ERROR] Errors in 'file:/D:/Projects/KStA_ZH_RegisterJP/code/application/zhstregisterjp-common/src/main/java/ch/zh/ksta/zhstregisterjp/shared/security/SecurityUtils.java'

[INFO]             [ERROR] Line 36: No source code is available for type org.springframework.security.core.context.SecurityContextHolder; did you forget to inherit a required module?

[INFO]       [ERROR] Compiler returned false

[INFO]       [WARN] recompile failed

[INFO]       [WARN] continuing to serve previous version

Since there *is no* previous version that’s it and the application then hangs/crashes.

It almost seems as if code server compiles in strict mode here, even though I explicitly have specified <failOnError>false</failOnError> in the plugin config.

Can one somehow “fix” (or rather circumvent) this behavior?

 

I need to be able to run and debug this application soon and have to postpone the cleanup to later. Is there a way to get the code server ignoring those errors and continue compiling that code – as the GWT-compiler apparently does when generating the code for the .war file?

 

Regards,

Michael

 

 

Michael Moser

oläst,
10 feb. 2023 11:15:252023-02-10
till google-we...@googlegroups.com

I boiled the cases where the compilation triggered in the code server stalls (see my previous email) down to three errors (the other dozen or so I was able to fix), but what do these last error messages try to convey to me?

 

[INFO]             [ERROR] Line 193: Rebind result 'ch.zh.ksta.zhstregisterjp.client.ui.components.ZHStRegisterJPThreeListField.ZHStRegisterJPThreeListFieldAppearance' must be a class

[INFO]             [ERROR] Line 141: Rebind result 'com.sencha.gxt.data.shared.LabelProvider' must be a class

 

What is this «rebinding» about? Is there some explanation somewhere? And why does it fail here? Esp. the latter error bothers me since that is in some library we use and I can’t change that.

 

And the third one:

 

[INFO]             [ERROR] Line 85: Only string constants may be used as property name in System.getProperty()

 

The code causing the above is from a spring library:

 

    public static boolean getBoolean(final String name) {

        boolean result = false;

        try {

            result = Boolean.parseBoolean(System.getProperty(name));

        } catch (IllegalArgumentException | NullPointerException e) {

        }

        return result;

    }

 

Does that REALLY mean that GWT can’t handle a System.getProperty(…)-calls with an argument that’s passed into the method? That seems completely brain-damaged to me. Why is that so???

--

You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-tool...@googlegroups.com.

lofid...@gmail.com

oläst,
10 feb. 2023 12:22:562023-02-10
till GWT Users
You need to think that the result app will be running in browser as JavaScript.

Can you do System.getProperty(...) in web browser?

In my last article I emphasize this:

(4) Treat the client as a JavaScript app

It is helpful for Java developers to think of the client as a JavaScript web application, since the result of the transpilation process is JavaScript that runs on a web browser. This makes it easier to understand how to include the JavaScript files in the static directory of your Spring Boot web application.


And also don't mix the server and client module. It seems you add SpringFramework together with your client module...

In my article above I write about the separation...

Hope this helps.

lofid...@gmail.com

oläst,
10 feb. 2023 12:38:042023-02-10
till GWT Users
You can still emulate System.xxx if you want to:

https://stackoverflow.com/questions/6457047/gwt-java-emulation
Michael Moser schrieb am Freitag, 10. Februar 2023 um 17:15:25 UTC+1:

Thomas Broyer

oläst,
11 feb. 2023 13:27:252023-02-11
till GWT Users
On Friday, February 10, 2023 at 6:38:04 PM UTC+1 lofid...@gmail.com wrote:
You can still emulate System.xxx if you want to:

It is emulated since GWT 2.8.0, where it returns GWT properties' values: https://github.com/gwtproject/gwt/commit/999d9a68abfa2583692826e49095dd26cb07f715

But as the error message said, the property name needs to be a constant for the compiler to replace it with the property value.

lofid...@gmail.com

oläst,
11 feb. 2023 17:20:242023-02-11
till GWT Users
Thanks Thomas for the info!
Svara alla
Svara författaren
Vidarebefordra
0 nya meddelanden