Skip to main content
aboutsummaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)AuthorFilesLines
2022-03-17Bug 573616 - [GTK] BrowserFunction only work in first browser instanceNikita Nemkin1-616/+0
(Part 1) Remove existing BrowserFunction implementation. To provide synchronous BrowserFunction calls from JavaScript to Java, SWT loads a native browser extension and communicates with it via a private D-Bus. Existing implementation assumes a single instance of the browser extension, but newer WebKitGTK versions create a separate process per view, resulting in multiple extension instances. The follow-up patch will provide an alternative BrowserFunction implementation based on the XMLHttpRequest. Change-Id: I74ce4ba944833ef205c409f197c5d22d2cae51fe Reviewed-on: https://git.eclipse.org/r/c/platform/eclipse.platform.swt/+/191031 Reviewed-by: Alexander Kurtakov <akurtako@redhat.com> Tested-by: Alexander Kurtakov <akurtako@redhat.com>
2021-01-12Bug 570178 - [GTK] Hide WebKit deprecation warningsAlexandr Miloslavskiy1-0/+12
Change-Id: Ia1b2607a9e248f5da5af0786dd991c04bbcf8422 Signed-off-by: Alexandr Miloslavskiy <alexandr.miloslavskiy@syntevo.com>
2020-06-08Bug 562443 - SWT spams temp folder with innumerable foldersPaul D'Pong1-9/+5
Removed unnecessary temporary directory creation, as Linux supports abstract addresses (compared to path-based addresses). Now both implementations (C & Java) of construct_server_address returns a pointer to a string representing the abstract name for the server to use for creation. See: https://dbus.freedesktop.org/doc/dbus-specification.html https://fossies.org/linux/glib/gio/tests/gdbus-peer.c Change-Id: Ia7a29e6833164bae39ba93e12006dba9f018c06e Signed-off-by: Paul D'Pong <sdamrong@redhat.com>
2020-02-17[GTK] Fix compilation warningsSravan Kumar Lakkimsetti1-7/+7
Change-Id: Ic8d58b2b652cf8684b3667a225df66c501caceef Signed-off-by: Sravan Kumar Lakkimsetti <sravankumarl@in.ibm.com>
2020-02-16Revert "[GTK] Fix compilation warnings"Sravan Kumar Lakkimsetti1-7/+8
This reverts commit 68415d36c3caba2410b68a953439e3436f0970fc. Change-Id: I2b74ae979ed2b8716bc697e3091d3c2d198dc3e4
2020-02-16[GTK] Fix compilation warningsNikita Nemkin1-8/+7
* Remove leftover sizeof that isn't defined anymore. * Fix GTK3/4 compatibility for gdk_cursor_new_from_name. * Fix signed/unsigned comparison and uninitialized field warnings. Change-Id: I9497f1f715568c4511eca974009c04d1f904ac8d Signed-off-by: Nikita Nemkin <nikita@nemkin.ru>
2019-12-13Bug 540060: The webkit dbus IPC should use a private busEric Williams1-115/+177
Convert WebKit code in SWT to use a private bus system instead of registering a public GDBus service on the system. How this works: 1) SWT creates a GDBusServer with an address. 2) This address is passed to the web extension on initialization. 3) The web extension creates its own GDBusServer with its own address. 4) The web extension then connects back to the SWT main process (recall step 2) with its own server address created in 3). 5) The SWT main process connects to the web extension via GDBusConnection. 6) Methods defined in the SWT GDBusServer and the web extension's GDBusServer are called via g_dbus_connection_call* methods. In summary: -SWT main process has a server and a connection to the extension -SWT web extension has a server and a connection to the SWT main process All functionality operates as before, just instead of registering a proxy with the system, the communication happens over private GDBusConnections. Some implementation notes: - We need to worry about disposing GDBus related objects to prevent leaks. - Disposal happens in the SWT main process, the only thing the web extension disposes is its own server (all connections are disposed of in SWT). - Disposal won't happen until the Display is released. - Authentication is a thing now: only processes owned by the same user as the SWT main process can connect to any of these DBus services. - Communication happens on GDBus services via a unix socket created in the /tmp directory. Tested on GTK3.24 with Fedora 30 and 31. No AllBrowserTests fail. Snippets from BrowserFunction related bugs maintain functionality. Red Hat Central in JBoss Tools also works as expected. Change-Id: Ife2c5260b22d927cc95aecc710f808e9e5bf89d7 Signed-off-by: Eric Williams <ericwill@redhat.com>
2018-10-17Bug 540200: [Webkit2] BrowserFunction strings are truncated afterEric Williams1-7/+12
reloading the page Perform a deep copy of strings received from GDBus, as these might be freed later on and can lead to issues. Tested with JBoss Tools/Red Hat Devstudio using the Red Hat Central page. The snippets/tests from bug 536141 still work as expected, and AllBrowserTests pass. Change-Id: I03e1aa092e0dec2965d749eeae27074c0951ee16 Signed-off-by: Eric Williams <ericwill@redhat.com>
2018-08-14Bug 536141: [Webkit2][Gtk] BrowserFunction lost after page reload onEric Williams1-18/+223
Linux/GTK The main cause of this bug is that web pages load too quickly -- by the time the BrowserFunctions are re-registered asynchronously from Java, the extension has loaded the page. BEFORE THIS PATCH: BrowserFunctions were registered asynchronously from Java into the web extension (C). This was done either at the outset (WebBrowser.createFunction()), or after every page load (Webkit.webkit_load_changed() callback). AFTER THIS PATCH: The fix is relatively straightforward, yet GDBus adds a lot of overhead. Instead of constantly registering BrowserFunctions from Java, we load them into the web extension on creation. This hands off the responsibility of re-registering BrowserFunctions to the web extension, which reduces overhead and ensures the functions are registered/executed before the page loads. The BrowserFunctions are stored at the C level in the extension, using a linked list. Whenever the "object-cleared" callback is triggered in the extension, the linked list is iterated over and any BrowserFunctions for that page are re-registered. Chronological ordering of information flow from SWT -> web extension via GDBus. 1) SWT Webkit class is loaded. SWT GDBus server is created. 2) SWT Webkit creates the extension, passing it the information of the SWT Webkit GDBus server. 3) The extension's initialization callback is called in C. 4) In this callback the extension contacts the SWT Webkit GDBus server and provides it with information such as its PID and name. 5) SWT Webkit acknowledges this information, and sends back any BrowserFunctions that were created before the extension loaded. 6) The extension adds these BrowserFunctions to its linked list. 7) Any subsequent BrowserFunctions are added to the extension's linked list by calling the extension's GDBus server synchronously. In the event of a GDBus timeout (happens sometimes when running tests), the GDBus call is made asynchronously. This functionality can be tested with the attached snippet. AllBrowserTests pass without issue, and there are no visible Browser issues in the IDE. The plugin attached to the initial bug report is now functional. Change-Id: Iddc5f2e69f0a7fd4500bd8228f0bc46c4b3a6322 Signed-off-by: Eric Williams <ericwill@redhat.com>
2017-12-08Bug 510905 [GTK3][Webkit2] Implement webkit2 support for browserLeo Ufimtsev1-1/+1
function (Part 2: Java return a value from callback.) 32bit warning fix. On 32bit systems, the webkitgtk_extension.c produces a warning because gsize is different on 32 bit than on 64 systems. Adding a cast that enforces consistent behavior across platforms. Change-Id: Ibc92c3d7fcdcbbf89f5a011e1a51d00e1f91240d Signed-off-by: Leo Ufimtsev <lufimtse@redhat.com>
2017-12-07Revert "Bug 510905 (Webkit2FuncRetVal)[GTK3][Webkit2] Fix 32bit compile ↵Leo Ufimtsev1-1/+1
warning." This reverts commit ccddf4d86de9b18c70f5ee874a6495a2eaeeed6d.
2017-12-07Bug 510905 (Webkit2FuncRetVal)[GTK3][Webkit2] Fix 32bit compile warning.Leo Ufimtsev1-1/+1
On 32bit systems, the webkitgtk_extension.c produces a warning because gsize is different on 32 bit than on 64 systems. Adding a cast that enforces consistent behavior across platforms. Change-Id: I27d1a1900bf949596eac746dc000fec2e0e7b107 Signed-off-by: Leo Ufimtsev <lufimtse@redhat.com>
2017-12-02Bug 510905 [Webkit2] BrowserFunction with return value back toAlexander Kurtakov1-1/+2
Javascript Fix compile to not require c99. Change-Id: I1b6ffbd3c053b33f0eec293228edb8e897cde1e2 Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
2017-12-01Bug 510905 [Webkit2] BrowserFunction with return value back toLeo Ufimtsev1-0/+335
Javascript (PRIOR TO MERGING, SWT BINARY REPO NEEDS TO BE PATCHED) Webkit2 moved it's webprocess into a separate process. For javascript to call a function, it needs to do so via the separate process. To interact with the separate process, we need to implement a webextension, which is a separate '.so' file loaded at run time. The extension needs to reside in it's own folder otherwise webkit will try to load the other .so files as extensions. (See Library.java changes). Communication between the extension and the main process is done via a gdbus channel. Javascript/Java types are packaged into GVariants and transmitted via gdbus. Compilation of the webextension requires webkit2gtk package to be present on build servers. Tests: - All jUnits pass - SWT Snippet (307) that use BrowserFunction work. - Attached local snippet can be used to test sending various paramaters over gdbus and receiving them back prints to main webview. - Child eclipse works fine with the patch. - Afaik, no known error/warnings are produced. (If there are, let me know). This might break 32bit build of SWT though, not tested on 32 bit. Patch set log: -------------- Patchset 6: - Passing webview as string in javascript function. Patchset 8: - Implemented dynamic gdbus bindigs on SWT/Java side. Works. (fairly large patch) Patchset 9: - Implemented gdbus bindings on client side, such that it can reach server. (working) Patchset 10: - Added GVariant conversion functions on SWT side. Works. - Moved code out of OS.java to reside only in WebKitGTK Patchset 11: - Figured out how to provide return value as an object array. Added snippet to show how to provide a string return value. (working) Patchset 12: - Passed webview pointer, index and token to Java. - Fixed typo in type definition. > (Working) Patchset 13: - Now passing javascript arguments along through gdbus to java. > (Working) Patchset 14: (Week 46) - Implemented support for 'null'. (use byte as magic number). - Found that there is a bug in how I deal with return value in gdbus, gdbus returns an array (always). Need to return first item in array. Patchset 15: (Week 46) - Implemented proper return value of java to javascript. - Found that js calls with no paramaters call() fail, need to fix. Patchset 16: (Week 46) - Implemented support for empty arrays (including calls without args). - Code tidy. - Found that I need to implement input argument verification from JS call and from java code ran by user, otherwise gdbus can crash. Patchset 17: (Week 46) - Implement checking of user-input arguments, to ensure it won't break gdbus connection. Patchset 18: (Week 46) - Implemented checking of return value from userfunction, so bad return value doesn't break gdbus. - Code tidy/polish. - Need to implement lazy loading of gdbus, only init gdbus for the first function that we instantiate. - Also still getting warning when loading webkit library. Patchset 19: [Week 47] - Implemented lazy loading of gdbus, to only load when needed. - wrapped getPID() into lock, otherwise had strange debug/execution behaviour. Patchset 20: [Week 47] - Two BrowserInstances with Two BrowserFunctions seem to hang (snippet), (need to investigate) Patchset 21: [W47] - Removed redundant print statements. Cleaned up code. Patchset 22: [W47] - Moved Webkit extension initialization logic into a callback, so that it's guaranteed to be loaded at the most optimal time. (All jUnits pass). Patchset 23: [W47] - Removed redundant println. Patchset 24: [W47] - Implemented mechanism by which webextension is compiled and loaded from a folder. (This needs a patch to binary project's build.properties) Patchset 25: [W47] - Code tidy. Patch complete (ish). Patchset 26: [W47] - forgot to add files to patchset 25. Patchset 27: [W47] - Verified that Browser widget will continue to work if webextension fails to load. - Added relevant warnings. Patchset 28: - Minor update on SWT_LIB_VERSIONS. Change-Id: Iccfc48bc78774ac4120aafd976186381f247c562 Signed-off-by: Leo Ufimtsev <lufimtse@redhat.com>

    Back to the top