Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 525946 (webkit2PortDownload)

Summary: [Gtk][Webkit2] Port download functionality
Product: [Eclipse Project] Platform Reporter: Leo Ufimtsev <lufimtse>
Component: SWTAssignee: Roland Grunberg <rgrunber>
Status: CLOSED FIXED QA Contact: Leo Ufimtsev <lufimtse>
Severity: normal    
Priority: P3 CC: akurtakov, lufimtse, niraj.modi, peter, platform-swt-inbox, rgrunber
Version: 4.8   
Target Milestone: 4.8 M4   
Hardware: PC   
OS: Linux   
See Also: https://git.eclipse.org/r/110238
https://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?id=efc5563b7cb50fbcec6327f029f63a31292bde26
https://bugs.eclipse.org/bugs/show_bug.cgi?id=533545
https://git.eclipse.org/r/#/c/121373/
Whiteboard: RHT
Bug Depends on:    
Bug Blocks: 516838    

Description Leo Ufimtsev CLA 2017-10-12 12:07:48 EDT
While working on:
Bug 514859 – [Webkit2] Verify that no webkit1-only functions are called on Webkit2. 

I found that the 'download' functionality has a situation where Webkit2 reaches webkit1-only functions.

See: Webkit.java
	webkit_download_requested(..)
	openDownloadWindow(..)

ex: "webkit_download_get_suggested_filename()" is a webkit1-only function.

This has the potential to cause a JVM crash and I don't know if download functionality actually works at the moment.

The following needs to be done:

1) Guard off Webkit1 functions from ever being called by webkit2. (Patch #1).
   (It's best that this functionality does nothing rather than cause crashes for the time being).

2) Write a jUnit to auto-test this functionality.
If no jUnit can be written for this for some reason, then a test snippet should be uploaded to:
- project:org.eclipse.swt.tests.gtk
    folder: Bug Snippets

3) Implement webkit2 equivalent. 

Note, 
- For this you might consider testing things with a native snippet. You may find my repository with simple snippets useful. For example here is a mini-webkit browser:
https://github.com/LeoUfimtsev/LeoGtk3/blob/master/snip_webkit_minibrowser/main.c

- Some relevant reading material:
  * Signals: 
    https://developer.gnome.org/gtk-tutorial/stable/x159.html
    https://developer.gnome.org/gobject/stable/signal.html
    http://zetcode.com/gui/gtk2/gtkevents/
Comment 1 Leo Ufimtsev CLA 2017-10-12 15:01:58 EDT
As a note, currently with webkit2, if you click on a download link, nothing happens.
Comment 2 Eclipse Genie CLA 2017-10-17 12:07:40 EDT
New Gerrit change created: https://git.eclipse.org/r/110238
Comment 4 Leo Ufimtsev CLA 2017-11-06 10:41:47 EST
Thank you very much for the patch, great work!
Comment 5 Niraj Modi CLA 2017-12-06 07:05:40 EST
Please verify(get verify) this bug fix in latest M4 build.
Comment 6 Leo Ufimtsev CLA 2017-12-06 13:18:41 EST
Verified on:
eclipse-SDK-I20171206-0800-linux-gtk-x86_64.tar.gz
Comment 7 Leo Ufimtsev CLA 2018-04-18 14:30:17 EDT
Wrote a patch to address a corner case:
https://git.eclipse.org/r/#/c/121373/
Comment 8 Leo Ufimtsev CLA 2018-04-19 13:58:36 EDT
Fixed. Will remove remaining instance checks in:

533833 – [Webkit2] Should not use G_TYPE_CHECK_INSTANCE_TYPE(..)
https://bugs.eclipse.org/bugs/show_bug.cgi?id=533833