-
Notifications
You must be signed in to change notification settings - Fork 182
Fix browser tests on Linux that open a new window + revert downgrade of WebKit for the Linux GH runner #2020
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
Fix browser tests on Linux that open a new window + revert downgrade of WebKit for the Linux GH runner #2020
Conversation
2734b4c
to
8a9c582
Compare
This seems to break Windows browser tests and will definitely leave some cases that used to work to actually crash swt. On the other side I agree that these cases are probably not so nicely written code. |
Hm, yeah, for some reason there are two completed events. I'll update the tests to be not so strict.
I think the tests were green, but the feature actually did not work, i.e. in the old WebKit there was a return path: So I don't think any productive feature is actually broken. But yeah, the fact that WebKit is more strict now and crashes if you use the OpenWindowListener incorrectly, is not very nice. |
I don't question that. What I am afraid of such old (and non-working) code now hard crashing the whole shell instead of "silently" not working (like it was). But I guess such plugins/projects will have to fix their own code as I still can't think how to prevent that in SWT. |
According to https://webkitgtk.org/reference/webkit2gtk/stable/signal.WebView.create.html 'The new WebKitWebView must be related to web_view, see WebKitWebView:related-view for more details.' To ensure this, org.eclipse.swt.browser.WebKit.create(Composite, int) does the following: Composite parentShell = parent.getParent(); Browser parentBrowser = WebKit.parentBrowser; if (parentBrowser == null && parentShell != null) { Control[] children = parentShell.getChildren(); for (int i = 0; i < children.length; i++) { if (children[i] instanceof Browser) { parentBrowser = (Browser) children[i]; break; } } } if (parentBrowser == null) { webView = WebKitGTK.webkit_web_view_new(); } else { webView = WebKitGTK.webkit_web_view_new_with_related_view(((WebKit)parentBrowser.webBrowser).webView); } 1) A static variable set to true inside NewWindowListeners: /** * Stores the browser which is opening a new browser window, * during a WebKit {@code create} signal. This browser * must be passed to a newly created browser as "related". * * See bug 579257. */ private static Browser parentBrowser; 2) A heuristic for when two browser instances share the parent In the failing tests, we currently have neither. To fix that, use the more 'correct' solution 1) by moving the instantiation of new Browser inside the OpenWindowListener. Resolves eclipse-platform#2014.
This reverts commit f8979dc.
8a9c582
to
0f43a3a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks fine. I agree with your conclusions regarding the potential risks you have already discussed.
This will resolve #1564 as well, right?
Yes. I added it to the PR message 👍 |
According to https://webkitgtk.org/reference/webkit2gtk/stable/signal.WebView.create.html
The new WebKitWebView must be related to web_view, see WebKitWebView:related-view for more details.
To ensure this, org.eclipse.swt.browser.WebKit.create(Composite, int)
does the following:
In the failing tests, we currently have neither.
To fix that, use the more 'correct' solution 1) by moving the instantiation of new Browser inside the OpenWindowListener.
Resolves #2014.
Resolves #1564.