-
Notifications
You must be signed in to change notification settings - Fork 139
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Multiple tests failing in Test_org_eclipse_swt_browser_Browser #1564
Comments
"More" is a comparison. Did you mean "Multiple" which is a numeric? Is the failure always reproduceable or random? |
I originally meant "more" because I wanted to mention the other tests that are failing (for which there is already an issue) but I changed my mind to avoid confusion. I changed the title now, thank you for the pointer. The tests fail very consistently when I run them locally. I am not sure about the failures in the pipelines though, I've only seen them failing in my own PRs. |
I can reproduce the failures locally on Ubuntu 24.04.1, Webkit 2.46.1. Tests fail with both X11 and Wayland. When I use the WebKit browser inside Eclipse and navigate to an HTML file that contains the same code as passed to the browser in the test, a child window pops up as expected. |
In tonight's I-build these tests now fail for all java versions 17,21 and 23. In the last night's it only failed for 17: I cannot tell if this is related to switching to Ubunut based images for Linux (eclipse-platform/eclipse.platform.releng.aggregator#2522) or if this is all just coincidence. |
I believe it's related (e.g. different webkitgtk version) but failing constantly is better than randomly. |
I can now confirm that an update of webkit introduced these test failures. I just downgraded from version 2.46.1 to 2.44.0 and the tests run fine again. More precisely, I downgraded the following libraries on an Ubuntu 24.04 system (target version: 2.44.0-2, original version: 2.46.1-0ubuntu0.24.04.1):
|
I can't notice anything in webkitgtk news file but it doesn't seem to contain changes in webkit engine itself but only changes to the "bindings" aka it's still to be figured where to find the changes in the engine itself. |
Indeed. I have not yet understood where the event flow stops. It does not seem to be missing JavaScript execution (as I indicated first), but rather with subsequent event processing. I also found a warning being logged with the current WebKit version that may direct to the problem (the "child" browser not being instantiated correctly):
I have extracted one of the test cases into a standalone snippet (but the essence of the snippet is the same for all failing tests, so the root cause should be the same): public class OpenChildBrowser {
public static void main(String[] args) {
Display display = new Display();
final Shell shell = new Shell(display);
shell.setLayout(new FillLayout());
final Browser browser = new Browser(shell, SWT.NONE);
Shell childShell = new Shell(shell, SWT.None);
childShell.setText("Child shell");
childShell.setLayout(new FillLayout());
final Browser browserChild = new Browser(childShell, SWT.NONE);
browser.addOpenWindowListener(event -> {
System.out.println("Open Window Listener");
event.browser = browserChild;
});
browserChild.addVisibilityWindowListener(VisibilityWindowListener.showAdapter(event -> {
System.out.println("Open shell");
childShell.open();
browserChild.setText("Child Browser");
}));
shell.open();
browser.setText("""
<html>
<script type='text/javascript'>
var newWin = window.open('about:blank');
</script>
<body>
This test uses javascript to open a new window.
</body>
</html>
""");
while (!shell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
display.dispose();
}
} The flow stops between processing the window opening event of the "main" browser (setting the This is the log output of above snippet for WebKit 2.44.0 (the second line is an added println to
This is the log output of above snippet for WebKit 2.46.1:
Unfortunately, I can currently not put more effort into this. Whoever wants to take over may find these commands useful (if on Ubuntu 24.04) to switch between the two WebKit versions for testing purposes: Switch to current WebKit (2.46.1):
Switch to previous WebKit (2.44.0):
|
I was also looking at this and debugging side to side WebKit 2.32.4 (Ubuntu 18.04.5 LTS) vs WebKit 2.46.1 (Ubuntu 24.04 LTS). All I can tell is that for 2.46.1 some
Looking at the documentation of
... which wasn't necessary before. But then again, this is just a guess and it relies on the fact that the default value of the If someone knows how to check if older versions of webkit were in fact using That's as far as I could get. Hopefully someone with more knowledge can help understand and solve this issue. |
I have tried using WEBKIT_PROCESS_MODEL_SHARED_SECONDARY_PROCESS (via calling webkit_web_context_set_process_model) on webkitgtk 2.46.3 but it failed(no change in behavior) with :
|
Thank you for testing it! Would it be possible for you to bind the method If not, any hint on how to bind the method myself would be appreciated. If I can bind it and call it, I can provide the output myself, but binding is sadly still beyond my ken 😅 |
@fedejeanne akurtakov@e5e9387 (edited to point to fixed commit) and LOCAL REBUILD OF NATIVES is all you need. As per https://webkitgtk.org/reference/webkit2gtk/stable/enum.ProcessModel.html - printing 0 is shared, 1 is multiple processes. On my webkitgtk 2.46.3 I get "Process Model:1". |
@akurtakov thank you for the help, I got it to run and I called I tried with the following versions of WebKit:
All of them in Ubuntu 24.04. This is what I found out:
The last 2 points show that using if (browser != null && !browser.isDisposed ()) {
webView = WebKitGTK.webkit_web_view_new_with_related_view( ((WebKit)browser.webBrowser).webView);
return webView;
} ... instead of if (browser != null && !browser.isDisposed ()) {
return ((WebKit)browser.webBrowser).webView;
} ... does not work, it actually breaks the older implementations too. But maybe you could try something in the same direction and see if we can successfully bind the child and the parent browser? |
Oops, the part that broke for you is a local experiment (totally unsuccessful for now) that was not supposed to end up in this commit. |
No worries, it was easy to spot it and I appreciate the experimentation you're doing :-) |
in https://download.eclipse.org/eclipse/downloads/drops4/I20241125-1220/testresults/html/org.eclipse.swt.tests_ep435I-unit-linux-x86_64-java21_linux.gtk.x86_64_21.html
|
The problem
It is not possible to open a child browser with newer versions of WebKit.
How to reproduce
The problem can be reproduced in Ubuntu 24.04 (tested using WSL2) with WebKit 2.46
Snippet
Expected result
A child window should be opened
Actual result
No child window is opened
Reverting back to a working version of WebKit
Version 2.44 of WebKit didn't have this problem. You can revert back to that version by running this command:
Original issue: failing tests
These 3 tests fail on Linux. I noticed in this run of #1496 and I was also able to reproduce it locally using WSL2:
org.eclipse.swt.tests.junit.Test_org_eclipse_swt_browser_Browser.test_OpenWindowListener_open_ChildPopup()
org.eclipse.swt.tests.junit.Test_org_eclipse_swt_browser_Browser.test_OpenWindow_Progress_Listener_ValidateEventOrder()
org.eclipse.swt.tests.junit.Test_org_eclipse_swt_browser_Browser.test_VisibilityWindowListener_eventSize()
It seems to be some issue with JavaScript (just my guess), here are some screenshots (WSL2):
All 3 tests timed out.
The text was updated successfully, but these errors were encountered: