Bug 1442419 - Fix failure to open files after downloading with snap r=jlorenzo
This fix does several things:
* Removes the mime cache generated by the desktop-gtk3 remote part
* Installs a stub shared-mime-info database
* Set default association for all types to use xdg-open
Note: There is still work[1] to be completed in snapd, adding OpenFile
support to xdg-open. Landing this is harmless though, it will fail
silently just as it does today but will start working when the snapd
feature lands.
1. https://github.com/snapcore/snapd/pull/4766
opening requested files,
MozReview-Commit-ID: 1eeOLeVN8xQ
new file mode 100644
--- /dev/null
+++ b/taskcluster/docker/firefox-snap/mime-handler.xml
@@ -0,0 +1,7 @@
+<mime-info
+ xmlns="http://www.freedesktop.org/standards/shared-mime-info">
+ <mime-type type="application/octet-stream">
+ <comment>Unknown</comment>
+ <glob pattern="*"/>
+ </mime-type>
+</mime-info>
new file mode 100644
--- /dev/null
+++ b/taskcluster/docker/firefox-snap/mimeapps.list
@@ -0,0 +1,4 @@
+[Default Applications]
+application/octet-stream=xdg-open.desktop
+text/plain=xdg-open.desktop
+inode/directory=xdg-open.desktop
--- a/taskcluster/docker/firefox-snap/snapcraft.yaml.in
+++ b/taskcluster/docker/firefox-snap/snapcraft.yaml.in
@@ -31,32 +31,55 @@ apps:
- x11
plugs:
browser-sandbox:
interface: browser-support
allow-sandbox: true
parts:
+ desktop-gtk3:
+ prime:
+ - -usr/share/mime
+
firefox:
plugin: dump
source: source
stage-packages:
- libxt6
- libdbus-glib-1-2
- libasound2
- libpulse0
- libgl1-mesa-dri
- libgl1-mesa-glx
- libmirclient9
- desktop-file-utils
- xdg-utils
- ffmpeg
after: [desktop-gtk3]
- optimization:
+ xdg-open:
after: [firefox]
plugin: nil
- stage-packages:
- - shared-mime-info
+ source: .
install: |
set -eux
+ mkdir -p $SNAPCRAFT_PART_INSTALL/usr/share/applications
+ install -m 644 mimeapps.list $SNAPCRAFT_PART_INSTALL/usr/share/applications
+ update-desktop-database -v $SNAPCRAFT_PART_INSTALL/usr/share/applications
+ build-packages:
+ - desktop-file-utils
+ build-attributes: [no-system-libraries]
+
+ shared-mime-info:
+ after: [xdg-open]
+ plugin: nil
+ source: .
+ build-packages:
+ - shared-mime-info
+ build-attributes: [no-system-libraries]
+ install: |
+ set -eux
+ mkdir -p $SNAPCRAFT_PART_INSTALL/usr/share/mime/packages
+ install -m 644 mime-handler.xml $SNAPCRAFT_PART_INSTALL/usr/share/mime/packages
update-mime-database $SNAPCRAFT_PART_INSTALL/usr/share/mime
+ stage:
+ - usr/share/mime