Skip to content

Commit 1ffe51f

Browse files
committed
[Win32] Spin event loop in Edge instead of processing OS messages eclipse-platform#1771
Before recent improvements of the Edge implementation, it was possible that a browser instance was disposed during WebView initialization, which made the initialization fail exceptionally. This has been worked around by not processing all kinds of asynchronously scheduled events (like a disposal) while waiting for WebView initialization but only those being processes by the OS event queue. This was still necessary to process the OS callbacks for WebView initialization and other operations. In some cases, this may lead to an Edge browser instance blocking the UI thread, as some asynchronously scheduled tasks need to be processed but are not. In addition, enhancements of the Edge implementation made the initialization happen asynchronously anyway, such that the browser instantiation itself cannot throw an error anymore, but the asynchronously happening initialization is now capable of processing asynchronous browser disposals. This change simplifies the event processing inside Edge to not only process the next OS message but to just ordinarily spin the event loop. This reduces the risk of operations executed on an Edge browser to block execution. eclipse-platform#1771
1 parent bff91d7 commit 1ffe51f

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_browser_Browser.java

+12-1
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@
8181
import org.eclipse.swt.widgets.Shell;
8282
import org.eclipse.swt.widgets.Text;
8383
import org.junit.Before;
84+
import org.junit.BeforeClass;
8485
import org.junit.FixMethodOrder;
8586
import org.junit.Ignore;
8687
import org.junit.Rule;
@@ -157,6 +158,16 @@ public Test_org_eclipse_swt_browser_Browser(int swtBrowserSettings) {
157158
this.swtBrowserSettings = swtBrowserSettings;
158159
}
159160

161+
@BeforeClass
162+
public static void setupEdgeEnvironment() {
163+
// initialize Edge environment before any test runs to isolate environment setup
164+
if (SwtTestUtil.isWindows) {
165+
Shell shell = new Shell();
166+
new Browser(shell, SWT.EDGE);
167+
shell.dispose();
168+
}
169+
}
170+
160171
@Override
161172
@Before
162173
public void setUp() {
@@ -295,7 +306,7 @@ private Browser createBrowser(Shell s, int flags) {
295306
}
296307

297308
private Browser createBrowser(Shell s, int flags, boolean expectSuccess) {
298-
long maximumBrowserCreationMilliseconds = 20_000;
309+
long maximumBrowserCreationMilliseconds = 90_000;
299310
long createStartTime = System.currentTimeMillis();
300311
Browser b = new Browser(s, flags);
301312
// Wait for asynchronous initialization via getting URL

0 commit comments

Comments
 (0)