You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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#2014.
Copy file name to clipboardExpand all lines: tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_browser_Browser.java
+35-40Lines changed: 35 additions & 40 deletions
Original file line number
Diff line number
Diff line change
@@ -44,6 +44,7 @@
44
44
importjava.util.ArrayList;
45
45
importjava.util.Collection;
46
46
importjava.util.Collections;
47
+
importjava.util.LinkedHashSet;
47
48
importjava.util.List;
48
49
importjava.util.Locale;
49
50
importjava.util.Map.Entry;
@@ -824,8 +825,8 @@ public void test_OpenWindowListener_addAndRemove() {
0 commit comments