Skip to content

[Linux] 3 tests failing in Test_org_eclipse_swt_browser_Browser #1564

@fedejeanne

Description

@fedejeanne

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

  • Install the proper version of WebKit with this command:
VERSION=2.46.3-0ubuntu0.24.04.1 && sudo apt-get install libwebkitgtk-6.0-4=${VERSION} libjavascriptcoregtk-6.0-1=${VERSION}
  • Run this snippet:
Snippet

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();
	}
}

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:

VERSION=2.44.0-2 && sudo apt-get install libwebkit2gtk-4.1-0=${VERSION} libjavascriptcoregtk-4.1-0=${VERSION}

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):

image

image

image

All 3 tests timed out.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Linux/GTKHappens on LinuxWebkitbugSomething isn't workinghelp wantedExtra attention is neededjunitJUnit test failureregressionSomething that used to work

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions