Skip to content

Conversation

@amartya4256
Copy link
Contributor

@amartya4256 amartya4256 commented Apr 1, 2025

This PR cotributes to replicating the behaviour of Edge:evaluate as
it is in WebKit - it must not wait for the execution of script to obtain
the result, in case evaluate is called inside a WebView callback. This
PR also makes sure that OpenWindowListeners are execute
synchronously or asynchronously depending on if the
handleNewWindowRequested is called from the evaluate script. Moreover,
this enables all the tests which were failing because of Edge:evaluate
limitations.

contributes to
#1771 and
#1919

@github-actions
Copy link
Contributor

github-actions bot commented Apr 1, 2025

Test Results

   539 files   -  6     539 suites   - 6   29m 55s ⏱️ -8s
 4 332 tests  - 37   4 322 ✅  - 35    9 💤  - 3  1 ❌ +1 
16 587 runs   - 37  16 483 ✅  - 31  103 💤  - 7  1 ❌ +1 

For more details on these failures, see this check.

Results for commit bda4169. ± Comparison against base commit 601136c.

This pull request removes 37 tests.
AllWin32Tests org.eclipse.swt.graphics.ImageWin32Tests ‑ testImageDataForDifferentFractionalZoomsShouldBeDifferent
AllWin32Tests org.eclipse.swt.graphics.ImageWin32Tests ‑ testImageShouldHaveDimesionAsPerZoomLevel
AllWin32Tests org.eclipse.swt.tests.win32.Test_org_eclipse_swt_dnd_DND ‑ testByteArrayTransfer
AllWin32Tests org.eclipse.swt.tests.win32.Test_org_eclipse_swt_dnd_DND ‑ testFileTransfer
AllWin32Tests org.eclipse.swt.tests.win32.Test_org_eclipse_swt_dnd_DND ‑ testHtmlTransfer
AllWin32Tests org.eclipse.swt.tests.win32.Test_org_eclipse_swt_dnd_DND ‑ testImageTransfer_fromCopiedImage
AllWin32Tests org.eclipse.swt.tests.win32.Test_org_eclipse_swt_dnd_DND ‑ testImageTransfer_fromImage
AllWin32Tests org.eclipse.swt.tests.win32.Test_org_eclipse_swt_dnd_DND ‑ testImageTransfer_fromImageData
AllWin32Tests org.eclipse.swt.tests.win32.Test_org_eclipse_swt_dnd_DND ‑ testImageTransfer_fromImageDataFromImage
AllWin32Tests org.eclipse.swt.tests.win32.Test_org_eclipse_swt_dnd_DND ‑ testRtfTransfer
…

♻️ This comment has been updated with latest results.

@amartya4256 amartya4256 force-pushed the amartya4256/edge_callback_listener_execution_async branch from afa88d8 to c6af804 Compare April 1, 2025 14:40
@amartya4256 amartya4256 linked an issue Apr 2, 2025 that may be closed by this pull request
@amartya4256 amartya4256 force-pushed the amartya4256/edge_callback_listener_execution_async branch from c6af804 to 6cd6756 Compare April 2, 2025 16:51
@fedejeanne fedejeanne force-pushed the amartya4256/edge_callback_listener_execution_async branch from 6cd6756 to e67bde7 Compare April 3, 2025 11:36
Copy link
Member

@fedejeanne fedejeanne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this PR does 2 things, right?

  1. It changes the strategy about how to execute callbacks by introducing the method executeAsynchronously(...)
  2. It executes some new blocks of code asynchronously by using the new method

Would it be possible to split it in 2 different PRs? That way it would be possible to see for example which part of these changes (1. or 2.) fixes the tests and which part makes it easier to work with the code.

@amartya4256 amartya4256 force-pushed the amartya4256/edge_callback_listener_execution_async branch 3 times, most recently from bd7cd75 to 87864c5 Compare April 8, 2025 12:06
@amartya4256 amartya4256 marked this pull request as ready for review April 8, 2025 12:07
Copy link
Member

@fedejeanne fedejeanne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made an initial review, just a few minor comments regarding coding practices. I will test it later today, after these comments are addressed.

In general, it looks good. Thank you @amartya4256 !

@fedejeanne fedejeanne force-pushed the amartya4256/edge_callback_listener_execution_async branch from 87864c5 to ce62574 Compare April 9, 2025 07:05
@fedejeanne
Copy link
Member

Test failure is unrelated #1843

@amartya4256 amartya4256 changed the title Edge callback listener execution async Edge:evaluate deadlock fix Apr 9, 2025
@amartya4256 amartya4256 force-pushed the amartya4256/edge_callback_listener_execution_async branch from ce62574 to f9ee6fd Compare April 9, 2025 10:26
Copy link
Member

@fedejeanne fedejeanne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@amartya4256 please restore all my changes from ce62574 and improve the text of the comment. No need for a new method.

@amartya4256 amartya4256 force-pushed the amartya4256/edge_callback_listener_execution_async branch from f9ee6fd to bda4169 Compare April 9, 2025 11:31
This commit cotributes to replicating the behaviour of Edge:evaluate as
it is in WebKit - it must not wait for the execution of script to obtain
the result, in case evaluate is called inside a WebView callback. This
commit also makes sure that OpenWindowListeners are execute
synchronously or asynchronously depending on if the
handleNewWindowRequested is called from the evaluate script. Moreover,
this enables all the tests which were failing because of Edge:evaluate
limitations.

contributes to
eclipse-platform#1771 and eclipse-platform#1919
@amartya4256 amartya4256 force-pushed the amartya4256/edge_callback_listener_execution_async branch from bda4169 to 3f39fdb Compare April 9, 2025 11:43
@fedejeanne fedejeanne merged commit c2136c9 into eclipse-platform:master Apr 9, 2025
6 of 8 checks passed
@fedejeanne fedejeanne deleted the amartya4256/edge_callback_listener_execution_async branch April 9, 2025 12:00
sratz added a commit to sratz/eclipse.platform.swt that referenced this pull request Apr 14, 2025
sratz added a commit that referenced this pull request Apr 14, 2025
@HeikoKlare
Copy link
Contributor

This PR produced a regression regarding:

While the root cause of that described issue led to a timeout before this PR, it now leads to a complete UI block from which the application does not recover.

Please have a look @amartya4256.

This is the according stack trace where it deadlocks:

Thread [main] (Suspended)	
	owns: RunnableLock  (id=43)	
	OS.PeekMessage(MSG, long, int, int, int) line: not available [native method]	
	Edge.processOSMessagesUntil(Supplier<Boolean>, Consumer<SWTException>, Display) line: 515	
	Edge.callAndWait(String[], ToIntFunction<IUnknown>) line: 288	
	Edge.evaluate(String) line: 920	
	Edge(WebBrowser).evaluate(String, boolean) line: 405	
	Browser.evaluate(String, boolean) line: 665	
	Browser.evaluate(String) line: 614	
	RichTextEditorConfiguration.customizeToolbar() line: 618	
	RichTextEditor$1.function(Object[]) line: 261	
	Edge.handleCallJava(int, long, long) line: 1014	
	0x000001d17c0cdb78.CallJava(int, long, long) line: not available	
	OS.DispatchMessage(MSG) line: not available [native method]	
	Display.readAndDispatch() line: 3725	
	Edge.processOSMessagesUntil(Supplier<Boolean>, Consumer<SWTException>, Display) line: 516	
	Edge.callAndWait(String[], ToIntFunction<IUnknown>) line: 288	
	Edge.evaluate(String) line: 920	
	Edge(WebBrowser).evaluate(String, boolean) line: 405	
	Browser.evaluate(String, boolean) line: 665	
	Browser.evaluate(String) line: 614	
	RichTextEditor$3.completed(ProgressEvent) line: 285	
	Edge.lambda$45() line: 1130	
	0x000001d17c0d4a28.run() line: not available	
	RunnableLock.run(Display) line: 40	
	Synchronizer.runAsyncMessages(boolean) line: 132	
	Display.runAsyncMessages(boolean) line: 4114	
	Display.readAndDispatch() line: 3730	
	RichTextEditorExample.main(String[]) line: 61	

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Edge: freezes in evalute()

3 participants