Skip to content

Commit

Permalink
Add browser regression test for calling evaluate requiring event loop
Browse files Browse the repository at this point in the history
Regression test for
eclipse-platform#1771
  • Loading branch information
sratz authored and HeikoKlare committed Jan 29, 2025
1 parent 2772617 commit 7a44e53
Showing 1 changed file with 21 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,27 @@ public void test_evalute_Cookies () {
assertFalse(res.isEmpty());
}

@Test
public void test_evaluate_callingIntoSwt() throws Exception {
AtomicBoolean initialLoad = new AtomicBoolean();
AtomicBoolean openWindowListenerCalled = new AtomicBoolean();
browser.addProgressListener(ProgressListener.completedAdapter(e -> initialLoad.set(true)));
browser.addOpenWindowListener(event -> {
event.required = true; // block default
openWindowListenerCalled.set(true);
});
browser.setText("""
<button id="button" onClick="window.open('https://eclipse.org');">open eclipse.org</button>
""");
waitForPassCondition(initialLoad::get);

browser.evaluate("""
document.getElementById("button").click();
""");

waitForPassCondition(openWindowListenerCalled::get);
}

@Test
public void test_ClearAllSessionCookies () {
// clearSessions will only work for Webkit2 when >= 2.16
Expand Down

0 comments on commit 7a44e53

Please sign in to comment.