Title: [292452] trunk/Tools
Revision
292452
Author
[email protected]
Date
2022-04-06 00:48:33 -0700 (Wed, 06 Apr 2022)

Log Message

[Flatpak SDK][AT-SPI] Use xdg-dbus-proxy to expose the a11y bus
https://bugs.webkit.org/show_bug.cgi?id=238856

Reviewed by Carlos Garcia Campos.

Expose the host at-spi socket with xdg-dbus-proxy to avoid at-spi
bailing out by not being able to connect to the a11y bus.

Also add the exported address to the environement of the tests.

Based on the original patch by Patrick Griffis with minor updates.

* Scripts/webkitpy/port/gtk.py:
(GtkPort.setup_environ_for_server):
* Scripts/webkitpy/port/wpe.py:
(WPEPort.setup_environ_for_server):
* flatpak/flatpakutils.py:
(WebkitFlatpak.setup_a11y_proxy):
(WebkitFlatpak.run_in_sandbox):
(WebkitFlatpak.get_user_runtime_dir): Deleted.

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (292451 => 292452)


--- trunk/Tools/ChangeLog	2022-04-06 07:05:25 UTC (rev 292451)
+++ trunk/Tools/ChangeLog	2022-04-06 07:48:33 UTC (rev 292452)
@@ -1,3 +1,26 @@
+2022-04-06  Lauro Moura  <[email protected]>
+
+        [Flatpak SDK][AT-SPI] Use xdg-dbus-proxy to expose the a11y bus
+        https://bugs.webkit.org/show_bug.cgi?id=238856
+
+        Reviewed by Carlos Garcia Campos.
+
+        Expose the host at-spi socket with xdg-dbus-proxy to avoid at-spi
+        bailing out by not being able to connect to the a11y bus.
+
+        Also add the exported address to the environement of the tests.
+
+        Based on the original patch by Patrick Griffis with minor updates.
+
+        * Scripts/webkitpy/port/gtk.py:
+        (GtkPort.setup_environ_for_server):
+        * Scripts/webkitpy/port/wpe.py:
+        (WPEPort.setup_environ_for_server):
+        * flatpak/flatpakutils.py:
+        (WebkitFlatpak.setup_a11y_proxy):
+        (WebkitFlatpak.run_in_sandbox):
+        (WebkitFlatpak.get_user_runtime_dir): Deleted.
+
 2022-04-05  Chris Dumez  <[email protected]>
 
         Mark String(const char*) constructor as explicit

Modified: trunk/Tools/Scripts/webkitpy/port/gtk.py (292451 => 292452)


--- trunk/Tools/Scripts/webkitpy/port/gtk.py	2022-04-06 07:05:25 UTC (rev 292451)
+++ trunk/Tools/Scripts/webkitpy/port/gtk.py	2022-04-06 07:48:33 UTC (rev 292452)
@@ -122,6 +122,7 @@
         self._copy_value_from_environ_if_set(environment, 'WEBKIT_TOP_LEVEL')
         self._copy_value_from_environ_if_set(environment, 'WEBKIT_DEBUG')
         self._copy_value_from_environ_if_set(environment, 'WEBKIT_GST_USE_PLAYBIN3')
+        self._copy_value_from_environ_if_set(environment, 'AT_SPI_BUS_ADDRESS')
         for gst_variable in ('DEBUG', 'DEBUG_DUMP_DOT_DIR', 'DEBUG_FILE', 'DEBUG_NO_COLOR',
                              'PLUGIN_SCANNER', 'PLUGIN_PATH', 'PLUGIN_SYSTEM_PATH', 'REGISTRY',
                              'PLUGIN_PATH_1_0'):

Modified: trunk/Tools/Scripts/webkitpy/port/wpe.py (292451 => 292452)


--- trunk/Tools/Scripts/webkitpy/port/wpe.py	2022-04-06 07:05:25 UTC (rev 292451)
+++ trunk/Tools/Scripts/webkitpy/port/wpe.py	2022-04-06 07:48:33 UTC (rev 292452)
@@ -88,6 +88,7 @@
         self._copy_value_from_environ_if_set(environment, 'WEBKIT_JHBUILD')
         self._copy_value_from_environ_if_set(environment, 'WEBKIT_TOP_LEVEL')
         self._copy_value_from_environ_if_set(environment, 'WEBKIT_DEBUG')
+        self._copy_value_from_environ_if_set(environment, 'AT_SPI_BUS_ADDRESS')
         self._copy_value_from_environ_if_set(environment, 'LIBGL_ALWAYS_SOFTWARE')
         self._copy_value_from_environ_if_set(environment, 'PULSE_SERVER')
         self._copy_value_from_environ_if_set(environment, 'PULSE_CLIENTCONFIG')

Modified: trunk/Tools/flatpak/flatpakutils.py (292451 => 292452)


--- trunk/Tools/flatpak/flatpakutils.py	2022-04-06 07:05:25 UTC (rev 292451)
+++ trunk/Tools/flatpak/flatpakutils.py	2022-04-06 07:48:33 UTC (rev 292452)
@@ -16,6 +16,7 @@
 # Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
 # Boston, MA 02110-1301, USA.
 import argparse
+import atexit
 import logging
 try:
     import configparser
@@ -736,10 +737,39 @@
     def is_build_jsc(self, command):
         return command and "build-jsc" in os.path.basename(command)
 
-    @staticmethod
-    def get_user_runtime_dir():
-        return os.environ.get('XDG_RUNTIME_DIR', os.path.join('/run/user', str(os.getuid())))
+    def setup_a11y_proxy(self):
+        try:
+            output = subprocess.check_output(("gdbus", "call", "-e", "-d", "org.a11y.Bus", "-o", "/org/a11y/bus", "-m", "org.a11y.Bus.GetAddress"))
+            a11y_bus_address = re.findall(br"'([^']+)", output)[0]  # Extract string from output from: ('unix:abstract=0000f',)
+            Console.message("Found a11y address {}".format(a11y_bus_address))
+        except (subprocess.CalledProcessError, IndexError) as e:
+            Console.message("Failed to get a11y address {}".format(e))
+            return []
 
+        dbus_proxy_path = shutil.which("xdg-dbus-proxy")
+        if not dbus_proxy_path:
+            Console.message("Failed to find xdg-dbus-proxy")
+            return []
+
+        self.socket_dir = tempfile.TemporaryDirectory(prefix="webkit-flatpak-a11y-sockets-")
+        self.a11y_socket = tempfile.NamedTemporaryFile(dir=self.socket_dir.name, delete=False)
+
+        try:
+            proxy_proc = subprocess.Popen((dbus_proxy_path, a11y_bus_address, self.a11y_socket.name))
+
+            atexit.register(lambda: proxy_proc.terminate())
+        except (subprocess.CalledProcessError) as e:
+            Console.message("Failed to get run xdg-dbus-proxy {}".format(e))
+            return []
+
+        return [
+            # FIXME: --session-bus is only a workaround for https://github.com/flatpak/flatpak/pull/4630
+            "--session-bus",
+            "--no-a11y-bus",
+            "--filesystem=" + self.socket_dir.name,
+            "--env=AT_SPI_BUS_ADDRESS=unix:path=" + self.a11y_socket.name,
+        ]
+
     def run_in_sandbox(self, *args, **kwargs):
         if not self.setup_builddir():
             return 1
@@ -790,13 +820,12 @@
                            "--die-with-parent",
                            "--filesystem=host",
                            "--allow=devel",
-                           # FIXME: --session-bus is only a workaround for https://github.com/flatpak/flatpak/pull/4630
-                           "--session-bus",
-                           "--no-a11y-bus",
-                           "--talk-name=org.a11y.Bus",
                            "--talk-name=org.gtk.vfs",
                            "--talk-name=org.gtk.vfs.*"]
 
+        flatpak_a11y_args = self.setup_a11y_proxy()
+        flatpak_command.extend(flatpak_a11y_args)
+
         if not gather_output and args and self.is_build_webkit(args[0]) and not self.is_branch_build():
             # Ensure self.build_path exists.
             try:
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to