Bug 505418 - [GTK3][webkit] Support Javascript 'evalute()' in Webkit2
Summary: [GTK3][webkit] Support Javascript 'evalute()' in Webkit2
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 4.5   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 4.7 M5   Edit
Assignee: Leo Ufimtsev CLA
QA Contact:
URL:
Whiteboard:
Keywords: noteworthy
Depends on: 505591
Blocks: Webkit2Port4.7
  Show dependency tree
 
Reported: 2016-10-07 11:45 EDT by Leo Ufimtsev CLA
Modified: 2017-05-17 14:46 EDT (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Leo Ufimtsev CLA 2016-10-07 11:45:27 EDT
Currently evalute() doesn't return anything. Need to implement this functionality. This bug is to track progress.
Comment 1 Eclipse Genie CLA 2016-11-18 12:49:52 EST
New Gerrit change created: https://git.eclipse.org/r/85316
Comment 3 Lars Vogel CLA 2016-11-22 04:54:41 EST
Should this be added to our N&N M4?
Comment 4 Leo Ufimtsev CLA 2016-11-22 10:04:38 EST
(In reply to Lars Vogel from comment #3)
> Should this be added to our N&N M4?

Evaluate in Webkit2 is not fully finished just yet. It now works for primitive return types and Strings, but I have yet to implement support for returning arrays.
Comment 5 Alexander Kurtakov CLA 2016-11-29 11:49:13 EST
Moving to M5 as it will not be finished in time for M4.
Comment 6 Eclipse Genie CLA 2016-12-15 20:14:00 EST
New Gerrit change created: https://git.eclipse.org/r/87283
Comment 8 Alexander Kurtakov CLA 2016-12-20 05:22:29 EST
Resolving the bug - all code is in.
Comment 9 Leo Ufimtsev CLA 2017-01-27 10:18:34 EST
While investigating Bug 510183 (hang), I found a situation where the webkitgtk_custom.c logic an cause a deadlock.

- If Webkit triggers a signal (e.g locationChange signal)
- If in this SWT (java) signal handler, an execute(..) evaluate(...) call is made, 
  then in the webkitgtk_custom.c logic, it will wait for the javascript execution to run,
  (webkit_web_view_run_javascrip(....))
  but webkit_web_view_run_javascript(..) [btw which is async] is never ran. It is put on top of the
  event queue to be ran, but it's not ran until the signal is finished.
- But the signal does not finish until webkit_web_view_run_javascript(...) is ran.

Like:
Webkit ---signal--> Java ---- evaluate()-----
           ^                  	           |
	   |(waiting on signal to finish)---	

The only solution I can think of is not to wait on webkit_web_view_run_javascript(..) to complete if it's called during a signal from webkit. I.e, execute()/evaluate(..) would still work, but it would not provide a return value in the corner case when it's called from a signal. 
This is a limitation of SWT and Webkit's api not being compatible. (SWT expects a sync exec, but webkit2 only provides async exec).

~Patch en-route
Comment 10 Lakshmi P Shanmugam CLA 2017-01-30 03:58:48 EST
M5 is done, moving to M6.
Comment 11 Leo Ufimtsev CLA 2017-01-30 11:26:16 EST
(In reply to Lakshmi Shanmugam from comment #10)
> M5 is done, moving to M6.

Thank you for picking up on that.

In the mean time:

I found a better fix that doesn't involve disabling evaluate():
https://git.eclipse.org/r/#/c/89875/

As such, this bug is not affected any more. Since it was meregd in M5, I'll set the Target milestone back to when this patch was originally merged.
Comment 12 Leo Ufimtsev CLA 2017-04-03 12:59:02 EDT
Need to modify previous debug_flag in makefile a bit.
Comment 13 Eclipse Genie CLA 2017-04-03 12:59:22 EDT
New Gerrit change created: https://git.eclipse.org/r/94319